@lynx-js/react 0.123.0 → 0.123.2

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 (43) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/components/lib/DeferredListItem.d.ts +8 -2
  3. package/components/lib/DeferredListItem.jsx.map +1 -1
  4. package/components/src/DeferredListItem.tsx +7 -2
  5. package/package.json +4 -4
  6. package/refresh/dist/index.js +4 -2
  7. package/runtime/lib/element-template/background/commit-hook.js +3 -0
  8. package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
  9. package/runtime/lib/element-template/prop-adapters/spread.js +11 -11
  10. package/runtime/lib/element-template/prop-adapters/spread.js.map +1 -1
  11. package/runtime/lib/element-template/protocol/types.d.ts +1 -0
  12. package/runtime/lib/index.d.ts +1 -0
  13. package/runtime/lib/index.js.map +1 -1
  14. package/runtime/lib/shared/attribute-name.d.ts +3 -0
  15. package/runtime/lib/shared/attribute-name.js +91 -0
  16. package/runtime/lib/shared/attribute-name.js.map +1 -0
  17. package/runtime/lib/snapshot/lifecycle/patch/commit.js +3 -0
  18. package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -1
  19. package/runtime/lib/snapshot/lynx/element.d.ts +28 -5
  20. package/runtime/lib/snapshot/lynx/element.js +9 -5
  21. package/runtime/lib/snapshot/lynx/element.js.map +1 -1
  22. package/runtime/lib/snapshot/renderToOpcodes/hydrate.js +19 -0
  23. package/runtime/lib/snapshot/renderToOpcodes/hydrate.js.map +1 -1
  24. package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +97 -65
  25. package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
  26. package/runtime/lib/snapshot/snapshot/list.js +8 -1
  27. package/runtime/lib/snapshot/snapshot/list.js.map +1 -1
  28. package/runtime/lib/snapshot/snapshot/platformInfo.js +20 -9
  29. package/runtime/lib/snapshot/snapshot/platformInfo.js.map +1 -1
  30. package/runtime/lib/snapshot/snapshot/spread.js +27 -17
  31. package/runtime/lib/snapshot/snapshot/spread.js.map +1 -1
  32. package/runtime/lib/snapshot/snapshot/utils.js +8 -3
  33. package/runtime/lib/snapshot/snapshot/utils.js.map +1 -1
  34. package/runtime/lib/tsconfig.tsbuildinfo +1 -1
  35. package/testing-library/dist/env/index.js +5 -0
  36. package/testing-library/dist/index.d.ts +3 -2
  37. package/testing-library/dist/pure.js +1 -1
  38. package/testing-library/dist/rstest-config.js +1 -1
  39. package/transform/dist/wasm.cjs +5 -5
  40. package/transform/index.d.ts +43 -0
  41. package/types/react.docs.d.ts +22 -2
  42. /package/testing-library/dist/{0~@rstest → 0-@rstest}/adapter-rsbuild.js +0 -0
  43. /package/testing-library/dist/{0~rslib-runtime.js → 0-rslib-runtime.js} +0 -0
@@ -670,6 +670,35 @@ export interface WorkletVisitorConfig {
670
670
  target: 'LEPUS' | 'JS' | 'MIXED'
671
671
  runtimePkg: string
672
672
  }
673
+ /**
674
+ * Serializable rules for transforming builtin element attribute names.
675
+ *
676
+ * Exact entries in `rename` take precedence over `preserve`, followed by the
677
+ * fallback behavior selected by `mode`.
678
+ *
679
+ * @public
680
+ */
681
+ export interface TransformBuiltinAttributeNamesOptions {
682
+ /**
683
+ * The fallback behavior for attribute names not listed in `rename` or
684
+ * `preserve`.
685
+ *
686
+ * `'dash-case'` also applies the default React-style event mappings.
687
+ * `'mapping-only'` leaves all remaining names unchanged.
688
+ *
689
+ * @defaultValue `'dash-case'`
690
+ */
691
+ mode?: 'dash-case' | 'mapping-only'
692
+ /**
693
+ * Attribute names that should remain unchanged unless an exact `rename`
694
+ * entry is also present.
695
+ */
696
+ preserve?: ReadonlyArray<string>
697
+ /**
698
+ * Exact mappings from source attribute names to transformed attribute names.
699
+ */
700
+ rename?: Readonly<Record<string, string>>
701
+ }
673
702
  export interface TransformNodiffOptions {
674
703
  /**
675
704
  * @internal
@@ -699,6 +728,20 @@ export interface TransformNodiffOptions {
699
728
  directiveDCE: boolean | DirectiveDceVisitorConfig
700
729
  worklet: boolean | WorkletVisitorConfig
701
730
  dynamicImport?: boolean | DynamicImportVisitorConfig
731
+ /**
732
+ * Transform attribute names on Lynx builtin elements.
733
+ *
734
+ * `true` applies the default rule: `onClick` becomes `bindtap`,
735
+ * `onCatchTap` becomes `catchtap`, other `onXXX` names become `bindxxx`,
736
+ * and remaining camelCase names become dash-case. An object provides
737
+ * serializable custom rules.
738
+ * Explicit JSX attributes are transformed during compilation. Attributes
739
+ * supplied through JSX spreads are transformed by the runtime with the same
740
+ * rules.
741
+ *
742
+ * @experimental
743
+ */
744
+ experimental_transformBuiltinAttributeNames?: boolean | TransformBuiltinAttributeNamesOptions
702
745
  /** @internal */
703
746
  inject?: boolean | InjectVisitorConfig
704
747
  inputSourceMap?: string
@@ -82,9 +82,9 @@ export { Fragment, Suspense } from 'react';
82
82
  * Legacy React APIs
83
83
  * @see https://react.dev/reference/react/legacy
84
84
  */
85
- export { Component, PureComponent, cloneElement, createElement, createRef, isValidElement } from 'react';
85
+ export { Component, PureComponent, createRef, isValidElement } from 'react';
86
86
 
87
- export type { ReactLynxChildren } from '../runtime/lib/index.js';
87
+ export type { CloneElement, CreateElement, ReactLynxChildren } from '../runtime/lib/index.js';
88
88
 
89
89
  /**
90
90
  * ReactLynx children utilities.
@@ -103,6 +103,26 @@ export const Children: ReactLynxChildren;
103
103
  */
104
104
  export { createPortal } from '../runtime/lib/index.js';
105
105
 
106
+ /**
107
+ * Creates a ReactLynx element from a Lynx intrinsic element name or a
108
+ * component type. Lynx intrinsic elements are processed by the ReactLynx
109
+ * snapshot runtime.
110
+ *
111
+ * @see https://react.dev/reference/react/createElement
112
+ * @public
113
+ */
114
+ export { createElement } from '../runtime/lib/index.js';
115
+
116
+ /**
117
+ * Clones an existing ReactLynx element and applies new props through the
118
+ * ReactLynx runtime. Runtime-created elements and components may also receive
119
+ * replacement children.
120
+ *
121
+ * @see https://react.dev/reference/react/cloneElement
122
+ * @public
123
+ */
124
+ export { cloneElement } from '../runtime/lib/index.js';
125
+
106
126
  /**
107
127
  * RL-defined Lynx APIs
108
128
  */