@wix/public-editor-platform-interfaces 1.59.0 → 1.60.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,501 @@
1
+ import type { ElementData, ElementDataInput, ElementDataValue, ElementLink } from './sdk/data';
2
+ import type { ElementStyles, ElementStylesUpdate, ElementStylesRemoval } from './sdk/styles';
3
+ import type { ElementDataDefinitions, ElementPresetDefinitions, ElementStateDefinitions, ElementStyleDefinitions } from './sdk/definitions';
4
+ import type { IPickerModes, IFontFamily, IFontWeight, IFontFamilyAndWeight, ISelectLinkSharedOptions, IPanelOptions, SelectFontParams, SelectFontFamilyParams, SelectFontWeightParams, SelectMediaParams, SelectLinkParams, SelectColorParams, SelectTextThemeParams } from './sdk/pickers';
5
+ import type { BackgroundPickerOptions } from './Inputs';
6
+ export type { IPickerModes, IFontFamily, IFontWeight, IFontFamilyAndWeight, ISelectLinkSharedOptions, IPanelOptions, SelectFontParams, SelectFontFamilyParams, SelectFontWeightParams, SelectMediaParams, SelectLinkParams, SelectColorParams, SelectTextThemeParams, };
7
+ /**
8
+ * Use `reactElements` from `@wix/editor` in a custom panel to read and update the component's styles,
9
+ * data, presets, and states, and to open editor pickers. Picker methods use {@link IPickerModes}. See each `select*` method for its parameter type.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * import { reactElements } from '@wix/editor';
14
+ *
15
+ * export default function MyPanel() {
16
+ * const handleClick = async () => {
17
+ * const data = await reactElements.getData();
18
+ * await reactElements.setData({ title: 'Updated!' });
19
+ * };
20
+ * return <button onClick={handleClick}>Update Title</button>;
21
+ * }
22
+ * ```
23
+ */
24
+ export interface IElementSDK {
25
+ /**
26
+ * Lists the data fields defined on the selected component's manifest.
27
+ *
28
+ * Each key in the result is a valid **`dataItemKey`** for {@link getData}, {@link setData}, and
29
+ * {@link getResolvedData}. See {@link ElementDataDefinitions}.
30
+ *
31
+ * A **`dataItemKey`** is the property name of a data field in that component's manifest. The same names
32
+ * returned from {@link getDataDefinitions}. Example: `'heroImage'` for a field declared as `heroImage` under
33
+ * `editorElement.data` in the component manifest.
34
+ *
35
+ * @returns Definitions keyed by `dataItemKey`.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * import { reactElements } from '@wix/editor';
40
+ *
41
+ * const defs = await reactElements.getDataDefinitions();
42
+ * ```
43
+ */
44
+ getDataDefinitions(): Promise<ElementDataDefinitions>;
45
+ /**
46
+ * Retrieves the current data values for the component.
47
+ *
48
+ * @typeParam T - Optional type parameter to define the expected structure of the returned data.
49
+ * @returns Current data values for the component.
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * import { reactElements } from '@wix/editor';
54
+ *
55
+ * const data = await reactElements.getData();
56
+ * ```
57
+ */
58
+ getData<T extends ElementData = ElementData>(): Promise<T>;
59
+ /**
60
+ * Returns one data field from the selected component by **`dataItemKey`**.
61
+ *
62
+ * {@link getData} returns all fields at once. This method returns only the field you name. For supported
63
+ * data types the editor may return a richer value than the same key in `getData`, such as expanded media
64
+ * or link details for UI.
65
+ *
66
+ * @param options.dataItemKey - Key of the data field to read. Must exist on the component manifest.
67
+ * @returns Value for that data field.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * import { reactElements } from '@wix/editor';
72
+ *
73
+ * const hero = await reactElements.getResolvedData({
74
+ * dataItemKey: 'heroImage',
75
+ * });
76
+ * ```
77
+ */
78
+ getResolvedData(options: {
79
+ dataItemKey: string;
80
+ }): Promise<ElementDataValue>;
81
+ /**
82
+ * Updates data values for the component. Only the specified data items
83
+ * are updated; other data items remain unchanged.
84
+ *
85
+ * @typeParam T - Optional type parameter to define the expected structure of the input data.
86
+ * @param values - Data item keys and their new values.
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * import { reactElements } from '@wix/editor';
91
+ *
92
+ * await reactElements.setData({ title: 'New Title', showButton: false });
93
+ * ```
94
+ */
95
+ setData<T extends ElementData = ElementData>(values: ElementDataInput<T>): Promise<void>;
96
+ /**
97
+ * Retrieves the style definitions declared in the component's manifest,
98
+ * including `cssProperties` and `cssCustomProperties`.
99
+ *
100
+ * @returns Style definitions for the component.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * import { reactElements } from '@wix/editor';
105
+ *
106
+ * const defs = await reactElements.getStyleDefinitions();
107
+ * ```
108
+ */
109
+ getStyleDefinitions(): Promise<ElementStyleDefinitions>;
110
+ /**
111
+ * Retrieves the current style values for the component.
112
+ *
113
+ * @returns Current `cssProperties` and `cssCustomProperties` values.
114
+ *
115
+ * @example
116
+ * ```ts
117
+ * import { reactElements } from '@wix/editor';
118
+ *
119
+ * const styles = await reactElements.getStyles();
120
+ * const bgColor = styles.cssProperties.backgroundColor;
121
+ * ```
122
+ */
123
+ getStyles(): Promise<ElementStyles>;
124
+ /**
125
+ * Sets style values for the component.
126
+ *
127
+ * @param values - Partial style update. Keys map to CSS property names or
128
+ * custom property names as defined by the element's style schema.
129
+ *
130
+ * @example
131
+ * ```ts
132
+ * import { reactElements, CssPropertyType } from '@wix/editor';
133
+ *
134
+ * await reactElements.setStyles({
135
+ * cssProperties: { [CssPropertyType.color]: '#fff' }
136
+ * });
137
+ * ```
138
+ */
139
+ setStyles(values?: ElementStylesUpdate): Promise<void>;
140
+ /**
141
+ * Removes style overrides from the component, reverting to default values.
142
+ *
143
+ * @param values - Identifies which [CSS properties](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/site-extensions/editor-react-components/manifest-reference/editor-element/css/standard-css-properties) or [custom properties](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/site-extensions/editor-react-components/manifest-reference/editor-element/css/css-custom-properties) to clear.
144
+ *
145
+ * @example
146
+ * ```ts
147
+ * import { reactElements, CssPropertyType } from '@wix/editor';
148
+ *
149
+ * await reactElements.removeStyles({
150
+ * cssPropertiesKeys: [CssPropertyType.color]
151
+ * });
152
+ * ```
153
+ */
154
+ removeStyles(values?: ElementStylesRemoval): Promise<void>;
155
+ /**
156
+ * Retrieves the preset definitions declared in the component's manifest.
157
+ *
158
+ * @returns An object mapping each preset key to its definition.
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * import { reactElements } from '@wix/editor';
163
+ *
164
+ * const presets = await reactElements.getPresetDefinitions();
165
+ * ```
166
+ */
167
+ getPresetDefinitions(): Promise<ElementPresetDefinitions>;
168
+ /**
169
+ * Retrieves the currently applied preset for the component.
170
+ *
171
+ * @returns Key of the applied preset, or `null` if no preset is applied.
172
+ *
173
+ * @example
174
+ * ```ts
175
+ * import { reactElements } from '@wix/editor';
176
+ *
177
+ * const preset = await reactElements.getAppliedPreset();
178
+ * ```
179
+ */
180
+ getAppliedPreset(): Promise<string | null>;
181
+ /**
182
+ * Applies a preset to the component. Applying a preset updates the component's
183
+ * styles and data to match the preset's defined defaults.
184
+ *
185
+ * @param options - Object containing the `key` of the preset to apply.
186
+ *
187
+ * @example
188
+ * ```ts
189
+ * import { reactElements } from '@wix/editor';
190
+ *
191
+ * await reactElements.applyPreset({ key: 'minimal' });
192
+ * ```
193
+ */
194
+ applyPreset(options: {
195
+ key: string;
196
+ }): Promise<void>;
197
+ /**
198
+ * Retrieves the currently active state for the component.
199
+ *
200
+ * @returns Key of the active state, or `null` if the default state is active.
201
+ *
202
+ * @example
203
+ * ```ts
204
+ * import { reactElements } from '@wix/editor';
205
+ *
206
+ * const state = await reactElements.getState();
207
+ * ```
208
+ */
209
+ getState(): Promise<string | null>;
210
+ /**
211
+ * Sets the active state for the component. Pass `null` to return to the
212
+ * default state.
213
+ *
214
+ * @param stateKey - State key to activate, or `null` for the default state.
215
+ *
216
+ * @example
217
+ * ```ts
218
+ * import { reactElements } from '@wix/editor';
219
+ *
220
+ * await reactElements.setState('hover');
221
+ * await reactElements.setState(null);
222
+ * ```
223
+ */
224
+ setState(stateKey: string | null): Promise<void>;
225
+ /**
226
+ * Retrieves the state definitions declared in the component's manifest.
227
+ *
228
+ * @returns An object mapping each state key to its definition.
229
+ *
230
+ * @example
231
+ * ```ts
232
+ * import { reactElements } from '@wix/editor';
233
+ *
234
+ * const states = await reactElements.getStateDefinitions();
235
+ * ```
236
+ */
237
+ getStateDefinitions(): Promise<ElementStateDefinitions>;
238
+ /**
239
+ * Retrieves the display group definitions declared in the component's manifest.
240
+ *
241
+ * @param options - Optional filter by `groupType`.
242
+ * @returns Display group definitions for the component.
243
+ *
244
+ * @example
245
+ * ```ts
246
+ * import { reactElements } from '@wix/editor';
247
+ *
248
+ * const groups = await reactElements.getDisplayGroupDefinitions();
249
+ * const cssGroups = await reactElements.getDisplayGroupDefinitions({
250
+ * filter: { groupType: 'cssDataType' },
251
+ * });
252
+ * ```
253
+ */
254
+ getDisplayGroupDefinitions(options?: {
255
+ filter?: {
256
+ groupType?: string;
257
+ };
258
+ }): Promise<Record<string, unknown>>;
259
+ /**
260
+ * Retrieves the display name of the component as defined in the manifest.
261
+ *
262
+ * @returns Component display name.
263
+ *
264
+ * @example
265
+ * ```ts
266
+ * import { reactElements } from '@wix/editor';
267
+ *
268
+ * const name = await reactElements.getDisplayName();
269
+ * ```
270
+ */
271
+ getDisplayName(): Promise<string>;
272
+ /**
273
+ * Subscribes to changes on the component. The callback is invoked whenever
274
+ * styles, data, state, preset, props, or manifest values change.
275
+ *
276
+ * @param callback - Callback that receives a patch with `type` and `value`.
277
+ * @returns Unsubscribe function. Call it to stop listening.
278
+ *
279
+ * @example
280
+ * ```ts
281
+ * import { reactElements } from '@wix/editor';
282
+ *
283
+ * const unsubscribe = await reactElements.onChange((patch) => {
284
+ * if (patch.type === 'data') {
285
+ * console.log('Data changed:', patch.value);
286
+ * }
287
+ * });
288
+ *
289
+ * unsubscribe();
290
+ * ```
291
+ */
292
+ onChange(callback: (patch: {
293
+ type: 'styles' | 'data' | 'state' | 'preset' | 'props' | 'manifest';
294
+ value: unknown;
295
+ }) => void): Promise<() => void>;
296
+ /**
297
+ * Retrieves the currently selected index in an array items data group.
298
+ *
299
+ * @param options - Specify `arrayItemsDisplayGroupKey` if the component
300
+ * has multiple array item groups.
301
+ * @returns Index of the currently selected array item.
302
+ *
303
+ * @example
304
+ * ```ts
305
+ * import { reactElements } from '@wix/editor';
306
+ *
307
+ * const index = await reactElements.getArrayItemsSelectedIndex();
308
+ * ```
309
+ */
310
+ getArrayItemsSelectedIndex(options?: {
311
+ arrayItemsDisplayGroupKey?: string;
312
+ }): Promise<number>;
313
+ /**
314
+ * Sets the selected index in an array items data group.
315
+ *
316
+ * @param options - Object containing the `index` to select, and optionally
317
+ * `arrayItemsDisplayGroupKey` if there are multiple array item groups.
318
+ *
319
+ * @example
320
+ * ```ts
321
+ * import { reactElements } from '@wix/editor';
322
+ *
323
+ * await reactElements.setArrayItemsSelectedIndex({ index: 2 });
324
+ * ```
325
+ */
326
+ setArrayItemsSelectedIndex(options: {
327
+ index: number;
328
+ arrayItemsDisplayGroupKey?: string;
329
+ }): Promise<void>;
330
+ /**
331
+ * Resets the selected index in an array items data group to the default.
332
+ *
333
+ * @param options - Specify `arrayItemsDisplayGroupKey` if the component
334
+ * has multiple array item groups.
335
+ *
336
+ * @example
337
+ * ```ts
338
+ * import { reactElements } from '@wix/editor';
339
+ *
340
+ * await reactElements.resetArrayItemsSelectedIndex();
341
+ * ```
342
+ */
343
+ resetArrayItemsSelectedIndex(options?: {
344
+ arrayItemsDisplayGroupKey?: string;
345
+ }): Promise<void>;
346
+ /**
347
+ * Opens the font picker for selecting a font family and weight.
348
+ *
349
+ * @param params - See {@link SelectFontParams} and {@link IPickerModes}.
350
+ * @returns Selected font family and weight, or `undefined` if dismissed.
351
+ *
352
+ * @example
353
+ * ```ts
354
+ * import { reactElements } from '@wix/editor';
355
+ *
356
+ * const font = await reactElements.selectFont({
357
+ * selectedFontFamily: { family: 'Arial', weight: '400' },
358
+ * target: buttonRef.current,
359
+ * onChange: (value) => console.log('Selected:', value),
360
+ * });
361
+ * ```
362
+ */
363
+ selectFont(params: SelectFontParams): Promise<IFontFamilyAndWeight | undefined>;
364
+ /**
365
+ * Opens the font family picker without weight selection.
366
+ *
367
+ * @param params - See {@link SelectFontFamilyParams} and {@link IPickerModes}.
368
+ * @returns Selected font family, or `undefined` if dismissed.
369
+ *
370
+ * @example
371
+ * ```ts
372
+ * import { reactElements } from '@wix/editor';
373
+ *
374
+ * const font = await reactElements.selectFontFamily({
375
+ * selectedFontFamily: { family: 'Helvetica', weight: '400' },
376
+ * target: buttonRef.current,
377
+ * onChange: (value) => console.log('Selected:', value.family),
378
+ * });
379
+ * ```
380
+ */
381
+ selectFontFamily(params: SelectFontFamilyParams): Promise<IFontFamily | undefined>;
382
+ /**
383
+ * Opens the font weight picker for a specified font family.
384
+ *
385
+ * @param params - See {@link SelectFontWeightParams} and {@link IPickerModes}.
386
+ * @returns Selected font weight.
387
+ *
388
+ * @example
389
+ * ```ts
390
+ * import { reactElements } from '@wix/editor';
391
+ *
392
+ * const weight = await reactElements.selectFontWeight({
393
+ * fontFamily: { family: 'Arial', weight: '400' },
394
+ * target: buttonRef.current,
395
+ * onChange: (value) => console.log('Selected weight:', value.weight),
396
+ * });
397
+ * ```
398
+ */
399
+ selectFontWeight(params: SelectFontWeightParams): Promise<IFontWeight>;
400
+ /**
401
+ * Opens the media picker for selecting images, videos, or other media.
402
+ *
403
+ * @param params - See {@link SelectMediaParams} and {@link IPickerModes}.
404
+ * @returns Selected media item.
405
+ *
406
+ * @example
407
+ * ```ts
408
+ * import { reactElements } from '@wix/editor';
409
+ *
410
+ * const media = await reactElements.selectMedia({
411
+ * isMultiSelect: true,
412
+ * category: 'image',
413
+ * });
414
+ * ```
415
+ */
416
+ selectMedia(params: SelectMediaParams): Promise<unknown>;
417
+ /**
418
+ * Opens the link picker for creating or editing a link.
419
+ *
420
+ * @param params - See {@link SelectLinkParams} and {@link IPickerModes}.
421
+ * @returns Selected link, or `null`/`undefined` if dismissed.
422
+ *
423
+ * @example
424
+ * ```ts
425
+ * import { reactElements } from '@wix/editor';
426
+ *
427
+ * const link = await reactElements.selectLink({
428
+ * value: currentLink,
429
+ * options: { linkTypes: ['ExternalLink', 'PageLink'] },
430
+ * });
431
+ * ```
432
+ */
433
+ selectLink(params: SelectLinkParams): Promise<ElementLink | null | undefined>;
434
+ /**
435
+ * Opens the color picker for selecting a color.
436
+ *
437
+ * @param params - See {@link SelectColorParams} and {@link IPickerModes}.
438
+ * @returns Selected color value as a CSS string, or `undefined` if dismissed.
439
+ *
440
+ * @example
441
+ * ```ts
442
+ * import { reactElements } from '@wix/editor';
443
+ *
444
+ * const color = await reactElements.selectColor({
445
+ * initialValue: '#ff0000',
446
+ * mode: ['solid', 'gradient'],
447
+ * showOpacity: true,
448
+ * onChange: (color) => console.log('Preview:', color),
449
+ * });
450
+ * ```
451
+ */
452
+ selectColor(params: SelectColorParams): Promise<string | undefined>;
453
+ /**
454
+ * Opens the background picker for selecting a background fill
455
+ * such as color, gradient, or image.
456
+ *
457
+ * @param options - Background picker configuration.
458
+ * @returns Selected background fill value.
459
+ *
460
+ * @example
461
+ * ```ts
462
+ * import { reactElements } from '@wix/editor';
463
+ *
464
+ * const bg = await reactElements.selectBackground({
465
+ * initialValue: { backgroundColor: '#fff', backgroundImage: '' },
466
+ * onChange: (value) => console.log('Preview:', value),
467
+ * });
468
+ * ```
469
+ */
470
+ selectBackground(options: BackgroundPickerOptions): Promise<unknown>;
471
+ /**
472
+ * Opens the text theme picker, a site theme combination of font and color.
473
+ *
474
+ * @param params - Picker options. See {@link SelectTextThemeParams}.
475
+ * @returns Selected text theme.
476
+ *
477
+ * @example
478
+ * ```ts
479
+ * import { reactElements } from '@wix/editor';
480
+ *
481
+ * const theme = await reactElements.selectTextTheme({
482
+ * target: buttonRef.current,
483
+ * initialValue: { font: 'Heading 1', color: '#333' },
484
+ * });
485
+ * ```
486
+ */
487
+ selectTextTheme(params: SelectTextThemeParams): Promise<unknown>;
488
+ /**
489
+ * Retrieves the BI token for the component.
490
+ *
491
+ * @returns BI token string.
492
+ *
493
+ * @example
494
+ * ```ts
495
+ * import { reactElements } from '@wix/editor';
496
+ *
497
+ * const token = await reactElements.getBiToken();
498
+ * ```
499
+ */
500
+ getBiToken(): Promise<string>;
501
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { WixSDKTypes };
3
3
  export { ComponentRef } from './ComponentRef';
4
4
  export { PlatformRealtimeChannels } from './Channels';
5
5
  export { IElement } from './Elements';
6
+ export type { IElementSDK } from './Element';
6
7
  export { EventType } from './EventType';
7
8
  export { AccessToken } from './Token';
8
9
  export { DsItem } from './DataItem';
@@ -2,5 +2,6 @@ export * from './data';
2
2
  export * from './styles';
3
3
  export * from './definitions';
4
4
  export * from './css-properties';
5
+ export * from './pickers';
5
6
  export * from './pages';
6
7
  export * from './routers';
package/dist/sdk/index.js CHANGED
@@ -18,5 +18,6 @@ __exportStar(require("./data"), exports);
18
18
  __exportStar(require("./styles"), exports);
19
19
  __exportStar(require("./definitions"), exports);
20
20
  __exportStar(require("./css-properties"), exports);
21
+ __exportStar(require("./pickers"), exports);
21
22
  __exportStar(require("./pages"), exports);
22
23
  __exportStar(require("./routers"), exports);
@@ -0,0 +1,205 @@
1
+ import type { ElementLink } from './data';
2
+ /**
3
+ * Each {@link IElementSDK | `reactElements`} `select*` method accepts one of two types of arguments:
4
+ * a manifest key for automatic editor handling, or explicit options to manage the value yourself.
5
+ * Use manifest-key mode to let the editor connect the picker to a manifest-backed data or style field.
6
+ * Use explicit-options mode when your panel owns the selected value and handles callbacks itself.
7
+ *
8
+ * @see IElementSDK.selectFont
9
+ * @see IElementSDK.selectFontFamily
10
+ * @see IElementSDK.selectFontWeight
11
+ * @see IElementSDK.selectMedia
12
+ * @see IElementSDK.selectLink
13
+ * @see IElementSDK.selectColor
14
+ */
15
+ export interface IPickerModes {
16
+ }
17
+ /** A font family and weight selection returned from {@link SelectFontParams} or {@link SelectFontFamilyParams}. */
18
+ export interface IFontFamily {
19
+ /**
20
+ * The font family name. Font options vary depending on site theme, custom uploads, and which fonts are available in the editor, such as Google fonts. Call {@link SelectFontParams} or
21
+ * {@link SelectFontFamilyParams} to get the `family` from the Wix user's selection rather
22
+ * than hard coding names in your panel.
23
+ */
24
+ family: string;
25
+ /**
26
+ * The font weight. Either a numeric string from `'100'`–`'900'` or a named value such as `'normal'` or `'bold'`.
27
+ * Available weight options depend on the selected font family. Call {@link SelectFontParams} or {@link SelectFontWeightParams}
28
+ * to get the available weight options based on the Wix user's selection.
29
+ */
30
+ weight: string;
31
+ }
32
+ /** Represents a font weight value. */
33
+ export interface IFontWeight {
34
+ /**
35
+ * The font weight. Either a numeric string from `'100'`–`'900'` or a named value such as `'normal'` or `'bold'`.
36
+ * Available weight options depend on the selected font family. Call {@link SelectFontParams} or {@link SelectFontWeightParams}
37
+ * to get the available weight options based on the Wix user's selection.
38
+ */
39
+ weight: string;
40
+ }
41
+ /** Combination of font family and weight properties. */
42
+ export type IFontFamilyAndWeight = IFontFamily & IFontWeight;
43
+ /**
44
+ * Extra settings passed as `options` when calling `reactElements.selectLink`.
45
+ */
46
+ export type ISelectLinkSharedOptions = {
47
+ /**
48
+ * Optional BI tag for where the link picker was opened from in the panel. Use a
49
+ * kebab-case string specific to your app, for example `header-cta` or `settings-link`.
50
+ */
51
+ origin?: string;
52
+ };
53
+ /**
54
+ * How the editor positions a floating picker popup relative to the element in the panel that caused the picker to open.
55
+ */
56
+ export type IPanelOptions = {
57
+ /** Preferred side or corner for the picker popup to appear relative to the element in the panel that caused the picker to open. */
58
+ placement?: 'top' | 'bottom' | 'top-start' | 'bottom-start' | 'top-end' | 'bottom-end';
59
+ /** Extra vertical offset in pixels from the default position beside the element in the panel that caused the picker to open. */
60
+ YShift?: number;
61
+ };
62
+ /**
63
+ * Options for {@link IElementSDK.selectFont | `reactElements.selectFont()`}.
64
+ * Pass either a manifest key or explicit options. See {@link IPickerModes}.
65
+ */
66
+ export type SelectFontParams = {
67
+ /** Pass a manifest key: field connected to `styleItemKey` in the manifest. See {@link IPickerModes}. */
68
+ styleItemKey: string;
69
+ } | {
70
+ /** Font family and weight shown when the picker opens. See {@link IPickerModes}. */
71
+ selectedFontFamily?: IFontFamilyAndWeight;
72
+ /** DOM element in your panel that caused the picker to open. */
73
+ target?: HTMLElement;
74
+ /** Where the picker popup appears relative to `target`. */
75
+ panelOptions?: IPanelOptions;
76
+ /** Called when the user confirms a selection. */
77
+ onChange?: (value: IFontFamilyAndWeight) => void;
78
+ /** Called while the user is hovering over options before confirming. */
79
+ onPreview?: (value: IFontFamilyAndWeight) => void;
80
+ };
81
+ /**
82
+ * Options for {@link IElementSDK.selectFontFamily | `reactElements.selectFontFamily()`}.
83
+ * Pass either a manifest key or explicit options. See {@link IPickerModes}.
84
+ */
85
+ export type SelectFontFamilyParams = {
86
+ /** Pass a manifest key: field connected to `styleItemKey` in the manifest. See {@link IPickerModes}. */
87
+ styleItemKey: string;
88
+ } | {
89
+ /** Font family shown when the picker opens. See {@link IPickerModes}. */
90
+ selectedFontFamily?: IFontFamily;
91
+ /** DOM element in your panel that caused the picker to open. */
92
+ target?: HTMLElement;
93
+ /** Where the picker popup appears relative to `target`. */
94
+ panelOptions?: IPanelOptions;
95
+ /** Called when the user confirms a selection. */
96
+ onChange?: (value: IFontFamily) => void;
97
+ /** Called while the user is hovering over options before confirming. */
98
+ onPreview?: (value: IFontFamily) => void;
99
+ };
100
+ /**
101
+ * Options for {@link IElementSDK.selectFontWeight | `reactElements.selectFontWeight()`}.
102
+ * Pass either a manifest key or explicit options. See {@link IPickerModes}.
103
+ */
104
+ export type SelectFontWeightParams = {
105
+ /** Pass a manifest key: field connected to `fontFamilyStyleItemKey` in the manifest. See {@link IPickerModes}. */
106
+ fontFamilyStyleItemKey: string;
107
+ /** Pass a manifest key: field connected to `fontWeightStyleItemKey` in the manifest. See {@link IPickerModes}. */
108
+ fontWeightStyleItemKey: string;
109
+ } | {
110
+ /** Pass a manifest key: field connected to `fontStyleItemKey` in the manifest. See {@link IPickerModes}. */
111
+ fontStyleItemKey: string;
112
+ } | {
113
+ /** Font family used to filter available weights. Omit to show all weights. See {@link IPickerModes}. */
114
+ fontFamily?: IFontFamily;
115
+ /** DOM element in your panel that caused the picker to open. */
116
+ target?: HTMLElement;
117
+ /** Called when the user selects a weight. */
118
+ onChange?: (value: IFontWeight) => void;
119
+ };
120
+ /**
121
+ * Options for {@link IElementSDK.selectMedia | `reactElements.selectMedia()`}.
122
+ * Pass either a manifest key or explicit options. See {@link IPickerModes}. */
123
+ export type SelectMediaParams = {
124
+ /** Pass a manifest key: field connected to `dataItemKey` in the manifest. See {@link IPickerModes}. */
125
+ dataItemKey: string;
126
+ } | {
127
+ /** Whether the user can select multiple media items at once. See {@link IPickerModes}. */
128
+ isMultiSelect?: boolean;
129
+ /** Restricts the media library to a specific category, for example `'image'`. */
130
+ category?: string;
131
+ };
132
+ /**
133
+ * Options for {@link IElementSDK.selectLink | `reactElements.selectLink()`}.
134
+ * Pass either a manifest key or explicit options. See {@link IPickerModes}. */
135
+ export type SelectLinkParams = {
136
+ /** Pass a manifest key: field connected to `dataItemKey` in the manifest. See {@link IPickerModes}. */
137
+ dataItemKey: string;
138
+ /** Optional settings. See {@link ISelectLinkSharedOptions}. */
139
+ options?: ISelectLinkSharedOptions;
140
+ } | {
141
+ /** Existing link to pre-populate the picker with. See {@link IPickerModes}. */
142
+ value?: ElementLink;
143
+ /** Optional settings such as BI attribution and allowed link types. See {@link ISelectLinkSharedOptions}. */
144
+ options?: ISelectLinkSharedOptions & {
145
+ /**
146
+ * Restricts the picker to specific link types.
147
+ * For example: `['ExternalLink', 'PageLink']`.
148
+ */
149
+ linkTypes?: string[];
150
+ };
151
+ };
152
+ /**
153
+ * Options for {@link IElementSDK.selectColor | `reactElements.selectColor()`}.
154
+ * Pass either a manifest key or explicit options. See {@link IPickerModes}. */
155
+ export type SelectColorParams = {
156
+ /** Pass a manifest key: field connected to `styleItemKey` in the manifest. See {@link IPickerModes}. */
157
+ styleItemKey: string;
158
+ } | {
159
+ /** Initial color when the picker opens, as a CSS color string. See {@link IPickerModes}. */
160
+ initialValue?: string;
161
+ /**
162
+ * Color modes to offer. Defaults to `['solid']`.
163
+ * Include `'gradient'` to enable gradient selection.
164
+ */
165
+ mode?: ('solid' | 'gradient')[];
166
+ /** Whether to show the site's brand color palette. */
167
+ showBrand?: boolean;
168
+ /** Whether to show the custom color input. */
169
+ showCustom?: boolean;
170
+ /** Whether to show the advanced settings panel. */
171
+ showAdvancedSettings?: boolean;
172
+ /** Whether to show the opacity / alpha slider. */
173
+ showOpacity?: boolean;
174
+ /** Screen-space position `{ x, y }` where the color picker should open. */
175
+ position?: {
176
+ x: number;
177
+ y: number;
178
+ };
179
+ /** BI tracking metadata. `origin` identifies the UI surface that opened the picker. */
180
+ biData?: {
181
+ origin: string;
182
+ };
183
+ /** Called on every color change while the picker is open. */
184
+ onChange?: (color: string) => void;
185
+ /** Called when the user explicitly confirms a color selection. */
186
+ onApply?: (color: string) => void;
187
+ /** Called when the picker is closed, whether or not a color was confirmed. */
188
+ onClose?: () => void;
189
+ /** Called when the user cancels without confirming. */
190
+ onCancel?: () => void;
191
+ };
192
+ /**
193
+ * Options for `reactElements.selectTextTheme()` from a custom panel.
194
+ */
195
+ export type SelectTextThemeParams = {
196
+ /** DOM element in your panel that caused the picker to open. */
197
+ target?: HTMLElement;
198
+ /** Initial values to pre-populate the picker with. */
199
+ initialValue?: {
200
+ /** Initial font value, as CSS font shorthand or a theme token. */
201
+ font?: string;
202
+ /** Initial color value, as a CSS color string or a theme token. */
203
+ color?: string;
204
+ };
205
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/public-editor-platform-interfaces",
3
- "version": "1.59.0",
3
+ "version": "1.60.0",
4
4
  "license": "UNLICENSED",
5
5
  "contributors": [
6
6
  {
@@ -52,5 +52,5 @@
52
52
  ]
53
53
  }
54
54
  },
55
- "falconPackageHash": "2d496dbb3b0fd8b3f2db09f96bb67f428f2d4a73f9de4f65b86c67fb"
55
+ "falconPackageHash": "fff05dc4387c9e0ca8419ffb283d050c596e080415538b721645765b"
56
56
  }