@lynx-js/react 0.105.0 → 0.105.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +57 -5
  3. package/package.json +7 -2
  4. package/refresh/.turbo/turbo-build.log +1 -1
  5. package/runtime/lib/internal.d.ts +1 -1
  6. package/runtime/lib/internal.js +1 -1
  7. package/runtime/lib/internal.js.map +1 -1
  8. package/runtime/lib/legacy-react-runtime/index.js +4 -2
  9. package/runtime/lib/legacy-react-runtime/index.js.map +1 -1
  10. package/runtime/lib/lifecycle/reload.js +2 -0
  11. package/runtime/lib/lifecycle/reload.js.map +1 -1
  12. package/runtime/lib/lynx/tt.js +1 -1
  13. package/runtime/lib/lynx/tt.js.map +1 -1
  14. package/runtime/lib/lynx-api.d.ts +2 -1
  15. package/runtime/lib/lynx-api.js +4 -4
  16. package/runtime/lib/lynx-api.js.map +1 -1
  17. package/runtime/lib/worklet/ctx.js +5 -5
  18. package/runtime/lib/worklet/ctx.js.map +1 -1
  19. package/runtime/lib/worklet/destroy.d.ts +2 -0
  20. package/runtime/lib/worklet/destroy.js +13 -0
  21. package/runtime/lib/worklet/destroy.js.map +1 -0
  22. package/runtime/lib/worklet/functionCall.d.ts +1 -0
  23. package/runtime/lib/worklet/functionCall.js +33 -0
  24. package/runtime/lib/worklet/functionCall.js.map +1 -0
  25. package/runtime/lib/worklet/functionality.d.ts +2 -1
  26. package/runtime/lib/worklet/functionality.js +21 -2
  27. package/runtime/lib/worklet/functionality.js.map +1 -1
  28. package/runtime/lib/worklet/runOnBackground.d.ts +20 -0
  29. package/runtime/lib/worklet/runOnBackground.js +105 -0
  30. package/runtime/lib/worklet/runOnBackground.js.map +1 -0
  31. package/runtime/lib/worklet/runOnMainThread.d.ts +19 -0
  32. package/runtime/lib/worklet/runOnMainThread.js +45 -0
  33. package/runtime/lib/worklet/runOnMainThread.js.map +1 -0
  34. package/runtime/lib/worklet/transformToWorklet.d.ts +1 -0
  35. package/runtime/lib/worklet/transformToWorklet.js +21 -0
  36. package/runtime/lib/worklet/transformToWorklet.js.map +1 -0
  37. package/runtime/lib/worklet/workletRef.js +2 -3
  38. package/runtime/lib/worklet/workletRef.js.map +1 -1
  39. package/runtime/lib/worklet/workletRefPool.d.ts +1 -2
  40. package/runtime/lib/worklet/workletRefPool.js +14 -11
  41. package/runtime/lib/worklet/workletRefPool.js.map +1 -1
  42. package/runtime/src/internal.ts +1 -1
  43. package/runtime/src/legacy-react-runtime/index.ts +4 -2
  44. package/runtime/src/lifecycle/reload.ts +2 -0
  45. package/runtime/src/lynx/tt.ts +1 -1
  46. package/runtime/src/lynx-api.ts +5 -4
  47. package/runtime/src/worklet/ctx.ts +5 -5
  48. package/runtime/src/worklet/destroy.ts +16 -0
  49. package/runtime/src/worklet/functionCall.ts +42 -0
  50. package/runtime/src/worklet/functionality.ts +25 -2
  51. package/runtime/src/worklet/runOnBackground.ts +125 -0
  52. package/runtime/src/worklet/runOnMainThread.ts +50 -0
  53. package/runtime/src/worklet/transformToWorklet.ts +26 -0
  54. package/runtime/src/worklet/workletRef.ts +3 -3
  55. package/runtime/src/worklet/workletRefPool.ts +16 -12
  56. package/transform/dist/wasm.cjs +1 -1
  57. package/transform/index.d.ts +5 -1
  58. package/worklet-runtime/dist/dev.js +10 -3
  59. package/worklet-runtime/dist/dev.js.map +2 -2
  60. package/worklet-runtime/dist/main.js +10 -3
  61. package/worklet-runtime/dist/main.js.map +2 -2
  62. package/worklet-runtime/lib/bindings/events.d.ts +12 -1
  63. package/worklet-runtime/lib/bindings/events.js +1 -0
  64. package/worklet-runtime/lib/bindings/events.js.map +1 -1
  65. package/worklet-runtime/lib/bindings/index.d.ts +1 -1
  66. package/worklet-runtime/lib/bindings/index.js.map +1 -1
  67. package/worklet-runtime/lib/bindings/types.d.ts +1 -1
  68. package/worklet-runtime/lib/global.d.ts +1 -1
  69. package/worklet-runtime/lib/jsFunctionLifecycle.d.ts +2 -2
  70. package/worklet-runtime/lib/jsFunctionLifecycle.js +2 -2
  71. package/worklet-runtime/lib/jsFunctionLifecycle.js.map +1 -1
  72. package/worklet-runtime/lib/listeners.js +9 -2
  73. package/worklet-runtime/lib/listeners.js.map +1 -1
  74. package/worklet-runtime/lib/workletRuntime.js +2 -2
  75. package/worklet-runtime/lib/workletRuntime.js.map +1 -1
  76. package/runtime/lib/worklet/jsImpl.d.ts +0 -11
  77. package/runtime/lib/worklet/jsImpl.js +0 -68
  78. package/runtime/lib/worklet/jsImpl.js.map +0 -1
  79. package/runtime/lib/worklet/runWorklet.d.ts +0 -14
  80. package/runtime/lib/worklet/runWorklet.js +0 -82
  81. package/runtime/lib/worklet/runWorklet.js.map +0 -1
  82. package/runtime/src/worklet/jsImpl.ts +0 -86
  83. package/runtime/src/worklet/runWorklet.ts +0 -88
@@ -1,25 +1,29 @@
1
1
  // Copyright 2024 The Lynx Authors. All rights reserved.
2
2
  // Licensed under the Apache License Version 2.0 that can be found in the
3
3
  // LICENSE file in the root directory of this source tree.
4
- import { lynxWorkletJsImpl } from './jsImpl.js';
5
4
 
5
+ import { isMtsEnabled } from './functionality.js';
6
+
7
+ let initValuePatch: [number, unknown][] = [];
8
+ const initValueIdSet = /*#__PURE__*/ new Set<number>();
9
+
10
+ /**
11
+ * @internal
12
+ */
6
13
  export function addWorkletRefInitValue(id: number, value: unknown): void {
7
- const impl = lynxWorkletJsImpl();
8
- if (!impl) {
14
+ if (!isMtsEnabled()) {
9
15
  return;
10
16
  }
11
17
 
12
- impl._workletRefInitValueSet.add(id);
13
- impl._workletRefInitValuePatch.push([id, value]);
18
+ initValueIdSet.add(id);
19
+ initValuePatch.push([id, value]);
14
20
  }
15
21
 
22
+ /**
23
+ * @internal
24
+ */
16
25
  export function takeWorkletRefInitValuePatch(): [number, unknown][] {
17
- const impl = lynxWorkletJsImpl(false);
18
- if (!impl) {
19
- return [];
20
- }
21
-
22
- const res = impl._workletRefInitValuePatch;
23
- impl._workletRefInitValuePatch = [];
26
+ const res = initValuePatch;
27
+ initValuePatch = [];
24
28
  return res;
25
29
  }