npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

egreact

v1.4.9

Published

A react render for egret 一个为 egret 而生的 react 渲染器

Downloads

146

Readme

egreact

介绍

一个为 egret 而生的 react渲染器。

功能

  • 混合开发,用 react 开发 egret 应用的 UI,还支持 redux,react-router 等库,支持 react-devtool 查看和选择组件。
  • 完备的 TypeScript 支持,编写 egreact 时处处有 TypeScript 提示,给予最好的开发体验
  • 自定义原生组件,开放自定义原生组件的接口,可以自行拓展原生组件,拓宽组件的描述能力。

使用和指引

为了体验大量在线实例,建议您阅读文档

快速开始

在 react-dom 环境 和 egret 环境下,

pnpm i egreact
import React from 'react'
import { Egreact } from 'egreact'

export default () => (
  <Egreact>
    <sprite
      graphics={[
        ['beginFill', 0x000000],
        ['drawRect', 0, 0, 300, 100],
        ['endFill'],
      ]}>
      <textField size={16}>Hello, egreact</textField>
    </sprite>
  </Egreact>
)

或者在 egret 中像皮肤一样使用

import { createEgreactRoot } from 'egreact'
class ReactRender extends egret.DisplayObjectContainer {
  root = createEgreactRoot(this)
  constructor(reactNode: React.ReactNode) {
    super()
    this.addEventListener(egret.Event.ADDED, () => this.root.render(reactNode), this)
    this.addEventListener(egret.Event.REMOVED, () => this.root.unmount(), this)
  }
}
const displayObjectContainer = new egret.displayObjectContainer();
displayObjectContainer.addChild(new ReactRender(
    <sprite
      graphics={[
        ['beginFill', 0x000000],
        ['drawRect', 0, 0, 300, 100],
        ['endFill'],
      ]}>
      <textField size={16}>Hello, egreact</textField>
    </sprite>  
))
core
├─ src
│  ├─ Components                自定义组件
│  ├─ Host                      定义原生组件
│  ├─ constants.ts              定义常量
│  ├─ devtool.ts                react devtool 的 hack 逻辑
│  ├─ index.ts 
│  ├─ outside.ts                外部逻辑
│  ├─ renderer                  定义 renderer
│  │  ├─ create.ts              createEgreact 相关 
│  │  └─ index.ts               定义 HostConfig
│  │  └─ utils
│  │     ├─ attach.ts           attachInfo 给实例附加信息
│  │     ├─ index.ts            
│  │     └─ props.ts            对比属性和应用变更
│  ├─ type.ts                   类型定义
│  └─ utils
│     └─ index.ts