@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,11 @@
1
+ import { createElement } from 'preact';
2
+ /**
3
+ * @internal
4
+ */
5
+ export function __etSlot(id, children) {
6
+ if (__BACKGROUND__) {
7
+ return createElement('slot', { id }, children);
8
+ }
9
+ throw new Error('__etSlot() should not run on the main thread. LEPUS ET children are lowered to slot arrays at compile time.');
10
+ }
11
+ //# sourceMappingURL=slot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slot.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/components/slot.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,EAAU,EAAE,QAA2B;IAC9D,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,aAAa,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;IACjD,CAAC;IACD,MAAM,IAAI,KAAK,CACb,6GAA6G,CAC9G,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare let __page: FiberElement;
2
+ export declare function setupPage(page: FiberElement): void;
@@ -0,0 +1,8 @@
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
+ export let __page;
5
+ export function setupPage(page) {
6
+ __page = page;
7
+ }
8
+ //# sourceMappingURL=page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/page/page.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,MAAM,CAAC,IAAI,MAAoB,CAAC;AAEhC,MAAM,UAAU,SAAS,CAAC,IAAkB;IAC1C,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Element Template-only root for renderPage.
3
+ */
4
+ declare let __root: {
5
+ __jsx?: React.ReactNode;
6
+ __opcodes?: any[];
7
+ nodeType?: Element['nodeType'];
8
+ };
9
+ declare function setRoot(root: typeof __root): void;
10
+ export { __root, setRoot };
@@ -0,0 +1,17 @@
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
+ * Element Template-only root for renderPage.
6
+ */
7
+ let __root;
8
+ function setRoot(root) {
9
+ __root = root;
10
+ // A fake ELEMENT_NODE to make preact/debug happy.
11
+ if (__DEV__ && __root) {
12
+ __root.nodeType = 1;
13
+ }
14
+ }
15
+ setRoot({});
16
+ export { __root, setRoot };
17
+ //# sourceMappingURL=root-instance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-instance.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/page/root-instance.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D;;GAEG;AACH,IAAI,MAIH,CAAC;AAEF,SAAS,OAAO,CAAC,IAAmB;IAClC,MAAM,GAAG,IAAI,CAAC;IAEd,kDAAkD;IAClD,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;QACtB,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC;IACtB,CAAC;AACH,CAAC;AAED,OAAO,CAAC,EAAE,CAAC,CAAC;AAEZ,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ElementTemplateUpdateCommandStream } from '../protocol/types.js';
2
+ export type { ElementTemplateUpdateCommandStream } from '../protocol/types.js';
3
+ export declare function applyElementTemplateUpdateCommands(stream: ElementTemplateUpdateCommandStream): void;
@@ -0,0 +1,145 @@
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 { elementTemplateRegistry } from './template/registry.js';
5
+ import { ElementTemplateUpdateOps } from '../protocol/opcodes.js';
6
+ export function applyElementTemplateUpdateCommands(stream) {
7
+ let i = 0;
8
+ while (i < stream.length) {
9
+ const op = stream[i++];
10
+ switch (op) {
11
+ case ElementTemplateUpdateOps.createTemplate: {
12
+ const handleId = stream[i++];
13
+ const templateKey = stream[i++];
14
+ const bundleUrl = stream[i++];
15
+ const attributeSlots = stream[i++];
16
+ const elementSlots = stream[i++];
17
+ if (__DEV__) {
18
+ const createError = validateCreateTemplatePayload(handleId, attributeSlots, elementSlots);
19
+ if (createError) {
20
+ lynx.reportError(createError);
21
+ continue;
22
+ }
23
+ }
24
+ const resolvedElementSlots = resolveElementSlots(elementSlots);
25
+ if (__DEV__ && resolvedElementSlots.hasError) {
26
+ continue;
27
+ }
28
+ const nativeRef = __CreateElementTemplate(templateKey, bundleUrl, normalizeAttributeSlots(attributeSlots), resolvedElementSlots.value, handleId);
29
+ if (nativeRef) {
30
+ elementTemplateRegistry.set(handleId, nativeRef);
31
+ }
32
+ break;
33
+ }
34
+ case ElementTemplateUpdateOps.setAttribute: {
35
+ const targetId = stream[i++];
36
+ const attrSlotIndex = stream[i++];
37
+ const value = stream[i++];
38
+ const nativeRef = resolveHandle(targetId, 'target');
39
+ if (!nativeRef) {
40
+ continue;
41
+ }
42
+ __SetAttributeOfElementTemplate(nativeRef, attrSlotIndex, value, null);
43
+ break;
44
+ }
45
+ case ElementTemplateUpdateOps.insertNode: {
46
+ const targetId = stream[i++];
47
+ const elementSlotIndex = stream[i++];
48
+ const childId = stream[i++];
49
+ const referenceId = stream[i++];
50
+ const nativeRef = resolveHandle(targetId, 'target');
51
+ const childRef = resolveHandle(childId, 'child');
52
+ if (!nativeRef || !childRef) {
53
+ continue;
54
+ }
55
+ const referenceRef = referenceId === 0 ? null : resolveHandle(referenceId, 'reference');
56
+ if (referenceId !== 0 && !referenceRef) {
57
+ continue;
58
+ }
59
+ __InsertNodeToElementTemplate(nativeRef, elementSlotIndex, childRef, referenceRef);
60
+ break;
61
+ }
62
+ case ElementTemplateUpdateOps.removeNode: {
63
+ const targetId = stream[i++];
64
+ const elementSlotIndex = stream[i++];
65
+ const childId = stream[i++];
66
+ const removedSubtreeHandleIds = stream[i++];
67
+ const nativeRef = resolveHandle(targetId, 'target');
68
+ const childRef = resolveHandle(childId, 'child');
69
+ if (!nativeRef || !childRef) {
70
+ continue;
71
+ }
72
+ __RemoveNodeFromElementTemplate(nativeRef, elementSlotIndex, childRef);
73
+ // The native API only detaches from the slot. Releasing ET runtime's
74
+ // strong refs after a successful detach lets JS GC reclaim the subtree.
75
+ for (const handleId of removedSubtreeHandleIds) {
76
+ elementTemplateRegistry.delete(handleId);
77
+ }
78
+ break;
79
+ }
80
+ default: {
81
+ lynx.reportError(new Error(`ElementTemplate update opcode ${String(op)} is not supported.`));
82
+ }
83
+ }
84
+ }
85
+ }
86
+ function resolveElementSlots(elementSlots) {
87
+ if (!Array.isArray(elementSlots)) {
88
+ return { hasError: false, value: null };
89
+ }
90
+ let hasError = false;
91
+ const value = elementSlots.map((children, slotIndex) => {
92
+ if (!Array.isArray(children)) {
93
+ if (__DEV__) {
94
+ lynx.reportError(new Error(`ElementTemplate create slot ${slotIndex} must be an array of child handles.`));
95
+ hasError = true;
96
+ }
97
+ return [];
98
+ }
99
+ return children
100
+ .map((childId) => {
101
+ const childRef = __DEV__
102
+ ? resolveHandle(childId, 'child')
103
+ : (elementTemplateRegistry.get(childId) ?? null);
104
+ if (__DEV__ && childRef === null) {
105
+ hasError = true;
106
+ }
107
+ return childRef;
108
+ })
109
+ .filter((childRef) => childRef !== null);
110
+ });
111
+ return { hasError, value };
112
+ }
113
+ function resolveHandle(id, role) {
114
+ const nativeRef = elementTemplateRegistry.get(id);
115
+ if (!nativeRef) {
116
+ lynx.reportError(new Error(`ElementTemplate update ${role} handle ${id} not found.`));
117
+ return null;
118
+ }
119
+ return nativeRef;
120
+ }
121
+ function isValidHandleId(handleId) {
122
+ return Number.isInteger(handleId) && handleId !== 0;
123
+ }
124
+ function validateCreateTemplatePayload(handleId, attributeSlots, elementSlots) {
125
+ if (!isValidHandleId(handleId)) {
126
+ return new Error(`ElementTemplate update has invalid handleId ${String(handleId)}.`);
127
+ }
128
+ if (elementTemplateRegistry.get(handleId)) {
129
+ return new Error(`ElementTemplate update received duplicate handleId ${handleId}.`);
130
+ }
131
+ if (attributeSlots != null && !Array.isArray(attributeSlots)) {
132
+ return new Error('ElementTemplate update create attributeSlots must be an array, null, or undefined.');
133
+ }
134
+ if (elementSlots != null && !Array.isArray(elementSlots)) {
135
+ return new Error('ElementTemplate update create elementSlots must be an array, null, or undefined.');
136
+ }
137
+ return null;
138
+ }
139
+ function normalizeAttributeSlots(attributeSlots) {
140
+ if (!Array.isArray(attributeSlots)) {
141
+ return attributeSlots;
142
+ }
143
+ return attributeSlots.map((value) => (value === undefined ? null : value));
144
+ }
145
+ //# sourceMappingURL=patch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch.js","sourceRoot":"","sources":["../../../src/element-template/runtime/patch.ts"],"names":[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,CAAC,CAAC,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,53 @@
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 the IFR (Instant First-Frame Rendering) on main thread.
6
+ */
7
+ import { renderOpcodesIntoElementTemplate } from './render-opcodes.js';
8
+ import { render as renderToString } from './render-to-opcodes.js';
9
+ import { profileEnd, profileStart } from '../../debug/profile.js';
10
+ import { ElementTemplateLifecycleConstant } from '../../protocol/lifecycle-constant.js';
11
+ import { __page } from '../page/page.js';
12
+ import { __root } from '../page/root-instance.js';
13
+ function renderMainThread() {
14
+ let opcodes;
15
+ let rootRefs = [];
16
+ profileStart('ReactLynx::renderMainThread');
17
+ try {
18
+ opcodes = renderToString(__root.__jsx, undefined);
19
+ }
20
+ catch (e) {
21
+ lynx.reportError(e);
22
+ opcodes = [];
23
+ }
24
+ finally {
25
+ profileEnd();
26
+ }
27
+ profileStart('ReactLynx::renderOpcodes');
28
+ try {
29
+ rootRefs = renderOpcodesIntoElementTemplate(opcodes).rootRefs;
30
+ for (const rootRef of rootRefs) {
31
+ __AppendElement(__page, rootRef);
32
+ }
33
+ }
34
+ finally {
35
+ profileEnd();
36
+ }
37
+ profileStart('ReactLynx::packSerializedETInstance');
38
+ try {
39
+ const instances = [];
40
+ for (const rootRef of rootRefs) {
41
+ instances.push(__SerializeElementTemplate(rootRef));
42
+ }
43
+ lynx.getJSContext().dispatchEvent({
44
+ type: ElementTemplateLifecycleConstant.hydrate,
45
+ data: instances,
46
+ });
47
+ }
48
+ finally {
49
+ profileEnd();
50
+ }
51
+ }
52
+ export { renderMainThread };
53
+ //# sourceMappingURL=render-main-thread.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-main-thread.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/render/render-main-thread.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACz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CAAC,CAAC;QACtD,CAAC;QAED,IAAI,CAAC,YAAY,EAAE,CAAC,aAAa,CAAC;YAChC,IAAI,EAAE,gCAAgC,CAAC,OAAO;YAC9C,IAAI,EAAE,SAAS;SAChB,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,UAAU,EAAE,CAAC;IACf,CAAC;AACH,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ export interface MainThreadCreateResult {
2
+ rootRefs: ElementRef[];
3
+ }
4
+ export declare function renderOpcodesIntoElementTemplate(opcodes: unknown[]): MainThreadCreateResult;
@@ -0,0 +1,134 @@
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
+ import { __OpAttr, __OpBegin, __OpEnd, __OpSlot, __OpText } from './render-to-opcodes.js';
5
+ import { __etAttrPlanMap } from '../template/attr-slot-plan.js';
6
+ import { createElementTemplateWithReservedHandle, reserveElementTemplateId } from '../template/handle.js';
7
+ const BUILTIN_RAW_TEXT_TEMPLATE_KEY = '_et_builtin_raw_text';
8
+ function appendChildToParent(parentTemplateKey, parentActiveElementSlot, rootRefs, elementRef) {
9
+ /* v8 ignore start -- stackTop is always rooted with `null`, never `undefined`. */
10
+ if (parentTemplateKey === undefined) {
11
+ return;
12
+ }
13
+ /* v8 ignore end */
14
+ if (parentTemplateKey === null) {
15
+ rootRefs.push(elementRef);
16
+ return;
17
+ }
18
+ if (!parentActiveElementSlot) {
19
+ throw new Error(`Template '${parentTemplateKey}' received a child outside of any element slot.`);
20
+ }
21
+ parentActiveElementSlot.push(elementRef);
22
+ }
23
+ export function renderOpcodesIntoElementTemplate(opcodes) {
24
+ const rootRefs = [];
25
+ const templateKeyStack = [null];
26
+ const attributeSlotsStack = [undefined];
27
+ const elementSlotsStack = [undefined];
28
+ const activeElementSlotStack = [undefined];
29
+ let stackTop = 0;
30
+ for (let i = 0; i < opcodes.length;) {
31
+ const opcode = opcodes[i];
32
+ switch (opcode) {
33
+ case __OpBegin: {
34
+ const vnode = opcodes[i + 1];
35
+ stackTop += 1;
36
+ templateKeyStack[stackTop] = vnode.type;
37
+ attributeSlotsStack[stackTop] = undefined;
38
+ elementSlotsStack[stackTop] = undefined;
39
+ activeElementSlotStack[stackTop] = undefined;
40
+ i += 2;
41
+ break;
42
+ }
43
+ case __OpEnd: {
44
+ if (stackTop === 0) {
45
+ throw new Error('Instruction mismatch: Popped root frame at __OpEnd');
46
+ }
47
+ const templateKey = templateKeyStack[stackTop];
48
+ const attributeSlots = attributeSlotsStack[stackTop];
49
+ const elementSlots = elementSlotsStack[stackTop];
50
+ stackTop -= 1;
51
+ // If templateKey is null, it means we popped the root frame?
52
+ // But __OpEnd should pair with __OpBegin.
53
+ // The Root frame is manually pushed and has no __OpBegin.
54
+ // So we should never pop the Root frame via __OpEnd unless there's an extra End.
55
+ if (templateKey === null) {
56
+ // This should effectively not happen if opcodes are balanced?
57
+ // Actually, if we are at root, and opcode has __OpEnd, it implies we are closing a component.
58
+ // The structure is: Root -> [Begin ... End] -> Root.
59
+ // Wait, if opcodes list ends, loop finishes.
60
+ // __OpEnd corresponds to a component.
61
+ // So if we pop, we must get a valid component frame.
62
+ /* v8 ignore start -- the synthetic root frame cannot be popped by balanced opcodes. */
63
+ throw new Error('Instruction mismatch: Popped root frame at __OpEnd');
64
+ /* v8 ignore end */
65
+ }
66
+ const concreteTemplateKey = templateKey;
67
+ const parentTemplateKey = templateKeyStack[stackTop];
68
+ const parentActiveElementSlot = activeElementSlotStack[stackTop];
69
+ const attrPlan = __etAttrPlanMap[concreteTemplateKey];
70
+ const handleId = reserveElementTemplateId();
71
+ let elementRef;
72
+ if (attrPlan === undefined) {
73
+ elementRef = createElementTemplateWithReservedHandle(handleId, concreteTemplateKey, null, attributeSlots ?? null, elementSlots ?? null);
74
+ }
75
+ else {
76
+ const preparedAttributeSlots = attributeSlots?.slice() ?? [];
77
+ for (let planIndex = 0; planIndex < attrPlan.length; planIndex += 2) {
78
+ const attrSlotIndex = attrPlan[planIndex];
79
+ const adapter = attrPlan[planIndex + 1];
80
+ preparedAttributeSlots[attrSlotIndex] = adapter(handleId, attrSlotIndex, preparedAttributeSlots[attrSlotIndex]);
81
+ }
82
+ elementRef = createElementTemplateWithReservedHandle(handleId, concreteTemplateKey, null, preparedAttributeSlots, elementSlots ?? null);
83
+ }
84
+ appendChildToParent(parentTemplateKey, parentActiveElementSlot, rootRefs, elementRef);
85
+ i += 1;
86
+ break;
87
+ }
88
+ case __OpAttr: {
89
+ const name = opcodes[i + 1];
90
+ const value = opcodes[i + 2];
91
+ if (name === 'attributeSlots') {
92
+ attributeSlotsStack[stackTop] = value;
93
+ }
94
+ i += 3;
95
+ break;
96
+ }
97
+ case __OpSlot: {
98
+ const slotId = opcodes[i + 1];
99
+ const elementSlots = elementSlotsStack[stackTop] ?? (elementSlotsStack[stackTop] = []);
100
+ const activeElementSlot = elementSlots[slotId] = [];
101
+ activeElementSlotStack[stackTop] = activeElementSlot;
102
+ i += 2;
103
+ break;
104
+ }
105
+ case __OpText: {
106
+ const text = opcodes[i + 1];
107
+ const handleId = reserveElementTemplateId();
108
+ const textRef = createElementTemplateWithReservedHandle(handleId, BUILTIN_RAW_TEXT_TEMPLATE_KEY, null, [String(text)], []);
109
+ const parentTemplateKey = templateKeyStack[stackTop];
110
+ if (parentTemplateKey === null) {
111
+ rootRefs.push(textRef);
112
+ }
113
+ else {
114
+ const activeElementSlot = activeElementSlotStack[stackTop];
115
+ if (!activeElementSlot) {
116
+ throw new Error(`Template '${parentTemplateKey}' received a text child outside of any element slot.`);
117
+ }
118
+ activeElementSlot.push(textRef);
119
+ }
120
+ i += 2;
121
+ break;
122
+ }
123
+ default:
124
+ // Unknown opcode, maybe skip? or throw?
125
+ // renderToString loop increments manually.
126
+ // If we hit here, something is desync.
127
+ throw new Error(`Unknown opcode: ${opcode}`);
128
+ }
129
+ }
130
+ return {
131
+ rootRefs,
132
+ };
133
+ }
134
+ //# sourceMappingURL=render-opcodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-opcodes.js","sourceRoot":"","sources":["../../../../src/element-template/runtime/render/render-opcodes.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAE1F,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,uCAAuC,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAE1G,MAAM,6BAA6B,GAAG,sBAAsB,CAAC;AAM7D,SAAS,mBAAmB,CAC1B,iBAA4C,EAC5C,uBAAiD,EACjD,QAAsB,EACtB,UAAsB;IAEtB,kFAAkF;IAClF,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;QACpC,OAAO;IACT,CAAC;IACD,mBAAmB;IAEnB,IAAI,iBAAiB,KAAK,IAAI,EAAE,CAAC;QAC/B,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,aAAa,iBAAiB,iDAAiD,CAAC,CAAC;IACnG,CAAC;IAED,uBAAuB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,OAAkB;IAElB,MAAM,QAAQ,GAAiB,EAAE,CAAC;IAClC,MAAM,gBAAgB,GAAyB,CAAC,IAAI,CAAC,CAAC;IACtD,MAAM,mBAAmB,GAA2C,CAAC,SAAS,CAAC,CAAC;IAChF,MAAM,iBAAiB,GAAgD,CAAC,SAAS,CAAC,CAAC;IACnF,MAAM,sBAAsB,GAAoC,CAAC,SAAS,CAAC,CAAC;IA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BAAiB,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;oBAC3D,IAAI,CAAC,iBAAiB,EAAE,CAAC;wBACvB,MAAM,IAAI,KAAK,CAAC,aAAa,iBAAiB,sDAAsD,CAAC,CAAC;oBACxG,CAAC;oBACD,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAClC,CAAC;gBACD,CAAC,IAAI,CAAC,CAAC;gBACP,MAAM;YACR,CAAC;YACD;gBACE,wCAAwC;gBACxC,2CAA2C;gBAC3C,uCAAuC;gBACvC,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAyB,EAAE,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;IACD,OAAO;QACL,QAAQ;KACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Render Preact JSX + Components to an HTML string.
3
+ * @param {VNode} vnode JSX Element / VNode to render
4
+ * @param {object} [context] Initial root context object
5
+ */
6
+ export declare function renderToString(vnode: any, context: any): any[];
7
+ export declare const __OpBegin = 0;
8
+ export declare const __OpEnd = 1;
9
+ export declare const __OpAttr = 2;
10
+ export declare const __OpText = 3;
11
+ export declare const __OpSlot = 4;
12
+ export default renderToString;
13
+ export declare const render: typeof renderToString;
14
+ export declare const renderToStaticMarkup: typeof renderToString;