@wix/react-component-schema 1.3.0 → 1.5.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.
@@ -0,0 +1,408 @@
1
+ declare module '@wix/editor-react-types' {
2
+ import type { ReactElement } from 'react';
3
+
4
+ /**
5
+ * Accessibility attributes.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * import type { A11y } from '@wix/editor-react-types';
10
+ *
11
+ * interface MyComponentProps {
12
+ * a11y?: A11y;
13
+ * }
14
+ *
15
+ * const MyComponent = ({ a11y }: MyComponentProps) => (
16
+ * <div
17
+ * tabIndex={a11y?.tabIndex}
18
+ * role={a11y?.role}
19
+ * aria-label={a11y?.ariaLabel}
20
+ * />
21
+ * );
22
+ * ```
23
+ */
24
+ export interface A11y {
25
+ /** The `tabindex` attribute. Controls the component's position in keyboard focus order. */
26
+ tabIndex?: number;
27
+ /** The `aria-level` attribute. Defines the hierarchical level of a component within a structure. */
28
+ ariaLevel?: number;
29
+ /** The `aria-expanded` attribute. Indicates whether a collapsible component is expanded or collapsed. */
30
+ ariaExpanded?: boolean | 'false' | 'true';
31
+ /** The `aria-disabled` attribute. Indicates that the component is perceivable but disabled. */
32
+ ariaDisabled?: boolean | 'false' | 'true';
33
+ /** The `aria-atomic` attribute. Indicates whether assistive technologies should present the entire region as a whole. */
34
+ ariaAtomic?: boolean | 'false' | 'true';
35
+ /** The `aria-hidden` attribute. Hides the component from assistive technologies. */
36
+ ariaHidden?: boolean | 'false' | 'true';
37
+ /** The `aria-busy` attribute. Indicates the component is being modified and assistive technologies should wait. */
38
+ ariaBusy?: boolean | 'false' | 'true';
39
+ /** Whether the component supports multiline input. */
40
+ multiline?: boolean;
41
+ /** The `aria-autocomplete` attribute. Indicates the type of autocomplete behavior for an input. */
42
+ ariaAutocomplete?: 'none' | 'inline' | 'list' | 'both';
43
+ /** The `aria-pressed` attribute. Indicates the current "pressed" state of a toggle button. */
44
+ ariaPressed?: boolean | 'false' | 'mixed' | 'true';
45
+ /** The `aria-haspopup` attribute. Indicates the availability and type of an interactive popup component. */
46
+ ariaHaspopup?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
47
+ /** The `aria-relevant` attribute. Indicates what notifications the user agent will trigger when the accessibility tree is modified. */
48
+ ariaRelevant?: 'additions' | 'additions text' | 'all' | 'removals' | 'text';
49
+ /** The `role` attribute. Defines the semantic role of the component. */
50
+ role?: string;
51
+ /** The `aria-live` attribute. Indicates that the component will be updated and describes the types of updates. */
52
+ ariaLive?: 'off' | 'assertive' | 'polite';
53
+ /** The `aria-current` attribute. Indicates the component that represents the current item within a container or set. */
54
+ ariaCurrent?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time';
55
+ /** The `aria-label` attribute. Defines a string value that labels the component. */
56
+ ariaLabel?: string;
57
+ /** The `aria-roledescription` attribute. Defines a human-readable description for the role of the component. */
58
+ ariaRoledescription?: string;
59
+ /** The `aria-describedby` attribute. Identifies the element that describes this component. */
60
+ ariaDescribedby?: string;
61
+ /** The `aria-labelledby` attribute. Identifies the element that labels this component. */
62
+ ariaLabelledby?: string;
63
+ /** The `aria-errormessage` attribute. Identifies the element that provides an error message for this component. */
64
+ ariaErrormessage?: string;
65
+ /** The `aria-owns` attribute. Identifies a component to define a visual, functional, or contextual parent/child relationship. */
66
+ ariaOwns?: string;
67
+ /** The `aria-controls` attribute. Identifies the element whose contents or presence are controlled by this component. */
68
+ ariaControls?: string;
69
+ /** The HTML tag to render the component as (e.g. `'h1'`, `'button'`). */
70
+ tag?: string;
71
+ /** The `aria-multiline` attribute. Indicates whether a text box accepts multiple lines of input. */
72
+ ariaMultiline?: boolean | 'false' | 'true';
73
+ /** The `aria-invalid` attribute. Indicates the entered value does not conform to the expected format. */
74
+ ariaInvalid?: boolean | 'false' | 'true' | 'grammar' | 'spelling';
75
+ }
76
+
77
+ /** An adaptive streaming video source (HLS or DASH). */
78
+ type AdaptiveVideoSource = {
79
+ /** The adaptive streaming format. */
80
+ format: 'hls' | 'dash';
81
+ /** The video URI. */
82
+ uri: string;
83
+ /** The fully resolved video URL. */
84
+ url: string;
85
+ };
86
+
87
+ /**
88
+ * An audio track from Wix Media.
89
+ *
90
+ * @example
91
+ * ```tsx
92
+ * import type { Audio } from '@wix/editor-react-types';
93
+ *
94
+ * interface MyComponentProps {
95
+ * audio?: Audio;
96
+ * }
97
+ * ```
98
+ */
99
+ export type Audio = {
100
+ /** The fully resolved audio URL. */
101
+ url: string;
102
+ /** The audio artist name. */
103
+ artist?: string;
104
+ /** The audio track title. */
105
+ title?: string;
106
+ /** The audio duration in seconds. */
107
+ duration?: number;
108
+ /** The audio file name. */
109
+ name?: string;
110
+ /** All available audio sources at different quality levels and formats. */
111
+ audio?: Array<AudioSource>;
112
+ };
113
+
114
+ /** A single audio source file at a specific quality and format. */
115
+ type AudioSource = {
116
+ /** The audio bitrate in kbps. */
117
+ audioBitrate: number;
118
+ /** The audio format (e.g. `'mp3'`, `'ogg'`). */
119
+ format: string;
120
+ /** The audio quality label. */
121
+ quality: string;
122
+ /** The fully resolved audio URL. */
123
+ url: string;
124
+ };
125
+
126
+ type Crop = Point & {
127
+ width: number;
128
+ height: number;
129
+ };
130
+
131
+ /**
132
+ * The text direction of the component.
133
+ * Maps to the HTML `dir` attribute.
134
+ * - `'ltr'` — left to right.
135
+ * - `'rtl'` — right to left.
136
+ * - `'auto'` — determined by content.
137
+ *
138
+ * @example
139
+ * ```tsx
140
+ * import type { Direction } from '@wix/editor-react-types';
141
+ *
142
+ * interface MyComponentProps {
143
+ * direction?: Direction;
144
+ * }
145
+ *
146
+ * const MyComponent = ({ direction = 'ltr' }: MyComponentProps) => (
147
+ * <div dir={direction}>...</div>
148
+ * );
149
+ * ```
150
+ */
151
+ export type Direction = 'rtl' | 'ltr' | 'auto';
152
+
153
+ /**
154
+ * An image from Wix Media.
155
+ *
156
+ * @example
157
+ * ```tsx
158
+ * import type { Image } from '@wix/editor-react-types';
159
+ *
160
+ * interface MyComponentProps {
161
+ * image?: Image;
162
+ * }
163
+ *
164
+ * const MyComponent = ({ image }: MyComponentProps) => (
165
+ * <img src={image?.url} alt={image?.alt} />
166
+ * );
167
+ * ```
168
+ */
169
+ export type Image = {
170
+ /** The image URI. */
171
+ uri?: string;
172
+ /** The image URL. */
173
+ url: string;
174
+ /** The image file name. */
175
+ name?: string;
176
+ /** The image height in pixels. */
177
+ height?: number;
178
+ /** The image width in pixels. */
179
+ width?: number;
180
+ /** Whether the image is animated (e.g. GIF). */
181
+ animated?: boolean;
182
+ /** The crop region applied to the image. */
183
+ crop?: Crop;
184
+ /** The image quality, as a percentage from 0 to 100. */
185
+ quality?: number;
186
+ /** The image alt text for accessibility. */
187
+ alt?: string;
188
+ };
189
+
190
+ /**
191
+ * A link to a URL, used for navigation within components.
192
+ *
193
+ * @example
194
+ * ```tsx
195
+ * import type { Link } from '@wix/editor-react-types';
196
+ *
197
+ * interface MyComponentProps {
198
+ * link?: Link;
199
+ * }
200
+ * ```
201
+ */
202
+ export type Link = {
203
+ /** The link URL. */
204
+ href?: string;
205
+ /**
206
+ * Where this link should open.
207
+ * - `'_self'` — opens in the same page.
208
+ * - `'_blank'` — opens in a new tab.
209
+ */
210
+ target?: LinkTarget;
211
+ /** The `rel` attribute of the link. Accepts LinkRel values separated by a space. */
212
+ rel?: string;
213
+ };
214
+
215
+ type LinkTarget = '_self' | '_blank';
216
+
217
+ /**
218
+ * A local date string in ISO-8601 extended format (`YYYY-MM-DD`).
219
+ *
220
+ * @example
221
+ * ```tsx
222
+ * import type { LocalDate } from '@wix/editor-react-types';
223
+ *
224
+ * interface MyComponentProps {
225
+ * startDate?: LocalDate; // e.g. '2024-03-15'
226
+ * }
227
+ * ```
228
+ */
229
+ export type LocalDate = string;
230
+
231
+ /**
232
+ * A local time string in ISO-8601 extended format (`hh:mm[:ss][.sss]`).
233
+ *
234
+ * @example
235
+ * ```tsx
236
+ * import type { LocalTime } from '@wix/editor-react-types';
237
+ *
238
+ * interface MyComponentProps {
239
+ * openingTime?: LocalTime; // e.g. '09:00'
240
+ * }
241
+ * ```
242
+ */
243
+ export type LocalTime = string;
244
+
245
+ /**
246
+ * A single item in a menu, optionally containing nested sub-items.
247
+ */
248
+ type MenuItem = {
249
+ /** A unique identifier for the menu item. */
250
+ id: string;
251
+ /** The display label shown to the user. */
252
+ label: string;
253
+ /** The navigation link for this menu item. */
254
+ link?: Link;
255
+ /** An optional container element rendered alongside the menu item. */
256
+ container?: ReactElement;
257
+ /** Nested child menu items, for building multi-level menus. */
258
+ items?: Array<MenuItem>;
259
+ };
260
+
261
+ /**
262
+ * A list of menu items.
263
+ *
264
+ * @example
265
+ * ```tsx
266
+ * import type { MenuItems } from '@wix/editor-react-types';
267
+ *
268
+ * interface MyComponentProps {
269
+ * items?: MenuItems;
270
+ * }
271
+ * ```
272
+ */
273
+ export type MenuItems = Array<MenuItem>;
274
+
275
+ type Point = {
276
+ x: number;
277
+ y: number;
278
+ };
279
+
280
+ /**
281
+ * Rich text content with resolved links.
282
+ *
283
+ * @example
284
+ * ```tsx
285
+ * import type { RichText } from '@wix/editor-react-types';
286
+ *
287
+ * interface MyComponentProps {
288
+ * description?: RichText;
289
+ * }
290
+ *
291
+ * const MyComponent = ({ description }: MyComponentProps) => (
292
+ * <div>
293
+ * {description?.html}
294
+ * {description?.linkList.map((link) => (
295
+ * <a key={link.href} href={link.href}>{link.href}</a>
296
+ * ))}
297
+ * </div>
298
+ * );
299
+ * ```
300
+ */
301
+ export type RichText = {
302
+ /** The original rich text content. */
303
+ text: string;
304
+ /** The HTML content with all links resolved. */
305
+ html: string;
306
+ /** All links present in the rich text content. */
307
+ linkList: Array<Link>;
308
+ };
309
+
310
+ /**
311
+ * A vector art (SVG) asset from Wix Media.
312
+ *
313
+ * @example
314
+ * ```tsx
315
+ * import type { VectorArt } from '@wix/editor-react-types';
316
+ *
317
+ * interface MyComponentProps {
318
+ * icon?: VectorArt;
319
+ * }
320
+ * ```
321
+ */
322
+ export type VectorArt = {
323
+ /** The SVG URI. */
324
+ uri: string;
325
+ /** The SVG `viewBox` attribute value. */
326
+ viewBox: string;
327
+ /** The SVG content box dimensions. */
328
+ contentBox: string;
329
+ /** A map of color IDs to their resolved color values, for themeable SVGs. */
330
+ colors: Record<string, string>;
331
+ /**
332
+ * The SVG content type, which determines how colors and theming are applied.
333
+ * - `'shape'` — a simple monochromatic shape.
334
+ * - `'color'` — a multi-color SVG.
335
+ * - `'tint'` — a single-color tintable SVG.
336
+ * - `'ugc'` — user-generated content.
337
+ * - `'textpath'` — text along a path.
338
+ */
339
+ contentType: 'shape' | 'color' | 'tint' | 'ugc' | 'textpath';
340
+ /** The raw SVG markup. */
341
+ svgContent: string;
342
+ };
343
+
344
+ /**
345
+ * A video from Wix Media, including all available sources and quality levels.
346
+ *
347
+ * @example
348
+ * ```tsx
349
+ * import type { Video } from '@wix/editor-react-types';
350
+ *
351
+ * interface MyComponentProps {
352
+ * video?: Video;
353
+ * }
354
+ * ```
355
+ */
356
+ export type Video = {
357
+ /** The original video URI. */
358
+ uri: string;
359
+ /** All available quality-level sources for progressive playback. */
360
+ sources: Array<VideoSource>;
361
+ /** Adaptive streaming sources (HLS/DASH) for streaming playback. */
362
+ adaptiveSources: Array<AdaptiveVideoSource>;
363
+ /** Whether the video contains an audio track. */
364
+ hasAudio: boolean;
365
+ /** The video frame rate in frames per second. */
366
+ fps: number;
367
+ /** A poster image to display before the video plays. */
368
+ poster?: Image;
369
+ };
370
+
371
+ /** A set of video files for a specific quality level. */
372
+ type VideoSource = {
373
+ /** The video quality level. */
374
+ quality: '1080p' | '720p' | '480p' | '360p';
375
+ /** The video width in pixels at this quality level. */
376
+ width: number;
377
+ /** The video height in pixels at this quality level. */
378
+ height: number;
379
+ /** The available file types for this quality level. */
380
+ types: Array<VideoSourceType>;
381
+ };
382
+
383
+ /** A single video file format for a given quality level. */
384
+ type VideoSourceType = {
385
+ /** The video format. */
386
+ format: 'mp4' | 'mp4-luminance';
387
+ /** The video URI. */
388
+ uri: string;
389
+ /** The fully resolved video URL. */
390
+ url: string;
391
+ };
392
+
393
+ /**
394
+ * A URL with an `http` or `https` scheme.
395
+ *
396
+ * @example
397
+ * ```tsx
398
+ * import type { WebUrl } from '@wix/editor-react-types';
399
+ *
400
+ * interface MyComponentProps {
401
+ * website?: WebUrl;
402
+ * }
403
+ * ```
404
+ */
405
+ export type WebUrl = string;
406
+
407
+ export { }
408
+ }
package/dist/index.d.ts CHANGED
@@ -1517,7 +1517,7 @@ declare enum DisplayValueEnumDisplayValue {
1517
1517
  }
1518
1518
 
1519
1519
  export declare type EditorElement = EditorElement_2 & RequiredFields<EditorElement_2, 'selector' | 'displayName'> & {
1520
- presets: Record<string, PresetItem>;
1520
+ presets?: Record<string, PresetItem>;
1521
1521
  };
1522
1522
 
1523
1523
  declare interface EditorElement_2 {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "registry": "https://registry.npmjs.org/",
5
5
  "access": "public"
6
6
  },
7
- "version": "1.3.0",
7
+ "version": "1.5.0",
8
8
  "description": "Schema constants and types for EditorReactComponent extension",
9
9
  "type": "module",
10
10
  "main": "dist/index.js",
@@ -13,6 +13,9 @@
13
13
  ".": {
14
14
  "import": "./dist/index.js",
15
15
  "types": "./dist/index.d.ts"
16
+ },
17
+ "./editor-react-types": {
18
+ "types": "./dist/editor-react-types.d.ts"
16
19
  }
17
20
  },
18
21
  "scripts": {
@@ -28,6 +31,7 @@
28
31
  "@types/node": "^20.0.0",
29
32
  "@wix/ambassador-devcenter-components-overrides-v1-components-override": "^1.0.408",
30
33
  "@wix/component-protocol": "1.223.0",
34
+ "@wix/editor-react-types": "^1.0.20",
31
35
  "vite": "^7.3.2",
32
36
  "vite-plugin-dts": "^4.5.4",
33
37
  "vitest": "^4.0.17"
@@ -48,5 +52,5 @@
48
52
  ]
49
53
  }
50
54
  },
51
- "falconPackageHash": "3479c3715d9982e330afa6498c29b4e8a838b947dfe262bfd8df67da"
55
+ "falconPackageHash": "b432d738be20865e7356082187540d6c0cde0a2cfcf7927aa00c666c"
52
56
  }
@@ -1,5 +1,417 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
+ exports[`react-component-schema dist > dist/editor-react-types.d.ts matches snapshot 1`] = `
4
+ "declare module '@wix/editor-react-types' {
5
+ import type { ReactElement } from 'react';
6
+
7
+ /**
8
+ * Accessibility attributes.
9
+ *
10
+ * @example
11
+ * \`\`\`tsx
12
+ * import type { A11y } from '@wix/editor-react-types';
13
+ *
14
+ * interface MyComponentProps {
15
+ * a11y?: A11y;
16
+ * }
17
+ *
18
+ * const MyComponent = ({ a11y }: MyComponentProps) => (
19
+ * <div
20
+ * tabIndex={a11y?.tabIndex}
21
+ * role={a11y?.role}
22
+ * aria-label={a11y?.ariaLabel}
23
+ * />
24
+ * );
25
+ * \`\`\`
26
+ */
27
+ export interface A11y {
28
+ /** The \`tabindex\` attribute. Controls the component's position in keyboard focus order. */
29
+ tabIndex?: number;
30
+ /** The \`aria-level\` attribute. Defines the hierarchical level of a component within a structure. */
31
+ ariaLevel?: number;
32
+ /** The \`aria-expanded\` attribute. Indicates whether a collapsible component is expanded or collapsed. */
33
+ ariaExpanded?: boolean | 'false' | 'true';
34
+ /** The \`aria-disabled\` attribute. Indicates that the component is perceivable but disabled. */
35
+ ariaDisabled?: boolean | 'false' | 'true';
36
+ /** The \`aria-atomic\` attribute. Indicates whether assistive technologies should present the entire region as a whole. */
37
+ ariaAtomic?: boolean | 'false' | 'true';
38
+ /** The \`aria-hidden\` attribute. Hides the component from assistive technologies. */
39
+ ariaHidden?: boolean | 'false' | 'true';
40
+ /** The \`aria-busy\` attribute. Indicates the component is being modified and assistive technologies should wait. */
41
+ ariaBusy?: boolean | 'false' | 'true';
42
+ /** Whether the component supports multiline input. */
43
+ multiline?: boolean;
44
+ /** The \`aria-autocomplete\` attribute. Indicates the type of autocomplete behavior for an input. */
45
+ ariaAutocomplete?: 'none' | 'inline' | 'list' | 'both';
46
+ /** The \`aria-pressed\` attribute. Indicates the current "pressed" state of a toggle button. */
47
+ ariaPressed?: boolean | 'false' | 'mixed' | 'true';
48
+ /** The \`aria-haspopup\` attribute. Indicates the availability and type of an interactive popup component. */
49
+ ariaHaspopup?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
50
+ /** The \`aria-relevant\` attribute. Indicates what notifications the user agent will trigger when the accessibility tree is modified. */
51
+ ariaRelevant?: 'additions' | 'additions text' | 'all' | 'removals' | 'text';
52
+ /** The \`role\` attribute. Defines the semantic role of the component. */
53
+ role?: string;
54
+ /** The \`aria-live\` attribute. Indicates that the component will be updated and describes the types of updates. */
55
+ ariaLive?: 'off' | 'assertive' | 'polite';
56
+ /** The \`aria-current\` attribute. Indicates the component that represents the current item within a container or set. */
57
+ ariaCurrent?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time';
58
+ /** The \`aria-label\` attribute. Defines a string value that labels the component. */
59
+ ariaLabel?: string;
60
+ /** The \`aria-roledescription\` attribute. Defines a human-readable description for the role of the component. */
61
+ ariaRoledescription?: string;
62
+ /** The \`aria-describedby\` attribute. Identifies the element that describes this component. */
63
+ ariaDescribedby?: string;
64
+ /** The \`aria-labelledby\` attribute. Identifies the element that labels this component. */
65
+ ariaLabelledby?: string;
66
+ /** The \`aria-errormessage\` attribute. Identifies the element that provides an error message for this component. */
67
+ ariaErrormessage?: string;
68
+ /** The \`aria-owns\` attribute. Identifies a component to define a visual, functional, or contextual parent/child relationship. */
69
+ ariaOwns?: string;
70
+ /** The \`aria-controls\` attribute. Identifies the element whose contents or presence are controlled by this component. */
71
+ ariaControls?: string;
72
+ /** The HTML tag to render the component as (e.g. \`'h1'\`, \`'button'\`). */
73
+ tag?: string;
74
+ /** The \`aria-multiline\` attribute. Indicates whether a text box accepts multiple lines of input. */
75
+ ariaMultiline?: boolean | 'false' | 'true';
76
+ /** The \`aria-invalid\` attribute. Indicates the entered value does not conform to the expected format. */
77
+ ariaInvalid?: boolean | 'false' | 'true' | 'grammar' | 'spelling';
78
+ }
79
+
80
+ /** An adaptive streaming video source (HLS or DASH). */
81
+ type AdaptiveVideoSource = {
82
+ /** The adaptive streaming format. */
83
+ format: 'hls' | 'dash';
84
+ /** The video URI. */
85
+ uri: string;
86
+ /** The fully resolved video URL. */
87
+ url: string;
88
+ };
89
+
90
+ /**
91
+ * An audio track from Wix Media.
92
+ *
93
+ * @example
94
+ * \`\`\`tsx
95
+ * import type { Audio } from '@wix/editor-react-types';
96
+ *
97
+ * interface MyComponentProps {
98
+ * audio?: Audio;
99
+ * }
100
+ * \`\`\`
101
+ */
102
+ export type Audio = {
103
+ /** The fully resolved audio URL. */
104
+ url: string;
105
+ /** The audio artist name. */
106
+ artist?: string;
107
+ /** The audio track title. */
108
+ title?: string;
109
+ /** The audio duration in seconds. */
110
+ duration?: number;
111
+ /** The audio file name. */
112
+ name?: string;
113
+ /** All available audio sources at different quality levels and formats. */
114
+ audio?: Array<AudioSource>;
115
+ };
116
+
117
+ /** A single audio source file at a specific quality and format. */
118
+ type AudioSource = {
119
+ /** The audio bitrate in kbps. */
120
+ audioBitrate: number;
121
+ /** The audio format (e.g. \`'mp3'\`, \`'ogg'\`). */
122
+ format: string;
123
+ /** The audio quality label. */
124
+ quality: string;
125
+ /** The fully resolved audio URL. */
126
+ url: string;
127
+ };
128
+
129
+ type Crop = Point & {
130
+ width: number;
131
+ height: number;
132
+ };
133
+
134
+ /**
135
+ * The text direction of the component.
136
+ * Maps to the HTML \`dir\` attribute.
137
+ * - \`'ltr'\` — left to right.
138
+ * - \`'rtl'\` — right to left.
139
+ * - \`'auto'\` — determined by content.
140
+ *
141
+ * @example
142
+ * \`\`\`tsx
143
+ * import type { Direction } from '@wix/editor-react-types';
144
+ *
145
+ * interface MyComponentProps {
146
+ * direction?: Direction;
147
+ * }
148
+ *
149
+ * const MyComponent = ({ direction = 'ltr' }: MyComponentProps) => (
150
+ * <div dir={direction}>...</div>
151
+ * );
152
+ * \`\`\`
153
+ */
154
+ export type Direction = 'rtl' | 'ltr' | 'auto';
155
+
156
+ /**
157
+ * An image from Wix Media.
158
+ *
159
+ * @example
160
+ * \`\`\`tsx
161
+ * import type { Image } from '@wix/editor-react-types';
162
+ *
163
+ * interface MyComponentProps {
164
+ * image?: Image;
165
+ * }
166
+ *
167
+ * const MyComponent = ({ image }: MyComponentProps) => (
168
+ * <img src={image?.url} alt={image?.alt} />
169
+ * );
170
+ * \`\`\`
171
+ */
172
+ export type Image = {
173
+ /** The image URI. */
174
+ uri?: string;
175
+ /** The image URL. */
176
+ url: string;
177
+ /** The image file name. */
178
+ name?: string;
179
+ /** The image height in pixels. */
180
+ height?: number;
181
+ /** The image width in pixels. */
182
+ width?: number;
183
+ /** Whether the image is animated (e.g. GIF). */
184
+ animated?: boolean;
185
+ /** The crop region applied to the image. */
186
+ crop?: Crop;
187
+ /** The image quality, as a percentage from 0 to 100. */
188
+ quality?: number;
189
+ /** The image alt text for accessibility. */
190
+ alt?: string;
191
+ };
192
+
193
+ /**
194
+ * A link to a URL, used for navigation within components.
195
+ *
196
+ * @example
197
+ * \`\`\`tsx
198
+ * import type { Link } from '@wix/editor-react-types';
199
+ *
200
+ * interface MyComponentProps {
201
+ * link?: Link;
202
+ * }
203
+ * \`\`\`
204
+ */
205
+ export type Link = {
206
+ /** The link URL. */
207
+ href?: string;
208
+ /**
209
+ * Where this link should open.
210
+ * - \`'_self'\` — opens in the same page.
211
+ * - \`'_blank'\` — opens in a new tab.
212
+ */
213
+ target?: LinkTarget;
214
+ /** The \`rel\` attribute of the link. Accepts LinkRel values separated by a space. */
215
+ rel?: string;
216
+ };
217
+
218
+ type LinkTarget = '_self' | '_blank';
219
+
220
+ /**
221
+ * A local date string in ISO-8601 extended format (\`YYYY-MM-DD\`).
222
+ *
223
+ * @example
224
+ * \`\`\`tsx
225
+ * import type { LocalDate } from '@wix/editor-react-types';
226
+ *
227
+ * interface MyComponentProps {
228
+ * startDate?: LocalDate; // e.g. '2024-03-15'
229
+ * }
230
+ * \`\`\`
231
+ */
232
+ export type LocalDate = string;
233
+
234
+ /**
235
+ * A local time string in ISO-8601 extended format (\`hh:mm[:ss][.sss]\`).
236
+ *
237
+ * @example
238
+ * \`\`\`tsx
239
+ * import type { LocalTime } from '@wix/editor-react-types';
240
+ *
241
+ * interface MyComponentProps {
242
+ * openingTime?: LocalTime; // e.g. '09:00'
243
+ * }
244
+ * \`\`\`
245
+ */
246
+ export type LocalTime = string;
247
+
248
+ /**
249
+ * A single item in a menu, optionally containing nested sub-items.
250
+ */
251
+ type MenuItem = {
252
+ /** A unique identifier for the menu item. */
253
+ id: string;
254
+ /** The display label shown to the user. */
255
+ label: string;
256
+ /** The navigation link for this menu item. */
257
+ link?: Link;
258
+ /** An optional container element rendered alongside the menu item. */
259
+ container?: ReactElement;
260
+ /** Nested child menu items, for building multi-level menus. */
261
+ items?: Array<MenuItem>;
262
+ };
263
+
264
+ /**
265
+ * A list of menu items.
266
+ *
267
+ * @example
268
+ * \`\`\`tsx
269
+ * import type { MenuItems } from '@wix/editor-react-types';
270
+ *
271
+ * interface MyComponentProps {
272
+ * items?: MenuItems;
273
+ * }
274
+ * \`\`\`
275
+ */
276
+ export type MenuItems = Array<MenuItem>;
277
+
278
+ type Point = {
279
+ x: number;
280
+ y: number;
281
+ };
282
+
283
+ /**
284
+ * Rich text content with resolved links.
285
+ *
286
+ * @example
287
+ * \`\`\`tsx
288
+ * import type { RichText } from '@wix/editor-react-types';
289
+ *
290
+ * interface MyComponentProps {
291
+ * description?: RichText;
292
+ * }
293
+ *
294
+ * const MyComponent = ({ description }: MyComponentProps) => (
295
+ * <div>
296
+ * {description?.html}
297
+ * {description?.linkList.map((link) => (
298
+ * <a key={link.href} href={link.href}>{link.href}</a>
299
+ * ))}
300
+ * </div>
301
+ * );
302
+ * \`\`\`
303
+ */
304
+ export type RichText = {
305
+ /** The original rich text content. */
306
+ text: string;
307
+ /** The HTML content with all links resolved. */
308
+ html: string;
309
+ /** All links present in the rich text content. */
310
+ linkList: Array<Link>;
311
+ };
312
+
313
+ /**
314
+ * A vector art (SVG) asset from Wix Media.
315
+ *
316
+ * @example
317
+ * \`\`\`tsx
318
+ * import type { VectorArt } from '@wix/editor-react-types';
319
+ *
320
+ * interface MyComponentProps {
321
+ * icon?: VectorArt;
322
+ * }
323
+ * \`\`\`
324
+ */
325
+ export type VectorArt = {
326
+ /** The SVG URI. */
327
+ uri: string;
328
+ /** The SVG \`viewBox\` attribute value. */
329
+ viewBox: string;
330
+ /** The SVG content box dimensions. */
331
+ contentBox: string;
332
+ /** A map of color IDs to their resolved color values, for themeable SVGs. */
333
+ colors: Record<string, string>;
334
+ /**
335
+ * The SVG content type, which determines how colors and theming are applied.
336
+ * - \`'shape'\` — a simple monochromatic shape.
337
+ * - \`'color'\` — a multi-color SVG.
338
+ * - \`'tint'\` — a single-color tintable SVG.
339
+ * - \`'ugc'\` — user-generated content.
340
+ * - \`'textpath'\` — text along a path.
341
+ */
342
+ contentType: 'shape' | 'color' | 'tint' | 'ugc' | 'textpath';
343
+ /** The raw SVG markup. */
344
+ svgContent: string;
345
+ };
346
+
347
+ /**
348
+ * A video from Wix Media, including all available sources and quality levels.
349
+ *
350
+ * @example
351
+ * \`\`\`tsx
352
+ * import type { Video } from '@wix/editor-react-types';
353
+ *
354
+ * interface MyComponentProps {
355
+ * video?: Video;
356
+ * }
357
+ * \`\`\`
358
+ */
359
+ export type Video = {
360
+ /** The original video URI. */
361
+ uri: string;
362
+ /** All available quality-level sources for progressive playback. */
363
+ sources: Array<VideoSource>;
364
+ /** Adaptive streaming sources (HLS/DASH) for streaming playback. */
365
+ adaptiveSources: Array<AdaptiveVideoSource>;
366
+ /** Whether the video contains an audio track. */
367
+ hasAudio: boolean;
368
+ /** The video frame rate in frames per second. */
369
+ fps: number;
370
+ /** A poster image to display before the video plays. */
371
+ poster?: Image;
372
+ };
373
+
374
+ /** A set of video files for a specific quality level. */
375
+ type VideoSource = {
376
+ /** The video quality level. */
377
+ quality: '1080p' | '720p' | '480p' | '360p';
378
+ /** The video width in pixels at this quality level. */
379
+ width: number;
380
+ /** The video height in pixels at this quality level. */
381
+ height: number;
382
+ /** The available file types for this quality level. */
383
+ types: Array<VideoSourceType>;
384
+ };
385
+
386
+ /** A single video file format for a given quality level. */
387
+ type VideoSourceType = {
388
+ /** The video format. */
389
+ format: 'mp4' | 'mp4-luminance';
390
+ /** The video URI. */
391
+ uri: string;
392
+ /** The fully resolved video URL. */
393
+ url: string;
394
+ };
395
+
396
+ /**
397
+ * A URL with an \`http\` or \`https\` scheme.
398
+ *
399
+ * @example
400
+ * \`\`\`tsx
401
+ * import type { WebUrl } from '@wix/editor-react-types';
402
+ *
403
+ * interface MyComponentProps {
404
+ * website?: WebUrl;
405
+ * }
406
+ * \`\`\`
407
+ */
408
+ export type WebUrl = string;
409
+
410
+ export { }
411
+ }
412
+ "
413
+ `;
414
+
3
415
  exports[`react-component-schema dist > dist/index.d.ts matches snapshot 1`] = `
4
416
  "export declare interface A11y {
5
417
  /**
@@ -1520,7 +1932,7 @@ declare enum DisplayValueEnumDisplayValue {
1520
1932
  }
1521
1933
 
1522
1934
  export declare type EditorElement = EditorElement_2 & RequiredFields<EditorElement_2, 'selector' | 'displayName'> & {
1523
- presets: Record<string, PresetItem>;
1935
+ presets?: Record<string, PresetItem>;
1524
1936
  };
1525
1937
 
1526
1938
  declare interface EditorElement_2 {
@@ -0,0 +1,20 @@
1
+ // Blacklisted types are excluded by omitting them from the explicit list below.
2
+ export type {
3
+ A11y,
4
+ Audio,
5
+ Direction,
6
+ Image,
7
+ Link,
8
+ LocalDate,
9
+ LocalTime,
10
+ MenuItems,
11
+ RichText,
12
+ VectorArt,
13
+ Video,
14
+ WebUrl,
15
+ // TODO: Not supported by auto panels
16
+ // Email,
17
+ // LocalDateTime,
18
+ // Phone,
19
+ // Regex,
20
+ } from '@wix/editor-react-types'
package/src/index.test.ts CHANGED
@@ -12,4 +12,9 @@ describe('react-component-schema dist', () => {
12
12
  const content = readFileSync(resolve(__dirname, '../dist/index.d.ts'), 'utf-8')
13
13
  expect(content).toMatchSnapshot()
14
14
  })
15
+
16
+ it('dist/editor-react-types.d.ts matches snapshot', () => {
17
+ const content = readFileSync(resolve(__dirname, '../dist/editor-react-types.d.ts'), 'utf-8')
18
+ expect(content).toMatchSnapshot()
19
+ })
15
20
  })
package/src/index.ts CHANGED
@@ -92,5 +92,5 @@ export type PresetItem = RawPresetItem & RequiredFields<RawPresetItem, 'displayN
92
92
  // make selector and displayName required to be consistant with headless-integration repo
93
93
  export type EditorElement = RawEditorElement &
94
94
  RequiredFields<RawEditorElement, 'selector' | 'displayName'> & {
95
- presets: Record<string, PresetItem>
95
+ presets?: Record<string, PresetItem>
96
96
  }
package/vite.config.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs'
1
2
  import { resolve } from 'node:path'
2
3
  import type { Plugin } from 'vite'
3
4
  import { defineConfig } from 'vite'
@@ -34,9 +35,39 @@ function pureEnumAnnotationsPlugin(): Plugin {
34
35
  }
35
36
  }
36
37
 
38
+ /**
39
+ * Wraps the generated editor-react-types.d.ts in a `declare module` block.
40
+ *
41
+ * vite-plugin-dts (with rollupTypes) inlines all bundled types. This plugin
42
+ * then wraps the inlined output so that consumers get a self-contained ambient
43
+ * module declaration for '@wix/editor-react-types' instead of a flat re-export.
44
+ */
45
+ function wrapEditorReactTypesDeclarationPlugin(): Plugin {
46
+ return {
47
+ name: 'wrap-editor-react-types-declaration',
48
+ generateBundle(_options, bundle) {
49
+ delete bundle['editor-react-types.js']
50
+ },
51
+ closeBundle() {
52
+ const declarationFilePath = resolve(__dirname, 'dist/editor-react-types.d.ts')
53
+ if (!existsSync(declarationFilePath)) return
54
+ const content = readFileSync(declarationFilePath, 'utf-8')
55
+ if (content.startsWith("declare module '@wix/editor-react-types'")) return
56
+ // Inside `declare module` every declaration is already ambient — strip
57
+ // the redundant `declare` keyword (bare or after `export`) to avoid TS2842.
58
+ const ambientContent = content.replace(
59
+ /^(export )?declare (type|interface|class|const|function|var|enum|namespace|abstract class)\b/gm,
60
+ '$1$2',
61
+ )
62
+ writeFileSync(declarationFilePath, `declare module '@wix/editor-react-types' {\n${ambientContent}}\n`)
63
+ },
64
+ }
65
+ }
66
+
37
67
  export default defineConfig({
38
68
  plugins: [
39
69
  pureEnumAnnotationsPlugin(),
70
+ wrapEditorReactTypesDeclarationPlugin(),
40
71
  dts({
41
72
  include: ['src/**/*.ts'],
42
73
  exclude: ['**/*.test.ts'],
@@ -45,14 +76,18 @@ export default defineConfig({
45
76
  '@wix/component-protocol',
46
77
  '@wix/ambassador-devcenter-v1-component-type-data',
47
78
  '@wix/ambassador-devcenter-components-overrides-v1-components-override',
79
+ '@wix/editor-react-types',
48
80
  ],
49
81
  }),
50
82
  ],
51
83
  build: {
52
84
  lib: {
53
- entry: resolve(__dirname, 'src/index.ts'),
85
+ entry: {
86
+ index: resolve(__dirname, 'src/index.ts'),
87
+ 'editor-react-types': resolve(__dirname, 'src/editor-react-types.ts'),
88
+ },
54
89
  formats: ['es'],
55
- fileName: 'index',
90
+ fileName: (format, entryName) => `${entryName}.js`,
56
91
  },
57
92
  rollupOptions: {
58
93
  // No externals — inline everything for a zero-dep bundle