@weapp-vite/react 0.2.13 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/components.d.mts +1 -3
  2. package/dist/dev/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/defineProperty.mjs +1 -2
  3. package/dist/dev/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPrimitive.mjs +1 -2
  4. package/dist/dev/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPropertyKey.mjs +1 -2
  5. package/dist/dev/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/typeof.mjs +1 -2
  6. package/dist/dev/components.mjs +1 -2
  7. package/dist/dev/event.mjs +1 -2
  8. package/dist/dev/hostTree/index.mjs +2 -3
  9. package/dist/dev/hostTree/nodes.mjs +2 -3
  10. package/dist/dev/hostTree/serialization.mjs +1 -2
  11. package/dist/dev/hostTree/staticBindings.mjs +2 -3
  12. package/dist/dev/package.mjs +2 -3
  13. package/dist/dev/renderer.mjs +1 -2
  14. package/dist/hostTree/index.d.mts +1 -3
  15. package/dist/hostTree/index.mjs +1 -1
  16. package/dist/hostTree/nodes.d.mts +1 -3
  17. package/dist/hostTree/nodes.mjs +1 -1
  18. package/dist/hostTree/staticBindings.mjs +1 -1
  19. package/dist/package.mjs +1 -1
  20. package/dist/renderer.d.mts +1 -3
  21. package/dist/types.d.mts +1 -3
  22. package/package.json +4 -4
  23. /package/dist/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/defineProperty.mjs +0 -0
  24. /package/dist/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPrimitive.mjs +0 -0
  25. /package/dist/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPropertyKey.mjs +0 -0
  26. /package/dist/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/typeof.mjs +0 -0
@@ -1,10 +1,8 @@
1
1
  import { MiniProgramHostProps } from "./types.mjs";
2
- //#region src/components.d.ts
3
2
  export declare const Button: (props: MiniProgramHostProps) => import("react").ReactElement<MiniProgramHostProps, string | import("react").JSXElementConstructor<any>>;
4
3
  export declare const Input: (props: MiniProgramHostProps) => import("react").ReactElement<MiniProgramHostProps, string | import("react").JSXElementConstructor<any>>;
5
4
  export declare const Slot: (props: MiniProgramHostProps) => import("react").ReactElement<MiniProgramHostProps, string | import("react").JSXElementConstructor<any>>;
6
5
  export declare const Text: (props: MiniProgramHostProps) => import("react").ReactElement<MiniProgramHostProps, string | import("react").JSXElementConstructor<any>>;
7
6
  export declare const View: (props: MiniProgramHostProps) => import("react").ReactElement<MiniProgramHostProps, string | import("react").JSXElementConstructor<any>>;
8
7
  export type NativeComponentProps<Props extends object> = Props & Omit<MiniProgramHostProps, keyof Props>;
9
- export declare function createNativeComponent<Props extends object = Record<string, unknown>>(type: string): (props: NativeComponentProps<Props>) => import("react").DOMElement<Props & Omit<MiniProgramHostProps, keyof Props>, Element>;
10
- //#endregion
8
+ export declare function createNativeComponent<Props extends object = Record<string, unknown>>(type: string): (props: NativeComponentProps<Props>) => import("react").DOMElement<Props & Omit<MiniProgramHostProps, keyof Props>, Element>;
@@ -1,6 +1,6 @@
1
1
  import toPropertyKey from "./toPropertyKey.mjs";
2
2
 
3
- //#region \0@oxc-project+runtime@0.154.0/helpers/esm/defineProperty.js
3
+ // \0@oxc-project+runtime@0.155.0/helpers/esm/defineProperty.js
4
4
  function _defineProperty(e, r, t) {
5
5
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
6
6
  value: t,
@@ -10,5 +10,4 @@ function _defineProperty(e, r, t) {
10
10
  }) : e[r] = t, e;
11
11
  }
12
12
 
13
- //#endregion
14
13
  export { _defineProperty as default };
@@ -1,6 +1,6 @@
1
1
  import _typeof from "./typeof.mjs";
2
2
 
3
- //#region \0@oxc-project+runtime@0.154.0/helpers/esm/toPrimitive.js
3
+ // \0@oxc-project+runtime@0.155.0/helpers/esm/toPrimitive.js
4
4
  function toPrimitive(t, r) {
5
5
  if ("object" != _typeof(t) || !t) return t;
6
6
  var e = t[Symbol.toPrimitive];
@@ -12,5 +12,4 @@ function toPrimitive(t, r) {
12
12
  return ("string" === r ? String : Number)(t);
13
13
  }
14
14
 
15
- //#endregion
16
15
  export { toPrimitive as default };
@@ -1,11 +1,10 @@
1
1
  import _typeof from "./typeof.mjs";
2
2
  import toPrimitive from "./toPrimitive.mjs";
3
3
 
4
- //#region \0@oxc-project+runtime@0.154.0/helpers/esm/toPropertyKey.js
4
+ // \0@oxc-project+runtime@0.155.0/helpers/esm/toPropertyKey.js
5
5
  function toPropertyKey(t) {
6
6
  var i = toPrimitive(t, "string");
7
7
  return "symbol" == _typeof(i) ? i : i + "";
8
8
  }
9
9
 
10
- //#endregion
11
10
  export { toPropertyKey as default };
@@ -1,4 +1,4 @@
1
- //#region \0@oxc-project+runtime@0.154.0/helpers/esm/typeof.js
1
+ // \0@oxc-project+runtime@0.155.0/helpers/esm/typeof.js
2
2
  function _typeof(o) {
3
3
  "@babel/helpers - typeof";
4
4
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -8,5 +8,4 @@ function _typeof(o) {
8
8
  }, _typeof(o);
9
9
  }
10
10
 
11
- //#endregion
12
11
  export { _typeof as default };
@@ -1,6 +1,6 @@
1
1
  import { createElement } from "react";
2
2
 
3
- //#region src/components.ts
3
+ // src/components.ts
4
4
  function createHostComponent(type) {
5
5
  return function MiniProgramHostComponent(props) {
6
6
  return createElement(type, props);
@@ -18,6 +18,5 @@ function createNativeComponent(type) {
18
18
  };
19
19
  }
20
20
 
21
- //#endregion
22
21
  export { Button, Input, Slot, Text, View, createNativeComponent };
23
22
  //# sourceMappingURL=components.mjs.map
@@ -1,7 +1,7 @@
1
1
  import { HostElement } from "./hostTree/nodes.mjs";
2
2
  import { WEAPP_REACT_EVENT_DATASET_KEY } from "@weapp-core/constants";
3
3
 
4
- //#region src/event.ts
4
+ // src/event.ts
5
5
  function toEventPropName(type) {
6
6
  return `on${type.charAt(0).toUpperCase()}${type.slice(1)}`;
7
7
  }
@@ -51,6 +51,5 @@ function dispatchHostEvent(root, nativeEvent) {
51
51
  root.flush();
52
52
  }
53
53
 
54
- //#endregion
55
54
  export { dispatchHostEvent };
56
55
  //# sourceMappingURL=event.mjs.map
@@ -1,10 +1,10 @@
1
1
  import { hasSerializedPropChanges } from "./serialization.mjs";
2
- import _defineProperty from "../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/defineProperty.mjs";
2
+ import _defineProperty from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/defineProperty.mjs";
3
3
  import { HostElement, HostText, attachHostNode } from "./nodes.mjs";
4
4
  import { StaticBindingState, hasStaticBindingChanges, readStaticSlot } from "./staticBindings.mjs";
5
5
  import { WEAPP_REACT_ROOT_DATA_KEY, WEAPP_REACT_SLOTS_DATA_KEY } from "@weapp-core/constants";
6
6
 
7
- //#region src/hostTree/index.ts
7
+ // src/hostTree/index.ts
8
8
  var HostRoot = class HostRoot {
9
9
  constructor(adapter, renderMode = "tree") {
10
10
  _defineProperty(this, "children", []);
@@ -168,6 +168,5 @@ var HostRoot = class HostRoot {
168
168
  }
169
169
  };
170
170
 
171
- //#endregion
172
171
  export { HostElement, HostRoot, HostText };
173
172
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  import { serializeProps, serializeStyle } from "./serialization.mjs";
2
- import _defineProperty from "../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/defineProperty.mjs";
2
+ import _defineProperty from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/defineProperty.mjs";
3
3
 
4
- //#region src/hostTree/nodes.ts
4
+ // src/hostTree/nodes.ts
5
5
  function attach(parent, child, index) {
6
6
  if (child.parent) {
7
7
  const previousIndex = child.parent.children.indexOf(child);
@@ -92,6 +92,5 @@ function attachHostNode(parent, child, index) {
92
92
  attach(parent, child, index);
93
93
  }
94
94
 
95
- //#endregion
96
95
  export { HostElement, HostText, attachHostNode };
97
96
  //# sourceMappingURL=nodes.mjs.map
@@ -1,4 +1,4 @@
1
- //#region src/hostTree/serialization.ts
1
+ // src/hostTree/serialization.ts
2
2
  const UNITLESS_STYLE_PROPERTIES = /* @__PURE__ */ new Set([
3
3
  "flex",
4
4
  "flexGrow",
@@ -44,6 +44,5 @@ function hasSerializedPropChanges(previous, next) {
44
44
  return JSON.stringify(serializeProps(previous)) !== JSON.stringify(serializeProps(next));
45
45
  }
46
46
 
47
- //#endregion
48
47
  export { hasSerializedPropChanges, serializeProps, serializeStyle };
49
48
  //# sourceMappingURL=serialization.mjs.map
@@ -1,7 +1,7 @@
1
1
  import { serializeStyle } from "./serialization.mjs";
2
- import _defineProperty from "../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/defineProperty.mjs";
2
+ import _defineProperty from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/defineProperty.mjs";
3
3
 
4
- //#region src/hostTree/staticBindings.ts
4
+ // src/hostTree/staticBindings.ts
5
5
  function isTextNode(node) {
6
6
  return "value" in node;
7
7
  }
@@ -81,6 +81,5 @@ var StaticBindingState = class {
81
81
  }
82
82
  };
83
83
 
84
- //#endregion
85
84
  export { StaticBindingState, hasStaticBindingChanges, readStaticBindingFields, readStaticSlot };
86
85
  //# sourceMappingURL=staticBindings.mjs.map
@@ -1,7 +1,6 @@
1
- //#region package.json
1
+ // package.json
2
2
  var name = "@weapp-vite/react";
3
- var version = "0.2.13";
3
+ var version = "0.3.0";
4
4
 
5
- //#endregion
6
5
  export { name, version };
7
6
  //# sourceMappingURL=package.mjs.map
@@ -6,7 +6,7 @@ import { createContext } from "react";
6
6
  import Reconciler from "react-reconciler";
7
7
  import { DefaultEventPriority, NoEventPriority } from "react-reconciler/constants.js";
8
8
 
9
- //#region src/renderer.ts
9
+ // src/renderer.ts
10
10
  function propsChanged(previous, next) {
11
11
  const previousKeys = Object.keys(previous).filter((key) => key !== "children");
12
12
  const nextKeys = Object.keys(next).filter((key) => key !== "children");
@@ -209,6 +209,5 @@ function createReactMiniProgramRoot(adapter, options = {}) {
209
209
  };
210
210
  }
211
211
 
212
- //#endregion
213
212
  export { createReactMiniProgramRoot };
214
213
  //# sourceMappingURL=renderer.mjs.map
@@ -2,7 +2,6 @@ import { HostProps, MiniProgramPageAdapter, SerializedHostNode } from "../types.
2
2
  import { HostElement, HostNode, HostParent, HostText } from "./nodes.mjs";
3
3
  import "./serialization.mjs";
4
4
  import "../index.mjs";
5
- //#region src/hostTree/index.d.ts
6
5
  export type HostRenderMode = 'static-bindings' | 'tree';
7
6
  export declare class HostRoot {
8
7
  readonly children: HostNode[];
@@ -43,5 +42,4 @@ export declare class HostRoot {
43
42
  private staticElements;
44
43
  private flushStaticBindings;
45
44
  flush(): void;
46
- }
47
- //#endregion
45
+ }
@@ -1 +1 @@
1
- import{hasSerializedPropChanges as e}from"./serialization.mjs";import t from"../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/defineProperty.mjs";import{HostElement as n,HostText as r,attachHostNode as i}from"./nodes.mjs";import{StaticBindingState as a,hasStaticBindingChanges as o,readStaticSlot as s}from"./staticBindings.mjs";import{WEAPP_REACT_ROOT_DATA_KEY as c,WEAPP_REACT_SLOTS_DATA_KEY as l}from"@weapp-core/constants";var u=class r{constructor(e,n=`tree`){t(this,`children`,[]),t(this,`renderMode`,void 0),t(this,`dirtyNodes`,/* @__PURE__ */ new Set),t(this,`dirtyStructures`,/* @__PURE__ */ new Set),t(this,`mounted`,!1),t(this,`nodeId`,0),t(this,`nodes`,/* @__PURE__ */ new Map),t(this,`pendingFlush`,!1),t(this,`adapter`,void 0),t(this,`staticBindings`,new a),t(this,`staticMismatch`,void 0),t(this,`unmounting`,!1),this.adapter=e,this.renderMode=n}beginUnmount(){this.unmounting=!0}assertStaticTemplateValid(){if(!this.staticMismatch)return;let e=this.staticMismatch;throw this.staticMismatch=void 0,e}createElementSid(e){return this.renderMode===`static-bindings`?s(e):this.nextSid()}nextSid(){return this.nodeId+=1,`r${this.nodeId}`}register(e){if(this.renderMode===`static-bindings`&&e instanceof n&&this.nodes.has(e.sid))throw Error(`static template slot 冲突:${e.sid}`);this.nodes.set(e.sid,e)}unregisterTree(e){this.nodes.delete(e.sid),e instanceof n&&e.children.forEach(e=>this.unregisterTree(e))}getNode(e){return this.nodes.get(e)}append(e){i(this,e),this.markStructure(this)}insertBefore(e,t){let n=this.children.indexOf(t);i(this,e,n<0?void 0:n),this.markStructure(this)}remove(e){let t=this.children.indexOf(e);t<0||(this.children.splice(t,1),e.parent=null,this.unregisterTree(e),this.markStructure(this))}clear(){this.children.forEach(e=>this.unregisterTree(e)),this.children.length=0,this.markStructure(this)}markNode(e){this.dirtyNodes.add(e),this.scheduleFlush()}markElementProps(e,t,n){this.renderMode===`static-bindings`?(this.staticBindings.markProps(e,t,n),this.scheduleFlush()):this.markNode(e)}markStaticText(e){this.staticBindings.markField(e,`text`),this.scheduleFlush()}markStructure(e){this.renderMode===`static-bindings`?this.mounted&&!this.unmounting&&(this.staticMismatch=/* @__PURE__ */ Error(`static template 运行时结构发生变化,需要切换 dynamic island fallback`)):(this.dirtyStructures.add(e),this.scheduleFlush())}scheduleFlush(){this.pendingFlush||(this.pendingFlush=!0,Promise.resolve().then(()=>this.flush()))}pathOf(e){if(e instanceof r)return`root`;let t=e.parent;if(!t)return;let n=this.pathOf(t),i=t.children.indexOf(e);return n&&i>=0?`${n}.cn[${i}]`:void 0}hasStructuralAncestor(e){let t=e.parent;for(;t;){if(this.dirtyStructures.has(t))return!0;t=t instanceof n?t.parent:null}return!1}snapshot(){return{cn:this.children.map(e=>e.serialize())}}shouldNotifyPropUpdate(t,n){return this.renderMode===`static-bindings`?o(t,n):e(t,n)}staticElements(){return Array.from(this.nodes.values()).filter(e=>e instanceof n)}flushStaticBindings(){if(this.staticMismatch){this.staticBindings.clear();return}if(!this.mounted){this.mounted=!0,this.staticBindings.clear(),this.adapter.setData({[l]:this.staticBindings.snapshot(this.staticElements())});return}let e=this.staticBindings.takePayload();Object.keys(e).length>0&&!this.unmounting&&this.adapter.setData(e)}flush(){if(this.pendingFlush=!1,this.renderMode===`static-bindings`){this.flushStaticBindings();return}if(!this.mounted){this.mounted=!0,this.dirtyNodes.clear(),this.dirtyStructures.clear(),this.adapter.setData({[c]:this.snapshot()});return}let e={};for(let t of this.dirtyStructures){let n=this.pathOf(t);n&&(e[`${n}.cn`]=t.children.map(e=>e.serialize()))}for(let t of this.dirtyNodes){if(this.hasStructuralAncestor(t))continue;let n=this.pathOf(t);n&&(e[n]=t.serialize())}this.dirtyNodes.clear(),this.dirtyStructures.clear(),Object.keys(e).length>0&&this.adapter.setData(e)}};export{n as HostElement,u as HostRoot,r as HostText};
1
+ import{hasSerializedPropChanges as e}from"./serialization.mjs";import t from"../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/defineProperty.mjs";import{HostElement as n,HostText as r,attachHostNode as i}from"./nodes.mjs";import{StaticBindingState as a,hasStaticBindingChanges as o,readStaticSlot as s}from"./staticBindings.mjs";import{WEAPP_REACT_ROOT_DATA_KEY as c,WEAPP_REACT_SLOTS_DATA_KEY as l}from"@weapp-core/constants";var u=class r{constructor(e,n=`tree`){t(this,`children`,[]),t(this,`renderMode`,void 0),t(this,`dirtyNodes`,/* @__PURE__ */ new Set),t(this,`dirtyStructures`,/* @__PURE__ */ new Set),t(this,`mounted`,!1),t(this,`nodeId`,0),t(this,`nodes`,/* @__PURE__ */ new Map),t(this,`pendingFlush`,!1),t(this,`adapter`,void 0),t(this,`staticBindings`,new a),t(this,`staticMismatch`,void 0),t(this,`unmounting`,!1),this.adapter=e,this.renderMode=n}beginUnmount(){this.unmounting=!0}assertStaticTemplateValid(){if(!this.staticMismatch)return;let e=this.staticMismatch;throw this.staticMismatch=void 0,e}createElementSid(e){return this.renderMode===`static-bindings`?s(e):this.nextSid()}nextSid(){return this.nodeId+=1,`r${this.nodeId}`}register(e){if(this.renderMode===`static-bindings`&&e instanceof n&&this.nodes.has(e.sid))throw Error(`static template slot 冲突:${e.sid}`);this.nodes.set(e.sid,e)}unregisterTree(e){this.nodes.delete(e.sid),e instanceof n&&e.children.forEach(e=>this.unregisterTree(e))}getNode(e){return this.nodes.get(e)}append(e){i(this,e),this.markStructure(this)}insertBefore(e,t){let n=this.children.indexOf(t);i(this,e,n<0?void 0:n),this.markStructure(this)}remove(e){let t=this.children.indexOf(e);t<0||(this.children.splice(t,1),e.parent=null,this.unregisterTree(e),this.markStructure(this))}clear(){this.children.forEach(e=>this.unregisterTree(e)),this.children.length=0,this.markStructure(this)}markNode(e){this.dirtyNodes.add(e),this.scheduleFlush()}markElementProps(e,t,n){this.renderMode===`static-bindings`?(this.staticBindings.markProps(e,t,n),this.scheduleFlush()):this.markNode(e)}markStaticText(e){this.staticBindings.markField(e,`text`),this.scheduleFlush()}markStructure(e){this.renderMode===`static-bindings`?this.mounted&&!this.unmounting&&(this.staticMismatch=/* @__PURE__ */ Error(`static template 运行时结构发生变化,需要切换 dynamic island fallback`)):(this.dirtyStructures.add(e),this.scheduleFlush())}scheduleFlush(){this.pendingFlush||(this.pendingFlush=!0,Promise.resolve().then(()=>this.flush()))}pathOf(e){if(e instanceof r)return`root`;let t=e.parent;if(!t)return;let n=this.pathOf(t),i=t.children.indexOf(e);return n&&i>=0?`${n}.cn[${i}]`:void 0}hasStructuralAncestor(e){let t=e.parent;for(;t;){if(this.dirtyStructures.has(t))return!0;t=t instanceof n?t.parent:null}return!1}snapshot(){return{cn:this.children.map(e=>e.serialize())}}shouldNotifyPropUpdate(t,n){return this.renderMode===`static-bindings`?o(t,n):e(t,n)}staticElements(){return Array.from(this.nodes.values()).filter(e=>e instanceof n)}flushStaticBindings(){if(this.staticMismatch){this.staticBindings.clear();return}if(!this.mounted){this.mounted=!0,this.staticBindings.clear(),this.adapter.setData({[l]:this.staticBindings.snapshot(this.staticElements())});return}let e=this.staticBindings.takePayload();Object.keys(e).length>0&&!this.unmounting&&this.adapter.setData(e)}flush(){if(this.pendingFlush=!1,this.renderMode===`static-bindings`){this.flushStaticBindings();return}if(!this.mounted){this.mounted=!0,this.dirtyNodes.clear(),this.dirtyStructures.clear(),this.adapter.setData({[c]:this.snapshot()});return}let e={};for(let t of this.dirtyStructures){let n=this.pathOf(t);n&&(e[`${n}.cn`]=t.children.map(e=>e.serialize()))}for(let t of this.dirtyNodes){if(this.hasStructuralAncestor(t))continue;let n=this.pathOf(t);n&&(e[n]=t.serialize())}this.dirtyNodes.clear(),this.dirtyStructures.clear(),Object.keys(e).length>0&&this.adapter.setData(e)}};export{n as HostElement,u as HostRoot,r as HostText};
@@ -1,6 +1,5 @@
1
1
  import { HostProps, SerializedHostNode } from "../types.mjs";
2
2
  import { HostRoot } from "./index.mjs";
3
- //#region src/hostTree/nodes.d.ts
4
3
  export type HostParent = HostElement | HostRoot;
5
4
  export type HostNode = HostElement | HostText;
6
5
  export declare class HostText {
@@ -25,5 +24,4 @@ export declare class HostElement {
25
24
  remove(child: HostNode): void;
26
25
  serialize(): SerializedHostNode;
27
26
  updateProps(props: HostProps, notify?: boolean): void;
28
- }
29
- //#endregion
27
+ }
@@ -1 +1 @@
1
- import{serializeProps as e,serializeStyle as t}from"./serialization.mjs";import n from"../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/defineProperty.mjs";function r(e,t,n){if(t.parent){let e=t.parent.children.indexOf(t);e>=0&&t.parent.children.splice(e,1)}t.parent=e,n===void 0?e.children.push(t):e.children.splice(n,0,t)}var i=class{constructor(e,t,r){n(this,`parent`,null),n(this,`root`,void 0),n(this,`sid`,void 0),n(this,`value`,void 0),this.root=e,this.sid=t,this.value=r,e.register(this)}serialize(){return{nn:`#text`,sid:this.sid,v:this.value}}setValue(e){e!==this.value&&(this.value=e,this.root.renderMode===`static-bindings`&&this.parent&&`props`in this.parent?this.root.markStaticText(this.parent):this.root.markNode(this))}},a=class{constructor(e,t,r,i){n(this,`children`,[]),n(this,`parent`,null),n(this,`props`,void 0),n(this,`root`,void 0),n(this,`sid`,void 0),n(this,`type`,void 0),this.props=i,this.root=e,this.sid=t,this.type=r,e.register(this)}append(e,t=!0){r(this,e),t&&this.root.markStructure(this)}insertBefore(e,t){let n=this.children.indexOf(t);r(this,e,n<0?void 0:n),this.root.markStructure(this)}remove(e){let t=this.children.indexOf(e);t<0||(this.children.splice(t,1),e.parent=null,this.root.unregisterTree(e),this.root.markStructure(this))}serialize(){var n;let r=(n=this.props.className)==null?this.props.class:n,i={nn:this.type,sid:this.sid};this.children.length>0&&(i.cn=this.children.map(e=>e.serialize())),typeof r==`string`&&r&&(i.cl=r);let a=t(this.props.style);a&&(i.st=a);let o=e(this.props);return o&&(i.p=o),i}updateProps(e,t=!0){let n=this.props;this.props=e,t&&this.root.markElementProps(this,n,e)}};function o(e,t,n){r(e,t,n)}export{a as HostElement,i as HostText,o as attachHostNode};
1
+ import{serializeProps as e,serializeStyle as t}from"./serialization.mjs";import n from"../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/defineProperty.mjs";function r(e,t,n){if(t.parent){let e=t.parent.children.indexOf(t);e>=0&&t.parent.children.splice(e,1)}t.parent=e,n===void 0?e.children.push(t):e.children.splice(n,0,t)}var i=class{constructor(e,t,r){n(this,`parent`,null),n(this,`root`,void 0),n(this,`sid`,void 0),n(this,`value`,void 0),this.root=e,this.sid=t,this.value=r,e.register(this)}serialize(){return{nn:`#text`,sid:this.sid,v:this.value}}setValue(e){e!==this.value&&(this.value=e,this.root.renderMode===`static-bindings`&&this.parent&&`props`in this.parent?this.root.markStaticText(this.parent):this.root.markNode(this))}},a=class{constructor(e,t,r,i){n(this,`children`,[]),n(this,`parent`,null),n(this,`props`,void 0),n(this,`root`,void 0),n(this,`sid`,void 0),n(this,`type`,void 0),this.props=i,this.root=e,this.sid=t,this.type=r,e.register(this)}append(e,t=!0){r(this,e),t&&this.root.markStructure(this)}insertBefore(e,t){let n=this.children.indexOf(t);r(this,e,n<0?void 0:n),this.root.markStructure(this)}remove(e){let t=this.children.indexOf(e);t<0||(this.children.splice(t,1),e.parent=null,this.root.unregisterTree(e),this.root.markStructure(this))}serialize(){var n;let r=(n=this.props.className)==null?this.props.class:n,i={nn:this.type,sid:this.sid};this.children.length>0&&(i.cn=this.children.map(e=>e.serialize())),typeof r==`string`&&r&&(i.cl=r);let a=t(this.props.style);a&&(i.st=a);let o=e(this.props);return o&&(i.p=o),i}updateProps(e,t=!0){let n=this.props;this.props=e,t&&this.root.markElementProps(this,n,e)}};function o(e,t,n){r(e,t,n)}export{a as HostElement,i as HostText,o as attachHostNode};
@@ -1 +1 @@
1
- import{serializeStyle as e}from"./serialization.mjs";import t from"../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/defineProperty.mjs";function n(e){return`value`in e}function r(e){return n(e)?e.value:e.children.map(r).join(``)}function i(e){let t=e.__bindingFields;return typeof t==`string`&&t?t.split(`,`).filter(Boolean):[]}function a(e){let t=e.__slot;if(typeof t!=`string`||!t)throw Error(`static template host node 缺少编译期 __slot`);return t}function o(t,n,i=t.props){if(n===`text`)return t.children.map(r).join(``);if(n===`className`){var a,o;return(a=(o=i.className)==null?i.class:o)==null?``:a}if(n===`style`){var s;return(s=e(i.style))==null?``:s}return i[n]}function s(t,n){return i(n).some(r=>{if(r===`text`)return!1;if(r===`className`){var i,a;return((i=t.className)==null?t.class:i)!==((a=n.className)==null?n.class:a)}return r===`style`?e(t.style)!==e(n.style):t[r]!==n[r]})}var c=class{constructor(){t(this,`dirty`,/* @__PURE__ */ new Map)}clear(){this.dirty.clear()}markField(e,t){let n=this.dirty.get(e);n||(n=/* @__PURE__ */ new Set,this.dirty.set(e,n)),n.add(t)}markProps(e,t,n){for(let r of i(n))r!==`text`&&o(e,r,t)!==o(e,r,n)&&this.markField(e,r)}snapshot(e){let t={};for(let n of e){let e=i(n.props);if(e.length===0)continue;let r={};for(let t of e)r[t]=o(n,t);t[n.sid]=r}return t}takePayload(){let e={};for(let[t,n]of this.dirty)for(let r of n)e[`slots.${t.sid}.${r}`]=o(t,r);return this.dirty.clear(),e}};export{c as StaticBindingState,s as hasStaticBindingChanges,i as readStaticBindingFields,a as readStaticSlot};
1
+ import{serializeStyle as e}from"./serialization.mjs";import t from"../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/defineProperty.mjs";function n(e){return`value`in e}function r(e){return n(e)?e.value:e.children.map(r).join(``)}function i(e){let t=e.__bindingFields;return typeof t==`string`&&t?t.split(`,`).filter(Boolean):[]}function a(e){let t=e.__slot;if(typeof t!=`string`||!t)throw Error(`static template host node 缺少编译期 __slot`);return t}function o(t,n,i=t.props){if(n===`text`)return t.children.map(r).join(``);if(n===`className`){var a,o;return(a=(o=i.className)==null?i.class:o)==null?``:a}if(n===`style`){var s;return(s=e(i.style))==null?``:s}return i[n]}function s(t,n){return i(n).some(r=>{if(r===`text`)return!1;if(r===`className`){var i,a;return((i=t.className)==null?t.class:i)!==((a=n.className)==null?n.class:a)}return r===`style`?e(t.style)!==e(n.style):t[r]!==n[r]})}var c=class{constructor(){t(this,`dirty`,/* @__PURE__ */ new Map)}clear(){this.dirty.clear()}markField(e,t){let n=this.dirty.get(e);n||(n=/* @__PURE__ */ new Set,this.dirty.set(e,n)),n.add(t)}markProps(e,t,n){for(let r of i(n))r!==`text`&&o(e,r,t)!==o(e,r,n)&&this.markField(e,r)}snapshot(e){let t={};for(let n of e){let e=i(n.props);if(e.length===0)continue;let r={};for(let t of e)r[t]=o(n,t);t[n.sid]=r}return t}takePayload(){let e={};for(let[t,n]of this.dirty)for(let r of n)e[`slots.${t.sid}.${r}`]=o(t,r);return this.dirty.clear(),e}};export{c as StaticBindingState,s as hasStaticBindingChanges,i as readStaticBindingFields,a as readStaticSlot};
package/dist/package.mjs CHANGED
@@ -1 +1 @@
1
- var e=`@weapp-vite/react`,t=`0.2.13`;export{e as name,t as version};
1
+ var e=`@weapp-vite/react`,t=`0.3.0`;export{e as name,t as version};
@@ -1,7 +1,6 @@
1
1
  import { MiniProgramEventLike, MiniProgramPageAdapter } from "./types.mjs";
2
2
  import { HostRenderMode, HostRoot } from "./hostTree/index.mjs";
3
3
  import { ReactNode } from "react";
4
- //#region src/renderer.d.ts
5
4
  export interface ReactMiniProgramRoot {
6
5
  dispatchEvent: (event: MiniProgramEventLike) => void;
7
6
  flush: () => void;
@@ -12,5 +11,4 @@ export interface ReactMiniProgramRoot {
12
11
  export interface ReactMiniProgramRootOptions {
13
12
  renderMode?: HostRenderMode;
14
13
  }
15
- export declare function createReactMiniProgramRoot(adapter: MiniProgramPageAdapter, options?: ReactMiniProgramRootOptions): ReactMiniProgramRoot;
16
- //#endregion
14
+ export declare function createReactMiniProgramRoot(adapter: MiniProgramPageAdapter, options?: ReactMiniProgramRootOptions): ReactMiniProgramRoot;
package/dist/types.d.mts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { ReactNode } from "react";
2
- //#region src/types.d.ts
3
2
  export interface MiniProgramEventLike {
4
3
  currentTarget?: {
5
4
  dataset?: Record<string, unknown>;
@@ -45,5 +44,4 @@ export type HostEventHandler = (event: {
45
44
  stopPropagation: () => void;
46
45
  target: unknown;
47
46
  type: string;
48
- }) => unknown;
49
- //#endregion
47
+ }) => unknown;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@weapp-vite/react",
3
3
  "type": "module",
4
- "version": "0.2.13",
4
+ "version": "0.3.0",
5
5
  "description": "React 19 runtime for weapp-vite mini programs",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/weapp-vite/weapp-vite#readme",
@@ -49,7 +49,7 @@
49
49
  "dist"
50
50
  ],
51
51
  "engines": {
52
- "node": "^20.19.0 || >=22.12.0"
52
+ "node": "^22.23.4 || ^24.22.1 || >=26.12.1"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public",
@@ -61,11 +61,11 @@
61
61
  "react-reconciler": "0.34.0"
62
62
  },
63
63
  "dependencies": {
64
- "@weapp-core/constants": "0.4.0"
64
+ "@weapp-core/constants": "0.5.0"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@types/react": "19.3.0",
68
- "@types/react-reconciler": "0.34.0",
68
+ "@types/react-reconciler": "0.34.1",
69
69
  "miniprogram-api-typings": "^5.2.3",
70
70
  "react": "19.3.1",
71
71
  "react-reconciler": "0.34.0"