@lynx-js/react 0.121.0 → 0.121.2
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 +34 -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/commit-context.d.ts +8 -0
- package/runtime/lib/core/commit-context.js +18 -0
- package/runtime/lib/core/commit-context.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/core/component.js +79 -0
- package/runtime/lib/core/component.js.map +1 -0
- package/runtime/lib/core/forceRootRender.d.ts +7 -0
- package/runtime/lib/core/forceRootRender.js +40 -0
- package/runtime/lib/core/forceRootRender.js.map +1 -0
- package/runtime/lib/core/globalProps.d.ts +31 -0
- package/runtime/lib/core/globalProps.js +55 -0
- package/runtime/lib/core/globalProps.js.map +1 -0
- package/runtime/lib/core/hooks/useLynxGlobalEventListener.js +1 -1
- package/runtime/lib/core/hooks/useLynxGlobalEventListener.js.map +1 -1
- package/runtime/lib/{snapshot/compat → core}/initData.d.ts +1 -1
- package/runtime/lib/{snapshot/compat → core}/initData.js +4 -5
- package/runtime/lib/core/initData.js.map +1 -0
- 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-data-processors.d.ts +2 -0
- package/runtime/lib/core/lynx-data-processors.js +53 -0
- package/runtime/lib/core/lynx-data-processors.js.map +1 -0
- package/runtime/lib/core/lynx-page-data.d.ts +1 -0
- package/runtime/lib/core/lynx-page-data.js +14 -0
- package/runtime/lib/core/lynx-page-data.js.map +1 -0
- package/runtime/lib/core/lynx-update-data.d.ts +11 -0
- package/runtime/lib/core/lynx-update-data.js +21 -0
- package/runtime/lib/core/lynx-update-data.js.map +1 -0
- 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/ref.d.ts +37 -0
- package/runtime/lib/core/ref.js +108 -0
- package/runtime/lib/core/ref.js.map +1 -0
- package/runtime/lib/core/reload-version.d.ts +2 -0
- package/runtime/lib/{snapshot/lifecycle/pass.js → core/reload-version.js} +4 -5
- package/runtime/lib/core/reload-version.js.map +1 -0
- package/runtime/lib/element-template/background/attr-slots.d.ts +6 -1
- package/runtime/lib/element-template/background/attr-slots.js +35 -2
- package/runtime/lib/element-template/background/attr-slots.js.map +1 -1
- package/runtime/lib/element-template/background/commit-context.d.ts +3 -3
- package/runtime/lib/element-template/background/commit-context.js +15 -18
- package/runtime/lib/element-template/background/commit-context.js.map +1 -1
- package/runtime/lib/element-template/background/commit-hook.d.ts +1 -1
- package/runtime/lib/element-template/background/commit-hook.js +68 -43
- package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
- package/runtime/lib/element-template/background/destroy.js +9 -6
- package/runtime/lib/element-template/background/destroy.js.map +1 -1
- package/runtime/lib/element-template/background/document.js +5 -5
- 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 +247 -74
- package/runtime/lib/element-template/background/hydrate.js.map +1 -1
- package/runtime/lib/element-template/background/hydration-listener.js +49 -22
- package/runtime/lib/element-template/background/hydration-listener.js.map +1 -1
- package/runtime/lib/element-template/background/instance.d.ts +38 -9
- package/runtime/lib/element-template/background/instance.js +292 -113
- package/runtime/lib/element-template/background/instance.js.map +1 -1
- package/runtime/lib/element-template/client/root.d.ts +7 -0
- package/runtime/lib/element-template/client/root.js +3 -6
- package/runtime/lib/element-template/client/root.js.map +1 -1
- package/runtime/lib/element-template/debug/alog.d.ts +21 -0
- package/runtime/lib/element-template/debug/alog.js +33 -0
- package/runtime/lib/element-template/debug/alog.js.map +1 -1
- package/runtime/lib/element-template/debug/elementPAPICall.js +5 -0
- package/runtime/lib/element-template/debug/elementPAPICall.js.map +1 -1
- package/runtime/lib/element-template/hydration-map.d.ts +5 -0
- package/runtime/lib/element-template/hydration-map.js +12 -0
- package/runtime/lib/element-template/hydration-map.js.map +1 -0
- package/runtime/lib/element-template/index.d.ts +25 -3
- package/runtime/lib/element-template/index.js +38 -9
- package/runtime/lib/element-template/index.js.map +1 -1
- package/runtime/lib/element-template/internal.d.ts +5 -1
- package/runtime/lib/element-template/internal.js +6 -7
- package/runtime/lib/element-template/internal.js.map +1 -1
- package/runtime/lib/element-template/lynx/env.js +5 -48
- 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.d.ts +1 -1
- package/runtime/lib/element-template/native/index.js +28 -2
- package/runtime/lib/element-template/native/index.js.map +1 -1
- package/runtime/lib/element-template/native/main-thread-api.js +27 -5
- package/runtime/lib/element-template/native/main-thread-api.js.map +1 -1
- package/runtime/lib/element-template/native/mts-destroy.js +2 -0
- package/runtime/lib/element-template/native/mts-destroy.js.map +1 -1
- package/runtime/lib/element-template/native/patch-listener.js +6 -2
- 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-background.js +39 -0
- package/runtime/lib/element-template/native/reload-background.js.map +1 -0
- package/runtime/lib/element-template/native/reload-main-thread.d.ts +1 -0
- package/runtime/lib/element-template/native/reload-main-thread.js +35 -0
- package/runtime/lib/element-template/native/reload-main-thread.js.map +1 -0
- package/runtime/lib/element-template/prop-adapters/event.d.ts +1 -0
- package/runtime/lib/element-template/prop-adapters/event.js +4 -1
- package/runtime/lib/element-template/prop-adapters/event.js.map +1 -1
- package/runtime/lib/element-template/prop-adapters/ref.d.ts +26 -0
- package/runtime/lib/element-template/prop-adapters/ref.js +107 -0
- package/runtime/lib/element-template/prop-adapters/ref.js.map +1 -0
- package/runtime/lib/element-template/prop-adapters/spread.js +8 -1
- package/runtime/lib/element-template/prop-adapters/spread.js.map +1 -1
- package/runtime/lib/element-template/protocol/opcodes.d.ts +4 -0
- package/runtime/lib/element-template/protocol/opcodes.js +4 -0
- package/runtime/lib/element-template/protocol/opcodes.js.map +1 -1
- package/runtime/lib/element-template/protocol/template-type.d.ts +6 -0
- package/runtime/lib/element-template/protocol/template-type.js +20 -0
- package/runtime/lib/element-template/protocol/template-type.js.map +1 -0
- package/runtime/lib/element-template/protocol/types.d.ts +74 -6
- 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/page/page.d.ts +5 -2
- package/runtime/lib/element-template/runtime/page/page.js +12 -0
- package/runtime/lib/element-template/runtime/page/page.js.map +1 -1
- package/runtime/lib/element-template/runtime/patch.js +210 -38
- package/runtime/lib/element-template/runtime/patch.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-main-thread.d.ts +3 -1
- package/runtime/lib/element-template/runtime/render/render-main-thread.js +38 -7
- package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-opcodes.js +80 -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 +41 -4
- 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 +1 -0
- package/runtime/lib/element-template/runtime/template/attr-slot-plan.js +4 -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 -2
- package/runtime/lib/element-template/runtime/template/handle.js +5 -1
- package/runtime/lib/element-template/runtime/template/handle.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/registry.d.ts +2 -0
- package/runtime/lib/element-template/runtime/template/registry.js +6 -1
- 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 +1 -1
- package/runtime/lib/index.js +3 -1
- 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 +3 -8
- package/runtime/lib/lynx-api.js +8 -45
- 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/debug/vnodeSource.js +1 -1
- package/runtime/lib/snapshot/debug/vnodeSource.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/commit.d.ts +0 -1
- package/runtime/lib/snapshot/lifecycle/patch/commit.js +4 -9
- package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js +2 -2
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/ref/delay.d.ts +6 -13
- package/runtime/lib/snapshot/lifecycle/ref/delay.js +9 -30
- package/runtime/lib/snapshot/lifecycle/ref/delay.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/reload.js +2 -2
- package/runtime/lib/snapshot/lifecycle/reload.js.map +1 -1
- package/runtime/lib/snapshot/list/list.js +1 -1
- package/runtime/lib/snapshot/list/list.js.map +1 -1
- package/runtime/lib/snapshot/list/listUpdateInfo.js +3 -2
- package/runtime/lib/snapshot/list/listUpdateInfo.js.map +1 -1
- package/runtime/lib/snapshot/lynx/calledByNative.js +3 -9
- package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -1
- package/runtime/lib/snapshot/lynx/env.js +5 -51
- package/runtime/lib/snapshot/lynx/env.js.map +1 -1
- 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/runWithForce.js +9 -39
- package/runtime/lib/snapshot/lynx/runWithForce.js.map +1 -1
- package/runtime/lib/snapshot/lynx/tt.js +10 -30
- package/runtime/lib/snapshot/lynx/tt.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +4 -4
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/list.js +1 -1
- package/runtime/lib/snapshot/snapshot/list.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/ref.d.ts +3 -5
- package/runtime/lib/snapshot/snapshot/ref.js +16 -59
- 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/snapshotInstanceHydrationMap.js +1 -1
- package/runtime/lib/snapshot/snapshot/snapshotInstanceHydrationMap.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/runtime/lib/worklet-runtime/workletRuntime.js +1 -1
- package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
- package/runtime/worklet-runtime/dev.js +2 -3
- 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/index.js +2 -8
- package/testing-library/dist/env/vitest.js +1 -1
- package/testing-library/dist/plugins/index.js +13 -2
- 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/runtime/lib/element-template/hooks/react.d.ts +0 -14
- package/runtime/lib/element-template/hooks/react.js +0 -24
- package/runtime/lib/element-template/hooks/react.js.map +0 -1
- package/runtime/lib/element-template/runtime/components/slot.js +0 -11
- package/runtime/lib/element-template/runtime/components/slot.js.map +0 -1
- package/runtime/lib/snapshot/compat/initData.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/lifecycle/pass.d.ts +0 -3
- package/runtime/lib/snapshot/lifecycle/pass.js.map +0 -1
- package/runtime/lib/snapshot/lynx/component.js +0 -73
- 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/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/element-template/{runtime/components/slot.d.ts → runtime-backend-marker.d.ts} +0 -0
- /package/runtime/lib/{snapshot/lynx/component.d.ts → runtime-backend-marker.d.ts} +0 -0
- /package/testing-library/dist/{0~123.js → 0~@rstest/adapter-rsbuild.js} +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
4
|
import { getEventValue } from './event-value.js';
|
|
5
|
+
import { prepareSpreadRefAttrValue } from './ref.js';
|
|
5
6
|
const eventPropKeyRegExp = /^(?:global-bind|bind|catch|capture-bind|capture-catch)[A-Za-z]+$/;
|
|
6
7
|
const namespacedEventKeyRegExp = /^[A-Za-z-]+:(?:global-bind|bind|catch|capture-bind|capture-catch)[A-Za-z]+$/;
|
|
7
8
|
function isEventPropKey(key) {
|
|
@@ -24,6 +25,13 @@ export function prepareSpreadAttrSlot(handleId, attrSlotIndex, value, _context)
|
|
|
24
25
|
prepared['class'] = (spreadValue ?? '');
|
|
25
26
|
continue;
|
|
26
27
|
}
|
|
28
|
+
if (key === 'ref') {
|
|
29
|
+
const refValue = prepareSpreadRefAttrValue(handleId, attrSlotIndex, value);
|
|
30
|
+
if (refValue !== undefined) {
|
|
31
|
+
prepared['ref'] = refValue;
|
|
32
|
+
}
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
27
35
|
if (isEventPropKey(key)) {
|
|
28
36
|
prepared[key] = spreadValue === null || spreadValue === undefined || spreadValue === false
|
|
29
37
|
? null
|
|
@@ -31,7 +39,6 @@ export function prepareSpreadAttrSlot(handleId, attrSlotIndex, value, _context)
|
|
|
31
39
|
continue;
|
|
32
40
|
}
|
|
33
41
|
if (spreadValue === undefined
|
|
34
|
-
|| key === 'ref'
|
|
35
42
|
|| key.endsWith(':ref')
|
|
36
43
|
|| key.endsWith(':gesture')
|
|
37
44
|
|| namespacedEventKeyRegExp.test(key)
|
|
@@ -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;
|
|
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;AAOrD,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,EACd,QAAmC;IAEnC,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"}
|
|
@@ -3,5 +3,9 @@ export declare const ElementTemplateUpdateOps: {
|
|
|
3
3
|
readonly setAttribute: 2;
|
|
4
4
|
readonly insertNode: 3;
|
|
5
5
|
readonly removeNode: 4;
|
|
6
|
+
readonly createTypedElement: 5;
|
|
7
|
+
readonly insertTypedListItem: 6;
|
|
8
|
+
readonly removeTypedListItem: 7;
|
|
9
|
+
readonly updateTypedListItem: 8;
|
|
6
10
|
};
|
|
7
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;
|
|
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,6 @@
|
|
|
1
|
+
export interface ParsedElementTemplateType {
|
|
2
|
+
templateKey: string;
|
|
3
|
+
bundleUrl: string | null;
|
|
4
|
+
}
|
|
5
|
+
export declare function parseElementTemplateType(type: string): ParsedElementTemplateType;
|
|
6
|
+
export declare function elementTemplateIdentityKey(templateKey: string, bundleUrl: string | null | undefined): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
export function parseElementTemplateType(type) {
|
|
5
|
+
const delimiter = type.lastIndexOf(':');
|
|
6
|
+
if (delimiter < 0) {
|
|
7
|
+
return {
|
|
8
|
+
templateKey: type,
|
|
9
|
+
bundleUrl: null,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
templateKey: type.slice(delimiter + 1),
|
|
14
|
+
bundleUrl: type.slice(0, delimiter),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function elementTemplateIdentityKey(templateKey, bundleUrl) {
|
|
18
|
+
return bundleUrl == null ? templateKey : `${bundleUrl}:${templateKey}`;
|
|
19
|
+
}
|
|
20
|
+
//# 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,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,OAAO;QACL,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;QACtC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC;KACpC,CAAC;AACJ,CAAC;AAED,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"}
|
|
@@ -2,13 +2,54 @@ import { ElementTemplateUpdateOps } from './opcodes.js';
|
|
|
2
2
|
export type SerializableValue = string | number | boolean | null | SerializableValue[] | {
|
|
3
3
|
[key: string]: SerializableValue;
|
|
4
4
|
};
|
|
5
|
-
export type
|
|
6
|
-
|
|
5
|
+
export type RuntimeOptionValue = SerializableValue | ElementRef | RuntimeOptionValue[] | {
|
|
6
|
+
[key: string]: RuntimeOptionValue;
|
|
7
|
+
};
|
|
8
|
+
export type RuntimeOptions = Record<string, RuntimeOptionValue>;
|
|
9
|
+
export type RuntimeAttributeSlotValue = SerializableValue | ((...args: unknown[]) => unknown) | RuntimeAttributeSlotValue[] | {
|
|
10
|
+
[key: string]: RuntimeAttributeSlotValue;
|
|
11
|
+
};
|
|
12
|
+
export type RuntimeTypedElementAttributes = Record<string, RuntimeAttributeSlotValue>;
|
|
13
|
+
export type TypedElementAttributesCommand = Record<string, SerializableValue>;
|
|
14
|
+
export type RuntimeElementSlots = Array<ElementRef[] | null | undefined>;
|
|
15
|
+
export type ElementTemplateHandleSlotsCommand = Array<number[] | null | undefined>;
|
|
16
|
+
export type SerializedEtNodeSlots = Array<SerializedEtNode[] | null | undefined>;
|
|
17
|
+
export interface ElementTemplateHandleRefCommandValue {
|
|
18
|
+
__etHandleRef: number;
|
|
19
|
+
[key: string]: SerializableValue;
|
|
20
|
+
}
|
|
21
|
+
export interface UpdateTypedListItemCommand extends ElementTemplateHandleRefCommandValue {
|
|
22
|
+
type: string;
|
|
23
|
+
platformInfo: Record<string, SerializableValue>;
|
|
24
|
+
}
|
|
25
|
+
export interface RuntimeOptionsCommand extends Record<string, SerializableValue> {
|
|
26
|
+
listChildren?: UpdateTypedListItemCommand[];
|
|
27
|
+
}
|
|
28
|
+
export type SerializedRuntimeOptionValue = SerializableValue | SerializedEtNode | SerializedRuntimeOptionValue[] | {
|
|
29
|
+
[key: string]: SerializedRuntimeOptionValue;
|
|
30
|
+
};
|
|
31
|
+
export type SerializedRuntimeOptions = Record<string, SerializedRuntimeOptionValue>;
|
|
32
|
+
export interface SerializedEtNodeBase {
|
|
33
|
+
attributeSlots?: SerializableValue[] | null;
|
|
34
|
+
elementSlots?: SerializedEtNodeSlots | null;
|
|
35
|
+
uid: number | string;
|
|
36
|
+
options?: SerializedRuntimeOptions | null;
|
|
37
|
+
}
|
|
38
|
+
export interface SerializedCompiledNode extends SerializedEtNodeBase {
|
|
7
39
|
templateKey: string;
|
|
8
40
|
bundleUrl?: string;
|
|
9
41
|
attributeSlots?: SerializableValue[] | null;
|
|
10
|
-
|
|
11
|
-
|
|
42
|
+
}
|
|
43
|
+
export interface SerializedTypedNode extends SerializedEtNodeBase {
|
|
44
|
+
tag: string;
|
|
45
|
+
attributes?: TypedElementAttributesCommand | null;
|
|
46
|
+
}
|
|
47
|
+
export type SerializedEtNode = SerializedCompiledNode | SerializedTypedNode;
|
|
48
|
+
export interface ElementTemplateHydrateCommitContext {
|
|
49
|
+
instances: SerializedEtNode[];
|
|
50
|
+
reloadVersion?: number;
|
|
51
|
+
}
|
|
52
|
+
export interface SerializedElementTemplate extends SerializedCompiledNode {
|
|
12
53
|
}
|
|
13
54
|
export type CreateTemplateCommand = [
|
|
14
55
|
typeof ElementTemplateUpdateOps.createTemplate,
|
|
@@ -16,7 +57,7 @@ export type CreateTemplateCommand = [
|
|
|
16
57
|
templateKey: string,
|
|
17
58
|
bundleUrl: string | null | undefined,
|
|
18
59
|
attributeSlots: SerializableValue[] | null | undefined,
|
|
19
|
-
elementSlots:
|
|
60
|
+
elementSlots: ElementTemplateHandleSlotsCommand | null | undefined
|
|
20
61
|
];
|
|
21
62
|
export type SetAttributeCommand = [
|
|
22
63
|
typeof ElementTemplateUpdateOps.setAttribute,
|
|
@@ -38,13 +79,40 @@ export type RemoveNodeCommand = [
|
|
|
38
79
|
childHandleId: number,
|
|
39
80
|
removedSubtreeHandleIds: number[]
|
|
40
81
|
];
|
|
41
|
-
export type
|
|
82
|
+
export type CreateTypedElementCommand = [
|
|
83
|
+
typeof ElementTemplateUpdateOps.createTypedElement,
|
|
84
|
+
handleId: number,
|
|
85
|
+
type: string,
|
|
86
|
+
attributes: TypedElementAttributesCommand | null | undefined,
|
|
87
|
+
elementSlots: ElementTemplateHandleSlotsCommand | null | undefined,
|
|
88
|
+
options: RuntimeOptionsCommand | null | undefined
|
|
89
|
+
];
|
|
90
|
+
export type InsertTypedListItemCommand = [
|
|
91
|
+
typeof ElementTemplateUpdateOps.insertTypedListItem,
|
|
92
|
+
listHandleId: number,
|
|
93
|
+
item: UpdateTypedListItemCommand,
|
|
94
|
+
beforeHandleId: number
|
|
95
|
+
];
|
|
96
|
+
export type RemoveTypedListItemCommand = [
|
|
97
|
+
typeof ElementTemplateUpdateOps.removeTypedListItem,
|
|
98
|
+
listHandleId: number,
|
|
99
|
+
itemHandleId: number,
|
|
100
|
+
removedSubtreeHandleIds: number[]
|
|
101
|
+
];
|
|
102
|
+
export type UpdateTypedListItemInfoCommand = [
|
|
103
|
+
typeof ElementTemplateUpdateOps.updateTypedListItem,
|
|
104
|
+
listHandleId: number,
|
|
105
|
+
item: UpdateTypedListItemCommand
|
|
106
|
+
];
|
|
107
|
+
export type ElementTemplateUpdateCommand = CreateTemplateCommand | SetAttributeCommand | InsertNodeCommand | RemoveNodeCommand | CreateTypedElementCommand | InsertTypedListItemCommand | RemoveTypedListItemCommand | UpdateTypedListItemInfoCommand;
|
|
42
108
|
export type ElementTemplateUpdateCommandStream = ElementTemplateUpdateCommand[number][];
|
|
43
109
|
export interface ElementTemplateFlushOptions {
|
|
44
110
|
pipelineOptions?: PipelineOptions;
|
|
111
|
+
triggerDataUpdated?: boolean;
|
|
45
112
|
}
|
|
46
113
|
export interface ElementTemplateUpdateCommitContext {
|
|
47
114
|
ops: ElementTemplateUpdateCommandStream;
|
|
48
115
|
flushOptions: ElementTemplateFlushOptions;
|
|
49
116
|
flowIds?: number[];
|
|
117
|
+
reloadVersion?: number;
|
|
50
118
|
}
|
|
@@ -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 {};
|