@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.
Files changed (240) hide show
  1. package/CHANGELOG.md +44 -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/background-function/exec-map.d.ts +11 -0
  7. package/runtime/lib/core/background-function/exec-map.js +39 -0
  8. package/runtime/lib/core/background-function/exec-map.js.map +1 -0
  9. package/runtime/lib/core/background-function/handle.d.ts +8 -0
  10. package/runtime/lib/core/background-function/handle.js +25 -0
  11. package/runtime/lib/core/background-function/handle.js.map +1 -0
  12. package/runtime/lib/core/background-function/run-on-background.d.ts +8 -0
  13. package/runtime/lib/{snapshot/worklet/call/runOnBackground.js → core/background-function/run-on-background.js} +39 -33
  14. package/runtime/lib/core/background-function/run-on-background.js.map +1 -0
  15. package/runtime/lib/{snapshot/legacy-react-runtime/index.d.ts → core/compat/legacy-react-runtime.d.ts} +4 -4
  16. package/runtime/lib/{snapshot/legacy-react-runtime/index.js → core/compat/legacy-react-runtime.js} +6 -6
  17. package/runtime/lib/core/compat/legacy-react-runtime.js.map +1 -0
  18. package/runtime/lib/{snapshot → core}/compat/lynxComponent.d.ts +2 -1
  19. package/runtime/lib/{snapshot → core}/compat/lynxComponent.js +11 -5
  20. package/runtime/lib/core/compat/lynxComponent.js.map +1 -0
  21. package/runtime/lib/core/component.d.ts +2 -0
  22. package/runtime/lib/{snapshot/lynx → core}/component.js +37 -31
  23. package/runtime/lib/core/component.js.map +1 -0
  24. package/runtime/lib/core/initData.js +35 -0
  25. package/runtime/lib/core/initData.js.map +1 -1
  26. package/runtime/lib/{snapshot/lynx/dynamic-js.js → core/lynx/dynamic-import.js} +1 -1
  27. package/runtime/lib/core/lynx/dynamic-import.js.map +1 -0
  28. package/runtime/lib/core/lynx/lazy-bundle.js.map +1 -0
  29. package/runtime/lib/core/lynx/runtime-backend.d.ts +5 -0
  30. package/runtime/lib/core/lynx/runtime-backend.js +20 -0
  31. package/runtime/lib/core/lynx/runtime-backend.js.map +1 -0
  32. package/runtime/lib/core/lynx-page-data.js +6 -0
  33. package/runtime/lib/core/lynx-page-data.js.map +1 -1
  34. package/runtime/lib/core/lynx-update-data.js +6 -0
  35. package/runtime/lib/core/lynx-update-data.js.map +1 -1
  36. package/runtime/lib/core/performance.d.ts +30 -0
  37. package/runtime/lib/core/performance.js +145 -0
  38. package/runtime/lib/core/performance.js.map +1 -0
  39. package/runtime/lib/core/runtime-destroy.d.ts +4 -0
  40. package/runtime/lib/core/runtime-destroy.js +18 -0
  41. package/runtime/lib/core/runtime-destroy.js.map +1 -0
  42. package/runtime/lib/core/thread-function-call/main-thread.d.ts +5 -0
  43. package/runtime/lib/core/thread-function-call/main-thread.js +69 -0
  44. package/runtime/lib/core/thread-function-call/main-thread.js.map +1 -0
  45. package/runtime/lib/core/thread-function-call/return-value.d.ts +2 -0
  46. package/runtime/lib/core/thread-function-call/return-value.js +67 -0
  47. package/runtime/lib/core/thread-function-call/return-value.js.map +1 -0
  48. package/runtime/lib/element-template/background/attr-slots.d.ts +1 -1
  49. package/runtime/lib/element-template/background/attr-slots.js +8 -7
  50. package/runtime/lib/element-template/background/attr-slots.js.map +1 -1
  51. package/runtime/lib/element-template/background/commit-hook.js +81 -61
  52. package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
  53. package/runtime/lib/element-template/background/destroy.js +4 -0
  54. package/runtime/lib/element-template/background/destroy.js.map +1 -1
  55. package/runtime/lib/element-template/background/document.js +7 -1
  56. package/runtime/lib/element-template/background/document.js.map +1 -1
  57. package/runtime/lib/element-template/background/hydrate.d.ts +2 -3
  58. package/runtime/lib/element-template/background/hydrate.js +237 -58
  59. package/runtime/lib/element-template/background/hydrate.js.map +1 -1
  60. package/runtime/lib/element-template/background/hydration-listener.js +38 -38
  61. package/runtime/lib/element-template/background/hydration-listener.js.map +1 -1
  62. package/runtime/lib/element-template/background/instance.d.ts +31 -4
  63. package/runtime/lib/element-template/background/instance.js +219 -31
  64. package/runtime/lib/element-template/background/instance.js.map +1 -1
  65. package/runtime/lib/element-template/background/render-scope.d.ts +4 -0
  66. package/runtime/lib/element-template/background/render-scope.js +43 -0
  67. package/runtime/lib/element-template/background/render-scope.js.map +1 -0
  68. package/runtime/lib/element-template/debug/alog.d.ts +14 -0
  69. package/runtime/lib/element-template/debug/alog.js +23 -0
  70. package/runtime/lib/element-template/debug/alog.js.map +1 -1
  71. package/runtime/lib/element-template/debug/elementPAPICall.js +1 -0
  72. package/runtime/lib/element-template/debug/elementPAPICall.js.map +1 -1
  73. package/runtime/lib/element-template/index.d.ts +5 -2
  74. package/runtime/lib/element-template/index.js +8 -7
  75. package/runtime/lib/element-template/index.js.map +1 -1
  76. package/runtime/lib/element-template/internal.d.ts +7 -0
  77. package/runtime/lib/element-template/internal.js +9 -9
  78. package/runtime/lib/element-template/internal.js.map +1 -1
  79. package/runtime/lib/element-template/lynx/env.js +2 -0
  80. package/runtime/lib/element-template/lynx/env.js.map +1 -1
  81. package/runtime/lib/element-template/lynx/performance.d.ts +0 -21
  82. package/runtime/lib/element-template/lynx/performance.js +4 -121
  83. package/runtime/lib/element-template/lynx/performance.js.map +1 -1
  84. package/runtime/lib/element-template/native/index.js +3 -1
  85. package/runtime/lib/element-template/native/index.js.map +1 -1
  86. package/runtime/lib/element-template/native/main-thread-api.js +1 -1
  87. package/runtime/lib/element-template/native/main-thread-api.js.map +1 -1
  88. package/runtime/lib/element-template/native/mts-destroy.js +6 -0
  89. package/runtime/lib/element-template/native/mts-destroy.js.map +1 -1
  90. package/runtime/lib/element-template/native/patch-listener.js +42 -17
  91. package/runtime/lib/element-template/native/patch-listener.js.map +1 -1
  92. package/runtime/lib/element-template/native/reload-background.d.ts +1 -0
  93. package/runtime/lib/element-template/native/{reload.js → reload-background.js} +1 -26
  94. package/runtime/lib/element-template/native/reload-background.js.map +1 -0
  95. package/runtime/lib/element-template/native/{reload.d.ts → reload-main-thread.d.ts} +0 -1
  96. package/runtime/lib/element-template/native/reload-main-thread.js +39 -0
  97. package/runtime/lib/element-template/native/reload-main-thread.js.map +1 -0
  98. package/runtime/lib/element-template/prop-adapters/spread.d.ts +1 -4
  99. package/runtime/lib/element-template/prop-adapters/spread.js +1 -1
  100. package/runtime/lib/element-template/prop-adapters/spread.js.map +1 -1
  101. package/runtime/lib/element-template/protocol/opcodes.d.ts +3 -0
  102. package/runtime/lib/element-template/protocol/opcodes.js +3 -0
  103. package/runtime/lib/element-template/protocol/opcodes.js.map +1 -1
  104. package/runtime/lib/element-template/protocol/template-type.d.ts +25 -0
  105. package/runtime/lib/element-template/protocol/template-type.js +42 -0
  106. package/runtime/lib/element-template/protocol/template-type.js.map +1 -0
  107. package/runtime/lib/element-template/protocol/types.d.ts +38 -15
  108. package/runtime/lib/element-template/protocol/types.js.map +1 -1
  109. package/runtime/lib/element-template/protocol/update-event.d.ts +15 -0
  110. package/runtime/lib/element-template/protocol/update-event.js +24 -0
  111. package/runtime/lib/element-template/protocol/update-event.js.map +1 -0
  112. package/runtime/lib/element-template/runtime/list/list.d.ts +65 -0
  113. package/runtime/lib/element-template/runtime/list/list.js +587 -0
  114. package/runtime/lib/element-template/runtime/list/list.js.map +1 -0
  115. package/runtime/lib/element-template/runtime/patch.d.ts +1 -1
  116. package/runtime/lib/element-template/runtime/patch.js +198 -75
  117. package/runtime/lib/element-template/runtime/patch.js.map +1 -1
  118. package/runtime/lib/element-template/runtime/render/render-main-thread.js +13 -0
  119. package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
  120. package/runtime/lib/element-template/runtime/render/render-opcodes.js +83 -43
  121. package/runtime/lib/element-template/runtime/render/render-opcodes.js.map +1 -1
  122. package/runtime/lib/element-template/runtime/render/render-to-opcodes.js +32 -1
  123. package/runtime/lib/element-template/runtime/render/render-to-opcodes.js.map +1 -1
  124. package/runtime/lib/element-template/runtime/template/attr-slot-plan.d.ts +7 -5
  125. package/runtime/lib/element-template/runtime/template/attr-slot-plan.js +17 -4
  126. package/runtime/lib/element-template/runtime/template/attr-slot-plan.js.map +1 -1
  127. package/runtime/lib/element-template/runtime/template/handle.d.ts +3 -2
  128. package/runtime/lib/element-template/runtime/template/handle.js +11 -0
  129. package/runtime/lib/element-template/runtime/template/handle.js.map +1 -1
  130. package/runtime/lib/element-template/runtime/template/main-thread-background-function.d.ts +10 -0
  131. package/runtime/lib/element-template/runtime/template/main-thread-background-function.js +30 -0
  132. package/runtime/lib/element-template/runtime/template/main-thread-background-function.js.map +1 -0
  133. package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.d.ts +15 -0
  134. package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js +91 -0
  135. package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js.map +1 -0
  136. package/runtime/lib/element-template/runtime/template/main-thread-event-ctx.d.ts +15 -0
  137. package/runtime/lib/element-template/runtime/template/main-thread-event-ctx.js +29 -0
  138. package/runtime/lib/element-template/runtime/template/main-thread-event-ctx.js.map +1 -0
  139. package/runtime/lib/element-template/runtime/template/main-thread-function.d.ts +6 -0
  140. package/runtime/lib/element-template/runtime/template/main-thread-function.js +24 -0
  141. package/runtime/lib/element-template/runtime/template/main-thread-function.js.map +1 -0
  142. package/runtime/lib/element-template/runtime/template/registry.d.ts +2 -0
  143. package/runtime/lib/element-template/runtime/template/registry.js +5 -0
  144. package/runtime/lib/element-template/runtime/template/registry.js.map +1 -1
  145. package/runtime/lib/element-template/runtime-backend-marker.js +6 -0
  146. package/runtime/lib/element-template/runtime-backend-marker.js.map +1 -0
  147. package/runtime/lib/index.d.ts +4 -2
  148. package/runtime/lib/index.js +5 -2
  149. package/runtime/lib/index.js.map +1 -1
  150. package/runtime/lib/internal.d.ts +5 -4
  151. package/runtime/lib/internal.js +6 -5
  152. package/runtime/lib/internal.js.map +1 -1
  153. package/runtime/lib/lynx-api.d.ts +1 -1
  154. package/runtime/lib/lynx-api.js +1 -1
  155. package/runtime/lib/lynx-api.js.map +1 -1
  156. package/runtime/lib/runtime-backend-marker.js +6 -0
  157. package/runtime/lib/runtime-backend-marker.js.map +1 -0
  158. package/runtime/lib/{snapshot/worklet/indexMap.d.ts → shared/index-map.d.ts} +2 -2
  159. package/runtime/lib/{snapshot/worklet/indexMap.js → shared/index-map.js} +5 -3
  160. package/runtime/lib/shared/index-map.js.map +1 -0
  161. package/runtime/lib/snapshot/lifecycle/patch/commit.js +2 -2
  162. package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -1
  163. package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js +1 -1
  164. package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -1
  165. package/runtime/lib/snapshot/lynx/calledByNative.js +1 -1
  166. package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -1
  167. package/runtime/lib/snapshot/lynx/children.d.ts +13 -0
  168. package/runtime/lib/snapshot/lynx/children.js +19 -0
  169. package/runtime/lib/snapshot/lynx/children.js.map +1 -0
  170. package/runtime/lib/snapshot/lynx/performance.d.ts +0 -21
  171. package/runtime/lib/snapshot/lynx/performance.js +7 -121
  172. package/runtime/lib/snapshot/lynx/performance.js.map +1 -1
  173. package/runtime/lib/snapshot/lynx/tt.js +2 -2
  174. package/runtime/lib/snapshot/lynx/tt.js.map +1 -1
  175. package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +1 -1
  176. package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
  177. package/runtime/lib/snapshot/snapshot/snapshot.js +1 -1
  178. package/runtime/lib/snapshot/snapshot/snapshot.js.map +1 -1
  179. package/runtime/lib/snapshot/worklet/call/runOnMainThread.js +10 -31
  180. package/runtime/lib/snapshot/worklet/call/runOnMainThread.js.map +1 -1
  181. package/runtime/lib/snapshot/worklet/ctx.js +2 -2
  182. package/runtime/lib/snapshot/worklet/ctx.js.map +1 -1
  183. package/runtime/lib/snapshot/worklet/destroy.d.ts +0 -1
  184. package/runtime/lib/snapshot/worklet/destroy.js +2 -5
  185. package/runtime/lib/snapshot/worklet/destroy.js.map +1 -1
  186. package/runtime/lib/tsconfig.tsbuildinfo +1 -1
  187. package/runtime/lib/worklet-runtime/bindings/observers.d.ts +7 -0
  188. package/runtime/lib/worklet-runtime/bindings/observers.js +14 -1
  189. package/runtime/lib/worklet-runtime/bindings/observers.js.map +1 -1
  190. package/runtime/lib/worklet-runtime/delayRunOnBackground.d.ts +2 -1
  191. package/runtime/lib/worklet-runtime/delayRunOnBackground.js +6 -2
  192. package/runtime/lib/worklet-runtime/delayRunOnBackground.js.map +1 -1
  193. package/runtime/lib/worklet-runtime/hydrate.js +3 -0
  194. package/runtime/lib/worklet-runtime/hydrate.js.map +1 -1
  195. package/runtime/lib/worklet-runtime/jsFunctionLifecycle.d.ts +1 -1
  196. package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js +1 -1
  197. package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js.map +1 -1
  198. package/runtime/lib/worklet-runtime/workletRuntime.js +17 -2
  199. package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
  200. package/runtime/worklet-runtime/dev.js +26 -9
  201. package/runtime/worklet-runtime/main.js +1 -1
  202. package/testing-library/dist/{rslib-runtime.js → 0~rslib-runtime.js} +14 -13
  203. package/testing-library/dist/env/vitest.js +1 -1
  204. package/testing-library/dist/plugins/index.js +1 -1
  205. package/testing-library/dist/pure.js +18 -18
  206. package/testing-library/dist/rstest-config.js +2 -4
  207. package/testing-library/dist/setupFiles/common/bootstrap.js +1 -0
  208. package/testing-library/dist/setupFiles/common/runtime-setup.js +1 -1
  209. package/testing-library/dist/setupFiles/inner/rstest.js +2 -1
  210. package/testing-library/dist/setupFiles/inner/vitest.js +2 -1
  211. package/testing-library/dist/type-entry/index.js +1 -0
  212. package/transform/dist/wasm.cjs +113 -40
  213. package/types/react.docs.d.ts +14 -0
  214. package/runtime/lib/element-template/native/reload.js.map +0 -1
  215. package/runtime/lib/snapshot/compat/lynxComponent.js.map +0 -1
  216. package/runtime/lib/snapshot/legacy-react-runtime/index.js.map +0 -1
  217. package/runtime/lib/snapshot/lynx/component.js.map +0 -1
  218. package/runtime/lib/snapshot/lynx/dynamic-js.js.map +0 -1
  219. package/runtime/lib/snapshot/lynx/lazy-bundle.js.map +0 -1
  220. package/runtime/lib/snapshot/worklet/call/delayedRunOnMainThreadData.d.ts +0 -3
  221. package/runtime/lib/snapshot/worklet/call/delayedRunOnMainThreadData.js +0 -10
  222. package/runtime/lib/snapshot/worklet/call/delayedRunOnMainThreadData.js.map +0 -1
  223. package/runtime/lib/snapshot/worklet/call/execMap.js +0 -43
  224. package/runtime/lib/snapshot/worklet/call/execMap.js.map +0 -1
  225. package/runtime/lib/snapshot/worklet/call/functionCall.d.ts +0 -1
  226. package/runtime/lib/snapshot/worklet/call/functionCall.js +0 -33
  227. package/runtime/lib/snapshot/worklet/call/functionCall.js.map +0 -1
  228. package/runtime/lib/snapshot/worklet/call/runOnBackground.d.ts +0 -20
  229. package/runtime/lib/snapshot/worklet/call/runOnBackground.js.map +0 -1
  230. package/runtime/lib/snapshot/worklet/call/transformToWorklet.d.ts +0 -1
  231. package/runtime/lib/snapshot/worklet/call/transformToWorklet.js +0 -22
  232. package/runtime/lib/snapshot/worklet/call/transformToWorklet.js.map +0 -1
  233. package/runtime/lib/snapshot/worklet/indexMap.js.map +0 -1
  234. package/testing-library/dist/881.js +0 -1
  235. /package/runtime/lib/{snapshot/lynx/dynamic-js.d.ts → core/lynx/dynamic-import.d.ts} +0 -0
  236. /package/runtime/lib/{snapshot → core}/lynx/lazy-bundle.d.ts +0 -0
  237. /package/runtime/lib/{snapshot → core}/lynx/lazy-bundle.js +0 -0
  238. /package/runtime/lib/{snapshot/lynx/component.d.ts → element-template/runtime-backend-marker.d.ts} +0 -0
  239. /package/runtime/lib/{snapshot/worklet/call/execMap.d.ts → runtime-backend-marker.d.ts} +0 -0
  240. /package/testing-library/dist/{0~123.js → 0~@rstest/adapter-rsbuild.js} +0 -0
@@ -0,0 +1,67 @@
1
+ // Copyright 2025 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 { IndexMap } from '../../shared/index-map.js';
5
+ import { WorkletEvents } from '../../worklet-runtime/bindings/events.js';
6
+ import { registerDestroyTask } from '../runtime-destroy.js';
7
+ let resolveMap;
8
+ let cleanupReturnValueListener;
9
+ let unregisterReturnValueCleanup;
10
+ function initReturnValueListener() {
11
+ const context = __JS__ ? lynx.getCoreContext() : lynx.getJSContext();
12
+ resolveMap = new IndexMap();
13
+ context.addEventListener(WorkletEvents.FunctionCallRet, onFunctionCallRet);
14
+ cleanupReturnValueListener = () => {
15
+ context.removeEventListener(WorkletEvents.FunctionCallRet, onFunctionCallRet);
16
+ resolveMap = undefined;
17
+ cleanupReturnValueListener = undefined;
18
+ };
19
+ }
20
+ /**
21
+ * @internal
22
+ */
23
+ export function onFunctionCall(resolve) {
24
+ ensureFunctionCallReturnCleanup();
25
+ if (!resolveMap) {
26
+ initReturnValueListener();
27
+ }
28
+ return resolveMap.add(resolve);
29
+ }
30
+ function ensureFunctionCallReturnCleanup() {
31
+ if (unregisterReturnValueCleanup) {
32
+ return;
33
+ }
34
+ unregisterReturnValueCleanup = registerDestroyTask(() => {
35
+ resetFunctionCallReturnListener();
36
+ });
37
+ }
38
+ export function resetFunctionCallReturnListener() {
39
+ cleanupReturnValueListener?.();
40
+ unregisterReturnValueCleanup?.();
41
+ unregisterReturnValueCleanup = undefined;
42
+ }
43
+ export function dropFunctionCallReturnIds(resolveIds) {
44
+ if (!resolveMap) {
45
+ return;
46
+ }
47
+ for (const resolveId of resolveIds) {
48
+ resolveMap.remove(resolveId);
49
+ }
50
+ if (resolveMap.size === 0) {
51
+ resetFunctionCallReturnListener();
52
+ }
53
+ }
54
+ function onFunctionCallRet(event) {
55
+ const data = JSON.parse(event.data);
56
+ const map = resolveMap;
57
+ if (!map) {
58
+ return;
59
+ }
60
+ const resolve = map.get(data.resolveId);
61
+ if (!resolve) {
62
+ return;
63
+ }
64
+ map.remove(data.resolveId);
65
+ resolve(data.returnValue);
66
+ }
67
+ //# sourceMappingURL=return-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"return-value.js","sourceRoot":"","sources":["../../../src/core/thread-function-call/return-value.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAEzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,IAAI,UAAsD,CAAC;AAC3D,IAAI,0BAAoD,CAAC;AACzD,IAAI,4BAAsD,CAAC;AAE3D,SAAS,uBAAuB;IAC9B,MAAM,OAAO,GAAiB,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;IAEnF,UAAU,GAAG,IAAI,QAAQ,EAAE,CAAC;IAC5B,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;IAE3E,0BAA0B,GAAG,GAAG,EAAE;QAChC,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;QAC9E,UAAU,GAAG,SAAS,CAAC;QACvB,0BAA0B,GAAG,SAAS,CAAC;IACzC,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAA6B;IAC1D,+BAA+B,EAAE,CAAC;IAClC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,uBAAuB,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,UAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,+BAA+B;IACtC,IAAI,4BAA4B,EAAE,CAAC;QACjC,OAAO;IACT,CAAC;IACD,4BAA4B,GAAG,mBAAmB,CAAC,GAAG,EAAE;QACtD,+BAA+B,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,+BAA+B;IAC7C,0BAA0B,EAAE,EAAE,CAAC;IAC/B,4BAA4B,EAAE,EAAE,CAAC;IACjC,4BAA4B,GAAG,SAAS,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,UAA6B;IACrE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO;IACT,CAAC;IACD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;IACD,IAAI,UAAU,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QAC1B,+BAA+B,EAAE,CAAC;IACpC,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAyB;IAClD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAc,CAAyB,CAAC;IACtE,MAAM,GAAG,GAAG,UAAU,CAAC;IACvB,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO;IACT,CAAC;IACD,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;IACT,CAAC;IACD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3B,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAC5B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { SerializableValue } from '../protocol/types.js';
2
2
  export interface PrepareAttributeSlotsOptions {
3
+ previousPreparedSlots?: readonly unknown[];
3
4
  previousRawSlots?: readonly unknown[];
4
- queueRefEffects?: boolean;
5
5
  }
6
6
  export declare function prepareAttributeSlots(templateKey: string, handleId: number, rawSlots: readonly unknown[], options?: PrepareAttributeSlotsOptions): SerializableValue[];
7
7
  export declare function queueRefAttributeSlotUpdates(templateKey: string, handleId: number, previousRawSlots?: readonly unknown[], nextRawSlots?: readonly unknown[]): void;
@@ -42,18 +42,19 @@ export function prepareAttributeSlots(templateKey, handleId, rawSlots, options)
42
42
  const preparedSlots = normalizedSlots === rawSlots
43
43
  ? rawSlots.slice()
44
44
  : normalizedSlots;
45
- const shouldQueueRefEffects = options?.queueRefEffects === true;
45
+ const previousPreparedSlots = options?.previousPreparedSlots;
46
46
  const previousRawSlots = options?.previousRawSlots;
47
+ const adapterContext = previousPreparedSlots && previousRawSlots
48
+ ? {
49
+ previousPreparedSlots,
50
+ previousRawSlots,
51
+ }
52
+ : undefined;
47
53
  for (let planIndex = 0; planIndex < attrPlan.length; planIndex += 2) {
48
54
  const attrSlotIndex = attrPlan[planIndex];
49
55
  const adapter = attrPlan[planIndex + 1];
50
56
  const rawValue = rawSlots[attrSlotIndex];
51
- preparedSlots[attrSlotIndex] = adapter(handleId, attrSlotIndex, rawValue);
52
- }
53
- if (shouldQueueRefEffects) {
54
- // Ref effects compare raw user refs, not prepared marker strings or the
55
- // spread wrapper object.
56
- queuePlannedRefAttributeSlotUpdates(handleId, attrPlan, previousRawSlots, rawSlots);
57
+ preparedSlots[attrSlotIndex] = adapter(handleId, attrSlotIndex, rawValue, adapterContext);
57
58
  }
58
59
  return preparedSlots;
59
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"attr-slots.js","sourceRoot":"","sources":["../../../src/element-template/background/attr-slots.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAEpF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EA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AC,CAAC,QAAQ,CAAC,KAAK,EAAyB;QACzC,CAAC,CAAC,eAAe,CAAC;IACpB,MAAM,qBAAqB,GAAG,OAAO,EAAE,qBAAqB,CAAC;IAC7D,MAAM,gBAAgB,GAAG,OAAO,EAAE,gBAAgB,CAAC;IACnD,MAAM,cAAc,GAAqC,qBAAqB,IAAI,gBAAgB;QAChG,CAAC,CAAC;YACA,qBAAqB;YACrB,gBAAgB;SACjB;QACD,CAAC,CAAC,SAAS,CAAC;IACd,KAAK,IAAI,SAAS,GAAG,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC,MAAM,EAAE,SAAS,IAAI,CAAC,EAAE,CAAC;QACpE,MAAM,aAAa,GAAG,QAAQ,CAAC,SAAS,CAAW,CAAC;QACpD,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,GAAG,CAAC,CAAkB,CAAC;QACzD,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;QACzC,aAAa,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,WAAmB,EACnB,QAAgB,EAChB,gBAAqC,EACrC,YAAiC;IAEjC,MAAM,QAAQ,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;IAC9C,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvC,OAAO;IACT,CAAC;IAED,mCAAmC,CAAC,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;AAC1F,CAAC"}
@@ -3,14 +3,17 @@
3
3
  // LICENSE file in the root directory of this source tree.
4
4
  import { options } from 'preact';
5
5
  import { globalCommitContext, resetGlobalCommitContext, takeRemovedSubtreesForPostDispatchTeardown, } from './commit-context.js';
6
+ import { clearElementTemplateRenderScope, resetElementTemplateRenderScope } from './render-scope.js';
7
+ import { globalPipelineOptions, markTiming, markTimingLegacy, setPipeline } from '../../core/performance.js';
6
8
  import { getReloadVersion } from '../../core/reload-version.js';
9
+ import { delayedRunOnMainThreadData, takeDelayedRunOnMainThreadData, } from '../../core/thread-function-call/main-thread.js';
10
+ import { dropFunctionCallReturnIds } from '../../core/thread-function-call/return-value.js';
7
11
  import { COMMIT } from '../../shared/render-constants.js';
8
12
  import { hook, isEmptyObject } from '../../utils.js';
9
13
  import { formatElementTemplateUpdateCommands } from '../debug/alog.js';
10
14
  import { profileEnd, profileStart } from '../debug/profile.js';
11
- import { globalPipelineOptions, markTiming, markTimingLegacy, setPipeline } from '../lynx/performance.js';
12
15
  import { clearPendingRefs, flushPendingRefs, hasPendingRefs } from '../prop-adapters/ref.js';
13
- import { ElementTemplateLifecycleConstant } from '../protocol/lifecycle-constant.js';
16
+ import { createElementTemplateUpdateEvent } from '../protocol/update-event.js';
14
17
  let installed = false;
15
18
  let hasHydrated = false;
16
19
  const scheduledRemovedSubtreeCleanupTimers = /*#__PURE__*/ new Set();
@@ -22,6 +25,7 @@ export function isElementTemplateHydrated() {
22
25
  }
23
26
  export function resetElementTemplateCommitState() {
24
27
  hasHydrated = false;
28
+ resetElementTemplateRenderScope();
25
29
  resetGlobalCommitContext();
26
30
  }
27
31
  export function scheduleElementTemplateRemovedSubtreeCleanup(removedSubtreesAwaitingTeardown) {
@@ -31,7 +35,7 @@ export function scheduleElementTemplateRemovedSubtreeCleanup(removedSubtreesAwai
31
35
  const timer = setTimeout(() => {
32
36
  scheduledRemovedSubtreeCleanupTimers.delete(timer);
33
37
  for (const root of removedSubtreesAwaitingTeardown) {
34
- root.tearDown();
38
+ root.releaseDetachedSubtreeFromManager();
35
39
  }
36
40
  }, 10000);
37
41
  scheduledRemovedSubtreeCleanupTimers.add(timer);
@@ -42,12 +46,83 @@ export function cancelElementTemplateRemovedSubtreeCleanup() {
42
46
  }
43
47
  scheduledRemovedSubtreeCleanupTimers.clear();
44
48
  }
49
+ function flushElementTemplateCommitChanges() {
50
+ const hasNativeOps = globalCommitContext.ops.length > 0;
51
+ const hasDelayedRunOnMainThread = delayedRunOnMainThreadData.length > 0;
52
+ const hasUpdatePayload = hasNativeOps
53
+ || !isEmptyObject(globalCommitContext.flushOptions)
54
+ || hasDelayedRunOnMainThread;
55
+ const removedSubtreesAwaitingTeardown = hasNativeOps ? takeRemovedSubtreesForPostDispatchTeardown() : [];
56
+ let didFlushRefs = false;
57
+ let didDispatchUpdatePayload = false;
58
+ let delayedRunOnMainThreadPayload;
59
+ try {
60
+ if (hasUpdatePayload) {
61
+ markTimingLegacy('updateDiffVdomEnd');
62
+ markTiming('diffVdomEnd');
63
+ if (__PROFILE__) {
64
+ profileStart('ReactLynx::commitChanges');
65
+ }
66
+ markTiming('packChangesStart');
67
+ if (globalPipelineOptions) {
68
+ globalCommitContext.flushOptions.pipelineOptions = globalPipelineOptions;
69
+ }
70
+ markTiming('packChangesEnd');
71
+ if (globalPipelineOptions) {
72
+ setPipeline(undefined);
73
+ }
74
+ if (__PROFILE__) {
75
+ profileEnd();
76
+ }
77
+ delayedRunOnMainThreadPayload = hasDelayedRunOnMainThread
78
+ ? takeDelayedRunOnMainThreadData()
79
+ : undefined;
80
+ if (typeof __ALOG__ !== 'undefined' && __ALOG__) {
81
+ console.alog?.('[ReactLynxDebug] ElementTemplate BTS -> MTS update:\n'
82
+ + JSON.stringify({
83
+ ops: formatElementTemplateUpdateCommands(globalCommitContext.ops),
84
+ flushOptions: globalCommitContext.flushOptions,
85
+ flowIds: globalCommitContext.flowIds,
86
+ delayedRunOnMainThreadDataCount: delayedRunOnMainThreadPayload?.length,
87
+ }, null, 2));
88
+ }
89
+ lynx.getCoreContext().dispatchEvent(createElementTemplateUpdateEvent({
90
+ ops: globalCommitContext.ops,
91
+ flushOptions: globalCommitContext.flushOptions,
92
+ reloadVersion: getReloadVersion(),
93
+ flowIds: globalCommitContext.flowIds,
94
+ delayedRunOnMainThreadData: delayedRunOnMainThreadPayload,
95
+ }));
96
+ didDispatchUpdatePayload = true;
97
+ }
98
+ // When native ops exist, patch first so a newly attached ref observes the
99
+ // committed native state. Ref-only commits still flush through this path.
100
+ flushPendingRefs();
101
+ didFlushRefs = true;
102
+ }
103
+ finally {
104
+ if (delayedRunOnMainThreadPayload && !didDispatchUpdatePayload) {
105
+ dropFunctionCallReturnIds(delayedRunOnMainThreadPayload.map(data => data.resolveId));
106
+ }
107
+ if (!didFlushRefs) {
108
+ clearPendingRefs();
109
+ }
110
+ resetGlobalCommitContext();
111
+ // Match Snapshot's cleanup boundary: start the delayed teardown only
112
+ // after the bridge dispatch attempt, so background JS objects are not
113
+ // torn down before main-thread detach observes the same commit.
114
+ scheduleElementTemplateRemovedSubtreeCleanup(removedSubtreesAwaitingTeardown);
115
+ }
116
+ }
45
117
  export function installElementTemplateCommitHook() {
46
118
  if (installed) {
47
119
  return;
48
120
  }
49
121
  installed = true;
50
122
  hook(options, COMMIT, (originalCommit, vnode, commitQueue) => {
123
+ if (__BACKGROUND__) {
124
+ clearElementTemplateRenderScope();
125
+ }
51
126
  if (__BACKGROUND__ && !hasHydrated && hasPendingRefs()) {
52
127
  // User effects can run before ET hydrate arrives, so ordinary refs must be
53
128
  // attached on the background commit even though native UI ops are delayed.
@@ -56,64 +131,9 @@ export function installElementTemplateCommitHook() {
56
131
  else if (__BACKGROUND__ && hasHydrated
57
132
  && (globalCommitContext.ops.length > 0
58
133
  || !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;
64
- try {
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;
106
- }
107
- finally {
108
- if (!didFlushRefs) {
109
- clearPendingRefs();
110
- }
111
- resetGlobalCommitContext();
112
- // Match Snapshot's cleanup boundary: start the delayed teardown only
113
- // after the bridge dispatch attempt, so background JS objects are not
114
- // torn down before main-thread detach observes the same commit.
115
- scheduleElementTemplateRemovedSubtreeCleanup(removedSubtreesAwaitingTeardown);
116
- }
134
+ || hasPendingRefs()
135
+ || delayedRunOnMainThreadData.length > 0)) {
136
+ flushElementTemplateCommitChanges();
117
137
  }
118
138
  originalCommit?.(vnode, commitQueue);
119
139
  });
@@ -1 +1 @@
1
- {"version":3,"file":"commit-hook.js","sourceRoot":"","sources":["../../../src/element-template/background/commit-hook.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0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AAgB,EAAE,CAAC;gBACnB,YAAY,GAAG,IAAI,CAAC;YACtB,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC,YAAY,EAAE,CAAC;oBAClB,gBAAgB,EAAE,CAAC;gBACrB,CAAC;gBACD,wBAAwB,EAAE,CAAC;gBAC3B,qEAAqE;gBACrE,sEAAsE;gBACtE,gEAAgE;gBAChE,4CAA4C,CAAC,+BAA+B,CAAC,CAAC;YAChF,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,+BAA+B,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AACrG,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7G,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,GAC/B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AAC5F,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,mCAAmC,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,gBAAgB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AE,CAAC;YACvD,2EAA2E;YAC3E,2EAA2E;YAC3E,gBAAgB,EAAE,CAAC;QACrB,CAAC;aAAM,IACL,cAAc,IAAI,WAAW;eAC1B,CACD,mBAAmB,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC;mBAC/B,CAAC,aAAa,CAAC,mBAAmB,CAAC,YAAY,CAAC;mBAChD,cAAc,EAAE;mBAChB,0BAA0B,CAAC,MAAM,GAAG,CAAC,CACzC,EACD,CAAC;YACD,iCAAiC,EAAE,CAAC;QACtC,CAAC;QAED,cAAc,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -5,6 +5,8 @@ import { backgroundElementTemplateInstanceManager } from './manager.js';
5
5
  import { clearEventState } from '../prop-adapters/event.js';
6
6
  import { clearRefState, flushPendingRefs } from '../prop-adapters/ref.js';
7
7
  import { __root } from '../runtime/page/root-instance.js';
8
+ import { resetElementTemplateBackgroundFunctionRuntime } from '../runtime/template/main-thread-background-function.js';
9
+ import { resetElementTemplateMainThreadFunctionRuntime } from '../runtime/template/main-thread-function.js';
8
10
  export function destroyElementTemplateBackgroundRuntime() {
9
11
  resetElementTemplateHydrationListener();
10
12
  cancelElementTemplateRemovedSubtreeCleanup();
@@ -13,6 +15,8 @@ export function destroyElementTemplateBackgroundRuntime() {
13
15
  // the raw ref ownership needed to detach callbacks is gone.
14
16
  flushPendingRefs();
15
17
  resetElementTemplateCommitState();
18
+ resetElementTemplateBackgroundFunctionRuntime();
19
+ resetElementTemplateMainThreadFunctionRuntime();
16
20
  clearEventState();
17
21
  clearRefState();
18
22
  backgroundElementTemplateInstanceManager.clear();
@@ -1 +1 @@
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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;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,6CAA6C,EAAE,CAAC;IAChD,6CAA6C,EAAE,CAAC;IAChD,eAAe,EAAE,CAAC;IAClB,aAAa,EAAE,CAAC;IAChB,wCAAwC,CAAC,KAAK,EAAE,CAAC;AACnD,CAAC"}
@@ -2,13 +2,19 @@
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 } 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 === 'list') {
10
+ return new BackgroundListElementTemplateInstance();
11
+ }
9
12
  return new BackgroundElementTemplateInstance(type);
10
13
  },
11
14
  createElementNS(_ns, type) {
15
+ if (type === 'list') {
16
+ return new BackgroundListElementTemplateInstance();
17
+ }
12
18
  return new BackgroundElementTemplateInstance(type);
13
19
  },
14
20
  createTextNode(text) {
@@ -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,EAAE,6BAA6B,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAQjG,MAAM,UAAU,sCAAsC;IACpD,MAAM,GAAG,GAAG;QACV,aAAa,CAAC,IAAY;YACxB,OAAO,IAAI,iCAAiC,CAAC,IAAI,CAAC,CAAC;QACrD,CAAC;QACD,eAAe,CAAC,GAAW,EAAE,IAAY;YACvC,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): boolean;
2
+ import type { SerializedEtNode } from '../protocol/types.js';
3
+ export declare function hydrateRootChildrenIntoContext(serializedChildren: SerializedEtNode[], root: BackgroundElementTemplateInstance): boolean;