@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 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/element-template/protocol/types.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createElement } from 'preact';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export function __etSlot(id, children) {
|
|
6
|
+
if (__BACKGROUND__) {
|
|
7
|
+
return createElement('slot', { id }, children);
|
|
8
|
+
}
|
|
9
|
+
throw new Error('__etSlot() should not run on the main thread. LEPUS ET children are lowered to slot arrays at compile time.');
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/components/slot.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,EAAU,EAAE,QAA2B;IAC9D,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,aAAa,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;IACjD,CAAC;IACD,MAAM,IAAI,KAAK,CACb,6GAA6G,CAC9G,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
export let __page;
|
|
5
|
+
export function setupPage(page) {
|
|
6
|
+
__page = page;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/page/page.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,MAAM,CAAC,IAAI,MAAoB,CAAC;AAEhC,MAAM,UAAU,SAAS,CAAC,IAAkB;IAC1C,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
* Element Template-only root for renderPage.
|
|
6
|
+
*/
|
|
7
|
+
let __root;
|
|
8
|
+
function setRoot(root) {
|
|
9
|
+
__root = root;
|
|
10
|
+
// A fake ELEMENT_NODE to make preact/debug happy.
|
|
11
|
+
if (__DEV__ && __root) {
|
|
12
|
+
__root.nodeType = 1;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
setRoot({});
|
|
16
|
+
export { __root, setRoot };
|
|
17
|
+
//# sourceMappingURL=root-instance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root-instance.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/page/root-instance.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D;;GAEG;AACH,IAAI,MAIH,CAAC;AAEF,SAAS,OAAO,CAAC,IAAmB;IAClC,MAAM,GAAG,IAAI,CAAC;IAEd,kDAAkD;IAClD,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;QACtB,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC;IACtB,CAAC;AACH,CAAC;AAED,OAAO,CAAC,EAAE,CAAC,CAAC;AAEZ,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// Copyright 2026 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 { elementTemplateRegistry } from './template/registry.js';
|
|
5
|
+
import { ElementTemplateUpdateOps } from '../protocol/opcodes.js';
|
|
6
|
+
export function applyElementTemplateUpdateCommands(stream) {
|
|
7
|
+
let i = 0;
|
|
8
|
+
while (i < stream.length) {
|
|
9
|
+
const op = stream[i++];
|
|
10
|
+
switch (op) {
|
|
11
|
+
case ElementTemplateUpdateOps.createTemplate: {
|
|
12
|
+
const handleId = stream[i++];
|
|
13
|
+
const templateKey = stream[i++];
|
|
14
|
+
const bundleUrl = stream[i++];
|
|
15
|
+
const attributeSlots = stream[i++];
|
|
16
|
+
const elementSlots = stream[i++];
|
|
17
|
+
if (__DEV__) {
|
|
18
|
+
const createError = validateCreateTemplatePayload(handleId, attributeSlots, elementSlots);
|
|
19
|
+
if (createError) {
|
|
20
|
+
lynx.reportError(createError);
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const resolvedElementSlots = resolveElementSlots(elementSlots);
|
|
25
|
+
if (__DEV__ && resolvedElementSlots.hasError) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const nativeRef = __CreateElementTemplate(templateKey, bundleUrl, normalizeAttributeSlots(attributeSlots), resolvedElementSlots.value, handleId);
|
|
29
|
+
if (nativeRef) {
|
|
30
|
+
elementTemplateRegistry.set(handleId, nativeRef);
|
|
31
|
+
}
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case ElementTemplateUpdateOps.setAttribute: {
|
|
35
|
+
const targetId = stream[i++];
|
|
36
|
+
const attrSlotIndex = stream[i++];
|
|
37
|
+
const value = stream[i++];
|
|
38
|
+
const nativeRef = resolveHandle(targetId, 'target');
|
|
39
|
+
if (!nativeRef) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
__SetAttributeOfElementTemplate(nativeRef, attrSlotIndex, value, null);
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
case ElementTemplateUpdateOps.insertNode: {
|
|
46
|
+
const targetId = stream[i++];
|
|
47
|
+
const elementSlotIndex = stream[i++];
|
|
48
|
+
const childId = stream[i++];
|
|
49
|
+
const referenceId = stream[i++];
|
|
50
|
+
const nativeRef = resolveHandle(targetId, 'target');
|
|
51
|
+
const childRef = resolveHandle(childId, 'child');
|
|
52
|
+
if (!nativeRef || !childRef) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const referenceRef = referenceId === 0 ? null : resolveHandle(referenceId, 'reference');
|
|
56
|
+
if (referenceId !== 0 && !referenceRef) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
__InsertNodeToElementTemplate(nativeRef, elementSlotIndex, childRef, referenceRef);
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
case ElementTemplateUpdateOps.removeNode: {
|
|
63
|
+
const targetId = stream[i++];
|
|
64
|
+
const elementSlotIndex = stream[i++];
|
|
65
|
+
const childId = stream[i++];
|
|
66
|
+
const removedSubtreeHandleIds = stream[i++];
|
|
67
|
+
const nativeRef = resolveHandle(targetId, 'target');
|
|
68
|
+
const childRef = resolveHandle(childId, 'child');
|
|
69
|
+
if (!nativeRef || !childRef) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
__RemoveNodeFromElementTemplate(nativeRef, elementSlotIndex, childRef);
|
|
73
|
+
// The native API only detaches from the slot. Releasing ET runtime's
|
|
74
|
+
// strong refs after a successful detach lets JS GC reclaim the subtree.
|
|
75
|
+
for (const handleId of removedSubtreeHandleIds) {
|
|
76
|
+
elementTemplateRegistry.delete(handleId);
|
|
77
|
+
}
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
default: {
|
|
81
|
+
lynx.reportError(new Error(`ElementTemplate update opcode ${String(op)} is not supported.`));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function resolveElementSlots(elementSlots) {
|
|
87
|
+
if (!Array.isArray(elementSlots)) {
|
|
88
|
+
return { hasError: false, value: null };
|
|
89
|
+
}
|
|
90
|
+
let hasError = false;
|
|
91
|
+
const value = elementSlots.map((children, slotIndex) => {
|
|
92
|
+
if (!Array.isArray(children)) {
|
|
93
|
+
if (__DEV__) {
|
|
94
|
+
lynx.reportError(new Error(`ElementTemplate create slot ${slotIndex} must be an array of child handles.`));
|
|
95
|
+
hasError = true;
|
|
96
|
+
}
|
|
97
|
+
return [];
|
|
98
|
+
}
|
|
99
|
+
return children
|
|
100
|
+
.map((childId) => {
|
|
101
|
+
const childRef = __DEV__
|
|
102
|
+
? resolveHandle(childId, 'child')
|
|
103
|
+
: (elementTemplateRegistry.get(childId) ?? null);
|
|
104
|
+
if (__DEV__ && childRef === null) {
|
|
105
|
+
hasError = true;
|
|
106
|
+
}
|
|
107
|
+
return childRef;
|
|
108
|
+
})
|
|
109
|
+
.filter((childRef) => childRef !== null);
|
|
110
|
+
});
|
|
111
|
+
return { hasError, value };
|
|
112
|
+
}
|
|
113
|
+
function resolveHandle(id, role) {
|
|
114
|
+
const nativeRef = elementTemplateRegistry.get(id);
|
|
115
|
+
if (!nativeRef) {
|
|
116
|
+
lynx.reportError(new Error(`ElementTemplate update ${role} handle ${id} not found.`));
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
return nativeRef;
|
|
120
|
+
}
|
|
121
|
+
function isValidHandleId(handleId) {
|
|
122
|
+
return Number.isInteger(handleId) && handleId !== 0;
|
|
123
|
+
}
|
|
124
|
+
function validateCreateTemplatePayload(handleId, attributeSlots, elementSlots) {
|
|
125
|
+
if (!isValidHandleId(handleId)) {
|
|
126
|
+
return new Error(`ElementTemplate update has invalid handleId ${String(handleId)}.`);
|
|
127
|
+
}
|
|
128
|
+
if (elementTemplateRegistry.get(handleId)) {
|
|
129
|
+
return new Error(`ElementTemplate update received duplicate handleId ${handleId}.`);
|
|
130
|
+
}
|
|
131
|
+
if (attributeSlots != null && !Array.isArray(attributeSlots)) {
|
|
132
|
+
return new Error('ElementTemplate update create attributeSlots must be an array, null, or undefined.');
|
|
133
|
+
}
|
|
134
|
+
if (elementSlots != null && !Array.isArray(elementSlots)) {
|
|
135
|
+
return new Error('ElementTemplate update create elementSlots must be an array, null, or undefined.');
|
|
136
|
+
}
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
function normalizeAttributeSlots(attributeSlots) {
|
|
140
|
+
if (!Array.isArray(attributeSlots)) {
|
|
141
|
+
return attributeSlots;
|
|
142
|
+
}
|
|
143
|
+
return attributeSlots.map((value) => (value === undefined ? null : value));
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=patch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch.js","sourceRoot":"","sources":["../../../src/element-template/runtime/patch.ts"],"names":[],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CAAC,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 the IFR (Instant First-Frame Rendering) on main thread.
|
|
6
|
+
*/
|
|
7
|
+
import { renderOpcodesIntoElementTemplate } from './render-opcodes.js';
|
|
8
|
+
import { render as renderToString } from './render-to-opcodes.js';
|
|
9
|
+
import { profileEnd, profileStart } from '../../debug/profile.js';
|
|
10
|
+
import { ElementTemplateLifecycleConstant } from '../../protocol/lifecycle-constant.js';
|
|
11
|
+
import { __page } from '../page/page.js';
|
|
12
|
+
import { __root } from '../page/root-instance.js';
|
|
13
|
+
function renderMainThread() {
|
|
14
|
+
let opcodes;
|
|
15
|
+
let rootRefs = [];
|
|
16
|
+
profileStart('ReactLynx::renderMainThread');
|
|
17
|
+
try {
|
|
18
|
+
opcodes = renderToString(__root.__jsx, undefined);
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
lynx.reportError(e);
|
|
22
|
+
opcodes = [];
|
|
23
|
+
}
|
|
24
|
+
finally {
|
|
25
|
+
profileEnd();
|
|
26
|
+
}
|
|
27
|
+
profileStart('ReactLynx::renderOpcodes');
|
|
28
|
+
try {
|
|
29
|
+
rootRefs = renderOpcodesIntoElementTemplate(opcodes).rootRefs;
|
|
30
|
+
for (const rootRef of rootRefs) {
|
|
31
|
+
__AppendElement(__page, rootRef);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
profileEnd();
|
|
36
|
+
}
|
|
37
|
+
profileStart('ReactLynx::packSerializedETInstance');
|
|
38
|
+
try {
|
|
39
|
+
const instances = [];
|
|
40
|
+
for (const rootRef of rootRefs) {
|
|
41
|
+
instances.push(__SerializeElementTemplate(rootRef));
|
|
42
|
+
}
|
|
43
|
+
lynx.getJSContext().dispatchEvent({
|
|
44
|
+
type: ElementTemplateLifecycleConstant.hydrate,
|
|
45
|
+
data: instances,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
profileEnd();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export { renderMainThread };
|
|
53
|
+
//# sourceMappingURL=render-main-thread.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-main-thread.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/render/render-main-thread.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D;;GAEG;AAEH,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,gCAAgC,EAAE,MAAM,sCAAsC,CAAC;AAExF,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,SAAS,gBAAgB;IACvB,IAAI,OAAO,CAAC;IACZ,IAAI,QAAQ,GAAiB,EAAE,CAAC;IAChC,YAAY,CAAC,6BAA6B,CAAC,CAAC;IAC5C,IAAI,CAAC;QACH,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,WAAW,CAAC,CAAU,CAAC,CAAC;QAC7B,OAAO,GAAG,EAAE,CAAC;IACf,CAAC;YAAS,CAAC;QACT,UAAU,EAAE,CAAC;IACf,CAAC;IAED,YAAY,CAAC,0BAA0B,CAAC,CAAC;IACzC,IAAI,CAAC;QACH,QAAQ,GAAG,gCAAgC,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;QAC9D,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;YAAS,CAAC;QACT,UAAU,EAAE,CAAC;IACf,CAAC;IAED,YAAY,CAAC,qCAAqC,CAAC,CAAC;IACpD,IAAI,CAAC;QACH,MAAM,SAAS,GAAgC,EAAE,CAAC;QAClD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,SAAS,CAAC,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC,CAAC;QACtD,CAAC;QAED,IAAI,CAAC,YAAY,EAAE,CAAC,aAAa,CAAC;YAChC,IAAI,EAAE,gCAAgC,CAAC,OAAO;YAC9C,IAAI,EAAE,SAAS;SAChB,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,UAAU,EAAE,CAAC;IACf,CAAC;AACH,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
import { __OpAttr, __OpBegin, __OpEnd, __OpSlot, __OpText } from './render-to-opcodes.js';
|
|
5
|
+
import { __etAttrPlanMap } from '../template/attr-slot-plan.js';
|
|
6
|
+
import { createElementTemplateWithReservedHandle, reserveElementTemplateId } from '../template/handle.js';
|
|
7
|
+
const BUILTIN_RAW_TEXT_TEMPLATE_KEY = '_et_builtin_raw_text';
|
|
8
|
+
function appendChildToParent(parentTemplateKey, parentActiveElementSlot, rootRefs, elementRef) {
|
|
9
|
+
/* v8 ignore start -- stackTop is always rooted with `null`, never `undefined`. */
|
|
10
|
+
if (parentTemplateKey === undefined) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
/* v8 ignore end */
|
|
14
|
+
if (parentTemplateKey === null) {
|
|
15
|
+
rootRefs.push(elementRef);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (!parentActiveElementSlot) {
|
|
19
|
+
throw new Error(`Template '${parentTemplateKey}' received a child outside of any element slot.`);
|
|
20
|
+
}
|
|
21
|
+
parentActiveElementSlot.push(elementRef);
|
|
22
|
+
}
|
|
23
|
+
export function renderOpcodesIntoElementTemplate(opcodes) {
|
|
24
|
+
const rootRefs = [];
|
|
25
|
+
const templateKeyStack = [null];
|
|
26
|
+
const attributeSlotsStack = [undefined];
|
|
27
|
+
const elementSlotsStack = [undefined];
|
|
28
|
+
const activeElementSlotStack = [undefined];
|
|
29
|
+
let stackTop = 0;
|
|
30
|
+
for (let i = 0; i < opcodes.length;) {
|
|
31
|
+
const opcode = opcodes[i];
|
|
32
|
+
switch (opcode) {
|
|
33
|
+
case __OpBegin: {
|
|
34
|
+
const vnode = opcodes[i + 1];
|
|
35
|
+
stackTop += 1;
|
|
36
|
+
templateKeyStack[stackTop] = vnode.type;
|
|
37
|
+
attributeSlotsStack[stackTop] = undefined;
|
|
38
|
+
elementSlotsStack[stackTop] = undefined;
|
|
39
|
+
activeElementSlotStack[stackTop] = undefined;
|
|
40
|
+
i += 2;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
case __OpEnd: {
|
|
44
|
+
if (stackTop === 0) {
|
|
45
|
+
throw new Error('Instruction mismatch: Popped root frame at __OpEnd');
|
|
46
|
+
}
|
|
47
|
+
const templateKey = templateKeyStack[stackTop];
|
|
48
|
+
const attributeSlots = attributeSlotsStack[stackTop];
|
|
49
|
+
const elementSlots = elementSlotsStack[stackTop];
|
|
50
|
+
stackTop -= 1;
|
|
51
|
+
// If templateKey is null, it means we popped the root frame?
|
|
52
|
+
// But __OpEnd should pair with __OpBegin.
|
|
53
|
+
// The Root frame is manually pushed and has no __OpBegin.
|
|
54
|
+
// So we should never pop the Root frame via __OpEnd unless there's an extra End.
|
|
55
|
+
if (templateKey === null) {
|
|
56
|
+
// This should effectively not happen if opcodes are balanced?
|
|
57
|
+
// Actually, if we are at root, and opcode has __OpEnd, it implies we are closing a component.
|
|
58
|
+
// The structure is: Root -> [Begin ... End] -> Root.
|
|
59
|
+
// Wait, if opcodes list ends, loop finishes.
|
|
60
|
+
// __OpEnd corresponds to a component.
|
|
61
|
+
// So if we pop, we must get a valid component frame.
|
|
62
|
+
/* v8 ignore start -- the synthetic root frame cannot be popped by balanced opcodes. */
|
|
63
|
+
throw new Error('Instruction mismatch: Popped root frame at __OpEnd');
|
|
64
|
+
/* v8 ignore end */
|
|
65
|
+
}
|
|
66
|
+
const concreteTemplateKey = templateKey;
|
|
67
|
+
const parentTemplateKey = templateKeyStack[stackTop];
|
|
68
|
+
const parentActiveElementSlot = activeElementSlotStack[stackTop];
|
|
69
|
+
const attrPlan = __etAttrPlanMap[concreteTemplateKey];
|
|
70
|
+
const handleId = reserveElementTemplateId();
|
|
71
|
+
let elementRef;
|
|
72
|
+
if (attrPlan === undefined) {
|
|
73
|
+
elementRef = createElementTemplateWithReservedHandle(handleId, concreteTemplateKey, null, attributeSlots ?? null, elementSlots ?? null);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const preparedAttributeSlots = attributeSlots?.slice() ?? [];
|
|
77
|
+
for (let planIndex = 0; planIndex < attrPlan.length; planIndex += 2) {
|
|
78
|
+
const attrSlotIndex = attrPlan[planIndex];
|
|
79
|
+
const adapter = attrPlan[planIndex + 1];
|
|
80
|
+
preparedAttributeSlots[attrSlotIndex] = adapter(handleId, attrSlotIndex, preparedAttributeSlots[attrSlotIndex]);
|
|
81
|
+
}
|
|
82
|
+
elementRef = createElementTemplateWithReservedHandle(handleId, concreteTemplateKey, null, preparedAttributeSlots, elementSlots ?? null);
|
|
83
|
+
}
|
|
84
|
+
appendChildToParent(parentTemplateKey, parentActiveElementSlot, rootRefs, elementRef);
|
|
85
|
+
i += 1;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case __OpAttr: {
|
|
89
|
+
const name = opcodes[i + 1];
|
|
90
|
+
const value = opcodes[i + 2];
|
|
91
|
+
if (name === 'attributeSlots') {
|
|
92
|
+
attributeSlotsStack[stackTop] = value;
|
|
93
|
+
}
|
|
94
|
+
i += 3;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
case __OpSlot: {
|
|
98
|
+
const slotId = opcodes[i + 1];
|
|
99
|
+
const elementSlots = elementSlotsStack[stackTop] ?? (elementSlotsStack[stackTop] = []);
|
|
100
|
+
const activeElementSlot = elementSlots[slotId] = [];
|
|
101
|
+
activeElementSlotStack[stackTop] = activeElementSlot;
|
|
102
|
+
i += 2;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
case __OpText: {
|
|
106
|
+
const text = opcodes[i + 1];
|
|
107
|
+
const handleId = reserveElementTemplateId();
|
|
108
|
+
const textRef = createElementTemplateWithReservedHandle(handleId, BUILTIN_RAW_TEXT_TEMPLATE_KEY, null, [String(text)], []);
|
|
109
|
+
const parentTemplateKey = templateKeyStack[stackTop];
|
|
110
|
+
if (parentTemplateKey === null) {
|
|
111
|
+
rootRefs.push(textRef);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
const activeElementSlot = activeElementSlotStack[stackTop];
|
|
115
|
+
if (!activeElementSlot) {
|
|
116
|
+
throw new Error(`Template '${parentTemplateKey}' received a text child outside of any element slot.`);
|
|
117
|
+
}
|
|
118
|
+
activeElementSlot.push(textRef);
|
|
119
|
+
}
|
|
120
|
+
i += 2;
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
default:
|
|
124
|
+
// Unknown opcode, maybe skip? or throw?
|
|
125
|
+
// renderToString loop increments manually.
|
|
126
|
+
// If we hit here, something is desync.
|
|
127
|
+
throw new Error(`Unknown opcode: ${opcode}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
rootRefs,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=render-opcodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-opcodes.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/render/render-opcodes.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAE1F,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,uCAAuC,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAE1G,MAAM,6BAA6B,GAAG,sBAAsB,CAAC;AAM7D,SAAS,mBAAmB,CAC1B,iBAA4C,EAC5C,uBAAiD,EACjD,QAAsB,EACtB,UAAsB;IAEtB,kFAAkF;IAClF,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;QACpC,OAAO;IACT,CAAC;IACD,mBAAmB;IAEnB,IAAI,iBAAiB,KAAK,IAAI,EAAE,CAAC;QAC/B,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,aAAa,iBAAiB,iDAAiD,CAAC,CAAC;IACnG,CAAC;IAED,uBAAuB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,OAAkB;IAElB,MAAM,QAAQ,GAAiB,EAAE,CAAC;IAClC,MAAM,gBAAgB,GAAyB,CAAC,IAAI,CAAC,CAAC;IACtD,MAAM,mBAAmB,GAA2C,CAAC,SAAS,CAAC,CAAC;IAChF,MAAM,iBAAiB,GAAgD,CAAC,SAAS,CAAC,CAAC;IACnF,MAAM,sBAAsB,G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CAAC;qBAAM,CAAC;oBACN,MAAM,iBAAiB,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;oBAC3D,IAAI,CAAC,iBAAiB,EAAE,CAAC;wBACvB,MAAM,IAAI,KAAK,CAAC,aAAa,iBAAiB,sDAAsD,CAAC,CAAC;oBACxG,CAAC;oBACD,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAClC,CAAC;gBACD,CAAC,IAAI,CAAC,CAAC;gBACP,MAAM;YACR,CAAC;YACD;gBACE,wCAAwC;gBACxC,2CAA2C;gBAC3C,uCAAuC;gBACvC,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAyB,EAAE,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;IACD,OAAO;QACL,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render Preact JSX + Components to an HTML string.
|
|
3
|
+
* @param {VNode} vnode JSX Element / VNode to render
|
|
4
|
+
* @param {object} [context] Initial root context object
|
|
5
|
+
*/
|
|
6
|
+
export declare function renderToString(vnode: any, context: any): any[];
|
|
7
|
+
export declare const __OpBegin = 0;
|
|
8
|
+
export declare const __OpEnd = 1;
|
|
9
|
+
export declare const __OpAttr = 2;
|
|
10
|
+
export declare const __OpText = 3;
|
|
11
|
+
export declare const __OpSlot = 4;
|
|
12
|
+
export default renderToString;
|
|
13
|
+
export declare const render: typeof renderToString;
|
|
14
|
+
export declare const renderToStaticMarkup: typeof renderToString;
|