@lynx-js/react 0.124.0 → 0.125.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 (115) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +1 -1
  3. package/runtime/jsx-dev-runtime/index.d.ts +39 -1
  4. package/runtime/jsx-runtime/index.d.ts +39 -1
  5. package/runtime/lepus/jsx-runtime/index.js +17 -0
  6. package/runtime/lib/core/main-thread-function.d.ts +2 -0
  7. package/runtime/lib/core/main-thread-function.js +10 -0
  8. package/runtime/lib/core/main-thread-function.js.map +1 -0
  9. package/runtime/lib/core/main-thread-ref-init-value.d.ts +1 -0
  10. package/runtime/lib/core/main-thread-ref-init-value.js +23 -0
  11. package/runtime/lib/core/main-thread-ref-init-value.js.map +1 -0
  12. package/runtime/lib/{snapshot/worklet/ref/workletRef.d.ts → core/main-thread-ref.d.ts} +6 -7
  13. package/runtime/lib/{snapshot/worklet/ref/workletRef.js → core/main-thread-ref.js} +31 -36
  14. package/runtime/lib/core/main-thread-ref.js.map +1 -0
  15. package/runtime/lib/core/mts-capability.d.ts +1 -0
  16. package/runtime/lib/core/mts-capability.js +18 -0
  17. package/runtime/lib/core/mts-capability.js.map +1 -0
  18. package/runtime/lib/core/thread-function-call/main-thread.js +4 -11
  19. package/runtime/lib/core/thread-function-call/main-thread.js.map +1 -1
  20. package/runtime/lib/element-template/background/attr-slots.d.ts +3 -1
  21. package/runtime/lib/element-template/background/attr-slots.js +3 -3
  22. package/runtime/lib/element-template/background/attr-slots.js.map +1 -1
  23. package/runtime/lib/element-template/background/commit-hook.d.ts +9 -0
  24. package/runtime/lib/element-template/background/commit-hook.js +23 -0
  25. package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
  26. package/runtime/lib/element-template/background/hydrate.js +6 -4
  27. package/runtime/lib/element-template/background/hydrate.js.map +1 -1
  28. package/runtime/lib/element-template/background/hydration-listener.js +4 -4
  29. package/runtime/lib/element-template/background/hydration-listener.js.map +1 -1
  30. package/runtime/lib/element-template/background/instance.d.ts +11 -0
  31. package/runtime/lib/element-template/background/instance.js +53 -29
  32. package/runtime/lib/element-template/background/instance.js.map +1 -1
  33. package/runtime/lib/element-template/background/manager.d.ts +1 -0
  34. package/runtime/lib/element-template/background/manager.js +8 -2
  35. package/runtime/lib/element-template/background/manager.js.map +1 -1
  36. package/runtime/lib/element-template/background/page-root-hydrate.d.ts +3 -0
  37. package/runtime/lib/element-template/background/page-root-hydrate.js +14 -0
  38. package/runtime/lib/element-template/background/page-root-hydrate.js.map +1 -0
  39. package/runtime/lib/element-template/index.d.ts +1 -0
  40. package/runtime/lib/element-template/index.js +1 -0
  41. package/runtime/lib/element-template/index.js.map +1 -1
  42. package/runtime/lib/element-template/internal.d.ts +1 -1
  43. package/runtime/lib/element-template/internal.js +1 -2
  44. package/runtime/lib/element-template/internal.js.map +1 -1
  45. package/runtime/lib/element-template/native/index.js +2 -2
  46. package/runtime/lib/element-template/native/index.js.map +1 -1
  47. package/runtime/lib/element-template/native/main-thread-api.js +1 -2
  48. package/runtime/lib/element-template/native/main-thread-api.js.map +1 -1
  49. package/runtime/lib/element-template/native/reload-background.js +2 -2
  50. package/runtime/lib/element-template/native/reload-background.js.map +1 -1
  51. package/runtime/lib/element-template/native/reload-main-thread.js +9 -2
  52. package/runtime/lib/element-template/native/reload-main-thread.js.map +1 -1
  53. package/runtime/lib/element-template/protocol/page.d.ts +3 -0
  54. package/runtime/lib/element-template/protocol/page.js +7 -0
  55. package/runtime/lib/element-template/protocol/page.js.map +1 -0
  56. package/runtime/lib/element-template/protocol/types.d.ts +6 -1
  57. package/runtime/lib/element-template/protocol/types.js +1 -0
  58. package/runtime/lib/element-template/protocol/types.js.map +1 -1
  59. package/runtime/lib/element-template/runtime/page/authored-page.d.ts +8 -0
  60. package/runtime/lib/element-template/runtime/page/authored-page.js +15 -0
  61. package/runtime/lib/element-template/runtime/page/authored-page.js.map +1 -0
  62. package/runtime/lib/element-template/runtime/page/page.d.ts +0 -2
  63. package/runtime/lib/element-template/runtime/page/page.js +2 -10
  64. package/runtime/lib/element-template/runtime/page/page.js.map +1 -1
  65. package/runtime/lib/element-template/runtime/patch.js +5 -3
  66. package/runtime/lib/element-template/runtime/patch.js.map +1 -1
  67. package/runtime/lib/element-template/runtime/render/render-main-thread.d.ts +1 -3
  68. package/runtime/lib/element-template/runtime/render/render-main-thread.js +9 -24
  69. package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
  70. package/runtime/lib/element-template/runtime/render/render-opcodes.d.ts +2 -0
  71. package/runtime/lib/element-template/runtime/render/render-opcodes.js +36 -3
  72. package/runtime/lib/element-template/runtime/render/render-opcodes.js.map +1 -1
  73. package/runtime/lib/element-template/runtime/render/render-to-opcodes.d.ts +2 -0
  74. package/runtime/lib/element-template/runtime/render/render-to-opcodes.js +13 -0
  75. package/runtime/lib/element-template/runtime/render/render-to-opcodes.js.map +1 -1
  76. package/runtime/lib/element-template/runtime/template/attr-slot-plan.d.ts +1 -0
  77. package/runtime/lib/element-template/runtime/template/attr-slot-plan.js +7 -2
  78. package/runtime/lib/element-template/runtime/template/attr-slot-plan.js.map +1 -1
  79. package/runtime/lib/element-template/runtime/template/main-thread-background-function.d.ts +3 -3
  80. package/runtime/lib/element-template/runtime/template/main-thread-background-function.js +2 -2
  81. package/runtime/lib/element-template/runtime/template/main-thread-background-function.js.map +1 -1
  82. package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js +2 -2
  83. package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js.map +1 -1
  84. package/runtime/lib/element-template/runtime/template/main-thread-event-ctx.d.ts +0 -1
  85. package/runtime/lib/element-template/runtime/template/main-thread-event-ctx.js +4 -9
  86. package/runtime/lib/element-template/runtime/template/main-thread-event-ctx.js.map +1 -1
  87. package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.d.ts +9 -0
  88. package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.js +33 -0
  89. package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.js.map +1 -0
  90. package/runtime/lib/element-template/runtime/template/registry.js +2 -1
  91. package/runtime/lib/element-template/runtime/template/registry.js.map +1 -1
  92. package/runtime/lib/element-template/runtime/template/typed-attributes.d.ts +5 -0
  93. package/runtime/lib/element-template/runtime/template/typed-attributes.js +13 -0
  94. package/runtime/lib/element-template/runtime/template/typed-attributes.js.map +1 -0
  95. package/runtime/lib/lynx-api.d.ts +1 -1
  96. package/runtime/lib/lynx-api.js +1 -1
  97. package/runtime/lib/lynx-api.js.map +1 -1
  98. package/runtime/lib/snapshot/lifecycle/patch/commit.d.ts +10 -1
  99. package/runtime/lib/snapshot/lifecycle/patch/commit.js +30 -2
  100. package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -1
  101. package/runtime/lib/snapshot/snapshot/snapshot.js +3 -0
  102. package/runtime/lib/snapshot/snapshot/snapshot.js.map +1 -1
  103. package/runtime/lib/snapshot/worklet/destroy.js +2 -2
  104. package/runtime/lib/snapshot/worklet/destroy.js.map +1 -1
  105. package/runtime/lib/snapshot/worklet/functionality.d.ts +1 -0
  106. package/runtime/lib/snapshot/worklet/functionality.js +2 -8
  107. package/runtime/lib/snapshot/worklet/functionality.js.map +1 -1
  108. package/runtime/lib/snapshot/worklet/ref/updateInitValue.js +2 -2
  109. package/runtime/lib/snapshot/worklet/ref/updateInitValue.js.map +1 -1
  110. package/runtime/lib/tsconfig.tsbuildinfo +1 -1
  111. package/transform/dist/wasm.cjs +5 -5
  112. package/runtime/lib/snapshot/worklet/ref/workletRef.js.map +0 -1
  113. package/runtime/lib/snapshot/worklet/ref/workletRefPool.d.ts +0 -1
  114. package/runtime/lib/snapshot/worklet/ref/workletRefPool.js +0 -23
  115. package/runtime/lib/snapshot/worklet/ref/workletRefPool.js.map +0 -1
@@ -1,15 +1,9 @@
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 { clearMtsConfigCacheForTesting, isMtsEnabled } from '../../core/mts-capability.js';
4
5
  import { isSdkVersionGt } from '../../utils.js';
5
- let mtsEnabled;
6
6
  let runOnBackgroundEnabled;
7
- /**
8
- * @internal
9
- */
10
- function isMtsEnabled() {
11
- return mtsEnabled ??= isSdkVersionGt(2, 13);
12
- }
13
7
  /**
14
8
  * @internal
15
9
  */
@@ -17,7 +11,7 @@ function isRunOnBackgroundEnabled() {
17
11
  return runOnBackgroundEnabled ??= isSdkVersionGt(2, 15);
18
12
  }
19
13
  function clearConfigCacheForTesting() {
20
- mtsEnabled = undefined;
14
+ clearMtsConfigCacheForTesting();
21
15
  runOnBackgroundEnabled = undefined;
22
16
  }
23
17
  export { isMtsEnabled, isRunOnBackgroundEnabled, clearConfigCacheForTesting };
@@ -1 +1 @@
1
- {"version":3,"file":"functionality.js","sourceRoot":"","sources":["../../../src/snapshot/worklet/functionality.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,IAAI,UAA+B,CAAC;AACpC,IAAI,sBAA2C,CAAC;AAEhD;;GAEG;AACH,SAAS,YAAY;IACnB,OAAO,UAAU,KAAK,cAAc,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,SAAS,wBAAwB;IAC/B,OAAO,sBAAsB,KAAK,cAAc,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,0BAA0B;IACjC,UAAU,GAAG,SAAS,CAAC;IACvB,sBAAsB,GAAG,SAAS,CAAC;AACrC,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,CAAC"}
1
+ {"version":3,"file":"functionality.js","sourceRoot":"","sources":["../../../src/snapshot/worklet/functionality.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,6BAA6B,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,IAAI,sBAA2C,CAAC;AAEhD;;GAEG;AACH,SAAS,wBAAwB;IAC/B,OAAO,sBAAsB,KAAK,cAAc,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,0BAA0B;IACjC,6BAA6B,EAAE,CAAC;IAChC,sBAAsB,GAAG,SAAS,CAAC;AACrC,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,CAAC"}
@@ -2,7 +2,7 @@
2
2
  // Licensed under the Apache License Version 2.0 that can be found in the
3
3
  // LICENSE file in the root directory of this source tree.
4
4
  import { updateWorkletRefInitValueChanges } from '@lynx-js/react/worklet-runtime/bindings';
5
- import { takeWorkletRefInitValuePatch } from './workletRefPool.js';
5
+ import { takeMainThreadRefInitValuePatch } from '../../../core/main-thread-ref-init-value.js';
6
6
  import { LifecycleConstant } from '../../lifecycle/constant.js';
7
7
  function updateMTRefInitValue({ data }) {
8
8
  // This update ignores reloadVersion check.
@@ -14,7 +14,7 @@ export function injectUpdateMTRefInitValue() {
14
14
  Object.assign(globalThis, { [LifecycleConstant.updateMTRefInitValue]: updateMTRefInitValue });
15
15
  }
16
16
  export function sendMTRefInitValueToMainThread() {
17
- const patch = takeWorkletRefInitValuePatch();
17
+ const patch = takeMainThreadRefInitValuePatch();
18
18
  if (patch.length === 0) {
19
19
  return;
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"updateInitValue.js","sourceRoot":"","sources":["../../../../src/snapshot/worklet/ref/updateInitValue.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAE3F,OAAO,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