@lynx-js/react 0.121.1 → 0.122.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/package.json +5 -5
- package/runtime/lazy/element-template-import.js +73 -0
- package/runtime/lazy/import.js +4 -0
- package/runtime/lazy/target.js +23 -0
- package/runtime/lib/core/background-function/exec-map.d.ts +11 -0
- package/runtime/lib/core/background-function/exec-map.js +39 -0
- package/runtime/lib/core/background-function/exec-map.js.map +1 -0
- package/runtime/lib/core/background-function/handle.d.ts +8 -0
- package/runtime/lib/core/background-function/handle.js +25 -0
- package/runtime/lib/core/background-function/handle.js.map +1 -0
- package/runtime/lib/core/background-function/run-on-background.d.ts +8 -0
- package/runtime/lib/{snapshot/worklet/call/runOnBackground.js → core/background-function/run-on-background.js} +39 -33
- package/runtime/lib/core/background-function/run-on-background.js.map +1 -0
- package/runtime/lib/{snapshot/legacy-react-runtime/index.d.ts → core/compat/legacy-react-runtime.d.ts} +4 -4
- package/runtime/lib/{snapshot/legacy-react-runtime/index.js → core/compat/legacy-react-runtime.js} +6 -6
- package/runtime/lib/core/compat/legacy-react-runtime.js.map +1 -0
- package/runtime/lib/{snapshot → core}/compat/lynxComponent.d.ts +2 -1
- package/runtime/lib/{snapshot → core}/compat/lynxComponent.js +11 -5
- package/runtime/lib/core/compat/lynxComponent.js.map +1 -0
- package/runtime/lib/core/component.d.ts +2 -0
- package/runtime/lib/{snapshot/lynx → core}/component.js +37 -31
- package/runtime/lib/core/component.js.map +1 -0
- package/runtime/lib/core/initData.js +35 -0
- package/runtime/lib/core/initData.js.map +1 -1
- package/runtime/lib/{snapshot/lynx/dynamic-js.js → core/lynx/dynamic-import.js} +1 -1
- package/runtime/lib/core/lynx/dynamic-import.js.map +1 -0
- package/runtime/lib/core/lynx/lazy-bundle.js.map +1 -0
- package/runtime/lib/core/lynx/runtime-backend.d.ts +5 -0
- package/runtime/lib/core/lynx/runtime-backend.js +20 -0
- package/runtime/lib/core/lynx/runtime-backend.js.map +1 -0
- package/runtime/lib/core/lynx-page-data.js +6 -0
- package/runtime/lib/core/lynx-page-data.js.map +1 -1
- package/runtime/lib/core/lynx-update-data.js +6 -0
- package/runtime/lib/core/lynx-update-data.js.map +1 -1
- package/runtime/lib/core/performance.d.ts +30 -0
- package/runtime/lib/core/performance.js +145 -0
- package/runtime/lib/core/performance.js.map +1 -0
- package/runtime/lib/core/runtime-destroy.d.ts +4 -0
- package/runtime/lib/core/runtime-destroy.js +18 -0
- package/runtime/lib/core/runtime-destroy.js.map +1 -0
- package/runtime/lib/core/thread-function-call/main-thread.d.ts +5 -0
- package/runtime/lib/core/thread-function-call/main-thread.js +69 -0
- package/runtime/lib/core/thread-function-call/main-thread.js.map +1 -0
- package/runtime/lib/core/thread-function-call/return-value.d.ts +2 -0
- package/runtime/lib/core/thread-function-call/return-value.js +67 -0
- package/runtime/lib/core/thread-function-call/return-value.js.map +1 -0
- package/runtime/lib/element-template/background/attr-slots.d.ts +1 -1
- package/runtime/lib/element-template/background/attr-slots.js +8 -7
- package/runtime/lib/element-template/background/attr-slots.js.map +1 -1
- package/runtime/lib/element-template/background/commit-hook.js +81 -61
- package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
- package/runtime/lib/element-template/background/destroy.js +4 -0
- package/runtime/lib/element-template/background/destroy.js.map +1 -1
- package/runtime/lib/element-template/background/document.js +7 -1
- package/runtime/lib/element-template/background/document.js.map +1 -1
- package/runtime/lib/element-template/background/hydrate.d.ts +2 -3
- package/runtime/lib/element-template/background/hydrate.js +237 -58
- package/runtime/lib/element-template/background/hydrate.js.map +1 -1
- package/runtime/lib/element-template/background/hydration-listener.js +38 -38
- package/runtime/lib/element-template/background/hydration-listener.js.map +1 -1
- package/runtime/lib/element-template/background/instance.d.ts +31 -4
- package/runtime/lib/element-template/background/instance.js +219 -31
- package/runtime/lib/element-template/background/instance.js.map +1 -1
- package/runtime/lib/element-template/background/render-scope.d.ts +4 -0
- package/runtime/lib/element-template/background/render-scope.js +43 -0
- package/runtime/lib/element-template/background/render-scope.js.map +1 -0
- package/runtime/lib/element-template/debug/alog.d.ts +14 -0
- package/runtime/lib/element-template/debug/alog.js +23 -0
- package/runtime/lib/element-template/debug/alog.js.map +1 -1
- package/runtime/lib/element-template/debug/elementPAPICall.js +1 -0
- package/runtime/lib/element-template/debug/elementPAPICall.js.map +1 -1
- package/runtime/lib/element-template/index.d.ts +5 -2
- package/runtime/lib/element-template/index.js +8 -7
- package/runtime/lib/element-template/index.js.map +1 -1
- package/runtime/lib/element-template/internal.d.ts +7 -0
- package/runtime/lib/element-template/internal.js +9 -9
- package/runtime/lib/element-template/internal.js.map +1 -1
- package/runtime/lib/element-template/lynx/env.js +2 -0
- package/runtime/lib/element-template/lynx/env.js.map +1 -1
- package/runtime/lib/element-template/lynx/performance.d.ts +0 -21
- package/runtime/lib/element-template/lynx/performance.js +4 -121
- package/runtime/lib/element-template/lynx/performance.js.map +1 -1
- package/runtime/lib/element-template/native/index.js +3 -1
- package/runtime/lib/element-template/native/index.js.map +1 -1
- package/runtime/lib/element-template/native/main-thread-api.js +1 -1
- package/runtime/lib/element-template/native/main-thread-api.js.map +1 -1
- package/runtime/lib/element-template/native/mts-destroy.js +6 -0
- package/runtime/lib/element-template/native/mts-destroy.js.map +1 -1
- package/runtime/lib/element-template/native/patch-listener.js +42 -17
- package/runtime/lib/element-template/native/patch-listener.js.map +1 -1
- package/runtime/lib/element-template/native/reload-background.d.ts +1 -0
- package/runtime/lib/element-template/native/{reload.js → reload-background.js} +1 -26
- package/runtime/lib/element-template/native/reload-background.js.map +1 -0
- package/runtime/lib/element-template/native/{reload.d.ts → reload-main-thread.d.ts} +0 -1
- package/runtime/lib/element-template/native/reload-main-thread.js +39 -0
- package/runtime/lib/element-template/native/reload-main-thread.js.map +1 -0
- package/runtime/lib/element-template/prop-adapters/spread.d.ts +1 -4
- 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 +3 -0
- package/runtime/lib/element-template/protocol/opcodes.js +3 -0
- package/runtime/lib/element-template/protocol/opcodes.js.map +1 -1
- package/runtime/lib/element-template/protocol/template-type.d.ts +25 -0
- package/runtime/lib/element-template/protocol/template-type.js +42 -0
- package/runtime/lib/element-template/protocol/template-type.js.map +1 -0
- package/runtime/lib/element-template/protocol/types.d.ts +38 -15
- package/runtime/lib/element-template/protocol/types.js.map +1 -1
- package/runtime/lib/element-template/protocol/update-event.d.ts +15 -0
- package/runtime/lib/element-template/protocol/update-event.js +24 -0
- package/runtime/lib/element-template/protocol/update-event.js.map +1 -0
- package/runtime/lib/element-template/runtime/list/list.d.ts +65 -0
- package/runtime/lib/element-template/runtime/list/list.js +587 -0
- package/runtime/lib/element-template/runtime/list/list.js.map +1 -0
- package/runtime/lib/element-template/runtime/patch.d.ts +1 -1
- package/runtime/lib/element-template/runtime/patch.js +198 -75
- package/runtime/lib/element-template/runtime/patch.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-main-thread.js +13 -0
- package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-opcodes.js +83 -43
- package/runtime/lib/element-template/runtime/render/render-opcodes.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.js +32 -1
- package/runtime/lib/element-template/runtime/render/render-to-opcodes.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.d.ts +7 -5
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.js +17 -4
- 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 -2
- package/runtime/lib/element-template/runtime/template/handle.js +11 -0
- package/runtime/lib/element-template/runtime/template/handle.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-background-function.d.ts +10 -0
- package/runtime/lib/element-template/runtime/template/main-thread-background-function.js +30 -0
- package/runtime/lib/element-template/runtime/template/main-thread-background-function.js.map +1 -0
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.d.ts +15 -0
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js +91 -0
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js.map +1 -0
- package/runtime/lib/element-template/runtime/template/main-thread-event-ctx.d.ts +15 -0
- package/runtime/lib/element-template/runtime/template/main-thread-event-ctx.js +29 -0
- package/runtime/lib/element-template/runtime/template/main-thread-event-ctx.js.map +1 -0
- package/runtime/lib/element-template/runtime/template/main-thread-function.d.ts +6 -0
- package/runtime/lib/element-template/runtime/template/main-thread-function.js +24 -0
- package/runtime/lib/element-template/runtime/template/main-thread-function.js.map +1 -0
- package/runtime/lib/element-template/runtime/template/registry.d.ts +2 -0
- package/runtime/lib/element-template/runtime/template/registry.js +5 -0
- package/runtime/lib/element-template/runtime/template/registry.js.map +1 -1
- package/runtime/lib/element-template/runtime-backend-marker.js +6 -0
- package/runtime/lib/element-template/runtime-backend-marker.js.map +1 -0
- package/runtime/lib/index.d.ts +4 -2
- package/runtime/lib/index.js +5 -2
- package/runtime/lib/index.js.map +1 -1
- package/runtime/lib/internal.d.ts +5 -4
- package/runtime/lib/internal.js +6 -5
- package/runtime/lib/internal.js.map +1 -1
- package/runtime/lib/lynx-api.d.ts +1 -1
- package/runtime/lib/lynx-api.js +1 -1
- package/runtime/lib/lynx-api.js.map +1 -1
- package/runtime/lib/runtime-backend-marker.js +6 -0
- package/runtime/lib/runtime-backend-marker.js.map +1 -0
- package/runtime/lib/{snapshot/worklet/indexMap.d.ts → shared/index-map.d.ts} +2 -2
- package/runtime/lib/{snapshot/worklet/indexMap.js → shared/index-map.js} +5 -3
- package/runtime/lib/shared/index-map.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/patch/commit.js +2 -2
- package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -1
- package/runtime/lib/snapshot/lynx/calledByNative.js +1 -1
- package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -1
- package/runtime/lib/snapshot/lynx/children.d.ts +13 -0
- package/runtime/lib/snapshot/lynx/children.js +19 -0
- package/runtime/lib/snapshot/lynx/children.js.map +1 -0
- package/runtime/lib/snapshot/lynx/performance.d.ts +0 -21
- package/runtime/lib/snapshot/lynx/performance.js +7 -121
- package/runtime/lib/snapshot/lynx/performance.js.map +1 -1
- package/runtime/lib/snapshot/lynx/tt.js +2 -2
- package/runtime/lib/snapshot/lynx/tt.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.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/worklet/call/runOnMainThread.js +10 -31
- package/runtime/lib/snapshot/worklet/call/runOnMainThread.js.map +1 -1
- package/runtime/lib/snapshot/worklet/ctx.js +2 -2
- package/runtime/lib/snapshot/worklet/ctx.js.map +1 -1
- package/runtime/lib/snapshot/worklet/destroy.d.ts +0 -1
- package/runtime/lib/snapshot/worklet/destroy.js +2 -5
- package/runtime/lib/snapshot/worklet/destroy.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/runtime/lib/worklet-runtime/bindings/observers.d.ts +7 -0
- package/runtime/lib/worklet-runtime/bindings/observers.js +14 -1
- package/runtime/lib/worklet-runtime/bindings/observers.js.map +1 -1
- package/runtime/lib/worklet-runtime/delayRunOnBackground.d.ts +2 -1
- package/runtime/lib/worklet-runtime/delayRunOnBackground.js +6 -2
- package/runtime/lib/worklet-runtime/delayRunOnBackground.js.map +1 -1
- package/runtime/lib/worklet-runtime/hydrate.js +3 -0
- package/runtime/lib/worklet-runtime/hydrate.js.map +1 -1
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.d.ts +1 -1
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js +1 -1
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js.map +1 -1
- package/runtime/lib/worklet-runtime/workletRuntime.js +17 -2
- package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
- package/runtime/worklet-runtime/dev.js +26 -9
- package/runtime/worklet-runtime/main.js +1 -1
- package/testing-library/dist/{rslib-runtime.js → 0~rslib-runtime.js} +14 -13
- package/testing-library/dist/env/vitest.js +1 -1
- package/testing-library/dist/plugins/index.js +1 -1
- package/testing-library/dist/pure.js +18 -18
- package/testing-library/dist/rstest-config.js +2 -4
- package/testing-library/dist/setupFiles/common/bootstrap.js +1 -0
- package/testing-library/dist/setupFiles/common/runtime-setup.js +1 -1
- package/testing-library/dist/setupFiles/inner/rstest.js +2 -1
- package/testing-library/dist/setupFiles/inner/vitest.js +2 -1
- package/testing-library/dist/type-entry/index.js +1 -0
- package/transform/dist/wasm.cjs +113 -40
- package/types/react.docs.d.ts +14 -0
- package/runtime/lib/element-template/native/reload.js.map +0 -1
- package/runtime/lib/snapshot/compat/lynxComponent.js.map +0 -1
- package/runtime/lib/snapshot/legacy-react-runtime/index.js.map +0 -1
- package/runtime/lib/snapshot/lynx/component.js.map +0 -1
- package/runtime/lib/snapshot/lynx/dynamic-js.js.map +0 -1
- package/runtime/lib/snapshot/lynx/lazy-bundle.js.map +0 -1
- package/runtime/lib/snapshot/worklet/call/delayedRunOnMainThreadData.d.ts +0 -3
- package/runtime/lib/snapshot/worklet/call/delayedRunOnMainThreadData.js +0 -10
- package/runtime/lib/snapshot/worklet/call/delayedRunOnMainThreadData.js.map +0 -1
- package/runtime/lib/snapshot/worklet/call/execMap.js +0 -43
- package/runtime/lib/snapshot/worklet/call/execMap.js.map +0 -1
- package/runtime/lib/snapshot/worklet/call/functionCall.d.ts +0 -1
- package/runtime/lib/snapshot/worklet/call/functionCall.js +0 -33
- package/runtime/lib/snapshot/worklet/call/functionCall.js.map +0 -1
- package/runtime/lib/snapshot/worklet/call/runOnBackground.d.ts +0 -20
- package/runtime/lib/snapshot/worklet/call/runOnBackground.js.map +0 -1
- package/runtime/lib/snapshot/worklet/call/transformToWorklet.d.ts +0 -1
- package/runtime/lib/snapshot/worklet/call/transformToWorklet.js +0 -22
- package/runtime/lib/snapshot/worklet/call/transformToWorklet.js.map +0 -1
- package/runtime/lib/snapshot/worklet/indexMap.js.map +0 -1
- package/testing-library/dist/881.js +0 -1
- /package/runtime/lib/{snapshot/lynx/dynamic-js.d.ts → core/lynx/dynamic-import.d.ts} +0 -0
- /package/runtime/lib/{snapshot → core}/lynx/lazy-bundle.d.ts +0 -0
- /package/runtime/lib/{snapshot → core}/lynx/lazy-bundle.js +0 -0
- /package/runtime/lib/{snapshot/lynx/component.d.ts → element-template/runtime-backend-marker.d.ts} +0 -0
- /package/runtime/lib/{snapshot/worklet/call/execMap.d.ts → runtime-backend-marker.d.ts} +0 -0
- /package/testing-library/dist/{0~123.js → 0~@rstest/adapter-rsbuild.js} +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright 2026 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
import { applyUpdatePageData } from '../../core/lynx-page-data.js';
|
|
5
|
+
import { increaseReloadVersion } from '../../core/reload-version.js';
|
|
6
|
+
import { profileEnd, profileStart } from '../debug/profile.js';
|
|
7
|
+
import { destroyAllElementTemplateListStates } from '../runtime/list/list.js';
|
|
8
|
+
import { __page } from '../runtime/page/page.js';
|
|
9
|
+
import { __root, setRoot } from '../runtime/page/root-instance.js';
|
|
10
|
+
import { removeMainThreadRootRefs, renderMainThread } from '../runtime/render/render-main-thread.js';
|
|
11
|
+
import { resetTemplateId } from '../runtime/template/handle.js';
|
|
12
|
+
import { resetElementTemplateMainThreadBackgroundFunctionRuntime } from '../runtime/template/main-thread-background-function.js';
|
|
13
|
+
import { clearMainThreadDynamicAttrState } from '../runtime/template/main-thread-dynamic-attr-state.js';
|
|
14
|
+
import { elementTemplateRegistry } from '../runtime/template/registry.js';
|
|
15
|
+
export function reloadMainThread(data, options) {
|
|
16
|
+
if (typeof __PROFILE__ !== 'undefined' && __PROFILE__) {
|
|
17
|
+
profileStart('ReactLynx::reloadMainThread');
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
increaseReloadVersion();
|
|
21
|
+
applyUpdatePageData(data, options);
|
|
22
|
+
destroyAllElementTemplateListStates();
|
|
23
|
+
elementTemplateRegistry.clear();
|
|
24
|
+
clearMainThreadDynamicAttrState();
|
|
25
|
+
resetElementTemplateMainThreadBackgroundFunctionRuntime();
|
|
26
|
+
resetTemplateId();
|
|
27
|
+
const oldRoot = __root;
|
|
28
|
+
removeMainThreadRootRefs();
|
|
29
|
+
setRoot({ __jsx: oldRoot.__jsx });
|
|
30
|
+
renderMainThread();
|
|
31
|
+
__FlushElementTree(__page, options);
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
if (typeof __PROFILE__ !== 'undefined' && __PROFILE__) {
|
|
35
|
+
profileEnd();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=reload-main-thread.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reload-main-thread.js","sourceRoot":"","sources":["../../../src/element-template/native/reload-main-thread.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,uDAAuD,EAAE,MAAM,wDAAwD,CAAC;AACjI,OAAO,EAAE,+BAA+B,EAAE,MAAM,uDAAuD,CAAC;AACxG,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE1E,MAAM,UAAU,gBAAgB,CAAC,IAAa,EAAE,OAAyB;IACvE,IAAI,OAAO,WAAW,KAAK,WAAW,IAAI,WAAW,EAAE,CAAC;QACtD,YAAY,CAAC,6BAA6B,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,CAAC;QACH,qBAAqB,EAAE,CAAC;QACxB,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEnC,mCAAmC,EAAE,CAAC;QACtC,uBAAuB,CAAC,KAAK,EAAE,CAAC;QAChC,+BAA+B,EAAE,CAAC;QAClC,uDAAuD,EAAE,CAAC;QAC1D,eAAe,EAAE,CAAC;QAElB,MAAM,OAAO,GAAG,MAAM,CAAC;QACvB,wBAAwB,EAAE,CAAC;QAC3B,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QAClC,gBAAgB,EAAE,CAAC;QAEnB,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;YAAS,CAAC;QACT,IAAI,OAAO,WAAW,KAAK,WAAW,IAAI,WAAW,EAAE,CAAC;YACtD,UAAU,EAAE,CAAC;QACf,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
import type { SerializableValue } from '../protocol/types.js';
|
|
2
|
-
export
|
|
3
|
-
previousPreparedValue?: unknown;
|
|
4
|
-
}
|
|
5
|
-
export declare function prepareSpreadAttrSlot(handleId: number, attrSlotIndex: number, value: unknown, _context?: SpreadAttrAdapterContext): SerializableValue | null;
|
|
2
|
+
export declare function prepareSpreadAttrSlot(handleId: number, attrSlotIndex: number, value: unknown): SerializableValue | null;
|
|
@@ -11,7 +11,7 @@ function isEventPropKey(key) {
|
|
|
11
11
|
function isSpreadRecord(value) {
|
|
12
12
|
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
13
13
|
}
|
|
14
|
-
export function prepareSpreadAttrSlot(handleId, attrSlotIndex, value
|
|
14
|
+
export function prepareSpreadAttrSlot(handleId, attrSlotIndex, value) {
|
|
15
15
|
if (value === false || !isSpreadRecord(value)) {
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spread.js","sourceRoot":"","sources":["../../../src/element-template/prop-adapters/spread.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"spread.js","sourceRoot":"","sources":["../../../src/element-template/prop-adapters/spread.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrD,MAAM,kBAAkB,GAAG,kEAAkE,CAAC;AAC9F,MAAM,wBAAwB,GAAG,6EAA6E,CAAC;AAE/G,SAAS,cAAc,CAAC,GAAW;IACjC,OAAO,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,QAAgB,EAChB,aAAqB,EACrB,KAAc;IAEd,IAAI,KAAK,KAAK,KAAK,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAsC,EAAE,CAAC;IAEvD,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,GAAG,KAAK,UAAU,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;YACjE,SAAS;QACX,CAAC;QAED,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC;YAC3C,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAsB,CAAC;YAC7D,SAAS;QACX,CAAC;QAED,IAAI,GAAG,KAAK,KAAK,EAAE,CAAC;YAClB,MAAM,QAAQ,GAAG,yBAAyB,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;YAC3E,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,QAAQ,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;YAC7B,CAAC;YACD,SAAS;QACX,CAAC;QAED,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YACxB,QAAQ,CAAC,GAAG,CAAC,GAAG,WAAW,KAAK,IAAI,IAAI,WAAW,KAAK,SAAS,IAAI,WAAW,KAAK,KAAK;gBACxF,CAAC,CAAC,IAAI;gBACN,CAAC,CAAC,aAAa,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC;YAChD,SAAS;QACX,CAAC;QAED,IACE,WAAW,KAAK,SAAS;eACtB,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;eACpB,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC;eACxB,wBAAwB,CAAC,IAAI,CAAC,GAAG,CAAC;eAClC,OAAO,WAAW,KAAK,UAAU,EACpC,CAAC;YACD,SAAS;QACX,CAAC;QAED,QAAQ,CAAC,GAAG,CAAC,GAAG,WAAgC,CAAC;IACnD,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -4,5 +4,8 @@ export declare const ElementTemplateUpdateOps: {
|
|
|
4
4
|
readonly insertNode: 3;
|
|
5
5
|
readonly removeNode: 4;
|
|
6
6
|
readonly createTypedElement: 5;
|
|
7
|
+
readonly insertTypedListItem: 6;
|
|
8
|
+
readonly removeTypedListItem: 7;
|
|
9
|
+
readonly updateTypedListItem: 8;
|
|
7
10
|
};
|
|
8
11
|
export type ElementTemplateUpdateOp = typeof ElementTemplateUpdateOps[keyof typeof ElementTemplateUpdateOps];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opcodes.js","sourceRoot":"","sources":["../../../src/element-template/protocol/opcodes.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,cAAc,EAAE,CAAC;IACjB,YAAY,EAAE,CAAC;IACf,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,CAAC;IACb,kBAAkB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"opcodes.js","sourceRoot":"","sources":["../../../src/element-template/protocol/opcodes.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,cAAc,EAAE,CAAC;IACjB,YAAY,EAAE,CAAC;IACf,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,CAAC;IACb,kBAAkB,EAAE,CAAC;IACrB,mBAAmB,EAAE,CAAC;IACtB,mBAAmB,EAAE,CAAC;IACtB,mBAAmB,EAAE,CAAC;CACd,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ParsedElementTemplateType {
|
|
2
|
+
templateKey: string;
|
|
3
|
+
bundleUrl: string | null;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The `globDynamicComponentEntry` value baked into main-bundle templates. It
|
|
7
|
+
* denotes "the main card", which is equivalent to having no `bundleUrl`, so it
|
|
8
|
+
* normalizes to `null` everywhere the template type is parsed.
|
|
9
|
+
*/
|
|
10
|
+
export declare const MAIN_BUNDLE_URL_SENTINEL = "__Card__";
|
|
11
|
+
export declare function parseElementTemplateType(type: string): ParsedElementTemplateType;
|
|
12
|
+
/**
|
|
13
|
+
* The native identity for a template: the bundle-scoped key the main-thread
|
|
14
|
+
* registers it under. The main card has no bundle, so its sentinel is stripped
|
|
15
|
+
* to a bare `templateKey` (preserving native behavior); lazy bundles keep their
|
|
16
|
+
* `${bundleUrl}:${templateKey}` form.
|
|
17
|
+
*/
|
|
18
|
+
export declare function elementTemplateIdentityKey(templateKey: string, bundleUrl: string | null | undefined): string;
|
|
19
|
+
/**
|
|
20
|
+
* The full `${globDynamicComponentEntry}:${templateKey}` tag the transform bakes
|
|
21
|
+
* into compiled templates and uses as the `__etAttrPlanMap` key. It always keeps
|
|
22
|
+
* the `__Card__` sentinel for the main card (unlike {@link elementTemplateIdentityKey},
|
|
23
|
+
* which strips it). Inverse of {@link parseElementTemplateType}.
|
|
24
|
+
*/
|
|
25
|
+
export declare function elementTemplateTypeTag(templateKey: string, bundleUrl: string | null | undefined): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Copyright 2026 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
/**
|
|
5
|
+
* The `globDynamicComponentEntry` value baked into main-bundle templates. It
|
|
6
|
+
* denotes "the main card", which is equivalent to having no `bundleUrl`, so it
|
|
7
|
+
* normalizes to `null` everywhere the template type is parsed.
|
|
8
|
+
*/
|
|
9
|
+
export const MAIN_BUNDLE_URL_SENTINEL = '__Card__';
|
|
10
|
+
export function parseElementTemplateType(type) {
|
|
11
|
+
const delimiter = type.lastIndexOf(':');
|
|
12
|
+
if (delimiter < 0) {
|
|
13
|
+
return {
|
|
14
|
+
templateKey: type,
|
|
15
|
+
bundleUrl: null,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const bundleUrl = type.slice(0, delimiter);
|
|
19
|
+
return {
|
|
20
|
+
templateKey: type.slice(delimiter + 1),
|
|
21
|
+
bundleUrl: bundleUrl === MAIN_BUNDLE_URL_SENTINEL ? null : bundleUrl,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The native identity for a template: the bundle-scoped key the main-thread
|
|
26
|
+
* registers it under. The main card has no bundle, so its sentinel is stripped
|
|
27
|
+
* to a bare `templateKey` (preserving native behavior); lazy bundles keep their
|
|
28
|
+
* `${bundleUrl}:${templateKey}` form.
|
|
29
|
+
*/
|
|
30
|
+
export function elementTemplateIdentityKey(templateKey, bundleUrl) {
|
|
31
|
+
return bundleUrl == null ? templateKey : `${bundleUrl}:${templateKey}`;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The full `${globDynamicComponentEntry}:${templateKey}` tag the transform bakes
|
|
35
|
+
* into compiled templates and uses as the `__etAttrPlanMap` key. It always keeps
|
|
36
|
+
* the `__Card__` sentinel for the main card (unlike {@link elementTemplateIdentityKey},
|
|
37
|
+
* which strips it). Inverse of {@link parseElementTemplateType}.
|
|
38
|
+
*/
|
|
39
|
+
export function elementTemplateTypeTag(templateKey, bundleUrl) {
|
|
40
|
+
return `${bundleUrl ?? MAIN_BUNDLE_URL_SENTINEL}:${templateKey}`;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=template-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-type.js","sourceRoot":"","sources":["../../../src/element-template/protocol/template-type.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAO1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,UAAU,CAAC;AAEnD,MAAM,UAAU,wBAAwB,CAAC,IAAY;IACnD,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;QAClB,OAAO;YACL,WAAW,EAAE,IAAI;YACjB,SAAS,EAAE,IAAI;SAChB,CAAC;IACJ,CAAC;IACD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAC3C,OAAO;QACL,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;QACtC,SAAS,EAAE,SAAS,KAAK,wBAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;KACrE,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,WAAmB,EACnB,SAAoC;IAEpC,OAAO,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,WAAW,EAAE,CAAC;AACzE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,WAAmB,EACnB,SAAoC;IAEpC,OAAO,GAAG,SAAS,IAAI,wBAAwB,IAAI,WAAW,EAAE,CAAC;AACnE,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RunWorkletCtxData } from '@lynx-js/react/worklet-runtime/bindings';
|
|
1
2
|
import { ElementTemplateUpdateOps } from './opcodes.js';
|
|
2
3
|
export type SerializableValue = string | number | boolean | null | SerializableValue[] | {
|
|
3
4
|
[key: string]: SerializableValue;
|
|
@@ -11,12 +12,19 @@ export type RuntimeAttributeSlotValue = SerializableValue | ((...args: unknown[]
|
|
|
11
12
|
};
|
|
12
13
|
export type RuntimeTypedElementAttributes = Record<string, RuntimeAttributeSlotValue>;
|
|
13
14
|
export type TypedElementAttributesCommand = Record<string, SerializableValue>;
|
|
15
|
+
export type RuntimeElementSlots = Array<ElementRef[] | null | undefined>;
|
|
16
|
+
export type ElementTemplateHandleSlotsCommand = Array<number[] | null | undefined>;
|
|
17
|
+
export type SerializedEtNodeSlots = Array<SerializedEtNode[] | null | undefined>;
|
|
14
18
|
export interface ElementTemplateHandleRefCommandValue {
|
|
15
19
|
__etHandleRef: number;
|
|
16
20
|
[key: string]: SerializableValue;
|
|
17
21
|
}
|
|
22
|
+
export interface UpdateTypedListItemCommand extends ElementTemplateHandleRefCommandValue {
|
|
23
|
+
type: string;
|
|
24
|
+
platformInfo: Record<string, SerializableValue>;
|
|
25
|
+
}
|
|
18
26
|
export interface RuntimeOptionsCommand extends Record<string, SerializableValue> {
|
|
19
|
-
listChildren?:
|
|
27
|
+
listChildren?: UpdateTypedListItemCommand[];
|
|
20
28
|
}
|
|
21
29
|
export type SerializedRuntimeOptionValue = SerializableValue | SerializedEtNode | SerializedRuntimeOptionValue[] | {
|
|
22
30
|
[key: string]: SerializedRuntimeOptionValue;
|
|
@@ -24,29 +32,25 @@ export type SerializedRuntimeOptionValue = SerializableValue | SerializedEtNode
|
|
|
24
32
|
export type SerializedRuntimeOptions = Record<string, SerializedRuntimeOptionValue>;
|
|
25
33
|
export interface SerializedEtNodeBase {
|
|
26
34
|
attributeSlots?: SerializableValue[] | null;
|
|
27
|
-
elementSlots?:
|
|
35
|
+
elementSlots?: SerializedEtNodeSlots | null;
|
|
28
36
|
uid: number | string;
|
|
29
37
|
options?: SerializedRuntimeOptions | null;
|
|
30
38
|
}
|
|
31
39
|
export interface SerializedCompiledNode extends SerializedEtNodeBase {
|
|
32
40
|
templateKey: string;
|
|
33
41
|
bundleUrl?: string;
|
|
42
|
+
attributeSlots?: SerializableValue[] | null;
|
|
34
43
|
}
|
|
35
44
|
export interface SerializedTypedNode extends SerializedEtNodeBase {
|
|
36
|
-
|
|
45
|
+
tag: string;
|
|
46
|
+
attributes?: TypedElementAttributesCommand | null;
|
|
37
47
|
}
|
|
38
48
|
export type SerializedEtNode = SerializedCompiledNode | SerializedTypedNode;
|
|
39
49
|
export interface ElementTemplateHydrateCommitContext {
|
|
40
50
|
instances: SerializedEtNode[];
|
|
41
51
|
reloadVersion?: number;
|
|
42
52
|
}
|
|
43
|
-
export interface SerializedElementTemplate {
|
|
44
|
-
templateKey: string;
|
|
45
|
-
bundleUrl?: string;
|
|
46
|
-
attributeSlots?: SerializableValue[] | null;
|
|
47
|
-
elementSlots?: SerializedElementTemplate[][] | null;
|
|
48
|
-
uid: number | string;
|
|
49
|
-
options?: SerializedRuntimeOptions | null;
|
|
53
|
+
export interface SerializedElementTemplate extends SerializedCompiledNode {
|
|
50
54
|
}
|
|
51
55
|
export type CreateTemplateCommand = [
|
|
52
56
|
typeof ElementTemplateUpdateOps.createTemplate,
|
|
@@ -54,7 +58,7 @@ export type CreateTemplateCommand = [
|
|
|
54
58
|
templateKey: string,
|
|
55
59
|
bundleUrl: string | null | undefined,
|
|
56
60
|
attributeSlots: SerializableValue[] | null | undefined,
|
|
57
|
-
elementSlots:
|
|
61
|
+
elementSlots: ElementTemplateHandleSlotsCommand | null | undefined
|
|
58
62
|
];
|
|
59
63
|
export type SetAttributeCommand = [
|
|
60
64
|
typeof ElementTemplateUpdateOps.setAttribute,
|
|
@@ -81,10 +85,27 @@ export type CreateTypedElementCommand = [
|
|
|
81
85
|
handleId: number,
|
|
82
86
|
type: string,
|
|
83
87
|
attributes: TypedElementAttributesCommand | null | undefined,
|
|
84
|
-
elementSlots:
|
|
88
|
+
elementSlots: ElementTemplateHandleSlotsCommand | null | undefined,
|
|
85
89
|
options: RuntimeOptionsCommand | null | undefined
|
|
86
90
|
];
|
|
87
|
-
export type
|
|
91
|
+
export type InsertTypedListItemCommand = [
|
|
92
|
+
typeof ElementTemplateUpdateOps.insertTypedListItem,
|
|
93
|
+
listHandleId: number,
|
|
94
|
+
item: UpdateTypedListItemCommand,
|
|
95
|
+
beforeHandleId: number
|
|
96
|
+
];
|
|
97
|
+
export type RemoveTypedListItemCommand = [
|
|
98
|
+
typeof ElementTemplateUpdateOps.removeTypedListItem,
|
|
99
|
+
listHandleId: number,
|
|
100
|
+
itemHandleId: number,
|
|
101
|
+
removedSubtreeHandleIds: number[]
|
|
102
|
+
];
|
|
103
|
+
export type UpdateTypedListItemInfoCommand = [
|
|
104
|
+
typeof ElementTemplateUpdateOps.updateTypedListItem,
|
|
105
|
+
listHandleId: number,
|
|
106
|
+
item: UpdateTypedListItemCommand
|
|
107
|
+
];
|
|
108
|
+
export type ElementTemplateUpdateCommand = CreateTemplateCommand | SetAttributeCommand | InsertNodeCommand | RemoveNodeCommand | CreateTypedElementCommand | InsertTypedListItemCommand | RemoveTypedListItemCommand | UpdateTypedListItemInfoCommand;
|
|
88
109
|
export type ElementTemplateUpdateCommandStream = ElementTemplateUpdateCommand[number][];
|
|
89
110
|
export interface ElementTemplateFlushOptions {
|
|
90
111
|
pipelineOptions?: PipelineOptions;
|
|
@@ -93,6 +114,8 @@ export interface ElementTemplateFlushOptions {
|
|
|
93
114
|
export interface ElementTemplateUpdateCommitContext {
|
|
94
115
|
ops: ElementTemplateUpdateCommandStream;
|
|
95
116
|
flushOptions: ElementTemplateFlushOptions;
|
|
96
|
-
flowIds?: number[];
|
|
97
|
-
|
|
117
|
+
flowIds?: number[] | undefined;
|
|
118
|
+
isHydration?: boolean | undefined;
|
|
119
|
+
reloadVersion?: number | undefined;
|
|
120
|
+
delayedRunOnMainThreadData?: RunWorkletCtxData[] | undefined;
|
|
98
121
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/element-template/protocol/types.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/element-template/protocol/types.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAI1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ElementTemplateUpdateCommitContext } from './types.js';
|
|
2
|
+
export interface ElementTemplateUpdatePatchOptions {
|
|
3
|
+
pipelineOptions?: PipelineOptions | undefined;
|
|
4
|
+
reloadVersion?: number | undefined;
|
|
5
|
+
flowIds?: number[] | undefined;
|
|
6
|
+
}
|
|
7
|
+
export interface ElementTemplateUpdateEventData {
|
|
8
|
+
payload: string;
|
|
9
|
+
patchOptions: ElementTemplateUpdatePatchOptions;
|
|
10
|
+
}
|
|
11
|
+
export interface ElementTemplateUpdateEvent extends RuntimeProxy.Event {
|
|
12
|
+
data: ElementTemplateUpdateEventData;
|
|
13
|
+
}
|
|
14
|
+
export declare function createElementTemplateUpdateEvent(payload: ElementTemplateUpdateCommitContext): ElementTemplateUpdateEvent;
|
|
15
|
+
export declare function parseElementTemplateUpdateEventPayload(data: unknown): ElementTemplateUpdateCommitContext;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright 2026 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
import { ElementTemplateLifecycleConstant } from './lifecycle-constant.js';
|
|
5
|
+
export function createElementTemplateUpdateEvent(payload) {
|
|
6
|
+
const flowIds = payload.ops.length > 0 && payload.flowIds && payload.flowIds.length > 0
|
|
7
|
+
? payload.flowIds
|
|
8
|
+
: undefined;
|
|
9
|
+
return {
|
|
10
|
+
type: ElementTemplateLifecycleConstant.update,
|
|
11
|
+
data: {
|
|
12
|
+
payload: JSON.stringify(payload),
|
|
13
|
+
patchOptions: {
|
|
14
|
+
pipelineOptions: payload.flushOptions.pipelineOptions,
|
|
15
|
+
reloadVersion: payload.reloadVersion,
|
|
16
|
+
flowIds,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function parseElementTemplateUpdateEventPayload(data) {
|
|
22
|
+
return JSON.parse(data.payload);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=update-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-event.js","sourceRoot":"","sources":["../../../src/element-template/protocol/update-event.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAkB3E,MAAM,UAAU,gCAAgC,CAC9C,OAA2C;IAE3C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;QACrF,CAAC,CAAC,OAAO,CAAC,OAAO;QACjB,CAAC,CAAC,SAAS,CAAC;IACd,OAAO;QACL,IAAI,EAAE,gCAAgC,CAAC,MAAM;QAC7C,IAAI,EAAE;YACJ,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAChC,YAAY,EAAE;gBACZ,eAAe,EAAE,OAAO,CAAC,YAAY,CAAC,eAAe;gBACrD,aAAa,EAAE,OAAO,CAAC,aAAa;gBACpC,OAAO;aACR;SACF;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,sCAAsC,CACpD,IAAa;IAEb,OAAO,IAAI,CAAC,KAAK,CAAE,IAAuC,CAAC,OAAO,CAAuC,CAAC;AAC5G,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { RuntimeTypedElementAttributes, SerializableValue } from '../../protocol/types.js';
|
|
2
|
+
export type ETListItemPlatformInfo = Record<string, SerializableValue>;
|
|
3
|
+
export interface ETListItemMeta {
|
|
4
|
+
templateKey: string;
|
|
5
|
+
platformInfo: ETListItemPlatformInfo;
|
|
6
|
+
}
|
|
7
|
+
interface ETListItemRecord extends ETListItemMeta {
|
|
8
|
+
uid: number;
|
|
9
|
+
ref: ElementRef;
|
|
10
|
+
attached: boolean;
|
|
11
|
+
needsAttachMove: boolean;
|
|
12
|
+
skipNextEnqueue: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface ETListCallbacks {
|
|
15
|
+
componentAtIndex: ComponentAtIndexCallback;
|
|
16
|
+
componentAtIndexes: ComponentAtIndexesCallback;
|
|
17
|
+
enqueueComponent: EnqueueComponentCallback;
|
|
18
|
+
}
|
|
19
|
+
export interface ETListState {
|
|
20
|
+
listHandleId: number | null;
|
|
21
|
+
holderRef: ElementRef | null;
|
|
22
|
+
items: ETListItemRecord[];
|
|
23
|
+
callbackItemBySign: Map<number, ETListItemRecord>;
|
|
24
|
+
destroyed: boolean;
|
|
25
|
+
hasAttachedMoves: boolean;
|
|
26
|
+
attributes: RuntimeTypedElementAttributes;
|
|
27
|
+
callbacks: ETListCallbacks;
|
|
28
|
+
}
|
|
29
|
+
export interface ETListUpdateItem extends ETListItemMeta {
|
|
30
|
+
uid: number;
|
|
31
|
+
ref: ElementRef;
|
|
32
|
+
}
|
|
33
|
+
export interface ETListUpdateInfo {
|
|
34
|
+
insertAction: Array<{
|
|
35
|
+
position: number;
|
|
36
|
+
type: string;
|
|
37
|
+
} & ETListItemPlatformInfo>;
|
|
38
|
+
removeAction: number[];
|
|
39
|
+
updateAction: Array<{
|
|
40
|
+
from: number;
|
|
41
|
+
to: number;
|
|
42
|
+
type: string;
|
|
43
|
+
flush: boolean;
|
|
44
|
+
} & ETListItemPlatformInfo>;
|
|
45
|
+
}
|
|
46
|
+
export interface ETListFlushResult {
|
|
47
|
+
uid: number;
|
|
48
|
+
attributes: RuntimeTypedElementAttributes;
|
|
49
|
+
removedSubtreeHandleIds?: number[];
|
|
50
|
+
}
|
|
51
|
+
export declare function registerElementTemplateListItem(uid: number, ref: ElementRef, meta: ETListItemMeta): void;
|
|
52
|
+
export declare function createElementTemplateListState(listItemUids: readonly number[], attributes?: RuntimeTypedElementAttributes | null): ETListState;
|
|
53
|
+
export declare function createElementTemplateListInitialUpdateInfo(state: ETListState): ETListUpdateInfo;
|
|
54
|
+
export declare function createElementTemplateListStateFromItems(items: ETListUpdateItem[], attributes?: RuntimeTypedElementAttributes | null): ETListState;
|
|
55
|
+
export declare function registerElementTemplateListState(uid: number, state: ETListState, needsInitialFlush: boolean, holderRef: ElementRef): void;
|
|
56
|
+
export declare function markElementTemplateListDestroyed(uid: number): number[] | undefined;
|
|
57
|
+
export declare function destroyAllElementTemplateListStates(): void;
|
|
58
|
+
export declare function updateElementTemplateListAttributes(uid: number, attributes: RuntimeTypedElementAttributes | null | undefined, updateListInfo?: ETListUpdateInfo): RuntimeTypedElementAttributes | null;
|
|
59
|
+
export declare function insertElementTemplateListItem(uid: number, item: ETListUpdateItem, beforeUid: number): void;
|
|
60
|
+
export declare function removeElementTemplateListItem(uid: number, itemUid: number, removedSubtreeHandleIds: readonly number[]): void;
|
|
61
|
+
export declare function updateElementTemplateListItem(uid: number, item: ETListUpdateItem): void;
|
|
62
|
+
export declare function flushPendingElementTemplateListUpdates(): ETListFlushResult[];
|
|
63
|
+
export declare function flushInitialElementTemplateListUpdates(): ETListFlushResult[];
|
|
64
|
+
export declare function composeElementTemplateListAttributes(attributes: RuntimeTypedElementAttributes | null | undefined, state: ETListState, updateListInfo?: ETListUpdateInfo): RuntimeTypedElementAttributes;
|
|
65
|
+
export {};
|