@lynx-js/react 0.127.0 → 0.129.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 (428) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/components/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +6 -14
  4. package/refresh/.turbo/turbo-build.log +1 -1
  5. package/runtime/__test__/core/entry-re-eval.test.ts +161 -0
  6. package/runtime/__test__/core/reload-scoped-dual-thread-communication.test.ts +129 -0
  7. package/runtime/__test__/core/thread-function-call.test.ts +1 -0
  8. package/runtime/__test__/element-template/fixtures/background/render/_shared.tsx +2 -0
  9. package/runtime/__test__/element-template/internal/legacy-internal-guardrail.test.ts +1 -1
  10. package/runtime/__test__/element-template/native/index.test.ts +8 -0
  11. package/runtime/__test__/element-template/native/main-thread-ref-init-value.test.ts +100 -0
  12. package/runtime/__test__/element-template/native/reload-dual-thread-communication.test.ts +101 -0
  13. package/runtime/__test__/element-template/native/reload.test.ts +50 -1
  14. package/runtime/__test__/element-template/runtime/background/commit-hook.test.ts +104 -47
  15. package/runtime/__test__/element-template/runtime/background/event/compiled-fixtures.test.tsx +39 -48
  16. package/runtime/__test__/element-template/runtime/background/main-thread-function/compiled-fixtures.test.tsx +14 -10
  17. package/runtime/__test__/element-template/runtime/background/re-eval-reload.test.ts +69 -0
  18. package/runtime/__test__/element-template/runtime/hydration/hydration-listener.test.ts +31 -5
  19. package/runtime/__test__/element-template/runtime/patch/element-template-patch.test.tsx +17 -3
  20. package/runtime/__test__/element-template/runtime/render/render-transform.contract.test.ts +8 -3
  21. package/runtime/__test__/element-template/runtime/template/main-thread-function.test.ts +89 -2
  22. package/runtime/__test__/element-template/test-utils/debug/compiledFixtureModule.ts +5 -0
  23. package/runtime/__test__/element-template/test-utils/mock/globals.js +6 -0
  24. package/runtime/__test__/element-template/vitest.config.ts +4 -0
  25. package/runtime/__test__/snapshot/lifecycle/re-eval-reload.test.jsx +114 -0
  26. package/runtime/__test__/snapshot/lifecycle/reload-background-function.test.jsx +169 -0
  27. package/runtime/__test__/snapshot/lifecycle/reload-delayed-background.test.jsx +63 -0
  28. package/runtime/__test__/snapshot/lifecycle/reload-delayed-main-thread.test.jsx +103 -0
  29. package/runtime/__test__/snapshot/lifecycle.test.jsx +61 -1
  30. package/runtime/__test__/snapshot/lynx/lazy-effect-scheduling.test.jsx +105 -0
  31. package/runtime/__test__/snapshot/ssr.test.jsx +2 -2
  32. package/runtime/__test__/snapshot/worklet/runOnBackground.test.js +6 -11
  33. package/runtime/__test__/snapshot/worklet/runOnMainThread.test.jsx +1 -1
  34. package/runtime/__test__/snapshot/worklet/workletRef.test.jsx +24 -1
  35. package/runtime/__test__/worklet-runtime/initEntry.test.js +109 -0
  36. package/runtime/__test__/worklet-runtime/jsFunctionLifecycle.test.js +15 -1
  37. package/runtime/__test__/worklet-runtime/mainThreadObject.test.js +46 -0
  38. package/runtime/__test__/worklet-runtime/object-methods.test.js +2 -3
  39. package/runtime/__test__/worklet-runtime/runOnMainThread.test.js +3 -3
  40. package/runtime/lazy/element-template-internal.js +0 -1
  41. package/runtime/lazy/internal.js +0 -1
  42. package/runtime/lib/core/background-function/exec-map.d.ts +2 -0
  43. package/runtime/lib/core/background-function/exec-map.js +7 -0
  44. package/runtime/lib/core/background-function/exec-map.js.map +1 -1
  45. package/runtime/lib/core/background-function/handle.js.map +1 -1
  46. package/runtime/lib/core/background-function/run-on-background.js +15 -16
  47. package/runtime/lib/core/background-function/run-on-background.js.map +1 -1
  48. package/runtime/lib/core/capture-main-thread-object.js.map +1 -1
  49. package/runtime/lib/core/card-lifetime.d.ts +5 -0
  50. package/runtime/lib/core/card-lifetime.js +17 -0
  51. package/runtime/lib/core/card-lifetime.js.map +1 -0
  52. package/runtime/lib/core/commit-context.js.map +1 -1
  53. package/runtime/lib/core/compat/legacy-react-runtime.js.map +1 -1
  54. package/runtime/lib/core/compat/lynxComponent.js.map +1 -1
  55. package/runtime/lib/core/component.js.map +1 -1
  56. package/runtime/lib/core/entry-reload.d.ts +7 -0
  57. package/runtime/lib/core/entry-reload.js +49 -0
  58. package/runtime/lib/core/entry-reload.js.map +1 -0
  59. package/runtime/lib/core/forceRootRender.js.map +1 -1
  60. package/runtime/lib/core/globalProps.js.map +1 -1
  61. package/runtime/lib/core/hooks/mainThread.js.map +1 -1
  62. package/runtime/lib/core/hooks/mainThreadImpl.js.map +1 -1
  63. package/runtime/lib/core/hooks/react.js.map +1 -1
  64. package/runtime/lib/core/hooks/useLynxGlobalEventListener.js.map +1 -1
  65. package/runtime/lib/core/initData.js.map +1 -1
  66. package/runtime/lib/core/lynx/dynamic-import.js.map +1 -1
  67. package/runtime/lib/core/lynx/lazy-bundle.js +4 -1
  68. package/runtime/lib/core/lynx/lazy-bundle.js.map +1 -1
  69. package/runtime/lib/core/lynx/runtime-backend.js.map +1 -1
  70. package/runtime/lib/core/lynx/runtime-version.js.map +1 -1
  71. package/runtime/lib/core/lynx-data-processors.js.map +1 -1
  72. package/runtime/lib/core/lynx-page-data.js.map +1 -1
  73. package/runtime/lib/core/lynx-update-data.js.map +1 -1
  74. package/runtime/lib/core/main-thread-function.js.map +1 -1
  75. package/runtime/lib/core/main-thread-object-handle-registry.js.map +1 -1
  76. package/runtime/lib/core/main-thread-object.js +1 -4
  77. package/runtime/lib/core/main-thread-object.js.map +1 -1
  78. package/runtime/lib/core/main-thread-ref-id.js +4 -4
  79. package/runtime/lib/core/main-thread-ref-id.js.map +1 -1
  80. package/runtime/lib/core/main-thread-ref-init-value.js.map +1 -1
  81. package/runtime/lib/core/main-thread-ref.js.map +1 -1
  82. package/runtime/lib/core/mts-capability.js.map +1 -1
  83. package/runtime/lib/core/performance.js.map +1 -1
  84. package/runtime/lib/core/ref.js.map +1 -1
  85. package/runtime/lib/core/reload-scoped-event.d.ts +5 -0
  86. package/runtime/lib/core/reload-scoped-event.js +26 -0
  87. package/runtime/lib/core/reload-scoped-event.js.map +1 -0
  88. package/runtime/lib/core/reload-version.js +4 -3
  89. package/runtime/lib/core/reload-version.js.map +1 -1
  90. package/runtime/lib/core/runtime-destroy.d.ts +2 -0
  91. package/runtime/lib/core/runtime-destroy.js +9 -0
  92. package/runtime/lib/core/runtime-destroy.js.map +1 -1
  93. package/runtime/lib/core/thread-function-call/main-thread.js +5 -4
  94. package/runtime/lib/core/thread-function-call/main-thread.js.map +1 -1
  95. package/runtime/lib/core/thread-function-call/return-value.js +6 -5
  96. package/runtime/lib/core/thread-function-call/return-value.js.map +1 -1
  97. package/runtime/lib/document.js.map +1 -1
  98. package/runtime/lib/element-template/background/attr-slots.js.map +1 -1
  99. package/runtime/lib/element-template/background/commit-context.js.map +1 -1
  100. package/runtime/lib/element-template/background/commit-hook.js +19 -16
  101. package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
  102. package/runtime/lib/element-template/background/destroy.js.map +1 -1
  103. package/runtime/lib/element-template/background/document.js.map +1 -1
  104. package/runtime/lib/element-template/background/hydrate.js.map +1 -1
  105. package/runtime/lib/element-template/background/hydration-listener.js +2 -6
  106. package/runtime/lib/element-template/background/hydration-listener.js.map +1 -1
  107. package/runtime/lib/element-template/background/instance.js.map +1 -1
  108. package/runtime/lib/element-template/background/manager.js.map +1 -1
  109. package/runtime/lib/element-template/background/page-root-hydrate.js.map +1 -1
  110. package/runtime/lib/element-template/background/render-scope.js.map +1 -1
  111. package/runtime/lib/element-template/client/root.js.map +1 -1
  112. package/runtime/lib/element-template/debug/alog.js.map +1 -1
  113. package/runtime/lib/element-template/debug/elementPAPICall.js.map +1 -1
  114. package/runtime/lib/element-template/debug/profile.js.map +1 -1
  115. package/runtime/lib/element-template/hydration-map.js.map +1 -1
  116. package/runtime/lib/element-template/index.js.map +1 -1
  117. package/runtime/lib/element-template/internal.d.ts +0 -1
  118. package/runtime/lib/element-template/internal.js +0 -1
  119. package/runtime/lib/element-template/internal.js.map +1 -1
  120. package/runtime/lib/element-template/jsx-dev-runtime/index.js.map +1 -1
  121. package/runtime/lib/element-template/jsx-runtime/index.js.map +1 -1
  122. package/runtime/lib/element-template/lynx/env.js.map +1 -1
  123. package/runtime/lib/element-template/lynx/performance.js.map +1 -1
  124. package/runtime/lib/element-template/main-thread-ref-init-value.d.ts +3 -0
  125. package/runtime/lib/element-template/main-thread-ref-init-value.js +38 -0
  126. package/runtime/lib/element-template/main-thread-ref-init-value.js.map +1 -0
  127. package/runtime/lib/element-template/native/callDestroyLifetimeFun.js.map +1 -1
  128. package/runtime/lib/element-template/native/index.js +2 -0
  129. package/runtime/lib/element-template/native/index.js.map +1 -1
  130. package/runtime/lib/element-template/native/main-thread-api.js.map +1 -1
  131. package/runtime/lib/element-template/native/mts-destroy.js +2 -0
  132. package/runtime/lib/element-template/native/mts-destroy.js.map +1 -1
  133. package/runtime/lib/element-template/native/patch-listener.js +1 -4
  134. package/runtime/lib/element-template/native/patch-listener.js.map +1 -1
  135. package/runtime/lib/element-template/native/reload-background.d.ts +1 -1
  136. package/runtime/lib/element-template/native/reload-background.js +12 -1
  137. package/runtime/lib/element-template/native/reload-background.js.map +1 -1
  138. package/runtime/lib/element-template/native/reload-main-thread.d.ts +6 -0
  139. package/runtime/lib/element-template/native/reload-main-thread.js +18 -2
  140. package/runtime/lib/element-template/native/reload-main-thread.js.map +1 -1
  141. package/runtime/lib/element-template/prop-adapters/event-value.js.map +1 -1
  142. package/runtime/lib/element-template/prop-adapters/event.js.map +1 -1
  143. package/runtime/lib/element-template/prop-adapters/ref.js.map +1 -1
  144. package/runtime/lib/element-template/prop-adapters/spread.js.map +1 -1
  145. package/runtime/lib/element-template/protocol/lifecycle-constant.d.ts +2 -1
  146. package/runtime/lib/element-template/protocol/lifecycle-constant.js +1 -0
  147. package/runtime/lib/element-template/protocol/lifecycle-constant.js.map +1 -1
  148. package/runtime/lib/element-template/protocol/opcodes.js.map +1 -1
  149. package/runtime/lib/element-template/protocol/page.js.map +1 -1
  150. package/runtime/lib/element-template/protocol/template-type.js.map +1 -1
  151. package/runtime/lib/element-template/protocol/types.d.ts +0 -2
  152. package/runtime/lib/element-template/protocol/types.js.map +1 -1
  153. package/runtime/lib/element-template/protocol/update-event.js.map +1 -1
  154. package/runtime/lib/element-template/runtime/list/list.js.map +1 -1
  155. package/runtime/lib/element-template/runtime/page/authored-page.js.map +1 -1
  156. package/runtime/lib/element-template/runtime/page/page.js.map +1 -1
  157. package/runtime/lib/element-template/runtime/page/root-instance.js.map +1 -1
  158. package/runtime/lib/element-template/runtime/patch.js.map +1 -1
  159. package/runtime/lib/element-template/runtime/render/create-rendered-host.js.map +1 -1
  160. package/runtime/lib/element-template/runtime/render/host.js.map +1 -1
  161. package/runtime/lib/element-template/runtime/render/render-components.js.map +1 -1
  162. package/runtime/lib/element-template/runtime/render/render-direct.js.map +1 -1
  163. package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
  164. package/runtime/lib/element-template/runtime/template/attr-slot-plan.js.map +1 -1
  165. package/runtime/lib/element-template/runtime/template/handle.js.map +1 -1
  166. package/runtime/lib/element-template/runtime/template/main-thread-background-function.js.map +1 -1
  167. package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js.map +1 -1
  168. package/runtime/lib/element-template/runtime/template/main-thread-event-ctx.js.map +1 -1
  169. package/runtime/lib/element-template/runtime/template/main-thread-function.js.map +1 -1
  170. package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.js.map +1 -1
  171. package/runtime/lib/element-template/runtime/template/registry.js.map +1 -1
  172. package/runtime/lib/element-template/runtime/template/typed-attributes.js.map +1 -1
  173. package/runtime/lib/element-template/runtime-marker.js.map +1 -1
  174. package/runtime/lib/index.js.map +1 -1
  175. package/runtime/lib/internal.d.ts +0 -1
  176. package/runtime/lib/internal.js +0 -1
  177. package/runtime/lib/internal.js.map +1 -1
  178. package/runtime/lib/lynx-api.js.map +1 -1
  179. package/runtime/lib/lynx.js.map +1 -1
  180. package/runtime/lib/root.js.map +1 -1
  181. package/runtime/lib/runtime-marker.js.map +1 -1
  182. package/runtime/lib/shared/attribute-name.js.map +1 -1
  183. package/runtime/lib/shared/component-stack.js.map +1 -1
  184. package/runtime/lib/shared/index-map.d.ts +4 -1
  185. package/runtime/lib/shared/index-map.js +5 -2
  186. package/runtime/lib/shared/index-map.js.map +1 -1
  187. package/runtime/lib/shared/profile.js.map +1 -1
  188. package/runtime/lib/shared/render-constants.js.map +1 -1
  189. package/runtime/lib/snapshot/alog/elementPAPICall.js.map +1 -1
  190. package/runtime/lib/snapshot/alog/index.js.map +1 -1
  191. package/runtime/lib/snapshot/alog/render.js.map +1 -1
  192. package/runtime/lib/snapshot/compat/componentIs.js.map +1 -1
  193. package/runtime/lib/snapshot/debug/debug.js.map +1 -1
  194. package/runtime/lib/snapshot/debug/describeInvalidValue.js.map +1 -1
  195. package/runtime/lib/snapshot/debug/formatPatch.js.map +1 -1
  196. package/runtime/lib/snapshot/debug/printSnapshot.js.map +1 -1
  197. package/runtime/lib/snapshot/debug/profileHooks.js.map +1 -1
  198. package/runtime/lib/snapshot/debug/vnodeSource.js.map +1 -1
  199. package/runtime/lib/snapshot/gesture/processGesture.js.map +1 -1
  200. package/runtime/lib/snapshot/gesture/processGestureBagkround.js.map +1 -1
  201. package/runtime/lib/snapshot/gesture/types.js.map +1 -1
  202. package/runtime/lib/snapshot/index.js.map +1 -1
  203. package/runtime/lib/snapshot/lifecycle/constant.js.map +1 -1
  204. package/runtime/lib/snapshot/lifecycle/destroy.js +6 -0
  205. package/runtime/lib/snapshot/lifecycle/destroy.js.map +1 -1
  206. package/runtime/lib/snapshot/lifecycle/event/delayEvents.js.map +1 -1
  207. package/runtime/lib/snapshot/lifecycle/event/delayLifecycleEvents.js.map +1 -1
  208. package/runtime/lib/snapshot/lifecycle/event/firstScreenSync.d.ts +6 -2
  209. package/runtime/lib/snapshot/lifecycle/event/firstScreenSync.js +21 -18
  210. package/runtime/lib/snapshot/lifecycle/event/firstScreenSync.js.map +1 -1
  211. package/runtime/lib/snapshot/lifecycle/isRendering.js.map +1 -1
  212. package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -1
  213. package/runtime/lib/snapshot/lifecycle/patch/error.js.map +1 -1
  214. package/runtime/lib/snapshot/lifecycle/patch/globalState.js.map +1 -1
  215. package/runtime/lib/snapshot/lifecycle/patch/isMainThreadHydrating.js.map +1 -1
  216. package/runtime/lib/snapshot/lifecycle/patch/nodesRefApply.js.map +1 -1
  217. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js.map +1 -1
  218. package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js.map +1 -1
  219. package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -1
  220. package/runtime/lib/snapshot/lifecycle/ref/delay.js.map +1 -1
  221. package/runtime/lib/snapshot/lifecycle/reload.d.ts +9 -2
  222. package/runtime/lib/snapshot/lifecycle/reload.js +29 -8
  223. package/runtime/lib/snapshot/lifecycle/reload.js.map +1 -1
  224. package/runtime/lib/snapshot/lifecycle/render.js.map +1 -1
  225. package/runtime/lib/snapshot/list/list.js +3 -2
  226. package/runtime/lib/snapshot/list/list.js.map +1 -1
  227. package/runtime/lib/snapshot/list/listUpdateInfo.js.map +1 -1
  228. package/runtime/lib/snapshot/list/pendingListUpdates.js.map +1 -1
  229. package/runtime/lib/snapshot/lynx/calledByNative.js +3 -3
  230. package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -1
  231. package/runtime/lib/snapshot/lynx/children.js.map +1 -1
  232. package/runtime/lib/snapshot/lynx/element.js.map +1 -1
  233. package/runtime/lib/snapshot/lynx/env.js.map +1 -1
  234. package/runtime/lib/snapshot/lynx/injectLepusMethods.js.map +1 -1
  235. package/runtime/lib/snapshot/lynx/lazyBundleConstants.js.map +1 -1
  236. package/runtime/lib/snapshot/lynx/nodesRef.js.map +1 -1
  237. package/runtime/lib/snapshot/lynx/performance.js.map +1 -1
  238. package/runtime/lib/snapshot/lynx/portals.js.map +1 -1
  239. package/runtime/lib/snapshot/lynx/portalsPending.js.map +1 -1
  240. package/runtime/lib/snapshot/lynx/prepareLazyBundleMTS.js.map +1 -1
  241. package/runtime/lib/snapshot/lynx/runWithForce.js.map +1 -1
  242. package/runtime/lib/snapshot/lynx/suspense.js.map +1 -1
  243. package/runtime/lib/snapshot/lynx/tt.js.map +1 -1
  244. package/runtime/lib/snapshot/renderToOpcodes/hydrate.js.map +1 -1
  245. package/runtime/lib/snapshot/renderToOpcodes/index.js.map +1 -1
  246. package/runtime/lib/snapshot/renderToOpcodes/opcodes.js.map +1 -1
  247. package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
  248. package/runtime/lib/snapshot/snapshot/constants.js.map +1 -1
  249. package/runtime/lib/snapshot/snapshot/definition.js.map +1 -1
  250. package/runtime/lib/snapshot/snapshot/dynamicPartType.js.map +1 -1
  251. package/runtime/lib/snapshot/snapshot/event.js.map +1 -1
  252. package/runtime/lib/snapshot/snapshot/gesture.js.map +1 -1
  253. package/runtime/lib/snapshot/snapshot/index.js.map +1 -1
  254. package/runtime/lib/snapshot/snapshot/list.js +2 -1
  255. package/runtime/lib/snapshot/snapshot/list.js.map +1 -1
  256. package/runtime/lib/snapshot/snapshot/platformInfo.js.map +1 -1
  257. package/runtime/lib/snapshot/snapshot/reconstructInstanceTree.js.map +1 -1
  258. package/runtime/lib/snapshot/snapshot/ref.js.map +1 -1
  259. package/runtime/lib/snapshot/snapshot/snapshot.js.map +1 -1
  260. package/runtime/lib/snapshot/snapshot/snapshotCreatorMap.js.map +1 -1
  261. package/runtime/lib/snapshot/snapshot/snapshotInstanceHydrationMap.js.map +1 -1
  262. package/runtime/lib/snapshot/snapshot/snapshotInstanceManager.d.ts +4 -2
  263. package/runtime/lib/snapshot/snapshot/snapshotInstanceManager.js +11 -11
  264. package/runtime/lib/snapshot/snapshot/snapshotInstanceManager.js.map +1 -1
  265. package/runtime/lib/snapshot/snapshot/spread.js.map +1 -1
  266. package/runtime/lib/snapshot/snapshot/types.js.map +1 -1
  267. package/runtime/lib/snapshot/snapshot/utils.js.map +1 -1
  268. package/runtime/lib/snapshot/snapshot/workletEvent.js.map +1 -1
  269. package/runtime/lib/snapshot/snapshot/workletRef.js.map +1 -1
  270. package/runtime/lib/snapshot/worklet/call/runOnMainThread.d.ts +1 -0
  271. package/runtime/lib/snapshot/worklet/call/runOnMainThread.js +6 -1
  272. package/runtime/lib/snapshot/worklet/call/runOnMainThread.js.map +1 -1
  273. package/runtime/lib/snapshot/worklet/ctx.d.ts +1 -1
  274. package/runtime/lib/snapshot/worklet/ctx.js +6 -1
  275. package/runtime/lib/snapshot/worklet/ctx.js.map +1 -1
  276. package/runtime/lib/snapshot/worklet/destroy.js.map +1 -1
  277. package/runtime/lib/snapshot/worklet/functionality.js.map +1 -1
  278. package/runtime/lib/snapshot/worklet/hmr.js.map +1 -1
  279. package/runtime/lib/snapshot/worklet/ref/updateInitValue.js +6 -0
  280. package/runtime/lib/snapshot/worklet/ref/updateInitValue.js.map +1 -1
  281. package/runtime/lib/tsconfig.tsbuildinfo +1 -1
  282. package/runtime/lib/utils.js.map +1 -1
  283. package/runtime/lib/worklet-runtime/api/animation/animation.js.map +1 -1
  284. package/runtime/lib/worklet-runtime/api/animation/effect.js.map +1 -1
  285. package/runtime/lib/worklet-runtime/api/element.js.map +1 -1
  286. package/runtime/lib/worklet-runtime/api/lepusQuerySelector.js.map +1 -1
  287. package/runtime/lib/worklet-runtime/api/lynxApi.js.map +1 -1
  288. package/runtime/lib/worklet-runtime/bindings/bindings.js.map +1 -1
  289. package/runtime/lib/worklet-runtime/bindings/events.js.map +1 -1
  290. package/runtime/lib/worklet-runtime/bindings/index.d.ts +0 -1
  291. package/runtime/lib/worklet-runtime/bindings/index.js +0 -1
  292. package/runtime/lib/worklet-runtime/bindings/index.js.map +1 -1
  293. package/runtime/lib/worklet-runtime/bindings/observers.js.map +1 -1
  294. package/runtime/lib/worklet-runtime/bindings/types.js.map +1 -1
  295. package/runtime/lib/worklet-runtime/delayRunOnBackground.js +3 -1
  296. package/runtime/lib/worklet-runtime/delayRunOnBackground.js.map +1 -1
  297. package/runtime/lib/worklet-runtime/delayWorkletEvent.js.map +1 -1
  298. package/runtime/lib/worklet-runtime/eomImpl.js.map +1 -1
  299. package/runtime/lib/worklet-runtime/eventPropagation.js.map +1 -1
  300. package/runtime/lib/worklet-runtime/global.js.map +1 -1
  301. package/runtime/lib/worklet-runtime/hydrate.js.map +1 -1
  302. package/runtime/lib/worklet-runtime/index.js +6 -0
  303. package/runtime/lib/worklet-runtime/index.js.map +1 -1
  304. package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js +2 -1
  305. package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js.map +1 -1
  306. package/runtime/lib/worklet-runtime/listeners.js +2 -2
  307. package/runtime/lib/worklet-runtime/listeners.js.map +1 -1
  308. package/runtime/lib/worklet-runtime/mainThreadObject.js +3 -1
  309. package/runtime/lib/worklet-runtime/mainThreadObject.js.map +1 -1
  310. package/runtime/lib/worklet-runtime/runOnMainThread.js +4 -3
  311. package/runtime/lib/worklet-runtime/runOnMainThread.js.map +1 -1
  312. package/runtime/lib/worklet-runtime/utils/mainThreadFlushLoopGuard.js.map +1 -1
  313. package/runtime/lib/worklet-runtime/utils/profile.js.map +1 -1
  314. package/runtime/lib/worklet-runtime/utils/version.js.map +1 -1
  315. package/runtime/lib/worklet-runtime/workletRef.js.map +1 -1
  316. package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
  317. package/runtime/src/core/background-function/exec-map.ts +9 -0
  318. package/runtime/src/core/background-function/run-on-background.ts +14 -16
  319. package/runtime/src/core/card-lifetime.ts +18 -0
  320. package/runtime/src/core/entry-reload.ts +63 -0
  321. package/runtime/src/core/lynx/lazy-bundle.ts +4 -1
  322. package/runtime/src/core/main-thread-object.ts +1 -8
  323. package/runtime/src/core/main-thread-ref-id.ts +5 -4
  324. package/runtime/src/core/reload-scoped-event.ts +35 -0
  325. package/runtime/src/core/reload-version.ts +5 -3
  326. package/runtime/src/core/runtime-destroy.ts +11 -0
  327. package/runtime/src/core/thread-function-call/main-thread.ts +4 -4
  328. package/runtime/src/core/thread-function-call/return-value.ts +6 -5
  329. package/runtime/src/element-template/background/commit-hook.ts +20 -17
  330. package/runtime/src/element-template/background/hydration-listener.ts +2 -6
  331. package/runtime/src/element-template/internal.ts +0 -1
  332. package/runtime/src/element-template/main-thread-ref-init-value.ts +44 -0
  333. package/runtime/src/element-template/native/index.ts +2 -0
  334. package/runtime/src/element-template/native/mts-destroy.ts +3 -0
  335. package/runtime/src/element-template/native/patch-listener.ts +0 -5
  336. package/runtime/src/element-template/native/reload-background.ts +13 -1
  337. package/runtime/src/element-template/native/reload-main-thread.ts +30 -2
  338. package/runtime/src/element-template/protocol/lifecycle-constant.ts +1 -0
  339. package/runtime/src/element-template/protocol/types.ts +0 -2
  340. package/runtime/src/internal.ts +0 -1
  341. package/runtime/src/shared/index-map.ts +3 -2
  342. package/runtime/src/snapshot/lifecycle/destroy.ts +7 -0
  343. package/runtime/src/snapshot/lifecycle/event/firstScreenSync.ts +26 -19
  344. package/runtime/src/snapshot/lifecycle/reload.ts +47 -11
  345. package/runtime/src/snapshot/list/list.ts +9 -2
  346. package/runtime/src/snapshot/lynx/calledByNative.ts +3 -4
  347. package/runtime/src/snapshot/snapshot/list.ts +5 -1
  348. package/runtime/src/snapshot/snapshot/snapshotInstanceManager.ts +19 -12
  349. package/runtime/src/snapshot/worklet/call/runOnMainThread.ts +10 -1
  350. package/runtime/src/snapshot/worklet/ctx.ts +10 -1
  351. package/runtime/src/snapshot/worklet/ref/updateInitValue.ts +6 -0
  352. package/runtime/src/worklet-runtime/README.md +13 -0
  353. package/runtime/src/worklet-runtime/bindings/index.ts +0 -1
  354. package/runtime/src/worklet-runtime/delayRunOnBackground.ts +3 -1
  355. package/runtime/src/worklet-runtime/index.ts +7 -0
  356. package/runtime/src/worklet-runtime/jsFunctionLifecycle.ts +2 -1
  357. package/runtime/src/worklet-runtime/listeners.ts +4 -7
  358. package/runtime/src/worklet-runtime/mainThreadObject.ts +2 -1
  359. package/runtime/src/worklet-runtime/runOnMainThread.ts +4 -3
  360. package/runtime/tsconfig.json +2 -0
  361. package/runtime/types/types.d.ts +3 -1
  362. package/runtime/vitest.config.ts +4 -0
  363. package/testing-library/.turbo/turbo-build.log +12 -12
  364. package/testing-library/dist/env/index.js +3 -15
  365. package/testing-library/dist/plugins/index.js +10 -0
  366. package/testing-library/dist/rstest-config.js +15 -0
  367. package/testing-library/dist/setupFiles/common/worklet-runtime-init.js +11 -0
  368. package/testing-library/rstest.config.ts +3 -0
  369. package/testing-library/src/__tests__/rstest-config.test.js +34 -1
  370. package/testing-library/src/__tests__/worklet.test.jsx +51 -37
  371. package/testing-library/src/plugins/vitest.ts +5 -1
  372. package/testing-library/src/rstest-config.ts +17 -1
  373. package/testing-library/src/setupFiles/common/worklet-runtime-init.js +22 -0
  374. package/transform/.turbo/turbo-build$colon$wasm.log +345 -150
  375. package/transform/__test__/defines.spec.js +187 -12
  376. package/transform/__test__/fixture.spec.js +166 -48
  377. package/transform/__test__/object-methods.spec.js +1 -3
  378. package/transform/crates/swc_plugin_worklet/definition_imports.rs +97 -0
  379. package/transform/crates/swc_plugin_worklet/gen_stmt.rs +26 -10
  380. package/transform/crates/swc_plugin_worklet/lib.rs +138 -153
  381. package/transform/crates/swc_plugin_worklet/napi.rs +10 -1
  382. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_capture_env_lepus.js +4 -4
  383. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_expose_object_method_capture_channels_lepus.js +3 -5
  384. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_ident_from_this_lepus.js +2 -4
  385. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_lepus.js +4 -4
  386. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_3_lepus.js +3 -5
  387. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_4_lepus.js +2 -4
  388. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_lepus.js +4 -4
  389. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_computed_object_method_key_lepus.js +2 -4
  390. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_globals.js +2 -4
  391. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_object_method_local_decls_lepus.js +2 -4
  392. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_capture_type_annotations.js +2 -4
  393. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_destructure_from_closure.js +2 -4
  394. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_extract_catch_clause_params.js +2 -4
  395. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_extract_idents_inside_of_ctx.js +2 -4
  396. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_not_transform_recursively.js +2 -4
  397. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_lepus.js +6 -6
  398. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_skip_shared_identifiers_lepus.js +2 -4
  399. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_arrow_function.js +2 -4
  400. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_fn_decl_lepus.js +2 -4
  401. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_function_expr.js +2 -4
  402. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_lepus.js +2 -4
  403. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_property_lepus.js +2 -4
  404. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_static_lepus.js +2 -4
  405. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_in_class_static_property_lepus.js +2 -4
  406. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_js_fn_in_run_on_js_lepus.js +2 -4
  407. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus.js +4 -4
  408. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus_alias.js +2 -4
  409. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus_general.js +2 -4
  410. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_lepus_general_mixed.js +2 -4
  411. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_multiple_worklets.js +3 -5
  412. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_multiple_worklets_in_func.js +3 -5
  413. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_object_methods_lepus.js +2 -4
  414. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_transform_ui_worklet_lepus.js +2 -4
  415. package/transform/dist/wasm.cjs +1 -1
  416. package/transform/index.d.ts +27 -1
  417. package/transform/src/lib.rs +354 -23
  418. package/transform/swc-plugin-reactlynx/.turbo/turbo-build.log +53 -52
  419. package/transform/swc-plugin-reactlynx/swc_plugin_reactlynx.wasm +0 -0
  420. package/transform/swc-plugin-reactlynx-compat/.turbo/turbo-build.log +63 -293
  421. package/runtime/lib/worklet-runtime/bindings/loadRuntime.d.ts +0 -8
  422. package/runtime/lib/worklet-runtime/bindings/loadRuntime.js +0 -23
  423. package/runtime/lib/worklet-runtime/bindings/loadRuntime.js.map +0 -1
  424. package/runtime/src/worklet-runtime/bindings/loadRuntime.ts +0 -25
  425. package/runtime/worklet-runtime/dev.js +0 -775
  426. package/runtime/worklet-runtime/main.js +0 -1
  427. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_add_worklet_runtime_ident_with_inner_ident.js +0 -13
  428. package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_add_worklet_runtime_ident_with_outer_ident.js +0 -13
@@ -1 +0,0 @@
1
- (()=>{var e,t,r;let n,l,i;function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class a{cancel(){return __ElementAnimate(this.effect.target.element,[3,this.id])}pause(){return __ElementAnimate(this.effect.target.element,[2,this.id])}play(){return __ElementAnimate(this.effect.target.element,[1,this.id])}start(){return __ElementAnimate(this.effect.target.element,[0,this.id,this.effect.keyframes,this.effect.options])}constructor(e){o(this,"effect",void 0),o(this,"id",void 0),this.effect=e,this.id="__lynx-inner-js-animation-"+a.count++,this.start()}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}o(a,"count",0);class s{constructor(e,t,r){u(this,"target",void 0),u(this,"keyframes",void 0),u(this,"options",void 0),this.target=e,this.keyframes=t,this.options=r}}function c(e,t){var r;let n=(null!=(r=SystemInfo.lynxSdkVersion)?r:"1.0").split(".");return Number(n[0])>e||Number(n[0])==e&&Number(n[1])>t}let d=!1,f=!0;class y{setAttribute(e,t){__SetAttribute(this.element,e,t),this.flushElementTree()}setStyleProperty(e,t){__AddInlineStyle(this.element,e,t),this.flushElementTree()}setStyleProperties(e){for(let t in e)__AddInlineStyle(this.element,t,e[t]);this.flushElementTree()}getAttribute(e){return __GetAttributeByName(this.element,e)}getAttributeNames(){return __GetAttributeNames(this.element)}querySelector(e){let t=__QuerySelector(this.element,e,{});return t?new y(t):null}querySelectorAll(e){return __QuerySelectorAll(this.element,e,{}).map(e=>new y(e))}getComputedStyleProperty(e){if(!c(3,4))throw Error("getComputedStyleProperty requires Lynx sdk version 3.5");if(!e)throw Error("getComputedStyleProperty: key is required");return __GetComputedStyleByKey(this.element,e)}animate(e,t){return new a(new s(this,e,"number"==typeof t?{duration:t}:null!=t?t:{}))}invoke(e,t){return new Promise((r,n)=>{__InvokeUIMethod(this.element,e,null!=t?t:{},e=>{0===e.code?r(e.data):n(Error("UI method invoke: "+JSON.stringify(e)))}),this.flushElementTree()})}flushElementTree(){!d&&f&&(d=!0,Promise.resolve().then(()=>{d=!1,__FlushElementTree()}))}constructor(e){var t,r;r=void 0,(t="element")in this?Object.defineProperty(this,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):this[t]=r,Object.defineProperty(this,"element",{get:()=>e})}}class h{static get(){return null!=h.pageElement||(h.pageElement=__GetPageElement()),h.pageElement}}function p(e,t,r){let n;try{n=runWorklet(e,t)}finally{lynx.getJSContext().dispatchEvent({type:"Lynx.Worklet.FunctionCallRet",data:JSON.stringify({resolveId:r,returnValue:n})})}}t=void 0,(e="pageElement")in h?Object.defineProperty(h,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):h[e]=t;let m=new Map,_=new WeakMap;function g(e){return"function"==typeof e?Function.prototype.toString.call(e):`worklet:${e._wkltId}`}function b(e){var t;return e._type&&"main-thread"!==e._type?function(e){var t;let r=e._type,n=m.get(r);if(!n)throw Error(`MainThreadObject type is not registered: "${r}". Define the type in a module evaluated on the main thread before initializing its handle.`);let l=(null!=(t=n.resolvedCreate)?t:n.resolvedCreate=function(e){if("function"==typeof e)return e;if(!("_wkltId"in e)||"_lepusWorkletHash"in e)throw Error("Cannot resolve an invalid Main Thread Function.");return lynxWorkletImpl._workletMap[e._wkltId]}(n.create))(e._initValue);if("object"!=typeof l||null===l)throw Error(`MainThreadObject type "${r}" created a non-object value.`);return _.set(l,r),l}(e):(t=e._wvid,{current:e._initValue,_wvid:t})}function k(e){return"object"==typeof e&&null!==e&&"number"==typeof e._wvid&&Object.prototype.hasOwnProperty.call(e,"current")}function w(e,t,r){let n;if(_.has(t)?n="typed-object":k(t)&&(n="mutable-cell"),!n)throw Error(`Cannot apply MainThreadObject ${r} for handle ${e._wvid}: the existing target has no worklet-value metadata.`);let l=e._type,i=l&&"main-thread"!==l?"typed-object":"mutable-cell";if(n!==i)throw Error(`Worklet value kind mismatch during ${r} for handle ${e._wvid}: background handle expects ${i}, but the main-thread target is ${n}.`);"typed-object"===n&&function(e,t,r){let n=_.get(t),l=e._type;if(n!==l)throw Error(`MainThreadObject type mismatch during ${r} for handle ${e._wvid}: background handle expects type "${l}", but the main-thread target is type "${n}".`)}(e,t,r)}let v=e=>{let t,r=e._wvid;if(r<0){var l,i;t=null!=(i=(l=n._firstScreenWorkletRefMap)[r])?i:l[r]=b(e)}else t=n._workletRefMap[r];return t};function I(){l.delayedBackgroundFunctionArray.length=0}function x(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j(e,t,r){lynxWorkletImpl._workletMap[t]=r}let R=new WeakMap;function W(e,t){if("object"!=typeof e||null===e)return e;if(t){let t=R.get(e);if(t)return t}let r=T({main:e},0,e);return t&&R.set(e,r.main),r.main}let T=(e,t,r)=>{if(++t>=1e3)throw Error("Depth of value exceeds limit of 1000.");if("object"!=typeof e||null===e)return e;let n=e;for(let o in n){var l,i;let a=n[o];if("object"!=typeof a||null===a||_.has(a))continue;if("number"==typeof(i=a)._wvid&&"string"==typeof i._type&&"main-thread"!==i._type){n=M(n,e,o,v(a));continue}if("elementRefptr"in a){n[o]=new y(a.elementRefptr);continue}if(a instanceof y)continue;let u=T(a,t,r);if("_wvid"in a){n[o]=v(a);continue}if("_wkltId"in a){let t=a===r,l={...u},i=lynxWorkletImpl._workletMap[a._wkltId].bind(l);u!==a&&n===e&&n!==r&&(n=F(n)),n=M(n,e,o,i),t||(i.boundCtx=l);continue}if(u!==a&&(n===e&&n!==r&&(n=F(n)),n=M(n,e,o,u)),"_jsFnId"in a){a._execId=r._execId,null==(l=lynxWorkletImpl._jsFunctionLifecycleManager)||l.addRef(r._execId,a);continue}}return n};function M(e,t,r,n){let l=Object.getOwnPropertyDescriptor(e,r);if(null==l?void 0:l.get){let i={value:n,writable:!0,enumerable:l.enumerable,configurable:l.configurable};if(e===t||!l.configurable){let t=Object.getOwnPropertyDescriptors(e);return t[r]=i,F(e,t)}Object.defineProperty(e,r,i)}else e[r]=n;return e}function F(e,t=Object.getOwnPropertyDescriptors(e)){return Object.defineProperties(Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e)),t)}if(void 0===globalThis.lynxWorkletImpl){let e,t;globalThis.lynxWorkletImpl={_workletMap:{},_refImpl:(m.clear(),_=new WeakMap,n={_workletRefMap:{},_firstScreenWorkletRefMap:{},updateWorkletRef:function(e,t){v(e).current=t?new y(t):null},updateWorkletRefInitValueChanges:function(e){let t,r=!1;if(e.forEach(([e,l,i])=>{try{let t={_wvid:e,_initValue:l,_type:i},r=n._workletRefMap[e];r?w(t,r,"initialization patch"):n._workletRefMap[e]=b(t)}catch(e){r||(t=e,r=!0)}}),r)throw t},registerMainThreadObjectType:function(e,t){if("main-thread"===e)throw Error('MainThreadObject type "main-thread" is reserved for MainThreadRef.');let r=m.get(e);if(r){if(g(r.create)!==g(t))throw Error(`Conflicting MainThreadObject registration for type "${e}". A type key must always use the same create function.`);return}m.set(e,{create:t})},clearFirstScreenWorkletRefMap:function(){n._firstScreenWorkletRefMap={}}}),_runOnBackgroundDelayImpl:l={delayedBackgroundFunctionArray:[],clearDelayedBackgroundFunctions:I,delayRunOnBackground:function(e,t){var r;l.delayedBackgroundFunctionArray.push({task:t}),(null!=(r=e._delayIndices)?r:e._delayIndices=[]).push(l.delayedBackgroundFunctionArray.length-1)},runDelayedBackgroundFunctions:function(){for(let e of l.delayedBackgroundFunctionArray)(null==e?void 0:e.jsFnHandle)&&e.task(e.jsFnHandle._jsFnId,e.jsFnHandle._execId);I()}},_hydrateCtx:function(e,t){!function e(t,r,l){if(t&&"object"==typeof t&&r&&"object"==typeof r&&(!t._wkltId||t._wkltId===r._wkltId)){var i,o,a;if("number"==typeof(i=t)._wvid&&"string"==typeof i._type)return void function(e,t){"object"==typeof t&&null!==t&&(_.has(t)||k(t))&&(w(e,t,"hydration"),n._workletRefMap[e._wvid]=t)}(t,r);for(let n in t)if("_wvid"===n){o=t[n],"_initValue"in(a=r)||(lynxWorkletImpl._refImpl._workletRefMap[o]=a)}else if("_jsFn"===n)!function(e,t,r){for(let n in e){let l=e[n],i=t[n];if(!(null==i?void 0:i._delayIndices)){i&&(i._isFirstScreen=!1,i._execId=r,Object.assign(i,l));continue}for(let e of i._delayIndices){let t=lynxWorkletImpl._runOnBackgroundDelayImpl.delayedBackgroundFunctionArray[e];t&&(l._execId=r,t.jsFnHandle=l)}}}(t[n],r[n],l);else{let i="function"==typeof r[n]?r[n].boundCtx:r[n];e(t[n],i,l)}}}(e,t,e._execId)},_eventDelayImpl:i={_delayedWorkletParamsMap:new Map,runDelayedWorklet:function(e,t){(()=>{let r=i._delayedWorkletParamsMap.get(e._wkltId);if(void 0===r)return;let n=[];r.forEach(r=>{var l;let i=r[0];(null==i||null==(l=i.currentTarget)?void 0:l.elementRefptr)===t?setTimeout(()=>{runWorklet(e,r)},0):n.push(r)}),i._delayedWorkletParamsMap.set(e._wkltId,n)})()},clearDelayedWorklets:function(){i._delayedWorkletParamsMap.clear()}},_eomImpl:{setShouldFlush:function(e){f=e}},_runRunOnMainThreadTask:p},c(2,15)&&(globalThis.lynxWorkletImpl._jsFunctionLifecycleManager=new class e{addRef(e,t){var r;this.retainedObjects.has(t)||(this.retainedObjects.add(t),this.execIdRefCount.set(e,(null!=(r=this.execIdRefCount.get(e))?r:0)+1),this.registry.register(t,e))}removeRef(e){let t=this.execIdRefCount.get(e);t>1?this.execIdRefCount.set(e,t-1):(this.execIdRefCount.delete(e),this.execIdSetToFire.add(e),this.willFire||(this.willFire=!0,Promise.resolve().then(()=>{this.fire()})))}fire(){lynx.getJSContext().dispatchEvent({type:"Lynx.Worklet.releaseBackgroundWorkletCtx",data:Array.from(this.execIdSetToFire)}),this.execIdSetToFire.clear(),this.willFire=!1}constructor(){x(this,"execIdRefCount",new Map),x(this,"execIdSetToFire",new Set),x(this,"retainedObjects",new WeakSet),x(this,"willFire",!1),x(this,"registry",void 0),this.registry=new FinalizationRegistry(this.removeRef.bind(this))}}),globalThis.registerWorklet=j,globalThis.registerWorkletInternal=j,globalThis.runWorklet=function(e,t,r){var n,l,o;if("object"==typeof(n=e)&&null!==n&&("_wkltId"in n||"_lepusWorkletHash"in n)){let n,a;return"_lepusWorkletHash"in e?void(l=e._lepusWorkletHash,o=t,(a=(n=i._delayedWorkletParamsMap).get(l))?a.push(o):n.set(l,[o])):function(e,t,r){let n=(e._wkltId,W(e,!0)),l=W(t||[],!1),[i,o]=function(e,t){if(!Array.isArray(e)||"object"!=typeof e[0]||null===e[0]||(!t||1!==t.source)&&1)return[!1,{}];let r={},n=e[0];return n.stopPropagation=function(){var e;r._eventReturnResult=(null!=(e=r._eventReturnResult)?e:0)|1},n.stopImmediatePropagation=function(){var e;r._eventReturnResult=(null!=(e=r._eventReturnResult)?e:0)|2},[!0,r]}(l,r),a=n(...l);return i?{returnValue:a,eventReturnResult:o._eventReturnResult}:a}(e,t,r)}},lynx.querySelector=function(e){let t=h.get();if(!t)return null;let r=__QuerySelector(t,e,{});return r?new y(r):null},lynx.querySelectorAll=function(e){let t=h.get();return t?__QuerySelectorAll(t,e,{}).map(e=>new y(e)):[]},globalThis.setTimeout=lynx.setTimeout,globalThis.setInterval=lynx.setInterval,globalThis.clearTimeout=lynx.clearTimeout,globalThis.clearInterval=null!=(r=lynx.clearInterval)?r:lynx.clearTimeInterval,e=lynx.requestAnimationFrame,lynx.requestAnimationFrame=globalThis.requestAnimationFrame=t=>{if(!c(2,15))throw Error("requestAnimationFrame in main thread script requires Lynx sdk version 2.16");return e(t)},globalThis.cancelAnimationFrame=lynx.cancelAnimationFrame,(t=lynx.getJSContext()).addEventListener("Lynx.Worklet.runWorkletCtx",e=>{let t=JSON.parse(e.data);p(t.worklet,t.params,t.resolveId)}),t.addEventListener("Lynx.Worklet.releaseWorkletRef",e=>{var t;t=e.data.id,delete n._workletRefMap[t]})}})();
@@ -1,13 +0,0 @@
1
- import { loadWorkletRuntime as __loadWorkletRuntime } from "@lynx-js/react";
2
- var loadWorkletRuntime = __loadWorkletRuntime;
3
- let foo = {
4
- _wkltId: "a123:test:1"
5
- };
6
- const __workletRuntimeLoaded = loadWorkletRuntime(typeof globDynamicComponentEntry === 'undefined' ? undefined : globDynamicComponentEntry);
7
- __workletRuntimeLoaded && registerWorkletInternal("main-thread", "a123:test:1", function() {
8
- const foo = lynxWorkletImpl._workletMap["a123:test:1"].bind(this);
9
- "main thread";
10
- const __workletRuntimeLoaded = false;
11
- console.log(__workletRuntimeLoaded);
12
- return 1;
13
- });
@@ -1,13 +0,0 @@
1
- import { loadWorkletRuntime as __loadWorkletRuntime } from "@lynx-js/react";
2
- var loadWorkletRuntime = __loadWorkletRuntime;
3
- const __workletRuntimeLoaded = false;
4
- console.log(__workletRuntimeLoaded);
5
- let foo = {
6
- _wkltId: "a123:test:1"
7
- };
8
- const __workletRuntimeLoaded1 = loadWorkletRuntime(typeof globDynamicComponentEntry === 'undefined' ? undefined : globDynamicComponentEntry);
9
- __workletRuntimeLoaded1 && registerWorkletInternal("main-thread", "a123:test:1", function() {
10
- const foo = lynxWorkletImpl._workletMap["a123:test:1"].bind(this);
11
- "main thread";
12
- return 1;
13
- });