@lynx-js/react 0.110.1 → 0.111.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 (80) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/components/lib/DeferredListItem.d.ts +7 -0
  3. package/components/lib/DeferredListItem.jsx +40 -0
  4. package/components/lib/DeferredListItem.jsx.map +1 -0
  5. package/components/lib/index.d.ts +1 -0
  6. package/components/lib/index.js +1 -0
  7. package/components/lib/index.js.map +1 -1
  8. package/components/src/DeferredListItem.tsx +56 -0
  9. package/components/src/index.ts +1 -0
  10. package/package.json +1 -1
  11. package/refresh/.turbo/turbo-build.log +1 -1
  12. package/runtime/lazy/react-lepus.js +1 -0
  13. package/runtime/lazy/react.js +1 -0
  14. package/runtime/lepus/index.d.ts +1 -1
  15. package/runtime/lepus/index.js +44 -0
  16. package/runtime/lib/backgroundSnapshot.d.ts +2 -1
  17. package/runtime/lib/backgroundSnapshot.js +62 -40
  18. package/runtime/lib/backgroundSnapshot.js.map +1 -1
  19. package/runtime/lib/compat/initData.js +10 -0
  20. package/runtime/lib/compat/initData.js.map +1 -1
  21. package/runtime/lib/index.d.ts +2 -2
  22. package/runtime/lib/index.js +2 -2
  23. package/runtime/lib/index.js.map +1 -1
  24. package/runtime/lib/lifecycle/patch/commit.js +5 -5
  25. package/runtime/lib/lifecycle/patch/commit.js.map +1 -1
  26. package/runtime/lib/lifecycle/patch/snapshotPatch.d.ts +9 -9
  27. package/runtime/lib/lifecycle/patch/snapshotPatch.js +9 -10
  28. package/runtime/lib/lifecycle/patch/snapshotPatch.js.map +1 -1
  29. package/runtime/lib/lifecycle/patch/updateMainThread.js +7 -8
  30. package/runtime/lib/lifecycle/patch/updateMainThread.js.map +1 -1
  31. package/runtime/lib/lifecycleConstant.d.ts +2 -1
  32. package/runtime/lib/lifecycleConstant.js +1 -0
  33. package/runtime/lib/lifecycleConstant.js.map +1 -1
  34. package/runtime/lib/list.js +102 -12
  35. package/runtime/lib/list.js.map +1 -1
  36. package/runtime/lib/lynx/calledByNative.js +6 -9
  37. package/runtime/lib/lynx/calledByNative.js.map +1 -1
  38. package/runtime/lib/lynx/component.js +11 -14
  39. package/runtime/lib/lynx/component.js.map +1 -1
  40. package/runtime/lib/lynx/env.js +1 -2
  41. package/runtime/lib/lynx/env.js.map +1 -1
  42. package/runtime/lib/lynx/lazy-bundle.js +48 -21
  43. package/runtime/lib/lynx/lazy-bundle.js.map +1 -1
  44. package/runtime/lib/lynx/performance.d.ts +3 -19
  45. package/runtime/lib/lynx/performance.js +25 -26
  46. package/runtime/lib/lynx/performance.js.map +1 -1
  47. package/runtime/lib/lynx/tt.js +10 -5
  48. package/runtime/lib/lynx/tt.js.map +1 -1
  49. package/runtime/lib/lynx-api.d.ts +78 -1
  50. package/runtime/lib/lynx-api.js.map +1 -1
  51. package/runtime/lib/snapshot.d.ts +2 -0
  52. package/runtime/lib/snapshot.js +19 -5
  53. package/runtime/lib/snapshot.js.map +1 -1
  54. package/runtime/lib/utils.d.ts +1 -0
  55. package/runtime/lib/utils.js +6 -0
  56. package/runtime/lib/utils.js.map +1 -1
  57. package/runtime/src/backgroundSnapshot.ts +74 -55
  58. package/runtime/src/compat/initData.ts +10 -0
  59. package/runtime/src/index.ts +2 -0
  60. package/runtime/src/lifecycle/patch/commit.ts +5 -11
  61. package/runtime/src/lifecycle/patch/snapshotPatch.ts +9 -9
  62. package/runtime/src/lifecycle/patch/updateMainThread.ts +7 -8
  63. package/runtime/src/lifecycleConstant.ts +1 -0
  64. package/runtime/src/list.ts +118 -15
  65. package/runtime/src/lynx/calledByNative.ts +6 -8
  66. package/runtime/src/lynx/component.ts +17 -29
  67. package/runtime/src/lynx/env.ts +1 -2
  68. package/runtime/src/lynx/lazy-bundle.ts +55 -20
  69. package/runtime/src/lynx/performance.ts +26 -27
  70. package/runtime/src/lynx/tt.ts +10 -11
  71. package/runtime/src/lynx-api.ts +77 -1
  72. package/runtime/src/snapshot.ts +20 -5
  73. package/runtime/src/utils.ts +9 -0
  74. package/testing-library/dist/index.d.ts +4 -1
  75. package/testing-library/dist/pure.js +1 -1
  76. package/testing-library/dist/vitest.config.js +38 -1
  77. package/testing-library/types/entry.d.ts +3 -2
  78. package/transform/dist/wasm.cjs +1 -1
  79. package/types/react.d.ts +21 -1
  80. package/types/react.docs.d.ts +1 -1
package/types/react.d.ts CHANGED
@@ -142,7 +142,27 @@ declare module '@lynx-js/types' {
142
142
  * we can use typeof item as the reuse-identifier.
143
143
  * By default, the developer does not provide a reuse-identifier, which is determined by the framework at the compile stage.
144
144
  */
145
- 'reuse-identifier'?: Key;
145
+ 'reuse-identifier'?: Key | null | undefined;
146
+
147
+ /**
148
+ * Makes the `<list-item />` deferred, meaning it will not be eagerly rendered
149
+ * on the main thread like a non-deferred `<list-item />`.
150
+ * Instead, it will be rendered on the background thread when necessary.
151
+ *
152
+ * As a result, rendering becomes asynchronous,
153
+ * which means that during extremely fast scrolling, some `<list-item />`s may not have been rendered yet—these will usually appear blank.
154
+ *
155
+ * @example
156
+ *
157
+ * Render a `<list-item />` containing a heavyweight component on the background thread.
158
+ *
159
+ * ```tsx
160
+ * <list-item defer item-key="heavy-item">
161
+ * <HeavyComponent />
162
+ * </list-item>
163
+ * ```
164
+ */
165
+ 'defer'?: boolean | undefined;
146
166
  }
147
167
 
148
168
  export interface FrameworkRenderingTimings {
@@ -66,7 +66,7 @@ export { Fragment, Suspense } from 'react';
66
66
  * Legacy React APIs
67
67
  * @see https://react.dev/reference/react/legacy
68
68
  */
69
- export { Component, PureComponent, createElement, createRef, isValidElement } from 'react';
69
+ export { Component, PureComponent, cloneElement, createElement, createRef, isValidElement } from 'react';
70
70
 
71
71
  /**
72
72
  * RL-defined Lynx APIs