@wix/public-editor-platform-interfaces 1.39.0 → 1.40.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/Elements.d.ts +64 -10
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.js +1 -0
- package/dist/sdk/pickers.d.ts +97 -0
- package/dist/sdk/pickers.js +2 -0
- package/package.json +2 -2
package/dist/Elements.d.ts
CHANGED
|
@@ -1,11 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { ElementData, ElementDataInput, ElementDataDefinitions, ElementStyles, ElementStylesUpdate, ElementStylesRemoval, ElementStyleDefinitions, ElementPresetDefinitions, ElementStateDefinitions, ElementLink, ElementDataValue } from './sdk';
|
|
2
|
+
import type { BackgroundPickerOptions } from './Inputs';
|
|
3
|
+
import type { SelectFontParams, SelectFontFamilyParams, SelectFontWeightParams, SelectMediaParams, SelectLinkParams, SelectColorParams, SelectTextThemeParams, IFontFamily, IFontWeight, IFontFamilyAndWeight } from './sdk/pickers';
|
|
4
|
+
/**
|
|
5
|
+
* Unified element interface returned by `elements.getSelection()` (Classic / Studio)
|
|
6
|
+
* and structurally satisfied by the `element` singleton (Harmony).
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* In Classic / Studio editors, builder-specific methods (`getStyles`, `getData`,
|
|
10
|
+
* `applyPreset`, pickers, etc.) return inert empty values. They are functional only
|
|
11
|
+
* when the component is selected in Harmony (Editor 3).
|
|
12
|
+
*/
|
|
13
|
+
export interface IElement {
|
|
14
|
+
/** Component type id. Populated in Classic/Studio (text|image|null). Always null in Harmony. */
|
|
15
|
+
type: string | null;
|
|
16
|
+
getProp<T = unknown>(prop: string): Promise<T | null | undefined | void>;
|
|
17
|
+
setProp<T = unknown>(prop: string, value: T | null | undefined): Promise<void>;
|
|
18
|
+
getData<T extends ElementData = ElementData>(): Promise<T>;
|
|
19
|
+
setData<T extends ElementData = ElementData>(values: ElementDataInput<T>): Promise<void>;
|
|
20
|
+
getResolvedData(options: {
|
|
21
|
+
dataItemKey: string;
|
|
22
|
+
}): Promise<ElementDataValue>;
|
|
23
|
+
getDataDefinitions(): Promise<ElementDataDefinitions>;
|
|
24
|
+
getStyles(): Promise<ElementStyles>;
|
|
25
|
+
setStyles(values?: ElementStylesUpdate): Promise<void>;
|
|
26
|
+
removeStyles(values?: ElementStylesRemoval): Promise<void>;
|
|
27
|
+
getStyleDefinitions(): Promise<ElementStyleDefinitions>;
|
|
28
|
+
getPresetDefinitions(): Promise<ElementPresetDefinitions>;
|
|
29
|
+
getAppliedPreset(): Promise<string | null>;
|
|
30
|
+
applyPreset(options: {
|
|
31
|
+
key: string;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
getState(): Promise<string | null>;
|
|
34
|
+
setState(stateKey: string | null): Promise<void>;
|
|
35
|
+
getStateDefinitions(): Promise<ElementStateDefinitions>;
|
|
36
|
+
getDisplayGroupDefinitions(options?: {
|
|
37
|
+
filter?: {
|
|
38
|
+
groupType?: string;
|
|
39
|
+
};
|
|
40
|
+
}): Promise<Record<string, unknown>>;
|
|
41
|
+
getDisplayName(): Promise<string>;
|
|
42
|
+
onChange(callback: (patch: {
|
|
43
|
+
type: 'styles' | 'data' | 'state' | 'preset' | 'props' | 'manifest';
|
|
44
|
+
value: unknown;
|
|
45
|
+
}) => void): Promise<() => void>;
|
|
46
|
+
selectFont(params: SelectFontParams): Promise<IFontFamilyAndWeight | undefined>;
|
|
47
|
+
selectFontFamily(params: SelectFontFamilyParams): Promise<IFontFamily | undefined>;
|
|
48
|
+
selectFontWeight(params: SelectFontWeightParams): Promise<IFontWeight>;
|
|
49
|
+
selectMedia(params: SelectMediaParams): Promise<unknown>;
|
|
50
|
+
selectLink(params: SelectLinkParams): Promise<ElementLink | null | undefined>;
|
|
51
|
+
selectColor(params: SelectColorParams): Promise<string | undefined>;
|
|
52
|
+
selectBackground(options: BackgroundPickerOptions): Promise<unknown>;
|
|
53
|
+
selectTextTheme(params: SelectTextThemeParams): Promise<unknown>;
|
|
54
|
+
getArrayItemsSelectedIndex(options?: {
|
|
55
|
+
arrayItemsDisplayGroupKey?: string;
|
|
56
|
+
}): Promise<number>;
|
|
57
|
+
setArrayItemsSelectedIndex(options: {
|
|
58
|
+
index: number;
|
|
59
|
+
arrayItemsDisplayGroupKey?: string;
|
|
60
|
+
}): Promise<void>;
|
|
61
|
+
resetArrayItemsSelectedIndex(options?: {
|
|
62
|
+
arrayItemsDisplayGroupKey?: string;
|
|
63
|
+
}): Promise<void>;
|
|
64
|
+
getBiToken(): Promise<string>;
|
|
5
65
|
}
|
|
6
|
-
export type IElement = IElementBase<'text', {
|
|
7
|
-
text: string;
|
|
8
|
-
}> | IElementBase<'image', {
|
|
9
|
-
src: string;
|
|
10
|
-
responsive: boolean;
|
|
11
|
-
}> | IElementBase<null, Record<string, string | number | boolean>>;
|
package/dist/sdk/index.d.ts
CHANGED
package/dist/sdk/index.js
CHANGED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { ElementLink } from './data';
|
|
2
|
+
/** Represents a font family and its weight. */
|
|
3
|
+
export interface IFontFamily {
|
|
4
|
+
/** The font family name. For example, 'Arial' or 'Helvetica Neue'. */
|
|
5
|
+
family: string;
|
|
6
|
+
/** The font weight. For example, '400' or 'bold'. */
|
|
7
|
+
weight: string;
|
|
8
|
+
}
|
|
9
|
+
/** Represents a font weight value. */
|
|
10
|
+
export interface IFontWeight {
|
|
11
|
+
/** The font weight. For example, '400' or 'bold'. */
|
|
12
|
+
weight: string;
|
|
13
|
+
}
|
|
14
|
+
/** Combination of font family and weight properties. */
|
|
15
|
+
export type IFontFamilyAndWeight = IFontFamily & IFontWeight;
|
|
16
|
+
export type ISelectLinkSharedOptions = {
|
|
17
|
+
/** Identifier for the origin of the link selection (used for BI tracking). */
|
|
18
|
+
origin?: string;
|
|
19
|
+
};
|
|
20
|
+
/** Options for positioning a picker panel relative to a target element. */
|
|
21
|
+
export type IPanelOptions = {
|
|
22
|
+
/** Where to place the picker panel relative to the target element. */
|
|
23
|
+
placement?: 'top' | 'bottom' | 'top-start' | 'bottom-start' | 'top-end' | 'bottom-end';
|
|
24
|
+
/** Vertical offset in pixels to shift the panel from its computed position. */
|
|
25
|
+
YShift?: number;
|
|
26
|
+
};
|
|
27
|
+
export type SelectFontParams = {
|
|
28
|
+
styleItemKey: string;
|
|
29
|
+
} | {
|
|
30
|
+
selectedFontFamily?: IFontFamilyAndWeight;
|
|
31
|
+
target?: HTMLElement;
|
|
32
|
+
panelOptions?: IPanelOptions;
|
|
33
|
+
onChange?: (value: IFontFamilyAndWeight) => void;
|
|
34
|
+
onPreview?: (value: IFontFamilyAndWeight) => void;
|
|
35
|
+
};
|
|
36
|
+
export type SelectFontFamilyParams = {
|
|
37
|
+
styleItemKey: string;
|
|
38
|
+
} | {
|
|
39
|
+
selectedFontFamily?: IFontFamily;
|
|
40
|
+
target?: HTMLElement;
|
|
41
|
+
panelOptions?: IPanelOptions;
|
|
42
|
+
onChange?: (value: IFontFamily) => void;
|
|
43
|
+
onPreview?: (value: IFontFamily) => void;
|
|
44
|
+
};
|
|
45
|
+
export type SelectFontWeightParams = {
|
|
46
|
+
fontFamilyStyleItemKey: string;
|
|
47
|
+
fontWeightStyleItemKey: string;
|
|
48
|
+
} | {
|
|
49
|
+
fontStyleItemKey: string;
|
|
50
|
+
} | {
|
|
51
|
+
fontFamily?: IFontFamily;
|
|
52
|
+
target?: HTMLElement;
|
|
53
|
+
onChange?: (value: IFontWeight) => void;
|
|
54
|
+
};
|
|
55
|
+
export type SelectMediaParams = {
|
|
56
|
+
dataItemKey: string;
|
|
57
|
+
} | {
|
|
58
|
+
isMultiSelect?: boolean;
|
|
59
|
+
category?: string;
|
|
60
|
+
};
|
|
61
|
+
export type SelectLinkParams = {
|
|
62
|
+
dataItemKey: string;
|
|
63
|
+
options?: ISelectLinkSharedOptions;
|
|
64
|
+
} | {
|
|
65
|
+
value?: ElementLink;
|
|
66
|
+
options?: ISelectLinkSharedOptions & {
|
|
67
|
+
linkTypes?: string[];
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export type SelectColorParams = {
|
|
71
|
+
styleItemKey: string;
|
|
72
|
+
} | {
|
|
73
|
+
initialValue?: string;
|
|
74
|
+
mode?: ('solid' | 'gradient')[];
|
|
75
|
+
showBrand?: boolean;
|
|
76
|
+
showCustom?: boolean;
|
|
77
|
+
showAdvancedSettings?: boolean;
|
|
78
|
+
showOpacity?: boolean;
|
|
79
|
+
position?: {
|
|
80
|
+
x: number;
|
|
81
|
+
y: number;
|
|
82
|
+
};
|
|
83
|
+
biData?: {
|
|
84
|
+
origin: string;
|
|
85
|
+
};
|
|
86
|
+
onChange?: (color: string) => void;
|
|
87
|
+
onApply?: (color: string) => void;
|
|
88
|
+
onClose?: () => void;
|
|
89
|
+
onCancel?: () => void;
|
|
90
|
+
};
|
|
91
|
+
export type SelectTextThemeParams = {
|
|
92
|
+
target?: HTMLElement;
|
|
93
|
+
initialValue?: {
|
|
94
|
+
font?: string;
|
|
95
|
+
color?: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/public-editor-platform-interfaces",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.40.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
]
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
|
-
"falconPackageHash": "
|
|
55
|
+
"falconPackageHash": "a8c951ca90455f089a3982bab36d21f4e7525ffa07a5eb1201a8378e"
|
|
56
56
|
}
|