@lynx-js/react 0.120.0 → 0.121.1

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 (350) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/package.json +36 -8
  3. package/runtime/lazy/compat.js +1 -0
  4. package/runtime/lazy/react.js +1 -0
  5. package/runtime/lib/core/commit-context.d.ts +8 -0
  6. package/runtime/lib/core/commit-context.js +18 -0
  7. package/runtime/lib/core/commit-context.js.map +1 -0
  8. package/runtime/lib/core/forceRootRender.d.ts +7 -0
  9. package/runtime/lib/core/forceRootRender.js +40 -0
  10. package/runtime/lib/core/forceRootRender.js.map +1 -0
  11. package/runtime/lib/core/globalProps.d.ts +31 -0
  12. package/runtime/lib/core/globalProps.js +55 -0
  13. package/runtime/lib/core/globalProps.js.map +1 -0
  14. package/runtime/lib/core/hooks/mainThread.d.ts +1 -0
  15. package/runtime/lib/core/hooks/mainThread.js +7 -0
  16. package/runtime/lib/core/hooks/mainThread.js.map +1 -0
  17. package/runtime/lib/{snapshot/hooks/mainThread.d.ts → core/hooks/mainThreadImpl.d.ts} +2 -1
  18. package/runtime/lib/{snapshot/hooks/mainThread.js → core/hooks/mainThreadImpl.js} +45 -34
  19. package/runtime/lib/core/hooks/mainThreadImpl.js.map +1 -0
  20. package/runtime/lib/{snapshot → core}/hooks/react.js +1 -1
  21. package/runtime/lib/core/hooks/react.js.map +1 -0
  22. package/runtime/lib/{snapshot → core}/hooks/useLynxGlobalEventListener.d.ts +1 -1
  23. package/runtime/lib/{snapshot → core}/hooks/useLynxGlobalEventListener.js +2 -2
  24. package/runtime/lib/core/hooks/useLynxGlobalEventListener.js.map +1 -0
  25. package/runtime/lib/{snapshot/compat → core}/initData.d.ts +2 -2
  26. package/runtime/lib/{snapshot/compat → core}/initData.js +4 -5
  27. package/runtime/lib/core/initData.js.map +1 -0
  28. package/runtime/lib/core/lynx-data-processors.d.ts +2 -0
  29. package/runtime/lib/core/lynx-data-processors.js +53 -0
  30. package/runtime/lib/core/lynx-data-processors.js.map +1 -0
  31. package/runtime/lib/core/lynx-page-data.d.ts +1 -0
  32. package/runtime/lib/core/lynx-page-data.js +14 -0
  33. package/runtime/lib/core/lynx-page-data.js.map +1 -0
  34. package/runtime/lib/core/lynx-update-data.d.ts +11 -0
  35. package/runtime/lib/core/lynx-update-data.js +21 -0
  36. package/runtime/lib/core/lynx-update-data.js.map +1 -0
  37. package/runtime/lib/core/ref.d.ts +37 -0
  38. package/runtime/lib/core/ref.js +108 -0
  39. package/runtime/lib/core/ref.js.map +1 -0
  40. package/runtime/lib/core/reload-version.d.ts +2 -0
  41. package/runtime/lib/{snapshot/lifecycle/pass.js → core/reload-version.js} +4 -5
  42. package/runtime/lib/core/reload-version.js.map +1 -0
  43. package/runtime/lib/element-template/background/attr-slots.d.ts +7 -0
  44. package/runtime/lib/element-template/background/attr-slots.js +67 -0
  45. package/runtime/lib/element-template/background/attr-slots.js.map +1 -0
  46. package/runtime/lib/element-template/background/commit-context.d.ts +13 -0
  47. package/runtime/lib/element-template/background/commit-context.js +22 -0
  48. package/runtime/lib/element-template/background/commit-context.js.map +1 -0
  49. package/runtime/lib/element-template/background/commit-hook.d.ts +7 -0
  50. package/runtime/lib/element-template/background/commit-hook.js +121 -0
  51. package/runtime/lib/element-template/background/commit-hook.js.map +1 -0
  52. package/runtime/lib/element-template/background/destroy.d.ts +1 -0
  53. package/runtime/lib/element-template/background/destroy.js +20 -0
  54. package/runtime/lib/element-template/background/destroy.js.map +1 -0
  55. package/runtime/lib/element-template/background/document.d.ts +7 -0
  56. package/runtime/lib/element-template/background/document.js +21 -0
  57. package/runtime/lib/element-template/background/document.js.map +1 -0
  58. package/runtime/lib/element-template/background/hydrate.d.ts +4 -0
  59. package/runtime/lib/element-template/background/hydrate.js +236 -0
  60. package/runtime/lib/element-template/background/hydrate.js.map +1 -0
  61. package/runtime/lib/element-template/background/hydration-listener.d.ts +2 -0
  62. package/runtime/lib/element-template/background/hydration-listener.js +139 -0
  63. package/runtime/lib/element-template/background/hydration-listener.js.map +1 -0
  64. package/runtime/lib/element-template/background/instance.d.ts +41 -0
  65. package/runtime/lib/element-template/background/instance.js +347 -0
  66. package/runtime/lib/element-template/background/instance.js.map +1 -0
  67. package/runtime/lib/element-template/background/manager.d.ts +10 -0
  68. package/runtime/lib/element-template/background/manager.js +60 -0
  69. package/runtime/lib/element-template/background/manager.js.map +1 -0
  70. package/runtime/lib/element-template/client/root.d.ts +43 -0
  71. package/runtime/lib/element-template/client/root.js +30 -0
  72. package/runtime/lib/element-template/client/root.js.map +1 -0
  73. package/runtime/lib/element-template/debug/alog.d.ts +41 -0
  74. package/runtime/lib/element-template/debug/alog.js +103 -0
  75. package/runtime/lib/element-template/debug/alog.js.map +1 -0
  76. package/runtime/lib/element-template/debug/elementPAPICall.d.ts +1 -0
  77. package/runtime/lib/element-template/debug/elementPAPICall.js +79 -0
  78. package/runtime/lib/element-template/debug/elementPAPICall.js.map +1 -0
  79. package/runtime/lib/element-template/debug/profile.d.ts +3 -0
  80. package/runtime/lib/element-template/debug/profile.js +141 -0
  81. package/runtime/lib/element-template/debug/profile.js.map +1 -0
  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 +28 -0
  86. package/runtime/lib/element-template/index.js +75 -0
  87. package/runtime/lib/element-template/index.js.map +1 -0
  88. package/runtime/lib/element-template/internal.d.ts +6 -0
  89. package/runtime/lib/element-template/internal.js +43 -0
  90. package/runtime/lib/element-template/internal.js.map +1 -0
  91. package/runtime/lib/element-template/jsx-dev-runtime/index.d.ts +1 -0
  92. package/runtime/lib/element-template/jsx-dev-runtime/index.js +5 -0
  93. package/runtime/lib/element-template/jsx-dev-runtime/index.js.map +1 -0
  94. package/runtime/lib/element-template/jsx-runtime/index.d.ts +19 -0
  95. package/runtime/lib/element-template/jsx-runtime/index.js +60 -0
  96. package/runtime/lib/element-template/jsx-runtime/index.js.map +1 -0
  97. package/runtime/lib/element-template/lynx/env.d.ts +1 -0
  98. package/runtime/lib/element-template/lynx/env.js +46 -0
  99. package/runtime/lib/element-template/lynx/env.js.map +1 -0
  100. package/runtime/lib/element-template/lynx/performance.d.ts +23 -0
  101. package/runtime/lib/element-template/lynx/performance.js +135 -0
  102. package/runtime/lib/element-template/lynx/performance.js.map +1 -0
  103. package/runtime/lib/element-template/native/callDestroyLifetimeFun.d.ts +1 -0
  104. package/runtime/lib/element-template/native/callDestroyLifetimeFun.js +8 -0
  105. package/runtime/lib/element-template/native/callDestroyLifetimeFun.js.map +1 -0
  106. package/runtime/lib/element-template/native/index.d.ts +1 -0
  107. package/runtime/lib/element-template/native/index.js +79 -0
  108. package/runtime/lib/element-template/native/index.js.map +1 -0
  109. package/runtime/lib/element-template/native/main-thread-api.d.ts +2 -0
  110. package/runtime/lib/element-template/native/main-thread-api.js +49 -0
  111. package/runtime/lib/element-template/native/main-thread-api.js.map +1 -0
  112. package/runtime/lib/element-template/native/mts-destroy.d.ts +3 -0
  113. package/runtime/lib/element-template/native/mts-destroy.js +37 -0
  114. package/runtime/lib/element-template/native/mts-destroy.js.map +1 -0
  115. package/runtime/lib/element-template/native/patch-listener.d.ts +2 -0
  116. package/runtime/lib/element-template/native/patch-listener.js +70 -0
  117. package/runtime/lib/element-template/native/patch-listener.js.map +1 -0
  118. package/runtime/lib/element-template/native/reload.d.ts +2 -0
  119. package/runtime/lib/element-template/native/reload.js +64 -0
  120. package/runtime/lib/element-template/native/reload.js.map +1 -0
  121. package/runtime/lib/element-template/prop-adapters/event-value.d.ts +1 -0
  122. package/runtime/lib/element-template/prop-adapters/event-value.js +7 -0
  123. package/runtime/lib/element-template/prop-adapters/event-value.js.map +1 -0
  124. package/runtime/lib/element-template/prop-adapters/event.d.ts +8 -0
  125. package/runtime/lib/element-template/prop-adapters/event.js +64 -0
  126. package/runtime/lib/element-template/prop-adapters/event.js.map +1 -0
  127. package/runtime/lib/element-template/prop-adapters/ref.d.ts +26 -0
  128. package/runtime/lib/element-template/prop-adapters/ref.js +107 -0
  129. package/runtime/lib/element-template/prop-adapters/ref.js.map +1 -0
  130. package/runtime/lib/element-template/prop-adapters/spread.d.ts +5 -0
  131. package/runtime/lib/element-template/prop-adapters/spread.js +52 -0
  132. package/runtime/lib/element-template/prop-adapters/spread.js.map +1 -0
  133. package/runtime/lib/element-template/protocol/lifecycle-constant.d.ts +4 -0
  134. package/runtime/lib/element-template/protocol/lifecycle-constant.js +9 -0
  135. package/runtime/lib/element-template/protocol/lifecycle-constant.js.map +1 -0
  136. package/runtime/lib/element-template/protocol/opcodes.d.ts +8 -0
  137. package/runtime/lib/element-template/protocol/opcodes.js +11 -0
  138. package/runtime/lib/element-template/protocol/opcodes.js.map +1 -0
  139. package/runtime/lib/element-template/protocol/types.d.ts +98 -0
  140. package/runtime/lib/element-template/protocol/types.js +5 -0
  141. package/runtime/lib/element-template/protocol/types.js.map +1 -0
  142. package/runtime/lib/element-template/runtime/page/page.d.ts +5 -0
  143. package/runtime/lib/element-template/runtime/page/page.js +20 -0
  144. package/runtime/lib/element-template/runtime/page/page.js.map +1 -0
  145. package/runtime/lib/element-template/runtime/page/root-instance.d.ts +10 -0
  146. package/runtime/lib/element-template/runtime/page/root-instance.js +17 -0
  147. package/runtime/lib/element-template/runtime/page/root-instance.js.map +1 -0
  148. package/runtime/lib/element-template/runtime/patch.d.ts +3 -0
  149. package/runtime/lib/element-template/runtime/patch.js +214 -0
  150. package/runtime/lib/element-template/runtime/patch.js.map +1 -0
  151. package/runtime/lib/element-template/runtime/render/render-main-thread.d.ts +4 -0
  152. package/runtime/lib/element-template/runtime/render/render-main-thread.js +71 -0
  153. package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -0
  154. package/runtime/lib/element-template/runtime/render/render-opcodes.d.ts +4 -0
  155. package/runtime/lib/element-template/runtime/render/render-opcodes.js +134 -0
  156. package/runtime/lib/element-template/runtime/render/render-opcodes.js.map +1 -0
  157. package/runtime/lib/element-template/runtime/render/render-to-opcodes.d.ts +14 -0
  158. package/runtime/lib/element-template/runtime/render/render-to-opcodes.js +278 -0
  159. package/runtime/lib/element-template/runtime/render/render-to-opcodes.js.map +1 -0
  160. package/runtime/lib/element-template/runtime/template/attr-slot-plan.d.ts +12 -0
  161. package/runtime/lib/element-template/runtime/template/attr-slot-plan.js +27 -0
  162. package/runtime/lib/element-template/runtime/template/attr-slot-plan.js.map +1 -0
  163. package/runtime/lib/element-template/runtime/template/handle.d.ts +5 -0
  164. package/runtime/lib/element-template/runtime/template/handle.js +22 -0
  165. package/runtime/lib/element-template/runtime/template/handle.js.map +1 -0
  166. package/runtime/lib/element-template/runtime/template/registry.d.ts +13 -0
  167. package/runtime/lib/element-template/runtime/template/registry.js +46 -0
  168. package/runtime/lib/element-template/runtime/template/registry.js.map +1 -0
  169. package/runtime/lib/index.d.ts +5 -3
  170. package/runtime/lib/index.js +7 -4
  171. package/runtime/lib/index.js.map +1 -1
  172. package/runtime/lib/internal.d.ts +3 -4
  173. package/runtime/lib/internal.js +4 -5
  174. package/runtime/lib/internal.js.map +1 -1
  175. package/runtime/lib/lynx-api.d.ts +4 -9
  176. package/runtime/lib/lynx-api.js +11 -48
  177. package/runtime/lib/lynx-api.js.map +1 -1
  178. package/runtime/lib/lynx.d.ts +1 -1
  179. package/runtime/lib/lynx.js +3 -3
  180. package/runtime/lib/lynx.js.map +1 -1
  181. package/runtime/lib/{snapshot/debug → shared}/component-stack.js +1 -1
  182. package/runtime/lib/shared/component-stack.js.map +1 -0
  183. package/runtime/lib/{snapshot/debug → shared}/profile.js +6 -4
  184. package/runtime/lib/shared/profile.js.map +1 -0
  185. package/runtime/lib/{snapshot/renderToOpcodes/constants.js → shared/render-constants.js} +1 -1
  186. package/runtime/lib/shared/render-constants.js.map +1 -0
  187. package/runtime/lib/snapshot/alog/elementPAPICall.js +1 -1
  188. package/runtime/lib/snapshot/alog/elementPAPICall.js.map +1 -1
  189. package/runtime/lib/snapshot/alog/render.js +1 -1
  190. package/runtime/lib/snapshot/alog/render.js.map +1 -1
  191. package/runtime/lib/snapshot/debug/profileHooks.js +1 -1
  192. package/runtime/lib/snapshot/debug/profileHooks.js.map +1 -1
  193. package/runtime/lib/snapshot/debug/vnodeSource.js +2 -2
  194. package/runtime/lib/snapshot/debug/vnodeSource.js.map +1 -1
  195. package/runtime/lib/snapshot/gesture/processGesture.d.ts +2 -0
  196. package/runtime/lib/snapshot/gesture/processGesture.js +16 -1
  197. package/runtime/lib/snapshot/gesture/processGesture.js.map +1 -1
  198. package/runtime/lib/snapshot/legacy-react-runtime/index.d.ts +2 -2
  199. package/runtime/lib/snapshot/legacy-react-runtime/index.js +2 -2
  200. package/runtime/lib/snapshot/legacy-react-runtime/index.js.map +1 -1
  201. package/runtime/lib/snapshot/lifecycle/destroy.js +1 -1
  202. package/runtime/lib/snapshot/lifecycle/destroy.js.map +1 -1
  203. package/runtime/lib/snapshot/lifecycle/event/jsReady.js +1 -1
  204. package/runtime/lib/snapshot/lifecycle/event/jsReady.js.map +1 -1
  205. package/runtime/lib/snapshot/lifecycle/isRendering.js +1 -1
  206. package/runtime/lib/snapshot/lifecycle/isRendering.js.map +1 -1
  207. package/runtime/lib/snapshot/lifecycle/patch/commit.d.ts +0 -1
  208. package/runtime/lib/snapshot/lifecycle/patch/commit.js +5 -10
  209. package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -1
  210. package/runtime/lib/snapshot/lifecycle/patch/nodesRefApply.d.ts +15 -0
  211. package/runtime/lib/snapshot/lifecycle/patch/nodesRefApply.js +102 -0
  212. package/runtime/lib/snapshot/lifecycle/patch/nodesRefApply.js.map +1 -0
  213. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.d.ts +2 -0
  214. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js +17 -0
  215. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js.map +1 -1
  216. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js +26 -0
  217. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js.map +1 -1
  218. package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js +1 -1
  219. package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -1
  220. package/runtime/lib/snapshot/lifecycle/ref/delay.d.ts +7 -13
  221. package/runtime/lib/snapshot/lifecycle/ref/delay.js +12 -31
  222. package/runtime/lib/snapshot/lifecycle/ref/delay.js.map +1 -1
  223. package/runtime/lib/snapshot/lifecycle/reload.js +3 -3
  224. package/runtime/lib/snapshot/lifecycle/reload.js.map +1 -1
  225. package/runtime/lib/snapshot/lifecycle/render.js +1 -1
  226. package/runtime/lib/snapshot/lifecycle/render.js.map +1 -1
  227. package/runtime/lib/snapshot/list/list.js +5 -2
  228. package/runtime/lib/snapshot/list/list.js.map +1 -1
  229. package/runtime/lib/snapshot/list/listUpdateInfo.js +4 -3
  230. package/runtime/lib/snapshot/list/listUpdateInfo.js.map +1 -1
  231. package/runtime/lib/snapshot/lynx/calledByNative.js +2 -8
  232. package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -1
  233. package/runtime/lib/snapshot/lynx/component.js +3 -3
  234. package/runtime/lib/snapshot/lynx/component.js.map +1 -1
  235. package/runtime/lib/snapshot/lynx/element.d.ts +6 -0
  236. package/runtime/lib/snapshot/lynx/element.js +35 -0
  237. package/runtime/lib/snapshot/lynx/element.js.map +1 -0
  238. package/runtime/lib/snapshot/lynx/env.js +5 -51
  239. package/runtime/lib/snapshot/lynx/env.js.map +1 -1
  240. package/runtime/lib/snapshot/lynx/nodesRef.d.ts +6 -0
  241. package/runtime/lib/snapshot/lynx/nodesRef.js +31 -0
  242. package/runtime/lib/snapshot/lynx/nodesRef.js.map +1 -0
  243. package/runtime/lib/snapshot/lynx/performance.js +1 -1
  244. package/runtime/lib/snapshot/lynx/performance.js.map +1 -1
  245. package/runtime/lib/snapshot/lynx/portals.d.ts +9 -0
  246. package/runtime/lib/snapshot/lynx/portals.js +120 -0
  247. package/runtime/lib/snapshot/lynx/portals.js.map +1 -0
  248. package/runtime/lib/snapshot/lynx/portalsPending.d.ts +10 -0
  249. package/runtime/lib/snapshot/lynx/portalsPending.js +38 -0
  250. package/runtime/lib/snapshot/lynx/portalsPending.js.map +1 -0
  251. package/runtime/lib/snapshot/lynx/runWithForce.js +9 -39
  252. package/runtime/lib/snapshot/lynx/runWithForce.js.map +1 -1
  253. package/runtime/lib/snapshot/lynx/tt.js +11 -31
  254. package/runtime/lib/snapshot/lynx/tt.js.map +1 -1
  255. package/runtime/lib/snapshot/renderToOpcodes/hydrate.js +1 -1
  256. package/runtime/lib/snapshot/renderToOpcodes/hydrate.js.map +1 -1
  257. package/runtime/lib/snapshot/renderToOpcodes/index.js +1 -1
  258. package/runtime/lib/snapshot/renderToOpcodes/index.js.map +1 -1
  259. package/runtime/lib/snapshot/renderToOpcodes/opcodes.js +1 -1
  260. package/runtime/lib/snapshot/renderToOpcodes/opcodes.js.map +1 -1
  261. package/runtime/lib/snapshot/snapshot/backgroundSnapshot.d.ts +1 -1
  262. package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +23 -24
  263. package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
  264. package/runtime/lib/snapshot/snapshot/constants.d.ts +4 -0
  265. package/runtime/lib/snapshot/snapshot/constants.js +4 -0
  266. package/runtime/lib/snapshot/snapshot/constants.js.map +1 -1
  267. package/runtime/lib/snapshot/snapshot/definition.d.ts +1 -0
  268. package/runtime/lib/snapshot/snapshot/definition.js +49 -1
  269. package/runtime/lib/snapshot/snapshot/definition.js.map +1 -1
  270. package/runtime/lib/snapshot/snapshot/dynamicPartType.d.ts +12 -0
  271. package/runtime/lib/snapshot/snapshot/dynamicPartType.js +12 -0
  272. package/runtime/lib/snapshot/snapshot/dynamicPartType.js.map +1 -1
  273. package/runtime/lib/snapshot/snapshot/event.d.ts +1 -1
  274. package/runtime/lib/snapshot/snapshot/event.js +0 -4
  275. package/runtime/lib/snapshot/snapshot/event.js.map +1 -1
  276. package/runtime/lib/snapshot/snapshot/gesture.js +9 -3
  277. package/runtime/lib/snapshot/snapshot/gesture.js.map +1 -1
  278. package/runtime/lib/snapshot/snapshot/list.js +1 -1
  279. package/runtime/lib/snapshot/snapshot/list.js.map +1 -1
  280. package/runtime/lib/snapshot/snapshot/reconstructInstanceTree.d.ts +14 -0
  281. package/runtime/lib/snapshot/snapshot/reconstructInstanceTree.js +27 -0
  282. package/runtime/lib/snapshot/snapshot/reconstructInstanceTree.js.map +1 -0
  283. package/runtime/lib/snapshot/snapshot/ref.d.ts +3 -5
  284. package/runtime/lib/snapshot/snapshot/ref.js +16 -59
  285. package/runtime/lib/snapshot/snapshot/ref.js.map +1 -1
  286. package/runtime/lib/snapshot/snapshot/snapshot.js +62 -3
  287. package/runtime/lib/snapshot/snapshot/snapshot.js.map +1 -1
  288. package/runtime/lib/snapshot/snapshot/snapshotInstanceHydrationMap.js +1 -1
  289. package/runtime/lib/snapshot/snapshot/snapshotInstanceHydrationMap.js.map +1 -1
  290. package/runtime/lib/snapshot/snapshot/spread.d.ts +1 -1
  291. package/runtime/lib/snapshot/snapshot/spread.js +32 -1
  292. package/runtime/lib/snapshot/snapshot/spread.js.map +1 -1
  293. package/runtime/lib/snapshot/snapshot/utils.d.ts +1 -3
  294. package/runtime/lib/snapshot/snapshot/utils.js +5 -0
  295. package/runtime/lib/snapshot/snapshot/utils.js.map +1 -1
  296. package/runtime/lib/snapshot/snapshot/workletEvent.d.ts +1 -1
  297. package/runtime/lib/snapshot/snapshot/workletEvent.js +10 -5
  298. package/runtime/lib/snapshot/snapshot/workletEvent.js.map +1 -1
  299. package/runtime/lib/snapshot/snapshot/workletRef.d.ts +1 -1
  300. package/runtime/lib/snapshot/snapshot/workletRef.js +6 -3
  301. package/runtime/lib/snapshot/snapshot/workletRef.js.map +1 -1
  302. package/runtime/lib/snapshot/worklet/ref/workletRef.js +1 -1
  303. package/runtime/lib/snapshot/worklet/ref/workletRef.js.map +1 -1
  304. package/runtime/lib/tsconfig.tsbuildinfo +1 -1
  305. package/runtime/lib/utils.js +1 -1
  306. package/runtime/lib/utils.js.map +1 -1
  307. package/runtime/lib/worklet-runtime/bindings/observers.d.ts +1 -0
  308. package/runtime/lib/worklet-runtime/bindings/observers.js +5 -3
  309. package/runtime/lib/worklet-runtime/bindings/observers.js.map +1 -1
  310. package/runtime/lib/worklet-runtime/bindings/types.d.ts +1 -1
  311. package/runtime/lib/worklet-runtime/bindings/types.js.map +1 -1
  312. package/runtime/lib/worklet-runtime/hydrate.js +1 -1
  313. package/runtime/lib/worklet-runtime/hydrate.js.map +1 -1
  314. package/runtime/lib/worklet-runtime/jsFunctionLifecycle.d.ts +1 -0
  315. package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js +5 -0
  316. package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js.map +1 -1
  317. package/runtime/lib/worklet-runtime/workletRuntime.js +2 -3
  318. package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
  319. package/runtime/worklet-runtime/dev.js +9 -5
  320. package/runtime/worklet-runtime/main.js +1 -1
  321. package/testing-library/dist/env/index.js +27 -15
  322. package/testing-library/dist/fire-event.d.ts +21 -7
  323. package/testing-library/dist/index.d.ts +2 -0
  324. package/testing-library/dist/plugins/index.js +12 -1
  325. package/testing-library/dist/pure.js +27 -9
  326. package/testing-library/dist/type-entry/index.js +0 -0
  327. package/transform/dist/wasm.cjs +833 -285
  328. package/transform/index.d.ts +28 -1
  329. package/types/react.docs.d.ts +9 -1
  330. package/refresh/.gitignore +0 -1
  331. package/refresh/.npmignore +0 -3
  332. package/refresh/.turbo/turbo-build.log +0 -12
  333. package/refresh/package.json +0 -20
  334. package/refresh/rslib.config.ts +0 -24
  335. package/refresh/tsconfig.json +0 -4
  336. package/refresh/turbo.json +0 -15
  337. package/runtime/lib/snapshot/compat/initData.js.map +0 -1
  338. package/runtime/lib/snapshot/debug/component-stack.js.map +0 -1
  339. package/runtime/lib/snapshot/debug/profile.js.map +0 -1
  340. package/runtime/lib/snapshot/hooks/mainThread.js.map +0 -1
  341. package/runtime/lib/snapshot/hooks/react.js.map +0 -1
  342. package/runtime/lib/snapshot/hooks/useLynxGlobalEventListener.js.map +0 -1
  343. package/runtime/lib/snapshot/lifecycle/pass.d.ts +0 -3
  344. package/runtime/lib/snapshot/lifecycle/pass.js.map +0 -1
  345. package/runtime/lib/snapshot/renderToOpcodes/constants.js.map +0 -1
  346. package/testing-library/README.md +0 -109
  347. /package/runtime/lib/{snapshot → core}/hooks/react.d.ts +0 -0
  348. /package/runtime/lib/{snapshot/debug → shared}/component-stack.d.ts +0 -0
  349. /package/runtime/lib/{snapshot/debug → shared}/profile.d.ts +0 -0
  350. /package/runtime/lib/{snapshot/renderToOpcodes/constants.d.ts → shared/render-constants.d.ts} +0 -0
@@ -0,0 +1,236 @@
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 { globalCommitContext, markRemovedSubtreeForPostDispatchTeardown, resetGlobalCommitContext, } from './commit-context.js';
5
+ import { BUILTIN_RAW_TEXT_TEMPLATE_KEY } from './instance.js';
6
+ import { backgroundElementTemplateInstanceManager } from './manager.js';
7
+ import { isDirectOrDeepEqual } from '../../utils.js';
8
+ import { hydrationMap } from '../hydration-map.js';
9
+ import { ElementTemplateUpdateOps } from '../protocol/opcodes.js';
10
+ export function hydrate(serialized, instance) {
11
+ resetGlobalCommitContext();
12
+ if (!hydrateIntoContext(serialized, instance)) {
13
+ // Hydration protocol errors are not transactional: earlier matched nodes
14
+ // may already be rebound while discovering a later mismatch. Discard the
15
+ // native output for this failed pass and let the listener keep refs/events gated.
16
+ resetGlobalCommitContext();
17
+ }
18
+ return globalCommitContext.ops;
19
+ }
20
+ export function hydrateIntoContext(serialized, instance) {
21
+ return hydrateInstance(serialized, instance);
22
+ }
23
+ function hydrateMatchingChildrenAndDiffSlot(serializedChildren, backgroundChildren) {
24
+ let lastPlacedIndex = 0;
25
+ const result = {
26
+ hasChanges: false,
27
+ insertions: {},
28
+ insertionCount: 0,
29
+ removals: [],
30
+ moves: {},
31
+ };
32
+ const serializedByTemplateKey = {};
33
+ const serializedCursorByTemplateKey = {};
34
+ for (let i = 0; i < serializedChildren.length; i += 1) {
35
+ const node = serializedChildren[i];
36
+ (serializedByTemplateKey[node.templateKey] ??= []).push([node, i]);
37
+ }
38
+ for (let i = 0; i < backgroundChildren.length; i += 1) {
39
+ const backgroundChild = backgroundChildren[i];
40
+ const serializedCandidates = serializedByTemplateKey[backgroundChild.type];
41
+ const candidateCursor = serializedCursorByTemplateKey[backgroundChild.type] ?? 0;
42
+ const matchedSerialized = serializedCandidates?.[candidateCursor];
43
+ if (matchedSerialized) {
44
+ serializedCursorByTemplateKey[backgroundChild.type] = candidateCursor + 1;
45
+ const oldIndex = matchedSerialized[1];
46
+ if (!hydrateInstance(matchedSerialized[0], backgroundChild)) {
47
+ return null;
48
+ }
49
+ if (oldIndex < lastPlacedIndex) {
50
+ result.moves[oldIndex] = { toIndex: i, instance: backgroundChild };
51
+ result.hasChanges = true;
52
+ }
53
+ else {
54
+ lastPlacedIndex = oldIndex;
55
+ }
56
+ }
57
+ else {
58
+ result.insertions[i] = backgroundChild;
59
+ result.insertionCount += 1;
60
+ result.hasChanges = true;
61
+ }
62
+ }
63
+ for (const key in serializedByTemplateKey) {
64
+ const candidates = serializedByTemplateKey[key];
65
+ const candidateCursor = serializedCursorByTemplateKey[key] ?? 0;
66
+ for (let i = candidateCursor; i < candidates.length; i += 1) {
67
+ result.removals.push(candidates[i][1]);
68
+ result.hasChanges = true;
69
+ }
70
+ }
71
+ return result;
72
+ }
73
+ function hydrateInstance(serialized, instance) {
74
+ if (serialized.templateKey !== instance.type) {
75
+ if (__DEV__) {
76
+ lynx.reportError(new Error(`ElementTemplate hydrate key mismatch: main='${serialized.templateKey}' background='${instance.type}'.`));
77
+ }
78
+ return false;
79
+ }
80
+ const handleId = serialized.uid;
81
+ if (!bindHydrationHandleId(instance, handleId, serialized.templateKey)) {
82
+ return false;
83
+ }
84
+ instance.prepareAttributeSlotsForHydration();
85
+ hydrateAttributeSlots(handleId, serialized.attributeSlots ?? [], instance.attributeSlots);
86
+ if (serialized.templateKey === BUILTIN_RAW_TEXT_TEMPLATE_KEY) {
87
+ return true;
88
+ }
89
+ const serializedElementSlots = serialized.elementSlots ?? [];
90
+ const backgroundElementSlots = instance.elementSlots;
91
+ // Snapshot hydrates dynamic children through slot-filtered lists. Keeping ET
92
+ // scoped the same way means a cross-slot candidate is a source remove plus a
93
+ // target create/insert, while same-slot reorder can still stay move-like.
94
+ const slotCount = Math.max(serializedElementSlots.length, backgroundElementSlots.length);
95
+ for (let slotId = 0; slotId < slotCount; slotId += 1) {
96
+ const serializedSlot = serializedElementSlots[slotId];
97
+ const backgroundSlot = backgroundElementSlots[slotId];
98
+ if (!serializedSlot && !backgroundSlot) {
99
+ continue;
100
+ }
101
+ if (!hydrateElementSlot(instance, slotId, serializedSlot ?? [], backgroundSlot ?? [])) {
102
+ return false;
103
+ }
104
+ }
105
+ return true;
106
+ }
107
+ function hydrateElementSlot(parent, slotId, serializedChildren, backgroundChildren) {
108
+ if (backgroundChildren.length === 0) {
109
+ for (const serialized of serializedChildren) {
110
+ emitSerializedSubtreeRemove(parent, slotId, serialized);
111
+ }
112
+ return true;
113
+ }
114
+ const listDiff = hydrateMatchingChildrenAndDiffSlot(serializedChildren, backgroundChildren);
115
+ if (listDiff === null) {
116
+ return false;
117
+ }
118
+ if (!listDiff.hasChanges) {
119
+ return true;
120
+ }
121
+ // Hydrate emits patches directly here. Replaying against serialized order
122
+ // keeps insert targets in the main-thread slot without reshaping background.
123
+ const removalIndexes = new Set(listDiff.removals);
124
+ const { insertions, moves } = listDiff;
125
+ const movesWaitingForInsertionPoint = new Map();
126
+ let serializedCursor = 0;
127
+ let currentSerializedChild = serializedChildren[serializedCursor];
128
+ let newIndex = 0;
129
+ let oldIndex = 0;
130
+ // Insertions are known before replay starts. Moves are counted only when their
131
+ // old serialized position is reached, so the cursor can keep emitting patches
132
+ // even after all serialized children have been consumed.
133
+ let insertOrMovePatchesWaitingForInsertionPoint = listDiff.insertionCount;
134
+ while (currentSerializedChild || insertOrMovePatchesWaitingForInsertionPoint > 0) {
135
+ let keepCurrentSerializedChild = false;
136
+ if (currentSerializedChild && removalIndexes.has(oldIndex)) {
137
+ emitSerializedSubtreeRemove(parent, slotId, currentSerializedChild);
138
+ }
139
+ else if (currentSerializedChild && moves[oldIndex] !== undefined) {
140
+ const move = moves[oldIndex];
141
+ movesWaitingForInsertionPoint.set(move.toIndex, move.instance);
142
+ insertOrMovePatchesWaitingForInsertionPoint += 1;
143
+ }
144
+ else {
145
+ const beforeChildId = currentSerializedChild ? currentSerializedChild.uid : 0;
146
+ const movedChild = movesWaitingForInsertionPoint.get(newIndex);
147
+ if (movedChild) {
148
+ keepCurrentSerializedChild = true;
149
+ globalCommitContext.ops.push(ElementTemplateUpdateOps.insertNode, parent.instanceId, slotId, movedChild.instanceId, beforeChildId);
150
+ insertOrMovePatchesWaitingForInsertionPoint -= 1;
151
+ }
152
+ else if (insertions[newIndex] !== undefined) {
153
+ const insertedChild = insertions[newIndex];
154
+ keepCurrentSerializedChild = true;
155
+ emitCreateSubtree(insertedChild);
156
+ globalCommitContext.ops.push(ElementTemplateUpdateOps.insertNode, parent.instanceId, slotId, insertedChild.instanceId, beforeChildId);
157
+ insertOrMovePatchesWaitingForInsertionPoint -= 1;
158
+ }
159
+ newIndex += 1;
160
+ }
161
+ if (currentSerializedChild && !keepCurrentSerializedChild) {
162
+ currentSerializedChild = serializedChildren[++serializedCursor];
163
+ oldIndex += 1;
164
+ }
165
+ }
166
+ return true;
167
+ }
168
+ function emitSerializedSubtreeRemove(parent, slotId, serialized) {
169
+ const childId = serialized.uid;
170
+ const existing = backgroundElementTemplateInstanceManager.get(childId);
171
+ // The removed child may no longer have a live background instance in this
172
+ // slot, so serialized data is the source of truth for registry cleanup.
173
+ const removedSubtreeHandleIds = [];
174
+ collectSerializedSubtreeHandleIdsInto(serialized, removedSubtreeHandleIds);
175
+ globalCommitContext.ops.push(ElementTemplateUpdateOps.removeNode, parent.instanceId, slotId, childId, removedSubtreeHandleIds);
176
+ if (existing && !existing.parent) {
177
+ markRemovedSubtreeForPostDispatchTeardown(existing);
178
+ }
179
+ }
180
+ function collectSerializedSubtreeHandleIdsInto(serialized, handles) {
181
+ handles.push(serialized.uid);
182
+ for (const slotChildren of serialized.elementSlots ?? []) {
183
+ if (!slotChildren) {
184
+ continue;
185
+ }
186
+ for (const child of slotChildren) {
187
+ collectSerializedSubtreeHandleIdsInto(child, handles);
188
+ }
189
+ }
190
+ }
191
+ function emitCreateSubtree(node) {
192
+ // Linked-list walk: slot grouping would be discarded since we recurse into
193
+ // every child regardless of slot. `emitCreate` does its own single-walk
194
+ // serialization of `instanceId`s grouped by slot.
195
+ let child = node.firstChild;
196
+ while (child) {
197
+ emitCreateSubtree(child);
198
+ child = child.nextSibling;
199
+ }
200
+ node.prepareAttributeSlotsForHydration();
201
+ node.emitCreate();
202
+ }
203
+ function bindHydrationHandleId(instance, handleId, templateKey) {
204
+ const oldHandleId = instance.instanceId;
205
+ try {
206
+ backgroundElementTemplateInstanceManager.updateId(instance.instanceId, handleId);
207
+ // Ref proxies created before hydrate keep the old background id; resolve it
208
+ // lazily so user-held proxies continue selecting the hydrated native node.
209
+ hydrationMap.set(oldHandleId, handleId);
210
+ instance.markMaterializedByHydration();
211
+ return true;
212
+ }
213
+ catch (error) {
214
+ if (__DEV__) {
215
+ const reason = error instanceof Error ? error.message : String(error);
216
+ lynx.reportError(new Error(`ElementTemplate hydrate received invalid uid ${handleId} for '${templateKey}': ${reason}`));
217
+ }
218
+ return false;
219
+ }
220
+ }
221
+ function hydrateAttributeSlots(handleId, beforeSlots, afterSlots) {
222
+ const slotCount = Math.max(beforeSlots.length, afterSlots.length);
223
+ for (let slotIndex = 0; slotIndex < slotCount; slotIndex += 1) {
224
+ const beforeValue = beforeSlots[slotIndex];
225
+ const afterValue = afterSlots[slotIndex];
226
+ if (isDirectOrDeepEqual(beforeValue, afterValue)) {
227
+ continue;
228
+ }
229
+ if (afterValue === undefined && beforeValue === null) {
230
+ // JSON serialization turns undefined array slots into null on the main-thread payload.
231
+ continue;
232
+ }
233
+ globalCommitContext.ops.push(ElementTemplateUpdateOps.setAttribute, handleId, slotIndex, afterValue ?? null);
234
+ }
235
+ }
236
+ //# sourceMappingURL=hydrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydrate.js","sourceRoot":"","sources":["../../../src/element-template/background/hydrate.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EACL,mBAAmB,EACnB,yCAAyC,EACzC,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,wCAAwC,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAOlE,MAAM,UAAU,OAAO,CACrB,UAAqC,EACrC,QAA2C;IAE3C,wBAAwB,EAAE,CAAC;IAC3B,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC9C,yEAAyE;QACzE,yEAAyE;QACzE,kFAAkF;QAClF,wBAAwB,EAAE,CAAC;IAC7B,CAAC;IACD,OAAO,mBAAmB,CAAC,GAAG,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,UAAqC,EACrC,QAA2C;IAE3C,OAAO,eAAe,CAAC,UAAU,EAAE,QAAQ,C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AM,WAAW,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;QAC3C,MAAM,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,mBAAmB,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,CAAC;YACjD,SAAS;QACX,CAAC;QACD,IAAI,UAAU,KAAK,SAAS,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;YACrD,uFAAuF;YACvF,SAAS;QACX,CAAC;QACD,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAC1B,wBAAwB,CAAC,YAAY,EACrC,QAAQ,EACR,SAAS,EACT,UAAU,IAAI,IAAI,CACnB,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function installElementTemplateHydrationListener(): void;
2
+ export declare function resetElementTemplateHydrationListener(): void;
@@ -0,0 +1,139 @@
1
+ // Copyright 2026 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ import { globalCommitContext, resetGlobalCommitContext, takeRemovedSubtreesForPostDispatchTeardown, } from './commit-context.js';
5
+ import { markElementTemplateHydrated, resetElementTemplateCommitState, scheduleElementTemplateRemovedSubtreeCleanup, } from './commit-hook.js';
6
+ import { hydrateIntoContext } from './hydrate.js';
7
+ import { BackgroundElementTemplateInstance } from './instance.js';
8
+ import { getReloadVersion } from '../../core/reload-version.js';
9
+ import { formatElementTemplateUpdateCommands, printElementTemplateTreeToString } from '../debug/alog.js';
10
+ import { profileEnd, profileStart } from '../debug/profile.js';
11
+ import { PerformanceTimingFlags, PipelineOrigins, beginPipeline, markTiming } from '../lynx/performance.js';
12
+ import { clearPendingEvents, flushPendingEvents } from '../prop-adapters/event.js';
13
+ import { clearDelayedRefUiOps, clearPendingRefs, flushDelayedRefUiOps } from '../prop-adapters/ref.js';
14
+ import { ElementTemplateLifecycleConstant } from '../protocol/lifecycle-constant.js';
15
+ import { __root } from '../runtime/page/root-instance.js';
16
+ let listener;
17
+ export function installElementTemplateHydrationListener() {
18
+ resetElementTemplateHydrationListener();
19
+ resetElementTemplateCommitState();
20
+ listener = (event) => {
21
+ const { data } = event;
22
+ let instances;
23
+ if (Array.isArray(data)) {
24
+ instances = data;
25
+ }
26
+ else {
27
+ const payload = data;
28
+ if (typeof payload.reloadVersion === 'number' && payload.reloadVersion < getReloadVersion()) {
29
+ return;
30
+ }
31
+ instances = payload.instances;
32
+ }
33
+ if (__PROFILE__) {
34
+ profileStart('ReactLynx::hydrate');
35
+ }
36
+ beginPipeline(true, PipelineOrigins.reactLynxHydrate, PerformanceTimingFlags.reactLynxHydrate);
37
+ markTiming('hydrateParsePayloadStart');
38
+ markTiming('hydrateParsePayloadEnd');
39
+ markTiming('diffVdomStart');
40
+ const root = __root;
41
+ resetGlobalCommitContext();
42
+ if (typeof __ALOG__ !== 'undefined' && __ALOG__) {
43
+ console.alog?.('[ReactLynxDebug] ElementTemplate MTS -> BTS hydrate:\n'
44
+ + JSON.stringify({ data: instances }, null, 2));
45
+ console.alog?.('[ReactLynxDebug] BackgroundElementTemplate tree before hydration:\n'
46
+ + printElementTemplateTreeToString(root));
47
+ }
48
+ let after = root.firstChild;
49
+ let didHydrateMatchedInstances = true;
50
+ for (const before of instances) {
51
+ if (!after) {
52
+ break;
53
+ }
54
+ if (!('templateKey' in before)) {
55
+ if (__DEV__) {
56
+ lynx.reportError(new Error(`ElementTemplate hydrate does not support serialized typed root '${before.type}'.`));
57
+ }
58
+ didHydrateMatchedInstances = false;
59
+ break;
60
+ }
61
+ if (!hydrateIntoContext(before, after)) {
62
+ didHydrateMatchedInstances = false;
63
+ break;
64
+ }
65
+ after = after.nextSibling;
66
+ }
67
+ if (typeof __ALOG__ !== 'undefined' && __ALOG__) {
68
+ console.alog?.('[ReactLynxDebug] BackgroundElementTemplate tree after hydration:\n'
69
+ + printElementTemplateTreeToString(root));
70
+ }
71
+ if (__PROFILE__) {
72
+ profileEnd();
73
+ }
74
+ markTiming('diffVdomEnd');
75
+ if (didHydrateMatchedInstances) {
76
+ markElementTemplateHydrated();
77
+ }
78
+ else {
79
+ // Hydrate is not transactional; a later failure can happen after earlier
80
+ // nodes were rebound. Treat the pass as failed for externally observable
81
+ // work, so delayed refs/events are not released from an incomplete tree.
82
+ clearPendingEvents();
83
+ clearPendingRefs();
84
+ clearDelayedRefUiOps();
85
+ resetGlobalCommitContext();
86
+ }
87
+ const hasHydrateUpdate = didHydrateMatchedInstances && globalCommitContext.ops.length > 0;
88
+ let didDispatchHydrateUpdate = false;
89
+ if (hasHydrateUpdate) {
90
+ if (typeof __ALOG__ !== 'undefined' && __ALOG__) {
91
+ console.alog?.('[ReactLynxDebug] ElementTemplate hydrate update commands:\n'
92
+ + JSON.stringify({
93
+ ops: formatElementTemplateUpdateCommands(globalCommitContext.ops),
94
+ flushOptions: globalCommitContext.flushOptions,
95
+ flowIds: globalCommitContext.flowIds,
96
+ }, null, 2));
97
+ }
98
+ const removedSubtreesAwaitingTeardown = takeRemovedSubtreesForPostDispatchTeardown();
99
+ try {
100
+ lynx.getCoreContext().dispatchEvent({
101
+ type: ElementTemplateLifecycleConstant.update,
102
+ data: {
103
+ ops: globalCommitContext.ops,
104
+ flushOptions: globalCommitContext.flushOptions,
105
+ flowIds: globalCommitContext.flowIds,
106
+ reloadVersion: getReloadVersion(),
107
+ },
108
+ });
109
+ didDispatchHydrateUpdate = true;
110
+ }
111
+ finally {
112
+ if (!didDispatchHydrateUpdate) {
113
+ // Do not expose refs or replay delayed selector ops if the hydrate
114
+ // patch failed to reach the main thread; selectors may still point at
115
+ // stale pre-hydration ids in that case.
116
+ clearPendingEvents();
117
+ clearPendingRefs();
118
+ clearDelayedRefUiOps();
119
+ }
120
+ resetGlobalCommitContext();
121
+ scheduleElementTemplateRemovedSubtreeCleanup(removedSubtreesAwaitingTeardown);
122
+ }
123
+ }
124
+ if (didHydrateMatchedInstances && (!hasHydrateUpdate || didDispatchHydrateUpdate)) {
125
+ flushPendingEvents();
126
+ // Ordinary refs attach on Preact commit boundaries; hydration only releases
127
+ // delayed selector ops after ids have been rebound to stable native handles.
128
+ flushDelayedRefUiOps();
129
+ }
130
+ };
131
+ lynx.getCoreContext().addEventListener(ElementTemplateLifecycleConstant.hydrate, listener);
132
+ }
133
+ export function resetElementTemplateHydrationListener() {
134
+ if (listener) {
135
+ lynx.getCoreContext().removeEventListener(ElementTemplateLifecycleConstant.hydrate, listener);
136
+ }
137
+ listener = undefined;
138
+ }
139
+ //# sourceMappingURL=hydration-listener.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydration-listener.js","sourceRoot":"","sources":["../../../src/element-template/background/hydration-listener.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,0CAA0C,GAC3C,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,4CAA4C,GAC7C,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,mCAAmC,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AACzG,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC5G,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACvG,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAMrF,O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CAAC;YACrB,4EAA4E;YAC5E,6EAA6E;YAC7E,oBAAoB,EAAE,CAAC;QACzB,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,CAAC,cAAc,EAAE,CAAC,gBAAgB,CAAC,gCAAgC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC7F,CAAC;AAED,MAAM,UAAU,qCAAqC;IACnD,IAAI,QAAQ,EAAE,CAAC;QACb,IAAI,CAAC,cAAc,EAAE,CAAC,mBAAmB,CAAC,gCAAgC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAChG,CAAC;IACD,QAAQ,GAAG,SAAS,CAAC;AACvB,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { SerializableValue } from '../protocol/types.js';
2
+ export declare const BUILTIN_RAW_TEXT_TEMPLATE_KEY = "_et_builtin_raw_text";
3
+ export declare class BackgroundElementTemplateInstance {
4
+ instanceId: number;
5
+ type: string;
6
+ parent: BackgroundElementTemplateInstance | null;
7
+ firstChild: BackgroundElementTemplateInstance | null;
8
+ lastChild: BackgroundElementTemplateInstance | null;
9
+ nextSibling: BackgroundElementTemplateInstance | null;
10
+ previousSibling: BackgroundElementTemplateInstance | null;
11
+ __slotIndex: number;
12
+ attributeSlots: SerializableValue[];
13
+ private rawAttributeSlots;
14
+ private isMaterializedOnMainThread;
15
+ get parentNode(): BackgroundElementTemplateInstance | null;
16
+ get childNodes(): BackgroundElementTemplateInstance[];
17
+ get elementSlots(): BackgroundElementTemplateInstance[][];
18
+ nodeType: number;
19
+ constructor(type: string, initialAttributeSlots?: SerializableValue[]);
20
+ emitCreate(): void;
21
+ private needsMainThreadCreate;
22
+ emitMainThreadCreateIfNeeded(): void;
23
+ private canEmitUpdatePatch;
24
+ appendChild(child: BackgroundElementTemplateInstance): void;
25
+ insertBefore(child: BackgroundElementTemplateInstance, beforeChild: BackgroundElementTemplateInstance | null, silent?: boolean): void;
26
+ removeChild(child: BackgroundElementTemplateInstance, silent?: boolean): void;
27
+ tearDown(): void;
28
+ queueRefCleanupForSubtree(): void;
29
+ getRawAttributeSlot(attrSlotIndex: number): unknown;
30
+ markMaterializedByHydration(): void;
31
+ prepareAttributeSlotsForNative(options?: {
32
+ queueRefEffects?: boolean;
33
+ }): void;
34
+ prepareAttributeSlotsForHydration(): void;
35
+ setAttribute(key: string, value: unknown): void;
36
+ get text(): string;
37
+ set text(value: string);
38
+ get data(): string;
39
+ set data(value: string);
40
+ }
41
+ export declare function collectElementTemplateSubtreeHandleIds(root: BackgroundElementTemplateInstance): number[];