@lynx-js/react 0.119.0 → 0.121.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 (549) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/package.json +39 -11
  3. package/runtime/lazy/compat.js +1 -0
  4. package/runtime/lazy/internal.js +3 -0
  5. package/runtime/lazy/react.js +1 -0
  6. package/runtime/lib/core/hooks/mainThread.d.ts +1 -0
  7. package/runtime/lib/core/hooks/mainThread.js +7 -0
  8. package/runtime/lib/core/hooks/mainThread.js.map +1 -0
  9. package/runtime/lib/{hooks/mainThread.d.ts → core/hooks/mainThreadImpl.d.ts} +2 -1
  10. package/runtime/lib/{hooks/mainThread.js → core/hooks/mainThreadImpl.js} +46 -35
  11. package/runtime/lib/core/hooks/mainThreadImpl.js.map +1 -0
  12. package/runtime/lib/{hooks → core/hooks}/react.js +1 -1
  13. package/runtime/lib/core/hooks/react.js.map +1 -0
  14. package/runtime/lib/{hooks → core/hooks}/useLynxGlobalEventListener.d.ts +1 -1
  15. package/runtime/lib/{hooks → core/hooks}/useLynxGlobalEventListener.js +1 -1
  16. package/runtime/lib/core/hooks/useLynxGlobalEventListener.js.map +1 -0
  17. package/runtime/lib/document.d.ts +4 -4
  18. package/runtime/lib/document.js +14 -12
  19. package/runtime/lib/document.js.map +1 -1
  20. package/runtime/lib/element-template/background/attr-slots.d.ts +2 -0
  21. package/runtime/lib/element-template/background/attr-slots.js +34 -0
  22. package/runtime/lib/element-template/background/attr-slots.js.map +1 -0
  23. package/runtime/lib/element-template/background/commit-context.d.ts +13 -0
  24. package/runtime/lib/element-template/background/commit-context.js +25 -0
  25. package/runtime/lib/element-template/background/commit-context.js.map +1 -0
  26. package/runtime/lib/element-template/background/commit-hook.d.ts +7 -0
  27. package/runtime/lib/element-template/background/commit-hook.js +96 -0
  28. package/runtime/lib/element-template/background/commit-hook.js.map +1 -0
  29. package/runtime/lib/element-template/background/destroy.d.ts +1 -0
  30. package/runtime/lib/element-template/background/destroy.js +17 -0
  31. package/runtime/lib/element-template/background/destroy.js.map +1 -0
  32. package/runtime/lib/element-template/background/document.d.ts +7 -0
  33. package/runtime/lib/element-template/background/document.js +27 -0
  34. package/runtime/lib/element-template/background/document.js.map +1 -0
  35. package/runtime/lib/element-template/background/hydrate.d.ts +4 -0
  36. package/runtime/lib/element-template/background/hydrate.js +219 -0
  37. package/runtime/lib/element-template/background/hydrate.js.map +1 -0
  38. package/runtime/lib/element-template/background/hydration-listener.d.ts +2 -0
  39. package/runtime/lib/element-template/background/hydration-listener.js +93 -0
  40. package/runtime/lib/element-template/background/hydration-listener.js.map +1 -0
  41. package/runtime/lib/element-template/background/instance.d.ts +39 -0
  42. package/runtime/lib/element-template/background/instance.js +349 -0
  43. package/runtime/lib/element-template/background/instance.js.map +1 -0
  44. package/runtime/lib/element-template/background/manager.d.ts +10 -0
  45. package/runtime/lib/element-template/background/manager.js +60 -0
  46. package/runtime/lib/element-template/background/manager.js.map +1 -0
  47. package/runtime/lib/element-template/client/root.d.ts +36 -0
  48. package/runtime/lib/element-template/client/root.js +33 -0
  49. package/runtime/lib/element-template/client/root.js.map +1 -0
  50. package/runtime/lib/element-template/debug/alog.d.ts +34 -0
  51. package/runtime/lib/element-template/debug/alog.js +93 -0
  52. package/runtime/lib/element-template/debug/alog.js.map +1 -0
  53. package/runtime/lib/element-template/debug/elementPAPICall.d.ts +1 -0
  54. package/runtime/lib/element-template/debug/elementPAPICall.js +75 -0
  55. package/runtime/lib/element-template/debug/elementPAPICall.js.map +1 -0
  56. package/runtime/lib/element-template/debug/profile.d.ts +3 -0
  57. package/runtime/lib/element-template/debug/profile.js +141 -0
  58. package/runtime/lib/element-template/debug/profile.js.map +1 -0
  59. package/runtime/lib/element-template/hooks/react.d.ts +14 -0
  60. package/runtime/lib/element-template/hooks/react.js +24 -0
  61. package/runtime/lib/element-template/hooks/react.js.map +1 -0
  62. package/runtime/lib/element-template/index.d.ts +7 -0
  63. package/runtime/lib/element-template/index.js +45 -0
  64. package/runtime/lib/element-template/index.js.map +1 -0
  65. package/runtime/lib/element-template/internal.d.ts +6 -0
  66. package/runtime/lib/element-template/internal.js +44 -0
  67. package/runtime/lib/element-template/internal.js.map +1 -0
  68. package/runtime/lib/element-template/jsx-dev-runtime/index.d.ts +1 -0
  69. package/runtime/lib/element-template/jsx-dev-runtime/index.js +5 -0
  70. package/runtime/lib/element-template/jsx-dev-runtime/index.js.map +1 -0
  71. package/runtime/lib/element-template/jsx-runtime/index.d.ts +19 -0
  72. package/runtime/lib/element-template/jsx-runtime/index.js +60 -0
  73. package/runtime/lib/element-template/jsx-runtime/index.js.map +1 -0
  74. package/runtime/lib/element-template/lynx/env.js +89 -0
  75. package/runtime/lib/element-template/lynx/env.js.map +1 -0
  76. package/runtime/lib/element-template/lynx/performance.d.ts +23 -0
  77. package/runtime/lib/element-template/lynx/performance.js +135 -0
  78. package/runtime/lib/element-template/lynx/performance.js.map +1 -0
  79. package/runtime/lib/element-template/native/callDestroyLifetimeFun.d.ts +1 -0
  80. package/runtime/lib/element-template/native/callDestroyLifetimeFun.js +8 -0
  81. package/runtime/lib/element-template/native/callDestroyLifetimeFun.js.map +1 -0
  82. package/runtime/lib/element-template/native/index.d.ts +1 -0
  83. package/runtime/lib/element-template/native/index.js +53 -0
  84. package/runtime/lib/element-template/native/index.js.map +1 -0
  85. package/runtime/lib/element-template/native/main-thread-api.js +27 -0
  86. package/runtime/lib/element-template/native/main-thread-api.js.map +1 -0
  87. package/runtime/lib/element-template/native/mts-destroy.d.ts +3 -0
  88. package/runtime/lib/element-template/native/mts-destroy.js +37 -0
  89. package/runtime/lib/element-template/native/mts-destroy.js.map +1 -0
  90. package/runtime/lib/element-template/native/patch-listener.d.ts +2 -0
  91. package/runtime/lib/element-template/native/patch-listener.js +66 -0
  92. package/runtime/lib/element-template/native/patch-listener.js.map +1 -0
  93. package/runtime/lib/element-template/prop-adapters/event-value.d.ts +1 -0
  94. package/runtime/lib/element-template/prop-adapters/event-value.js +7 -0
  95. package/runtime/lib/element-template/prop-adapters/event-value.js.map +1 -0
  96. package/runtime/lib/element-template/prop-adapters/event.d.ts +7 -0
  97. package/runtime/lib/element-template/prop-adapters/event.js +61 -0
  98. package/runtime/lib/element-template/prop-adapters/event.js.map +1 -0
  99. package/runtime/lib/element-template/prop-adapters/spread.d.ts +5 -0
  100. package/runtime/lib/element-template/prop-adapters/spread.js +45 -0
  101. package/runtime/lib/element-template/prop-adapters/spread.js.map +1 -0
  102. package/runtime/lib/element-template/protocol/lifecycle-constant.d.ts +4 -0
  103. package/runtime/lib/element-template/protocol/lifecycle-constant.js +9 -0
  104. package/runtime/lib/element-template/protocol/lifecycle-constant.js.map +1 -0
  105. package/runtime/lib/element-template/protocol/opcodes.d.ts +7 -0
  106. package/runtime/lib/element-template/protocol/opcodes.js +10 -0
  107. package/runtime/lib/element-template/protocol/opcodes.js.map +1 -0
  108. package/runtime/lib/element-template/protocol/types.d.ts +50 -0
  109. package/runtime/lib/element-template/protocol/types.js +5 -0
  110. package/runtime/lib/element-template/protocol/types.js.map +1 -0
  111. package/runtime/lib/element-template/runtime/components/slot.js +11 -0
  112. package/runtime/lib/element-template/runtime/components/slot.js.map +1 -0
  113. package/runtime/lib/element-template/runtime/page/page.d.ts +2 -0
  114. package/runtime/lib/element-template/runtime/page/page.js +8 -0
  115. package/runtime/lib/element-template/runtime/page/page.js.map +1 -0
  116. package/runtime/lib/element-template/runtime/page/root-instance.d.ts +10 -0
  117. package/runtime/lib/element-template/runtime/page/root-instance.js +17 -0
  118. package/runtime/lib/element-template/runtime/page/root-instance.js.map +1 -0
  119. package/runtime/lib/element-template/runtime/patch.d.ts +3 -0
  120. package/runtime/lib/element-template/runtime/patch.js +145 -0
  121. package/runtime/lib/element-template/runtime/patch.js.map +1 -0
  122. package/runtime/lib/element-template/runtime/render/render-main-thread.js +53 -0
  123. package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -0
  124. package/runtime/lib/element-template/runtime/render/render-opcodes.d.ts +4 -0
  125. package/runtime/lib/element-template/runtime/render/render-opcodes.js +134 -0
  126. package/runtime/lib/element-template/runtime/render/render-opcodes.js.map +1 -0
  127. package/runtime/lib/element-template/runtime/render/render-to-opcodes.d.ts +14 -0
  128. package/runtime/lib/element-template/runtime/render/render-to-opcodes.js +272 -0
  129. package/runtime/lib/element-template/runtime/render/render-to-opcodes.js.map +1 -0
  130. package/runtime/lib/element-template/runtime/template/attr-slot-plan.d.ts +11 -0
  131. package/runtime/lib/element-template/runtime/template/attr-slot-plan.js +23 -0
  132. package/runtime/lib/element-template/runtime/template/attr-slot-plan.js.map +1 -0
  133. package/runtime/lib/element-template/runtime/template/handle.d.ts +5 -0
  134. package/runtime/lib/element-template/runtime/template/handle.js +23 -0
  135. package/runtime/lib/element-template/runtime/template/handle.js.map +1 -0
  136. package/runtime/lib/element-template/runtime/template/registry.d.ts +13 -0
  137. package/runtime/lib/element-template/runtime/template/registry.js +46 -0
  138. package/runtime/lib/element-template/runtime/template/registry.js.map +1 -0
  139. package/runtime/lib/index.d.ts +7 -5
  140. package/runtime/lib/index.js +9 -6
  141. package/runtime/lib/index.js.map +1 -1
  142. package/runtime/lib/internal.d.ts +22 -20
  143. package/runtime/lib/internal.js +26 -23
  144. package/runtime/lib/internal.js.map +1 -1
  145. package/runtime/lib/lynx-api.d.ts +5 -5
  146. package/runtime/lib/lynx-api.js +9 -9
  147. package/runtime/lib/lynx-api.js.map +1 -1
  148. package/runtime/lib/lynx.d.ts +2 -2
  149. package/runtime/lib/lynx.js +17 -17
  150. package/runtime/lib/lynx.js.map +1 -1
  151. package/runtime/lib/root.d.ts +2 -2
  152. package/runtime/lib/root.js +2 -2
  153. package/runtime/lib/root.js.map +1 -1
  154. package/runtime/lib/{debug → shared}/component-stack.js +1 -1
  155. package/runtime/lib/shared/component-stack.js.map +1 -0
  156. package/runtime/lib/{debug → shared}/profile.js +6 -4
  157. package/runtime/lib/shared/profile.js.map +1 -0
  158. package/runtime/lib/{renderToOpcodes/constants.js → shared/render-constants.js} +1 -1
  159. package/runtime/lib/shared/render-constants.js.map +1 -0
  160. package/runtime/lib/{alog → snapshot/alog}/elementPAPICall.js +1 -1
  161. package/runtime/lib/snapshot/alog/elementPAPICall.js.map +1 -0
  162. package/runtime/lib/snapshot/alog/index.js.map +1 -0
  163. package/runtime/lib/{alog → snapshot/alog}/render.js +2 -2
  164. package/runtime/lib/snapshot/alog/render.js.map +1 -0
  165. package/runtime/lib/snapshot/compat/componentIs.js.map +1 -0
  166. package/runtime/lib/{compat → snapshot/compat}/initData.d.ts +2 -2
  167. package/runtime/lib/{compat → snapshot/compat}/initData.js +1 -1
  168. package/runtime/lib/snapshot/compat/initData.js.map +1 -0
  169. package/runtime/lib/snapshot/compat/lynxComponent.js.map +1 -0
  170. package/runtime/lib/snapshot/debug/debug.js.map +1 -0
  171. package/runtime/lib/snapshot/debug/describeInvalidValue.js.map +1 -0
  172. package/runtime/lib/snapshot/debug/formatPatch.js.map +1 -0
  173. package/runtime/lib/snapshot/debug/printSnapshot.js.map +1 -0
  174. package/runtime/lib/{debug → snapshot/debug}/profileHooks.js +2 -2
  175. package/runtime/lib/snapshot/debug/profileHooks.js.map +1 -0
  176. package/runtime/lib/{debug → snapshot/debug}/vnodeSource.js +1 -1
  177. package/runtime/lib/snapshot/debug/vnodeSource.js.map +1 -0
  178. package/runtime/lib/{gesture → snapshot/gesture}/processGesture.d.ts +2 -0
  179. package/runtime/lib/{gesture → snapshot/gesture}/processGesture.js +40 -3
  180. package/runtime/lib/snapshot/gesture/processGesture.js.map +1 -0
  181. package/runtime/lib/snapshot/gesture/processGestureBagkround.d.ts +9 -0
  182. package/runtime/lib/snapshot/gesture/processGestureBagkround.js +80 -0
  183. package/runtime/lib/snapshot/gesture/processGestureBagkround.js.map +1 -0
  184. package/runtime/lib/snapshot/gesture/types.js.map +1 -0
  185. package/runtime/lib/snapshot/index.d.ts +1 -4
  186. package/runtime/lib/snapshot/index.js +2 -5
  187. package/runtime/lib/snapshot/index.js.map +1 -1
  188. package/runtime/lib/{legacy-react-runtime → snapshot/legacy-react-runtime}/index.d.ts +2 -2
  189. package/runtime/lib/{legacy-react-runtime → snapshot/legacy-react-runtime}/index.js +2 -2
  190. package/runtime/lib/snapshot/legacy-react-runtime/index.js.map +1 -0
  191. package/runtime/lib/snapshot/lifecycle/constant.js.map +1 -0
  192. package/runtime/lib/{lifecycle → snapshot/lifecycle}/destroy.js +2 -2
  193. package/runtime/lib/snapshot/lifecycle/destroy.js.map +1 -0
  194. package/runtime/lib/snapshot/lifecycle/event/delayEvents.js.map +1 -0
  195. package/runtime/lib/snapshot/lifecycle/event/delayLifecycleEvents.js.map +1 -0
  196. package/runtime/lib/{lifecycle → snapshot/lifecycle}/event/jsReady.js +2 -2
  197. package/runtime/lib/snapshot/lifecycle/event/jsReady.js.map +1 -0
  198. package/runtime/lib/{lifecycle → snapshot/lifecycle}/isRendering.js +2 -2
  199. package/runtime/lib/snapshot/lifecycle/isRendering.js.map +1 -0
  200. package/runtime/lib/snapshot/lifecycle/pass.js.map +1 -0
  201. package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/commit.js +3 -3
  202. package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -0
  203. package/runtime/lib/snapshot/lifecycle/patch/error.js.map +1 -0
  204. package/runtime/lib/snapshot/lifecycle/patch/globalState.js.map +1 -0
  205. package/runtime/lib/snapshot/lifecycle/patch/isMainThreadHydrating.js.map +1 -0
  206. package/runtime/lib/snapshot/lifecycle/patch/nodesRefApply.d.ts +15 -0
  207. package/runtime/lib/snapshot/lifecycle/patch/nodesRefApply.js +102 -0
  208. package/runtime/lib/snapshot/lifecycle/patch/nodesRefApply.js.map +1 -0
  209. package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/snapshotPatch.d.ts +2 -0
  210. package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/snapshotPatch.js +27 -2
  211. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js.map +1 -0
  212. package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/snapshotPatchApply.js +28 -0
  213. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js.map +1 -0
  214. package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -0
  215. package/runtime/lib/{lifecycle → snapshot/lifecycle}/ref/delay.d.ts +1 -0
  216. package/runtime/lib/{lifecycle → snapshot/lifecycle}/ref/delay.js +5 -3
  217. package/runtime/lib/snapshot/lifecycle/ref/delay.js.map +1 -0
  218. package/runtime/lib/{lifecycle → snapshot/lifecycle}/reload.js +3 -3
  219. package/runtime/lib/snapshot/lifecycle/reload.js.map +1 -0
  220. package/runtime/lib/snapshot/lifecycle/render.d.ts +2 -0
  221. package/runtime/lib/{lifecycle → snapshot/lifecycle}/render.js +2 -2
  222. package/runtime/lib/snapshot/lifecycle/render.js.map +1 -0
  223. package/runtime/lib/{list → snapshot/list}/list.js +5 -2
  224. package/runtime/lib/snapshot/list/list.js.map +1 -0
  225. package/runtime/lib/{list → snapshot/list}/listUpdateInfo.js +1 -1
  226. package/runtime/lib/snapshot/list/listUpdateInfo.js.map +1 -0
  227. package/runtime/lib/snapshot/list/pendingListUpdates.js.map +1 -0
  228. package/runtime/lib/snapshot/lynx/calledByNative.d.ts +2 -0
  229. package/runtime/lib/{lynx → snapshot/lynx}/calledByNative.js +2 -2
  230. package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -0
  231. package/runtime/lib/{lynx → snapshot/lynx}/component.js +1 -1
  232. package/runtime/lib/snapshot/lynx/component.js.map +1 -0
  233. package/runtime/lib/snapshot/lynx/dynamic-js.js.map +1 -0
  234. package/runtime/lib/snapshot/lynx/element.d.ts +6 -0
  235. package/runtime/lib/snapshot/lynx/element.js +35 -0
  236. package/runtime/lib/snapshot/lynx/element.js.map +1 -0
  237. package/runtime/lib/snapshot/lynx/env.d.ts +1 -0
  238. package/runtime/lib/{lynx → snapshot/lynx}/env.js +1 -4
  239. package/runtime/lib/snapshot/lynx/env.js.map +1 -0
  240. package/runtime/lib/snapshot/lynx/injectLepusMethods.js.map +1 -0
  241. package/runtime/lib/snapshot/lynx/lazy-bundle.js.map +1 -0
  242. package/runtime/lib/snapshot/lynx/nodesRef.d.ts +6 -0
  243. package/runtime/lib/snapshot/lynx/nodesRef.js +31 -0
  244. package/runtime/lib/snapshot/lynx/nodesRef.js.map +1 -0
  245. package/runtime/lib/{lynx → snapshot/lynx}/performance.js +2 -2
  246. package/runtime/lib/snapshot/lynx/performance.js.map +1 -0
  247. package/runtime/lib/snapshot/lynx/portals.d.ts +9 -0
  248. package/runtime/lib/snapshot/lynx/portals.js +120 -0
  249. package/runtime/lib/snapshot/lynx/portals.js.map +1 -0
  250. package/runtime/lib/snapshot/lynx/portalsPending.d.ts +10 -0
  251. package/runtime/lib/snapshot/lynx/portalsPending.js +38 -0
  252. package/runtime/lib/snapshot/lynx/portalsPending.js.map +1 -0
  253. package/runtime/lib/{lynx → snapshot/lynx}/runWithForce.js +2 -2
  254. package/runtime/lib/snapshot/lynx/runWithForce.js.map +1 -0
  255. package/runtime/lib/{lynx → snapshot/lynx}/suspense.js +27 -17
  256. package/runtime/lib/snapshot/lynx/suspense.js.map +1 -0
  257. package/runtime/lib/{lynx → snapshot/lynx}/tt.js +3 -3
  258. package/runtime/lib/snapshot/lynx/tt.js.map +1 -0
  259. package/runtime/lib/{renderToOpcodes → snapshot/renderToOpcodes}/hydrate.js +22 -5
  260. package/runtime/lib/snapshot/renderToOpcodes/hydrate.js.map +1 -0
  261. package/runtime/lib/{renderToOpcodes → snapshot/renderToOpcodes}/index.js +35 -14
  262. package/runtime/lib/snapshot/renderToOpcodes/index.js.map +1 -0
  263. package/runtime/lib/{renderToOpcodes → snapshot/renderToOpcodes}/opcodes.js +5 -3
  264. package/runtime/lib/snapshot/renderToOpcodes/opcodes.js.map +1 -0
  265. package/runtime/lib/snapshot/{backgroundSnapshot.d.ts → snapshot/backgroundSnapshot.d.ts} +2 -1
  266. package/runtime/lib/snapshot/{backgroundSnapshot.js → snapshot/backgroundSnapshot.js} +101 -73
  267. package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -0
  268. package/runtime/lib/snapshot/{constants.d.ts → snapshot/constants.d.ts} +4 -0
  269. package/runtime/lib/snapshot/{constants.js → snapshot/constants.js} +4 -0
  270. package/runtime/lib/snapshot/snapshot/constants.js.map +1 -0
  271. package/runtime/lib/snapshot/{definition.d.ts → snapshot/definition.d.ts} +2 -0
  272. package/runtime/lib/snapshot/{definition.js → snapshot/definition.js} +55 -3
  273. package/runtime/lib/snapshot/snapshot/definition.js.map +1 -0
  274. package/runtime/lib/snapshot/{dynamicPartType.d.ts → snapshot/dynamicPartType.d.ts} +14 -0
  275. package/runtime/lib/snapshot/{dynamicPartType.js → snapshot/dynamicPartType.js} +14 -0
  276. package/runtime/lib/snapshot/snapshot/dynamicPartType.js.map +1 -0
  277. package/runtime/lib/snapshot/{event.d.ts → snapshot/event.d.ts} +1 -1
  278. package/runtime/lib/snapshot/{event.js → snapshot/event.js} +0 -4
  279. package/runtime/lib/snapshot/snapshot/event.js.map +1 -0
  280. package/runtime/lib/snapshot/{gesture.js → snapshot/gesture.js} +9 -3
  281. package/runtime/lib/snapshot/snapshot/gesture.js.map +1 -0
  282. package/runtime/lib/snapshot/snapshot/index.d.ts +4 -0
  283. package/runtime/lib/snapshot/snapshot/index.js +8 -0
  284. package/runtime/lib/snapshot/snapshot/index.js.map +1 -0
  285. package/runtime/lib/snapshot/snapshot/list.js.map +1 -0
  286. package/runtime/lib/snapshot/snapshot/platformInfo.js.map +1 -0
  287. package/runtime/lib/snapshot/snapshot/reconstructInstanceTree.d.ts +14 -0
  288. package/runtime/lib/snapshot/snapshot/reconstructInstanceTree.js +27 -0
  289. package/runtime/lib/snapshot/snapshot/reconstructInstanceTree.js.map +1 -0
  290. package/runtime/lib/snapshot/{ref.d.ts → snapshot/ref.d.ts} +1 -0
  291. package/runtime/lib/snapshot/{ref.js → snapshot/ref.js} +13 -1
  292. package/runtime/lib/snapshot/snapshot/ref.js.map +1 -0
  293. package/runtime/lib/snapshot/{snapshot.d.ts → snapshot/snapshot.d.ts} +1 -0
  294. package/runtime/lib/snapshot/{snapshot.js → snapshot/snapshot.js} +90 -11
  295. package/runtime/lib/snapshot/snapshot/snapshot.js.map +1 -0
  296. package/runtime/lib/snapshot/snapshot/snapshotInstanceHydrationMap.js.map +1 -0
  297. package/runtime/lib/snapshot/{spread.d.ts → snapshot/spread.d.ts} +1 -1
  298. package/runtime/lib/snapshot/{spread.js → snapshot/spread.js} +35 -4
  299. package/runtime/lib/snapshot/snapshot/spread.js.map +1 -0
  300. package/runtime/lib/snapshot/{types.d.ts → snapshot/types.d.ts} +1 -0
  301. package/runtime/lib/snapshot/snapshot/types.js.map +1 -0
  302. package/runtime/lib/snapshot/{utils.d.ts → snapshot/utils.d.ts} +1 -3
  303. package/runtime/lib/snapshot/{utils.js → snapshot/utils.js} +5 -0
  304. package/runtime/lib/snapshot/snapshot/utils.js.map +1 -0
  305. package/runtime/lib/snapshot/{workletEvent.d.ts → snapshot/workletEvent.d.ts} +1 -1
  306. package/runtime/lib/snapshot/{workletEvent.js → snapshot/workletEvent.js} +10 -5
  307. package/runtime/lib/snapshot/snapshot/workletEvent.js.map +1 -0
  308. package/runtime/lib/snapshot/{workletRef.d.ts → snapshot/workletRef.d.ts} +1 -1
  309. package/runtime/lib/snapshot/{workletRef.js → snapshot/workletRef.js} +6 -3
  310. package/runtime/lib/snapshot/snapshot/workletRef.js.map +1 -0
  311. package/runtime/lib/snapshot/worklet/call/delayedRunOnMainThreadData.js.map +1 -0
  312. package/runtime/lib/snapshot/worklet/call/execMap.js.map +1 -0
  313. package/runtime/lib/snapshot/worklet/call/functionCall.js.map +1 -0
  314. package/runtime/lib/snapshot/worklet/call/runOnBackground.js.map +1 -0
  315. package/runtime/lib/snapshot/worklet/call/runOnMainThread.js.map +1 -0
  316. package/runtime/lib/snapshot/worklet/call/transformToWorklet.js.map +1 -0
  317. package/runtime/lib/snapshot/worklet/ctx.d.ts +1 -0
  318. package/runtime/lib/snapshot/worklet/ctx.js.map +1 -0
  319. package/runtime/lib/snapshot/worklet/destroy.js.map +1 -0
  320. package/runtime/lib/{worklet → snapshot/worklet}/functionality.js +1 -1
  321. package/runtime/lib/snapshot/worklet/functionality.js.map +1 -0
  322. package/runtime/lib/snapshot/worklet/hmr.js.map +1 -0
  323. package/runtime/lib/snapshot/worklet/indexMap.js.map +1 -0
  324. package/runtime/lib/snapshot/worklet/ref/updateInitValue.js.map +1 -0
  325. package/runtime/lib/{worklet → snapshot/worklet}/ref/workletRef.js +1 -1
  326. package/runtime/lib/snapshot/worklet/ref/workletRef.js.map +1 -0
  327. package/runtime/lib/snapshot/worklet/ref/workletRefPool.js.map +1 -0
  328. package/runtime/lib/tsconfig.tsbuildinfo +1 -1
  329. package/runtime/lib/utils.js +1 -1
  330. package/runtime/lib/utils.js.map +1 -1
  331. package/runtime/lib/worklet-runtime/bindings/observers.d.ts +1 -0
  332. package/runtime/lib/worklet-runtime/bindings/observers.js +5 -3
  333. package/runtime/lib/worklet-runtime/bindings/observers.js.map +1 -1
  334. package/runtime/lib/worklet-runtime/bindings/types.d.ts +1 -1
  335. package/runtime/lib/worklet-runtime/bindings/types.js.map +1 -1
  336. package/runtime/lib/worklet-runtime/hydrate.js +1 -1
  337. package/runtime/lib/worklet-runtime/hydrate.js.map +1 -1
  338. package/runtime/lib/worklet-runtime/jsFunctionLifecycle.d.ts +1 -0
  339. package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js +5 -0
  340. package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js.map +1 -1
  341. package/runtime/lib/worklet-runtime/workletRuntime.js +1 -2
  342. package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
  343. package/runtime/worklet-runtime/dev.js +8 -4
  344. package/runtime/worklet-runtime/main.js +1 -1
  345. package/testing-library/dist/env/index.js +25 -7
  346. package/testing-library/dist/fire-event.d.ts +21 -7
  347. package/testing-library/dist/index.d.ts +2 -0
  348. package/testing-library/dist/pure.js +29 -11
  349. package/testing-library/dist/setupFiles/common/runtime-setup.js +14 -49
  350. package/testing-library/dist/type-entry/index.js +0 -0
  351. package/transform/dist/wasm.cjs +1274 -665
  352. package/transform/index.d.ts +28 -1
  353. package/types/react.docs.d.ts +9 -1
  354. package/refresh/.gitignore +0 -1
  355. package/refresh/.npmignore +0 -3
  356. package/refresh/.turbo/turbo-build.log +0 -12
  357. package/refresh/package.json +0 -20
  358. package/refresh/rslib.config.ts +0 -24
  359. package/refresh/tsconfig.json +0 -4
  360. package/refresh/turbo.json +0 -15
  361. package/runtime/lib/alog/elementPAPICall.js.map +0 -1
  362. package/runtime/lib/alog/index.js.map +0 -1
  363. package/runtime/lib/alog/render.js.map +0 -1
  364. package/runtime/lib/compat/componentIs.js.map +0 -1
  365. package/runtime/lib/compat/initData.js.map +0 -1
  366. package/runtime/lib/compat/lynxComponent.js.map +0 -1
  367. package/runtime/lib/debug/component-stack.js.map +0 -1
  368. package/runtime/lib/debug/debug.js.map +0 -1
  369. package/runtime/lib/debug/describeInvalidValue.js.map +0 -1
  370. package/runtime/lib/debug/formatPatch.js.map +0 -1
  371. package/runtime/lib/debug/printSnapshot.js.map +0 -1
  372. package/runtime/lib/debug/profile.js.map +0 -1
  373. package/runtime/lib/debug/profileHooks.js.map +0 -1
  374. package/runtime/lib/debug/vnodeSource.js.map +0 -1
  375. package/runtime/lib/gesture/processGesture.js.map +0 -1
  376. package/runtime/lib/gesture/processGestureBagkround.d.ts +0 -2
  377. package/runtime/lib/gesture/processGestureBagkround.js +0 -19
  378. package/runtime/lib/gesture/processGestureBagkround.js.map +0 -1
  379. package/runtime/lib/gesture/types.js.map +0 -1
  380. package/runtime/lib/hooks/mainThread.js.map +0 -1
  381. package/runtime/lib/hooks/react.js.map +0 -1
  382. package/runtime/lib/hooks/useLynxGlobalEventListener.js.map +0 -1
  383. package/runtime/lib/legacy-react-runtime/index.js.map +0 -1
  384. package/runtime/lib/lifecycle/constant.js.map +0 -1
  385. package/runtime/lib/lifecycle/destroy.js.map +0 -1
  386. package/runtime/lib/lifecycle/event/delayEvents.js.map +0 -1
  387. package/runtime/lib/lifecycle/event/delayLifecycleEvents.js.map +0 -1
  388. package/runtime/lib/lifecycle/event/jsReady.js.map +0 -1
  389. package/runtime/lib/lifecycle/isRendering.js.map +0 -1
  390. package/runtime/lib/lifecycle/pass.js.map +0 -1
  391. package/runtime/lib/lifecycle/patch/commit.js.map +0 -1
  392. package/runtime/lib/lifecycle/patch/error.js.map +0 -1
  393. package/runtime/lib/lifecycle/patch/globalState.js.map +0 -1
  394. package/runtime/lib/lifecycle/patch/isMainThreadHydrating.js.map +0 -1
  395. package/runtime/lib/lifecycle/patch/snapshotPatch.js.map +0 -1
  396. package/runtime/lib/lifecycle/patch/snapshotPatchApply.js.map +0 -1
  397. package/runtime/lib/lifecycle/patch/updateMainThread.js.map +0 -1
  398. package/runtime/lib/lifecycle/ref/delay.js.map +0 -1
  399. package/runtime/lib/lifecycle/reload.js.map +0 -1
  400. package/runtime/lib/lifecycle/render.js.map +0 -1
  401. package/runtime/lib/list/list.js.map +0 -1
  402. package/runtime/lib/list/listUpdateInfo.js.map +0 -1
  403. package/runtime/lib/list/pendingListUpdates.js.map +0 -1
  404. package/runtime/lib/lynx/calledByNative.js.map +0 -1
  405. package/runtime/lib/lynx/component.js.map +0 -1
  406. package/runtime/lib/lynx/dynamic-js.js.map +0 -1
  407. package/runtime/lib/lynx/env.js.map +0 -1
  408. package/runtime/lib/lynx/injectLepusMethods.js.map +0 -1
  409. package/runtime/lib/lynx/lazy-bundle.js.map +0 -1
  410. package/runtime/lib/lynx/performance.js.map +0 -1
  411. package/runtime/lib/lynx/runWithForce.js.map +0 -1
  412. package/runtime/lib/lynx/suspense.js.map +0 -1
  413. package/runtime/lib/lynx/tt.js.map +0 -1
  414. package/runtime/lib/renderToOpcodes/constants.js.map +0 -1
  415. package/runtime/lib/renderToOpcodes/hydrate.js.map +0 -1
  416. package/runtime/lib/renderToOpcodes/index.js.map +0 -1
  417. package/runtime/lib/renderToOpcodes/opcodes.js.map +0 -1
  418. package/runtime/lib/snapshot/backgroundSnapshot.js.map +0 -1
  419. package/runtime/lib/snapshot/constants.js.map +0 -1
  420. package/runtime/lib/snapshot/definition.js.map +0 -1
  421. package/runtime/lib/snapshot/dynamicPartType.js.map +0 -1
  422. package/runtime/lib/snapshot/event.js.map +0 -1
  423. package/runtime/lib/snapshot/gesture.js.map +0 -1
  424. package/runtime/lib/snapshot/list.js.map +0 -1
  425. package/runtime/lib/snapshot/platformInfo.js.map +0 -1
  426. package/runtime/lib/snapshot/ref.js.map +0 -1
  427. package/runtime/lib/snapshot/snapshot.js.map +0 -1
  428. package/runtime/lib/snapshot/snapshotInstanceHydrationMap.js.map +0 -1
  429. package/runtime/lib/snapshot/spread.js.map +0 -1
  430. package/runtime/lib/snapshot/types.js.map +0 -1
  431. package/runtime/lib/snapshot/utils.js.map +0 -1
  432. package/runtime/lib/snapshot/workletEvent.js.map +0 -1
  433. package/runtime/lib/snapshot/workletRef.js.map +0 -1
  434. package/runtime/lib/worklet/call/delayedRunOnMainThreadData.js.map +0 -1
  435. package/runtime/lib/worklet/call/execMap.js.map +0 -1
  436. package/runtime/lib/worklet/call/functionCall.js.map +0 -1
  437. package/runtime/lib/worklet/call/runOnBackground.js.map +0 -1
  438. package/runtime/lib/worklet/call/runOnMainThread.js.map +0 -1
  439. package/runtime/lib/worklet/call/transformToWorklet.js.map +0 -1
  440. package/runtime/lib/worklet/ctx.js.map +0 -1
  441. package/runtime/lib/worklet/destroy.js.map +0 -1
  442. package/runtime/lib/worklet/functionality.js.map +0 -1
  443. package/runtime/lib/worklet/hmr.js.map +0 -1
  444. package/runtime/lib/worklet/indexMap.js.map +0 -1
  445. package/runtime/lib/worklet/ref/updateInitValue.js.map +0 -1
  446. package/runtime/lib/worklet/ref/workletRef.js.map +0 -1
  447. package/runtime/lib/worklet/ref/workletRefPool.js.map +0 -1
  448. package/testing-library/README.md +0 -109
  449. /package/runtime/lib/{hooks → core/hooks}/react.d.ts +0 -0
  450. /package/runtime/lib/{lynx → element-template/lynx}/env.d.ts +0 -0
  451. /package/runtime/lib/{lynx/calledByNative.d.ts → element-template/native/main-thread-api.d.ts} +0 -0
  452. /package/runtime/lib/{lynx/component.d.ts → element-template/runtime/components/slot.d.ts} +0 -0
  453. /package/runtime/lib/{lifecycle/render.d.ts → element-template/runtime/render/render-main-thread.d.ts} +0 -0
  454. /package/runtime/lib/{debug → shared}/component-stack.d.ts +0 -0
  455. /package/runtime/lib/{debug → shared}/profile.d.ts +0 -0
  456. /package/runtime/lib/{renderToOpcodes/constants.d.ts → shared/render-constants.d.ts} +0 -0
  457. /package/runtime/lib/{alog → snapshot/alog}/elementPAPICall.d.ts +0 -0
  458. /package/runtime/lib/{alog → snapshot/alog}/index.d.ts +0 -0
  459. /package/runtime/lib/{alog → snapshot/alog}/index.js +0 -0
  460. /package/runtime/lib/{alog → snapshot/alog}/render.d.ts +0 -0
  461. /package/runtime/lib/{compat → snapshot/compat}/componentIs.d.ts +0 -0
  462. /package/runtime/lib/{compat → snapshot/compat}/componentIs.js +0 -0
  463. /package/runtime/lib/{compat → snapshot/compat}/lynxComponent.d.ts +0 -0
  464. /package/runtime/lib/{compat → snapshot/compat}/lynxComponent.js +0 -0
  465. /package/runtime/lib/{debug → snapshot/debug}/debug.d.ts +0 -0
  466. /package/runtime/lib/{debug → snapshot/debug}/debug.js +0 -0
  467. /package/runtime/lib/{debug → snapshot/debug}/describeInvalidValue.d.ts +0 -0
  468. /package/runtime/lib/{debug → snapshot/debug}/describeInvalidValue.js +0 -0
  469. /package/runtime/lib/{debug → snapshot/debug}/formatPatch.d.ts +0 -0
  470. /package/runtime/lib/{debug → snapshot/debug}/formatPatch.js +0 -0
  471. /package/runtime/lib/{debug → snapshot/debug}/printSnapshot.d.ts +0 -0
  472. /package/runtime/lib/{debug → snapshot/debug}/printSnapshot.js +0 -0
  473. /package/runtime/lib/{debug → snapshot/debug}/profileHooks.d.ts +0 -0
  474. /package/runtime/lib/{debug → snapshot/debug}/vnodeSource.d.ts +0 -0
  475. /package/runtime/lib/{gesture → snapshot/gesture}/types.d.ts +0 -0
  476. /package/runtime/lib/{gesture → snapshot/gesture}/types.js +0 -0
  477. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/constant.d.ts +0 -0
  478. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/constant.js +0 -0
  479. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/destroy.d.ts +0 -0
  480. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/event/delayEvents.d.ts +0 -0
  481. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/event/delayEvents.js +0 -0
  482. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/event/delayLifecycleEvents.d.ts +0 -0
  483. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/event/delayLifecycleEvents.js +0 -0
  484. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/event/jsReady.d.ts +0 -0
  485. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/isRendering.d.ts +0 -0
  486. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/pass.d.ts +0 -0
  487. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/pass.js +0 -0
  488. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/commit.d.ts +0 -0
  489. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/error.d.ts +0 -0
  490. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/error.js +0 -0
  491. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/globalState.d.ts +0 -0
  492. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/globalState.js +0 -0
  493. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/isMainThreadHydrating.d.ts +0 -0
  494. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/isMainThreadHydrating.js +0 -0
  495. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/snapshotPatchApply.d.ts +0 -0
  496. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/updateMainThread.d.ts +0 -0
  497. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/patch/updateMainThread.js +0 -0
  498. /package/runtime/lib/{lifecycle → snapshot/lifecycle}/reload.d.ts +0 -0
  499. /package/runtime/lib/{list → snapshot/list}/list.d.ts +0 -0
  500. /package/runtime/lib/{list → snapshot/list}/listUpdateInfo.d.ts +0 -0
  501. /package/runtime/lib/{list → snapshot/list}/pendingListUpdates.d.ts +0 -0
  502. /package/runtime/lib/{list → snapshot/list}/pendingListUpdates.js +0 -0
  503. /package/runtime/lib/{worklet/call/execMap.d.ts → snapshot/lynx/component.d.ts} +0 -0
  504. /package/runtime/lib/{lynx → snapshot/lynx}/dynamic-js.d.ts +0 -0
  505. /package/runtime/lib/{lynx → snapshot/lynx}/dynamic-js.js +0 -0
  506. /package/runtime/lib/{lynx → snapshot/lynx}/injectLepusMethods.d.ts +0 -0
  507. /package/runtime/lib/{lynx → snapshot/lynx}/injectLepusMethods.js +0 -0
  508. /package/runtime/lib/{lynx → snapshot/lynx}/lazy-bundle.d.ts +0 -0
  509. /package/runtime/lib/{lynx → snapshot/lynx}/lazy-bundle.js +0 -0
  510. /package/runtime/lib/{lynx → snapshot/lynx}/performance.d.ts +0 -0
  511. /package/runtime/lib/{lynx → snapshot/lynx}/runWithForce.d.ts +0 -0
  512. /package/runtime/lib/{lynx → snapshot/lynx}/suspense.d.ts +0 -0
  513. /package/runtime/lib/{lynx → snapshot/lynx}/tt.d.ts +0 -0
  514. /package/runtime/lib/{renderToOpcodes → snapshot/renderToOpcodes}/hydrate.d.ts +0 -0
  515. /package/runtime/lib/{renderToOpcodes → snapshot/renderToOpcodes}/index.d.ts +0 -0
  516. /package/runtime/lib/{renderToOpcodes → snapshot/renderToOpcodes}/opcodes.d.ts +0 -0
  517. /package/runtime/lib/snapshot/{gesture.d.ts → snapshot/gesture.d.ts} +0 -0
  518. /package/runtime/lib/snapshot/{list.d.ts → snapshot/list.d.ts} +0 -0
  519. /package/runtime/lib/snapshot/{list.js → snapshot/list.js} +0 -0
  520. /package/runtime/lib/snapshot/{platformInfo.d.ts → snapshot/platformInfo.d.ts} +0 -0
  521. /package/runtime/lib/snapshot/{platformInfo.js → snapshot/platformInfo.js} +0 -0
  522. /package/runtime/lib/snapshot/{snapshotInstanceHydrationMap.d.ts → snapshot/snapshotInstanceHydrationMap.d.ts} +0 -0
  523. /package/runtime/lib/snapshot/{snapshotInstanceHydrationMap.js → snapshot/snapshotInstanceHydrationMap.js} +0 -0
  524. /package/runtime/lib/snapshot/{types.js → snapshot/types.js} +0 -0
  525. /package/runtime/lib/{worklet → snapshot/worklet}/call/delayedRunOnMainThreadData.d.ts +0 -0
  526. /package/runtime/lib/{worklet → snapshot/worklet}/call/delayedRunOnMainThreadData.js +0 -0
  527. /package/runtime/lib/{worklet/call/transformToWorklet.d.ts → snapshot/worklet/call/execMap.d.ts} +0 -0
  528. /package/runtime/lib/{worklet → snapshot/worklet}/call/execMap.js +0 -0
  529. /package/runtime/lib/{worklet → snapshot/worklet}/call/functionCall.d.ts +0 -0
  530. /package/runtime/lib/{worklet → snapshot/worklet}/call/functionCall.js +0 -0
  531. /package/runtime/lib/{worklet → snapshot/worklet}/call/runOnBackground.d.ts +0 -0
  532. /package/runtime/lib/{worklet → snapshot/worklet}/call/runOnBackground.js +0 -0
  533. /package/runtime/lib/{worklet → snapshot/worklet}/call/runOnMainThread.d.ts +0 -0
  534. /package/runtime/lib/{worklet → snapshot/worklet}/call/runOnMainThread.js +0 -0
  535. /package/runtime/lib/{worklet/ctx.d.ts → snapshot/worklet/call/transformToWorklet.d.ts} +0 -0
  536. /package/runtime/lib/{worklet → snapshot/worklet}/call/transformToWorklet.js +0 -0
  537. /package/runtime/lib/{worklet → snapshot/worklet}/ctx.js +0 -0
  538. /package/runtime/lib/{worklet → snapshot/worklet}/destroy.d.ts +0 -0
  539. /package/runtime/lib/{worklet → snapshot/worklet}/destroy.js +0 -0
  540. /package/runtime/lib/{worklet → snapshot/worklet}/functionality.d.ts +0 -0
  541. /package/runtime/lib/{worklet → snapshot/worklet}/hmr.d.ts +0 -0
  542. /package/runtime/lib/{worklet → snapshot/worklet}/hmr.js +0 -0
  543. /package/runtime/lib/{worklet → snapshot/worklet}/indexMap.d.ts +0 -0
  544. /package/runtime/lib/{worklet → snapshot/worklet}/indexMap.js +0 -0
  545. /package/runtime/lib/{worklet → snapshot/worklet}/ref/updateInitValue.d.ts +0 -0
  546. /package/runtime/lib/{worklet → snapshot/worklet}/ref/updateInitValue.js +0 -0
  547. /package/runtime/lib/{worklet → snapshot/worklet}/ref/workletRef.d.ts +0 -0
  548. /package/runtime/lib/{worklet → snapshot/worklet}/ref/workletRefPool.d.ts +0 -0
  549. /package/runtime/lib/{worklet → snapshot/worklet}/ref/workletRefPool.js +0 -0
@@ -0,0 +1,272 @@
1
+ // Copyright 2024 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ /**
5
+ * Implements rendering to opcodes.
6
+ * This module is modified from preact-render-to-string@6.0.3 to generate
7
+ * opcodes instead of HTML strings for Lynx.
8
+ */
9
+ // @ts-nocheck
10
+ import { Fragment, h, options } from 'preact';
11
+ import { CHILDREN, COMMIT, COMPONENT, DIFF, DIFF2, DIFFED, DIRTY, NEXT_STATE, PARENT, RENDER, SKIP_EFFECTS, VNODE, } from '../../../shared/render-constants.js';
12
+ /** @typedef {import('preact').VNode} VNode */
13
+ const EMPTY_ARR = [];
14
+ const isArray = /* @__PURE__ */ Array.isArray;
15
+ const assign = /* @__PURE__ */ Object.assign;
16
+ // Global state for the current render pass
17
+ let beforeDiff, beforeDiff2, afterDiff, renderHook, ummountHook;
18
+ /**
19
+ * Render Preact JSX + Components to an HTML string.
20
+ * @param {VNode} vnode JSX Element / VNode to render
21
+ * @param {object} [context] Initial root context object
22
+ */
23
+ export function renderToString(vnode, context) {
24
+ // Performance optimization: `renderToString` is synchronous and we
25
+ // therefore don't execute any effects. To do that we pass an empty
26
+ // array to `options._commit` (`__c`). But we can go one step further
27
+ // and avoid a lot of dirty checks and allocations by setting
28
+ // `options._skipEffects` (`__s`) too.
29
+ const previousSkipEffects = options[SKIP_EFFECTS];
30
+ options[SKIP_EFFECTS] = true;
31
+ // store options hooks once before each synchronous render call
32
+ beforeDiff = options[DIFF];
33
+ beforeDiff2 = options[DIFF2];
34
+ afterDiff = options[DIFFED];
35
+ renderHook = options[RENDER];
36
+ ummountHook = options.unmount;
37
+ const parent = h(Fragment, null);
38
+ parent[CHILDREN] = [vnode];
39
+ const opcodes = [];
40
+ try {
41
+ _renderToString(vnode, context || EMPTY_OBJ, parent, opcodes);
42
+ }
43
+ finally {
44
+ // options._commit, we don't schedule any effects in this library right now,
45
+ // so we can pass an empty queue to this hook.
46
+ if (options[COMMIT])
47
+ options[COMMIT](vnode, EMPTY_ARR);
48
+ options[SKIP_EFFECTS] = previousSkipEffects;
49
+ EMPTY_ARR.length = 0;
50
+ }
51
+ return opcodes;
52
+ }
53
+ // Installed as setState/forceUpdate for function components
54
+ /* v8 ignore start */
55
+ function markAsDirty() {
56
+ this.__d = true;
57
+ }
58
+ /* v8 ignore stop */
59
+ const EMPTY_OBJ = {};
60
+ export const __OpBegin = 0;
61
+ export const __OpEnd = 1;
62
+ export const __OpAttr = 2;
63
+ export const __OpText = 3;
64
+ export const __OpSlot = 4;
65
+ /**
66
+ * @param {VNode} vnode
67
+ * @param {Record<string, unknown>} context
68
+ */
69
+ function renderClassComponent(vnode, context) {
70
+ const type = /** @type {import("preact").ComponentClass<typeof vnode.props>} */ (vnode.type);
71
+ let c;
72
+ if (vnode[COMPONENT]) {
73
+ c = vnode[COMPONENT];
74
+ c.state = c[NEXT_STATE];
75
+ }
76
+ else {
77
+ c = new type(vnode.props, context);
78
+ }
79
+ vnode[COMPONENT] = c;
80
+ c[VNODE] = vnode;
81
+ c.props = vnode.props;
82
+ c.context = context;
83
+ // turn off stateful re-rendering:
84
+ c[DIRTY] = true;
85
+ if (c.state == null)
86
+ c.state = EMPTY_OBJ;
87
+ if (c[NEXT_STATE] == null) {
88
+ c[NEXT_STATE] = c.state;
89
+ }
90
+ if (type.getDerivedStateFromProps) {
91
+ c.state = assign({}, c.state, type.getDerivedStateFromProps(c.props, c.state));
92
+ }
93
+ if (renderHook)
94
+ renderHook(vnode);
95
+ return c.render(c.props, c.state, context);
96
+ }
97
+ function cleanupVNode(vnode) {
98
+ if (afterDiff)
99
+ afterDiff(vnode);
100
+ vnode[PARENT] = undefined;
101
+ if (ummountHook)
102
+ ummountHook(vnode);
103
+ }
104
+ function shouldRenderEtChild(child) {
105
+ return child != null && child !== false && child !== true;
106
+ }
107
+ function isCompiledEtHostType(type) {
108
+ return type.startsWith('_et_')
109
+ || type.includes(':_et_');
110
+ }
111
+ function renderEtSlotArray(slotChildrenById, context, vnode, opcodes) {
112
+ for (let slotId = 0; slotId < slotChildrenById.length; slotId += 1) {
113
+ const slotChildren = slotChildrenById[slotId];
114
+ if (!shouldRenderEtChild(slotChildren)) {
115
+ continue;
116
+ }
117
+ opcodes.push(__OpSlot, slotId);
118
+ _renderToString(slotChildren, context, vnode, opcodes);
119
+ }
120
+ }
121
+ function renderComponentVNode(vnode, type, props, context, opcodes) {
122
+ let cctx = context;
123
+ let rendered;
124
+ let component;
125
+ const opcodesLength = opcodes.length;
126
+ if (type === Fragment) {
127
+ rendered = props.children;
128
+ }
129
+ else {
130
+ const contextType = type.contextType;
131
+ if (contextType != null) {
132
+ const provider = context[contextType.__c];
133
+ cctx = provider ? provider.props.value : contextType.__;
134
+ }
135
+ if (type.prototype && typeof type.prototype.render === 'function') {
136
+ rendered = /**#__NOINLINE__**/ renderClassComponent(vnode, cctx);
137
+ component = vnode[COMPONENT];
138
+ }
139
+ else {
140
+ component = {
141
+ __v: vnode,
142
+ props,
143
+ context: cctx,
144
+ // silently drop state updates
145
+ setState: markAsDirty,
146
+ forceUpdate: markAsDirty,
147
+ __d: true,
148
+ // hooks
149
+ __h: [],
150
+ };
151
+ vnode[COMPONENT] = component;
152
+ component.constructor = type;
153
+ component.render = doRender;
154
+ let count = 0;
155
+ while (component[DIRTY] && count++ < 25) {
156
+ component[DIRTY] = false;
157
+ if (renderHook)
158
+ renderHook(vnode);
159
+ rendered = component.render(props, component.state, cctx);
160
+ }
161
+ component[DIRTY] = true;
162
+ }
163
+ if (component.getChildContext != null) {
164
+ context = assign({}, context, component.getChildContext());
165
+ }
166
+ }
167
+ const isTopLevelFragment = rendered != null && rendered.type === Fragment
168
+ && rendered.key == null;
169
+ rendered = isTopLevelFragment ? rendered.props.children : rendered;
170
+ try {
171
+ _renderToString(rendered, context, vnode, opcodes);
172
+ }
173
+ catch (e) {
174
+ if (e && typeof e === 'object' && e.then && component && /* _childDidSuspend */ component.__c) {
175
+ component.setState({ /* _suspended */ __a: true });
176
+ if (component[DIRTY]) {
177
+ rendered = renderClassComponent(vnode, context);
178
+ component = vnode[COMPONENT];
179
+ opcodes.length = opcodesLength;
180
+ _renderToString(rendered, context, vnode, opcodes);
181
+ }
182
+ }
183
+ else {
184
+ throw e;
185
+ }
186
+ }
187
+ finally {
188
+ cleanupVNode(vnode);
189
+ }
190
+ }
191
+ function renderCompiledEtHostVNode(vnode, props, context, opcodes) {
192
+ opcodes.push(__OpBegin, vnode);
193
+ const attributeSlots = props.attributeSlots;
194
+ if (attributeSlots !== undefined) {
195
+ opcodes.push(__OpAttr, 'attributeSlots', attributeSlots);
196
+ }
197
+ // ET host nodes are compiler-generated and encode dynamic element slots in
198
+ // `children`, so the runtime can interpret the prop as a slot array directly.
199
+ const elementSlots = props.children;
200
+ if (elementSlots !== undefined) {
201
+ renderEtSlotArray(elementSlots, context, vnode, opcodes);
202
+ }
203
+ cleanupVNode(vnode);
204
+ opcodes.push(__OpEnd);
205
+ }
206
+ function renderStringHostVNode(type, vnode, props, context, opcodes) {
207
+ if (__DEV__ && !isCompiledEtHostType(type)) {
208
+ cleanupVNode(vnode);
209
+ throw new Error(`Element Template main-thread renderer received an uncompiled host vnode: ${type}`);
210
+ }
211
+ renderCompiledEtHostVNode(vnode, props, context, opcodes);
212
+ }
213
+ /**
214
+ * Recursively render VNodes to HTML.
215
+ * @param {VNode|any} vnode
216
+ * @param {any} context
217
+ * @param {VNode} parent
218
+ * @param opcodes
219
+ */
220
+ function _renderToString(vnode, context, parent, opcodes) {
221
+ // Ignore non-rendered VNodes/values
222
+ if (vnode == null || vnode === true || vnode === false || vnode === '') {
223
+ return;
224
+ }
225
+ // Text VNodes: escape as HTML
226
+ if (typeof vnode !== 'object') {
227
+ if (typeof vnode === 'function')
228
+ return;
229
+ opcodes.push(__OpText, vnode + '');
230
+ return;
231
+ }
232
+ // Recurse into children / Arrays
233
+ if (isArray(vnode)) {
234
+ parent[CHILDREN] = vnode;
235
+ for (let i = 0; i < vnode.length; i++) {
236
+ const child = vnode[i];
237
+ if (child == null || typeof child === 'boolean')
238
+ continue;
239
+ _renderToString(child, context, parent, opcodes);
240
+ }
241
+ return;
242
+ }
243
+ // VNodes have {constructor:undefined} to prevent JSON injection:
244
+ // if (vnode.constructor !== undefined) return;
245
+ vnode[PARENT] = parent;
246
+ if (beforeDiff)
247
+ beforeDiff(vnode);
248
+ if (beforeDiff2)
249
+ beforeDiff2(vnode, EMPTY_OBJ);
250
+ let type = vnode.type, props = vnode.props;
251
+ // Invoke rendering on Components
252
+ if (typeof type === 'function') {
253
+ renderComponentVNode(vnode, type, props, context, opcodes);
254
+ return;
255
+ }
256
+ if (typeof type === 'string') {
257
+ renderStringHostVNode(type, vnode, props, context, opcodes);
258
+ return;
259
+ }
260
+ if (__DEV__) {
261
+ cleanupVNode(vnode);
262
+ throw new Error('Element Template main-thread renderer received an invalid vnode.');
263
+ }
264
+ }
265
+ /** The `.render()` method for a PFC backing instance. */
266
+ function doRender(props, state, context) {
267
+ return this.constructor(props, context);
268
+ }
269
+ export default renderToString;
270
+ export const render = renderToString;
271
+ export const renderToStaticMarkup = renderToString;
272
+ //# sourceMappingURL=render-to-opcodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-to-opcodes.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/render/render-to-opcodes.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D;;;;GAIG;AAEH,cAAc;AAEd,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,IAAI,EACJ,KAAK,EACL,MAAM,EACN,KAAK,EACL,UAAU,EACV,MAAM,EACN,MAAM,EACN,YAAY,EACZ,KAAK,GACN,MAAM,qCAAqC,CAAC;AAE7C,8CAA8C;AAE9C,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC;AAC9C,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC;AAE7C,2CAA2C;AAC3C,IAAI,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,CAAC;AAEhE;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAU,EAAE,OAAY;IACrD,mEAAmE;IACnE,mEAAmE;IACnE,qEAAqE;IACrE,6DAA6D;IAC7D,sCAAsC;IACtC,MAAM,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAClD,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;IAE7B,+DAA+D;IAC/D,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC7B,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,UAAU,GAAG,OAAO,CAAC,MAA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,CAAC;IACtF,CAAC;AACH,CAAC;AAED,yDAAyD;AACzD,SAAS,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO;IACrC,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC;AAED,eAAe,cAAc,CAAC;AAC9B,MAAM,CAAC,MAAM,MAAM,GAA0B,cAAc,CAAC;AAC5D,MAAM,CAAC,MAAM,oBAAoB,GAA0B,cAAc,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { SpreadAttrAdapterContext } from '../../prop-adapters/spread.js';
2
+ import type { SerializableValue } from '../../protocol/types.js';
3
+ export interface EtAttrAdapterContext extends SpreadAttrAdapterContext {
4
+ }
5
+ export type EtAttrAdapter = (handleId: number, attrSlotIndex: number, value: unknown, context?: EtAttrAdapterContext) => SerializableValue | null;
6
+ export type EtAttrPlan = (number | EtAttrAdapter)[];
7
+ export type EtAttrPlanMap = Record<string, EtAttrPlan | undefined>;
8
+ export declare const __etAttrPlanMap: EtAttrPlanMap;
9
+ export declare function adaptEventAttrSlot(handleId: number, attrSlotIndex: number, value: unknown, _context?: EtAttrAdapterContext): SerializableValue | null;
10
+ export declare function adaptSpreadAttrSlot(handleId: number, attrSlotIndex: number, value: unknown, context?: EtAttrAdapterContext): SerializableValue | null;
11
+ export declare function clearEtAttrPlanMap(): void;
@@ -0,0 +1,23 @@
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 { getEventValue } from '../../prop-adapters/event-value.js';
5
+ import { prepareSpreadAttrSlot } from '../../prop-adapters/spread.js';
6
+ export const __etAttrPlanMap = Object.create(null);
7
+ export function adaptEventAttrSlot(handleId, attrSlotIndex, value, _context) {
8
+ if (value === null || value === undefined || value === false) {
9
+ return null;
10
+ }
11
+ return getEventValue(handleId, attrSlotIndex);
12
+ }
13
+ export function adaptSpreadAttrSlot(handleId, attrSlotIndex, value, context) {
14
+ return prepareSpreadAttrSlot(handleId, attrSlotIndex, value, context);
15
+ }
16
+ export function clearEtAttrPlanMap() {
17
+ // The compiled output assigns into the exported side table directly, so the
18
+ // object identity must stay stable when tests or teardown clear state.
19
+ for (const templateKey in __etAttrPlanMap) {
20
+ delete __etAttrPlanMap[templateKey];
21
+ }
22
+ }
23
+ //# sourceMappingURL=attr-slot-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attr-slot-plan.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/template/attr-slot-plan.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAoBtE,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAkB,CAAC;AAEpE,MAAM,UAAU,kBAAkB,CAChC,QAAgB,EAChB,aAAqB,EACrB,KAAc,EACd,QAA+B;IAE/B,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QAC7D,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,QAAgB,EAChB,aAAqB,EACrB,KAAc,EACd,OAA8B;IAE9B,OAAO,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,4EAA4E;IAC5E,uEAAuE;IACvE,KAAK,MAAM,WAAW,IAAI,eAAe,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { SerializableValue } from '../../protocol/types.js';
2
+ export declare function reserveElementTemplateId(): number;
3
+ export declare function createElementTemplateWithReservedHandle(handleId: number, templateKey: string, bundleUrl: string | null | undefined, attributeSlots: SerializableValue[] | null | undefined, elementSlots: ElementRef[][] | null | undefined): ElementRef;
4
+ export declare function resetTemplateId(): void;
5
+ export declare function destroyElementTemplateId(id: number): void;
@@ -0,0 +1,23 @@
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 { deleteElementTemplateNativeRef, setElementTemplateNativeRef } from './registry.js';
5
+ // Main-thread IFR allocates ids as consecutive negative integers.
6
+ let nextId = -1;
7
+ export function reserveElementTemplateId() {
8
+ const id = nextId--;
9
+ return id;
10
+ }
11
+ export function createElementTemplateWithReservedHandle(handleId, templateKey, bundleUrl, attributeSlots, elementSlots) {
12
+ const nativeRef = __CreateElementTemplate(templateKey, bundleUrl, attributeSlots, elementSlots, handleId);
13
+ setElementTemplateNativeRef(handleId, nativeRef);
14
+ return nativeRef;
15
+ }
16
+ export function resetTemplateId() {
17
+ nextId = -1;
18
+ }
19
+ export function destroyElementTemplateId(id) {
20
+ deleteElementTemplateNativeRef(id);
21
+ // __ReleaseElement(nativeRef);
22
+ }
23
+ //# sourceMappingURL=handle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/template/handle.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,8BAA8B,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAG5F,kEAAkE;AAClE,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;AAEhB,MAAM,UAAU,wBAAwB;IACtC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,QAAgB,EAChB,WAAmB,EACnB,SAAoC,EACpC,cAAsD,EACtD,YAA+C;IAE/C,MAAM,SAAS,GAAG,uBAAuB,CACvC,WAAW,EACX,SAAS,EACT,cAAc,EACd,YAAY,EACZ,QAAQ,CACT,CAAC;IACF,2BAA2B,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACjD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,MAAM,GAAG,CAAC,CAAC,CAAC;AACd,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,EAAU;IACjD,8BAA8B,CAAC,EAAE,CAAC,CAAC;IACnC,+BAA+B;AACjC,CAAC"}
@@ -0,0 +1,13 @@
1
+ export declare function setElementTemplateNativeRef(id: number, nativeRef: ElementRef): void;
2
+ export declare function getElementTemplateNativeRef(id: number): ElementRef | undefined;
3
+ export declare function hasElementTemplateNativeRef(id: number): boolean;
4
+ export declare function deleteElementTemplateNativeRef(id: number): void;
5
+ export declare function clearElementTemplateNativeRefRegistry(): void;
6
+ export interface ElementTemplateRegistryFacade {
7
+ set: (id: number, nativeRef: ElementRef) => void;
8
+ get: (id: number) => ElementRef | undefined;
9
+ has: (id: number) => boolean;
10
+ delete: (id: number) => void;
11
+ clear: () => void;
12
+ }
13
+ export declare const elementTemplateRegistry: ElementTemplateRegistryFacade;
@@ -0,0 +1,46 @@
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
+ // Registry for mapping element-template handle IDs to native refs.
5
+ //
6
+ // Main-thread IFR allocates IDs as consecutive negative integers: -1, -2, -3...
7
+ // We store those in a dense array for performance.
8
+ //
9
+ // Other IDs (e.g. positive IDs coming from background-created nodes) fall back to a Map.
10
+ const negativeRefs = [];
11
+ const otherRefs = new Map();
12
+ export function setElementTemplateNativeRef(id, nativeRef) {
13
+ if (id < 0) {
14
+ negativeRefs[-id - 1] = nativeRef;
15
+ return;
16
+ }
17
+ otherRefs.set(id, nativeRef);
18
+ }
19
+ export function getElementTemplateNativeRef(id) {
20
+ if (id < 0) {
21
+ return negativeRefs[-id - 1];
22
+ }
23
+ return otherRefs.get(id);
24
+ }
25
+ export function hasElementTemplateNativeRef(id) {
26
+ return getElementTemplateNativeRef(id) != null;
27
+ }
28
+ export function deleteElementTemplateNativeRef(id) {
29
+ if (id < 0) {
30
+ negativeRefs[-id - 1] = undefined;
31
+ return;
32
+ }
33
+ otherRefs.delete(id);
34
+ }
35
+ export function clearElementTemplateNativeRefRegistry() {
36
+ negativeRefs.length = 0;
37
+ otherRefs.clear();
38
+ }
39
+ export const elementTemplateRegistry = {
40
+ set: setElementTemplateNativeRef,
41
+ get: getElementTemplateNativeRef,
42
+ has: hasElementTemplateNativeRef,
43
+ delete: deleteElementTemplateNativeRef,
44
+ clear: clearElementTemplateNativeRefRegistry,
45
+ };
46
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/template/registry.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,mEAAmE;AACnE,EAAE;AACF,gFAAgF;AAChF,mDAAmD;AACnD,EAAE;AACF,yFAAyF;AAEzF,MAAM,YAAY,GAAkC,EAAE,CAAC;AACvD,MAAM,SAAS,GAA4B,IAAI,GAAG,EAAE,CAAC;AAErD,MAAM,UAAU,2BAA2B,CAAC,EAAU,EAAE,SAAqB;IAC3E,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QACX,YAAY,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;QAClC,OAAO;IACT,CAAC;IACD,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,EAAU;IACpD,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QACX,OAAO,YAAY,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,EAAU;IACpD,OAAO,2BAA2B,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,EAAU;IACvD,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QACX,YAAY,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;QAClC,OAAO;IACT,CAAC;IACD,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,qCAAqC;IACnD,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;IACxB,SAAS,CAAC,KAAK,EAAE,CAAC;AACpB,CAAC;AAYD,MAAM,CAAC,MAAM,uBAAuB,GAAkC;IACpE,GAAG,EAAE,2BAA2B;IAChC,GAAG,EAAE,2BAA2B;IAChC,GAAG,EAAE,2BAA2B;IAChC,MAAM,EAAE,8BAA8B;IACtC,KAAK,EAAE,qCAAqC;CAC7C,CAAC"}
@@ -1,9 +1,11 @@
1
1
  import './lynx.js';
2
- import './lynx/component.js';
3
- import { Children, Fragment, cloneElement, createElement, createRef, forwardRef, isValidElement, lazy, memo, useSyncExternalStore } from 'preact/compat';
4
- import { Suspense } from './lynx/suspense.js';
2
+ import './snapshot/lynx/component.js';
3
+ import { Children, Fragment, cloneElement, createRef, forwardRef, isValidElement, lazy, memo, useSyncExternalStore } from 'preact/compat';
4
+ import { createElement } from './snapshot/lynx/element.js';
5
+ import { createPortal } from './snapshot/lynx/portals.js';
6
+ import { Suspense } from './snapshot/lynx/suspense.js';
5
7
  export { Component, createContext } from 'preact';
6
8
  export { PureComponent } from 'preact/compat';
7
- export * from './hooks/react.js';
8
- export { Children, createRef, Fragment, isValidElement, memo, forwardRef, Suspense, lazy, createElement, cloneElement, useSyncExternalStore, };
9
+ export * from './core/hooks/react.js';
10
+ export { Children, createRef, Fragment, isValidElement, memo, forwardRef, Suspense, lazy, createElement, cloneElement, useSyncExternalStore, createPortal, };
9
11
  export * from './lynx-api.js';
@@ -2,13 +2,15 @@
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 './lynx.js';
5
- import './lynx/component.js';
6
- import { Children, Component, Fragment, PureComponent, cloneElement, createContext, createElement, createRef, forwardRef, isValidElement, lazy, memo, useSyncExternalStore, } from 'preact/compat';
7
- import { useCallback, useContext, useDebugValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, } from './hooks/react.js';
8
- import { Suspense } from './lynx/suspense.js';
5
+ import './snapshot/lynx/component.js';
6
+ import { Children, Component, Fragment, PureComponent, cloneElement, createContext, createRef, forwardRef, isValidElement, lazy, memo, useSyncExternalStore, } from 'preact/compat';
7
+ import { useCallback, useContext, useDebugValue, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, } from './core/hooks/react.js';
8
+ import { createElement } from './snapshot/lynx/element.js';
9
+ import { createPortal } from './snapshot/lynx/portals.js';
10
+ import { Suspense } from './snapshot/lynx/suspense.js';
9
11
  export { Component, createContext } from 'preact';
10
12
  export { PureComponent } from 'preact/compat';
11
- export * from './hooks/react.js';
13
+ export * from './core/hooks/react.js';
12
14
  /**
13
15
  * @internal
14
16
  */
@@ -37,7 +39,8 @@ export default {
37
39
  Suspense,
38
40
  lazy,
39
41
  createElement,
42
+ createPortal,
40
43
  };
41
- export { Children, createRef, Fragment, isValidElement, memo, forwardRef, Suspense, lazy, createElement, cloneElement, useSyncExternalStore, };
44
+ export { Children, createRef, Fragment, isValidElement, memo, forwardRef, Suspense, lazy, createElement, cloneElement, useSyncExternalStore, createPortal, };
42
45
  export * from './lynx-api.js';
43
46
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,WAAW,CAAC;AACnB,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,SAAS,EACT,UAAU,EACV,cAAc,EACd,IAAI,EACJ,IAAI,EACJ,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,WAAW,EACX,UAAU,EACV,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,eAAe,EACf,OAAO,EACP,UAAU,EACV,MAAM,EACN,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,cAAc,kBAAkB,CAAC;AAEjC;;GAEG;AACH,eAAe;IACb,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,SAAS;IACT,eAAe;IACf,MAAM;IACN,mBAAmB;IACnB,OAAO;IACP,WAAW;IACX,UAAU;IACV,aAAa;IACb,oBAAoB;IAEpB,aAAa;IACb,SAAS;IACT,QAAQ;IACR,cAAc;IACd,QAAQ;IACR,SAAS;IACT,aAAa;IACb,IAAI;IACJ,UAAU;IACV,QAAQ;IACR,IAAI;IACJ,aAAa;CACd,CAAC;AAEF,OAAO,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,cAAc,EACd,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,IAAI,EACJ,aAAa,EACb,YAAY,EACZ,oBAAoB,GACrB,CAAC;AAEF,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js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,GACb,CAAC;AAEF,cAAc,eAAe,CAAC"}
@@ -1,31 +1,33 @@
1
1
  import './lynx.js';
2
2
  import { __root } from './root.js';
3
- import { BackgroundSnapshotInstance } from './snapshot/backgroundSnapshot.js';
4
- import { __page, __pageId, createSnapshot, snapshotManager } from './snapshot/definition.js';
5
- import { DynamicPartType } from './snapshot/dynamicPartType.js';
6
- import { snapshotCreateList } from './snapshot/list.js';
7
- import { SnapshotInstance, snapshotCreatorMap } from './snapshot/snapshot.js';
8
- export { CHILDREN, COMPONENT, DIFF, DIRTY, DOM, FLAGS, INDEX, PARENT } from './renderToOpcodes/constants.js';
3
+ import { BackgroundSnapshotInstance } from './snapshot/snapshot/backgroundSnapshot.js';
4
+ import { __page, __pageId, createSnapshot, snapshotManager } from './snapshot/snapshot/definition.js';
5
+ import { DynamicPartType } from './snapshot/snapshot/dynamicPartType.js';
6
+ import { snapshotCreateList } from './snapshot/snapshot/list.js';
7
+ import { SnapshotInstance, snapshotCreatorMap } from './snapshot/snapshot/snapshot.js';
8
+ export { CHILDREN, COMPONENT, DIFF, DIRTY, DOM, FLAGS, INDEX, PARENT } from './shared/render-constants.js';
9
9
  export { __page, __pageId, __root };
10
10
  export { BackgroundSnapshotInstance, SnapshotInstance, snapshotCreateList, createSnapshot, snapshotManager, snapshotCreatorMap, };
11
11
  export declare const __DynamicPartSlot: DynamicPartType;
12
12
  export declare const __DynamicPartMultiChildren: DynamicPartType;
13
13
  export declare const __DynamicPartChildren: DynamicPartType;
14
14
  export declare const __DynamicPartListChildren: DynamicPartType;
15
- export { __DynamicPartChildren_0 } from './snapshot/dynamicPartType.js';
16
- export { updateSpread } from './snapshot/spread.js';
17
- export { updateEvent } from './snapshot/event.js';
18
- export { updateRef, transformRef } from './snapshot/ref.js';
19
- export { updateWorkletEvent } from './snapshot/workletEvent.js';
20
- export { updateWorkletRef } from './snapshot/workletRef.js';
21
- export { updateGesture } from './snapshot/gesture.js';
22
- export { updateListItemPlatformInfo } from './snapshot/platformInfo.js';
15
+ export { __DynamicPartChildren_0, __DynamicPartSlotV2_0 } from './snapshot/snapshot/dynamicPartType.js';
16
+ export declare const __DynamicPartSlotV2: DynamicPartType;
17
+ export declare const __DynamicPartListSlotV2: DynamicPartType;
18
+ export { updateSpread } from './snapshot/snapshot/spread.js';
19
+ export { updateEvent } from './snapshot/snapshot/event.js';
20
+ export { updateRef, transformRef } from './snapshot/snapshot/ref.js';
21
+ export { updateWorkletEvent } from './snapshot/snapshot/workletEvent.js';
22
+ export { updateWorkletRef } from './snapshot/snapshot/workletRef.js';
23
+ export { updateGesture } from './snapshot/snapshot/gesture.js';
24
+ export { updateListItemPlatformInfo } from './snapshot/snapshot/platformInfo.js';
23
25
  export { options, Component, process, } from 'preact';
24
26
  export type { Options } from 'preact';
25
- export { loadDynamicJS, __dynamicImport } from './lynx/dynamic-js.js';
26
- export { withInitDataInState } from './compat/initData.js';
27
- export { wrapWithLynxComponent } from './compat/lynxComponent.js';
28
- export { loadLazyBundle } from './lynx/lazy-bundle.js';
29
- export { transformToWorklet } from './worklet/call/transformToWorklet.js';
30
- export { registerWorkletOnBackground } from './worklet/hmr.js';
27
+ export { loadDynamicJS, __dynamicImport } from './snapshot/lynx/dynamic-js.js';
28
+ export { withInitDataInState } from './snapshot/compat/initData.js';
29
+ export { wrapWithLynxComponent } from './snapshot/compat/lynxComponent.js';
30
+ export { loadLazyBundle } from './snapshot/lynx/lazy-bundle.js';
31
+ export { transformToWorklet } from './snapshot/worklet/call/transformToWorklet.js';
32
+ export { registerWorkletOnBackground } from './snapshot/worklet/hmr.js';
31
33
  export { loadWorkletRuntime } from '@lynx-js/react/worklet-runtime/bindings';
@@ -3,44 +3,47 @@
3
3
  // LICENSE file in the root directory of this source tree.
4
4
  import { Suspense, createElement, lazy } from 'preact/compat';
5
5
  import './lynx.js';
6
- import { factory as factory2 } from './compat/componentIs.js';
7
- import { useMemo } from './hooks/react.js';
8
- import { loadLazyBundle } from './lynx/lazy-bundle.js';
6
+ import { useMemo } from './core/hooks/react.js';
9
7
  import { __root } from './root.js';
10
- import { BackgroundSnapshotInstance } from './snapshot/backgroundSnapshot.js';
11
- import { __page, __pageId, createSnapshot, snapshotManager } from './snapshot/definition.js';
12
- import { DynamicPartType } from './snapshot/dynamicPartType.js';
13
- import { snapshotCreateList } from './snapshot/list.js';
14
- import { SnapshotInstance, snapshotCreatorMap } from './snapshot/snapshot.js';
15
- export { CHILDREN, COMPONENT, DIFF, DIRTY, DOM, FLAGS, INDEX, PARENT } from './renderToOpcodes/constants.js';
8
+ import { factory as factory2 } from './snapshot/compat/componentIs.js';
9
+ import { loadLazyBundle } from './snapshot/lynx/lazy-bundle.js';
10
+ import { BackgroundSnapshotInstance } from './snapshot/snapshot/backgroundSnapshot.js';
11
+ import { __page, __pageId, createSnapshot, snapshotManager } from './snapshot/snapshot/definition.js';
12
+ import { DynamicPartType } from './snapshot/snapshot/dynamicPartType.js';
13
+ import { snapshotCreateList } from './snapshot/snapshot/list.js';
14
+ import { SnapshotInstance, snapshotCreatorMap } from './snapshot/snapshot/snapshot.js';
15
+ export { CHILDREN, COMPONENT, DIFF, DIRTY, DOM, FLAGS, INDEX, PARENT } from './shared/render-constants.js';
16
16
  export { __page, __pageId, __root };
17
17
  export { BackgroundSnapshotInstance, SnapshotInstance, snapshotCreateList, createSnapshot, snapshotManager, snapshotCreatorMap, };
18
18
  export const __DynamicPartSlot = DynamicPartType.Slot;
19
19
  export const __DynamicPartMultiChildren = DynamicPartType.MultiChildren;
20
20
  export const __DynamicPartChildren = DynamicPartType.Children;
21
21
  export const __DynamicPartListChildren = DynamicPartType.ListChildren;
22
- export { __DynamicPartChildren_0 } from './snapshot/dynamicPartType.js';
23
- export { updateSpread } from './snapshot/spread.js';
24
- export { updateEvent } from './snapshot/event.js';
25
- export { updateRef, transformRef } from './snapshot/ref.js';
26
- export { updateWorkletEvent } from './snapshot/workletEvent.js';
27
- export { updateWorkletRef } from './snapshot/workletRef.js';
28
- export { updateGesture } from './snapshot/gesture.js';
29
- export { updateListItemPlatformInfo } from './snapshot/platformInfo.js';
22
+ export { __DynamicPartChildren_0, __DynamicPartSlotV2_0 } from './snapshot/snapshot/dynamicPartType.js';
23
+ // v2 slot
24
+ export const __DynamicPartSlotV2 = DynamicPartType.SlotV2;
25
+ export const __DynamicPartListSlotV2 = DynamicPartType.ListSlotV2;
26
+ export { updateSpread } from './snapshot/snapshot/spread.js';
27
+ export { updateEvent } from './snapshot/snapshot/event.js';
28
+ export { updateRef, transformRef } from './snapshot/snapshot/ref.js';
29
+ export { updateWorkletEvent } from './snapshot/snapshot/workletEvent.js';
30
+ export { updateWorkletRef } from './snapshot/snapshot/workletRef.js';
31
+ export { updateGesture } from './snapshot/snapshot/gesture.js';
32
+ export { updateListItemPlatformInfo } from './snapshot/snapshot/platformInfo.js';
30
33
  export { options,
31
34
  // Component is not an internal API, but refresh needs it from 'react/internal'
32
35
  Component, process, } from 'preact';
33
- export { loadDynamicJS, __dynamicImport } from './lynx/dynamic-js.js';
34
- export { withInitDataInState } from './compat/initData.js';
35
- export { wrapWithLynxComponent } from './compat/lynxComponent.js';
36
+ export { loadDynamicJS, __dynamicImport } from './snapshot/lynx/dynamic-js.js';
37
+ export { withInitDataInState } from './snapshot/compat/initData.js';
38
+ export { wrapWithLynxComponent } from './snapshot/compat/lynxComponent.js';
36
39
  /**
37
40
  * @internal a polyfill for <component is=? />
38
41
  */
39
42
  export const __ComponentIsPolyfill = /* @__PURE__ */ factory2(
40
43
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
41
44
  { Suspense, lazy, createElement, useMemo }, loadLazyBundle);
42
- export { loadLazyBundle } from './lynx/lazy-bundle.js';
43
- export { transformToWorklet } from './worklet/call/transformToWorklet.js';
44
- export { registerWorkletOnBackground } from './worklet/hmr.js';
45
+ export { loadLazyBundle } from './snapshot/lynx/lazy-bundle.js';
46
+ export { transformToWorklet } from './snapshot/worklet/call/transformToWorklet.js';
47
+ export { registerWorkletOnBackground } from './snapshot/worklet/hmr.js';
45
48
  export { loadWorkletRuntime } from '@lynx-js/react/worklet-runtime/bindings';
46
49
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAG9D,OAAO,WAAW,CAAC;AAEnB,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE9E,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAE7G,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAEpC,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,kBAAkB,GACnB,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAoB,eAAe,CAAC,IAAI,CAAC;AACvE,MAAM,CAAC,MAAM,0BAA0B,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