@lynx-js/react 0.123.1 → 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 (27) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.json +1 -1
  3. package/runtime/lib/element-template/background/commit-hook.js +3 -0
  4. package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
  5. package/runtime/lib/element-template/prop-adapters/spread.js +11 -11
  6. package/runtime/lib/element-template/prop-adapters/spread.js.map +1 -1
  7. package/runtime/lib/element-template/protocol/types.d.ts +1 -0
  8. package/runtime/lib/shared/attribute-name.d.ts +3 -0
  9. package/runtime/lib/shared/attribute-name.js +91 -0
  10. package/runtime/lib/shared/attribute-name.js.map +1 -0
  11. package/runtime/lib/snapshot/lifecycle/patch/commit.js +3 -0
  12. package/runtime/lib/snapshot/lifecycle/patch/commit.js.map +1 -1
  13. package/runtime/lib/snapshot/renderToOpcodes/hydrate.js +19 -0
  14. package/runtime/lib/snapshot/renderToOpcodes/hydrate.js.map +1 -1
  15. package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +97 -65
  16. package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
  17. package/runtime/lib/snapshot/snapshot/platformInfo.js +20 -9
  18. package/runtime/lib/snapshot/snapshot/platformInfo.js.map +1 -1
  19. package/runtime/lib/snapshot/snapshot/spread.js +27 -17
  20. package/runtime/lib/snapshot/snapshot/spread.js.map +1 -1
  21. package/runtime/lib/snapshot/snapshot/utils.js +8 -3
  22. package/runtime/lib/snapshot/snapshot/utils.js.map +1 -1
  23. package/runtime/lib/tsconfig.tsbuildinfo +1 -1
  24. package/testing-library/dist/env/index.js +5 -0
  25. package/testing-library/dist/index.d.ts +1 -0
  26. package/transform/dist/wasm.cjs +1 -1
  27. package/transform/index.d.ts +43 -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