@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.
Files changed (238) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/package.json +5 -5
  3. package/runtime/lazy/element-template-import.js +73 -0
  4. package/runtime/lazy/import.js +4 -0
  5. package/runtime/lazy/target.js +23 -0
  6. package/runtime/lib/core/commit-context.d.ts +8 -0
  7. package/runtime/lib/core/commit-context.js +18 -0
  8. package/runtime/lib/core/commit-context.js.map +1 -0
  9. package/runtime/lib/{snapshot/legacy-react-runtime/index.d.ts → core/compat/legacy-react-runtime.d.ts} +4 -4
  10. package/runtime/lib/{snapshot/legacy-react-runtime/index.js → core/compat/legacy-react-runtime.js} +6 -6
  11. package/runtime/lib/core/compat/legacy-react-runtime.js.map +1 -0
  12. package/runtime/lib/{snapshot → core}/compat/lynxComponent.d.ts +2 -1
  13. package/runtime/lib/{snapshot → core}/compat/lynxComponent.js +11 -5
  14. package/runtime/lib/core/compat/lynxComponent.js.map +1 -0
  15. package/runtime/lib/core/component.d.ts +2 -0
  16. package/runtime/lib/core/component.js +79 -0
  17. package/runtime/lib/core/component.js.map +1 -0
  18. package/runtime/lib/core/forceRootRender.d.ts +7 -0
  19. package/runtime/lib/core/forceRootRender.js +40 -0
  20. package/runtime/lib/core/forceRootRender.js.map +1 -0
  21. package/runtime/lib/core/globalProps.d.ts +31 -0
  22. package/runtime/lib/core/globalProps.js +55 -0
  23. package/runtime/lib/core/globalProps.js.map +1 -0
  24. package/runtime/lib/core/hooks/useLynxGlobalEventListener.js +1 -1
  25. package/runtime/lib/core/hooks/useLynxGlobalEventListener.js.map +1 -1
  26. package/runtime/lib/{snapshot/compat → core}/initData.d.ts +1 -1
  27. package/runtime/lib/{snapshot/compat → core}/initData.js +4 -5
  28. package/runtime/lib/core/initData.js.map +1 -0
  29. package/runtime/lib/{snapshot/lynx/dynamic-js.js → core/lynx/dynamic-import.js} +1 -1
  30. package/runtime/lib/core/lynx/dynamic-import.js.map +1 -0
  31. package/runtime/lib/core/lynx/lazy-bundle.js.map +1 -0
  32. package/runtime/lib/core/lynx/runtime-backend.d.ts +5 -0
  33. package/runtime/lib/core/lynx/runtime-backend.js +20 -0
  34. package/runtime/lib/core/lynx/runtime-backend.js.map +1 -0
  35. package/runtime/lib/core/lynx-data-processors.d.ts +2 -0
  36. package/runtime/lib/core/lynx-data-processors.js +53 -0
  37. package/runtime/lib/core/lynx-data-processors.js.map +1 -0
  38. package/runtime/lib/core/lynx-page-data.d.ts +1 -0
  39. package/runtime/lib/core/lynx-page-data.js +14 -0
  40. package/runtime/lib/core/lynx-page-data.js.map +1 -0
  41. package/runtime/lib/core/lynx-update-data.d.ts +11 -0
  42. package/runtime/lib/core/lynx-update-data.js +21 -0
  43. package/runtime/lib/core/lynx-update-data.js.map +1 -0
  44. package/runtime/lib/core/performance.d.ts +30 -0
  45. package/runtime/lib/core/performance.js +145 -0
  46. package/runtime/lib/core/performance.js.map +1 -0
  47. package/runtime/lib/core/ref.d.ts +37 -0
  48. package/runtime/lib/core/ref.js +108 -0
  49. package/runtime/lib/core/ref.js.map +1 -0
  50. package/runtime/lib/core/reload-version.d.ts +2 -0
  51. package/runtime/lib/{snapshot/lifecycle/pass.js → core/reload-version.js} +4 -5
  52. package/runtime/lib/core/reload-version.js.map +1 -0
  53. package/runtime/lib/element-template/background/attr-slots.d.ts +6 -1
  54. package/runtime/lib/element-template/background/attr-slots.js +35 -2
  55. package/runtime/lib/element-template/background/attr-slots.js.map +1 -1
  56. package/runtime/lib/element-template/background/commit-context.d.ts +3 -3
  57. package/runtime/lib/element-template/background/commit-context.js +15 -18
  58. package/runtime/lib/element-template/background/commit-context.js.map +1 -1
  59. package/runtime/lib/element-template/background/commit-hook.d.ts +1 -1
  60. package/runtime/lib/element-template/background/commit-hook.js +68 -43
  61. package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
  62. package/runtime/lib/element-template/background/destroy.js +9 -6
  63. package/runtime/lib/element-template/background/destroy.js.map +1 -1
  64. package/runtime/lib/element-template/background/document.js +5 -5
  65. package/runtime/lib/element-template/background/document.js.map +1 -1
  66. package/runtime/lib/element-template/background/hydrate.d.ts +2 -3
  67. package/runtime/lib/element-template/background/hydrate.js +247 -74
  68. package/runtime/lib/element-template/background/hydrate.js.map +1 -1
  69. package/runtime/lib/element-template/background/hydration-listener.js +49 -22
  70. package/runtime/lib/element-template/background/hydration-listener.js.map +1 -1
  71. package/runtime/lib/element-template/background/instance.d.ts +38 -9
  72. package/runtime/lib/element-template/background/instance.js +292 -113
  73. package/runtime/lib/element-template/background/instance.js.map +1 -1
  74. package/runtime/lib/element-template/client/root.d.ts +7 -0
  75. package/runtime/lib/element-template/client/root.js +3 -6
  76. package/runtime/lib/element-template/client/root.js.map +1 -1
  77. package/runtime/lib/element-template/debug/alog.d.ts +21 -0
  78. package/runtime/lib/element-template/debug/alog.js +33 -0
  79. package/runtime/lib/element-template/debug/alog.js.map +1 -1
  80. package/runtime/lib/element-template/debug/elementPAPICall.js +5 -0
  81. package/runtime/lib/element-template/debug/elementPAPICall.js.map +1 -1
  82. package/runtime/lib/element-template/hydration-map.d.ts +5 -0
  83. package/runtime/lib/element-template/hydration-map.js +12 -0
  84. package/runtime/lib/element-template/hydration-map.js.map +1 -0
  85. package/runtime/lib/element-template/index.d.ts +25 -3
  86. package/runtime/lib/element-template/index.js +38 -9
  87. package/runtime/lib/element-template/index.js.map +1 -1
  88. package/runtime/lib/element-template/internal.d.ts +5 -1
  89. package/runtime/lib/element-template/internal.js +6 -7
  90. package/runtime/lib/element-template/internal.js.map +1 -1
  91. package/runtime/lib/element-template/lynx/env.js +5 -48
  92. package/runtime/lib/element-template/lynx/env.js.map +1 -1
  93. package/runtime/lib/element-template/lynx/performance.d.ts +0 -21
  94. package/runtime/lib/element-template/lynx/performance.js +4 -121
  95. package/runtime/lib/element-template/lynx/performance.js.map +1 -1
  96. package/runtime/lib/element-template/native/index.d.ts +1 -1
  97. package/runtime/lib/element-template/native/index.js +28 -2
  98. package/runtime/lib/element-template/native/index.js.map +1 -1
  99. package/runtime/lib/element-template/native/main-thread-api.js +27 -5
  100. package/runtime/lib/element-template/native/main-thread-api.js.map +1 -1
  101. package/runtime/lib/element-template/native/mts-destroy.js +2 -0
  102. package/runtime/lib/element-template/native/mts-destroy.js.map +1 -1
  103. package/runtime/lib/element-template/native/patch-listener.js +6 -2
  104. package/runtime/lib/element-template/native/patch-listener.js.map +1 -1
  105. package/runtime/lib/element-template/native/reload-background.d.ts +1 -0
  106. package/runtime/lib/element-template/native/reload-background.js +39 -0
  107. package/runtime/lib/element-template/native/reload-background.js.map +1 -0
  108. package/runtime/lib/element-template/native/reload-main-thread.d.ts +1 -0
  109. package/runtime/lib/element-template/native/reload-main-thread.js +35 -0
  110. package/runtime/lib/element-template/native/reload-main-thread.js.map +1 -0
  111. package/runtime/lib/element-template/prop-adapters/event.d.ts +1 -0
  112. package/runtime/lib/element-template/prop-adapters/event.js +4 -1
  113. package/runtime/lib/element-template/prop-adapters/event.js.map +1 -1
  114. package/runtime/lib/element-template/prop-adapters/ref.d.ts +26 -0
  115. package/runtime/lib/element-template/prop-adapters/ref.js +107 -0
  116. package/runtime/lib/element-template/prop-adapters/ref.js.map +1 -0
  117. package/runtime/lib/element-template/prop-adapters/spread.js +8 -1
  118. package/runtime/lib/element-template/prop-adapters/spread.js.map +1 -1
  119. package/runtime/lib/element-template/protocol/opcodes.d.ts +4 -0
  120. package/runtime/lib/element-template/protocol/opcodes.js +4 -0
  121. package/runtime/lib/element-template/protocol/opcodes.js.map +1 -1
  122. package/runtime/lib/element-template/protocol/template-type.d.ts +6 -0
  123. package/runtime/lib/element-template/protocol/template-type.js +20 -0
  124. package/runtime/lib/element-template/protocol/template-type.js.map +1 -0
  125. package/runtime/lib/element-template/protocol/types.d.ts +74 -6
  126. package/runtime/lib/element-template/runtime/list/list.d.ts +65 -0
  127. package/runtime/lib/element-template/runtime/list/list.js +587 -0
  128. package/runtime/lib/element-template/runtime/list/list.js.map +1 -0
  129. package/runtime/lib/element-template/runtime/page/page.d.ts +5 -2
  130. package/runtime/lib/element-template/runtime/page/page.js +12 -0
  131. package/runtime/lib/element-template/runtime/page/page.js.map +1 -1
  132. package/runtime/lib/element-template/runtime/patch.js +210 -38
  133. package/runtime/lib/element-template/runtime/patch.js.map +1 -1
  134. package/runtime/lib/element-template/runtime/render/render-main-thread.d.ts +3 -1
  135. package/runtime/lib/element-template/runtime/render/render-main-thread.js +38 -7
  136. package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
  137. package/runtime/lib/element-template/runtime/render/render-opcodes.js +80 -43
  138. package/runtime/lib/element-template/runtime/render/render-opcodes.js.map +1 -1
  139. package/runtime/lib/element-template/runtime/render/render-to-opcodes.js +41 -4
  140. package/runtime/lib/element-template/runtime/render/render-to-opcodes.js.map +1 -1
  141. package/runtime/lib/element-template/runtime/template/attr-slot-plan.d.ts +1 -0
  142. package/runtime/lib/element-template/runtime/template/attr-slot-plan.js +4 -0
  143. package/runtime/lib/element-template/runtime/template/attr-slot-plan.js.map +1 -1
  144. package/runtime/lib/element-template/runtime/template/handle.d.ts +3 -2
  145. package/runtime/lib/element-template/runtime/template/handle.js +5 -1
  146. package/runtime/lib/element-template/runtime/template/handle.js.map +1 -1
  147. package/runtime/lib/element-template/runtime/template/registry.d.ts +2 -0
  148. package/runtime/lib/element-template/runtime/template/registry.js +6 -1
  149. package/runtime/lib/element-template/runtime/template/registry.js.map +1 -1
  150. package/runtime/lib/element-template/runtime-backend-marker.js +6 -0
  151. package/runtime/lib/element-template/runtime-backend-marker.js.map +1 -0
  152. package/runtime/lib/index.d.ts +1 -1
  153. package/runtime/lib/index.js +3 -1
  154. package/runtime/lib/index.js.map +1 -1
  155. package/runtime/lib/internal.d.ts +5 -4
  156. package/runtime/lib/internal.js +6 -5
  157. package/runtime/lib/internal.js.map +1 -1
  158. package/runtime/lib/lynx-api.d.ts +3 -8
  159. package/runtime/lib/lynx-api.js +8 -45
  160. package/runtime/lib/lynx-api.js.map +1 -1
  161. package/runtime/lib/runtime-backend-marker.js +6 -0
  162. package/runtime/lib/runtime-backend-marker.js.map +1 -0
  163. package/runtime/lib/snapshot/debug/vnodeSource.js +1 -1
  164. package/runtime/lib/snapshot/debug/vnodeSource.js.map +1 -1
  165. package/runtime/lib/snapshot/lifecycle/patch/commit.d.ts +0 -1
  166. package/runtime/lib/snapshot/lifecycle/patch/commit.js +4 -9
  167. package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -1
  168. package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js +2 -2
  169. package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -1
  170. package/runtime/lib/snapshot/lifecycle/ref/delay.d.ts +6 -13
  171. package/runtime/lib/snapshot/lifecycle/ref/delay.js +9 -30
  172. package/runtime/lib/snapshot/lifecycle/ref/delay.js.map +1 -1
  173. package/runtime/lib/snapshot/lifecycle/reload.js +2 -2
  174. package/runtime/lib/snapshot/lifecycle/reload.js.map +1 -1
  175. package/runtime/lib/snapshot/list/list.js +1 -1
  176. package/runtime/lib/snapshot/list/list.js.map +1 -1
  177. package/runtime/lib/snapshot/list/listUpdateInfo.js +3 -2
  178. package/runtime/lib/snapshot/list/listUpdateInfo.js.map +1 -1
  179. package/runtime/lib/snapshot/lynx/calledByNative.js +3 -9
  180. package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -1
  181. package/runtime/lib/snapshot/lynx/env.js +5 -51
  182. package/runtime/lib/snapshot/lynx/env.js.map +1 -1
  183. package/runtime/lib/snapshot/lynx/performance.d.ts +0 -21
  184. package/runtime/lib/snapshot/lynx/performance.js +7 -121
  185. package/runtime/lib/snapshot/lynx/performance.js.map +1 -1
  186. package/runtime/lib/snapshot/lynx/runWithForce.js +9 -39
  187. package/runtime/lib/snapshot/lynx/runWithForce.js.map +1 -1
  188. package/runtime/lib/snapshot/lynx/tt.js +10 -30
  189. package/runtime/lib/snapshot/lynx/tt.js.map +1 -1
  190. package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +4 -4
  191. package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
  192. package/runtime/lib/snapshot/snapshot/list.js +1 -1
  193. package/runtime/lib/snapshot/snapshot/list.js.map +1 -1
  194. package/runtime/lib/snapshot/snapshot/ref.d.ts +3 -5
  195. package/runtime/lib/snapshot/snapshot/ref.js +16 -59
  196. package/runtime/lib/snapshot/snapshot/ref.js.map +1 -1
  197. package/runtime/lib/snapshot/snapshot/snapshot.js +1 -1
  198. package/runtime/lib/snapshot/snapshot/snapshot.js.map +1 -1
  199. package/runtime/lib/snapshot/snapshot/snapshotInstanceHydrationMap.js +1 -1
  200. package/runtime/lib/snapshot/snapshot/snapshotInstanceHydrationMap.js.map +1 -1
  201. package/runtime/lib/tsconfig.tsbuildinfo +1 -1
  202. package/runtime/lib/worklet-runtime/workletRuntime.js +1 -1
  203. package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
  204. package/runtime/worklet-runtime/dev.js +2 -3
  205. package/runtime/worklet-runtime/main.js +1 -1
  206. package/testing-library/dist/{rslib-runtime.js → 0~rslib-runtime.js} +14 -13
  207. package/testing-library/dist/env/index.js +2 -8
  208. package/testing-library/dist/env/vitest.js +1 -1
  209. package/testing-library/dist/plugins/index.js +13 -2
  210. package/testing-library/dist/pure.js +18 -18
  211. package/testing-library/dist/rstest-config.js +2 -4
  212. package/testing-library/dist/setupFiles/common/bootstrap.js +1 -0
  213. package/testing-library/dist/setupFiles/common/runtime-setup.js +1 -1
  214. package/testing-library/dist/setupFiles/inner/rstest.js +2 -1
  215. package/testing-library/dist/setupFiles/inner/vitest.js +2 -1
  216. package/testing-library/dist/type-entry/index.js +1 -0
  217. package/transform/dist/wasm.cjs +113 -40
  218. package/runtime/lib/element-template/hooks/react.d.ts +0 -14
  219. package/runtime/lib/element-template/hooks/react.js +0 -24
  220. package/runtime/lib/element-template/hooks/react.js.map +0 -1
  221. package/runtime/lib/element-template/runtime/components/slot.js +0 -11
  222. package/runtime/lib/element-template/runtime/components/slot.js.map +0 -1
  223. package/runtime/lib/snapshot/compat/initData.js.map +0 -1
  224. package/runtime/lib/snapshot/compat/lynxComponent.js.map +0 -1
  225. package/runtime/lib/snapshot/legacy-react-runtime/index.js.map +0 -1
  226. package/runtime/lib/snapshot/lifecycle/pass.d.ts +0 -3
  227. package/runtime/lib/snapshot/lifecycle/pass.js.map +0 -1
  228. package/runtime/lib/snapshot/lynx/component.js +0 -73
  229. package/runtime/lib/snapshot/lynx/component.js.map +0 -1
  230. package/runtime/lib/snapshot/lynx/dynamic-js.js.map +0 -1
  231. package/runtime/lib/snapshot/lynx/lazy-bundle.js.map +0 -1
  232. package/testing-library/dist/881.js +0 -1
  233. /package/runtime/lib/{snapshot/lynx/dynamic-js.d.ts → core/lynx/dynamic-import.d.ts} +0 -0
  234. /package/runtime/lib/{snapshot → core}/lynx/lazy-bundle.d.ts +0 -0
  235. /package/runtime/lib/{snapshot → core}/lynx/lazy-bundle.js +0 -0
  236. /package/runtime/lib/element-template/{runtime/components/slot.d.ts → runtime-backend-marker.d.ts} +0 -0
  237. /package/runtime/lib/{snapshot/lynx/component.d.ts → runtime-backend-marker.d.ts} +0 -0
  238. /package/testing-library/dist/{0~123.js → 0~@rstest/adapter-rsbuild.js} +0 -0
@@ -1,13 +1,13 @@
1
1
  import type { BackgroundElementTemplateInstance } from './instance.js';
2
2
  import type { ElementTemplateUpdateCommitContext } from '../protocol/types.js';
3
3
  interface ElementTemplateCommitNonPayloadState {
4
- removedSubtrees: BackgroundElementTemplateInstance[];
4
+ removedSubtreesAwaitingTeardown: BackgroundElementTemplateInstance[];
5
5
  }
6
6
  type ElementTemplateGlobalCommitContext = ElementTemplateUpdateCommitContext & {
7
7
  nonPayload: ElementTemplateCommitNonPayloadState;
8
8
  };
9
9
  export declare const globalCommitContext: ElementTemplateGlobalCommitContext;
10
10
  export declare function resetGlobalCommitContext(): void;
11
- export declare function markRemovedSubtreeForCurrentCommit(root: BackgroundElementTemplateInstance): void;
12
- export declare function takeRemovedSubtreesForCurrentCommit(): BackgroundElementTemplateInstance[];
11
+ export declare function markRemovedSubtreeForPostDispatchTeardown(root: BackgroundElementTemplateInstance): void;
12
+ export declare function takeRemovedSubtreesForPostDispatchTeardown(): BackgroundElementTemplateInstance[];
13
13
  export {};
@@ -1,25 +1,22 @@
1
- export const globalCommitContext = {
2
- ops: [],
3
- flushOptions: {},
4
- nonPayload: {
5
- removedSubtrees: [],
6
- },
1
+ import { globalCommitContext as coreGlobalCommitContext, resetGlobalCommitContext as resetCoreGlobalCommitContext, } from '../../core/commit-context.js';
2
+ const nonPayload = {
3
+ removedSubtreesAwaitingTeardown: [],
7
4
  };
5
+ export const globalCommitContext = coreGlobalCommitContext;
6
+ globalCommitContext.nonPayload = nonPayload;
8
7
  export function resetGlobalCommitContext() {
9
- globalCommitContext.ops = [];
10
- globalCommitContext.flushOptions = {};
11
- delete globalCommitContext.flowIds;
12
- globalCommitContext.nonPayload.removedSubtrees = [];
8
+ resetCoreGlobalCommitContext();
9
+ nonPayload.removedSubtreesAwaitingTeardown = [];
13
10
  }
14
- export function markRemovedSubtreeForCurrentCommit(root) {
15
- const { removedSubtrees } = globalCommitContext.nonPayload;
16
- if (!removedSubtrees.includes(root)) {
17
- removedSubtrees.push(root);
11
+ export function markRemovedSubtreeForPostDispatchTeardown(root) {
12
+ const { removedSubtreesAwaitingTeardown } = globalCommitContext.nonPayload;
13
+ if (!removedSubtreesAwaitingTeardown.includes(root)) {
14
+ removedSubtreesAwaitingTeardown.push(root);
18
15
  }
19
16
  }
20
- export function takeRemovedSubtreesForCurrentCommit() {
21
- const removedSubtrees = globalCommitContext.nonPayload.removedSubtrees;
22
- globalCommitContext.nonPayload.removedSubtrees = [];
23
- return removedSubtrees;
17
+ export function takeRemovedSubtreesForPostDispatchTeardown() {
18
+ const removedSubtreesAwaitingTeardown = globalCommitContext.nonPayload.removedSubtreesAwaitingTeardown;
19
+ globalCommitContext.nonPayload.removedSubtreesAwaitingTeardown = [];
20
+ return removedSubtreesAwaitingTeardown;
24
21
  }
25
22
  //# sourceMappingURL=commit-context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commit-context.js","sourceRoot":"","sources":["../../../src/element-template/background/commit-context.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,mBAAmB,GAAuC;IACrE,GAAG,EAAE,EAAE;IACP,YAAY,EAAE,EAAE;IAChB,UAAU,EAAE;QACV,eAAe,EAAE,EAAE;KACpB;CACF,CAAC;AAEF,MAAM,UAAU,wBAAwB;IACtC,mBAAmB,CAAC,GAAG,GAAG,EAAE,CAAC;IAC7B,mBAAmB,CAAC,YAAY,GAAG,EAAE,CAAC;IACtC,OAAO,mBAAmB,CAAC,OAAO,CAAC;IACnC,mBAAmB,CAAC,UAAU,CAAC,eAAe,GAAG,EAAE,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,kCAAkC,CAChD,IAAuC;IAEvC,MAAM,EAAE,eAAe,EAAE,GAAG,mBAAmB,CAAC,UAAU,CAAC;IAC3D,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,mCAAmC;IACjD,MAAM,eAAe,GAAG,mBAAmB,CAAC,UAAU,CAAC,eAAe,CAAC;IACvE,mBAAmB,CAAC,UAAU,CAAC,eAAe,GAAG,EAAE,CAAC;IACpD,OAAO,eAAe,CAAC;AACzB,CAAC"}
1
+ {"version":3,"file":"commit-context.js","sourceRoot":"","sources":["../../../src/element-template/background/commit-context.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,mBAAmB,IAAI,uBAAuB,EAC9C,wBAAwB,IAAI,4BAA4B,GACzD,MAAM,8BAA8B,CAAC;AActC,MAAM,UAAU,GAAyC;IACvD,+BAA+B,EAAE,EAAE;CACpC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAwE,CAAC;AAE5G,mBAAmB,CAAC,UAAU,GAAG,UAAU,CAAC;AAE5C,MAAM,UAAU,wBAAwB;IACtC,4BAA4B,EAAE,CAAC;IAC/B,UAAU,CAAC,+BAA+B,GAAG,EAAE,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,yCAAyC,CACvD,IAAuC;IAEvC,MAAM,EAAE,+BAA+B,EAAE,GAAG,mBAAmB,CAAC,UAAU,CAAC;IAC3E,IAAI,CAAC,+BAA+B,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACpD,+BAA+B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC;AAED,MAAM,UAAU,0CAA0C;IACxD,MAAM,+BAA+B,GAAG,mBAAmB,CAAC,UAAU,CAAC,+BAA+B,CAAC;IACvG,mBAAmB,CAAC,UAAU,CAAC,+BAA+B,GAAG,EAAE,CAAC;IACpE,OAAO,+BAA+B,CAAC;AACzC,CAAC"}
@@ -2,6 +2,6 @@ import type { BackgroundElementTemplateInstance } from './instance.js';
2
2
  export declare function markElementTemplateHydrated(): void;
3
3
  export declare function isElementTemplateHydrated(): boolean;
4
4
  export declare function resetElementTemplateCommitState(): void;
5
- export declare function scheduleElementTemplateRemovedSubtreeCleanup(removedSubtrees: BackgroundElementTemplateInstance[]): void;
5
+ export declare function scheduleElementTemplateRemovedSubtreeCleanup(removedSubtreesAwaitingTeardown: BackgroundElementTemplateInstance[]): void;
6
6
  export declare function cancelElementTemplateRemovedSubtreeCleanup(): void;
7
7
  export declare function installElementTemplateCommitHook(): void;
@@ -2,16 +2,18 @@
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 { options } from 'preact';
5
- import { globalCommitContext, resetGlobalCommitContext, takeRemovedSubtreesForCurrentCommit, } from './commit-context.js';
5
+ import { globalCommitContext, resetGlobalCommitContext, takeRemovedSubtreesForPostDispatchTeardown, } from './commit-context.js';
6
+ import { globalPipelineOptions, markTiming, markTimingLegacy, setPipeline } from '../../core/performance.js';
7
+ import { getReloadVersion } from '../../core/reload-version.js';
6
8
  import { COMMIT } from '../../shared/render-constants.js';
7
- import { hook } from '../../utils.js';
9
+ import { hook, isEmptyObject } from '../../utils.js';
8
10
  import { formatElementTemplateUpdateCommands } from '../debug/alog.js';
9
11
  import { profileEnd, profileStart } from '../debug/profile.js';
10
- import { globalPipelineOptions, markTiming, markTimingLegacy, setPipeline } from '../lynx/performance.js';
12
+ import { clearPendingRefs, flushPendingRefs, hasPendingRefs } from '../prop-adapters/ref.js';
11
13
  import { ElementTemplateLifecycleConstant } from '../protocol/lifecycle-constant.js';
12
14
  let installed = false;
13
15
  let hasHydrated = false;
14
- const scheduledRemovedSubtreeCleanupTimers = new Set();
16
+ const scheduledRemovedSubtreeCleanupTimers = /*#__PURE__*/ new Set();
15
17
  export function markElementTemplateHydrated() {
16
18
  hasHydrated = true;
17
19
  }
@@ -22,14 +24,14 @@ export function resetElementTemplateCommitState() {
22
24
  hasHydrated = false;
23
25
  resetGlobalCommitContext();
24
26
  }
25
- export function scheduleElementTemplateRemovedSubtreeCleanup(removedSubtrees) {
26
- if (removedSubtrees.length === 0) {
27
+ export function scheduleElementTemplateRemovedSubtreeCleanup(removedSubtreesAwaitingTeardown) {
28
+ if (removedSubtreesAwaitingTeardown.length === 0) {
27
29
  return;
28
30
  }
29
31
  const timer = setTimeout(() => {
30
32
  scheduledRemovedSubtreeCleanupTimers.delete(timer);
31
- for (const root of removedSubtrees) {
32
- root.tearDown();
33
+ for (const root of removedSubtreesAwaitingTeardown) {
34
+ root.releaseDetachedSubtreeFromManager();
33
35
  }
34
36
  }, 10000);
35
37
  scheduledRemovedSubtreeCleanupTimers.add(timer);
@@ -46,48 +48,71 @@ export function installElementTemplateCommitHook() {
46
48
  }
47
49
  installed = true;
48
50
  hook(options, COMMIT, (originalCommit, vnode, commitQueue) => {
49
- if (__BACKGROUND__ && hasHydrated && globalCommitContext.ops.length > 0) {
50
- markTimingLegacy('updateDiffVdomEnd');
51
- markTiming('diffVdomEnd');
52
- if (__PROFILE__) {
53
- profileStart('ReactLynx::commitChanges');
54
- }
55
- markTiming('packChangesStart');
56
- if (globalPipelineOptions) {
57
- globalCommitContext.flushOptions.pipelineOptions = globalPipelineOptions;
58
- }
59
- markTiming('packChangesEnd');
60
- if (globalPipelineOptions) {
61
- setPipeline(undefined);
62
- }
63
- if (__PROFILE__) {
64
- profileEnd();
65
- }
66
- if (typeof __ALOG__ !== 'undefined' && __ALOG__) {
67
- console.alog?.('[ReactLynxDebug] ElementTemplate BTS -> MTS update:\n'
68
- + JSON.stringify({
69
- ops: formatElementTemplateUpdateCommands(globalCommitContext.ops),
70
- flushOptions: globalCommitContext.flushOptions,
71
- flowIds: globalCommitContext.flowIds,
72
- }, null, 2));
73
- }
74
- const removedSubtrees = takeRemovedSubtreesForCurrentCommit();
51
+ if (__BACKGROUND__ && !hasHydrated && hasPendingRefs()) {
52
+ // User effects can run before ET hydrate arrives, so ordinary refs must be
53
+ // attached on the background commit even though native UI ops are delayed.
54
+ flushPendingRefs();
55
+ }
56
+ else if (__BACKGROUND__ && hasHydrated
57
+ && (globalCommitContext.ops.length > 0
58
+ || !isEmptyObject(globalCommitContext.flushOptions)
59
+ || hasPendingRefs())) {
60
+ const hasNativeOps = globalCommitContext.ops.length > 0;
61
+ const hasUpdatePayload = hasNativeOps || !isEmptyObject(globalCommitContext.flushOptions);
62
+ const removedSubtreesAwaitingTeardown = hasNativeOps ? takeRemovedSubtreesForPostDispatchTeardown() : [];
63
+ let didFlushRefs = false;
75
64
  try {
76
- lynx.getCoreContext().dispatchEvent({
77
- type: ElementTemplateLifecycleConstant.update,
78
- data: {
79
- ops: globalCommitContext.ops,
80
- flushOptions: globalCommitContext.flushOptions,
81
- flowIds: globalCommitContext.flowIds,
82
- },
83
- });
65
+ if (hasUpdatePayload) {
66
+ markTimingLegacy('updateDiffVdomEnd');
67
+ markTiming('diffVdomEnd');
68
+ if (__PROFILE__) {
69
+ profileStart('ReactLynx::commitChanges');
70
+ }
71
+ markTiming('packChangesStart');
72
+ if (globalPipelineOptions) {
73
+ globalCommitContext.flushOptions.pipelineOptions = globalPipelineOptions;
74
+ }
75
+ markTiming('packChangesEnd');
76
+ if (globalPipelineOptions) {
77
+ setPipeline(undefined);
78
+ }
79
+ if (__PROFILE__) {
80
+ profileEnd();
81
+ }
82
+ if (typeof __ALOG__ !== 'undefined' && __ALOG__) {
83
+ console.alog?.('[ReactLynxDebug] ElementTemplate BTS -> MTS update:\n'
84
+ + JSON.stringify({
85
+ ops: formatElementTemplateUpdateCommands(globalCommitContext.ops),
86
+ flushOptions: globalCommitContext.flushOptions,
87
+ flowIds: globalCommitContext.flowIds,
88
+ }, null, 2));
89
+ }
90
+ }
91
+ if (hasUpdatePayload) {
92
+ lynx.getCoreContext().dispatchEvent({
93
+ type: ElementTemplateLifecycleConstant.update,
94
+ data: {
95
+ ops: globalCommitContext.ops,
96
+ flushOptions: globalCommitContext.flushOptions,
97
+ flowIds: globalCommitContext.flowIds,
98
+ reloadVersion: getReloadVersion(),
99
+ },
100
+ });
101
+ }
102
+ // When native ops exist, patch first so a newly attached ref observes the
103
+ // committed native state. Ref-only commits still flush through this path.
104
+ flushPendingRefs();
105
+ didFlushRefs = true;
84
106
  }
85
107
  finally {
108
+ if (!didFlushRefs) {
109
+ clearPendingRefs();
110
+ }
86
111
  resetGlobalCommitContext();
87
112
  // Match Snapshot's cleanup boundary: start the delayed teardown only
88
113
  // after the bridge dispatch attempt, so background JS objects are not
89
114
  // torn down before main-thread detach observes the same commit.
90
- scheduleElementTemplateRemovedSubtreeCleanup(removedSubtrees);
115
+ scheduleElementTemplateRemovedSubtreeCleanup(removedSubtreesAwaitingTeardown);
91
116
  }
92
117
  }
93
118
  originalCommit?.(vnode, commitQueue);
@@ -1 +1 @@
1
- {"version":3,"file":"commit-hook.js","sourceR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AE,mCAAmC,CAAC,mBAAmB,CAAC,GAAG,CAAC;wBACjE,YAAY,EAAE,mBAAmB,CAAC,YAAY;wBAC9C,OAAO,EAAE,mBAAmB,CAAC,OAAO;qBACrC,EACD,IAAI,EACJ,CAAC,CACF,CACJ,CAAC;YACJ,CAAC;YAED,MAAM,eAAe,GAAG,mCAAmC,EAAE,CAAC;YAC9D,IAAI,CAAC;gBACH,IAAI,CAAC,cAAc,EAAE,CAAC,aAAa,CAAC;oBAClC,IAAI,EAAE,gCAAgC,CAAC,MAAM;oBAC7C,IAAI,EAAE;wBACJ,GAAG,EAAE,mBAAmB,CAAC,GAAG;wBAC5B,YAAY,EAAE,mBAAmB,CAAC,YAAY;wBAC9C,OAAO,EAAE,mBAAmB,CAAC,OAAO;qBACrC;iBACF,CAAC,CAAC;YACL,CAAC;oBAAS,CAAC;gBACT,wBAAwB,EAAE,CAAC;gBAC3B,qEAAqE;gBACrE,sEAAsE;gBACtE,gEAAgE;gBAChE,4CAA4C,CAAC,eAAe,CAAC,CAAC;YAChE,CAAC;QACH,CAAC;QAED,cAAc,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"commit-hook.js","sourceRoot":"","sources":["../../../src/element-template/background/commit-hook.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,0CAA0C,GAC3C,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7G,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,IAAI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C,CAAC;AACL,CAAC"}
@@ -1,17 +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.
1
+ import { render } from 'preact';
4
2
  import { cancelElementTemplateRemovedSubtreeCleanup, resetElementTemplateCommitState } from './commit-hook.js';
5
3
  import { resetElementTemplateHydrationListener } from './hydration-listener.js';
6
4
  import { backgroundElementTemplateInstanceManager } from './manager.js';
7
5
  import { clearEventState } from '../prop-adapters/event.js';
6
+ import { clearRefState, flushPendingRefs } from '../prop-adapters/ref.js';
7
+ import { __root } from '../runtime/page/root-instance.js';
8
8
  export function destroyElementTemplateBackgroundRuntime() {
9
9
  resetElementTemplateHydrationListener();
10
- resetElementTemplateCommitState();
11
- // Destroy is the only place that may discard delayed removed subtrees instead
12
- // of letting the Snapshot-aligned timer tear them down later.
13
10
  cancelElementTemplateRemovedSubtreeCleanup();
11
+ render(null, __root);
12
+ // Run user cleanup before dropping the backend side tables; after clearRefState
13
+ // the raw ref ownership needed to detach callbacks is gone.
14
+ flushPendingRefs();
15
+ resetElementTemplateCommitState();
14
16
  clearEventState();
17
+ clearRefState();
15
18
  backgroundElementTemplateInstanceManager.clear();
16
19
  }
17
20
  //# sourceMappingURL=destroy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"destroy.js","sourceRoot":"","sources":["../../../src/element-template/background/destroy.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,0CAA0C,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAC;AAC/G,OAAO,EAAE,qCAAqC,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,wCAAwC,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,UAAU,uCAAuC;IACrD,qCAAqC,EAAE,CAAC;IACxC,+BAA+B,EAAE,CAAC;IAClC,8EAA8E;IAC9E,8DAA8D;IAC9D,0CAA0C,EAAE,CAAC;IAC7C,eAAe,EAAE,CAAC;IAClB,wCAAwC,CAAC,KAAK,EAAE,CAAC;AACnD,CAAC"}
1
+ {"version":3,"file":"destroy.js","sourceRoot":"","sources":["../../../src/element-template/background/destroy.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,0CAA0C,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAC;AAC/G,OAAO,EAAE,qCAAqC,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,wCAAwC,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAE1D,MAAM,UAAU,uCAAuC;IACrD,qCAAqC,EAAE,CAAC;IACxC,0CAA0C,EAAE,CAAC;IAE7C,MAAM,CAAC,IAAI,EAAE,MAAkC,CAAC,CAAC;IACjD,gFAAgF;IAChF,4DAA4D;IAC5D,gBAAgB,EAAE,CAAC;IAEnB,+BAA+B,EAAE,CAAC;IAClC,eAAe,EAAE,CAAC;IAClB,aAAa,EAAE,CAAC;IAChB,wCAAwC,CAAC,KAAK,EAAE,CAAC;AACnD,CAAC"}
@@ -2,18 +2,18 @@
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 { options } from 'preact';
5
- import { BUILTIN_RAW_TEXT_TEMPLATE_KEY, BackgroundElementTemplateInstance, BackgroundElementTemplateSlot, } from './instance.js';
5
+ import { BUILTIN_RAW_TEXT_TEMPLATE_KEY, BackgroundElementTemplateInstance, BackgroundListElementTemplateInstance, } from './instance.js';
6
6
  export function setupBackgroundElementTemplateDocument() {
7
7
  const doc = {
8
8
  createElement(type) {
9
- if (type === 'slot') {
10
- return new BackgroundElementTemplateSlot();
9
+ if (type === 'list') {
10
+ return new BackgroundListElementTemplateInstance();
11
11
  }
12
12
  return new BackgroundElementTemplateInstance(type);
13
13
  },
14
14
  createElementNS(_ns, type) {
15
- if (type === 'slot') {
16
- return new BackgroundElementTemplateSlot();
15
+ if (type === 'list') {
16
+ return new BackgroundListElementTemplateInstance();
17
17
  }
18
18
  return new BackgroundElementTemplateInstance(type);
19
19
  },
@@ -1 +1 @@
1
- {"version":3,"file":"document.js","sourceRoot":"","sources":["../../../src/element-template/background/document.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,EACL,6BAA6B,EAC7B,iCAAiC,EACjC,6BAA6B,GAC9B,MAAM,eAAe,CAAC;AAQvB,MAAM,UAAU,sCAAsC;IACpD,MAAM,GAAG,GAAG;QACV,aAAa,CAAC,IAAY;YACxB,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;gBACpB,OAAO,IAAI,6BAA6B,EAAE,CAAC;YAC7C,CAAC;YACD,OAAO,IAAI,iCAAiC,CAAC,IAAI,CAAC,CAAC;QACrD,CAAC;QACD,eAAe,CAAC,GAAW,EAAE,IAAY;YACvC,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;gBACpB,OAAO,IAAI,6BAA6B,EAAE,CAAC;YAC7C,CAAC;YACD,OAAO,IAAI,iCAAiC,CAAC,IAAI,CAAC,CAAC;QACrD,CAAC;QACD,cAAc,CAAC,IAAY;YACzB,OAAO,IAAI,iCAAiC,CAAC,6BAA6B,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QACtF,CAAC;KACF,CAAC;IAEF,OAAO,CAAC,QAAQ,GAAG,GAA0B,CAAC;IAE9C,OAAO,GAAG,CAAC;AACb,CAAC"}
1
+ {"version":3,"file":"document.js","sourceRoot":"","sources":["../../../src/element-template/background/document.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,EACL,6BAA6B,EAC7B,iCAAiC,EACjC,qCAAqC,GACtC,MAAM,eAAe,CAAC;AAQvB,MAAM,UAAU,sCAAsC;IACpD,MAAM,GAAG,GAAG;QACV,aAAa,CAAC,IAAY;YACxB,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;gBACpB,OAAO,IAAI,qCAAqC,EAAE,CAAC;YACrD,CAAC;YACD,OAAO,IAAI,iCAAiC,CAAC,IAAI,CAAC,CAAC;QACrD,CAAC;QACD,eAAe,CAAC,GAAW,EAAE,IAAY;YACvC,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;gBACpB,OAAO,IAAI,qCAAqC,EAAE,CAAC;YACrD,CAAC;YACD,OAAO,IAAI,iCAAiC,CAAC,IAAI,CAAC,CAAC;QACrD,CAAC;QACD,cAAc,CAAC,IAAY;YACzB,OAAO,IAAI,iCAAiC,CAAC,6BAA6B,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QACtF,CAAC;KACF,CAAC;IAEF,OAAO,CAAC,QAAQ,GAAG,GAA0B,CAAC;IAE9C,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,4 +1,3 @@
1
1
  import type { BackgroundElementTemplateInstance } from './instance.js';
2
- import type { ElementTemplateUpdateCommandStream, SerializedElementTemplate } from '../protocol/types.js';
3
- export declare function hydrate(serialized: SerializedElementTemplate, instance: BackgroundElementTemplateInstance): ElementTemplateUpdateCommandStream;
4
- export declare function hydrateIntoContext(serialized: SerializedElementTemplate, instance: BackgroundElementTemplateInstance): void;
2
+ import type { SerializedEtNode } from '../protocol/types.js';
3
+ export declare function hydrateRootChildrenIntoContext(serializedChildren: SerializedEtNode[], root: BackgroundElementTemplateInstance): boolean;