diff --git a/.changeset/tall-taxis-laugh.md b/.changeset/tall-taxis-laugh.md new file mode 100644 index 0000000000..853d812bb3 --- /dev/null +++ b/.changeset/tall-taxis-laugh.md @@ -0,0 +1,3 @@ +--- + +--- diff --git a/packages/react/runtime/lazy/internal.js b/packages/react/runtime/lazy/internal.js index c9bb4ce2bb..8093ba94c9 100644 --- a/packages/react/runtime/lazy/internal.js +++ b/packages/react/runtime/lazy/internal.js @@ -6,7 +6,15 @@ import { sExportsReactInternal, target } from './target.js'; export const { BackgroundSnapshotInstance, + CHILDREN, + COMPONENT, Component, + DIFF, + DIRTY, + DOM, + FLAGS, + INDEX, + PARENT, __ComponentIsPolyfill, __DynamicPartChildren, __DynamicPartChildren_0, diff --git a/packages/react/runtime/lepus/jsx-runtime/index.js b/packages/react/runtime/lepus/jsx-runtime/index.js index 687bacc411..e5a4d803eb 100644 --- a/packages/react/runtime/lepus/jsx-runtime/index.js +++ b/packages/react/runtime/lepus/jsx-runtime/index.js @@ -1,7 +1,7 @@ // Copyright 2024 The Lynx Authors. All rights reserved. // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. -import { SnapshotInstance } from '@lynx-js/react/internal'; +import { CHILDREN, COMPONENT, DIFF, DIRTY, DOM, FLAGS, INDEX, PARENT, SnapshotInstance } from '@lynx-js/react/internal'; function createVNode(type, props, _key) { if (typeof type === 'string') { @@ -9,15 +9,15 @@ function createVNode(type, props, _key) { r.props = props; - r.__k = null; - r.__ = null; - r.__b = 0; - r.__e = null; - r.__d = undefined; - r.__c = null; + r[CHILDREN] = null; + r[PARENT] = null; + r[DIFF] = 0; + r[DOM] = null; + r[DIRTY] = undefined; + r[COMPONENT] = null; // r.__v = --vnodeId; - r.__i = -1; - r.__u = 0; + r[INDEX] = -1; + r[FLAGS] = 0; return r; } else if (typeof type === 'function') { @@ -48,16 +48,16 @@ function createVNode(type, props, _key) { type, props: normalizedProps, - __k: null, - __: null, - __b: 0, - __e: null, - __d: void 0, - __c: null, + [CHILDREN]: null, + [PARENT]: null, + [DIFF]: 0, + [DOM]: null, + [DIRTY]: void 0, + [COMPONENT]: null, constructor: void 0, // __v: --vnodeId, - __i: -1, - __u: 0, + [INDEX]: -1, + [FLAGS]: 0, }; } } diff --git a/packages/react/runtime/src/internal.ts b/packages/react/runtime/src/internal.ts index 8aaaa9c863..043b77c151 100644 --- a/packages/react/runtime/src/internal.ts +++ b/packages/react/runtime/src/internal.ts @@ -17,6 +17,8 @@ import { DynamicPartType } from './snapshot/dynamicPartType.js'; import { snapshotCreateList } from './snapshot/list.js'; import { SnapshotInstance, snapshotCreatorMap } from './snapshot/snapshot.js'; +export { CHILDREN, COMPONENT, DIFF, DIRTY, DOM, FLAGS, INDEX, PARENT } from './renderToOpcodes/constants.js'; + export { __page, __pageId, __root }; export { diff --git a/packages/react/runtime/src/renderToOpcodes/constants.ts b/packages/react/runtime/src/renderToOpcodes/constants.ts index b3e89c66aa..40e14d5585 100644 --- a/packages/react/runtime/src/renderToOpcodes/constants.ts +++ b/packages/react/runtime/src/renderToOpcodes/constants.ts @@ -18,6 +18,8 @@ export const PARENT = '__'; export const MASK = '__m'; export const DOM = '__e'; export const ORIGINAL = '__v'; +export const INDEX = '__i'; +export const FLAGS = '__u'; // Component properties export const VNODE = '__v';