@wix/react-component-schema 1.1.0 → 1.3.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.
package/dist/index.d.ts CHANGED
@@ -1516,7 +1516,9 @@ declare enum DisplayValueEnumDisplayValue {
1516
1516
  listItem = "listItem"
1517
1517
  }
1518
1518
 
1519
- export declare type EditorElement = EditorElement_2 & Required<Pick<EditorElement_2, 'selector' | 'displayName'>>;
1519
+ export declare type EditorElement = EditorElement_2 & RequiredFields<EditorElement_2, 'selector' | 'displayName'> & {
1520
+ presets: Record<string, PresetItem>;
1521
+ };
1520
1522
 
1521
1523
  declare interface EditorElement_2 {
1522
1524
  /**
@@ -1539,7 +1541,7 @@ declare interface EditorElement_2 {
1539
1541
  /** Custom actions specified for the component, allowing for flexibility beyond native actions */
1540
1542
  customActions?: Record<string, ApiAction>;
1541
1543
  /** Component presets definition. Canonically useful for different layout or theming */
1542
- presets?: Record<string, PresetItem>;
1544
+ presets?: Record<string, PresetItem_2>;
1543
1545
  /** Layout capabilities of the component */
1544
1546
  layout?: EditorElementLayout;
1545
1547
  /** The Archetype this component adheres to, to be used for classification by AI models */
@@ -2100,7 +2102,7 @@ export declare interface InlineElement {
2100
2102
  /** Custom actions specified for the component, allowing for flexibility beyond native actions */
2101
2103
  customActions?: Record<string, ApiAction>;
2102
2104
  /** Component presets definition. Canonically useful for different layout or theming */
2103
- presets?: Record<string, PresetItem>;
2105
+ presets?: Record<string, PresetItem_2>;
2104
2106
  /** The Archetype this component adheres to, to be used for classification by AI models */
2105
2107
  archetype?: ARCHETYPE;
2106
2108
  /** A map with definitions of states that this element can be edited in */
@@ -2408,7 +2410,9 @@ declare interface PresetInnerElementDefaults {
2408
2410
  elements?: Record<string, PresetInnerElementDefaults>;
2409
2411
  }
2410
2412
 
2411
- export declare interface PresetItem {
2413
+ export declare type PresetItem = PresetItem_2 & RequiredFields<PresetItem_2, 'displayName'>;
2414
+
2415
+ declare interface PresetItem_2 {
2412
2416
  /**
2413
2417
  * DEPRECATED - use preset_css_url instead
2414
2418
  * @format WEB_URL
@@ -2600,6 +2604,8 @@ declare interface RefInnerElementDefaults {
2600
2604
  cssCustomProperties?: Record<string, CssPropertyItemDefaults>;
2601
2605
  }
2602
2606
 
2607
+ declare type RequiredFields<T, K extends keyof T> = Required<Pick<T, K>>;
2608
+
2603
2609
  declare enum ResizeDirection {
2604
2610
  /** Default value when direction is not specified */
2605
2611
  UNKNOWN_ResizeDirection = "UNKNOWN_ResizeDirection",
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "registry": "https://registry.npmjs.org/",
5
5
  "access": "public"
6
6
  },
7
- "version": "1.1.0",
7
+ "version": "1.3.0",
8
8
  "description": "Schema constants and types for EditorReactComponent extension",
9
9
  "type": "module",
10
10
  "main": "dist/index.js",
@@ -48,5 +48,5 @@
48
48
  ]
49
49
  }
50
50
  },
51
- "falconPackageHash": "02b91df4f5928ec7fa0b957958ec2dcb26e070a985419bbab3d51a41"
51
+ "falconPackageHash": "3479c3715d9982e330afa6498c29b4e8a838b947dfe262bfd8df67da"
52
52
  }
@@ -1519,7 +1519,9 @@ declare enum DisplayValueEnumDisplayValue {
1519
1519
  listItem = "listItem"
1520
1520
  }
1521
1521
 
1522
- export declare type EditorElement = EditorElement_2 & Required<Pick<EditorElement_2, 'selector' | 'displayName'>>;
1522
+ export declare type EditorElement = EditorElement_2 & RequiredFields<EditorElement_2, 'selector' | 'displayName'> & {
1523
+ presets: Record<string, PresetItem>;
1524
+ };
1523
1525
 
1524
1526
  declare interface EditorElement_2 {
1525
1527
  /**
@@ -1542,7 +1544,7 @@ declare interface EditorElement_2 {
1542
1544
  /** Custom actions specified for the component, allowing for flexibility beyond native actions */
1543
1545
  customActions?: Record<string, ApiAction>;
1544
1546
  /** Component presets definition. Canonically useful for different layout or theming */
1545
- presets?: Record<string, PresetItem>;
1547
+ presets?: Record<string, PresetItem_2>;
1546
1548
  /** Layout capabilities of the component */
1547
1549
  layout?: EditorElementLayout;
1548
1550
  /** The Archetype this component adheres to, to be used for classification by AI models */
@@ -2103,7 +2105,7 @@ export declare interface InlineElement {
2103
2105
  /** Custom actions specified for the component, allowing for flexibility beyond native actions */
2104
2106
  customActions?: Record<string, ApiAction>;
2105
2107
  /** Component presets definition. Canonically useful for different layout or theming */
2106
- presets?: Record<string, PresetItem>;
2108
+ presets?: Record<string, PresetItem_2>;
2107
2109
  /** The Archetype this component adheres to, to be used for classification by AI models */
2108
2110
  archetype?: ARCHETYPE;
2109
2111
  /** A map with definitions of states that this element can be edited in */
@@ -2411,7 +2413,9 @@ declare interface PresetInnerElementDefaults {
2411
2413
  elements?: Record<string, PresetInnerElementDefaults>;
2412
2414
  }
2413
2415
 
2414
- export declare interface PresetItem {
2416
+ export declare type PresetItem = PresetItem_2 & RequiredFields<PresetItem_2, 'displayName'>;
2417
+
2418
+ declare interface PresetItem_2 {
2415
2419
  /**
2416
2420
  * DEPRECATED - use preset_css_url instead
2417
2421
  * @format WEB_URL
@@ -2603,6 +2607,8 @@ declare interface RefInnerElementDefaults {
2603
2607
  cssCustomProperties?: Record<string, CssPropertyItemDefaults>;
2604
2608
  }
2605
2609
 
2610
+ declare type RequiredFields<T, K extends keyof T> = Required<Pick<T, K>>;
2611
+
2606
2612
  declare enum ResizeDirection {
2607
2613
  /** Default value when direction is not specified */
2608
2614
  UNKNOWN_ResizeDirection = "UNKNOWN_ResizeDirection",
package/src/index.ts CHANGED
@@ -28,7 +28,6 @@ export type {
28
28
  DataItem,
29
29
  DataItemsMap,
30
30
  Presets,
31
- PresetItem,
32
31
  Elements,
33
32
  ElementsDefaults,
34
33
  ElementItem,
@@ -83,7 +82,15 @@ export type {
83
82
  ListItem,
84
83
  } from '@wix/component-protocol/schema'
85
84
 
86
- import type { EditorElement as RawEditorElement } from '@wix/component-protocol/schema'
85
+ import type { EditorElement as RawEditorElement, PresetItem as RawPresetItem } from '@wix/component-protocol/schema'
86
+
87
+ type RequiredFields<T, K extends keyof T> = Required<Pick<T, K>>
88
+
89
+ // make displayName required to be consistant with headless-integration repo
90
+ export type PresetItem = RawPresetItem & RequiredFields<RawPresetItem, 'displayName'>
87
91
 
88
92
  // make selector and displayName required to be consistant with headless-integration repo
89
- export type EditorElement = RawEditorElement & Required<Pick<RawEditorElement, 'selector' | 'displayName'>>
93
+ export type EditorElement = RawEditorElement &
94
+ RequiredFields<RawEditorElement, 'selector' | 'displayName'> & {
95
+ presets: Record<string, PresetItem>
96
+ }