@contentstack/studio-registry 0.1.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/README.md +130 -0
- package/dist/cjs/index.cjs +5625 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/esm/breakpoint-registry/index.js +68 -0
- package/dist/esm/breakpoint-registry/index.js.map +1 -0
- package/dist/esm/component-registry/registry-options-processor.js +195 -0
- package/dist/esm/component-registry/registry-options-processor.js.map +1 -0
- package/dist/esm/component-registry/registry.constant.js +119 -0
- package/dist/esm/component-registry/registry.constant.js.map +1 -0
- package/dist/esm/component-registry/registry.js +245 -0
- package/dist/esm/component-registry/registry.js.map +1 -0
- package/dist/esm/data-binder/cslp.js +31 -0
- package/dist/esm/data-binder/cslp.js.map +1 -0
- package/dist/esm/data-binder/handle-binding-map.util.js +103 -0
- package/dist/esm/data-binder/handle-binding-map.util.js.map +1 -0
- package/dist/esm/data-binder/retrieve-data.js +146 -0
- package/dist/esm/data-binder/retrieve-data.js.map +1 -0
- package/dist/esm/data-binder/retrieve-data.util.js +177 -0
- package/dist/esm/data-binder/retrieve-data.util.js.map +1 -0
- package/dist/esm/design-registry/constants.js +386 -0
- package/dist/esm/design-registry/constants.js.map +1 -0
- package/dist/esm/design-registry/design-classes.js +36 -0
- package/dist/esm/design-registry/design-classes.js.map +1 -0
- package/dist/esm/design-registry/design-registry.js +87 -0
- package/dist/esm/design-registry/design-registry.js.map +1 -0
- package/dist/esm/design-registry/design-token.js +332 -0
- package/dist/esm/design-registry/design-token.js.map +1 -0
- package/dist/esm/index.d.ts +1196 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/json-rte-registry/index.js +18 -0
- package/dist/esm/json-rte-registry/index.js.map +1 -0
- package/dist/esm/utils/symbols.js +12 -0
- package/dist/esm/utils/symbols.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,1196 @@
|
|
|
1
|
+
import { NodePropType, NodePropTypes, Node, NodePropStaticValueTypes, BindableNodePropType, NodePropsWithSlot, BindingType } from '@contentstack/studio-internal';
|
|
2
|
+
import { Properties } from 'csstype';
|
|
3
|
+
import { IJsonToHtmlOptions } from '@contentstack/json-rte-serializer';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
export { RegisterBreakpointsEventPayload, UpdateBindingErrorsEventPayload } from '@contentstack/studio-message-types/latest';
|
|
6
|
+
|
|
7
|
+
type PropBase<T extends NodePropType, V> = {
|
|
8
|
+
type: T;
|
|
9
|
+
displayName?: string;
|
|
10
|
+
defaultValue?: V;
|
|
11
|
+
defaultValueHint?: string;
|
|
12
|
+
helpText?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Validates the prop value. If the value is invalid, return a string with an error message.
|
|
15
|
+
* @param currentValue - The current value of the prop.
|
|
16
|
+
*/
|
|
17
|
+
validate?: PropValidator<V>;
|
|
18
|
+
};
|
|
19
|
+
type PropValidator<V> = (currentValue: V) => boolean | string | void;
|
|
20
|
+
type StringProp = PropBase<NodePropTypes["string"], string> & {
|
|
21
|
+
/**
|
|
22
|
+
* This controls the size of the input field if you are passing the static values.
|
|
23
|
+
* @default "default"
|
|
24
|
+
*/
|
|
25
|
+
control?: "default" | "large" | "markdown";
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
};
|
|
28
|
+
type BooleanProp = PropBase<NodePropTypes["boolean"], boolean>;
|
|
29
|
+
type NumberProp = PropBase<NodePropTypes["number"], number> & {
|
|
30
|
+
control?: "default" | "slider";
|
|
31
|
+
min?: number;
|
|
32
|
+
max?: number;
|
|
33
|
+
step?: number;
|
|
34
|
+
};
|
|
35
|
+
type ArrayProp = PropBase<NodePropTypes["array"], unknown[]> & {
|
|
36
|
+
items: PropInput | {
|
|
37
|
+
type: "any";
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
type DateStringProp = PropBase<NodePropTypes["datestring"], string> & {
|
|
41
|
+
/**
|
|
42
|
+
* @default "date"
|
|
43
|
+
*/
|
|
44
|
+
control?: "date" | "datetime";
|
|
45
|
+
};
|
|
46
|
+
type HrefProp = PropBase<NodePropTypes["href"], string> & {
|
|
47
|
+
placeholder?: string;
|
|
48
|
+
};
|
|
49
|
+
type ImageUrlProp = PropBase<NodePropTypes["imageurl"], string>;
|
|
50
|
+
type ObjectProp = PropBase<NodePropTypes["object"], Record<string, unknown>> & {
|
|
51
|
+
properties: Props;
|
|
52
|
+
};
|
|
53
|
+
type SlotProp = PropBase<NodePropTypes["slot"], Node[]>;
|
|
54
|
+
type ChoiceProp = PropBase<NodePropTypes["choice"], string[]> & {
|
|
55
|
+
options: string[] | {
|
|
56
|
+
value: string | number | boolean;
|
|
57
|
+
label: string;
|
|
58
|
+
}[];
|
|
59
|
+
/**
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
multiSelect?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* If the multiSelect is false, then the control will be radio, else select field.
|
|
65
|
+
* @default "radio"
|
|
66
|
+
*/
|
|
67
|
+
control?: "radio" | "dropdown";
|
|
68
|
+
};
|
|
69
|
+
type ObjectInput = PropBase<NodePropTypes["object"], Record<string, unknown>> & {
|
|
70
|
+
properties?: unknown;
|
|
71
|
+
};
|
|
72
|
+
type AnyProp = PropBase<NodePropTypes["any"], any>;
|
|
73
|
+
type JsonRTEProp = PropBase<NodePropTypes["json_rte"], object>;
|
|
74
|
+
type PropsWithNoOptionsRequired = StringProp | BooleanProp | NumberProp | DateStringProp | HrefProp | ImageUrlProp | ObjectProp | ArrayProp | SlotProp;
|
|
75
|
+
type PropInput = StringProp | BooleanProp | NumberProp | DateStringProp | HrefProp | ImageUrlProp | ObjectProp | ArrayProp | SlotProp | ChoiceProp | AnyProp | JsonRTEProp;
|
|
76
|
+
type PropTypeOfNoOptionsRequired = PropsWithNoOptionsRequired["type"];
|
|
77
|
+
type PropType = PropInput["type"];
|
|
78
|
+
type Props = {
|
|
79
|
+
[field: string]: PropInput | PropTypeOfNoOptionsRequired;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
type DesignClassValue = string;
|
|
83
|
+
interface DesignClasses {
|
|
84
|
+
name: DesignClassValue;
|
|
85
|
+
displayName: string;
|
|
86
|
+
}
|
|
87
|
+
type DesignClassesInput = DesignClasses | DesignClassValue;
|
|
88
|
+
type ExtractNames<T> = T extends DesignClasses ? T["name"] : T extends string ? T : never;
|
|
89
|
+
type DesignClassesNames<T extends DesignClassesInput[]> = {
|
|
90
|
+
[K in ExtractNames<T[number]>]: K;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
declare const DATA_SOURCES_PREFIX = "dataSources";
|
|
94
|
+
declare const DATA_SOURCES: {
|
|
95
|
+
readonly COMPONENT_PROPS: "component_props";
|
|
96
|
+
readonly STATIC_VALUE: "static_value";
|
|
97
|
+
readonly TEMPLATE: "template";
|
|
98
|
+
readonly CONTENTSTACK: "contentstack";
|
|
99
|
+
readonly REPEATER: "repeater";
|
|
100
|
+
readonly SYMBOL_PROPS: "symbol_props";
|
|
101
|
+
};
|
|
102
|
+
declare const INTERNAL_COMPONENT_SECTIONS: {
|
|
103
|
+
readonly BASIC: "Basic";
|
|
104
|
+
readonly MEDIA: "Media";
|
|
105
|
+
readonly CONTAINER: "Container";
|
|
106
|
+
readonly SMART_CONTAINER: "Smart Containers";
|
|
107
|
+
readonly ADVANCED: "Advanced";
|
|
108
|
+
readonly REGISTERED_COMPONENTS: "Registered Components";
|
|
109
|
+
readonly HTML_ELEMENT: "HTML Elements";
|
|
110
|
+
readonly SYMBOL: "Symbols";
|
|
111
|
+
};
|
|
112
|
+
declare const INTERNAL_SECTIONS: ("Basic" | "Media" | "Container" | "Smart Containers" | "Advanced" | "Registered Components" | "HTML Elements" | "Symbols")[];
|
|
113
|
+
declare const STYLE_SECTIONS_OPTIONS: readonly ["class", "size", "spacing", "position", "visibility", "layout", "typography", "transform", "media", "background", "shadow", "effect", "overflow", "border", "responsive"];
|
|
114
|
+
/**
|
|
115
|
+
* The style group is the group of the style sections options.
|
|
116
|
+
* When a style group is selected, all the styles
|
|
117
|
+
* corresponding to it will be extracted from the
|
|
118
|
+
*/
|
|
119
|
+
declare const STYLE_SECTION_CATEGORIES: {
|
|
120
|
+
readonly block: ["class", "size", "spacing", "position", "visibility", "layout", "background", "shadow", "effect", "overflow", "border", "responsive"];
|
|
121
|
+
readonly text: ["typography"];
|
|
122
|
+
};
|
|
123
|
+
declare const INTERNAL_COMPONENTS_NAMES: {
|
|
124
|
+
readonly PAGE: "page";
|
|
125
|
+
readonly HEADER: "header";
|
|
126
|
+
readonly LINK: "link";
|
|
127
|
+
readonly LINK_CONTAINER: "link-container";
|
|
128
|
+
readonly TEXT: "text";
|
|
129
|
+
readonly BUTTON: "button";
|
|
130
|
+
readonly JSON_RTE: "json-rte";
|
|
131
|
+
readonly COLLAPSIBLE_TEXT: "collapsible-text";
|
|
132
|
+
readonly PLAIN_TEXT: "plain-text";
|
|
133
|
+
readonly VIDEO: "video";
|
|
134
|
+
readonly EMBED: "embed";
|
|
135
|
+
readonly IMAGE: "image";
|
|
136
|
+
readonly SECTION: "section";
|
|
137
|
+
readonly BOX: "box";
|
|
138
|
+
readonly COLUMNS: "hstack";
|
|
139
|
+
readonly ROWS: "vstack";
|
|
140
|
+
readonly REPEATER: "repeater";
|
|
141
|
+
readonly CONDITION_BLOCK: "condition-block";
|
|
142
|
+
readonly SYMBOL: "symbol";
|
|
143
|
+
readonly FRAGMENT: "fragment";
|
|
144
|
+
readonly HTML_ELEMENT: "html-element";
|
|
145
|
+
readonly STYLE_SHEET: "style-sheet";
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* System components are protected components that are not intended to be modified or removed.
|
|
149
|
+
*/
|
|
150
|
+
declare const SYSTEM_COMPONENTS: Set<string>;
|
|
151
|
+
/**
|
|
152
|
+
* Built-in components are components that are included in the component registry by default.
|
|
153
|
+
* User can opt-out of including these components in the registry by setting the
|
|
154
|
+
* `includeBuiltInComponents` option to `false`.
|
|
155
|
+
*/
|
|
156
|
+
declare const BUILT_IN_COMPONENTS: {
|
|
157
|
+
readonly HEADER: "header";
|
|
158
|
+
readonly LINK: "link";
|
|
159
|
+
readonly LINK_CONTAINER: "link-container";
|
|
160
|
+
readonly TEXT: "text";
|
|
161
|
+
readonly BUTTON: "button";
|
|
162
|
+
readonly JSON_RTE: "json-rte";
|
|
163
|
+
readonly COLLAPSIBLE_TEXT: "collapsible-text";
|
|
164
|
+
readonly VIDEO: "video";
|
|
165
|
+
readonly EMBED: "embed";
|
|
166
|
+
readonly IMAGE: "image";
|
|
167
|
+
readonly SECTION: "section";
|
|
168
|
+
readonly BOX: "box";
|
|
169
|
+
readonly COLUMNS: "hstack";
|
|
170
|
+
readonly ROWS: "vstack";
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
type ComponentType = string;
|
|
174
|
+
interface RegisterComponentSchemaInput<C = unknown> {
|
|
175
|
+
/**
|
|
176
|
+
* The unique type identifier for the component.
|
|
177
|
+
* Used internally to distinguish between different component types.
|
|
178
|
+
*/
|
|
179
|
+
type: ComponentType;
|
|
180
|
+
component: C;
|
|
181
|
+
props?: Props;
|
|
182
|
+
/**
|
|
183
|
+
* Controls whether the component should be wrapped in a div or not.
|
|
184
|
+
* You must pass the `StudioAttributes` to your component to
|
|
185
|
+
* handle the editing of the component in the builder.
|
|
186
|
+
*
|
|
187
|
+
* If you pass a string, the component will be wrapped in the tag.
|
|
188
|
+
*
|
|
189
|
+
* @default false
|
|
190
|
+
*/
|
|
191
|
+
wrap?: boolean | string;
|
|
192
|
+
/**
|
|
193
|
+
* The name to be displayed for the component. Optional: if not
|
|
194
|
+
* specified, `options.name` is used.
|
|
195
|
+
*/
|
|
196
|
+
displayName?: string;
|
|
197
|
+
/**
|
|
198
|
+
* The description of the component to be shown.
|
|
199
|
+
*/
|
|
200
|
+
description?: string;
|
|
201
|
+
/**
|
|
202
|
+
* Controls which section to display the component in the Left Panel.
|
|
203
|
+
*/
|
|
204
|
+
sections?: string[] | string;
|
|
205
|
+
/**
|
|
206
|
+
* A link to an image that will be displayed as a thumbnail of the component, if the component has a `section` specified.
|
|
207
|
+
*/
|
|
208
|
+
thumbnailUrl?: string;
|
|
209
|
+
/**
|
|
210
|
+
* Controls what styles will be provided to the component.
|
|
211
|
+
* The styles will be available under the key you define.
|
|
212
|
+
* If you set the values against the `default` key, it will be
|
|
213
|
+
* passed to the default component prop.
|
|
214
|
+
* TODO: add a document link to explain the previous statement.
|
|
215
|
+
*/
|
|
216
|
+
styles?: {
|
|
217
|
+
[section: string]: StyleGroupOptions;
|
|
218
|
+
};
|
|
219
|
+
hideFromContentCreators?: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Controls whether the component should be hidden from the component list.
|
|
222
|
+
* @default false
|
|
223
|
+
*/
|
|
224
|
+
hideFromComponentList?: boolean;
|
|
225
|
+
icon?: string;
|
|
226
|
+
/**
|
|
227
|
+
* This can be used to store extra metadata for components. For eg for symbols we can store uid here.
|
|
228
|
+
*/
|
|
229
|
+
metadata?: Record<string, unknown>;
|
|
230
|
+
}
|
|
231
|
+
interface RegisterComponentSchema<C> extends Required<Omit<RegisterComponentSchemaInput<C>, "props">> {
|
|
232
|
+
registry: Registry;
|
|
233
|
+
sections: string[];
|
|
234
|
+
styles: {
|
|
235
|
+
[styleGroup: string]: Required<StyleGroupOptions>;
|
|
236
|
+
};
|
|
237
|
+
props: {
|
|
238
|
+
[key: string]: PropInput;
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
type Registry = "internal" | "user-defined" | "symbols";
|
|
242
|
+
type RegisterComponentOptionsInput<C = unknown> = Omit<RegisterComponentSchemaInput<C>, "icon">;
|
|
243
|
+
type RegisterInternalComponentOptionsInput<C = unknown> = RegisterComponentSchemaInput<C>;
|
|
244
|
+
type InternalComponentRegistryOptions = {
|
|
245
|
+
overrideComponents?: boolean;
|
|
246
|
+
};
|
|
247
|
+
type StyleSectionOptions = (typeof STYLE_SECTIONS_OPTIONS)[number];
|
|
248
|
+
type StyleSectionCategoriesOptions = keyof typeof STYLE_SECTION_CATEGORIES;
|
|
249
|
+
type StyleSections = (StyleSectionOptions | StyleSectionCategoriesOptions)[] | "all" | "none";
|
|
250
|
+
interface StyleGroupOptions {
|
|
251
|
+
/**
|
|
252
|
+
* The classes will be sent to the component.
|
|
253
|
+
*/
|
|
254
|
+
defaultClasses?: DesignClassValue[];
|
|
255
|
+
/**
|
|
256
|
+
*
|
|
257
|
+
*/
|
|
258
|
+
defaultStyles?: Properties;
|
|
259
|
+
/**
|
|
260
|
+
* Controls which style sections to display in the Style Panel.
|
|
261
|
+
* If not specified, all the style sections will be displayed.
|
|
262
|
+
* @default "all"
|
|
263
|
+
*/
|
|
264
|
+
styleSections?: StyleSections;
|
|
265
|
+
displayName?: string;
|
|
266
|
+
}
|
|
267
|
+
type CSBindingPath = {
|
|
268
|
+
[path: string]: CSBindingPath;
|
|
269
|
+
};
|
|
270
|
+
type TemplateBindingValue = {
|
|
271
|
+
path: CSBindingPath;
|
|
272
|
+
};
|
|
273
|
+
type RepeaterBindingValue = {
|
|
274
|
+
repeaterUID: string;
|
|
275
|
+
path: CSBindingPath;
|
|
276
|
+
};
|
|
277
|
+
type ContentstackBindingValue = {
|
|
278
|
+
uid: string;
|
|
279
|
+
_content_type_uid: string;
|
|
280
|
+
} & TemplateBindingValue;
|
|
281
|
+
|
|
282
|
+
type BuiltInComponentValue = (typeof BUILT_IN_COMPONENTS)[keyof typeof BUILT_IN_COMPONENTS];
|
|
283
|
+
interface ComponentRegistryOptions {
|
|
284
|
+
allowedBuiltInComponents?: boolean | BuiltInComponentValue[];
|
|
285
|
+
overrideDefaultComponents?: boolean;
|
|
286
|
+
debug?: boolean;
|
|
287
|
+
}
|
|
288
|
+
declare class ComponentRegistry<C> {
|
|
289
|
+
private componentRegistry;
|
|
290
|
+
private propValidatorRegistry;
|
|
291
|
+
private config;
|
|
292
|
+
constructor(config?: ComponentRegistryOptions);
|
|
293
|
+
setConfig(config?: Partial<ComponentRegistryOptions>): void;
|
|
294
|
+
/**
|
|
295
|
+
* Updates the component registry with the provided configuration.
|
|
296
|
+
* This method is **UNSAFE** and should be used if the updated config is
|
|
297
|
+
* already processed.
|
|
298
|
+
* @param updatedConfig - An array of component configurations to update the registry with.
|
|
299
|
+
*/
|
|
300
|
+
updateRegistry(updatedConfig: RegisterComponentSchema<C>[]): void;
|
|
301
|
+
/**
|
|
302
|
+
* This acts like PATCH for the component registry.
|
|
303
|
+
* @param components - An array of component configurations to update the registry with.
|
|
304
|
+
*/
|
|
305
|
+
updateComponents(components: Partial<RegisterComponentSchema<C>>[]): void;
|
|
306
|
+
/**
|
|
307
|
+
* Registers internal components with the component registry.
|
|
308
|
+
*
|
|
309
|
+
* @param componentConfigs - An array of component configurations to register.
|
|
310
|
+
* @throws {Error} If a component name is missing.
|
|
311
|
+
*/
|
|
312
|
+
registerInternalComponent(componentConfigs: RegisterInternalComponentOptionsInput<C>[], options?: InternalComponentRegistryOptions): void;
|
|
313
|
+
/**
|
|
314
|
+
* Registers list of symbol components in the component registry
|
|
315
|
+
* @param componentsConfigs
|
|
316
|
+
*/
|
|
317
|
+
registerSymbolComponent(componentsConfigs: RegisterInternalComponentOptionsInput<C>[]): void;
|
|
318
|
+
/**
|
|
319
|
+
* Registers one or more components in the component registry.
|
|
320
|
+
* @param components - An array of component options to register.
|
|
321
|
+
*/
|
|
322
|
+
registerComponents(components: RegisterComponentOptionsInput<C>[]): void;
|
|
323
|
+
/**
|
|
324
|
+
* Retrieves an array of component registry values.
|
|
325
|
+
*
|
|
326
|
+
* @param options - An optional object containing the registry option.
|
|
327
|
+
* @returns An array of component registry values.
|
|
328
|
+
*/
|
|
329
|
+
getComponents(options?: {
|
|
330
|
+
registry?: RegisterComponentSchema<C>["registry"];
|
|
331
|
+
/**
|
|
332
|
+
* Whether to include system components in the result.
|
|
333
|
+
* @default false
|
|
334
|
+
*/
|
|
335
|
+
excludeSystemComponents?: boolean;
|
|
336
|
+
}): RegisterComponentSchema<C>[];
|
|
337
|
+
/**
|
|
338
|
+
* Retrieves a component from the component registry by its name.
|
|
339
|
+
*
|
|
340
|
+
* @param name - The name of the component to retrieve.
|
|
341
|
+
* @returns The component registry value for the specified component name.
|
|
342
|
+
* @throws Error if the component with the specified name is not registered.
|
|
343
|
+
*/
|
|
344
|
+
getComponent(name: string): RegisterComponentSchema<C>;
|
|
345
|
+
/**
|
|
346
|
+
* Retrieves a component from the component registry by its name.
|
|
347
|
+
*
|
|
348
|
+
* @param node - The node of the component to retrieve.
|
|
349
|
+
* @returns The component registry value for the specified component name.
|
|
350
|
+
* @throws Error if the component with the specified name is not registered.
|
|
351
|
+
*/
|
|
352
|
+
getComponentByNode(node: Node, suppressError?: boolean): RegisterComponentSchema<C> | undefined;
|
|
353
|
+
hasComponent(node: Node): boolean;
|
|
354
|
+
unregisterComponent(node: Node | string): void;
|
|
355
|
+
validateProp<V>(componentName: string, propName: string, value: V): ReturnType<PropValidator<V>>;
|
|
356
|
+
getComponentName(node: Node): string;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
type DesignTokensInput = Partial<SectionDesignTokens> & Partial<GlobalDesignTokens>;
|
|
360
|
+
type DesignTokensInputKeys = keyof DesignTokensInput;
|
|
361
|
+
type GlobalDesignTokens = {
|
|
362
|
+
colorTokens: Record<string, string>;
|
|
363
|
+
spaceTokens: Record<string, LengthToken>;
|
|
364
|
+
};
|
|
365
|
+
type PreProcessedDesignTokenInput = Omit<DesignTokensInput, "shadow" | "background"> & {
|
|
366
|
+
shadow?: Omit<DesignTokensInput["shadow"], "style"> & Partial<{
|
|
367
|
+
style: Record<string, string>;
|
|
368
|
+
}>;
|
|
369
|
+
background?: Omit<DesignTokensInput["background"], "style"> & Partial<{
|
|
370
|
+
style: Record<string, string>;
|
|
371
|
+
}>;
|
|
372
|
+
};
|
|
373
|
+
interface SectionDesignTokens {
|
|
374
|
+
size: Partial<{
|
|
375
|
+
tokens: Record<string, LengthToken>;
|
|
376
|
+
width: Record<string, LengthToken>;
|
|
377
|
+
height: Record<string, LengthToken>;
|
|
378
|
+
minWidth: Record<string, LengthToken>;
|
|
379
|
+
minHeight: Record<string, LengthToken>;
|
|
380
|
+
maxWidth: Record<string, LengthToken>;
|
|
381
|
+
maxHeight: Record<string, LengthToken>;
|
|
382
|
+
}>;
|
|
383
|
+
spacing: Partial<{
|
|
384
|
+
tokens: Record<string, LengthToken>;
|
|
385
|
+
margin: Record<string, LengthToken>;
|
|
386
|
+
padding: Record<string, LengthToken>;
|
|
387
|
+
style: Record<string, Partial<{
|
|
388
|
+
margin: LengthToken;
|
|
389
|
+
padding: LengthToken;
|
|
390
|
+
}>>;
|
|
391
|
+
}>;
|
|
392
|
+
position: Partial<{
|
|
393
|
+
zIndex: Record<string, string>;
|
|
394
|
+
position: Record<string, string>;
|
|
395
|
+
}>;
|
|
396
|
+
visibility: Partial<{
|
|
397
|
+
opacity: Record<string, `${number}%`>;
|
|
398
|
+
}>;
|
|
399
|
+
layout: Partial<{
|
|
400
|
+
gap: Record<string, LengthToken>;
|
|
401
|
+
}>;
|
|
402
|
+
typography: Partial<{
|
|
403
|
+
color: Record<string, string>;
|
|
404
|
+
fontWeight: Record<string, number>;
|
|
405
|
+
fontSize: Record<string, string>;
|
|
406
|
+
lineHeight: Record<string, number | LengthToken>;
|
|
407
|
+
letterSpacing: Record<string, LengthToken>;
|
|
408
|
+
style: Record<string, Partial<{
|
|
409
|
+
fontFamily: string;
|
|
410
|
+
fontWeight: string;
|
|
411
|
+
fontSize: LengthToken;
|
|
412
|
+
lineHeight: number | LengthToken;
|
|
413
|
+
letterSpacing: LengthToken;
|
|
414
|
+
}>>;
|
|
415
|
+
}>;
|
|
416
|
+
background: Partial<{
|
|
417
|
+
color: Record<string, string>;
|
|
418
|
+
style: Record<string, {
|
|
419
|
+
type: "solid-color";
|
|
420
|
+
color: string;
|
|
421
|
+
} | {
|
|
422
|
+
type: "linear-gradient";
|
|
423
|
+
angle?: number;
|
|
424
|
+
stops: string[];
|
|
425
|
+
} | {
|
|
426
|
+
type: "radial-gradient";
|
|
427
|
+
position: string;
|
|
428
|
+
stops: string[];
|
|
429
|
+
} | {
|
|
430
|
+
type: "image";
|
|
431
|
+
url: string;
|
|
432
|
+
size: "cover" | "contain" | "fill" | "auto";
|
|
433
|
+
repeat: "no-repeat" | "repeat" | "repeat-x" | "repeat-y";
|
|
434
|
+
align: "center" | "top" | "bottom" | "left" | "right";
|
|
435
|
+
}>;
|
|
436
|
+
}>;
|
|
437
|
+
shadow: Partial<{
|
|
438
|
+
color: Record<string, string>;
|
|
439
|
+
style: Record<string, {
|
|
440
|
+
inset?: boolean;
|
|
441
|
+
x: LengthToken;
|
|
442
|
+
y: LengthToken;
|
|
443
|
+
blur?: LengthToken;
|
|
444
|
+
spread?: LengthToken;
|
|
445
|
+
color?: string;
|
|
446
|
+
}>;
|
|
447
|
+
}>;
|
|
448
|
+
effects: Partial<{
|
|
449
|
+
filter: Record<string, string>;
|
|
450
|
+
}>;
|
|
451
|
+
border: Partial<{
|
|
452
|
+
color: Record<string, string>;
|
|
453
|
+
radius: Record<string, LengthToken>;
|
|
454
|
+
style: Record<string, Partial<{
|
|
455
|
+
style: "solid" | "dashed" | "dotted";
|
|
456
|
+
width: LengthToken;
|
|
457
|
+
color: string;
|
|
458
|
+
radius: LengthToken | Partial<{
|
|
459
|
+
topLeft: LengthToken;
|
|
460
|
+
topRight: LengthToken;
|
|
461
|
+
bottomRight: LengthToken;
|
|
462
|
+
bottomLeft: LengthToken;
|
|
463
|
+
}>;
|
|
464
|
+
}>>;
|
|
465
|
+
}>;
|
|
466
|
+
transform: Partial<{
|
|
467
|
+
style: Record<string, Partial<{
|
|
468
|
+
translateX: LengthToken;
|
|
469
|
+
translateY: LengthToken;
|
|
470
|
+
translateZ: LengthToken;
|
|
471
|
+
rotateX: string;
|
|
472
|
+
rotateY: string;
|
|
473
|
+
rotateZ: string;
|
|
474
|
+
scaleX: string;
|
|
475
|
+
scaleY: string;
|
|
476
|
+
scaleZ: string;
|
|
477
|
+
skewX: string;
|
|
478
|
+
skewY: string;
|
|
479
|
+
}>>;
|
|
480
|
+
}>;
|
|
481
|
+
overflow: Partial<{
|
|
482
|
+
style: Record<string, OverflowTokens | Partial<{
|
|
483
|
+
x: OverflowTokens;
|
|
484
|
+
y: OverflowTokens;
|
|
485
|
+
}>>;
|
|
486
|
+
}>;
|
|
487
|
+
}
|
|
488
|
+
type DesignTokenCssVariable = `var(--token-${string})`;
|
|
489
|
+
interface CssVariablesToValue {
|
|
490
|
+
[cssVariable: string]: any;
|
|
491
|
+
}
|
|
492
|
+
interface CssVariablesToDesignTokens {
|
|
493
|
+
[cssVariable: string]: {
|
|
494
|
+
fieldName: string;
|
|
495
|
+
type: "preset" | "token";
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
interface DesignTokens<T extends DesignTokensInput = Record<string, any>> {
|
|
499
|
+
size: {
|
|
500
|
+
width: ExtractDesignTokenNames<DeepNonNullable<T>["size"]["tokens"], DesignTokenCssVariable> & ExtractDesignTokenNames<DeepNonNullable<T>["size"]["width"], DesignTokenCssVariable>;
|
|
501
|
+
height: ExtractDesignTokenNames<DeepNonNullable<T>["size"]["tokens"], DesignTokenCssVariable> & ExtractDesignTokenNames<DeepNonNullable<T>["size"]["height"], DesignTokenCssVariable>;
|
|
502
|
+
minWidth: ExtractDesignTokenNames<DeepNonNullable<T>["size"]["tokens"], DesignTokenCssVariable> & ExtractDesignTokenNames<DeepNonNullable<T>["size"]["minWidth"], DesignTokenCssVariable>;
|
|
503
|
+
minHeight: ExtractDesignTokenNames<DeepNonNullable<T>["size"]["tokens"], DesignTokenCssVariable> & ExtractDesignTokenNames<DeepNonNullable<T>["size"]["minHeight"], DesignTokenCssVariable>;
|
|
504
|
+
maxWidth: ExtractDesignTokenNames<DeepNonNullable<T>["size"]["tokens"], DesignTokenCssVariable> & ExtractDesignTokenNames<DeepNonNullable<T>["size"]["maxWidth"], DesignTokenCssVariable>;
|
|
505
|
+
maxHeight: ExtractDesignTokenNames<DeepNonNullable<T>["size"]["tokens"], DesignTokenCssVariable> & ExtractDesignTokenNames<DeepNonNullable<T>["size"]["maxHeight"], DesignTokenCssVariable>;
|
|
506
|
+
};
|
|
507
|
+
spacing: {
|
|
508
|
+
margin: ExtractDesignTokenNames<DeepNonNullable<T>["spaceTokens"], DesignTokenCssVariable> & ExtractDesignTokenNames<DeepNonNullable<T>["spacing"]["tokens"], DesignTokenCssVariable> & ExtractDesignTokenNames<DeepNonNullable<T>["spacing"]["margin"], DesignTokenCssVariable>;
|
|
509
|
+
padding: ExtractDesignTokenNames<DeepNonNullable<T>["spaceTokens"], DesignTokenCssVariable> & ExtractDesignTokenNames<DeepNonNullable<T>["spacing"]["tokens"], DesignTokenCssVariable> & ExtractDesignTokenNames<DeepNonNullable<T>["spacing"]["padding"], DesignTokenCssVariable>;
|
|
510
|
+
style: ExtractDesignTokenNames<DeepNonNullable<T>["spacing"]["style"], Partial<{
|
|
511
|
+
margin: DesignTokenCssVariable;
|
|
512
|
+
padding: DesignTokenCssVariable;
|
|
513
|
+
}>>;
|
|
514
|
+
};
|
|
515
|
+
position: {
|
|
516
|
+
zIndex: ExtractDesignTokenNames<DeepNonNullable<T>["position"]["zIndex"], DesignTokenCssVariable>;
|
|
517
|
+
position: ExtractDesignTokenNames<DeepNonNullable<T>["position"]["position"], DesignTokenCssVariable>;
|
|
518
|
+
};
|
|
519
|
+
visibility: {
|
|
520
|
+
opacity: ExtractDesignTokenNames<DeepNonNullable<T>["visibility"]["opacity"], DesignTokenCssVariable>;
|
|
521
|
+
};
|
|
522
|
+
layout: {
|
|
523
|
+
gap: ExtractDesignTokenNames<DeepNonNullable<T>["spaceTokens"], DesignTokenCssVariable> & ExtractDesignTokenNames<DeepNonNullable<T>["layout"]["gap"], DesignTokenCssVariable>;
|
|
524
|
+
};
|
|
525
|
+
typography: {
|
|
526
|
+
color: ExtractDesignTokenNames<DeepNonNullable<T>["colorTokens"], DesignTokenCssVariable> & ExtractDesignTokenNames<DeepNonNullable<T>["typography"]["color"], DesignTokenCssVariable>;
|
|
527
|
+
fontWeight: ExtractDesignTokenNames<DeepNonNullable<T>["typography"]["fontWeight"], DesignTokenCssVariable>;
|
|
528
|
+
fontSize: ExtractDesignTokenNames<DeepNonNullable<T>["typography"]["fontSize"], DesignTokenCssVariable>;
|
|
529
|
+
lineHeight: ExtractDesignTokenNames<DeepNonNullable<T>["typography"]["lineHeight"], DesignTokenCssVariable>;
|
|
530
|
+
letterSpacing: ExtractDesignTokenNames<DeepNonNullable<T>["typography"]["letterSpacing"], DesignTokenCssVariable>;
|
|
531
|
+
style: ExtractDesignTokenNames<DeepNonNullable<T>["typography"]["style"], Partial<{
|
|
532
|
+
fontFamily: DesignTokenCssVariable;
|
|
533
|
+
fontWeight: DesignTokenCssVariable;
|
|
534
|
+
fontSize: DesignTokenCssVariable;
|
|
535
|
+
lineHeight: DesignTokenCssVariable;
|
|
536
|
+
letterSpacing: DesignTokenCssVariable;
|
|
537
|
+
}>>;
|
|
538
|
+
};
|
|
539
|
+
background: {
|
|
540
|
+
color: ExtractDesignTokenNames<DeepNonNullable<T>["colorTokens"], DesignTokenCssVariable> & ExtractDesignTokenNames<DeepNonNullable<T>["background"]["color"], DesignTokenCssVariable>;
|
|
541
|
+
style: ExtractDesignTokenNames<DeepNonNullable<T>["background"]["style"], DesignTokenCssVariable>;
|
|
542
|
+
};
|
|
543
|
+
shadow: {
|
|
544
|
+
color: ExtractDesignTokenNames<DeepNonNullable<T>["colorTokens"], DesignTokenCssVariable> & ExtractDesignTokenNames<DeepNonNullable<T>["shadow"]["color"], DesignTokenCssVariable>;
|
|
545
|
+
style: ExtractDesignTokenNames<DeepNonNullable<T>["shadow"]["style"], DesignTokenCssVariable>;
|
|
546
|
+
};
|
|
547
|
+
effects: {
|
|
548
|
+
filter: ExtractDesignTokenNames<DeepNonNullable<T>["effects"]["filter"], DesignTokenCssVariable>;
|
|
549
|
+
};
|
|
550
|
+
border: {
|
|
551
|
+
color: ExtractDesignTokenNames<DeepNonNullable<T>["colorTokens"], DesignTokenCssVariable> & ExtractDesignTokenNames<DeepNonNullable<T>["border"]["color"], DesignTokenCssVariable>;
|
|
552
|
+
radius: ExtractDesignTokenNames<DeepNonNullable<T>["border"]["radius"], DesignTokenCssVariable>;
|
|
553
|
+
style: ExtractDesignTokenNames<DeepNonNullable<T>["border"]["style"], Partial<{
|
|
554
|
+
style: DesignTokenCssVariable;
|
|
555
|
+
width: DesignTokenCssVariable;
|
|
556
|
+
color: DesignTokenCssVariable;
|
|
557
|
+
radius: DesignTokenCssVariable;
|
|
558
|
+
}>>;
|
|
559
|
+
};
|
|
560
|
+
transform: {
|
|
561
|
+
style: ExtractDesignTokenNames<DeepNonNullable<T>["transform"]["style"], Partial<{
|
|
562
|
+
translateX: DesignTokenCssVariable;
|
|
563
|
+
translateY: DesignTokenCssVariable;
|
|
564
|
+
translateZ: DesignTokenCssVariable;
|
|
565
|
+
rotateX: DesignTokenCssVariable;
|
|
566
|
+
rotateY: DesignTokenCssVariable;
|
|
567
|
+
rotateZ: DesignTokenCssVariable;
|
|
568
|
+
scaleX: DesignTokenCssVariable;
|
|
569
|
+
scaleY: DesignTokenCssVariable;
|
|
570
|
+
scaleZ: DesignTokenCssVariable;
|
|
571
|
+
skewX: DesignTokenCssVariable;
|
|
572
|
+
skewY: DesignTokenCssVariable;
|
|
573
|
+
}>>;
|
|
574
|
+
};
|
|
575
|
+
overflow: {
|
|
576
|
+
style: ExtractDesignTokenNames<DeepNonNullable<T>["overflow"]["style"], DesignTokenCssVariable>;
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
type OverflowTokens = "visible" | "hidden" | "scroll" | "auto" | "clip";
|
|
580
|
+
type LengthToken = `${number}${CssLengthUnit}`;
|
|
581
|
+
type CssLengthUnit = "cm" | "mm" | "Q" | "in" | "pc" | "pt" | "px" | "em" | "ex" | "ch" | "rem" | "lh" | "vw" | "vh" | "%" | "vmin" | "vmax";
|
|
582
|
+
interface DesignTokensOptions {
|
|
583
|
+
allowDefaultDesignTokens: boolean;
|
|
584
|
+
/**
|
|
585
|
+
* The level determines which values are allowed in the design tokens.
|
|
586
|
+
* For example,
|
|
587
|
+
* if it is set to "dynamic", only data can be linked,
|
|
588
|
+
* if it is set to "tokens", data and tokens can be linked,
|
|
589
|
+
* if it is set to "arbitrary", any value can be linked and the user can enter any value.
|
|
590
|
+
*/
|
|
591
|
+
allowedValuesLevel: AllowedDesignValuesLevel;
|
|
592
|
+
}
|
|
593
|
+
interface DesignTokensOptionsInput {
|
|
594
|
+
allowDefaultDesignTokens?: boolean;
|
|
595
|
+
allowedValuesLevel?: AllowedDesignValues;
|
|
596
|
+
}
|
|
597
|
+
type AllowedDesignValues = "tokens" | "dynamic" | "arbitrary";
|
|
598
|
+
type AllowedDesignValuesLevel = number;
|
|
599
|
+
type ExtractDesignTokenNames<T extends Record<string, any> | undefined, V> = {
|
|
600
|
+
[K in keyof T]: V;
|
|
601
|
+
};
|
|
602
|
+
type DeepNonNullable<T> = {
|
|
603
|
+
[K in keyof T]: T[K] extends Record<string, any> ? DeepNonNullable<T[K]> : NonNullable<T[K]>;
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
declare class DesignRegistry {
|
|
607
|
+
private classes;
|
|
608
|
+
private tokens;
|
|
609
|
+
private cssVariables;
|
|
610
|
+
private options;
|
|
611
|
+
cssVariablesToDesignTokens: CssVariablesToDesignTokens;
|
|
612
|
+
registerDesignTokens(tokens: DesignTokensInput, options?: Partial<DesignTokensOptionsInput>): void;
|
|
613
|
+
getDesignTokens(): DesignTokens;
|
|
614
|
+
getDesignTokenOptions(): DesignTokensOptions;
|
|
615
|
+
getDesignTokenCssVariables(): CssVariablesToValue;
|
|
616
|
+
getCssVariablesToDesignTokens(): CssVariablesToDesignTokens;
|
|
617
|
+
/**
|
|
618
|
+
* If the design tokens are already processed, we can use this method to update the design tokens
|
|
619
|
+
* without processing them again.
|
|
620
|
+
* @param tokens The processed design tokens
|
|
621
|
+
*/
|
|
622
|
+
updateDesignTokens(tokens: DesignTokens, cssVariablesToDesignTokens: CssVariablesToDesignTokens, options: DesignTokensOptions): void;
|
|
623
|
+
clearDesignTokens(): void;
|
|
624
|
+
registerClasses<C extends DesignClassesInput[]>(classes: C): DesignClassesNames<C>;
|
|
625
|
+
getClasses(): DesignClasses[];
|
|
626
|
+
getClass(name: string): DesignClasses | undefined;
|
|
627
|
+
hasClass(name: string): boolean;
|
|
628
|
+
isDesignTokenCssVariable(value: string): value is DesignTokenCssVariable;
|
|
629
|
+
isValueCssVariable(value: string): boolean;
|
|
630
|
+
/**
|
|
631
|
+
* If the design classes are already processed, we can use this method to update the design classes
|
|
632
|
+
* without processing them again.
|
|
633
|
+
* @param classes The processed design classes
|
|
634
|
+
*/
|
|
635
|
+
updateClasses(classes: DesignClasses[]): void;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
declare function getDesignClassesNames<C extends DesignClassesInput[]>(classes: C): DesignClassesNames<C>;
|
|
639
|
+
|
|
640
|
+
declare const DEFAULT_DESIGN_TOKENS: {
|
|
641
|
+
readonly colorTokens: {
|
|
642
|
+
readonly "color-dark": "#000000";
|
|
643
|
+
readonly "color-primary": "#6c5ce7";
|
|
644
|
+
readonly "color-white": "#ffffff";
|
|
645
|
+
readonly "color-secondary": "#475161";
|
|
646
|
+
};
|
|
647
|
+
readonly size: {
|
|
648
|
+
readonly width: Record<string, `${number}cm` | `${number}mm` | `${number}Q` | `${number}in` | `${number}pc` | `${number}pt` | `${number}px` | `${number}em` | `${number}ex` | `${number}ch` | `${number}rem` | `${number}lh` | `${number}vw` | `${number}vh` | `${number}%` | `${number}vmin` | `${number}vmax`>;
|
|
649
|
+
readonly height: Record<string, `${number}cm` | `${number}mm` | `${number}Q` | `${number}in` | `${number}pc` | `${number}pt` | `${number}px` | `${number}em` | `${number}ex` | `${number}ch` | `${number}rem` | `${number}lh` | `${number}vw` | `${number}vh` | `${number}%` | `${number}vmin` | `${number}vmax`>;
|
|
650
|
+
readonly minWidth: Record<string, `${number}cm` | `${number}mm` | `${number}Q` | `${number}in` | `${number}pc` | `${number}pt` | `${number}px` | `${number}em` | `${number}ex` | `${number}ch` | `${number}rem` | `${number}lh` | `${number}vw` | `${number}vh` | `${number}%` | `${number}vmin` | `${number}vmax`>;
|
|
651
|
+
readonly minHeight: Record<string, `${number}cm` | `${number}mm` | `${number}Q` | `${number}in` | `${number}pc` | `${number}pt` | `${number}px` | `${number}em` | `${number}ex` | `${number}ch` | `${number}rem` | `${number}lh` | `${number}vw` | `${number}vh` | `${number}%` | `${number}vmin` | `${number}vmax`>;
|
|
652
|
+
readonly maxWidth: Record<string, `${number}cm` | `${number}mm` | `${number}Q` | `${number}in` | `${number}pc` | `${number}pt` | `${number}px` | `${number}em` | `${number}ex` | `${number}ch` | `${number}rem` | `${number}lh` | `${number}vw` | `${number}vh` | `${number}%` | `${number}vmin` | `${number}vmax`>;
|
|
653
|
+
};
|
|
654
|
+
readonly layout: {
|
|
655
|
+
readonly gap: {
|
|
656
|
+
readonly "gap-2": "0.125rem";
|
|
657
|
+
readonly "gap-4": "0.25rem";
|
|
658
|
+
readonly "gap-5": "0.3125rem";
|
|
659
|
+
readonly "gap-6": "0.375rem";
|
|
660
|
+
readonly "gap-8": "0.5rem";
|
|
661
|
+
readonly "gap-10": "0.625rem";
|
|
662
|
+
readonly "gap-12": "0.75rem";
|
|
663
|
+
readonly "gap-14": "0.875rem";
|
|
664
|
+
readonly "gap-15": "0.9375rem";
|
|
665
|
+
readonly "gap-16": "1rem";
|
|
666
|
+
};
|
|
667
|
+
};
|
|
668
|
+
readonly typography: {
|
|
669
|
+
readonly fontSize: {
|
|
670
|
+
readonly "font-size-sm": "0.75rem";
|
|
671
|
+
readonly "font-size-md": "0.875rem";
|
|
672
|
+
readonly "font-size-base": "1rem";
|
|
673
|
+
readonly "font-size-lg": "1.25rem";
|
|
674
|
+
readonly "font-size-xl": "1.75rem";
|
|
675
|
+
readonly "font-size-2xl": "2.125rem";
|
|
676
|
+
};
|
|
677
|
+
readonly fontWeight: {
|
|
678
|
+
readonly "font-regular": 400;
|
|
679
|
+
readonly "font-medium": 500;
|
|
680
|
+
readonly "font-semi-bold": 600;
|
|
681
|
+
readonly "font-bold": 700;
|
|
682
|
+
readonly "font-extra-bold": 800;
|
|
683
|
+
};
|
|
684
|
+
readonly lineHeight: {
|
|
685
|
+
readonly "line-height-default": 1.5;
|
|
686
|
+
readonly "line-height-sm": 1.25;
|
|
687
|
+
readonly "line-height-xs": 1;
|
|
688
|
+
};
|
|
689
|
+
readonly color: {
|
|
690
|
+
readonly "color-dark": "#000000";
|
|
691
|
+
readonly "color-primary": "#6c5ce7";
|
|
692
|
+
readonly "color-white": "#ffffff";
|
|
693
|
+
readonly "color-secondary": "#475161";
|
|
694
|
+
};
|
|
695
|
+
};
|
|
696
|
+
readonly border: {
|
|
697
|
+
readonly radius: {
|
|
698
|
+
readonly "border-radius-xs": "2px";
|
|
699
|
+
readonly "border-radius-sm": "4px";
|
|
700
|
+
readonly "border-radius-md": "6px";
|
|
701
|
+
readonly "border-radius-lg": "8px";
|
|
702
|
+
readonly "border-radius-xl": "10px";
|
|
703
|
+
readonly "border-radius-50": "50%";
|
|
704
|
+
readonly "border-radius-full": "9999px";
|
|
705
|
+
};
|
|
706
|
+
readonly color: {
|
|
707
|
+
readonly "color-lighter": "#f5f5f5";
|
|
708
|
+
readonly "color-light": "#a9b6cb";
|
|
709
|
+
readonly "color-base": "#647696";
|
|
710
|
+
readonly "color-dark": "#475161";
|
|
711
|
+
readonly "color-link": "#6c5ce7";
|
|
712
|
+
readonly "color-focus": "#edf1f7";
|
|
713
|
+
readonly "color-warning": "#d62400";
|
|
714
|
+
readonly "color-success": "#007a52";
|
|
715
|
+
};
|
|
716
|
+
};
|
|
717
|
+
readonly spacing: {
|
|
718
|
+
readonly tokens: {
|
|
719
|
+
readonly "space-2": "0.125rem";
|
|
720
|
+
readonly "space-4": "0.25rem";
|
|
721
|
+
readonly "space-5": "0.3125rem";
|
|
722
|
+
readonly "space-6": "0.375rem";
|
|
723
|
+
readonly "space-8": "0.5rem";
|
|
724
|
+
readonly "space-10": "0.625rem";
|
|
725
|
+
readonly "space-12": "0.75rem";
|
|
726
|
+
readonly "space-14": "0.875rem";
|
|
727
|
+
readonly "space-15": "0.9375rem";
|
|
728
|
+
readonly "space-16": "1rem";
|
|
729
|
+
readonly "space-18": "1.125rem";
|
|
730
|
+
readonly "space-20": "1.25rem";
|
|
731
|
+
readonly "space-22": "1.375rem";
|
|
732
|
+
readonly "space-24": "1.5rem";
|
|
733
|
+
readonly "space-25": "1.5625rem";
|
|
734
|
+
readonly "space-26": "1.625rem";
|
|
735
|
+
readonly "space-28": "1.75rem";
|
|
736
|
+
readonly "space-30": "1.875rem";
|
|
737
|
+
readonly "space-32": "2rem";
|
|
738
|
+
readonly "space-34": "2.125rem";
|
|
739
|
+
readonly "space-35": "2.1875rem";
|
|
740
|
+
readonly "space-36": "2.25rem";
|
|
741
|
+
readonly "space-38": "2.375rem";
|
|
742
|
+
readonly "space-40": "2.5rem";
|
|
743
|
+
readonly "space-50": "3.125rem";
|
|
744
|
+
readonly "space-60": "3.75rem";
|
|
745
|
+
readonly "space-80": "5rem";
|
|
746
|
+
readonly "space-100": "6.25rem";
|
|
747
|
+
readonly "space-160": "10rem";
|
|
748
|
+
};
|
|
749
|
+
};
|
|
750
|
+
readonly background: {
|
|
751
|
+
readonly color: {
|
|
752
|
+
readonly "color-dark": "#000000";
|
|
753
|
+
readonly "color-primary": "#6c5ce7";
|
|
754
|
+
readonly "color-white": "#ffffff";
|
|
755
|
+
readonly "color-secondary": "#475161";
|
|
756
|
+
};
|
|
757
|
+
};
|
|
758
|
+
readonly position: {
|
|
759
|
+
readonly zIndex: {
|
|
760
|
+
readonly "z-index-default": "0";
|
|
761
|
+
readonly "z-index-positive": "1";
|
|
762
|
+
readonly "z-index-negative": "-1";
|
|
763
|
+
readonly "z-index-deepdive": "-99999";
|
|
764
|
+
};
|
|
765
|
+
};
|
|
766
|
+
readonly visibility: {
|
|
767
|
+
readonly opacity: {
|
|
768
|
+
readonly "opacity-0": "0%";
|
|
769
|
+
readonly "opacity-10": "10%";
|
|
770
|
+
readonly "opacity-20": "20%";
|
|
771
|
+
readonly "opacity-40": "40%";
|
|
772
|
+
readonly "opacity-50": "50%";
|
|
773
|
+
readonly "opacity-80": "80%";
|
|
774
|
+
readonly "opacity-100": "100%";
|
|
775
|
+
};
|
|
776
|
+
};
|
|
777
|
+
readonly shadow: {
|
|
778
|
+
readonly style: {
|
|
779
|
+
readonly default: {
|
|
780
|
+
readonly x: "0px";
|
|
781
|
+
readonly y: "1px";
|
|
782
|
+
readonly blur: "3px";
|
|
783
|
+
readonly spread: "0px";
|
|
784
|
+
readonly color: "rgba(0, 0, 0, 0.08)";
|
|
785
|
+
};
|
|
786
|
+
readonly heavy: {
|
|
787
|
+
readonly x: "0px";
|
|
788
|
+
readonly y: "2px";
|
|
789
|
+
readonly blur: "3px";
|
|
790
|
+
readonly spread: "0px";
|
|
791
|
+
readonly color: "rgba(0, 0, 0, 0.35)";
|
|
792
|
+
};
|
|
793
|
+
readonly "light-purple-1px": {
|
|
794
|
+
readonly x: "0px";
|
|
795
|
+
readonly y: "0px";
|
|
796
|
+
readonly blur: "2px";
|
|
797
|
+
readonly spread: "0px";
|
|
798
|
+
readonly color: "rgba(0, 0, 0, 0.14)";
|
|
799
|
+
};
|
|
800
|
+
readonly "light-purple-2px": {
|
|
801
|
+
readonly x: "0px";
|
|
802
|
+
readonly y: "2px";
|
|
803
|
+
readonly blur: "2px";
|
|
804
|
+
readonly spread: "0px";
|
|
805
|
+
readonly color: "rgba(0, 0, 0, 0.12)";
|
|
806
|
+
};
|
|
807
|
+
readonly "light-purple-3px": {
|
|
808
|
+
readonly x: "0px";
|
|
809
|
+
readonly y: "1px";
|
|
810
|
+
readonly blur: "3px";
|
|
811
|
+
readonly spread: "0px";
|
|
812
|
+
readonly color: "rgba(108, 92, 231, 0.2)";
|
|
813
|
+
};
|
|
814
|
+
readonly "light-purple-4px": {
|
|
815
|
+
readonly x: "0px";
|
|
816
|
+
readonly y: "2px";
|
|
817
|
+
readonly blur: "4px";
|
|
818
|
+
readonly spread: "0px";
|
|
819
|
+
readonly color: "rgba(0, 0, 0, 0.14)";
|
|
820
|
+
};
|
|
821
|
+
readonly "light-purple-5px": {
|
|
822
|
+
readonly x: "0px";
|
|
823
|
+
readonly y: "5px";
|
|
824
|
+
readonly blur: "5px";
|
|
825
|
+
readonly spread: "0px";
|
|
826
|
+
readonly color: "rgba(0, 0, 0, 0.12)";
|
|
827
|
+
};
|
|
828
|
+
readonly "light-purple-10px": {
|
|
829
|
+
readonly x: "0px";
|
|
830
|
+
readonly y: "1px";
|
|
831
|
+
readonly blur: "10px";
|
|
832
|
+
readonly spread: "0px";
|
|
833
|
+
readonly color: "rgba(108, 92, 231, 0.2)";
|
|
834
|
+
};
|
|
835
|
+
readonly "light-purple-10px-1": {
|
|
836
|
+
readonly x: "0px";
|
|
837
|
+
readonly y: "8px";
|
|
838
|
+
readonly blur: "10px";
|
|
839
|
+
readonly spread: "1px";
|
|
840
|
+
readonly color: "rgba(0, 0, 0, 0.14)";
|
|
841
|
+
};
|
|
842
|
+
readonly "light-purple-14px": {
|
|
843
|
+
readonly x: "0px";
|
|
844
|
+
readonly y: "3px";
|
|
845
|
+
readonly blur: "14px";
|
|
846
|
+
readonly spread: "3px";
|
|
847
|
+
readonly color: "rgba(0, 0, 0, 0.12)";
|
|
848
|
+
};
|
|
849
|
+
readonly "light-purple-15px": {
|
|
850
|
+
readonly x: "0px";
|
|
851
|
+
readonly y: "4px";
|
|
852
|
+
readonly blur: "15px";
|
|
853
|
+
readonly spread: "0px";
|
|
854
|
+
readonly color: "rgba(108, 92, 231, 0.2)";
|
|
855
|
+
};
|
|
856
|
+
readonly "light-purple-24px": {
|
|
857
|
+
readonly x: "0px";
|
|
858
|
+
readonly y: "16px";
|
|
859
|
+
readonly blur: "24px";
|
|
860
|
+
readonly spread: "2px";
|
|
861
|
+
readonly color: "rgba(0, 0, 0, 0.14)";
|
|
862
|
+
};
|
|
863
|
+
readonly "light-purple-30px": {
|
|
864
|
+
readonly x: "0px";
|
|
865
|
+
readonly y: "6px";
|
|
866
|
+
readonly blur: "30px";
|
|
867
|
+
readonly spread: "5px";
|
|
868
|
+
readonly color: "rgba(0, 0, 0, 0.12)";
|
|
869
|
+
};
|
|
870
|
+
readonly "light-purple-10px-3": {
|
|
871
|
+
readonly x: "0px";
|
|
872
|
+
readonly y: "8px";
|
|
873
|
+
readonly blur: "10px";
|
|
874
|
+
readonly spread: "3px";
|
|
875
|
+
readonly color: "rgba(108, 92, 231, 0.2)";
|
|
876
|
+
};
|
|
877
|
+
readonly "light-purple-38px": {
|
|
878
|
+
readonly x: "0px";
|
|
879
|
+
readonly y: "24px";
|
|
880
|
+
readonly blur: "38px";
|
|
881
|
+
readonly spread: "3px";
|
|
882
|
+
readonly color: "rgba(0, 0, 0, 0.14)";
|
|
883
|
+
};
|
|
884
|
+
readonly "light-purple-46px": {
|
|
885
|
+
readonly x: "0px";
|
|
886
|
+
readonly y: "9px";
|
|
887
|
+
readonly blur: "46px";
|
|
888
|
+
readonly spread: "8px";
|
|
889
|
+
readonly color: "rgba(0, 0, 0, 0.12)";
|
|
890
|
+
};
|
|
891
|
+
readonly "light-purple-15px-8": {
|
|
892
|
+
readonly x: "0px";
|
|
893
|
+
readonly y: "11px";
|
|
894
|
+
readonly blur: "15px";
|
|
895
|
+
readonly spread: "8px";
|
|
896
|
+
readonly color: "rgba(108, 92, 231, 0.2)";
|
|
897
|
+
};
|
|
898
|
+
readonly "black-1px": {
|
|
899
|
+
readonly x: "0px";
|
|
900
|
+
readonly y: "0px";
|
|
901
|
+
readonly blur: "2px";
|
|
902
|
+
readonly spread: "0px";
|
|
903
|
+
readonly color: "rgba(0, 0, 0, 0.14)";
|
|
904
|
+
};
|
|
905
|
+
readonly "black-2px": {
|
|
906
|
+
readonly x: "0px";
|
|
907
|
+
readonly y: "2px";
|
|
908
|
+
readonly blur: "2px";
|
|
909
|
+
readonly spread: "0px";
|
|
910
|
+
readonly color: "rgba(0, 0, 0, 0.12)";
|
|
911
|
+
};
|
|
912
|
+
readonly "black-3px": {
|
|
913
|
+
readonly x: "0px";
|
|
914
|
+
readonly y: "1px";
|
|
915
|
+
readonly blur: "3px";
|
|
916
|
+
readonly spread: "0px";
|
|
917
|
+
readonly color: "rgba(0, 0, 0, 0.2)";
|
|
918
|
+
};
|
|
919
|
+
readonly "black-4px": {
|
|
920
|
+
readonly x: "0px";
|
|
921
|
+
readonly y: "2px";
|
|
922
|
+
readonly blur: "4px";
|
|
923
|
+
readonly spread: "0px";
|
|
924
|
+
readonly color: "rgba(0, 0, 0, 0.14)";
|
|
925
|
+
};
|
|
926
|
+
readonly "black-5px": {
|
|
927
|
+
readonly x: "0px";
|
|
928
|
+
readonly y: "5px";
|
|
929
|
+
readonly blur: "5px";
|
|
930
|
+
readonly spread: "0px";
|
|
931
|
+
readonly color: "rgba(0, 0, 0, 0.12)";
|
|
932
|
+
};
|
|
933
|
+
readonly "black-10px": {
|
|
934
|
+
readonly x: "0px";
|
|
935
|
+
readonly y: "1px";
|
|
936
|
+
readonly blur: "10px";
|
|
937
|
+
readonly spread: "0px";
|
|
938
|
+
readonly color: "rgba(0, 0, 0, 0.2)";
|
|
939
|
+
};
|
|
940
|
+
readonly "black-10px-1": {
|
|
941
|
+
readonly x: "0px";
|
|
942
|
+
readonly y: "8px";
|
|
943
|
+
readonly blur: "10px";
|
|
944
|
+
readonly spread: "1px";
|
|
945
|
+
readonly color: "rgba(0, 0, 0, 0.14)";
|
|
946
|
+
};
|
|
947
|
+
readonly "black-14px": {
|
|
948
|
+
readonly x: "0px";
|
|
949
|
+
readonly y: "3px";
|
|
950
|
+
readonly blur: "14px";
|
|
951
|
+
readonly spread: "3px";
|
|
952
|
+
readonly color: "rgba(0, 0, 0, 0.12)";
|
|
953
|
+
};
|
|
954
|
+
readonly "black-15px": {
|
|
955
|
+
readonly x: "0px";
|
|
956
|
+
readonly y: "4px";
|
|
957
|
+
readonly blur: "15px";
|
|
958
|
+
readonly spread: "0px";
|
|
959
|
+
readonly color: "rgba(0, 0, 0, 0.2)";
|
|
960
|
+
};
|
|
961
|
+
readonly "black-16px": {
|
|
962
|
+
readonly x: "0px";
|
|
963
|
+
readonly y: "16px";
|
|
964
|
+
readonly blur: "24px";
|
|
965
|
+
readonly spread: "2px";
|
|
966
|
+
readonly color: "rgba(0, 0, 0, 0.14)";
|
|
967
|
+
};
|
|
968
|
+
readonly "black-30px": {
|
|
969
|
+
readonly x: "0px";
|
|
970
|
+
readonly y: "6px";
|
|
971
|
+
readonly blur: "30px";
|
|
972
|
+
readonly spread: "5px";
|
|
973
|
+
readonly color: "rgba(0, 0, 0, 0.12)";
|
|
974
|
+
};
|
|
975
|
+
readonly "black-10px-8": {
|
|
976
|
+
readonly x: "0px";
|
|
977
|
+
readonly y: "8px";
|
|
978
|
+
readonly blur: "10px";
|
|
979
|
+
readonly spread: "0px";
|
|
980
|
+
readonly color: "rgba(0, 0, 0, 0.2)";
|
|
981
|
+
};
|
|
982
|
+
readonly "black-38px": {
|
|
983
|
+
readonly x: "0px";
|
|
984
|
+
readonly y: "24px";
|
|
985
|
+
readonly blur: "38px";
|
|
986
|
+
readonly spread: "3px";
|
|
987
|
+
readonly color: "rgba(0, 0, 0, 0.14)";
|
|
988
|
+
};
|
|
989
|
+
readonly "black-46px": {
|
|
990
|
+
readonly x: "0px";
|
|
991
|
+
readonly y: "9px";
|
|
992
|
+
readonly blur: "46px";
|
|
993
|
+
readonly spread: "8px";
|
|
994
|
+
readonly color: "rgba(0, 0, 0, 0.12)";
|
|
995
|
+
};
|
|
996
|
+
readonly "black-15px-2": {
|
|
997
|
+
readonly x: "0px";
|
|
998
|
+
readonly y: "11px";
|
|
999
|
+
readonly blur: "15px";
|
|
1000
|
+
readonly spread: "0px";
|
|
1001
|
+
readonly color: "rgba(0, 0, 0, 0.2)";
|
|
1002
|
+
};
|
|
1003
|
+
};
|
|
1004
|
+
};
|
|
1005
|
+
};
|
|
1006
|
+
/**
|
|
1007
|
+
* The level determines which values are allowed in the design tokens.
|
|
1008
|
+
* The higher the level, the more values are allowed.
|
|
1009
|
+
*/
|
|
1010
|
+
declare const ALLOWED_DESIGN_VALUES_LEVELS: {
|
|
1011
|
+
readonly DYNAMIC: 1;
|
|
1012
|
+
readonly TOKENS: 2;
|
|
1013
|
+
readonly ARBITRARY: 3;
|
|
1014
|
+
};
|
|
1015
|
+
|
|
1016
|
+
interface JSONRTERegistryOptions {
|
|
1017
|
+
config: IJsonToHtmlOptions;
|
|
1018
|
+
}
|
|
1019
|
+
declare class JSONRTERegistry {
|
|
1020
|
+
private config;
|
|
1021
|
+
constructor(config?: JSONRTERegistryOptions);
|
|
1022
|
+
registerJSONRTE(config: IJsonToHtmlOptions): void;
|
|
1023
|
+
getJSONRTE(): IJsonToHtmlOptions;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
type PartialRecord<K extends keyof any, T> = {
|
|
1027
|
+
[P in K]?: T;
|
|
1028
|
+
};
|
|
1029
|
+
|
|
1030
|
+
interface ICSEntryReference {
|
|
1031
|
+
uid: string;
|
|
1032
|
+
_content_type_uid: string;
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* This is how we store the data in the compositon entry.
|
|
1036
|
+
*/
|
|
1037
|
+
interface DataSourceItem {
|
|
1038
|
+
uid: string;
|
|
1039
|
+
data: unknown;
|
|
1040
|
+
}
|
|
1041
|
+
type CSDataSources = DataSourceItem[];
|
|
1042
|
+
interface DataSources {
|
|
1043
|
+
contentstack?: any;
|
|
1044
|
+
[source: string]: any;
|
|
1045
|
+
}
|
|
1046
|
+
interface StudioSpecData {
|
|
1047
|
+
dataSources: DataSources;
|
|
1048
|
+
static_value: StaticValue;
|
|
1049
|
+
symbol_props?: Record<string, any>;
|
|
1050
|
+
}
|
|
1051
|
+
interface ComposableStudioData extends StudioSpecData {
|
|
1052
|
+
component_props: Record<string, any> | undefined;
|
|
1053
|
+
}
|
|
1054
|
+
type StaticValueUid = string;
|
|
1055
|
+
interface StaticValueItem<T> {
|
|
1056
|
+
key: StaticValueUid;
|
|
1057
|
+
value: T;
|
|
1058
|
+
}
|
|
1059
|
+
type RawStaticValue = {
|
|
1060
|
+
text?: Array<StaticValueItem<string>>;
|
|
1061
|
+
/**
|
|
1062
|
+
* NOTE: We are storing the Markdown value in the html_rte field.
|
|
1063
|
+
* Earlier we used to store the HTML Values, here we are storing the Markdown Values.
|
|
1064
|
+
* For backward compatibility, we are not changing the field name.
|
|
1065
|
+
*/
|
|
1066
|
+
html_rte?: Array<StaticValueItem<string>>;
|
|
1067
|
+
array?: Array<StaticValueItem<string>>;
|
|
1068
|
+
object?: Array<StaticValueItem<string>>;
|
|
1069
|
+
number?: Array<StaticValueItem<number>>;
|
|
1070
|
+
href?: Array<StaticValueItem<string>>;
|
|
1071
|
+
textarea?: Array<StaticValueItem<string>>;
|
|
1072
|
+
datestring?: Array<StaticValueItem<string>>;
|
|
1073
|
+
boolean?: Array<StaticValueItem<boolean>>;
|
|
1074
|
+
image?: Array<StaticValueItem<string>>;
|
|
1075
|
+
choice?: Array<StaticValueItem<string[]>>;
|
|
1076
|
+
any?: Array<StaticValueItem<any>>;
|
|
1077
|
+
json_rte?: Array<StaticValueItem<any>>;
|
|
1078
|
+
};
|
|
1079
|
+
type StaticValue = {
|
|
1080
|
+
[field: StaticValueUid]: unknown;
|
|
1081
|
+
};
|
|
1082
|
+
type GetSlotsParams = {
|
|
1083
|
+
slots: Node[];
|
|
1084
|
+
parent: Node;
|
|
1085
|
+
slotUid: string;
|
|
1086
|
+
};
|
|
1087
|
+
type GetSlots<T> = (args: GetSlotsParams) => T;
|
|
1088
|
+
type PlaceHolders<T> = PartialRecord<PropType, (placeholder?: string) => T>;
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* Retrieves the value of a property for a given node based on the provided arguments.
|
|
1092
|
+
*
|
|
1093
|
+
* @template S - The type of the default slot.
|
|
1094
|
+
* @template T - The type of the component props.
|
|
1095
|
+
*
|
|
1096
|
+
* @param {RetrievePropValueArgs<S, T>} args - The arguments required to retrieve the property value.
|
|
1097
|
+
* @param {ComposableStudioData} args.data - The data from Studio.
|
|
1098
|
+
* @param {S} args.defaultSlot - The default slot value.
|
|
1099
|
+
* @param {RegisterComponentSchema<T>} args.componentOptions - The properties of the component.
|
|
1100
|
+
* @param {Node} args.node - The node for which the property value is being retrieved.
|
|
1101
|
+
* @param {PartialRecord<PropType, (placeholder?: string) => T>} [args.placeholders] - Optional placeholders for the properties.
|
|
1102
|
+
* @param {Object} args.cslp - The CSLP configuration.
|
|
1103
|
+
* @param {boolean} args.cslp.appendTags - Whether to append tags to the binding.
|
|
1104
|
+
* @param {Function} args.getSlots - A function to get the slots for a given node.
|
|
1105
|
+
*
|
|
1106
|
+
* @returns {Record<string, any>} - A record of the retrieved property values.
|
|
1107
|
+
*
|
|
1108
|
+
* @throws {Error} - Throws an error if the prop type does not match the component registry or if the type is not handled.
|
|
1109
|
+
*/
|
|
1110
|
+
|
|
1111
|
+
type CommonNodeProps<T> = T & {
|
|
1112
|
+
binding?: string;
|
|
1113
|
+
placeholder?: string;
|
|
1114
|
+
};
|
|
1115
|
+
/**
|
|
1116
|
+
* This is the props object present in the UI json
|
|
1117
|
+
*/
|
|
1118
|
+
type NodeProps = CommonNodeProps<PropInput>;
|
|
1119
|
+
interface RetrievePropValueArgs<S, T> {
|
|
1120
|
+
data: ComposableStudioData;
|
|
1121
|
+
defaultSlot: S;
|
|
1122
|
+
componentOptions: RegisterComponentSchema<(props?: any) => React.ReactNode>;
|
|
1123
|
+
node: Node;
|
|
1124
|
+
placeholders?: PlaceHolders<T>;
|
|
1125
|
+
cslp: {
|
|
1126
|
+
appendTags: boolean;
|
|
1127
|
+
};
|
|
1128
|
+
nodeUid: string;
|
|
1129
|
+
getSlots: GetSlots<T>;
|
|
1130
|
+
jsonRTE: IJsonToHtmlOptions;
|
|
1131
|
+
isCompositionBeingEdited: boolean;
|
|
1132
|
+
}
|
|
1133
|
+
declare function retrievePropValue<S, T>(args: RetrievePropValueArgs<S, T>): Record<string, any>;
|
|
1134
|
+
|
|
1135
|
+
interface GetSlotDataArgs<T> {
|
|
1136
|
+
nodeProps: NodePropsWithSlot;
|
|
1137
|
+
field: string;
|
|
1138
|
+
node: Node;
|
|
1139
|
+
getSlots: GetSlots<T>;
|
|
1140
|
+
}
|
|
1141
|
+
declare function getDefaultPropStaticValue(): NodePropStaticValueTypes;
|
|
1142
|
+
declare function getDefaultPropStaticValue<K extends BindableNodePropType>(args: K): NodePropStaticValueTypes[K];
|
|
1143
|
+
declare function isKnownType(type: string): type is PropType;
|
|
1144
|
+
declare function getSlotData<T>({ nodeProps, field, node, getSlots, }: GetSlotDataArgs<T>): T | null;
|
|
1145
|
+
declare function getPlaceHolderComponent<T>(placeholders: PlaceHolders<T>, prop: PropInput, type: BindableNodePropType): any;
|
|
1146
|
+
declare const getBindingString: (binding: BindingType) => string;
|
|
1147
|
+
declare const resolveMetadataBindings: (node: Node, data: ComposableStudioData) => void;
|
|
1148
|
+
declare const getRepeaterContextPath: (binding: RepeaterBindingValue) => string;
|
|
1149
|
+
declare function isDataMatchingPropType(data: unknown, type: BindableNodePropType): boolean;
|
|
1150
|
+
declare function getDataType(data: unknown): string;
|
|
1151
|
+
|
|
1152
|
+
/**
|
|
1153
|
+
* Gets the CSLP path of a binding. The CSLP path is the path of the binding with the $ sign in between the path.
|
|
1154
|
+
* @param binding The path to where the data is stored.
|
|
1155
|
+
* @returns The path of the CSLP path.
|
|
1156
|
+
*/
|
|
1157
|
+
declare function getCslpPath(binding: string): string;
|
|
1158
|
+
declare const getRepeaterBinding: (node: Node) => any;
|
|
1159
|
+
declare const getCslpTag: ({ bindedField, data, }: {
|
|
1160
|
+
bindedField: string;
|
|
1161
|
+
data: ComposableStudioData;
|
|
1162
|
+
}) => any;
|
|
1163
|
+
|
|
1164
|
+
interface Breakpoint {
|
|
1165
|
+
id: string;
|
|
1166
|
+
displayName: string;
|
|
1167
|
+
query: string;
|
|
1168
|
+
previewSize: {
|
|
1169
|
+
width: number;
|
|
1170
|
+
height: number;
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1173
|
+
type PreProcessedBreakpoint = Omit<Breakpoint, "displayName"> & {
|
|
1174
|
+
displayName?: string;
|
|
1175
|
+
};
|
|
1176
|
+
type DefaultBreakpoint = Omit<PreProcessedBreakpoint, "query"> & {
|
|
1177
|
+
id: "default";
|
|
1178
|
+
};
|
|
1179
|
+
type BreakpointInput = [DefaultBreakpoint, ...PreProcessedBreakpoint[]];
|
|
1180
|
+
|
|
1181
|
+
declare class BreakpointRegistry {
|
|
1182
|
+
private breakpoints;
|
|
1183
|
+
private requiredFields;
|
|
1184
|
+
private uniqueNames;
|
|
1185
|
+
registerBreakpoints(breakpoints: BreakpointInput): void;
|
|
1186
|
+
getBreakpoints(): Breakpoint[];
|
|
1187
|
+
getBreakpoint(id: string): Breakpoint;
|
|
1188
|
+
setBreakpoint(breakpoints: Breakpoint[]): void;
|
|
1189
|
+
processBreakpoints(breakpoints: BreakpointInput): Breakpoint[];
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
declare const getSymbolUIDFromNode: (symbol: Node) => string;
|
|
1193
|
+
declare const getSymbolUIDFromUID: (uid: string) => string;
|
|
1194
|
+
|
|
1195
|
+
export { ALLOWED_DESIGN_VALUES_LEVELS, BUILT_IN_COMPONENTS, BreakpointRegistry, ComponentRegistry, DATA_SOURCES, DATA_SOURCES_PREFIX, DEFAULT_DESIGN_TOKENS, DesignRegistry, INTERNAL_COMPONENTS_NAMES, INTERNAL_COMPONENT_SECTIONS, INTERNAL_SECTIONS, JSONRTERegistry, STYLE_SECTIONS_OPTIONS, STYLE_SECTION_CATEGORIES, SYSTEM_COMPONENTS, getBindingString, getCslpPath, getCslpTag, getDataType, getDefaultPropStaticValue, getDesignClassesNames, getPlaceHolderComponent, getRepeaterBinding, getRepeaterContextPath, getSlotData, getSymbolUIDFromNode, getSymbolUIDFromUID, isDataMatchingPropType, isKnownType, resolveMetadataBindings, retrievePropValue };
|
|
1196
|
+
export type { AllowedDesignValues, AllowedDesignValuesLevel, AnyProp, ArrayProp, BooleanProp, Breakpoint, BreakpointInput, CSBindingPath, CSDataSources, ChoiceProp, ComponentRegistryOptions, ComponentType, ComposableStudioData, ContentstackBindingValue, CssVariablesToDesignTokens, CssVariablesToValue, DataSourceItem, DataSources, DateStringProp, DefaultBreakpoint, DesignClassValue, DesignClasses, DesignClassesInput, DesignClassesNames, DesignTokenCssVariable, DesignTokens, DesignTokensInput, DesignTokensInputKeys, DesignTokensOptions, DesignTokensOptionsInput, GetSlots, GetSlotsParams, GlobalDesignTokens, HrefProp, ICSEntryReference, ImageUrlProp, InternalComponentRegistryOptions, JSONRTERegistryOptions, JsonRTEProp, LengthToken, NodeProps, NumberProp, ObjectInput, ObjectProp, PlaceHolders, PreProcessedBreakpoint, PreProcessedDesignTokenInput, PropBase, PropInput, PropType, PropTypeOfNoOptionsRequired, PropValidator, Props, PropsWithNoOptionsRequired, RawStaticValue, RegisterComponentOptionsInput, RegisterComponentSchema, RegisterComponentSchemaInput, RegisterInternalComponentOptionsInput, Registry, RepeaterBindingValue, SectionDesignTokens, SlotProp, StaticValue, StaticValueItem, StaticValueUid, StringProp, StudioSpecData, StyleGroupOptions, StyleSectionCategoriesOptions, StyleSectionOptions, StyleSections, TemplateBindingValue };
|