@lynx-js/react 0.129.2 → 0.129.4
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 +24 -0
- package/components/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/refresh/.turbo/turbo-build.log +3 -3
- package/refresh/dist/index.js +113 -20
- package/refresh/rslib.config.ts +13 -3
- package/refresh/src/index.ts +100 -0
- package/refresh/src/self.ts +38 -0
- package/runtime/__test__/{snapshot → core}/attribute-name.test.ts +1 -1
- package/runtime/__test__/core/background-function.test.ts +37 -0
- package/runtime/__test__/{shared → core}/component-stack.test.ts +4 -4
- package/runtime/__test__/core/ref.test.ts +218 -1
- package/runtime/__test__/core/sync-effect-flush.test.ts +58 -0
- package/runtime/__test__/element-template/debug/alog.test.ts +20 -12
- package/runtime/__test__/element-template/fixtures/background/hydrate/_shared.tsx +15 -34
- package/runtime/__test__/element-template/fixtures/background/hydrate/children.creates-missing-nodes-recursively/output.txt +2 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/children.iterates-existing-slots/output.txt +1 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/children.missing-attrs-element/output.txt +6 -1
- package/runtime/__test__/element-template/fixtures/background/hydrate/children.missing-slot-record-on-main/output.txt +1 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/{coverage.move-before-child → children.reconciles-raw-text-slots}/case.tsx +1 -1
- package/runtime/__test__/element-template/fixtures/background/hydrate/coverage.emit-create-raw-text/output.txt +1 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/coverage.emit-create-raw-text-non-text/output.txt +1 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate/root-key-mismatch-reconciles/output.txt +1 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.creates-and-inserts-new/output.txt +1 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.inserts-before-existing-sibling/output.txt +1 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.mixed-operations/output.txt +1 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/children.non-string-raw-text-key-on-main/output.txt +1 -0
- package/runtime/__test__/element-template/fixtures/background/hydrate-compiled/complex-trees.deeply-nested-dynamic-content/output.txt +1 -0
- package/runtime/__test__/element-template/fixtures/background/instance/ops/emits-bundle-url-in-create-template/output.txt +1 -0
- package/runtime/__test__/element-template/fixtures/list/mts/index.tsx +185 -0
- package/runtime/__test__/element-template/fixtures/page/render-page/native-log.txt +1 -0
- package/runtime/__test__/element-template/fixtures/patch/detaches-node-when-moving-between-slots/case.tsx +2 -0
- package/runtime/__test__/element-template/fixtures/patch-compiled/applies-insert-before-with-reference/ops.txt +1 -0
- package/runtime/__test__/element-template/fixtures/patch-compiled/apply-hydration-ops/ops.txt +1 -0
- package/runtime/__test__/element-template/fixtures/render/child-siblings/papi.txt +10 -5
- package/runtime/__test__/element-template/fixtures/render/component/papi.txt +6 -3
- package/runtime/__test__/element-template/fixtures/render/component-slot-content/papi.txt +6 -3
- package/runtime/__test__/element-template/fixtures/render/css-scope-dynamic-bundle-url/papi.txt +2 -1
- package/runtime/__test__/element-template/fixtures/render/direct-native/appends-root-text-via-append-element/native-log.txt +1 -0
- package/runtime/__test__/element-template/fixtures/render/direct-native/creates-template-from-attrs-and-slot-text/native-log.txt +2 -0
- package/runtime/__test__/element-template/fixtures/render/direct-native/handles-multiple-template-children-in-the-same-slot/native-log.txt +3 -0
- package/runtime/__test__/element-template/fixtures/render/direct-native/handles-multiple-text-nodes-in-the-same-slot/native-log.txt +3 -0
- package/runtime/__test__/element-template/fixtures/render/direct-native/inserts-nested-templates-into-parent-slots/native-log.txt +3 -0
- package/runtime/__test__/element-template/fixtures/render/direct-native/keeps-slot-children-separated-and-ordered/native-log.txt +3 -0
- package/runtime/__test__/element-template/fixtures/render/direct-native/passes-bundle-url-to-native-create/native-log.txt +1 -0
- package/runtime/__test__/element-template/fixtures/render/mapped-view-children/papi.txt +14 -7
- package/runtime/__test__/element-template/fixtures/render/mixed-children/papi.txt +8 -4
- package/runtime/__test__/element-template/fixtures/render/multiple-text/papi.txt +38 -19
- package/runtime/__test__/element-template/fixtures/render/nested-templates/papi.txt +6 -3
- package/runtime/__test__/element-template/fixtures/render/react-example/papi.txt +6 -3
- package/runtime/__test__/element-template/fixtures/render/sparse-element-slot/papi.txt +6 -3
- package/runtime/__test__/element-template/fixtures/render/template-dedupe/papi.txt +10 -5
- package/runtime/__test__/element-template/lynx/performance.test.ts +1 -0
- package/runtime/__test__/element-template/native/callDestroyLifetimeFun.test.ts +1 -0
- package/runtime/__test__/element-template/native/mts-destroy.test.ts +10 -15
- package/runtime/__test__/element-template/native/reload.test.ts +4 -7
- package/runtime/__test__/element-template/runtime/background/adapter/background-adapter.et.test.tsx +0 -32
- package/runtime/__test__/element-template/runtime/background/commit-context.test.ts +0 -14
- package/runtime/__test__/element-template/runtime/background/commit-hook.test.ts +10 -0
- package/runtime/__test__/element-template/runtime/background/event/compiled-fixtures.test.tsx +22 -0
- package/runtime/__test__/element-template/runtime/background/hydrate.test.ts +197 -252
- package/runtime/__test__/element-template/runtime/background/instance.test.ts +277 -126
- package/runtime/__test__/element-template/runtime/background/passive-update-depth.test.tsx +496 -0
- package/runtime/__test__/element-template/runtime/background/render/preact.test.tsx +16 -22
- package/runtime/__test__/element-template/runtime/background/root-render.test.tsx +5 -3
- package/runtime/__test__/element-template/runtime/background/suspense.test.tsx +2 -0
- package/runtime/__test__/element-template/runtime/background/update/compiled-fixtures.test.tsx +1 -0
- package/runtime/__test__/element-template/runtime/background/update-timing.test.ts +1 -0
- package/runtime/__test__/element-template/runtime/hydration/hydration-listener.test.ts +3 -4
- package/runtime/__test__/element-template/runtime/list/list-mts-compiled.test.ts +525 -0
- package/runtime/__test__/element-template/runtime/page/compiled-fixtures.test.tsx +2 -0
- package/runtime/__test__/element-template/runtime/page/root-instance.test.ts +2 -14
- package/runtime/__test__/element-template/runtime/patch/element-template-patch.test.tsx +425 -1032
- package/runtime/__test__/element-template/runtime/patch/patch-listener-alog.test.ts +1 -0
- package/runtime/__test__/element-template/runtime/patch/update-timing.test.ts +1 -0
- package/runtime/__test__/element-template/runtime/prop-adapters/event.test.ts +0 -20
- package/runtime/__test__/element-template/runtime/prop-adapters/gesture.test.ts +2 -1
- package/runtime/__test__/element-template/runtime/prop-adapters/hydrate.test.ts +1 -0
- package/runtime/__test__/element-template/runtime/prop-adapters/ref.test.ts +65 -0
- package/runtime/__test__/element-template/runtime/prop-adapters/spread-mts-compiled.test.ts +12 -4
- package/runtime/__test__/element-template/runtime/render/render-components.test.jsx +2 -5
- package/runtime/__test__/element-template/runtime/render/render-direct-native.test.tsx +56 -121
- package/runtime/__test__/element-template/runtime/render/render-direct-suspense.test.ts +18 -17
- package/runtime/__test__/element-template/runtime/render/render-direct.test.ts +5 -4
- package/runtime/__test__/element-template/runtime/render/render-main-thread.contract.test.ts +2 -0
- package/runtime/__test__/element-template/runtime/render/render-main-thread.test.ts +1 -60
- package/runtime/__test__/element-template/runtime/render/render-transform.contract.test.ts +32 -89
- package/runtime/__test__/element-template/runtime/template/element-template-handle.test.ts +8 -6
- package/runtime/__test__/element-template/runtime/template/main-thread-dynamic-attr-state.test.ts +34 -6
- package/runtime/__test__/element-template/test-utils/debug/updateRunner.test.tsx +20 -12
- package/runtime/__test__/element-template/test-utils/debug/updateRunner.ts +2 -28
- package/runtime/__test__/element-template/test-utils/mock/mockNativePapi/templateTree.test.ts +14 -5
- package/runtime/__test__/element-template/test-utils/mock/mockNativePapi/templateTree.ts +1 -57
- package/runtime/__test__/element-template/test-utils/mock/mockNativePapi.ts +29 -13
- package/runtime/__test__/element-template/vitest.config.ts +1 -0
- package/runtime/__test__/guardrails/snapshot-containment.test.ts +98 -77
- package/runtime/__test__/snapshot/compat/export.test.jsx +8 -2
- package/runtime/__test__/snapshot/debug/passive-update-depth.test.jsx +549 -0
- package/runtime/__test__/snapshot/debug/react-hooks-profile.test.jsx +3 -3
- package/runtime/__test__/snapshot/lifecycle/reload-background-function.test.jsx +138 -1
- package/runtime/__test__/snapshot/lifecycle/reload-delayed-background.test.jsx +1 -1
- package/runtime/__test__/snapshot/lifecycle/transfer.mts.test.jsx +194 -0
- package/runtime/__test__/snapshot/lifecycle/transfer.test.jsx +210 -0
- package/runtime/__test__/snapshot/list.test.jsx +109 -0
- package/runtime/__test__/snapshot/lynxQueueMicrotask.test.jsx +2 -2
- package/runtime/__test__/snapshot/ref.test.jsx +124 -1
- package/runtime/__test__/snapshot/utils/envManager.ts +5 -0
- package/runtime/__test__/snapshot/utils/globals.js +1 -0
- package/runtime/__test__/worklet-runtime/delayWorkletEvent.test.js +22 -11
- package/runtime/__test__/worklet-runtime/hydrate.test.js +1 -0
- package/runtime/__test__/worklet-runtime/initEntry.test.js +12 -0
- package/runtime/__test__/worklet-runtime/jsFunctionLifecycle.test.js +24 -16
- package/runtime/__test__/worklet-runtime/runOnBackground.test.js +188 -0
- package/runtime/__test__/worklet-runtime/workletRef.test.js +16 -0
- package/runtime/__test__/worklet-runtime/workletRuntime.test.js +53 -1
- package/runtime/compat/index.d.ts +17 -1
- package/runtime/compat/index.js +3 -2
- package/runtime/lazy/compat.js +1 -0
- package/runtime/lazy/internal.js +1 -0
- package/runtime/lib/core/attribute-name.js.map +1 -0
- package/runtime/lib/core/background-function/run-on-background.js +7 -7
- package/runtime/lib/core/background-function/run-on-background.js.map +1 -1
- package/runtime/lib/{shared → core}/component-stack.js +1 -1
- package/runtime/lib/core/component-stack.js.map +1 -0
- package/runtime/lib/core/deep-equal.d.ts +1 -0
- package/runtime/lib/core/deep-equal.js +31 -0
- package/runtime/lib/core/deep-equal.js.map +1 -0
- package/runtime/lib/core/hooks/mainThreadImpl.js +1 -1
- package/runtime/lib/core/hooks/mainThreadImpl.js.map +1 -1
- package/runtime/lib/core/lynx-page-data.js +1 -1
- package/runtime/lib/core/lynx-page-data.js.map +1 -1
- package/runtime/lib/core/mts-capability.js +1 -1
- package/runtime/lib/core/mts-capability.js.map +1 -1
- package/runtime/lib/core/performance.js +2 -1
- package/runtime/lib/core/performance.js.map +1 -1
- package/runtime/lib/core/ref.d.ts +1 -2
- package/runtime/lib/core/ref.js +60 -9
- package/runtime/lib/core/ref.js.map +1 -1
- package/runtime/lib/core/sync-effect-flush.d.ts +9 -0
- package/runtime/lib/core/sync-effect-flush.js +31 -0
- package/runtime/lib/core/sync-effect-flush.js.map +1 -0
- package/runtime/lib/core/thread-function-call/main-thread.js +1 -1
- package/runtime/lib/core/thread-function-call/main-thread.js.map +1 -1
- package/runtime/lib/element-template/background/attr-slots.d.ts +1 -0
- package/runtime/lib/element-template/background/attr-slots.js.map +1 -1
- package/runtime/lib/element-template/background/commit-hook.js +1 -1
- package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
- package/runtime/lib/element-template/background/destroy.js +1 -1
- package/runtime/lib/element-template/background/destroy.js.map +1 -1
- package/runtime/lib/element-template/background/hydrate.js +173 -85
- package/runtime/lib/element-template/background/hydrate.js.map +1 -1
- package/runtime/lib/element-template/background/instance.d.ts +7 -10
- package/runtime/lib/element-template/background/instance.js +65 -58
- package/runtime/lib/element-template/background/instance.js.map +1 -1
- package/runtime/lib/element-template/background/render-scope.js +2 -1
- package/runtime/lib/element-template/background/render-scope.js.map +1 -1
- package/runtime/lib/element-template/debug/alog.d.ts +1 -10
- package/runtime/lib/element-template/debug/alog.js +1 -16
- package/runtime/lib/element-template/debug/alog.js.map +1 -1
- package/runtime/lib/element-template/debug/profile.js +1 -1
- package/runtime/lib/element-template/debug/profile.js.map +1 -1
- package/runtime/lib/element-template/native/index.js +2 -2
- package/runtime/lib/element-template/native/index.js.map +1 -1
- package/runtime/lib/element-template/native/patch-listener.js +4 -8
- package/runtime/lib/element-template/native/patch-listener.js.map +1 -1
- package/runtime/lib/element-template/native/reload-main-thread.js +0 -4
- package/runtime/lib/element-template/native/reload-main-thread.js.map +1 -1
- package/runtime/lib/element-template/prop-adapters/ref.d.ts +2 -1
- package/runtime/lib/element-template/prop-adapters/ref.js +4 -4
- package/runtime/lib/element-template/prop-adapters/ref.js.map +1 -1
- package/runtime/lib/element-template/prop-adapters/spread.js +1 -1
- package/runtime/lib/element-template/prop-adapters/spread.js.map +1 -1
- package/runtime/lib/element-template/protocol/opcodes.d.ts +0 -2
- package/runtime/lib/element-template/protocol/opcodes.js +0 -2
- package/runtime/lib/element-template/protocol/opcodes.js.map +1 -1
- package/runtime/lib/element-template/protocol/types.d.ts +8 -30
- package/runtime/lib/element-template/protocol/types.js.map +1 -1
- package/runtime/lib/element-template/runtime/list/list.d.ts +14 -54
- package/runtime/lib/element-template/runtime/list/list.js +82 -546
- package/runtime/lib/element-template/runtime/list/list.js.map +1 -1
- package/runtime/lib/element-template/runtime/list/platform-info.d.ts +2 -0
- package/runtime/lib/element-template/runtime/list/platform-info.js +26 -0
- package/runtime/lib/element-template/runtime/list/platform-info.js.map +1 -0
- package/runtime/lib/element-template/runtime/patch.js +42 -119
- package/runtime/lib/element-template/runtime/patch.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/create-rendered-host.d.ts +1 -1
- package/runtime/lib/element-template/runtime/render/create-rendered-host.js +24 -21
- package/runtime/lib/element-template/runtime/render/create-rendered-host.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-components.d.ts +1 -1
- package/runtime/lib/element-template/runtime/render/render-components.js +3 -6
- package/runtime/lib/element-template/runtime/render/render-components.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-direct.js +21 -20
- package/runtime/lib/element-template/runtime/render/render-direct.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-main-thread.js +0 -13
- package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.js +8 -0
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/handle.d.ts +3 -3
- package/runtime/lib/element-template/runtime/template/handle.js +2 -2
- package/runtime/lib/element-template/runtime/template/handle.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-background-function.js +1 -6
- package/runtime/lib/element-template/runtime/template/main-thread-background-function.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.d.ts +2 -1
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js +44 -28
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/typed-attributes.d.ts +2 -0
- package/runtime/lib/element-template/runtime/template/typed-attributes.js +8 -1
- package/runtime/lib/element-template/runtime/template/typed-attributes.js.map +1 -1
- package/runtime/lib/internal.d.ts +1 -0
- package/runtime/lib/internal.js +1 -0
- package/runtime/lib/internal.js.map +1 -1
- package/runtime/lib/lynx-api.js +6 -1
- package/runtime/lib/lynx-api.js.map +1 -1
- package/runtime/lib/lynx.js +4 -4
- package/runtime/lib/lynx.js.map +1 -1
- package/runtime/lib/root.d.ts +5 -1
- package/runtime/lib/root.js +12 -1
- package/runtime/lib/root.js.map +1 -1
- package/runtime/lib/shared/microtask.d.ts +1 -0
- package/runtime/lib/shared/microtask.js +28 -0
- package/runtime/lib/shared/microtask.js.map +1 -0
- package/runtime/lib/shared/utils.d.ts +8 -0
- package/runtime/lib/shared/utils.js +27 -0
- package/runtime/lib/shared/utils.js.map +1 -0
- package/runtime/lib/{worklet-runtime/utils → shared}/version.d.ts +1 -0
- package/runtime/lib/shared/version.js +15 -0
- package/runtime/lib/shared/version.js.map +1 -0
- package/runtime/lib/snapshot/alog/render.js +1 -1
- package/runtime/lib/snapshot/alog/render.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/lifecycle/destroy.js +2 -2
- package/runtime/lib/snapshot/lifecycle/destroy.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/isRendering.js +2 -1
- package/runtime/lib/snapshot/lifecycle/isRendering.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/commit.d.ts +7 -2
- package/runtime/lib/snapshot/lifecycle/patch/commit.js +11 -6
- package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.d.ts +5 -0
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/ref/delay.d.ts +1 -1
- package/runtime/lib/snapshot/lifecycle/ref/delay.js +2 -2
- 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/list/list.js +12 -3
- package/runtime/lib/snapshot/list/list.js.map +1 -1
- package/runtime/lib/snapshot/lynx/tt.d.ts +3 -1
- package/runtime/lib/snapshot/lynx/tt.js +7 -3
- 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/snapshot/backgroundSnapshot.js +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/platformInfo.js +1 -1
- package/runtime/lib/snapshot/snapshot/platformInfo.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/ref.d.ts +1 -0
- package/runtime/lib/snapshot/snapshot/ref.js +2 -2
- package/runtime/lib/snapshot/snapshot/ref.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/snapshot.js +1 -1
- package/runtime/lib/snapshot/snapshot/snapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/spread.js +3 -2
- package/runtime/lib/snapshot/snapshot/spread.js.map +1 -1
- package/runtime/lib/snapshot/transfer.d.ts +15 -0
- package/runtime/lib/snapshot/transfer.js +343 -0
- package/runtime/lib/snapshot/transfer.js.map +1 -0
- package/runtime/lib/snapshot/worklet/functionality.js +1 -1
- package/runtime/lib/snapshot/worklet/functionality.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/runtime/lib/worklet-runtime/api/element.js +1 -1
- package/runtime/lib/worklet-runtime/api/element.js.map +1 -1
- package/runtime/lib/worklet-runtime/api/lynxApi.js +1 -1
- package/runtime/lib/worklet-runtime/api/lynxApi.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/bindings.d.ts +3 -2
- package/runtime/lib/worklet-runtime/bindings/bindings.js +11 -1
- package/runtime/lib/worklet-runtime/bindings/bindings.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/observers.js +9 -1
- package/runtime/lib/worklet-runtime/bindings/observers.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/types.d.ts +1 -0
- package/runtime/lib/worklet-runtime/bindings/types.js.map +1 -1
- package/runtime/lib/worklet-runtime/delayWorkletEvent.d.ts +2 -4
- package/runtime/lib/worklet-runtime/delayWorkletEvent.js +42 -44
- package/runtime/lib/worklet-runtime/delayWorkletEvent.js.map +1 -1
- package/runtime/lib/worklet-runtime/global.d.ts +1 -2
- package/runtime/lib/worklet-runtime/global.js.map +1 -1
- package/runtime/lib/worklet-runtime/hydrate.js +2 -32
- package/runtime/lib/worklet-runtime/hydrate.js.map +1 -1
- package/runtime/lib/worklet-runtime/run-on-background/index.d.ts +28 -0
- package/runtime/lib/worklet-runtime/run-on-background/index.js +103 -0
- package/runtime/lib/worklet-runtime/run-on-background/index.js.map +1 -0
- package/runtime/lib/worklet-runtime/{jsFunctionLifecycle.d.ts → run-on-background/lifecycle.d.ts} +2 -2
- package/runtime/lib/worklet-runtime/{jsFunctionLifecycle.js → run-on-background/lifecycle.js} +12 -9
- package/runtime/lib/worklet-runtime/run-on-background/lifecycle.js.map +1 -0
- package/runtime/lib/worklet-runtime/workletRef.js +51 -54
- package/runtime/lib/worklet-runtime/workletRef.js.map +1 -1
- package/runtime/lib/worklet-runtime/workletRuntime.js +5 -6
- package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
- package/runtime/src/core/background-function/run-on-background.ts +7 -7
- package/runtime/src/{shared → core}/component-stack.ts +1 -1
- package/runtime/src/core/deep-equal.ts +33 -0
- package/runtime/src/core/hooks/mainThreadImpl.ts +1 -1
- package/runtime/src/core/lynx-page-data.ts +1 -1
- package/runtime/src/core/mts-capability.ts +1 -1
- package/runtime/src/core/performance.ts +2 -1
- package/runtime/src/core/ref.ts +92 -15
- package/runtime/src/core/sync-effect-flush.ts +30 -0
- package/runtime/src/core/thread-function-call/main-thread.ts +1 -1
- package/runtime/src/element-template/background/attr-slots.ts +2 -2
- package/runtime/src/element-template/background/commit-hook.ts +1 -1
- package/runtime/src/element-template/background/destroy.ts +1 -1
- package/runtime/src/element-template/background/hydrate.ts +229 -119
- package/runtime/src/element-template/background/instance.ts +82 -82
- package/runtime/src/element-template/background/render-scope.ts +2 -1
- package/runtime/src/element-template/debug/alog.ts +2 -30
- package/runtime/src/element-template/debug/profile.ts +1 -1
- package/runtime/src/element-template/native/index.ts +2 -2
- package/runtime/src/element-template/native/patch-listener.ts +6 -7
- package/runtime/src/element-template/native/reload-main-thread.ts +0 -4
- package/runtime/src/element-template/prop-adapters/ref.ts +12 -5
- package/runtime/src/element-template/prop-adapters/spread.ts +1 -1
- package/runtime/src/element-template/protocol/opcodes.ts +0 -2
- package/runtime/src/element-template/protocol/types.ts +10 -38
- package/runtime/src/element-template/runtime/list/list.ts +115 -744
- package/runtime/src/element-template/runtime/list/platform-info.ts +31 -0
- package/runtime/src/element-template/runtime/patch.ts +59 -163
- package/runtime/src/element-template/runtime/render/create-rendered-host.ts +27 -31
- package/runtime/src/element-template/runtime/render/render-components.ts +2 -5
- package/runtime/src/element-template/runtime/render/render-direct.ts +19 -18
- package/runtime/src/element-template/runtime/render/render-main-thread.ts +0 -14
- package/runtime/src/element-template/runtime/template/attr-slot-plan.ts +9 -0
- package/runtime/src/element-template/runtime/template/handle.ts +3 -2
- package/runtime/src/element-template/runtime/template/main-thread-background-function.ts +1 -6
- package/runtime/src/element-template/runtime/template/main-thread-dynamic-attr-state.ts +44 -30
- package/runtime/src/element-template/runtime/template/typed-attributes.ts +17 -1
- package/runtime/src/element-template/types.d.ts +6 -22
- package/runtime/src/internal.ts +2 -0
- package/runtime/src/lynx-api.ts +6 -1
- package/runtime/src/lynx.ts +4 -4
- package/runtime/src/root.ts +17 -1
- package/runtime/src/shared/microtask.ts +26 -0
- package/runtime/src/shared/utils.ts +37 -0
- package/runtime/src/shared/version.ts +16 -0
- package/runtime/src/snapshot/alog/render.ts +1 -1
- package/runtime/src/snapshot/debug/profileHooks.ts +1 -1
- package/runtime/src/snapshot/lifecycle/destroy.ts +2 -2
- package/runtime/src/snapshot/lifecycle/isRendering.ts +2 -1
- package/runtime/src/snapshot/lifecycle/patch/commit.ts +28 -7
- package/runtime/src/snapshot/lifecycle/patch/updateMainThread.ts +1 -1
- package/runtime/src/snapshot/lifecycle/ref/delay.ts +5 -2
- package/runtime/src/snapshot/lifecycle/reload.ts +1 -1
- package/runtime/src/snapshot/list/list.ts +12 -3
- package/runtime/src/snapshot/lynx/tt.ts +8 -3
- package/runtime/src/snapshot/renderToOpcodes/hydrate.ts +1 -1
- package/runtime/src/snapshot/snapshot/backgroundSnapshot.ts +1 -1
- package/runtime/src/snapshot/snapshot/platformInfo.ts +1 -1
- package/runtime/src/snapshot/snapshot/ref.ts +7 -4
- package/runtime/src/snapshot/snapshot/snapshot.ts +1 -1
- package/runtime/src/snapshot/snapshot/spread.ts +3 -2
- package/runtime/src/snapshot/transfer.ts +379 -0
- package/runtime/src/snapshot/worklet/functionality.ts +1 -1
- package/runtime/src/worklet-runtime/api/element.ts +1 -1
- package/runtime/src/worklet-runtime/api/lynxApi.ts +1 -1
- package/runtime/src/worklet-runtime/bindings/bindings.ts +12 -0
- package/runtime/src/worklet-runtime/bindings/observers.ts +9 -1
- package/runtime/src/worklet-runtime/bindings/types.ts +1 -0
- package/runtime/src/worklet-runtime/delayWorkletEvent.ts +49 -54
- package/runtime/src/worklet-runtime/global.ts +1 -2
- package/runtime/src/worklet-runtime/hydrate.ts +2 -35
- package/runtime/src/worklet-runtime/run-on-background/index.ts +145 -0
- package/runtime/src/worklet-runtime/{jsFunctionLifecycle.ts → run-on-background/lifecycle.ts} +11 -9
- package/runtime/src/worklet-runtime/workletRef.ts +63 -62
- package/runtime/src/worklet-runtime/workletRuntime.ts +10 -10
- package/testing-library/.turbo/turbo-build.log +10 -10
- package/testing-library/dist/pure.js +7 -4
- package/testing-library/dist/setupFiles/common/runtime-setup.js +3 -1
- package/testing-library/dist/setupFiles/inner/rstest.js +1 -1
- package/testing-library/dist/setupFiles/inner/vitest.js +1 -1
- package/testing-library/src/__tests__/list.test.jsx +52 -0
- package/testing-library/src/__tests__/worklet.test.jsx +81 -0
- package/testing-library/src/pure.jsx +5 -2
- package/testing-library/src/setupFiles/common/runtime-setup.js +2 -0
- package/transform/.turbo/turbo-build$colon$wasm.log +88 -201
- package/transform/crates/swc_plugin_element_template/tests/element_template.rs +19 -45
- package/transform/crates/swc_plugin_element_template/tests/element_template_contract.rs +0 -19
- package/transform/rspack-napi/tsconfig.tsbuildinfo +1 -1
- package/transform/swc-plugin-reactlynx/.turbo/turbo-build.log +129 -156
- package/transform/swc-plugin-reactlynx-compat/.turbo/turbo-build.log +282 -149
- package/runtime/__test__/element-template/fixtures/background/hydrate/coverage.move-before-child/output.txt +0 -10
- package/runtime/__test__/element-template/fixtures/background/hydrate/coverage.raw-text-key-branches/case.tsx +0 -5
- package/runtime/__test__/element-template/fixtures/background/instance/ops/supports-silent-insert-before/case.ts +0 -11
- package/runtime/__test__/element-template/fixtures/background/instance/ops/supports-silent-insert-before/output.txt +0 -1
- package/runtime/__test__/element-template/fixtures/background/instance/ops/treats-nullish-attrs-as-empty-object/case.ts +0 -23
- package/runtime/__test__/element-template/fixtures/background/instance/ops/treats-nullish-attrs-as-empty-object/output.txt +0 -6
- package/runtime/__test__/element-template/runtime/page/authored-page.test.ts +0 -35
- package/runtime/__test__/element-template/runtime/patch/update-fixture-helper.test.tsx +0 -40
- package/runtime/__test__/snapshot/lynx-data-processors.test.ts +0 -3
- package/runtime/lib/shared/attribute-name.js.map +0 -1
- package/runtime/lib/shared/component-stack.js.map +0 -1
- package/runtime/lib/snapshot/alog/index.d.ts +0 -1
- package/runtime/lib/snapshot/alog/index.js +0 -8
- package/runtime/lib/snapshot/alog/index.js.map +0 -1
- package/runtime/lib/utils.d.ts +0 -19
- package/runtime/lib/utils.js +0 -119
- package/runtime/lib/utils.js.map +0 -1
- package/runtime/lib/worklet-runtime/delayRunOnBackground.d.ts +0 -13
- package/runtime/lib/worklet-runtime/delayRunOnBackground.js +0 -29
- package/runtime/lib/worklet-runtime/delayRunOnBackground.js.map +0 -1
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js.map +0 -1
- package/runtime/lib/worklet-runtime/utils/version.js +0 -10
- package/runtime/lib/worklet-runtime/utils/version.js.map +0 -1
- package/runtime/src/snapshot/alog/index.ts +0 -8
- package/runtime/src/utils.ts +0 -134
- package/runtime/src/worklet-runtime/delayRunOnBackground.ts +0 -53
- package/runtime/src/worklet-runtime/utils/version.ts +0 -11
- /package/runtime/__test__/element-template/fixtures/background/hydrate/{coverage.raw-text-key-branches → children.reconciles-raw-text-slots}/output.txt +0 -0
- /package/runtime/lib/{shared → core}/attribute-name.d.ts +0 -0
- /package/runtime/lib/{shared → core}/attribute-name.js +0 -0
- /package/runtime/lib/{shared → core}/component-stack.d.ts +0 -0
- /package/runtime/src/{shared → core}/attribute-name.ts +0 -0
|
@@ -5,8 +5,8 @@ import { getAttributeSlotUpdateOp } from './attr-slots.js';
|
|
|
5
5
|
import { globalCommitContext, markRemovedSubtreeForPostDispatchTeardown } from './commit-context.js';
|
|
6
6
|
import { BUILTIN_RAW_TEXT_TEMPLATE_KEY, BackgroundListElementTemplateInstance, collectMainThreadRefSubtreeHandleIds, getContainingListItem, toUpdateTypedListItemCommand, } from './instance.js';
|
|
7
7
|
import { backgroundElementTemplateInstanceManager } from './manager.js';
|
|
8
|
+
import { isDirectOrDeepEqual } from '../../core/deep-equal.js';
|
|
8
9
|
import { isMainThreadFunction } from '../../core/main-thread-function.js';
|
|
9
|
-
import { isDirectOrDeepEqual } from '../../utils.js';
|
|
10
10
|
import { hydrationMap } from '../hydration-map.js';
|
|
11
11
|
import { isGestureSlotValue } from '../prop-adapters/gesture.js';
|
|
12
12
|
import { isMainThreadEventPropKey, isSpreadRecord } from '../prop-adapters/spread.js';
|
|
@@ -16,10 +16,6 @@ import { elementTemplateIdentityKey, parseElementTemplateType } from '../protoco
|
|
|
16
16
|
import { getMainThreadDynamicAttrSlotKinds } from '../runtime/template/attr-slot-plan.js';
|
|
17
17
|
import { isMTEventNativeWrapper } from '../runtime/template/main-thread-event-ctx.js';
|
|
18
18
|
const MAIN_BUNDLE_URL_SENTINEL = '__Card__';
|
|
19
|
-
const COMPONENT_AT_INDEX_ATTR = 'component-at-index';
|
|
20
|
-
const COMPONENT_AT_INDEXES_ATTR = 'component-at-indexes';
|
|
21
|
-
const ENQUEUE_COMPONENT_ATTR = 'enqueue-component';
|
|
22
|
-
const UPDATE_LIST_INFO_ATTR = 'update-list-info';
|
|
23
19
|
export function hydrateRootChildrenIntoContext(serializedChildren, root) {
|
|
24
20
|
try {
|
|
25
21
|
return hydrateChildListIntoContext(ELEMENT_TEMPLATE_PAGE_HANDLE_ID, ELEMENT_TEMPLATE_PAGE_ROOT_SLOT_INDEX, serializedChildren, root.childNodes);
|
|
@@ -27,8 +23,10 @@ export function hydrateRootChildrenIntoContext(serializedChildren, root) {
|
|
|
27
23
|
finally {
|
|
28
24
|
// Template identities only need caching for this synchronous hydration pass.
|
|
29
25
|
backgroundHydrateKeys.clear();
|
|
26
|
+
hydratedListItemsNeedingSubtreeSync.clear();
|
|
30
27
|
}
|
|
31
28
|
}
|
|
29
|
+
const hydratedListItemsNeedingSubtreeSync = new Set();
|
|
32
30
|
function isSerializedCompiledNode(serialized) {
|
|
33
31
|
return typeof serialized.templateKey === 'string';
|
|
34
32
|
}
|
|
@@ -94,6 +92,8 @@ function hydrateInstance(serialized, instance) {
|
|
|
94
92
|
lynx.reportError(new Error(`ElementTemplate hydrate does not support serialized typed node '${serialized.tag}'.`));
|
|
95
93
|
return false;
|
|
96
94
|
}
|
|
95
|
+
// Match List items separately, then reuse the shared structural patch
|
|
96
|
+
// emitter.
|
|
97
97
|
return hydrateListInstance(serialized, instance);
|
|
98
98
|
}
|
|
99
99
|
function hydrateCompiledInstance(serialized, instance) {
|
|
@@ -150,54 +150,174 @@ function normalizeSerializedBundleUrl(bundleUrl) {
|
|
|
150
150
|
return bundleUrl === undefined || bundleUrl === MAIN_BUNDLE_URL_SENTINEL ? null : bundleUrl;
|
|
151
151
|
}
|
|
152
152
|
function getSerializedTypedListChildren(serialized) {
|
|
153
|
-
|
|
153
|
+
// Native List stores logical items in childSlots[0].
|
|
154
|
+
// A missing or empty slot 0 represents an empty List.
|
|
155
|
+
return serialized.childSlots?.[0] ?? [];
|
|
156
|
+
}
|
|
157
|
+
function getSerializedListItemPlatformInfo(serialized) {
|
|
158
|
+
const options = serialized.options;
|
|
159
|
+
if (!options || !('__listItemPlatformInfo' in options)) {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
const platformInfo = options['__listItemPlatformInfo'];
|
|
163
|
+
// Require an attribute object for platform info.
|
|
164
|
+
if (platformInfo == null
|
|
165
|
+
|| typeof platformInfo !== 'object'
|
|
166
|
+
|| Array.isArray(platformInfo)) {
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
// Reuse the ET serializable attribute type and preserve the original object.
|
|
170
|
+
return platformInfo;
|
|
171
|
+
}
|
|
172
|
+
function getListItemHydrateKey(platformInfo) {
|
|
173
|
+
const itemKey = platformInfo?.['item-key'];
|
|
174
|
+
// Nullish item keys use the unkeyed group. Empty strings are valid keys.
|
|
175
|
+
// Normalize provided keys to strings to preserve RL3's object-key grouping.
|
|
176
|
+
return itemKey == null ? undefined : String(itemKey);
|
|
154
177
|
}
|
|
155
178
|
function hydrateListInstance(serialized, instance) {
|
|
156
|
-
|
|
157
|
-
lynx.reportError(new Error('ElementTemplate hydrate typed list does not support childSlots.'));
|
|
158
|
-
return false;
|
|
159
|
-
}
|
|
160
|
-
const listChildren = getSerializedTypedListChildren(serialized);
|
|
161
|
-
if (__DEV__ && !Array.isArray(listChildren)) {
|
|
162
|
-
lynx.reportError(new Error('ElementTemplate hydrate typed list requires options.listChildren.'));
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
179
|
+
const serializedChildren = getSerializedTypedListChildren(serialized);
|
|
165
180
|
const backgroundChildren = instance.childNodes;
|
|
181
|
+
if (__DEV__) {
|
|
182
|
+
// Both sides store logical List items in slot 0.
|
|
183
|
+
const hasUnsupportedSerializedSlot = serialized.childSlots?.some((children, slotIndex) => slotIndex !== 0 && (children?.length ?? 0) > 0);
|
|
184
|
+
// A child's __slotIndex identifies its logical slot.
|
|
185
|
+
const hasUnsupportedBackgroundSlot = backgroundChildren.some(child => child.__slotIndex !== 0);
|
|
186
|
+
if (hasUnsupportedSerializedSlot || hasUnsupportedBackgroundSlot) {
|
|
187
|
+
lynx.reportError(new Error('ElementTemplate hydrate typed list only supports logical slot 0.'));
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
166
191
|
const handleId = serialized.uid;
|
|
167
192
|
if (!bindHydrationHandleId(instance, handleId, serialized.tag)) {
|
|
168
193
|
return false;
|
|
169
194
|
}
|
|
170
195
|
instance.prepareAttributeSlotsForHydration();
|
|
171
|
-
hydrateAttributeSlots(serialized.tag, handleId, [
|
|
172
|
-
|
|
196
|
+
hydrateAttributeSlots(serialized.tag, handleId, [serialized.attributes ?? null], instance.attributeSlots);
|
|
197
|
+
// The List UID and attributes are hydrated before this empty-children fast
|
|
198
|
+
// path.
|
|
199
|
+
if (serializedChildren.length === 0 && backgroundChildren.length === 0) {
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
// Hydrate matched items recursively and preserve insertion, removal, and move
|
|
203
|
+
// distinctions.
|
|
204
|
+
const listDiff = hydrateMatchingListChildrenAndDiff(handleId, serializedChildren, backgroundChildren);
|
|
173
205
|
if (listDiff === null) {
|
|
174
206
|
return false;
|
|
175
207
|
}
|
|
176
|
-
|
|
208
|
+
// Reuse child-slot structural commands so native records List changes in slot
|
|
209
|
+
// 0.
|
|
210
|
+
if (!emitHydrateChildrenDiff(handleId, 0, serializedChildren, listDiff)) {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
for (let index = 0; index < backgroundChildren.length; index += 1) {
|
|
214
|
+
const child = backgroundChildren[index];
|
|
215
|
+
if (!hydratedListItemsNeedingSubtreeSync.delete(child)) {
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
globalCommitContext.ops.push(ElementTemplateUpdateOps.updateTypedListItem, handleId, toUpdateTypedListItemCommand(child, false));
|
|
219
|
+
}
|
|
220
|
+
return true;
|
|
177
221
|
}
|
|
178
|
-
function
|
|
179
|
-
|
|
180
|
-
|
|
222
|
+
function hydrateMatchingListChildrenAndDiff(listHandleId, serializedChildren, backgroundChildren) {
|
|
223
|
+
const result = {
|
|
224
|
+
insertions: {},
|
|
225
|
+
insertionCount: 0,
|
|
226
|
+
removals: [],
|
|
227
|
+
moves: {},
|
|
228
|
+
};
|
|
229
|
+
// Explicit item-key values are unique on each side, so each key maps to one
|
|
230
|
+
// old node.
|
|
231
|
+
const serializedByItemKey = new Map();
|
|
232
|
+
// Group unkeyed nodes by template identity.
|
|
233
|
+
// Preserve their old order and consume candidates with a per-template cursor.
|
|
234
|
+
const serializedByTemplateKey = new Map();
|
|
235
|
+
// Track old positions to detect moves.
|
|
236
|
+
// Remove matched records so the remaining entries identify deleted nodes.
|
|
237
|
+
const remainingOldIndices = new Map();
|
|
238
|
+
for (let oldIndex = 0; oldIndex < serializedChildren.length; oldIndex++) {
|
|
239
|
+
const serialized = serializedChildren[oldIndex];
|
|
240
|
+
const itemKey = getListItemHydrateKey(getSerializedListItemPlatformInfo(serialized));
|
|
241
|
+
remainingOldIndices.set(serialized, oldIndex);
|
|
242
|
+
if (itemKey !== undefined) {
|
|
243
|
+
// Index keyed nodes for matching by item-key.
|
|
244
|
+
serializedByItemKey.set(itemKey, serialized);
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
// Queue unkeyed nodes by normalized template identity.
|
|
248
|
+
const templateKey = getSerializedNodeHydrateKey(serialized);
|
|
249
|
+
let group = serializedByTemplateKey.get(templateKey);
|
|
250
|
+
if (group === undefined) {
|
|
251
|
+
group = { nodes: [], cursor: 0 };
|
|
252
|
+
serializedByTemplateKey.set(templateKey, group);
|
|
253
|
+
}
|
|
254
|
+
group.nodes.push(serialized);
|
|
181
255
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
256
|
+
let lastPlacedIndex = 0;
|
|
257
|
+
for (let newIndex = 0; newIndex < backgroundChildren.length; newIndex++) {
|
|
258
|
+
const instance = backgroundChildren[newIndex];
|
|
259
|
+
const itemKey = getListItemHydrateKey(instance.getListItemPlatformInfo());
|
|
260
|
+
const templateKey = getBackgroundNodeHydrateKey(instance.type);
|
|
261
|
+
let serialized;
|
|
262
|
+
if (itemKey === undefined) {
|
|
263
|
+
const group = serializedByTemplateKey.get(templateKey);
|
|
264
|
+
serialized = group?.nodes[group.cursor];
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
serialized = serializedByItemKey.get(itemKey);
|
|
268
|
+
}
|
|
269
|
+
if (serialized === undefined || getSerializedNodeHydrateKey(serialized) !== templateKey) {
|
|
270
|
+
// Record an insertion when no compatible candidate exists.
|
|
271
|
+
result.insertions[newIndex] = instance;
|
|
272
|
+
result.insertionCount += 1;
|
|
273
|
+
// Keep the old candidate pending removal.
|
|
195
274
|
continue;
|
|
196
275
|
}
|
|
197
|
-
|
|
198
|
-
|
|
276
|
+
if (!hydrateInstance(serialized, instance)) {
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
// The item now uses its native UID.
|
|
280
|
+
// Emit updateTypedListItem when platform info changes.
|
|
281
|
+
hydrateListItemPlatformInfo(listHandleId, serialized, instance);
|
|
282
|
+
// Remove the matched node from the pending-removal map.
|
|
283
|
+
const oldIndex = remainingOldIndices.get(serialized);
|
|
284
|
+
remainingOldIndices.delete(serialized);
|
|
285
|
+
if (itemKey === undefined) {
|
|
286
|
+
serializedByTemplateKey.get(templateKey).cursor += 1;
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
serializedByItemKey.delete(itemKey);
|
|
290
|
+
}
|
|
291
|
+
if (oldIndex < lastPlacedIndex) {
|
|
292
|
+
// Record a move for the retained item.
|
|
293
|
+
result.moves[oldIndex] = {
|
|
294
|
+
toIndex: newIndex,
|
|
295
|
+
instance,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
lastPlacedIndex = oldIndex;
|
|
300
|
+
}
|
|
199
301
|
}
|
|
200
|
-
|
|
302
|
+
// Remove the old nodes left unmatched.
|
|
303
|
+
// The Map preserves old order, so remaining indexes are already sorted.
|
|
304
|
+
for (const oldIndex of remainingOldIndices.values()) {
|
|
305
|
+
result.removals.push(oldIndex);
|
|
306
|
+
}
|
|
307
|
+
return result;
|
|
308
|
+
}
|
|
309
|
+
function hydrateListItemPlatformInfo(listHandleId, serialized, instance) {
|
|
310
|
+
const before = getSerializedListItemPlatformInfo(serialized) ?? {};
|
|
311
|
+
const after = instance.getListItemPlatformInfo();
|
|
312
|
+
if (isDirectOrDeepEqual(before, after)) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
globalCommitContext.ops.push(ElementTemplateUpdateOps.updateTypedListItem, listHandleId, {
|
|
316
|
+
__etHandleRef: serialized.uid,
|
|
317
|
+
type: instance.type,
|
|
318
|
+
platformInfo: after,
|
|
319
|
+
subtreeHandleIds: null,
|
|
320
|
+
});
|
|
201
321
|
}
|
|
202
322
|
function hydrateChildListIntoContext(targetHandleId, slotId, serializedChildren, backgroundChildren) {
|
|
203
323
|
if (backgroundChildren.length === 0) {
|
|
@@ -235,6 +355,11 @@ function hydrateChildListIntoContext(targetHandleId, slotId, serializedChildren,
|
|
|
235
355
|
}
|
|
236
356
|
// Hydrate emits patches directly here. Replaying against serialized order
|
|
237
357
|
// keeps insert targets in the main-thread slot without reshaping background.
|
|
358
|
+
return emitHydrateChildrenDiff(targetHandleId, slotId, serializedChildren, listDiff);
|
|
359
|
+
}
|
|
360
|
+
function emitHydrateChildrenDiff(targetHandleId, slotId, serializedChildren, listDiff) {
|
|
361
|
+
// serializedChildren supplies the old order and insertion anchors.
|
|
362
|
+
// listDiff describes the target changes.
|
|
238
363
|
const removalIndexes = new Set(listDiff.removals);
|
|
239
364
|
const { insertions, moves } = listDiff;
|
|
240
365
|
const movesWaitingForInsertionPoint = new Map();
|
|
@@ -268,9 +393,14 @@ function hydrateChildListIntoContext(targetHandleId, slotId, serializedChildren,
|
|
|
268
393
|
}
|
|
269
394
|
else if (insertions[newIndex] !== undefined) {
|
|
270
395
|
const insertedChild = insertions[newIndex];
|
|
396
|
+
const containingListItem = getContainingListItem(insertedChild);
|
|
397
|
+
const subtreeHandleIds = collectMainThreadRefSubtreeHandleIds(insertedChild);
|
|
271
398
|
keepCurrentSerializedChild = true;
|
|
272
399
|
emitCreateSubtree(insertedChild);
|
|
273
|
-
globalCommitContext.ops.push(ElementTemplateUpdateOps.insertNode, targetHandleId, slotId, insertedChild.instanceId, beforeChildId,
|
|
400
|
+
globalCommitContext.ops.push(ElementTemplateUpdateOps.insertNode, targetHandleId, slotId, insertedChild.instanceId, beforeChildId, containingListItem ? null : subtreeHandleIds);
|
|
401
|
+
if (containingListItem && subtreeHandleIds !== null) {
|
|
402
|
+
hydratedListItemsNeedingSubtreeSync.add(containingListItem);
|
|
403
|
+
}
|
|
274
404
|
insertOrMovePatchesWaitingForInsertionPoint -= 1;
|
|
275
405
|
}
|
|
276
406
|
newIndex += 1;
|
|
@@ -321,15 +451,14 @@ function collectRemovableSerializedSubtreeHandleIdsInto(serialized, handles) {
|
|
|
321
451
|
return false;
|
|
322
452
|
}
|
|
323
453
|
const serializedList = serialized;
|
|
324
|
-
|
|
325
|
-
|
|
454
|
+
// Collect all logical item UIDs from slot 0 when removing a List or its
|
|
455
|
+
// ancestor.
|
|
456
|
+
if (__DEV__
|
|
457
|
+
&& serializedList.childSlots?.some((children, slotIndex) => slotIndex !== 0 && (children?.length ?? 0) > 0)) {
|
|
458
|
+
lynx.reportError(new Error('ElementTemplate hydrate typed list only supports logical slot 0.'));
|
|
326
459
|
return false;
|
|
327
460
|
}
|
|
328
461
|
const listChildren = getSerializedTypedListChildren(serializedList);
|
|
329
|
-
if (__DEV__ && !Array.isArray(listChildren)) {
|
|
330
|
-
lynx.reportError(new Error('ElementTemplate hydrate typed list requires options.listChildren.'));
|
|
331
|
-
return false;
|
|
332
|
-
}
|
|
333
462
|
for (const child of listChildren) {
|
|
334
463
|
if (!collectRemovableSerializedSubtreeHandleIdsInto(child, handles)) {
|
|
335
464
|
return false;
|
|
@@ -348,47 +477,6 @@ function getRemovableSerializedHandleId(serialized) {
|
|
|
348
477
|
}
|
|
349
478
|
return handleId;
|
|
350
479
|
}
|
|
351
|
-
function emitHydrateTypedListReconciliation(instance, serializedChildren, backgroundChildren, listDiff) {
|
|
352
|
-
const movedOldIndexes = Object.keys(listDiff.moves).map(Number);
|
|
353
|
-
const removalIndexes = listDiff.removals.concat(movedOldIndexes).sort((a, b) => a - b);
|
|
354
|
-
for (let index = 0; index < removalIndexes.length; index += 1) {
|
|
355
|
-
const oldIndex = removalIndexes[index];
|
|
356
|
-
const serialized = serializedChildren[oldIndex];
|
|
357
|
-
let itemId;
|
|
358
|
-
const removedSubtreeHandleIds = [];
|
|
359
|
-
if (listDiff.moves[oldIndex] === undefined) {
|
|
360
|
-
if (!collectRemovableSerializedSubtreeHandleIdsInto(serialized, removedSubtreeHandleIds)) {
|
|
361
|
-
return false;
|
|
362
|
-
}
|
|
363
|
-
itemId = removedSubtreeHandleIds[0];
|
|
364
|
-
}
|
|
365
|
-
else {
|
|
366
|
-
itemId = serialized.uid;
|
|
367
|
-
}
|
|
368
|
-
globalCommitContext.ops.push(ElementTemplateUpdateOps.removeTypedListItem, instance.instanceId, itemId, removedSubtreeHandleIds);
|
|
369
|
-
}
|
|
370
|
-
const insertedIndexes = Object.keys(listDiff.insertions).map(Number);
|
|
371
|
-
let movedToIndexes = null;
|
|
372
|
-
for (let index = 0; index < movedOldIndexes.length; index += 1) {
|
|
373
|
-
const toIndex = listDiff.moves[movedOldIndexes[index]].toIndex;
|
|
374
|
-
insertedIndexes.push(toIndex);
|
|
375
|
-
(movedToIndexes ??= new Set()).add(toIndex);
|
|
376
|
-
}
|
|
377
|
-
insertedIndexes.sort((a, b) => b - a);
|
|
378
|
-
for (let index = 0; index < insertedIndexes.length; index += 1) {
|
|
379
|
-
const insertedIndex = insertedIndexes[index];
|
|
380
|
-
const child = backgroundChildren[insertedIndex];
|
|
381
|
-
emitCreateSubtree(child);
|
|
382
|
-
globalCommitContext.ops.push(ElementTemplateUpdateOps.insertTypedListItem, instance.instanceId, toUpdateTypedListItemCommand(child), backgroundChildren[insertedIndex + 1]?.instanceId ?? 0);
|
|
383
|
-
}
|
|
384
|
-
for (let index = 0; index < backgroundChildren.length; index += 1) {
|
|
385
|
-
if (listDiff.insertions[index] || movedToIndexes?.has(index)) {
|
|
386
|
-
continue;
|
|
387
|
-
}
|
|
388
|
-
globalCommitContext.ops.push(ElementTemplateUpdateOps.updateTypedListItem, instance.instanceId, toUpdateTypedListItemCommand(backgroundChildren[index]));
|
|
389
|
-
}
|
|
390
|
-
return true;
|
|
391
|
-
}
|
|
392
480
|
function emitCreateSubtree(node) {
|
|
393
481
|
// Linked-list walk: slot grouping would be discarded since we recurse into
|
|
394
482
|
// every child regardless of slot. `emitCreate` does its own single-walk
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydrate.js","sourceRoot":"","sources":["../../../src/element-template/background/hydrate.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,yCAAyC,EAAE,MAAM,qBAAqB,CAAC;AACrG,OAAO,EACL,6BAA6B,EAC7B,qCAAqC,EACrC,oCAAoC,EACpC,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,wCAAwC,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,+BAA+B,EAAE,qCAAqC,EAAE,MAAM,qBAAqB,CAAC;AAC7G,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAOpG,OAAO,EAAE,iCAAiC,EAAE,MAAM,uCAAuC,CAAC;AAE1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAGtF,MAAM,wBAAwB,GAAG,UAAU,CAAC;AAC5C,MAA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served.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport { getAttributeSlotUpdateOp } from './attr-slots.js';\nimport { globalCommitContext, markRemovedSubtreeForPostDispatchTeardown } from './commit-context.js';\nimport {\n BUILTIN_RAW_TEXT_TEMPLATE_KEY,\n BackgroundListElementTemplateInstance,\n collectMainThreadRefSubtreeHandleIds,\n getContainingListItem,\n toUpdateTypedListItemCommand,\n} from './instance.js';\nimport type { BackgroundElementTemplateInstance } from './instance.js';\nimport { backgroundElementTemplateInstanceManager } from './manager.js';\nimport { isMainThreadFunction } from '../../core/main-thread-function.js';\nimport { isDirectOrDeepEqual } from '../../utils.js';\nimport { hydrationMap } from '../hydration-map.js';\nimport { isGestureSlotValue } from '../prop-adapters/gesture.js';\nimport { isMainThreadEventPropKey, isSpreadRecord } from '../prop-adapters/spread.js';\nimport { ElementTemplateUpdateOps } from '../protocol/opcodes.js';\nimport { ELEMENT_TEMPLATE_PAGE_HANDLE_ID, ELEMENT_TEMPLATE_PAGE_ROOT_SLOT_INDEX } from '../protocol/page.js';\nimport { elementTemplateIdentityKey, parseElementTemplateType } from '../protocol/template-type.js';\nimport type {\n SerializableValue,\n SerializedCompiledNode,\n SerializedEtNode,\n SerializedTypedListNode,\n} from '../protocol/types.js';\nimport { getMainThreadDynamicAttrSlotKinds } from '../runtime/template/attr-slot-plan.js';\nimport type { MainThreadDynamicAttrKind } from '../runtime/template/attr-slot-plan.js';\nimport { isMTEventNativeWrapper } from '../runtime/template/main-thread-event-ctx.js';\nimport type { MTRefNativeWrapper } from '../runtime/template/main-thread-ref-ctx.js';\n\nconst MAIN_BUNDLE_URL_SENTINEL = '__Card__';\nconst COMPONENT_AT_INDEX_ATTR = 'component-at-index';\nconst COMPONENT_AT_INDEXES_ATTR = 'component-at-indexes';\nconst ENQUEUE_COMPONENT_ATTR = 'enqueue-component';\nconst UPDATE_LIST_INFO_ATTR = 'update-list-info';\n\nexport function hydrateRootChildrenIntoContext(\n serializedChildren: SerializedEtNode[],\n root: BackgroundElementTemplateInstance,\n): boolean {\n try {\n return hydrateChildListIntoContext(\n ELEMENT_TEMPLATE_PAGE_HANDLE_ID,\n ELEMENT_TEMPLATE_PAGE_ROOT_SLOT_INDEX,\n serializedChildren,\n root.childNodes,\n );\n } finally {\n // Template identities only need caching for this synchronous hydration pass.\n backgroundHydrateKeys.clear();\n }\n}\n\nfunction isSerializedCompiledNode(serialized: SerializedEtNode): serialized is SerializedCompiledNode {\n return typeof (serialized as { templateKey?: unknown }).templateKey === 'string';\n}\n\nfunction isSerializedTypedListNode(serialized: SerializedEtNode): serialized is SerializedTypedListNode {\n return !isSerializedCompiledNode(serialized) && serialized.tag === 'list';\n}\n\ninterface HydrateChildListDiff {\n // Background child at a new slot index that has no matching serialized child.\n insertions: Record<number, BackgroundElementTemplateInstance>;\n insertionCount: number;\n // Serialized child indexes that no longer exist in the background slot.\n removals: number[];\n // Serialized child old index -> same-slot reorder target.\n moves: Record<number, { toIndex: number; instance: BackgroundElementTemplateInstance }>;\n}\n\nfunction hydrateMatchingChildrenAndDiffSlot(\n serializedChildren: SerializedEtNode[],\n backgroundChildren: BackgroundElementTemplateInstance[],\n): HydrateChildListDiff | null {\n let lastPlacedIndex = 0;\n const result: HydrateChildListDiff = {\n insertions: {},\n insertionCount: 0,\n removals: [],\n moves: {},\n };\n const serializedByNodeKey: Record<string, [SerializedEtNode, number][]> = {};\n const serializedCursorByNodeKey: Record<string, number> = {};\n\n for (let i = 0; i < serializedChildren.length; i += 1) {\n const node = serializedChildren[i]!;\n const key = getSerializedNodeHydrateKey(node);\n (serializedByNodeKey[key] ??= []).push([node, i]);\n }\n\n for (let i = 0; i < backgroundChildren.length; i += 1) {\n const backgroundChild = backgroundChildren[i]!;\n // Normalize the background instance's full `${entry}:${key}` type tag to the\n // same native identity the serialized side uses (sentinel folded to the main\n // card), so main-card nodes match regardless of the `__Card__` prefix.\n const backgroundKey = getBackgroundNodeHydrateKey(backgroundChild.type);\n const serializedCandidates = serializedByNodeKey[backgroundKey];\n const candidateCursor = serializedCursorByNodeKey[backgroundKey] ?? 0;\n const matchedSerialized = serializedCandidates?.[candidateCursor];\n\n if (matchedSerialized) {\n serializedCursorByNodeKey[backgroundKey] = candidateCursor + 1;\n const oldIndex = matchedSerialized[1];\n if (!hydrateInstance(matchedSerialized[0], backgroundChild)) {\n return null;\n }\n if (oldIndex < lastPlacedIndex) {\n result.moves[oldIndex] = { toIndex: i, instance: backgroundChild };\n } else {\n lastPlacedIndex = oldIndex;\n }\n } else {\n result.insertions[i] = backgroundChild;\n result.insertionCount += 1;\n }\n }\n\n for (const key in serializedByNodeKey) {\n const candidates = serializedByNodeKey[key]!;\n const candidateCursor = serializedCursorByNodeKey[key] ?? 0;\n for (let i = candidateCursor; i < candidates.length; i += 1) {\n result.removals.push(candidates[i]![1]);\n }\n }\n\n return result;\n}\n\nfunction hydrateInstance(\n serialized: SerializedEtNode,\n instance: BackgroundElementTemplateInstance,\n): boolean {\n if (isSerializedCompiledNode(serialized)) {\n return hydrateCompiledInstance(serialized, instance);\n }\n if (__DEV__ && !isSerializedTypedListNode(serialized)) {\n lynx.reportError(\n new Error(`ElementTemplate hydrate does not support serialized typed node '${serialized.tag}'.`),\n );\n return false;\n }\n return hydrateListInstance(\n serialized as SerializedTypedListNode,\n instance as BackgroundListElementTemplateInstance,\n );\n}\n\nfunction hydrateCompiledInstance(\n serialized: SerializedCompiledNode,\n instance: BackgroundElementTemplateInstance,\n): boolean {\n const handleId = serialized.uid;\n if (!bindHydrationHandleId(instance, handleId, serialized.templateKey)) {\n return false;\n }\n if (serialized.attributeSlots?.length || instance.attributeSlots.length) {\n instance.prepareAttributeSlotsForHydration();\n hydrateAttributeSlots(instance.type, handleId, serialized.attributeSlots ?? [], instance.attributeSlots);\n }\n\n if (serialized.templateKey === BUILTIN_RAW_TEXT_TEMPLATE_KEY) {\n return true;\n }\n\n if (!serialized.childSlots?.length && !instance.firstChild) {\n return true;\n }\n\n const serializedChildSlots = serialized.childSlots ?? [];\n const backgroundChildSlots = instance.childSlots;\n // Snapshot hydrates dynamic children through slot-filtered lists. Keeping ET\n // scoped the same way means a cross-slot candidate is a source remove plus a\n // target create/insert, while same-slot reorder can still stay move-like.\n const slotCount = Math.max(serializedChildSlots.length, backgroundChildSlots.length);\n for (let slotId = 0; slotId < slotCount; slotId += 1) {\n const serializedSlot = serializedChildSlots[slotId];\n const backgroundSlot = backgroundChildSlots[slotId];\n if (!serializedSlot && !backgroundSlot) {\n continue;\n }\n if (\n !hydrateChildListIntoContext(\n instance.instanceId,\n slotId,\n serializedSlot ?? [],\n backgroundSlot ?? [],\n )\n ) {\n return false;\n }\n }\n return true;\n}\n\nconst backgroundHydrateKeys = new Map<string, string>();\n\nfunction getBackgroundNodeHydrateKey(type: string): string {\n const cached = backgroundHydrateKeys.get(type);\n if (cached !== undefined) {\n return cached;\n }\n const parsed = parseElementTemplateType(type);\n const key = elementTemplateIdentityKey(parsed.templateKey, parsed.bundleUrl);\n backgroundHydrateKeys.set(type, key);\n return key;\n}\n\nfunction getSerializedNodeHydrateKey(serialized: SerializedEtNode): string {\n if (!isSerializedCompiledNode(serialized)) {\n return serialized.tag;\n }\n return elementTemplateIdentityKey(\n serialized.templateKey,\n normalizeSerializedBundleUrl(serialized.bundleUrl),\n );\n}\n\nfunction normalizeSerializedBundleUrl(bundleUrl: string | undefined): string | null {\n return bundleUrl === undefined || bundleUrl === MAIN_BUNDLE_URL_SENTINEL ? null : bundleUrl;\n}\n\nfunction getSerializedTypedListChildren(serialized: SerializedTypedListNode): SerializedEtNode[] {\n return (__DEV__ ? serialized.options?.listChildren : serialized.options!.listChildren)!;\n}\n\nfunction hydrateListInstance(\n serialized: SerializedTypedListNode,\n instance: BackgroundListElementTemplateInstance,\n): boolean {\n if (__DEV__ && (serialized.childSlots?.length ?? 0) > 0) {\n lynx.reportError(new Error('ElementTemplate hydrate typed list does not support childSlots.'));\n return false;\n }\n\n const listChildren = getSerializedTypedListChildren(serialized);\n if (__DEV__ && !Array.isArray(listChildren)) {\n lynx.reportError(new Error('ElementTemplate hydrate typed list requires options.listChildren.'));\n return false;\n }\n\n const backgroundChildren = instance.childNodes;\n const handleId = serialized.uid;\n if (!bindHydrationHandleId(instance, handleId, serialized.tag)) {\n return false;\n }\n instance.prepareAttributeSlotsForHydration();\n hydrateAttributeSlots(\n serialized.tag,\n handleId,\n [getStableSerializedListAttributes(serialized.attributes)],\n instance.attributeSlots,\n );\n\n const listDiff = hydrateMatchingChildrenAndDiffSlot(listChildren, backgroundChildren);\n if (listDiff === null) {\n return false;\n }\n\n return emitHydrateTypedListReconciliation(\n instance,\n listChildren,\n backgroundChildren,\n listDiff,\n );\n}\n\nfunction getStableSerializedListAttributes(\n attributes: SerializedTypedListNode['attributes'],\n): SerializableValue {\n if (attributes == null) {\n return null;\n }\n if (\n !(COMPONENT_AT_INDEX_ATTR in attributes)\n && !(COMPONENT_AT_INDEXES_ATTR in attributes)\n && !(ENQUEUE_COMPONENT_ATTR in attributes)\n && !(UPDATE_LIST_INFO_ATTR in attributes)\n ) {\n return attributes;\n }\n const stableAttributes: Record<string, SerializableValue> = {};\n let hasStableAttribute = false;\n for (const key in attributes) {\n if (\n key === COMPONENT_AT_INDEX_ATTR\n || key === COMPONENT_AT_INDEXES_ATTR\n || key === ENQUEUE_COMPONENT_ATTR\n || key === UPDATE_LIST_INFO_ATTR\n ) {\n continue;\n }\n stableAttributes[key] = attributes[key]!;\n hasStableAttribute = true;\n }\n return hasStableAttribute ? stableAttributes : null;\n}\n\nfunction hydrateChildListIntoContext(\n targetHandleId: number,\n slotId: number,\n serializedChildren: SerializedEtNode[],\n backgroundChildren: BackgroundElementTemplateInstance[],\n): boolean {\n if (backgroundChildren.length === 0) {\n for (const serialized of serializedChildren) {\n if (!emitSerializedSubtreeRemove(targetHandleId, slotId, serialized)) {\n return false;\n }\n }\n return true;\n }\n\n // Preserve the full matcher’s FIFO pairing while avoiding its temporary\n // structures when every child already occupies the matching slot position.\n const length = serializedChildren.length;\n if (length === backgroundChildren.length) {\n let samePairwise = true;\n for (let i = 0; i < length; i += 1) {\n if (\n getSerializedNodeHydrateKey(serializedChildren[i]!)\n !== getBackgroundNodeHydrateKey(backgroundChildren[i]!.type)\n ) {\n samePairwise = false;\n break;\n }\n }\n if (samePairwise) {\n for (let i = 0; i < length; i += 1) {\n if (!hydrateInstance(serializedChildren[i]!, backgroundChildren[i]!)) {\n return false;\n }\n }\n return true;\n }\n }\n\n const listDiff = hydrateMatchingChildrenAndDiffSlot(serializedChildren, backgroundChildren);\n if (listDiff === null) {\n return false;\n }\n\n // Hydrate emits patches directly here. Replaying against serialized order\n // keeps insert targets in the main-thread slot without reshaping background.\n const removalIndexes = new Set(listDiff.removals);\n const { insertions, moves } = listDiff;\n const movesWaitingForInsertionPoint = new Map<number, BackgroundElementTemplateInstance>();\n let serializedCursor = 0;\n let currentSerializedChild = serializedChildren[serializedCursor];\n let newIndex = 0;\n let oldIndex = 0;\n // Insertions are known before replay starts. Moves are counted only when their\n // old serialized position is reached, so the cursor can keep emitting patches\n // even after all serialized children have been consumed.\n let insertOrMovePatchesWaitingForInsertionPoint = listDiff.insertionCount;\n while (currentSerializedChild || insertOrMovePatchesWaitingForInsertionPoint > 0) {\n let keepCurrentSerializedChild = false;\n if (currentSerializedChild && removalIndexes.has(oldIndex)) {\n if (!emitSerializedSubtreeRemove(targetHandleId, slotId, currentSerializedChild)) {\n return false;\n }\n } else if (currentSerializedChild && moves[oldIndex] !== undefined) {\n const move = moves[oldIndex]!;\n movesWaitingForInsertionPoint.set(move.toIndex, move.instance);\n insertOrMovePatchesWaitingForInsertionPoint += 1;\n } else {\n const beforeChildId = currentSerializedChild ? currentSerializedChild.uid : 0;\n const movedChild = movesWaitingForInsertionPoint.get(newIndex);\n if (movedChild) {\n keepCurrentSerializedChild = true;\n globalCommitContext.ops.push(\n ElementTemplateUpdateOps.insertNode,\n targetHandleId,\n slotId,\n movedChild.instanceId,\n beforeChildId,\n getContainingListItem(movedChild) ? null : collectMainThreadRefSubtreeHandleIds(movedChild),\n );\n insertOrMovePatchesWaitingForInsertionPoint -= 1;\n } else if (insertions[newIndex] !== undefined) {\n const insertedChild = insertions[newIndex]!;\n keepCurrentSerializedChild = true;\n emitCreateSubtree(insertedChild);\n globalCommitContext.ops.push(\n ElementTemplateUpdateOps.insertNode,\n targetHandleId,\n slotId,\n insertedChild.instanceId,\n beforeChildId,\n getContainingListItem(insertedChild) ? null : collectMainThreadRefSubtreeHandleIds(insertedChild),\n );\n insertOrMovePatchesWaitingForInsertionPoint -= 1;\n }\n\n newIndex += 1;\n }\n if (currentSerializedChild && !keepCurrentSerializedChild) {\n currentSerializedChild = serializedChildren[++serializedCursor];\n oldIndex += 1;\n }\n }\n return true;\n}\n\nfunction emitSerializedSubtreeRemove(\n targetHandleId: number,\n slotId: number,\n serialized: SerializedEtNode,\n): boolean {\n // The removed child may no longer have a live background instance in this\n // slot, so serialized data is the source of truth for registry cleanup.\n const removedSubtreeHandleIds: number[] = [];\n if (!collectRemovableSerializedSubtreeHandleIdsInto(serialized, removedSubtreeHandleIds)) {\n return false;\n }\n const childId = removedSubtreeHandleIds[0]!;\n const existing = backgroundElementTemplateInstanceManager.get(childId);\n globalCommitContext.ops.push(\n ElementTemplateUpdateOps.removeNode,\n targetHandleId,\n slotId,\n childId,\n removedSubtreeHandleIds,\n );\n if (existing && !existing.parent) {\n markRemovedSubtreeForPostDispatchTeardown(existing);\n }\n return true;\n}\n\nfunction collectRemovableSerializedSubtreeHandleIdsInto(\n serialized: SerializedEtNode,\n handles: number[],\n): boolean {\n const handleId = getRemovableSerializedHandleId(serialized);\n if (handleId === null) {\n return false;\n }\n handles.push(handleId);\n\n if (isSerializedCompiledNode(serialized)) {\n for (const slotChildren of serialized.childSlots ?? []) {\n if (!slotChildren) {\n continue;\n }\n for (const child of slotChildren) {\n if (!collectRemovableSerializedSubtreeHandleIdsInto(child, handles)) {\n return false;\n }\n }\n }\n return true;\n }\n\n if (__DEV__ && !isSerializedTypedListNode(serialized)) {\n lynx.reportError(\n new Error(`ElementTemplate hydrate does not support serialized typed node '${serialized.tag}'.`),\n );\n return false;\n }\n const serializedList = serialized as SerializedTypedListNode;\n if (__DEV__ && (serializedList.childSlots?.length ?? 0) > 0) {\n lynx.reportError(new Error('ElementTemplate hydrate typed list does not support childSlots.'));\n return false;\n }\n const listChildren = getSerializedTypedListChildren(serializedList);\n if (__DEV__ && !Array.isArray(listChildren)) {\n lynx.reportError(new Error('ElementTemplate hydrate typed list requires options.listChildren.'));\n return false;\n }\n for (const child of listChildren) {\n if (!collectRemovableSerializedSubtreeHandleIdsInto(child, handles)) {\n return false;\n }\n }\n return true;\n}\n\nfunction getRemovableSerializedHandleId(serialized: SerializedEtNode): number | null {\n const handleId = serialized.uid;\n if (\n __DEV__\n && (typeof handleId !== 'number'\n || !Number.isInteger(handleId)\n || handleId === ELEMENT_TEMPLATE_PAGE_HANDLE_ID)\n ) {\n lynx.reportError(\n new Error(`ElementTemplate hydrate remove received invalid uid ${String(handleId)}.`),\n );\n return null;\n }\n return handleId;\n}\n\nfunction emitHydrateTypedListReconciliation(\n instance: BackgroundListElementTemplateInstance,\n serializedChildren: SerializedEtNode[],\n backgroundChildren: BackgroundElementTemplateInstance[],\n listDiff: HydrateChildListDiff,\n): boolean {\n const movedOldIndexes = Object.keys(listDiff.moves).map(Number);\n const removalIndexes = listDiff.removals.concat(movedOldIndexes).sort((a, b) => a - b);\n for (let index = 0; index < removalIndexes.length; index += 1) {\n const oldIndex = removalIndexes[index]!;\n const serialized = serializedChildren[oldIndex]!;\n let itemId: number;\n const removedSubtreeHandleIds: number[] = [];\n if (listDiff.moves[oldIndex] === undefined) {\n if (!collectRemovableSerializedSubtreeHandleIdsInto(serialized, removedSubtreeHandleIds)) {\n return false;\n }\n itemId = removedSubtreeHandleIds[0]!;\n } else {\n itemId = serialized.uid;\n }\n globalCommitContext.ops.push(\n ElementTemplateUpdateOps.removeTypedListItem,\n instance.instanceId,\n itemId,\n removedSubtreeHandleIds,\n );\n }\n\n const insertedIndexes = Object.keys(listDiff.insertions).map(Number);\n let movedToIndexes: Set<number> | null = null;\n for (let index = 0; index < movedOldIndexes.length; index += 1) {\n const toIndex = listDiff.moves[movedOldIndexes[index]!]!.toIndex;\n insertedIndexes.push(toIndex);\n (movedToIndexes ??= new Set()).add(toIndex);\n }\n insertedIndexes.sort((a, b) => b - a);\n for (let index = 0; index < insertedIndexes.length; index += 1) {\n const insertedIndex = insertedIndexes[index]!;\n const child = backgroundChildren[insertedIndex]!;\n emitCreateSubtree(child);\n globalCommitContext.ops.push(\n ElementTemplateUpdateOps.insertTypedListItem,\n instance.instanceId,\n toUpdateTypedListItemCommand(child),\n backgroundChildren[insertedIndex + 1]?.instanceId ?? 0,\n );\n }\n\n for (let index = 0; index < backgroundChildren.length; index += 1) {\n if (listDiff.insertions[index] || movedToIndexes?.has(index)) {\n continue;\n }\n globalCommitContext.ops.push(\n ElementTemplateUpdateOps.updateTypedListItem,\n instance.instanceId,\n toUpdateTypedListItemCommand(backgroundChildren[index]!),\n );\n }\n return true;\n}\n\nfunction emitCreateSubtree(node: BackgroundElementTemplateInstance): void {\n // Linked-list walk: slot grouping would be discarded since we recurse into\n // every child regardless of slot. `emitCreate` does its own single-walk\n // serialization of `instanceId`s grouped by slot.\n let child = node.firstChild;\n while (child) {\n emitCreateSubtree(child);\n child = child.nextSibling;\n }\n node.prepareAttributeSlotsForHydration();\n node.emitCreate();\n}\n\nfunction bindHydrationHandleId(\n instance: BackgroundElementTemplateInstance,\n handleId: number,\n templateKey: string,\n): boolean {\n const oldHandleId = instance.instanceId;\n if (__DEV__) {\n try {\n backgroundElementTemplateInstanceManager.updateId(instance.instanceId, handleId);\n // Ref proxies created before hydrate keep the old background id; resolve it\n // lazily so user-held proxies continue selecting the hydrated native node.\n hydrationMap.set(oldHandleId, handleId);\n instance.markMaterializedByHydration();\n return true;\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n lynx.reportError(\n new Error(`ElementTemplate hydrate received invalid uid ${handleId} for '${templateKey}': ${reason}`),\n );\n return false;\n }\n }\n\n backgroundElementTemplateInstanceManager.updateId(instance.instanceId, handleId);\n hydrationMap.set(oldHandleId, handleId);\n instance.markMaterializedByHydration();\n return true;\n}\n\nfunction hydrateAttributeSlots(\n templateType: string,\n handleId: number,\n beforeSlots: SerializableValue[],\n afterSlots: SerializableValue[],\n): void {\n const slotCount = Math.max(beforeSlots.length, afterSlots.length);\n const slotKinds = getMainThreadDynamicAttrSlotKinds(templateType);\n for (let slotIndex = 0; slotIndex < slotCount; slotIndex += 1) {\n // Native serialization and background preparation may represent an absent slot differently.\n const beforeValue = beforeSlots[slotIndex] ?? null;\n const afterValue = afterSlots[slotIndex] ?? null;\n if (\n !shouldForceMainThreadHydrateSlot(slotKinds?.get(slotIndex), afterValue)\n && isDirectOrDeepEqual(beforeValue, afterValue)\n ) {\n continue;\n }\n globalCommitContext.ops.push(\n getAttributeSlotUpdateOp(templateType, slotIndex),\n handleId,\n slotIndex,\n afterValue,\n );\n }\n}\n\nfunction shouldForceMainThreadHydrateSlot(\n slotKind: MainThreadDynamicAttrKind | undefined,\n value: SerializableValue | undefined,\n): boolean {\n if (slotKind === 'gesture') {\n return value != null;\n }\n if (slotKind === 'mt-event') {\n return isMTEventNativeWrapper(value);\n }\n if (slotKind === 'spread') {\n if (!isSpreadRecord(value)) {\n return false;\n }\n for (const key of Object.keys(value)) {\n if (key === 'main-thread:ref') {\n return true;\n }\n const entry = value[key];\n if (key === 'main-thread:gesture' && isGestureSlotValue(entry)) {\n return true;\n }\n if (isMainThreadEventPropKey(key) && isMTEventNativeWrapper(entry)) {\n return true;\n }\n }\n return false;\n }\n return slotKind === 'mt-ref'\n && (value == null || isMainThreadFunction((value as unknown as MTRefNativeWrapper).value));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"hydrate.js","sourceRoot":"","sources":["../../../src/element-template/background/hydrate.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yE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AiB,EAAE,CAAC;gBAC9B,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;YACzB,IAAI,GAAG,KAAK,qBAAqB,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC/D,OAAO,IAAI,CAAC;YACd,CAAC;YACD,IAAI,wBAAwB,CAAC,GAAG,CAAC,IAAI,sBAAsB,CAAC,KAAK,CAAC,EAAE,CAAC;gBACnE,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,QAAQ,KAAK,QAAQ;WACvB,CAAC,KAAK,IAAI,IAAI,IAAI,oBAAoB,CAAE,KAAuC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/F,CAAC","sourcesContent":["// Copyright 2025 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport { getAttributeSlotUpdateOp } from './attr-slots.js';\nimport { globalCommitContext, markRemovedSubtreeForPostDispatchTeardown } from './commit-context.js';\nimport {\n BUILTIN_RAW_TEXT_TEMPLATE_KEY,\n BackgroundListElementTemplateInstance,\n collectMainThreadRefSubtreeHandleIds,\n getContainingListItem,\n toUpdateTypedListItemCommand,\n} from './instance.js';\nimport type { BackgroundElementTemplateInstance } from './instance.js';\nimport { backgroundElementTemplateInstanceManager } from './manager.js';\nimport { isDirectOrDeepEqual } from '../../core/deep-equal.js';\nimport { isMainThreadFunction } from '../../core/main-thread-function.js';\nimport { hydrationMap } from '../hydration-map.js';\nimport { isGestureSlotValue } from '../prop-adapters/gesture.js';\nimport { isMainThreadEventPropKey, isSpreadRecord } from '../prop-adapters/spread.js';\nimport { ElementTemplateUpdateOps } from '../protocol/opcodes.js';\nimport { ELEMENT_TEMPLATE_PAGE_HANDLE_ID, ELEMENT_TEMPLATE_PAGE_ROOT_SLOT_INDEX } from '../protocol/page.js';\nimport { elementTemplateIdentityKey, parseElementTemplateType } from '../protocol/template-type.js';\nimport type {\n SerializableValue,\n SerializedCompiledNode,\n SerializedEtNode,\n SerializedTypedListNode,\n} from '../protocol/types.js';\nimport type { ETListItemPlatformInfo } from '../runtime/list/list.js';\nimport { getMainThreadDynamicAttrSlotKinds } from '../runtime/template/attr-slot-plan.js';\nimport type { MainThreadDynamicAttrKind } from '../runtime/template/attr-slot-plan.js';\nimport { isMTEventNativeWrapper } from '../runtime/template/main-thread-event-ctx.js';\nimport type { MTRefNativeWrapper } from '../runtime/template/main-thread-ref-ctx.js';\n\nconst MAIN_BUNDLE_URL_SENTINEL = '__Card__';\n\nexport function hydrateRootChildrenIntoContext(\n serializedChildren: SerializedEtNode[],\n root: BackgroundElementTemplateInstance,\n): boolean {\n try {\n return hydrateChildListIntoContext(\n ELEMENT_TEMPLATE_PAGE_HANDLE_ID,\n ELEMENT_TEMPLATE_PAGE_ROOT_SLOT_INDEX,\n serializedChildren,\n root.childNodes,\n );\n } finally {\n // Template identities only need caching for this synchronous hydration pass.\n backgroundHydrateKeys.clear();\n hydratedListItemsNeedingSubtreeSync.clear();\n }\n}\n\nconst hydratedListItemsNeedingSubtreeSync = new Set<BackgroundElementTemplateInstance>();\n\nfunction isSerializedCompiledNode(serialized: SerializedEtNode): serialized is SerializedCompiledNode {\n return typeof (serialized as { templateKey?: unknown }).templateKey === 'string';\n}\n\nfunction isSerializedTypedListNode(serialized: SerializedEtNode): serialized is SerializedTypedListNode {\n return !isSerializedCompiledNode(serialized) && serialized.tag === 'list';\n}\n\ninterface HydrateChildListDiff {\n // Background child at a new slot index that has no matching serialized child.\n insertions: Record<number, BackgroundElementTemplateInstance>;\n insertionCount: number;\n // Serialized child indexes that no longer exist in the background slot.\n removals: number[];\n // Serialized child old index -> same-slot reorder target.\n moves: Record<number, { toIndex: number; instance: BackgroundElementTemplateInstance }>;\n}\n\nfunction hydrateMatchingChildrenAndDiffSlot(\n serializedChildren: SerializedEtNode[],\n backgroundChildren: BackgroundElementTemplateInstance[],\n): HydrateChildListDiff | null {\n let lastPlacedIndex = 0;\n const result: HydrateChildListDiff = {\n insertions: {},\n insertionCount: 0,\n removals: [],\n moves: {},\n };\n const serializedByNodeKey: Record<string, [SerializedEtNode, number][]> = {};\n const serializedCursorByNodeKey: Record<string, number> = {};\n\n for (let i = 0; i < serializedChildren.length; i += 1) {\n const node = serializedChildren[i]!;\n const key = getSerializedNodeHydrateKey(node);\n (serializedByNodeKey[key] ??= []).push([node, i]);\n }\n\n for (let i = 0; i < backgroundChildren.length; i += 1) {\n const backgroundChild = backgroundChildren[i]!;\n // Normalize the background instance's full `${entry}:${key}` type tag to the\n // same native identity the serialized side uses (sentinel folded to the main\n // card), so main-card nodes match regardless of the `__Card__` prefix.\n const backgroundKey = getBackgroundNodeHydrateKey(backgroundChild.type);\n const serializedCandidates = serializedByNodeKey[backgroundKey];\n const candidateCursor = serializedCursorByNodeKey[backgroundKey] ?? 0;\n const matchedSerialized = serializedCandidates?.[candidateCursor];\n\n if (matchedSerialized) {\n serializedCursorByNodeKey[backgroundKey] = candidateCursor + 1;\n const oldIndex = matchedSerialized[1];\n if (!hydrateInstance(matchedSerialized[0], backgroundChild)) {\n return null;\n }\n if (oldIndex < lastPlacedIndex) {\n result.moves[oldIndex] = { toIndex: i, instance: backgroundChild };\n } else {\n lastPlacedIndex = oldIndex;\n }\n } else {\n result.insertions[i] = backgroundChild;\n result.insertionCount += 1;\n }\n }\n\n for (const key in serializedByNodeKey) {\n const candidates = serializedByNodeKey[key]!;\n const candidateCursor = serializedCursorByNodeKey[key] ?? 0;\n for (let i = candidateCursor; i < candidates.length; i += 1) {\n result.removals.push(candidates[i]![1]);\n }\n }\n\n return result;\n}\n\nfunction hydrateInstance(\n serialized: SerializedEtNode,\n instance: BackgroundElementTemplateInstance,\n): boolean {\n if (isSerializedCompiledNode(serialized)) {\n return hydrateCompiledInstance(serialized, instance);\n }\n if (__DEV__ && !isSerializedTypedListNode(serialized)) {\n lynx.reportError(\n new Error(`ElementTemplate hydrate does not support serialized typed node '${serialized.tag}'.`),\n );\n return false;\n }\n // Match List items separately, then reuse the shared structural patch\n // emitter.\n return hydrateListInstance(\n serialized as SerializedTypedListNode,\n instance as BackgroundListElementTemplateInstance,\n );\n}\n\nfunction hydrateCompiledInstance(\n serialized: SerializedCompiledNode,\n instance: BackgroundElementTemplateInstance,\n): boolean {\n const handleId = serialized.uid;\n if (!bindHydrationHandleId(instance, handleId, serialized.templateKey)) {\n return false;\n }\n if (serialized.attributeSlots?.length || instance.attributeSlots.length) {\n instance.prepareAttributeSlotsForHydration();\n hydrateAttributeSlots(instance.type, handleId, serialized.attributeSlots ?? [], instance.attributeSlots);\n }\n\n if (serialized.templateKey === BUILTIN_RAW_TEXT_TEMPLATE_KEY) {\n return true;\n }\n\n if (!serialized.childSlots?.length && !instance.firstChild) {\n return true;\n }\n\n const serializedChildSlots = serialized.childSlots ?? [];\n const backgroundChildSlots = instance.childSlots;\n // Snapshot hydrates dynamic children through slot-filtered lists. Keeping ET\n // scoped the same way means a cross-slot candidate is a source remove plus a\n // target create/insert, while same-slot reorder can still stay move-like.\n const slotCount = Math.max(serializedChildSlots.length, backgroundChildSlots.length);\n for (let slotId = 0; slotId < slotCount; slotId += 1) {\n const serializedSlot = serializedChildSlots[slotId];\n const backgroundSlot = backgroundChildSlots[slotId];\n if (!serializedSlot && !backgroundSlot) {\n continue;\n }\n if (\n !hydrateChildListIntoContext(\n instance.instanceId,\n slotId,\n serializedSlot ?? [],\n backgroundSlot ?? [],\n )\n ) {\n return false;\n }\n }\n return true;\n}\n\nconst backgroundHydrateKeys = new Map<string, string>();\n\nfunction getBackgroundNodeHydrateKey(type: string): string {\n const cached = backgroundHydrateKeys.get(type);\n if (cached !== undefined) {\n return cached;\n }\n const parsed = parseElementTemplateType(type);\n const key = elementTemplateIdentityKey(parsed.templateKey, parsed.bundleUrl);\n backgroundHydrateKeys.set(type, key);\n return key;\n}\n\nfunction getSerializedNodeHydrateKey(serialized: SerializedEtNode): string {\n if (!isSerializedCompiledNode(serialized)) {\n return serialized.tag;\n }\n return elementTemplateIdentityKey(\n serialized.templateKey,\n normalizeSerializedBundleUrl(serialized.bundleUrl),\n );\n}\n\nfunction normalizeSerializedBundleUrl(bundleUrl: string | undefined): string | null {\n return bundleUrl === undefined || bundleUrl === MAIN_BUNDLE_URL_SENTINEL ? null : bundleUrl;\n}\n\nfunction getSerializedTypedListChildren(\n serialized: SerializedTypedListNode,\n): SerializedEtNode[] {\n // Native List stores logical items in childSlots[0].\n // A missing or empty slot 0 represents an empty List.\n return serialized.childSlots?.[0] ?? [];\n}\n\nfunction getSerializedListItemPlatformInfo(\n serialized: SerializedEtNode,\n): ETListItemPlatformInfo | undefined {\n const options = serialized.options;\n if (!options || !('__listItemPlatformInfo' in options)) {\n return undefined;\n }\n const platformInfo = options['__listItemPlatformInfo'];\n // Require an attribute object for platform info.\n if (\n platformInfo == null\n || typeof platformInfo !== 'object'\n || Array.isArray(platformInfo)\n ) {\n return undefined;\n }\n // Reuse the ET serializable attribute type and preserve the original object.\n return platformInfo as ETListItemPlatformInfo;\n}\n\nfunction getListItemHydrateKey(\n platformInfo: ETListItemPlatformInfo | undefined,\n): string | undefined {\n const itemKey = platformInfo?.['item-key'];\n // Nullish item keys use the unkeyed group. Empty strings are valid keys.\n // Normalize provided keys to strings to preserve RL3's object-key grouping.\n return itemKey == null ? undefined : String(itemKey as string | number);\n}\n\nfunction hydrateListInstance(\n serialized: SerializedTypedListNode,\n instance: BackgroundListElementTemplateInstance,\n): boolean {\n const serializedChildren = getSerializedTypedListChildren(serialized);\n const backgroundChildren = instance.childNodes;\n if (__DEV__) {\n // Both sides store logical List items in slot 0.\n const hasUnsupportedSerializedSlot = serialized.childSlots?.some(\n (children, slotIndex) => slotIndex !== 0 && (children?.length ?? 0) > 0,\n );\n // A child's __slotIndex identifies its logical slot.\n const hasUnsupportedBackgroundSlot = backgroundChildren.some(child => child.__slotIndex !== 0);\n if (hasUnsupportedSerializedSlot || hasUnsupportedBackgroundSlot) {\n lynx.reportError(new Error('ElementTemplate hydrate typed list only supports logical slot 0.'));\n return false;\n }\n }\n\n const handleId = serialized.uid;\n if (!bindHydrationHandleId(instance, handleId, serialized.tag)) {\n return false;\n }\n\n instance.prepareAttributeSlotsForHydration();\n\n hydrateAttributeSlots(\n serialized.tag,\n handleId,\n [serialized.attributes ?? null],\n instance.attributeSlots,\n );\n\n // The List UID and attributes are hydrated before this empty-children fast\n // path.\n if (serializedChildren.length === 0 && backgroundChildren.length === 0) {\n return true;\n }\n\n // Hydrate matched items recursively and preserve insertion, removal, and move\n // distinctions.\n const listDiff = hydrateMatchingListChildrenAndDiff(handleId, serializedChildren, backgroundChildren);\n if (listDiff === null) {\n return false;\n }\n\n // Reuse child-slot structural commands so native records List changes in slot\n // 0.\n if (!emitHydrateChildrenDiff(handleId, 0, serializedChildren, listDiff)) {\n return false;\n }\n for (let index = 0; index < backgroundChildren.length; index += 1) {\n const child = backgroundChildren[index]!;\n if (!hydratedListItemsNeedingSubtreeSync.delete(child)) {\n continue;\n }\n globalCommitContext.ops.push(\n ElementTemplateUpdateOps.updateTypedListItem,\n handleId,\n toUpdateTypedListItemCommand(child, false),\n );\n }\n return true;\n}\n\nfunction hydrateMatchingListChildrenAndDiff(\n listHandleId: number,\n serializedChildren: SerializedEtNode[],\n backgroundChildren: BackgroundElementTemplateInstance[],\n): HydrateChildListDiff | null {\n const result: HydrateChildListDiff = {\n insertions: {},\n insertionCount: 0,\n removals: [],\n moves: {},\n };\n // Explicit item-key values are unique on each side, so each key maps to one\n // old node.\n const serializedByItemKey = new Map<string, SerializedEtNode>();\n // Group unkeyed nodes by template identity.\n // Preserve their old order and consume candidates with a per-template cursor.\n const serializedByTemplateKey = new Map<string, {\n nodes: SerializedEtNode[];\n cursor: number; // Index of the next candidate to consume, initially zero.\n }>();\n // Track old positions to detect moves.\n // Remove matched records so the remaining entries identify deleted nodes.\n const remainingOldIndices = new Map<SerializedEtNode, number>();\n\n for (let oldIndex = 0; oldIndex < serializedChildren.length; oldIndex++) {\n const serialized = serializedChildren[oldIndex]!;\n const itemKey = getListItemHydrateKey(\n getSerializedListItemPlatformInfo(serialized),\n );\n remainingOldIndices.set(serialized, oldIndex);\n if (itemKey !== undefined) {\n // Index keyed nodes for matching by item-key.\n serializedByItemKey.set(itemKey, serialized);\n continue;\n }\n // Queue unkeyed nodes by normalized template identity.\n const templateKey = getSerializedNodeHydrateKey(serialized);\n let group = serializedByTemplateKey.get(templateKey);\n if (group === undefined) {\n group = { nodes: [], cursor: 0 };\n serializedByTemplateKey.set(templateKey, group);\n }\n group.nodes.push(serialized);\n }\n\n let lastPlacedIndex = 0;\n for (let newIndex = 0; newIndex < backgroundChildren.length; newIndex++) {\n const instance = backgroundChildren[newIndex]!;\n const itemKey = getListItemHydrateKey(\n instance.getListItemPlatformInfo(),\n );\n const templateKey = getBackgroundNodeHydrateKey(instance.type);\n\n let serialized: SerializedEtNode | undefined;\n if (itemKey === undefined) {\n const group = serializedByTemplateKey.get(templateKey);\n serialized = group?.nodes[group.cursor];\n } else {\n serialized = serializedByItemKey.get(itemKey);\n }\n\n if (serialized === undefined || getSerializedNodeHydrateKey(serialized) !== templateKey) {\n // Record an insertion when no compatible candidate exists.\n result.insertions[newIndex] = instance;\n result.insertionCount += 1;\n // Keep the old candidate pending removal.\n continue;\n }\n\n if (!hydrateInstance(serialized, instance)) {\n return null;\n }\n\n // The item now uses its native UID.\n // Emit updateTypedListItem when platform info changes.\n hydrateListItemPlatformInfo(listHandleId, serialized, instance);\n\n // Remove the matched node from the pending-removal map.\n const oldIndex = remainingOldIndices.get(serialized)!;\n remainingOldIndices.delete(serialized);\n if (itemKey === undefined) {\n serializedByTemplateKey.get(templateKey)!.cursor += 1;\n } else {\n serializedByItemKey.delete(itemKey);\n }\n if (oldIndex < lastPlacedIndex) {\n // Record a move for the retained item.\n result.moves[oldIndex] = {\n toIndex: newIndex,\n instance,\n };\n } else {\n lastPlacedIndex = oldIndex;\n }\n }\n // Remove the old nodes left unmatched.\n // The Map preserves old order, so remaining indexes are already sorted.\n for (const oldIndex of remainingOldIndices.values()) {\n result.removals.push(oldIndex);\n }\n return result;\n}\n\nfunction hydrateListItemPlatformInfo(\n listHandleId: number,\n serialized: SerializedEtNode,\n instance: BackgroundElementTemplateInstance,\n): void {\n const before = getSerializedListItemPlatformInfo(serialized) ?? {};\n const after = instance.getListItemPlatformInfo();\n if (isDirectOrDeepEqual(before, after)) {\n return;\n }\n globalCommitContext.ops.push(\n ElementTemplateUpdateOps.updateTypedListItem,\n listHandleId,\n {\n __etHandleRef: serialized.uid,\n type: instance.type,\n platformInfo: after,\n subtreeHandleIds: null,\n },\n );\n}\n\nfunction hydrateChildListIntoContext(\n targetHandleId: number,\n slotId: number,\n serializedChildren: SerializedEtNode[],\n backgroundChildren: BackgroundElementTemplateInstance[],\n): boolean {\n if (backgroundChildren.length === 0) {\n for (const serialized of serializedChildren) {\n if (!emitSerializedSubtreeRemove(targetHandleId, slotId, serialized)) {\n return false;\n }\n }\n return true;\n }\n\n // Preserve the full matcher’s FIFO pairing while avoiding its temporary\n // structures when every child already occupies the matching slot position.\n const length = serializedChildren.length;\n if (length === backgroundChildren.length) {\n let samePairwise = true;\n for (let i = 0; i < length; i += 1) {\n if (\n getSerializedNodeHydrateKey(serializedChildren[i]!)\n !== getBackgroundNodeHydrateKey(backgroundChildren[i]!.type)\n ) {\n samePairwise = false;\n break;\n }\n }\n if (samePairwise) {\n for (let i = 0; i < length; i += 1) {\n if (!hydrateInstance(serializedChildren[i]!, backgroundChildren[i]!)) {\n return false;\n }\n }\n return true;\n }\n }\n\n const listDiff = hydrateMatchingChildrenAndDiffSlot(serializedChildren, backgroundChildren);\n if (listDiff === null) {\n return false;\n }\n\n // Hydrate emits patches directly here. Replaying against serialized order\n // keeps insert targets in the main-thread slot without reshaping background.\n return emitHydrateChildrenDiff(targetHandleId, slotId, serializedChildren, listDiff);\n}\n\nfunction emitHydrateChildrenDiff(\n targetHandleId: number,\n slotId: number,\n serializedChildren: SerializedEtNode[],\n listDiff: HydrateChildListDiff,\n): boolean {\n // serializedChildren supplies the old order and insertion anchors.\n // listDiff describes the target changes.\n const removalIndexes = new Set(listDiff.removals);\n const { insertions, moves } = listDiff;\n const movesWaitingForInsertionPoint = new Map<number, BackgroundElementTemplateInstance>();\n let serializedCursor = 0;\n let currentSerializedChild = serializedChildren[serializedCursor];\n let newIndex = 0;\n let oldIndex = 0;\n // Insertions are known before replay starts. Moves are counted only when their\n // old serialized position is reached, so the cursor can keep emitting patches\n // even after all serialized children have been consumed.\n let insertOrMovePatchesWaitingForInsertionPoint = listDiff.insertionCount;\n while (currentSerializedChild || insertOrMovePatchesWaitingForInsertionPoint > 0) {\n let keepCurrentSerializedChild = false;\n if (currentSerializedChild && removalIndexes.has(oldIndex)) {\n if (!emitSerializedSubtreeRemove(targetHandleId, slotId, currentSerializedChild)) {\n return false;\n }\n } else if (currentSerializedChild && moves[oldIndex] !== undefined) {\n const move = moves[oldIndex]!;\n movesWaitingForInsertionPoint.set(move.toIndex, move.instance);\n insertOrMovePatchesWaitingForInsertionPoint += 1;\n } else {\n const beforeChildId = currentSerializedChild ? currentSerializedChild.uid : 0;\n const movedChild = movesWaitingForInsertionPoint.get(newIndex);\n if (movedChild) {\n keepCurrentSerializedChild = true;\n globalCommitContext.ops.push(\n ElementTemplateUpdateOps.insertNode,\n targetHandleId,\n slotId,\n movedChild.instanceId,\n beforeChildId,\n getContainingListItem(movedChild) ? null : collectMainThreadRefSubtreeHandleIds(movedChild),\n );\n insertOrMovePatchesWaitingForInsertionPoint -= 1;\n } else if (insertions[newIndex] !== undefined) {\n const insertedChild = insertions[newIndex]!;\n const containingListItem = getContainingListItem(insertedChild);\n const subtreeHandleIds = collectMainThreadRefSubtreeHandleIds(insertedChild);\n keepCurrentSerializedChild = true;\n emitCreateSubtree(insertedChild);\n globalCommitContext.ops.push(\n ElementTemplateUpdateOps.insertNode,\n targetHandleId,\n slotId,\n insertedChild.instanceId,\n beforeChildId,\n containingListItem ? null : subtreeHandleIds,\n );\n if (containingListItem && subtreeHandleIds !== null) {\n hydratedListItemsNeedingSubtreeSync.add(containingListItem);\n }\n insertOrMovePatchesWaitingForInsertionPoint -= 1;\n }\n\n newIndex += 1;\n }\n if (currentSerializedChild && !keepCurrentSerializedChild) {\n currentSerializedChild = serializedChildren[++serializedCursor];\n oldIndex += 1;\n }\n }\n return true;\n}\n\nfunction emitSerializedSubtreeRemove(\n targetHandleId: number,\n slotId: number,\n serialized: SerializedEtNode,\n): boolean {\n // The removed child may no longer have a live background instance in this\n // slot, so serialized data is the source of truth for registry cleanup.\n const removedSubtreeHandleIds: number[] = [];\n if (!collectRemovableSerializedSubtreeHandleIdsInto(serialized, removedSubtreeHandleIds)) {\n return false;\n }\n const childId = removedSubtreeHandleIds[0]!;\n const existing = backgroundElementTemplateInstanceManager.get(childId);\n globalCommitContext.ops.push(\n ElementTemplateUpdateOps.removeNode,\n targetHandleId,\n slotId,\n childId,\n removedSubtreeHandleIds,\n );\n if (existing && !existing.parent) {\n markRemovedSubtreeForPostDispatchTeardown(existing);\n }\n return true;\n}\n\nfunction collectRemovableSerializedSubtreeHandleIdsInto(\n serialized: SerializedEtNode,\n handles: number[],\n): boolean {\n const handleId = getRemovableSerializedHandleId(serialized);\n if (handleId === null) {\n return false;\n }\n handles.push(handleId);\n\n if (isSerializedCompiledNode(serialized)) {\n for (const slotChildren of serialized.childSlots ?? []) {\n if (!slotChildren) {\n continue;\n }\n for (const child of slotChildren) {\n if (!collectRemovableSerializedSubtreeHandleIdsInto(child, handles)) {\n return false;\n }\n }\n }\n return true;\n }\n\n if (__DEV__ && !isSerializedTypedListNode(serialized)) {\n lynx.reportError(\n new Error(`ElementTemplate hydrate does not support serialized typed node '${serialized.tag}'.`),\n );\n return false;\n }\n const serializedList = serialized as SerializedTypedListNode;\n // Collect all logical item UIDs from slot 0 when removing a List or its\n // ancestor.\n if (\n __DEV__\n && serializedList.childSlots?.some(\n (children, slotIndex) => slotIndex !== 0 && (children?.length ?? 0) > 0,\n )\n ) {\n lynx.reportError(new Error('ElementTemplate hydrate typed list only supports logical slot 0.'));\n return false;\n }\n const listChildren = getSerializedTypedListChildren(serializedList);\n for (const child of listChildren) {\n if (!collectRemovableSerializedSubtreeHandleIdsInto(child, handles)) {\n return false;\n }\n }\n return true;\n}\n\nfunction getRemovableSerializedHandleId(serialized: SerializedEtNode): number | null {\n const handleId = serialized.uid;\n if (\n __DEV__\n && (typeof handleId !== 'number'\n || !Number.isInteger(handleId)\n || handleId === ELEMENT_TEMPLATE_PAGE_HANDLE_ID)\n ) {\n lynx.reportError(\n new Error(`ElementTemplate hydrate remove received invalid uid ${String(handleId)}.`),\n );\n return null;\n }\n return handleId;\n}\n\nfunction emitCreateSubtree(node: BackgroundElementTemplateInstance): void {\n // Linked-list walk: slot grouping would be discarded since we recurse into\n // every child regardless of slot. `emitCreate` does its own single-walk\n // serialization of `instanceId`s grouped by slot.\n let child = node.firstChild;\n while (child) {\n emitCreateSubtree(child);\n child = child.nextSibling;\n }\n node.prepareAttributeSlotsForHydration();\n node.emitCreate();\n}\n\nfunction bindHydrationHandleId(\n instance: BackgroundElementTemplateInstance,\n handleId: number,\n templateKey: string,\n): boolean {\n const oldHandleId = instance.instanceId;\n if (__DEV__) {\n try {\n backgroundElementTemplateInstanceManager.updateId(instance.instanceId, handleId);\n // Ref proxies created before hydrate keep the old background id; resolve it\n // lazily so user-held proxies continue selecting the hydrated native node.\n hydrationMap.set(oldHandleId, handleId);\n instance.markMaterializedByHydration();\n return true;\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n lynx.reportError(\n new Error(`ElementTemplate hydrate received invalid uid ${handleId} for '${templateKey}': ${reason}`),\n );\n return false;\n }\n }\n\n backgroundElementTemplateInstanceManager.updateId(instance.instanceId, handleId);\n hydrationMap.set(oldHandleId, handleId);\n instance.markMaterializedByHydration();\n return true;\n}\n\nfunction hydrateAttributeSlots(\n templateType: string,\n handleId: number,\n beforeSlots: SerializableValue[],\n afterSlots: SerializableValue[],\n): void {\n const slotCount = Math.max(beforeSlots.length, afterSlots.length);\n const slotKinds = getMainThreadDynamicAttrSlotKinds(templateType);\n for (let slotIndex = 0; slotIndex < slotCount; slotIndex += 1) {\n // Native serialization and background preparation may represent an absent slot differently.\n const beforeValue = beforeSlots[slotIndex] ?? null;\n const afterValue = afterSlots[slotIndex] ?? null;\n if (\n !shouldForceMainThreadHydrateSlot(slotKinds?.get(slotIndex), afterValue)\n && isDirectOrDeepEqual(beforeValue, afterValue)\n ) {\n continue;\n }\n globalCommitContext.ops.push(\n getAttributeSlotUpdateOp(templateType, slotIndex),\n handleId,\n slotIndex,\n afterValue,\n );\n }\n}\n\nfunction shouldForceMainThreadHydrateSlot(\n slotKind: MainThreadDynamicAttrKind | undefined,\n value: SerializableValue | undefined,\n): boolean {\n if (slotKind === 'gesture') {\n return value != null;\n }\n if (slotKind === 'mt-event') {\n return isMTEventNativeWrapper(value);\n }\n if (slotKind === 'spread') {\n if (!isSpreadRecord(value)) {\n return false;\n }\n for (const key of Object.keys(value)) {\n if (key === 'main-thread:ref') {\n return true;\n }\n const entry = value[key];\n if (key === 'main-thread:gesture' && isGestureSlotValue(entry)) {\n return true;\n }\n if (isMainThreadEventPropKey(key) && isMTEventNativeWrapper(entry)) {\n return true;\n }\n }\n return false;\n }\n return slotKind === 'mt-ref'\n && (value == null || isMainThreadFunction((value as unknown as MTRefNativeWrapper).value));\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ElementTemplateHandleSlotsCommand, RuntimeOptionsCommand, SerializableValue, TypedElementAttributesCommand,
|
|
1
|
+
import type { ElementTemplateHandleSlotsCommand, RuntimeOptionsCommand, SerializableValue, TypedElementAttributesCommand, UpdateTypedListItemCommand } from '../protocol/types.js';
|
|
2
2
|
import type { AuthoredPageAttributes } from '../runtime/page/authored-page.js';
|
|
3
3
|
import type { EtAttrPlan } from '../runtime/template/attr-slot-plan.js';
|
|
4
4
|
export declare const BUILTIN_RAW_TEXT_TEMPLATE_KEY = "_et_builtin_raw_text";
|
|
@@ -32,7 +32,7 @@ export declare class BackgroundElementTemplateInstance {
|
|
|
32
32
|
protected canEmitUpdatePatch(): boolean;
|
|
33
33
|
protected cleanupDetachedChildForLifetimeRemoval(child: BackgroundElementTemplateInstance, canEmitUpdatePatch: boolean): void;
|
|
34
34
|
appendChild(child: BackgroundElementTemplateInstance): void;
|
|
35
|
-
insertBefore(child: BackgroundElementTemplateInstance, beforeChild: BackgroundElementTemplateInstance | null
|
|
35
|
+
insertBefore(child: BackgroundElementTemplateInstance, beforeChild: BackgroundElementTemplateInstance | null): void;
|
|
36
36
|
removeChild(child: BackgroundElementTemplateInstance, silent?: boolean): void;
|
|
37
37
|
tearDown(): void;
|
|
38
38
|
queueRefCleanupForSubtree(): void;
|
|
@@ -68,14 +68,11 @@ export declare class BackgroundPageRootInstance extends BackgroundTypedElementTe
|
|
|
68
68
|
}
|
|
69
69
|
export declare class BackgroundListElementTemplateInstance extends BackgroundTypedElementTemplateInstance {
|
|
70
70
|
constructor();
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
private emitTypedListItemInsert;
|
|
76
|
-
private emitTypedListItemRemove;
|
|
77
|
-
private emitTypedListItemUpdate;
|
|
71
|
+
emitCreate(): void;
|
|
72
|
+
protected getAttributeSlotPlan(): EtAttrPlan;
|
|
73
|
+
protected getChildSlotsForCreate(): ElementTemplateHandleSlotsCommand;
|
|
74
|
+
emitTypedListItemUpdate(child: BackgroundElementTemplateInstance, isUpdatePlatformInfo: boolean): void;
|
|
78
75
|
}
|
|
79
|
-
export declare function toUpdateTypedListItemCommand(child: BackgroundElementTemplateInstance): UpdateTypedListItemCommand;
|
|
76
|
+
export declare function toUpdateTypedListItemCommand(child: BackgroundElementTemplateInstance, isUpdatePlatformInfo: boolean): UpdateTypedListItemCommand;
|
|
80
77
|
export declare function collectElementTemplateSubtreeHandleIds(root: BackgroundElementTemplateInstance): number[];
|
|
81
78
|
export declare function collectMainThreadRefSubtreeHandleIds(root: BackgroundElementTemplateInstance): number[] | null;
|