@lynx-js/react 0.120.0 → 0.121.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.
- package/CHANGELOG.md +52 -0
- package/package.json +35 -7
- package/runtime/lazy/compat.js +1 -0
- package/runtime/lazy/react.js +1 -0
- package/runtime/lib/core/hooks/mainThread.d.ts +1 -0
- package/runtime/lib/core/hooks/mainThread.js +7 -0
- package/runtime/lib/core/hooks/mainThread.js.map +1 -0
- package/runtime/lib/{snapshot/hooks/mainThread.d.ts → core/hooks/mainThreadImpl.d.ts} +2 -1
- package/runtime/lib/{snapshot/hooks/mainThread.js → core/hooks/mainThreadImpl.js} +45 -34
- package/runtime/lib/core/hooks/mainThreadImpl.js.map +1 -0
- package/runtime/lib/{snapshot → core}/hooks/react.js +1 -1
- package/runtime/lib/core/hooks/react.js.map +1 -0
- package/runtime/lib/{snapshot → core}/hooks/useLynxGlobalEventListener.d.ts +1 -1
- package/runtime/lib/{snapshot → core}/hooks/useLynxGlobalEventListener.js +1 -1
- package/runtime/lib/core/hooks/useLynxGlobalEventListener.js.map +1 -0
- package/runtime/lib/element-template/background/attr-slots.d.ts +2 -0
- package/runtime/lib/element-template/background/attr-slots.js +34 -0
- package/runtime/lib/element-template/background/attr-slots.js.map +1 -0
- package/runtime/lib/element-template/background/commit-context.d.ts +13 -0
- package/runtime/lib/element-template/background/commit-context.js +25 -0
- package/runtime/lib/element-template/background/commit-context.js.map +1 -0
- package/runtime/lib/element-template/background/commit-hook.d.ts +7 -0
- package/runtime/lib/element-template/background/commit-hook.js +96 -0
- package/runtime/lib/element-template/background/commit-hook.js.map +1 -0
- package/runtime/lib/element-template/background/destroy.d.ts +1 -0
- package/runtime/lib/element-template/background/destroy.js +17 -0
- package/runtime/lib/element-template/background/destroy.js.map +1 -0
- package/runtime/lib/element-template/background/document.d.ts +7 -0
- package/runtime/lib/element-template/background/document.js +27 -0
- package/runtime/lib/element-template/background/document.js.map +1 -0
- package/runtime/lib/element-template/background/hydrate.d.ts +4 -0
- package/runtime/lib/element-template/background/hydrate.js +219 -0
- package/runtime/lib/element-template/background/hydrate.js.map +1 -0
- package/runtime/lib/element-template/background/hydration-listener.d.ts +2 -0
- package/runtime/lib/element-template/background/hydration-listener.js +93 -0
- package/runtime/lib/element-template/background/hydration-listener.js.map +1 -0
- package/runtime/lib/element-template/background/instance.d.ts +39 -0
- package/runtime/lib/element-template/background/instance.js +349 -0
- package/runtime/lib/element-template/background/instance.js.map +1 -0
- package/runtime/lib/element-template/background/manager.d.ts +10 -0
- package/runtime/lib/element-template/background/manager.js +60 -0
- package/runtime/lib/element-template/background/manager.js.map +1 -0
- package/runtime/lib/element-template/client/root.d.ts +36 -0
- package/runtime/lib/element-template/client/root.js +33 -0
- package/runtime/lib/element-template/client/root.js.map +1 -0
- package/runtime/lib/element-template/debug/alog.d.ts +34 -0
- package/runtime/lib/element-template/debug/alog.js +93 -0
- package/runtime/lib/element-template/debug/alog.js.map +1 -0
- package/runtime/lib/element-template/debug/elementPAPICall.d.ts +1 -0
- package/runtime/lib/element-template/debug/elementPAPICall.js +75 -0
- package/runtime/lib/element-template/debug/elementPAPICall.js.map +1 -0
- package/runtime/lib/element-template/debug/profile.d.ts +3 -0
- package/runtime/lib/element-template/debug/profile.js +141 -0
- package/runtime/lib/element-template/debug/profile.js.map +1 -0
- package/runtime/lib/element-template/hooks/react.d.ts +14 -0
- package/runtime/lib/element-template/hooks/react.js +24 -0
- package/runtime/lib/element-template/hooks/react.js.map +1 -0
- package/runtime/lib/element-template/index.d.ts +7 -0
- package/runtime/lib/element-template/index.js +45 -0
- package/runtime/lib/element-template/index.js.map +1 -0
- package/runtime/lib/element-template/internal.d.ts +6 -0
- package/runtime/lib/element-template/internal.js +44 -0
- package/runtime/lib/element-template/internal.js.map +1 -0
- package/runtime/lib/element-template/jsx-dev-runtime/index.d.ts +1 -0
- package/runtime/lib/element-template/jsx-dev-runtime/index.js +5 -0
- package/runtime/lib/element-template/jsx-dev-runtime/index.js.map +1 -0
- package/runtime/lib/element-template/jsx-runtime/index.d.ts +19 -0
- package/runtime/lib/element-template/jsx-runtime/index.js +60 -0
- package/runtime/lib/element-template/jsx-runtime/index.js.map +1 -0
- package/runtime/lib/element-template/lynx/env.d.ts +1 -0
- package/runtime/lib/element-template/lynx/env.js +89 -0
- package/runtime/lib/element-template/lynx/env.js.map +1 -0
- package/runtime/lib/element-template/lynx/performance.d.ts +23 -0
- package/runtime/lib/element-template/lynx/performance.js +135 -0
- package/runtime/lib/element-template/lynx/performance.js.map +1 -0
- package/runtime/lib/element-template/native/callDestroyLifetimeFun.d.ts +1 -0
- package/runtime/lib/element-template/native/callDestroyLifetimeFun.js +8 -0
- package/runtime/lib/element-template/native/callDestroyLifetimeFun.js.map +1 -0
- package/runtime/lib/element-template/native/index.d.ts +1 -0
- package/runtime/lib/element-template/native/index.js +53 -0
- package/runtime/lib/element-template/native/index.js.map +1 -0
- package/runtime/lib/element-template/native/main-thread-api.d.ts +2 -0
- package/runtime/lib/element-template/native/main-thread-api.js +27 -0
- package/runtime/lib/element-template/native/main-thread-api.js.map +1 -0
- package/runtime/lib/element-template/native/mts-destroy.d.ts +3 -0
- package/runtime/lib/element-template/native/mts-destroy.js +37 -0
- package/runtime/lib/element-template/native/mts-destroy.js.map +1 -0
- package/runtime/lib/element-template/native/patch-listener.d.ts +2 -0
- package/runtime/lib/element-template/native/patch-listener.js +66 -0
- package/runtime/lib/element-template/native/patch-listener.js.map +1 -0
- package/runtime/lib/element-template/prop-adapters/event-value.d.ts +1 -0
- package/runtime/lib/element-template/prop-adapters/event-value.js +7 -0
- package/runtime/lib/element-template/prop-adapters/event-value.js.map +1 -0
- package/runtime/lib/element-template/prop-adapters/event.d.ts +7 -0
- package/runtime/lib/element-template/prop-adapters/event.js +61 -0
- package/runtime/lib/element-template/prop-adapters/event.js.map +1 -0
- package/runtime/lib/element-template/prop-adapters/spread.d.ts +5 -0
- package/runtime/lib/element-template/prop-adapters/spread.js +45 -0
- package/runtime/lib/element-template/prop-adapters/spread.js.map +1 -0
- package/runtime/lib/element-template/protocol/lifecycle-constant.d.ts +4 -0
- package/runtime/lib/element-template/protocol/lifecycle-constant.js +9 -0
- package/runtime/lib/element-template/protocol/lifecycle-constant.js.map +1 -0
- package/runtime/lib/element-template/protocol/opcodes.d.ts +7 -0
- package/runtime/lib/element-template/protocol/opcodes.js +10 -0
- package/runtime/lib/element-template/protocol/opcodes.js.map +1 -0
- package/runtime/lib/element-template/protocol/types.d.ts +50 -0
- package/runtime/lib/element-template/protocol/types.js +5 -0
- package/runtime/lib/element-template/protocol/types.js.map +1 -0
- package/runtime/lib/element-template/runtime/components/slot.d.ts +1 -0
- package/runtime/lib/element-template/runtime/components/slot.js +11 -0
- package/runtime/lib/element-template/runtime/components/slot.js.map +1 -0
- package/runtime/lib/element-template/runtime/page/page.d.ts +2 -0
- package/runtime/lib/element-template/runtime/page/page.js +8 -0
- package/runtime/lib/element-template/runtime/page/page.js.map +1 -0
- package/runtime/lib/element-template/runtime/page/root-instance.d.ts +10 -0
- package/runtime/lib/element-template/runtime/page/root-instance.js +17 -0
- package/runtime/lib/element-template/runtime/page/root-instance.js.map +1 -0
- package/runtime/lib/element-template/runtime/patch.d.ts +3 -0
- package/runtime/lib/element-template/runtime/patch.js +145 -0
- package/runtime/lib/element-template/runtime/patch.js.map +1 -0
- package/runtime/lib/element-template/runtime/render/render-main-thread.d.ts +2 -0
- package/runtime/lib/element-template/runtime/render/render-main-thread.js +53 -0
- package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -0
- package/runtime/lib/element-template/runtime/render/render-opcodes.d.ts +4 -0
- package/runtime/lib/element-template/runtime/render/render-opcodes.js +134 -0
- package/runtime/lib/element-template/runtime/render/render-opcodes.js.map +1 -0
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.d.ts +14 -0
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.js +272 -0
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.js.map +1 -0
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.d.ts +11 -0
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.js +23 -0
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.js.map +1 -0
- package/runtime/lib/element-template/runtime/template/handle.d.ts +5 -0
- package/runtime/lib/element-template/runtime/template/handle.js +23 -0
- package/runtime/lib/element-template/runtime/template/handle.js.map +1 -0
- package/runtime/lib/element-template/runtime/template/registry.d.ts +13 -0
- package/runtime/lib/element-template/runtime/template/registry.js +46 -0
- package/runtime/lib/element-template/runtime/template/registry.js.map +1 -0
- package/runtime/lib/index.d.ts +5 -3
- package/runtime/lib/index.js +7 -4
- package/runtime/lib/index.js.map +1 -1
- package/runtime/lib/internal.d.ts +2 -3
- package/runtime/lib/internal.js +3 -4
- package/runtime/lib/internal.js.map +1 -1
- package/runtime/lib/lynx-api.d.ts +1 -1
- package/runtime/lib/lynx-api.js +3 -3
- package/runtime/lib/lynx-api.js.map +1 -1
- package/runtime/lib/lynx.d.ts +1 -1
- package/runtime/lib/lynx.js +3 -3
- package/runtime/lib/lynx.js.map +1 -1
- package/runtime/lib/{snapshot/debug → shared}/component-stack.js +1 -1
- package/runtime/lib/shared/component-stack.js.map +1 -0
- package/runtime/lib/{snapshot/debug → shared}/profile.js +6 -4
- package/runtime/lib/shared/profile.js.map +1 -0
- package/runtime/lib/{snapshot/renderToOpcodes/constants.js → shared/render-constants.js} +1 -1
- package/runtime/lib/shared/render-constants.js.map +1 -0
- package/runtime/lib/snapshot/alog/elementPAPICall.js +1 -1
- package/runtime/lib/snapshot/alog/elementPAPICall.js.map +1 -1
- package/runtime/lib/snapshot/alog/render.js +1 -1
- package/runtime/lib/snapshot/alog/render.js.map +1 -1
- package/runtime/lib/snapshot/compat/initData.d.ts +2 -2
- package/runtime/lib/snapshot/compat/initData.js +1 -1
- package/runtime/lib/snapshot/compat/initData.js.map +1 -1
- package/runtime/lib/snapshot/debug/profileHooks.js +1 -1
- package/runtime/lib/snapshot/debug/profileHooks.js.map +1 -1
- package/runtime/lib/snapshot/debug/vnodeSource.js +1 -1
- package/runtime/lib/snapshot/debug/vnodeSource.js.map +1 -1
- package/runtime/lib/snapshot/gesture/processGesture.d.ts +2 -0
- package/runtime/lib/snapshot/gesture/processGesture.js +16 -1
- package/runtime/lib/snapshot/gesture/processGesture.js.map +1 -1
- package/runtime/lib/snapshot/legacy-react-runtime/index.d.ts +2 -2
- package/runtime/lib/snapshot/legacy-react-runtime/index.js +2 -2
- package/runtime/lib/snapshot/legacy-react-runtime/index.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/destroy.js +1 -1
- package/runtime/lib/snapshot/lifecycle/destroy.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/event/jsReady.js +1 -1
- package/runtime/lib/snapshot/lifecycle/event/jsReady.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/isRendering.js +1 -1
- package/runtime/lib/snapshot/lifecycle/isRendering.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/commit.js +2 -2
- package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/nodesRefApply.d.ts +15 -0
- package/runtime/lib/snapshot/lifecycle/patch/nodesRefApply.js +102 -0
- package/runtime/lib/snapshot/lifecycle/patch/nodesRefApply.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.d.ts +2 -0
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js +17 -0
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js +26 -0
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/ref/delay.d.ts +1 -0
- package/runtime/lib/snapshot/lifecycle/ref/delay.js +5 -3
- package/runtime/lib/snapshot/lifecycle/ref/delay.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/reload.js +1 -1
- package/runtime/lib/snapshot/lifecycle/reload.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/render.js +1 -1
- package/runtime/lib/snapshot/lifecycle/render.js.map +1 -1
- package/runtime/lib/snapshot/list/list.js +4 -1
- package/runtime/lib/snapshot/list/list.js.map +1 -1
- package/runtime/lib/snapshot/list/listUpdateInfo.js +1 -1
- package/runtime/lib/snapshot/list/listUpdateInfo.js.map +1 -1
- package/runtime/lib/snapshot/lynx/component.js +1 -1
- package/runtime/lib/snapshot/lynx/component.js.map +1 -1
- package/runtime/lib/snapshot/lynx/element.d.ts +6 -0
- package/runtime/lib/snapshot/lynx/element.js +35 -0
- package/runtime/lib/snapshot/lynx/element.js.map +1 -0
- package/runtime/lib/snapshot/lynx/env.js +1 -1
- package/runtime/lib/snapshot/lynx/env.js.map +1 -1
- package/runtime/lib/snapshot/lynx/nodesRef.d.ts +6 -0
- package/runtime/lib/snapshot/lynx/nodesRef.js +31 -0
- package/runtime/lib/snapshot/lynx/nodesRef.js.map +1 -0
- package/runtime/lib/snapshot/lynx/performance.js +1 -1
- package/runtime/lib/snapshot/lynx/performance.js.map +1 -1
- package/runtime/lib/snapshot/lynx/portals.d.ts +9 -0
- package/runtime/lib/snapshot/lynx/portals.js +120 -0
- package/runtime/lib/snapshot/lynx/portals.js.map +1 -0
- package/runtime/lib/snapshot/lynx/portalsPending.d.ts +10 -0
- package/runtime/lib/snapshot/lynx/portalsPending.js +38 -0
- package/runtime/lib/snapshot/lynx/portalsPending.js.map +1 -0
- package/runtime/lib/snapshot/lynx/runWithForce.js +1 -1
- package/runtime/lib/snapshot/lynx/runWithForce.js.map +1 -1
- package/runtime/lib/snapshot/lynx/tt.js +2 -2
- package/runtime/lib/snapshot/lynx/tt.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/hydrate.js +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/hydrate.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/index.js +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/index.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.js +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.d.ts +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +20 -21
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/constants.d.ts +4 -0
- package/runtime/lib/snapshot/snapshot/constants.js +4 -0
- package/runtime/lib/snapshot/snapshot/constants.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/definition.d.ts +1 -0
- package/runtime/lib/snapshot/snapshot/definition.js +49 -1
- package/runtime/lib/snapshot/snapshot/definition.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/dynamicPartType.d.ts +12 -0
- package/runtime/lib/snapshot/snapshot/dynamicPartType.js +12 -0
- package/runtime/lib/snapshot/snapshot/dynamicPartType.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/event.d.ts +1 -1
- package/runtime/lib/snapshot/snapshot/event.js +0 -4
- package/runtime/lib/snapshot/snapshot/event.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/gesture.js +9 -3
- package/runtime/lib/snapshot/snapshot/gesture.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/reconstructInstanceTree.d.ts +14 -0
- package/runtime/lib/snapshot/snapshot/reconstructInstanceTree.js +27 -0
- package/runtime/lib/snapshot/snapshot/reconstructInstanceTree.js.map +1 -0
- package/runtime/lib/snapshot/snapshot/snapshot.js +62 -3
- package/runtime/lib/snapshot/snapshot/snapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/spread.d.ts +1 -1
- package/runtime/lib/snapshot/snapshot/spread.js +32 -1
- package/runtime/lib/snapshot/snapshot/spread.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/utils.d.ts +1 -3
- package/runtime/lib/snapshot/snapshot/utils.js +5 -0
- package/runtime/lib/snapshot/snapshot/utils.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/workletEvent.d.ts +1 -1
- package/runtime/lib/snapshot/snapshot/workletEvent.js +10 -5
- package/runtime/lib/snapshot/snapshot/workletEvent.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/workletRef.d.ts +1 -1
- package/runtime/lib/snapshot/snapshot/workletRef.js +6 -3
- package/runtime/lib/snapshot/snapshot/workletRef.js.map +1 -1
- package/runtime/lib/snapshot/worklet/ref/workletRef.js +1 -1
- package/runtime/lib/snapshot/worklet/ref/workletRef.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/runtime/lib/utils.js +1 -1
- package/runtime/lib/utils.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/observers.d.ts +1 -0
- package/runtime/lib/worklet-runtime/bindings/observers.js +5 -3
- package/runtime/lib/worklet-runtime/bindings/observers.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/types.d.ts +1 -1
- package/runtime/lib/worklet-runtime/bindings/types.js.map +1 -1
- package/runtime/lib/worklet-runtime/hydrate.js +1 -1
- package/runtime/lib/worklet-runtime/hydrate.js.map +1 -1
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.d.ts +1 -0
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js +5 -0
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js.map +1 -1
- package/runtime/lib/worklet-runtime/workletRuntime.js +1 -2
- package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
- package/runtime/worklet-runtime/dev.js +8 -4
- package/runtime/worklet-runtime/main.js +1 -1
- package/testing-library/dist/env/index.js +25 -7
- package/testing-library/dist/fire-event.d.ts +21 -7
- package/testing-library/dist/index.d.ts +2 -0
- package/testing-library/dist/pure.js +27 -9
- package/testing-library/dist/type-entry/index.js +0 -0
- package/transform/dist/wasm.cjs +833 -285
- package/transform/index.d.ts +28 -1
- package/types/react.docs.d.ts +9 -1
- package/refresh/.gitignore +0 -1
- package/refresh/.npmignore +0 -3
- package/refresh/.turbo/turbo-build.log +0 -12
- package/refresh/package.json +0 -20
- package/refresh/rslib.config.ts +0 -24
- package/refresh/tsconfig.json +0 -4
- package/refresh/turbo.json +0 -15
- package/runtime/lib/snapshot/debug/component-stack.js.map +0 -1
- package/runtime/lib/snapshot/debug/profile.js.map +0 -1
- package/runtime/lib/snapshot/hooks/mainThread.js.map +0 -1
- package/runtime/lib/snapshot/hooks/react.js.map +0 -1
- package/runtime/lib/snapshot/hooks/useLynxGlobalEventListener.js.map +0 -1
- package/runtime/lib/snapshot/renderToOpcodes/constants.js.map +0 -1
- package/testing-library/README.md +0 -109
- /package/runtime/lib/{snapshot → core}/hooks/react.d.ts +0 -0
- /package/runtime/lib/{snapshot/debug → shared}/component-stack.d.ts +0 -0
- /package/runtime/lib/{snapshot/debug → shared}/profile.d.ts +0 -0
- /package/runtime/lib/{snapshot/renderToOpcodes/constants.d.ts → shared/render-constants.d.ts} +0 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
/**
|
|
5
|
+
* Implements rendering to opcodes.
|
|
6
|
+
* This module is modified from preact-render-to-string@6.0.3 to generate
|
|
7
|
+
* opcodes instead of HTML strings for Lynx.
|
|
8
|
+
*/
|
|
9
|
+
// @ts-nocheck
|
|
10
|
+
import { Fragment, h, options } from 'preact';
|
|
11
|
+
import { CHILDREN, COMMIT, COMPONENT, DIFF, DIFF2, DIFFED, DIRTY, NEXT_STATE, PARENT, RENDER, SKIP_EFFECTS, VNODE, } from '../../../shared/render-constants.js';
|
|
12
|
+
/** @typedef {import('preact').VNode} VNode */
|
|
13
|
+
const EMPTY_ARR = [];
|
|
14
|
+
const isArray = /* @__PURE__ */ Array.isArray;
|
|
15
|
+
const assign = /* @__PURE__ */ Object.assign;
|
|
16
|
+
// Global state for the current render pass
|
|
17
|
+
let beforeDiff, beforeDiff2, afterDiff, renderHook, ummountHook;
|
|
18
|
+
/**
|
|
19
|
+
* Render Preact JSX + Components to an HTML string.
|
|
20
|
+
* @param {VNode} vnode JSX Element / VNode to render
|
|
21
|
+
* @param {object} [context] Initial root context object
|
|
22
|
+
*/
|
|
23
|
+
export function renderToString(vnode, context) {
|
|
24
|
+
// Performance optimization: `renderToString` is synchronous and we
|
|
25
|
+
// therefore don't execute any effects. To do that we pass an empty
|
|
26
|
+
// array to `options._commit` (`__c`). But we can go one step further
|
|
27
|
+
// and avoid a lot of dirty checks and allocations by setting
|
|
28
|
+
// `options._skipEffects` (`__s`) too.
|
|
29
|
+
const previousSkipEffects = options[SKIP_EFFECTS];
|
|
30
|
+
options[SKIP_EFFECTS] = true;
|
|
31
|
+
// store options hooks once before each synchronous render call
|
|
32
|
+
beforeDiff = options[DIFF];
|
|
33
|
+
beforeDiff2 = options[DIFF2];
|
|
34
|
+
afterDiff = options[DIFFED];
|
|
35
|
+
renderHook = options[RENDER];
|
|
36
|
+
ummountHook = options.unmount;
|
|
37
|
+
const parent = h(Fragment, null);
|
|
38
|
+
parent[CHILDREN] = [vnode];
|
|
39
|
+
const opcodes = [];
|
|
40
|
+
try {
|
|
41
|
+
_renderToString(vnode, context || EMPTY_OBJ, parent, opcodes);
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
// options._commit, we don't schedule any effects in this library right now,
|
|
45
|
+
// so we can pass an empty queue to this hook.
|
|
46
|
+
if (options[COMMIT])
|
|
47
|
+
options[COMMIT](vnode, EMPTY_ARR);
|
|
48
|
+
options[SKIP_EFFECTS] = previousSkipEffects;
|
|
49
|
+
EMPTY_ARR.length = 0;
|
|
50
|
+
}
|
|
51
|
+
return opcodes;
|
|
52
|
+
}
|
|
53
|
+
// Installed as setState/forceUpdate for function components
|
|
54
|
+
/* v8 ignore start */
|
|
55
|
+
function markAsDirty() {
|
|
56
|
+
this.__d = true;
|
|
57
|
+
}
|
|
58
|
+
/* v8 ignore stop */
|
|
59
|
+
const EMPTY_OBJ = {};
|
|
60
|
+
export const __OpBegin = 0;
|
|
61
|
+
export const __OpEnd = 1;
|
|
62
|
+
export const __OpAttr = 2;
|
|
63
|
+
export const __OpText = 3;
|
|
64
|
+
export const __OpSlot = 4;
|
|
65
|
+
/**
|
|
66
|
+
* @param {VNode} vnode
|
|
67
|
+
* @param {Record<string, unknown>} context
|
|
68
|
+
*/
|
|
69
|
+
function renderClassComponent(vnode, context) {
|
|
70
|
+
const type = /** @type {import("preact").ComponentClass<typeof vnode.props>} */ (vnode.type);
|
|
71
|
+
let c;
|
|
72
|
+
if (vnode[COMPONENT]) {
|
|
73
|
+
c = vnode[COMPONENT];
|
|
74
|
+
c.state = c[NEXT_STATE];
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
c = new type(vnode.props, context);
|
|
78
|
+
}
|
|
79
|
+
vnode[COMPONENT] = c;
|
|
80
|
+
c[VNODE] = vnode;
|
|
81
|
+
c.props = vnode.props;
|
|
82
|
+
c.context = context;
|
|
83
|
+
// turn off stateful re-rendering:
|
|
84
|
+
c[DIRTY] = true;
|
|
85
|
+
if (c.state == null)
|
|
86
|
+
c.state = EMPTY_OBJ;
|
|
87
|
+
if (c[NEXT_STATE] == null) {
|
|
88
|
+
c[NEXT_STATE] = c.state;
|
|
89
|
+
}
|
|
90
|
+
if (type.getDerivedStateFromProps) {
|
|
91
|
+
c.state = assign({}, c.state, type.getDerivedStateFromProps(c.props, c.state));
|
|
92
|
+
}
|
|
93
|
+
if (renderHook)
|
|
94
|
+
renderHook(vnode);
|
|
95
|
+
return c.render(c.props, c.state, context);
|
|
96
|
+
}
|
|
97
|
+
function cleanupVNode(vnode) {
|
|
98
|
+
if (afterDiff)
|
|
99
|
+
afterDiff(vnode);
|
|
100
|
+
vnode[PARENT] = undefined;
|
|
101
|
+
if (ummountHook)
|
|
102
|
+
ummountHook(vnode);
|
|
103
|
+
}
|
|
104
|
+
function shouldRenderEtChild(child) {
|
|
105
|
+
return child != null && child !== false && child !== true;
|
|
106
|
+
}
|
|
107
|
+
function isCompiledEtHostType(type) {
|
|
108
|
+
return type.startsWith('_et_')
|
|
109
|
+
|| type.includes(':_et_');
|
|
110
|
+
}
|
|
111
|
+
function renderEtSlotArray(slotChildrenById, context, vnode, opcodes) {
|
|
112
|
+
for (let slotId = 0; slotId < slotChildrenById.length; slotId += 1) {
|
|
113
|
+
const slotChildren = slotChildrenById[slotId];
|
|
114
|
+
if (!shouldRenderEtChild(slotChildren)) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
opcodes.push(__OpSlot, slotId);
|
|
118
|
+
_renderToString(slotChildren, context, vnode, opcodes);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function renderComponentVNode(vnode, type, props, context, opcodes) {
|
|
122
|
+
let cctx = context;
|
|
123
|
+
let rendered;
|
|
124
|
+
let component;
|
|
125
|
+
const opcodesLength = opcodes.length;
|
|
126
|
+
if (type === Fragment) {
|
|
127
|
+
rendered = props.children;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
const contextType = type.contextType;
|
|
131
|
+
if (contextType != null) {
|
|
132
|
+
const provider = context[contextType.__c];
|
|
133
|
+
cctx = provider ? provider.props.value : contextType.__;
|
|
134
|
+
}
|
|
135
|
+
if (type.prototype && typeof type.prototype.render === 'function') {
|
|
136
|
+
rendered = /**#__NOINLINE__**/ renderClassComponent(vnode, cctx);
|
|
137
|
+
component = vnode[COMPONENT];
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
component = {
|
|
141
|
+
__v: vnode,
|
|
142
|
+
props,
|
|
143
|
+
context: cctx,
|
|
144
|
+
// silently drop state updates
|
|
145
|
+
setState: markAsDirty,
|
|
146
|
+
forceUpdate: markAsDirty,
|
|
147
|
+
__d: true,
|
|
148
|
+
// hooks
|
|
149
|
+
__h: [],
|
|
150
|
+
};
|
|
151
|
+
vnode[COMPONENT] = component;
|
|
152
|
+
component.constructor = type;
|
|
153
|
+
component.render = doRender;
|
|
154
|
+
let count = 0;
|
|
155
|
+
while (component[DIRTY] && count++ < 25) {
|
|
156
|
+
component[DIRTY] = false;
|
|
157
|
+
if (renderHook)
|
|
158
|
+
renderHook(vnode);
|
|
159
|
+
rendered = component.render(props, component.state, cctx);
|
|
160
|
+
}
|
|
161
|
+
component[DIRTY] = true;
|
|
162
|
+
}
|
|
163
|
+
if (component.getChildContext != null) {
|
|
164
|
+
context = assign({}, context, component.getChildContext());
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const isTopLevelFragment = rendered != null && rendered.type === Fragment
|
|
168
|
+
&& rendered.key == null;
|
|
169
|
+
rendered = isTopLevelFragment ? rendered.props.children : rendered;
|
|
170
|
+
try {
|
|
171
|
+
_renderToString(rendered, context, vnode, opcodes);
|
|
172
|
+
}
|
|
173
|
+
catch (e) {
|
|
174
|
+
if (e && typeof e === 'object' && e.then && component && /* _childDidSuspend */ component.__c) {
|
|
175
|
+
component.setState({ /* _suspended */ __a: true });
|
|
176
|
+
if (component[DIRTY]) {
|
|
177
|
+
rendered = renderClassComponent(vnode, context);
|
|
178
|
+
component = vnode[COMPONENT];
|
|
179
|
+
opcodes.length = opcodesLength;
|
|
180
|
+
_renderToString(rendered, context, vnode, opcodes);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
throw e;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
finally {
|
|
188
|
+
cleanupVNode(vnode);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function renderCompiledEtHostVNode(vnode, props, context, opcodes) {
|
|
192
|
+
opcodes.push(__OpBegin, vnode);
|
|
193
|
+
const attributeSlots = props.attributeSlots;
|
|
194
|
+
if (attributeSlots !== undefined) {
|
|
195
|
+
opcodes.push(__OpAttr, 'attributeSlots', attributeSlots);
|
|
196
|
+
}
|
|
197
|
+
// ET host nodes are compiler-generated and encode dynamic element slots in
|
|
198
|
+
// `children`, so the runtime can interpret the prop as a slot array directly.
|
|
199
|
+
const elementSlots = props.children;
|
|
200
|
+
if (elementSlots !== undefined) {
|
|
201
|
+
renderEtSlotArray(elementSlots, context, vnode, opcodes);
|
|
202
|
+
}
|
|
203
|
+
cleanupVNode(vnode);
|
|
204
|
+
opcodes.push(__OpEnd);
|
|
205
|
+
}
|
|
206
|
+
function renderStringHostVNode(type, vnode, props, context, opcodes) {
|
|
207
|
+
if (__DEV__ && !isCompiledEtHostType(type)) {
|
|
208
|
+
cleanupVNode(vnode);
|
|
209
|
+
throw new Error(`Element Template main-thread renderer received an uncompiled host vnode: ${type}`);
|
|
210
|
+
}
|
|
211
|
+
renderCompiledEtHostVNode(vnode, props, context, opcodes);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Recursively render VNodes to HTML.
|
|
215
|
+
* @param {VNode|any} vnode
|
|
216
|
+
* @param {any} context
|
|
217
|
+
* @param {VNode} parent
|
|
218
|
+
* @param opcodes
|
|
219
|
+
*/
|
|
220
|
+
function _renderToString(vnode, context, parent, opcodes) {
|
|
221
|
+
// Ignore non-rendered VNodes/values
|
|
222
|
+
if (vnode == null || vnode === true || vnode === false || vnode === '') {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
// Text VNodes: escape as HTML
|
|
226
|
+
if (typeof vnode !== 'object') {
|
|
227
|
+
if (typeof vnode === 'function')
|
|
228
|
+
return;
|
|
229
|
+
opcodes.push(__OpText, vnode + '');
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
// Recurse into children / Arrays
|
|
233
|
+
if (isArray(vnode)) {
|
|
234
|
+
parent[CHILDREN] = vnode;
|
|
235
|
+
for (let i = 0; i < vnode.length; i++) {
|
|
236
|
+
const child = vnode[i];
|
|
237
|
+
if (child == null || typeof child === 'boolean')
|
|
238
|
+
continue;
|
|
239
|
+
_renderToString(child, context, parent, opcodes);
|
|
240
|
+
}
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
// VNodes have {constructor:undefined} to prevent JSON injection:
|
|
244
|
+
// if (vnode.constructor !== undefined) return;
|
|
245
|
+
vnode[PARENT] = parent;
|
|
246
|
+
if (beforeDiff)
|
|
247
|
+
beforeDiff(vnode);
|
|
248
|
+
if (beforeDiff2)
|
|
249
|
+
beforeDiff2(vnode, EMPTY_OBJ);
|
|
250
|
+
let type = vnode.type, props = vnode.props;
|
|
251
|
+
// Invoke rendering on Components
|
|
252
|
+
if (typeof type === 'function') {
|
|
253
|
+
renderComponentVNode(vnode, type, props, context, opcodes);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if (typeof type === 'string') {
|
|
257
|
+
renderStringHostVNode(type, vnode, props, context, opcodes);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (__DEV__) {
|
|
261
|
+
cleanupVNode(vnode);
|
|
262
|
+
throw new Error('Element Template main-thread renderer received an invalid vnode.');
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/** The `.render()` method for a PFC backing instance. */
|
|
266
|
+
function doRender(props, state, context) {
|
|
267
|
+
return this.constructor(props, context);
|
|
268
|
+
}
|
|
269
|
+
export default renderToString;
|
|
270
|
+
export const render = renderToString;
|
|
271
|
+
export const renderToStaticMarkup = renderToString;
|
|
272
|
+
//# sourceMappingURL=render-to-opcodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-to-opcodes.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/render/render-to-opcodes.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D;;;;GAIG;AAEH,cAAc;AAEd,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,IAAI,EACJ,KAAK,EACL,MAAM,EACN,KAAK,EACL,UAA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AO,CAAC,CAAC;QACnD,CAAC;QACD,OAAO;IACT,CAAC;IAED,iEAAiE;IACjE,+CAA+C;IAE/C,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IACvB,IAAI,UAAU;QAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,WAAW;QAAE,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAE/C,IAAI,IAAI,GAAG,KAAK,CAAC,IAAI,EACnB,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAEtB,iCAAiC;IACjC,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,oBAAoB,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC3D,OAAO;IACT,CAAC;IAED,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5D,OAAO;IACT,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACZ,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;IACtF,CAAC;AACH,CAAC;AAED,yDAAyD;AACzD,SAAS,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO;IACrC,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC;AAED,eAAe,cAAc,CAAC;AAC9B,MAAM,CAAC,MAAM,MAAM,GAA0B,cAAc,CAAC;AAC5D,MAAM,CAAC,MAAM,oBAAoB,GAA0B,cAAc,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SpreadAttrAdapterContext } from '../../prop-adapters/spread.js';
|
|
2
|
+
import type { SerializableValue } from '../../protocol/types.js';
|
|
3
|
+
export interface EtAttrAdapterContext extends SpreadAttrAdapterContext {
|
|
4
|
+
}
|
|
5
|
+
export type EtAttrAdapter = (handleId: number, attrSlotIndex: number, value: unknown, context?: EtAttrAdapterContext) => SerializableValue | null;
|
|
6
|
+
export type EtAttrPlan = (number | EtAttrAdapter)[];
|
|
7
|
+
export type EtAttrPlanMap = Record<string, EtAttrPlan | undefined>;
|
|
8
|
+
export declare const __etAttrPlanMap: EtAttrPlanMap;
|
|
9
|
+
export declare function adaptEventAttrSlot(handleId: number, attrSlotIndex: number, value: unknown, _context?: EtAttrAdapterContext): SerializableValue | null;
|
|
10
|
+
export declare function adaptSpreadAttrSlot(handleId: number, attrSlotIndex: number, value: unknown, context?: EtAttrAdapterContext): SerializableValue | null;
|
|
11
|
+
export declare function clearEtAttrPlanMap(): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
import { getEventValue } from '../../prop-adapters/event-value.js';
|
|
5
|
+
import { prepareSpreadAttrSlot } from '../../prop-adapters/spread.js';
|
|
6
|
+
export const __etAttrPlanMap = Object.create(null);
|
|
7
|
+
export function adaptEventAttrSlot(handleId, attrSlotIndex, value, _context) {
|
|
8
|
+
if (value === null || value === undefined || value === false) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return getEventValue(handleId, attrSlotIndex);
|
|
12
|
+
}
|
|
13
|
+
export function adaptSpreadAttrSlot(handleId, attrSlotIndex, value, context) {
|
|
14
|
+
return prepareSpreadAttrSlot(handleId, attrSlotIndex, value, context);
|
|
15
|
+
}
|
|
16
|
+
export function clearEtAttrPlanMap() {
|
|
17
|
+
// The compiled output assigns into the exported side table directly, so the
|
|
18
|
+
// object identity must stay stable when tests or teardown clear state.
|
|
19
|
+
for (const templateKey in __etAttrPlanMap) {
|
|
20
|
+
delete __etAttrPlanMap[templateKey];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=attr-slot-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attr-slot-plan.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/template/attr-slot-plan.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAoBtE,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAkB,CAAC;AAEpE,MAAM,UAAU,kBAAkB,CAChC,QAAgB,EAChB,aAAqB,EACrB,KAAc,EACd,QAA+B;IAE/B,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QAC7D,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,QAAgB,EAChB,aAAqB,EACrB,KAAc,EACd,OAA8B;IAE9B,OAAO,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,4EAA4E;IAC5E,uEAAuE;IACvE,KAAK,MAAM,WAAW,IAAI,eAAe,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SerializableValue } from '../../protocol/types.js';
|
|
2
|
+
export declare function reserveElementTemplateId(): number;
|
|
3
|
+
export declare function createElementTemplateWithReservedHandle(handleId: number, templateKey: string, bundleUrl: string | null | undefined, attributeSlots: SerializableValue[] | null | undefined, elementSlots: ElementRef[][] | null | undefined): ElementRef;
|
|
4
|
+
export declare function resetTemplateId(): void;
|
|
5
|
+
export declare function destroyElementTemplateId(id: number): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
import { deleteElementTemplateNativeRef, setElementTemplateNativeRef } from './registry.js';
|
|
5
|
+
// Main-thread IFR allocates ids as consecutive negative integers.
|
|
6
|
+
let nextId = -1;
|
|
7
|
+
export function reserveElementTemplateId() {
|
|
8
|
+
const id = nextId--;
|
|
9
|
+
return id;
|
|
10
|
+
}
|
|
11
|
+
export function createElementTemplateWithReservedHandle(handleId, templateKey, bundleUrl, attributeSlots, elementSlots) {
|
|
12
|
+
const nativeRef = __CreateElementTemplate(templateKey, bundleUrl, attributeSlots, elementSlots, handleId);
|
|
13
|
+
setElementTemplateNativeRef(handleId, nativeRef);
|
|
14
|
+
return nativeRef;
|
|
15
|
+
}
|
|
16
|
+
export function resetTemplateId() {
|
|
17
|
+
nextId = -1;
|
|
18
|
+
}
|
|
19
|
+
export function destroyElementTemplateId(id) {
|
|
20
|
+
deleteElementTemplateNativeRef(id);
|
|
21
|
+
// __ReleaseElement(nativeRef);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=handle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/template/handle.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,8BAA8B,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAG5F,kEAAkE;AAClE,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;AAEhB,MAAM,UAAU,wBAAwB;IACtC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,QAAgB,EAChB,WAAmB,EACnB,SAAoC,EACpC,cAAsD,EACtD,YAA+C;IAE/C,MAAM,SAAS,GAAG,uBAAuB,CACvC,WAAW,EACX,SAAS,EACT,cAAc,EACd,YAAY,EACZ,QAAQ,CACT,CAAC;IACF,2BAA2B,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACjD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,MAAM,GAAG,CAAC,CAAC,CAAC;AACd,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,EAAU;IACjD,8BAA8B,CAAC,EAAE,CAAC,CAAC;IACnC,+BAA+B;AACjC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function setElementTemplateNativeRef(id: number, nativeRef: ElementRef): void;
|
|
2
|
+
export declare function getElementTemplateNativeRef(id: number): ElementRef | undefined;
|
|
3
|
+
export declare function hasElementTemplateNativeRef(id: number): boolean;
|
|
4
|
+
export declare function deleteElementTemplateNativeRef(id: number): void;
|
|
5
|
+
export declare function clearElementTemplateNativeRefRegistry(): void;
|
|
6
|
+
export interface ElementTemplateRegistryFacade {
|
|
7
|
+
set: (id: number, nativeRef: ElementRef) => void;
|
|
8
|
+
get: (id: number) => ElementRef | undefined;
|
|
9
|
+
has: (id: number) => boolean;
|
|
10
|
+
delete: (id: number) => void;
|
|
11
|
+
clear: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const elementTemplateRegistry: ElementTemplateRegistryFacade;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
// Registry for mapping element-template handle IDs to native refs.
|
|
5
|
+
//
|
|
6
|
+
// Main-thread IFR allocates IDs as consecutive negative integers: -1, -2, -3...
|
|
7
|
+
// We store those in a dense array for performance.
|
|
8
|
+
//
|
|
9
|
+
// Other IDs (e.g. positive IDs coming from background-created nodes) fall back to a Map.
|
|
10
|
+
const negativeRefs = [];
|
|
11
|
+
const otherRefs = new Map();
|
|
12
|
+
export function setElementTemplateNativeRef(id, nativeRef) {
|
|
13
|
+
if (id < 0) {
|
|
14
|
+
negativeRefs[-id - 1] = nativeRef;
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
otherRefs.set(id, nativeRef);
|
|
18
|
+
}
|
|
19
|
+
export function getElementTemplateNativeRef(id) {
|
|
20
|
+
if (id < 0) {
|
|
21
|
+
return negativeRefs[-id - 1];
|
|
22
|
+
}
|
|
23
|
+
return otherRefs.get(id);
|
|
24
|
+
}
|
|
25
|
+
export function hasElementTemplateNativeRef(id) {
|
|
26
|
+
return getElementTemplateNativeRef(id) != null;
|
|
27
|
+
}
|
|
28
|
+
export function deleteElementTemplateNativeRef(id) {
|
|
29
|
+
if (id < 0) {
|
|
30
|
+
negativeRefs[-id - 1] = undefined;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
otherRefs.delete(id);
|
|
34
|
+
}
|
|
35
|
+
export function clearElementTemplateNativeRefRegistry() {
|
|
36
|
+
negativeRefs.length = 0;
|
|
37
|
+
otherRefs.clear();
|
|
38
|
+
}
|
|
39
|
+
export const elementTemplateRegistry = {
|
|
40
|
+
set: setElementTemplateNativeRef,
|
|
41
|
+
get: getElementTemplateNativeRef,
|
|
42
|
+
has: hasElementTemplateNativeRef,
|
|
43
|
+
delete: deleteElementTemplateNativeRef,
|
|
44
|
+
clear: clearElementTemplateNativeRefRegistry,
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/template/registry.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACx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;IAChC,MAAM,EAAE,8BAA8B;IACtC,KAAK,EAAE,qCAAqC;CAC7C,CAAC"}
|
package/runtime/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import './lynx.js';
|
|
2
2
|
import './snapshot/lynx/component.js';
|
|
3
|
-
import { Children, Fragment, cloneElement,
|
|
3
|
+
import { Children, Fragment, cloneElement, createRef, forwardRef, isValidElement, lazy, memo, useSyncExternalStore } from 'preact/compat';
|
|
4
|
+
import { createElement } from './snapshot/lynx/element.js';
|
|
5
|
+
import { createPortal } from './snapshot/lynx/portals.js';
|
|
4
6
|
import { Suspense } from './snapshot/lynx/suspense.js';
|
|
5
7
|
export { Component, createContext } from 'preact';
|
|
6
8
|
export { PureComponent } from 'preact/compat';
|
|
7
|
-
export * from './
|
|
8
|
-
export { Children, createRef, Fragment, isValidElement, memo, forwardRef, Suspense, lazy, createElement, cloneElement, useSyncExternalStore, };
|
|
9
|
+
export * from './core/hooks/react.js';
|
|
10
|
+
export { Children, createRef, Fragment, isValidElement, memo, forwardRef, Suspense, lazy, createElement, cloneElement, useSyncExternalStore, createPortal, };
|
|
9
11
|
export * from './lynx-api.js';
|
package/runtime/lib/index.js
CHANGED
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
4
|
import './lynx.js';
|
|
5
5
|
import './snapshot/lynx/component.js';
|
|
6
|
-
import { Children, Component, Fragment, PureComponent, cloneElement, createContext,
|
|
7
|
-
import { useCallback, useContext, useDebugValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, } from './
|
|
6
|
+
import { Children, Component, Fragment, PureComponent, cloneElement, createContext, createRef, forwardRef, isValidElement, lazy, memo, useSyncExternalStore, } from 'preact/compat';
|
|
7
|
+
import { useCallback, useContext, useDebugValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, } from './core/hooks/react.js';
|
|
8
|
+
import { createElement } from './snapshot/lynx/element.js';
|
|
9
|
+
import { createPortal } from './snapshot/lynx/portals.js';
|
|
8
10
|
import { Suspense } from './snapshot/lynx/suspense.js';
|
|
9
11
|
export { Component, createContext } from 'preact';
|
|
10
12
|
export { PureComponent } from 'preact/compat';
|
|
11
|
-
export * from './
|
|
13
|
+
export * from './core/hooks/react.js';
|
|
12
14
|
/**
|
|
13
15
|
* @internal
|
|
14
16
|
*/
|
|
@@ -37,7 +39,8 @@ export default {
|
|
|
37
39
|
Suspense,
|
|
38
40
|
lazy,
|
|
39
41
|
createElement,
|
|
42
|
+
createPortal,
|
|
40
43
|
};
|
|
41
|
-
export { Children, createRef, Fragment, isValidElement, memo, forwardRef, Suspense, lazy, createElement, cloneElement, useSyncExternalStore, };
|
|
44
|
+
export { Children, createRef, Fragment, isValidElement, memo, forwardRef, Suspense, lazy, createElement, cloneElement, useSyncExternalStore, createPortal, };
|
|
42
45
|
export * from './lynx-api.js';
|
|
43
46
|
//# sourceMappingURL=index.js.map
|
package/runtime/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,WAAW,CAAC;AACnB,OAAO,8BAA8B,CAAC;AACtC,OAAO,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,WAAW,CAAC;AACnB,OAAO,8BAA8B,CAAC;AACtC,OAAO,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,aAAa,EACb,SAAS,EACT,UAAU,EACV,cAAc,EACd,IAAI,EACJ,IAAI,EACJ,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,WAAW,EACX,UAAU,EACV,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,eAAe,EACf,OAAO,EACP,UAAU,EACV,MAAM,EACN,QAAQ,GACT,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AAEtC;;GAEG;AACH,eAAe;IACb,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,SAAS;IACT,eAAe;IACf,MAAM;IACN,mBAAmB;IACnB,OAAO;IACP,WAAW;IACX,UAAU;IACV,aAAa;IACb,oBAAoB;IAEpB,aAAa;IACb,SAAS;IACT,QAAQ;IACR,cAAc;IACd,QAAQ;IACR,SAAS;IACT,aAAa;IACb,IAAI;IACJ,UAAU;IACV,QAAQ;IACR,IAAI;IACJ,aAAa;IACb,YAAY;CACb,CAAC;AAEF,OAAO,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,cAAc,EACd,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,IAAI,EACJ,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,YAAY,GACb,CAAC;AAEF,cAAc,eAAe,CAAC"}
|
|
@@ -5,17 +5,16 @@ import { __page, __pageId, createSnapshot, snapshotManager } from './snapshot/sn
|
|
|
5
5
|
import { DynamicPartType } from './snapshot/snapshot/dynamicPartType.js';
|
|
6
6
|
import { snapshotCreateList } from './snapshot/snapshot/list.js';
|
|
7
7
|
import { SnapshotInstance, snapshotCreatorMap } from './snapshot/snapshot/snapshot.js';
|
|
8
|
-
export { CHILDREN, COMPONENT, DIFF, DIRTY, DOM, FLAGS, INDEX, PARENT } from './
|
|
8
|
+
export { CHILDREN, COMPONENT, DIFF, DIRTY, DOM, FLAGS, INDEX, PARENT } from './shared/render-constants.js';
|
|
9
9
|
export { __page, __pageId, __root };
|
|
10
10
|
export { BackgroundSnapshotInstance, SnapshotInstance, snapshotCreateList, createSnapshot, snapshotManager, snapshotCreatorMap, };
|
|
11
11
|
export declare const __DynamicPartSlot: DynamicPartType;
|
|
12
12
|
export declare const __DynamicPartMultiChildren: DynamicPartType;
|
|
13
13
|
export declare const __DynamicPartChildren: DynamicPartType;
|
|
14
14
|
export declare const __DynamicPartListChildren: DynamicPartType;
|
|
15
|
-
export { __DynamicPartChildren_0 } from './snapshot/snapshot/dynamicPartType.js';
|
|
15
|
+
export { __DynamicPartChildren_0, __DynamicPartSlotV2_0 } from './snapshot/snapshot/dynamicPartType.js';
|
|
16
16
|
export declare const __DynamicPartSlotV2: DynamicPartType;
|
|
17
17
|
export declare const __DynamicPartListSlotV2: DynamicPartType;
|
|
18
|
-
export declare const __DynamicPartSlotV2_0: [DynamicPartType, number][];
|
|
19
18
|
export { updateSpread } from './snapshot/snapshot/spread.js';
|
|
20
19
|
export { updateEvent } from './snapshot/snapshot/event.js';
|
|
21
20
|
export { updateRef, transformRef } from './snapshot/snapshot/ref.js';
|
package/runtime/lib/internal.js
CHANGED
|
@@ -3,27 +3,26 @@
|
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
4
|
import { Suspense, createElement, lazy } from 'preact/compat';
|
|
5
5
|
import './lynx.js';
|
|
6
|
+
import { useMemo } from './core/hooks/react.js';
|
|
6
7
|
import { __root } from './root.js';
|
|
7
8
|
import { factory as factory2 } from './snapshot/compat/componentIs.js';
|
|
8
|
-
import { useMemo } from './snapshot/hooks/react.js';
|
|
9
9
|
import { loadLazyBundle } from './snapshot/lynx/lazy-bundle.js';
|
|
10
10
|
import { BackgroundSnapshotInstance } from './snapshot/snapshot/backgroundSnapshot.js';
|
|
11
11
|
import { __page, __pageId, createSnapshot, snapshotManager } from './snapshot/snapshot/definition.js';
|
|
12
12
|
import { DynamicPartType } from './snapshot/snapshot/dynamicPartType.js';
|
|
13
13
|
import { snapshotCreateList } from './snapshot/snapshot/list.js';
|
|
14
14
|
import { SnapshotInstance, snapshotCreatorMap } from './snapshot/snapshot/snapshot.js';
|
|
15
|
-
export { CHILDREN, COMPONENT, DIFF, DIRTY, DOM, FLAGS, INDEX, PARENT } from './
|
|
15
|
+
export { CHILDREN, COMPONENT, DIFF, DIRTY, DOM, FLAGS, INDEX, PARENT } from './shared/render-constants.js';
|
|
16
16
|
export { __page, __pageId, __root };
|
|
17
17
|
export { BackgroundSnapshotInstance, SnapshotInstance, snapshotCreateList, createSnapshot, snapshotManager, snapshotCreatorMap, };
|
|
18
18
|
export const __DynamicPartSlot = DynamicPartType.Slot;
|
|
19
19
|
export const __DynamicPartMultiChildren = DynamicPartType.MultiChildren;
|
|
20
20
|
export const __DynamicPartChildren = DynamicPartType.Children;
|
|
21
21
|
export const __DynamicPartListChildren = DynamicPartType.ListChildren;
|
|
22
|
-
export { __DynamicPartChildren_0 } from './snapshot/snapshot/dynamicPartType.js';
|
|
22
|
+
export { __DynamicPartChildren_0, __DynamicPartSlotV2_0 } from './snapshot/snapshot/dynamicPartType.js';
|
|
23
23
|
// v2 slot
|
|
24
24
|
export const __DynamicPartSlotV2 = DynamicPartType.SlotV2;
|
|
25
25
|
export const __DynamicPartListSlotV2 = DynamicPartType.ListSlotV2;
|
|
26
|
-
export const __DynamicPartSlotV2_0 = [[DynamicPartType.SlotV2, 0]];
|
|
27
26
|
export { updateSpread } from './snapshot/snapshot/spread.js';
|
|
28
27
|
export { updateEvent } from './snapshot/snapshot/event.js';
|
|
29
28
|
export { updateRef, transformRef } from './snapshot/snapshot/ref.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD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F,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAExE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC"}
|
|
@@ -458,7 +458,7 @@ export interface Lynx {
|
|
|
458
458
|
*/
|
|
459
459
|
registerDataProcessors: (dataProcessorDefinition?: DataProcessorDefinition) => void;
|
|
460
460
|
}
|
|
461
|
-
export { useLynxGlobalEventListener } from './
|
|
461
|
+
export { useLynxGlobalEventListener } from './core/hooks/useLynxGlobalEventListener.js';
|
|
462
462
|
export { runOnBackground } from './snapshot/worklet/call/runOnBackground.js';
|
|
463
463
|
export { runOnMainThread } from './snapshot/worklet/call/runOnMainThread.js';
|
|
464
464
|
export { MainThreadRef, useMainThreadRef } from './snapshot/worklet/ref/workletRef.js';
|
package/runtime/lib/lynx-api.js
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
import { render } from 'preact';
|
|
5
5
|
import { createContext, createElement } from 'preact/compat';
|
|
6
6
|
import { useState } from 'preact/hooks';
|
|
7
|
+
import { useLynxGlobalEventListener } from './core/hooks/useLynxGlobalEventListener.js';
|
|
7
8
|
import { __root } from './root.js';
|
|
9
|
+
import { profileEnd, profileStart } from './shared/profile.js';
|
|
8
10
|
import { factory, withInitDataInState } from './snapshot/compat/initData.js';
|
|
9
|
-
import { profileEnd, profileStart } from './snapshot/debug/profile.js';
|
|
10
|
-
import { useLynxGlobalEventListener } from './snapshot/hooks/useLynxGlobalEventListener.js';
|
|
11
11
|
import { LifecycleConstant } from './snapshot/lifecycle/constant.js';
|
|
12
12
|
import { flushDelayedLifecycleEvents } from './snapshot/lynx/tt.js';
|
|
13
13
|
/**
|
|
@@ -237,7 +237,7 @@ export const useGlobalProps = /* @__PURE__ */ _GlobalProps.use();
|
|
|
237
237
|
export const useGlobalPropsChanged = /* @__PURE__ */ _GlobalProps
|
|
238
238
|
.useChanged();
|
|
239
239
|
export { withInitDataInState };
|
|
240
|
-
export { useLynxGlobalEventListener } from './
|
|
240
|
+
export { useLynxGlobalEventListener } from './core/hooks/useLynxGlobalEventListener.js';
|
|
241
241
|
export { runOnBackground } from './snapshot/worklet/call/runOnBackground.js';
|
|
242
242
|
export { runOnMainThread } from './snapshot/worklet/call/runOnMainThread.js';
|
|
243
243
|
export { MainThreadRef, useMainThreadRef } from './snapshot/worklet/ref/workletRef.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lynx-api.js","sourceRoot":"","sources":["../src/lynx-api.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"lynx-api.js","sourceRoot":"","sources":["../src/lynx-api.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EA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'./snapshot/lynx/runWithForce.js';
|
package/runtime/lib/lynx.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
4
|
import { options } from 'preact';
|
|
5
5
|
// to make sure preact's hooks to register earlier than ours
|
|
6
|
-
import './
|
|
6
|
+
import './core/hooks/react.js';
|
|
7
7
|
import { document, setupBackgroundDocument } from './document.js';
|
|
8
|
+
import { setupComponentStack } from './shared/component-stack.js';
|
|
9
|
+
import { isProfiling } from './shared/profile.js';
|
|
8
10
|
import { initElementPAPICallAlog } from './snapshot/alog/elementPAPICall.js';
|
|
9
11
|
import { initAlog } from './snapshot/alog/index.js';
|
|
10
|
-
import { setupComponentStack } from './snapshot/debug/component-stack.js';
|
|
11
|
-
import { isProfiling } from './snapshot/debug/profile.js';
|
|
12
12
|
import { initProfileHook } from './snapshot/debug/profileHooks.js';
|
|
13
13
|
import { setupVNodeSourceHook } from './snapshot/debug/vnodeSource.js';
|
|
14
14
|
import { replaceCommitHook } from './snapshot/lifecycle/patch/commit.js';
|