@webiny/website-builder-sdk 0.0.0-unstable.06b2ede40f
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/BindingsApi.d.ts +25 -0
- package/BindingsApi.js +42 -0
- package/BindingsApi.js.map +1 -0
- package/BindingsProcessor.d.ts +11 -0
- package/BindingsProcessor.js +49 -0
- package/BindingsProcessor.js.map +1 -0
- package/BindingsProcessor.test.d.ts +1 -0
- package/BindingsProcessor.test.js +86 -0
- package/BindingsProcessor.test.js.map +1 -0
- package/BindingsResolver.d.ts +20 -0
- package/BindingsResolver.js +134 -0
- package/BindingsResolver.js.map +1 -0
- package/BindingsResolver.test.d.ts +1 -0
- package/BindingsResolver.test.js +382 -0
- package/BindingsResolver.test.js.map +1 -0
- package/ComponentInputTraverser.d.ts +18 -0
- package/ComponentInputTraverser.js +56 -0
- package/ComponentInputTraverser.js.map +1 -0
- package/ComponentManifestToAstConverter.d.ts +13 -0
- package/ComponentManifestToAstConverter.js +24 -0
- package/ComponentManifestToAstConverter.js.map +1 -0
- package/ComponentRegistry.d.ts +15 -0
- package/ComponentRegistry.js +25 -0
- package/ComponentRegistry.js.map +1 -0
- package/ComponentResolver.d.ts +14 -0
- package/ComponentResolver.js +36 -0
- package/ComponentResolver.js.map +1 -0
- package/ContentSdk.d.ts +44 -0
- package/ContentSdk.js +106 -0
- package/ContentSdk.js.map +1 -0
- package/DocumentStore.d.ts +15 -0
- package/DocumentStore.js +67 -0
- package/DocumentStore.js.map +1 -0
- package/DocumentStoreManager.d.ts +11 -0
- package/DocumentStoreManager.js +22 -0
- package/DocumentStoreManager.js.map +1 -0
- package/EditingSdk.d.ts +21 -0
- package/EditingSdk.js +143 -0
- package/EditingSdk.js.map +1 -0
- package/ElementFactory.d.ts +54 -0
- package/ElementFactory.js +183 -0
- package/ElementFactory.js.map +1 -0
- package/Environment.d.ts +9 -0
- package/Environment.js +23 -0
- package/Environment.js.map +1 -0
- package/FunctionConverter.d.ts +6 -0
- package/FunctionConverter.js +11 -0
- package/FunctionConverter.js.map +1 -0
- package/HashObject.d.ts +6 -0
- package/HashObject.js +17 -0
- package/HashObject.js.map +1 -0
- package/HotkeyManager.d.ts +6 -0
- package/HotkeyManager.js +58 -0
- package/HotkeyManager.js.map +1 -0
- package/IBindingsUpdater.d.ts +6 -0
- package/IBindingsUpdater.js +3 -0
- package/IBindingsUpdater.js.map +1 -0
- package/IRedirects.d.ts +5 -0
- package/IRedirects.js +3 -0
- package/IRedirects.js.map +1 -0
- package/InheritanceProcessor.d.ts +29 -0
- package/InheritanceProcessor.js +147 -0
- package/InheritanceProcessor.js.map +1 -0
- package/InheritanceProcessor.test.d.ts +1 -0
- package/InheritanceProcessor.test.js +192 -0
- package/InheritanceProcessor.test.js.map +1 -0
- package/InheritedValueResolver.d.ts +10 -0
- package/InheritedValueResolver.js +24 -0
- package/InheritedValueResolver.js.map +1 -0
- package/InputBindingsProcessor.d.ts +38 -0
- package/InputBindingsProcessor.js +306 -0
- package/InputBindingsProcessor.js.map +1 -0
- package/InputsBindingsProcessor.test.d.ts +1 -0
- package/InputsBindingsProcessor.test.js +327 -0
- package/InputsBindingsProcessor.test.js.map +1 -0
- package/InputsUpdater.d.ts +12 -0
- package/InputsUpdater.js +34 -0
- package/InputsUpdater.js.map +1 -0
- package/LICENSE +21 -0
- package/LiveSdk.d.ts +7 -0
- package/LiveSdk.js +18 -0
- package/LiveSdk.js.map +1 -0
- package/Logger.d.ts +1 -0
- package/Logger.js +10 -0
- package/Logger.js.map +1 -0
- package/MouseTracker.d.ts +39 -0
- package/MouseTracker.js +93 -0
- package/MouseTracker.js.map +1 -0
- package/NullSdk.d.ts +8 -0
- package/NullSdk.js +17 -0
- package/NullSdk.js.map +1 -0
- package/PreviewDocument.d.ts +8 -0
- package/PreviewDocument.js +35 -0
- package/PreviewDocument.js.map +1 -0
- package/PreviewSdk.d.ts +8 -0
- package/PreviewSdk.js +22 -0
- package/PreviewSdk.js.map +1 -0
- package/PreviewViewport.d.ts +9 -0
- package/PreviewViewport.js +88 -0
- package/PreviewViewport.js.map +1 -0
- package/README.md +3 -0
- package/ResizeObserver.d.ts +5 -0
- package/ResizeObserver.js +41 -0
- package/ResizeObserver.js.map +1 -0
- package/StylesBindingsProcessor.d.ts +33 -0
- package/StylesBindingsProcessor.js +91 -0
- package/StylesBindingsProcessor.js.map +1 -0
- package/StylesUpdater.d.ts +10 -0
- package/StylesUpdater.js +34 -0
- package/StylesUpdater.js.map +1 -0
- package/Theme.d.ts +4 -0
- package/Theme.js +36 -0
- package/Theme.js.map +1 -0
- package/ViewportManager.d.ts +34 -0
- package/ViewportManager.js +106 -0
- package/ViewportManager.js.map +1 -0
- package/constants.d.ts +6 -0
- package/constants.js +8 -0
- package/constants.js.map +1 -0
- package/createElement.d.ts +10 -0
- package/createElement.js +8 -0
- package/createElement.js.map +1 -0
- package/createInput.d.ts +17 -0
- package/createInput.js +128 -0
- package/createInput.js.map +1 -0
- package/createTheme.d.ts +3 -0
- package/createTheme.js +5 -0
- package/createTheme.js.map +1 -0
- package/dataProviders/ApiClient.d.ts +13 -0
- package/dataProviders/ApiClient.js +43 -0
- package/dataProviders/ApiClient.js.map +1 -0
- package/dataProviders/DefaultDataProvider.d.ts +14 -0
- package/dataProviders/DefaultDataProvider.js +47 -0
- package/dataProviders/DefaultDataProvider.js.map +1 -0
- package/dataProviders/GET_ACTIVE_REDIRECTS.d.ts +1 -0
- package/dataProviders/GET_ACTIVE_REDIRECTS.js +21 -0
- package/dataProviders/GET_ACTIVE_REDIRECTS.js.map +1 -0
- package/dataProviders/GET_PAGE_BY_ID.d.ts +1 -0
- package/dataProviders/GET_PAGE_BY_ID.js +21 -0
- package/dataProviders/GET_PAGE_BY_ID.js.map +1 -0
- package/dataProviders/GET_PAGE_BY_PATH.d.ts +1 -0
- package/dataProviders/GET_PAGE_BY_PATH.js +21 -0
- package/dataProviders/GET_PAGE_BY_PATH.js.map +1 -0
- package/dataProviders/LIST_PUBLISHED_PAGES.d.ts +1 -0
- package/dataProviders/LIST_PUBLISHED_PAGES.js +21 -0
- package/dataProviders/LIST_PUBLISHED_PAGES.js.map +1 -0
- package/dataProviders/NullDataProvider.d.ts +7 -0
- package/dataProviders/NullDataProvider.js +16 -0
- package/dataProviders/NullDataProvider.js.map +1 -0
- package/dataProviders/RedirectsProvider.d.ts +11 -0
- package/dataProviders/RedirectsProvider.js +33 -0
- package/dataProviders/RedirectsProvider.js.map +1 -0
- package/defaultBreakpoints.d.ts +2 -0
- package/defaultBreakpoints.js +25 -0
- package/defaultBreakpoints.js.map +1 -0
- package/documentOperations/$addElementReferenceToParent.d.ts +9 -0
- package/documentOperations/$addElementReferenceToParent.js +31 -0
- package/documentOperations/$addElementReferenceToParent.js.map +1 -0
- package/documentOperations/AddElement.d.ts +7 -0
- package/documentOperations/AddElement.js +10 -0
- package/documentOperations/AddElement.js.map +1 -0
- package/documentOperations/AddToParent.d.ts +8 -0
- package/documentOperations/AddToParent.js +17 -0
- package/documentOperations/AddToParent.js.map +1 -0
- package/documentOperations/IDocumentOperation.d.ts +4 -0
- package/documentOperations/IDocumentOperation.js +3 -0
- package/documentOperations/IDocumentOperation.js.map +1 -0
- package/documentOperations/RemoveElement.d.ts +7 -0
- package/documentOperations/RemoveElement.js +10 -0
- package/documentOperations/RemoveElement.js.map +1 -0
- package/documentOperations/SetGlobalInputBinding.d.ts +9 -0
- package/documentOperations/SetGlobalInputBinding.js +25 -0
- package/documentOperations/SetGlobalInputBinding.js.map +1 -0
- package/documentOperations/SetGlobalStyleBinding.d.ts +9 -0
- package/documentOperations/SetGlobalStyleBinding.js +26 -0
- package/documentOperations/SetGlobalStyleBinding.js.map +1 -0
- package/documentOperations/SetInputBindingOverride.d.ts +10 -0
- package/documentOperations/SetInputBindingOverride.js +33 -0
- package/documentOperations/SetInputBindingOverride.js.map +1 -0
- package/documentOperations/SetStyleBindingOverride.d.ts +10 -0
- package/documentOperations/SetStyleBindingOverride.js +35 -0
- package/documentOperations/SetStyleBindingOverride.js.map +1 -0
- package/documentOperations/index.d.ts +17 -0
- package/documentOperations/index.js +18 -0
- package/documentOperations/index.js.map +1 -0
- package/findMatchingAstNode.d.ts +2 -0
- package/findMatchingAstNode.js +17 -0
- package/findMatchingAstNode.js.map +1 -0
- package/generateElementId.d.ts +1 -0
- package/generateElementId.js +7 -0
- package/generateElementId.js.map +1 -0
- package/headersProvider.d.ts +4 -0
- package/headersProvider.js +7 -0
- package/headersProvider.js.map +1 -0
- package/index.d.ts +31 -0
- package/index.js +33 -0
- package/index.js.map +1 -0
- package/jsonPatch.d.ts +6 -0
- package/jsonPatch.js +12 -0
- package/jsonPatch.js.map +1 -0
- package/lexical/createDefaultLexicalTheme.d.ts +2 -0
- package/lexical/createDefaultLexicalTheme.js +84 -0
- package/lexical/createDefaultLexicalTheme.js.map +1 -0
- package/lexical/createLexicalTheme.d.ts +2 -0
- package/lexical/createLexicalTheme.js +7 -0
- package/lexical/createLexicalTheme.js.map +1 -0
- package/lexical/deepMerge.d.ts +1 -0
- package/lexical/deepMerge.js +23 -0
- package/lexical/deepMerge.js.map +1 -0
- package/messages.d.ts +11 -0
- package/messages.js +13 -0
- package/messages.js.map +1 -0
- package/messenger/MessageOrigin.d.ts +7 -0
- package/messenger/MessageOrigin.js +14 -0
- package/messenger/MessageOrigin.js.map +1 -0
- package/messenger/Messenger.d.ts +22 -0
- package/messenger/Messenger.js +80 -0
- package/messenger/Messenger.js.map +1 -0
- package/messenger/index.d.ts +2 -0
- package/messenger/index.js +4 -0
- package/messenger/index.js.map +1 -0
- package/package.json +54 -0
- package/registerComponentGroup.d.ts +2 -0
- package/registerComponentGroup.js +10 -0
- package/registerComponentGroup.js.map +1 -0
- package/types/LexicalEditorTheme.d.ts +2 -0
- package/types/LexicalEditorTheme.js +3 -0
- package/types/LexicalEditorTheme.js.map +1 -0
- package/types/ShorthandCssProperties.d.ts +1 -0
- package/types/ShorthandCssProperties.js +3 -0
- package/types/ShorthandCssProperties.js.map +1 -0
- package/types/WebsiteBuilderTheme.d.ts +92 -0
- package/types/WebsiteBuilderTheme.js +3 -0
- package/types/WebsiteBuilderTheme.js.map +1 -0
- package/types.d.ts +295 -0
- package/types.js +3 -0
- package/types.js.map +1 -0
package/types.d.ts
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import type * as CSS from "csstype";
|
|
2
|
+
import type { BindingsApi } from "./BindingsApi";
|
|
3
|
+
import type { ShorthandCssProperties } from "./types/ShorthandCssProperties";
|
|
4
|
+
export type { WebsiteBuilderTheme, Breakpoint } from "./types/WebsiteBuilderTheme";
|
|
5
|
+
interface CSSProperties extends CSS.Properties<string | number> {
|
|
6
|
+
}
|
|
7
|
+
export type ElementMap = Record<string, DocumentElement>;
|
|
8
|
+
export type DocumentState = Record<string, any>;
|
|
9
|
+
export type InputValueBinding<T = any> = ValueBinding<T> & {
|
|
10
|
+
id: string;
|
|
11
|
+
type: string;
|
|
12
|
+
translatable?: boolean;
|
|
13
|
+
list?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type StyleValueBinding<T = any> = ValueBinding<T>;
|
|
16
|
+
export type ValueBinding<T = any> = {
|
|
17
|
+
static?: T;
|
|
18
|
+
expression?: string;
|
|
19
|
+
};
|
|
20
|
+
export type RepeatValueBinding = {
|
|
21
|
+
expression: string;
|
|
22
|
+
};
|
|
23
|
+
export type CssProperties = Omit<CSSProperties, ShorthandCssProperties>;
|
|
24
|
+
export type DocumentElementStyleBindings = Partial<{
|
|
25
|
+
[K in keyof CssProperties]: StyleValueBinding<CssProperties[K]>;
|
|
26
|
+
}>;
|
|
27
|
+
export type DocumentElementInputBindings = {
|
|
28
|
+
[inputName: string]: InputValueBinding;
|
|
29
|
+
};
|
|
30
|
+
export type DocumentElementBindings = {
|
|
31
|
+
$repeat?: RepeatValueBinding;
|
|
32
|
+
inputs?: DocumentElementInputBindings;
|
|
33
|
+
styles?: DocumentElementStyleBindings;
|
|
34
|
+
metadata?: Record<string, any>;
|
|
35
|
+
overrides?: {
|
|
36
|
+
[key: string]: {
|
|
37
|
+
inputs?: DocumentElementInputBindings;
|
|
38
|
+
styles?: DocumentElementStyleBindings;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export type DocumentBindings = {
|
|
43
|
+
[elementId: string]: DocumentElementBindings;
|
|
44
|
+
};
|
|
45
|
+
export type ResolvedComponent<TComponent = any> = {
|
|
46
|
+
component: TComponent;
|
|
47
|
+
inputs: Record<string, any>;
|
|
48
|
+
manifest: ComponentManifest;
|
|
49
|
+
styles: SerializableCSSStyleDeclaration;
|
|
50
|
+
};
|
|
51
|
+
export type ResolvedElement = {
|
|
52
|
+
id: string;
|
|
53
|
+
inputs: Record<string, any>;
|
|
54
|
+
styles: SerializableCSSStyleDeclaration;
|
|
55
|
+
};
|
|
56
|
+
export type Component = {
|
|
57
|
+
component: any;
|
|
58
|
+
manifest: ComponentManifest;
|
|
59
|
+
};
|
|
60
|
+
export type ComponentGroupItem = {
|
|
61
|
+
name: string;
|
|
62
|
+
item?: DocumentElementTemplate;
|
|
63
|
+
};
|
|
64
|
+
export type SerializedComponentGroup = ComponentGroup & {
|
|
65
|
+
filter?: string;
|
|
66
|
+
};
|
|
67
|
+
export type ComponentGroupFilterContext = {
|
|
68
|
+
document: EditorDocument;
|
|
69
|
+
};
|
|
70
|
+
export type ComponentGroup = {
|
|
71
|
+
name: string;
|
|
72
|
+
label: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
filter?: (component: ComponentManifest, context: ComponentGroupFilterContext) => boolean;
|
|
75
|
+
};
|
|
76
|
+
export type ResponsiveStyles = {
|
|
77
|
+
[key: string]: SerializableCSSStyleDeclaration;
|
|
78
|
+
};
|
|
79
|
+
export type ComponentManifest = {
|
|
80
|
+
name: string;
|
|
81
|
+
group?: string;
|
|
82
|
+
label?: string;
|
|
83
|
+
image?: string;
|
|
84
|
+
inputs?: ComponentInput[];
|
|
85
|
+
canDrag?: boolean;
|
|
86
|
+
canDelete?: boolean;
|
|
87
|
+
acceptsChildren?: boolean;
|
|
88
|
+
hideFromToolbar?: boolean;
|
|
89
|
+
hideStyleSettings?: string[];
|
|
90
|
+
autoApplyStyles?: boolean;
|
|
91
|
+
tags?: string[];
|
|
92
|
+
defaults?: {
|
|
93
|
+
inputs?: Record<string, any>;
|
|
94
|
+
styles?: SerializableCSSStyleDeclaration;
|
|
95
|
+
overrides?: {
|
|
96
|
+
[breakpoint: string]: {
|
|
97
|
+
inputs?: Record<string, any>;
|
|
98
|
+
styles?: SerializableCSSStyleDeclaration;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export type DocumentElementTemplate = Omit<DocumentElement, "id">;
|
|
104
|
+
export type ElementComponent = {
|
|
105
|
+
name: string;
|
|
106
|
+
};
|
|
107
|
+
export type DocumentElement = {
|
|
108
|
+
type: "Webiny/Element";
|
|
109
|
+
id: string;
|
|
110
|
+
component: ElementComponent;
|
|
111
|
+
parent?: {
|
|
112
|
+
id: string;
|
|
113
|
+
slot: string;
|
|
114
|
+
};
|
|
115
|
+
styles?: ResponsiveStyles;
|
|
116
|
+
};
|
|
117
|
+
export type SerializableCSSStyleDeclaration = {
|
|
118
|
+
[K in keyof CssProperties]?: CssProperties[K];
|
|
119
|
+
};
|
|
120
|
+
export type Document = {
|
|
121
|
+
id: string;
|
|
122
|
+
state: DocumentState;
|
|
123
|
+
version: number;
|
|
124
|
+
properties: Record<string, any>;
|
|
125
|
+
bindings: DocumentBindings;
|
|
126
|
+
elements: ElementMap;
|
|
127
|
+
};
|
|
128
|
+
export type PublicPage = Pick<Page, "id" | "version" | "properties" | "bindings" | "elements" | "state">;
|
|
129
|
+
export type PublicRedirect = {
|
|
130
|
+
id: string;
|
|
131
|
+
from: string;
|
|
132
|
+
to: string;
|
|
133
|
+
permanent: boolean;
|
|
134
|
+
};
|
|
135
|
+
export type EditorPage = EditorDocument & Pick<Page, "properties" | "status" | "location">;
|
|
136
|
+
export type EditorDocument = Document & {
|
|
137
|
+
metadata: Record<string, any>;
|
|
138
|
+
};
|
|
139
|
+
export type Page = Document & {
|
|
140
|
+
id: string;
|
|
141
|
+
status: string;
|
|
142
|
+
version: number;
|
|
143
|
+
location: {
|
|
144
|
+
folderId: string;
|
|
145
|
+
};
|
|
146
|
+
properties: {
|
|
147
|
+
title: string;
|
|
148
|
+
snippet: string;
|
|
149
|
+
path: string;
|
|
150
|
+
tags: string[];
|
|
151
|
+
seo: {
|
|
152
|
+
title: string;
|
|
153
|
+
description: string;
|
|
154
|
+
metaTags: Array<{
|
|
155
|
+
name: string;
|
|
156
|
+
content: string;
|
|
157
|
+
}>;
|
|
158
|
+
};
|
|
159
|
+
social: {
|
|
160
|
+
title: string;
|
|
161
|
+
description: string;
|
|
162
|
+
metaTags: Array<{
|
|
163
|
+
property: string;
|
|
164
|
+
content: string;
|
|
165
|
+
}>;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
export type Box = {
|
|
170
|
+
depth: number;
|
|
171
|
+
parentId: string;
|
|
172
|
+
parentSlot: string;
|
|
173
|
+
parentIndex: number;
|
|
174
|
+
width: number;
|
|
175
|
+
height: number;
|
|
176
|
+
top: number;
|
|
177
|
+
left: number;
|
|
178
|
+
};
|
|
179
|
+
export type ElementBoxData = Box & {
|
|
180
|
+
type: "element";
|
|
181
|
+
};
|
|
182
|
+
export type ElementSlotBoxData = Box & {
|
|
183
|
+
type: "element-slot";
|
|
184
|
+
};
|
|
185
|
+
export type BoxData = ElementBoxData | ElementSlotBoxData;
|
|
186
|
+
export type EditorViewportInfo = PreviewViewportInfo & {
|
|
187
|
+
top: number;
|
|
188
|
+
left: number;
|
|
189
|
+
};
|
|
190
|
+
export type PreviewViewportInfo = {
|
|
191
|
+
width: number;
|
|
192
|
+
height: number;
|
|
193
|
+
scrollX: number;
|
|
194
|
+
scrollY: number;
|
|
195
|
+
};
|
|
196
|
+
export type BoxesData = Record<string, BoxData>;
|
|
197
|
+
export type EditorViewportData = {
|
|
198
|
+
boxes: BoxesData;
|
|
199
|
+
viewport: EditorViewportInfo;
|
|
200
|
+
};
|
|
201
|
+
export type PreviewViewportData = {
|
|
202
|
+
boxes: BoxesData;
|
|
203
|
+
viewport: PreviewViewportInfo;
|
|
204
|
+
};
|
|
205
|
+
export type ApiOptions = Record<string, any>;
|
|
206
|
+
export type GetPageOptions = ApiOptions;
|
|
207
|
+
export type ListPagesOptions = ApiOptions;
|
|
208
|
+
export interface IDataProvider {
|
|
209
|
+
getPageByPath(path: string, options?: GetPageOptions): Promise<PublicPage | null>;
|
|
210
|
+
getPageById(id: string, options?: GetPageOptions): Promise<PublicPage | null>;
|
|
211
|
+
listPages(options?: ListPagesOptions): Promise<PublicPage[]>;
|
|
212
|
+
}
|
|
213
|
+
export interface IEnvironment {
|
|
214
|
+
isClient(): boolean;
|
|
215
|
+
isServer(): boolean;
|
|
216
|
+
isPreview(): boolean;
|
|
217
|
+
}
|
|
218
|
+
export interface IContentSdk {
|
|
219
|
+
getPage(path: string): Promise<PublicPage | null>;
|
|
220
|
+
listPages(options?: ListPagesOptions): Promise<PublicPage[]>;
|
|
221
|
+
}
|
|
222
|
+
export type BaseInput<T = any> = {
|
|
223
|
+
name: string;
|
|
224
|
+
type: string;
|
|
225
|
+
onChange?: (bindings: ReturnType<BindingsApi["getPublicApi"]>, context: {
|
|
226
|
+
breakpoint: string;
|
|
227
|
+
}) => void;
|
|
228
|
+
label?: string;
|
|
229
|
+
description?: string;
|
|
230
|
+
helperText?: string;
|
|
231
|
+
defaultValue?: T;
|
|
232
|
+
responsive?: boolean;
|
|
233
|
+
required?: boolean;
|
|
234
|
+
hideFromUi?: boolean;
|
|
235
|
+
renderer?: string;
|
|
236
|
+
list?: boolean;
|
|
237
|
+
translatable?: boolean;
|
|
238
|
+
};
|
|
239
|
+
export type TextInput = BaseInput<string> & {
|
|
240
|
+
type: "text";
|
|
241
|
+
};
|
|
242
|
+
export type SlotInput = BaseInput<any> & {
|
|
243
|
+
type: "slot";
|
|
244
|
+
components?: string[];
|
|
245
|
+
};
|
|
246
|
+
export type TagsInput = BaseInput<string[]> & {
|
|
247
|
+
type: "text";
|
|
248
|
+
};
|
|
249
|
+
export type LongTextInput = BaseInput<string> & {
|
|
250
|
+
type: "longText";
|
|
251
|
+
};
|
|
252
|
+
export type NumberInput = BaseInput<number> & {
|
|
253
|
+
type: "number";
|
|
254
|
+
minValue?: number;
|
|
255
|
+
};
|
|
256
|
+
export type BooleanInput = BaseInput<boolean> & {
|
|
257
|
+
type: "boolean";
|
|
258
|
+
};
|
|
259
|
+
export type ColorInput = BaseInput<string> & {
|
|
260
|
+
type: "color";
|
|
261
|
+
};
|
|
262
|
+
export type FileInput = BaseInput<string> & {
|
|
263
|
+
type: "file";
|
|
264
|
+
allowedFileTypes: string[];
|
|
265
|
+
};
|
|
266
|
+
export type DateTimeInput = BaseInput<string> & {
|
|
267
|
+
type: "datetime";
|
|
268
|
+
};
|
|
269
|
+
export type LexicalInput = BaseInput<string> & {
|
|
270
|
+
type: "lexical";
|
|
271
|
+
};
|
|
272
|
+
export type SelectInput = BaseInput<string> & {
|
|
273
|
+
type: "select";
|
|
274
|
+
options: {
|
|
275
|
+
label: string;
|
|
276
|
+
value: string;
|
|
277
|
+
}[];
|
|
278
|
+
showResetAction?: boolean;
|
|
279
|
+
};
|
|
280
|
+
export type RadioInput = BaseInput<string> & {
|
|
281
|
+
type: "radio";
|
|
282
|
+
options: {
|
|
283
|
+
label: string;
|
|
284
|
+
value: string;
|
|
285
|
+
}[];
|
|
286
|
+
};
|
|
287
|
+
export type ObjectInput = BaseInput<Record<string, any>> & {
|
|
288
|
+
type: "object";
|
|
289
|
+
fields: ComponentInput[];
|
|
290
|
+
};
|
|
291
|
+
export type CustomInput = BaseInput<any> & {
|
|
292
|
+
type: string;
|
|
293
|
+
fields: ComponentInput[];
|
|
294
|
+
};
|
|
295
|
+
export type ComponentInput = TextInput | LongTextInput | NumberInput | BooleanInput | ColorInput | FileInput | DateTimeInput | LexicalInput | SelectInput | RadioInput | TagsInput | ObjectInput | SlotInput | CustomInput;
|
package/types.js
ADDED
package/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type * as CSS from \"csstype\";\nimport type { BindingsApi } from \"~/BindingsApi\";\nimport type { ShorthandCssProperties } from \"./types/ShorthandCssProperties\";\nexport type { WebsiteBuilderTheme, Breakpoint } from \"./types/WebsiteBuilderTheme\";\n\ninterface CSSProperties extends CSS.Properties<string | number> {}\n\nexport type ElementMap = Record<string, DocumentElement>;\n\nexport type DocumentState = Record<string, any>;\n\nexport type InputValueBinding<T = any> = ValueBinding<T> & {\n id: string;\n type: string;\n translatable?: boolean;\n list?: boolean;\n};\n\nexport type StyleValueBinding<T = any> = ValueBinding<T>;\n\nexport type ValueBinding<T = any> = {\n static?: T;\n expression?: string;\n};\n\nexport type RepeatValueBinding = {\n expression: string;\n};\n\nexport type CssProperties = Omit<CSSProperties, ShorthandCssProperties>;\n\nexport type DocumentElementStyleBindings = Partial<{\n [K in keyof CssProperties]: StyleValueBinding<CssProperties[K]>;\n}>;\n\nexport type DocumentElementInputBindings = {\n [inputName: string]: InputValueBinding;\n};\n\nexport type DocumentElementBindings = {\n $repeat?: RepeatValueBinding;\n inputs?: DocumentElementInputBindings;\n styles?: DocumentElementStyleBindings;\n metadata?: Record<string, any>;\n overrides?: {\n [key: string]: {\n inputs?: DocumentElementInputBindings;\n styles?: DocumentElementStyleBindings;\n };\n };\n};\n\nexport type DocumentBindings = {\n [elementId: string]: DocumentElementBindings;\n};\n\nexport type ResolvedComponent<TComponent = any> = {\n component: TComponent;\n inputs: Record<string, any>;\n manifest: ComponentManifest;\n styles: SerializableCSSStyleDeclaration;\n};\n\nexport type ResolvedElement = {\n id: string;\n inputs: Record<string, any>;\n styles: SerializableCSSStyleDeclaration;\n};\n\nexport type Component = {\n component: any;\n manifest: ComponentManifest;\n};\n\nexport type ComponentGroupItem = {\n // Name of the component.\n name: string;\n // Optionally, define an exact element to insert.\n item?: DocumentElementTemplate;\n};\n\nexport type SerializedComponentGroup = ComponentGroup & {\n filter?: string;\n};\n\nexport type ComponentGroupFilterContext = {\n document: EditorDocument;\n};\n\nexport type ComponentGroup = {\n name: string;\n label: string;\n description?: string;\n filter?: (component: ComponentManifest, context: ComponentGroupFilterContext) => boolean;\n};\n\nexport type ResponsiveStyles = {\n [key: string]: SerializableCSSStyleDeclaration;\n};\n\nexport type ComponentManifest = {\n name: string;\n group?: string;\n label?: string;\n image?: string;\n inputs?: ComponentInput[];\n canDrag?: boolean;\n canDelete?: boolean;\n acceptsChildren?: boolean;\n hideFromToolbar?: boolean;\n hideStyleSettings?: string[];\n autoApplyStyles?: boolean;\n tags?: string[];\n defaults?: {\n inputs?: Record<string, any>;\n styles?: SerializableCSSStyleDeclaration;\n overrides?: {\n [breakpoint: string]: {\n inputs?: Record<string, any>;\n styles?: SerializableCSSStyleDeclaration;\n };\n };\n };\n};\n\nexport type DocumentElementTemplate = Omit<DocumentElement, \"id\">;\n\nexport type ElementComponent = {\n name: string;\n};\n\nexport type DocumentElement = {\n type: \"Webiny/Element\";\n id: string;\n component: ElementComponent;\n parent?: {\n id: string;\n slot: string;\n };\n styles?: ResponsiveStyles;\n};\n\nexport type SerializableCSSStyleDeclaration = {\n [K in keyof CssProperties]?: CssProperties[K];\n};\n\nexport type Document = {\n id: string;\n state: DocumentState;\n version: number;\n properties: Record<string, any>;\n bindings: DocumentBindings;\n elements: ElementMap;\n};\n\nexport type PublicPage = Pick<\n Page,\n \"id\" | \"version\" | \"properties\" | \"bindings\" | \"elements\" | \"state\"\n>;\n\nexport type PublicRedirect = {\n id: string;\n from: string;\n to: string;\n permanent: boolean;\n};\n\nexport type EditorPage = EditorDocument & Pick<Page, \"properties\" | \"status\" | \"location\">;\n\nexport type EditorDocument = Document & {\n metadata: Record<string, any>;\n};\n\nexport type Page = Document & {\n id: string;\n status: string;\n version: number;\n location: {\n folderId: string;\n };\n properties: {\n title: string;\n snippet: string;\n /*image: {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n };*/\n path: string;\n tags: string[];\n seo: {\n title: string;\n description: string;\n metaTags: Array<{ name: string; content: string }>;\n };\n social: {\n title: string;\n description: string;\n /*image: {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n };*/\n metaTags: Array<{ property: string; content: string }>;\n };\n };\n};\n\nexport type Box = {\n depth: number;\n parentId: string;\n parentSlot: string;\n parentIndex: number;\n width: number;\n height: number;\n top: number;\n left: number;\n};\n\nexport type ElementBoxData = Box & {\n type: \"element\";\n};\n\nexport type ElementSlotBoxData = Box & {\n type: \"element-slot\";\n};\n\nexport type BoxData = ElementBoxData | ElementSlotBoxData;\n\nexport type EditorViewportInfo = PreviewViewportInfo & {\n top: number;\n left: number;\n};\n\nexport type PreviewViewportInfo = {\n width: number;\n height: number;\n scrollX: number;\n scrollY: number;\n};\n\nexport type BoxesData = Record<string, BoxData>;\n\nexport type EditorViewportData = {\n boxes: BoxesData;\n viewport: EditorViewportInfo;\n};\n\nexport type PreviewViewportData = {\n boxes: BoxesData;\n viewport: PreviewViewportInfo;\n};\n\nexport type ApiOptions = Record<string, any>;\n\nexport type GetPageOptions = ApiOptions;\nexport type ListPagesOptions = ApiOptions;\n\nexport interface IDataProvider {\n getPageByPath(path: string, options?: GetPageOptions): Promise<PublicPage | null>;\n getPageById(id: string, options?: GetPageOptions): Promise<PublicPage | null>;\n listPages(options?: ListPagesOptions): Promise<PublicPage[]>;\n}\n\nexport interface IEnvironment {\n isClient(): boolean;\n isServer(): boolean;\n isPreview(): boolean;\n}\n\nexport interface IContentSdk {\n getPage(path: string): Promise<PublicPage | null>;\n listPages(options?: ListPagesOptions): Promise<PublicPage[]>;\n}\n\n// Input types\n\n// inputTypes.ts\nexport type BaseInput<T = any> = {\n name: string;\n type: string;\n onChange?: (\n bindings: ReturnType<BindingsApi[\"getPublicApi\"]>,\n context: { breakpoint: string }\n ) => void;\n label?: string;\n description?: string;\n helperText?: string;\n defaultValue?: T;\n responsive?: boolean;\n required?: boolean;\n hideFromUi?: boolean;\n renderer?: string;\n list?: boolean;\n translatable?: boolean;\n};\n\n// Discriminated union per input type\nexport type TextInput = BaseInput<string> & {\n type: \"text\";\n};\n\nexport type SlotInput = BaseInput<any> & {\n type: \"slot\";\n components?: string[];\n};\n\nexport type TagsInput = BaseInput<string[]> & {\n type: \"text\";\n};\n\nexport type LongTextInput = BaseInput<string> & {\n type: \"longText\";\n};\n\nexport type NumberInput = BaseInput<number> & {\n type: \"number\";\n minValue?: number;\n};\n\nexport type BooleanInput = BaseInput<boolean> & {\n type: \"boolean\";\n};\n\nexport type ColorInput = BaseInput<string> & {\n type: \"color\";\n};\n\nexport type FileInput = BaseInput<string> & {\n type: \"file\";\n allowedFileTypes: string[];\n};\n\nexport type DateTimeInput = BaseInput<string> & {\n type: \"datetime\";\n};\n\nexport type LexicalInput = BaseInput<string> & {\n type: \"lexical\";\n};\n\nexport type SelectInput = BaseInput<string> & {\n type: \"select\";\n options: { label: string; value: string }[];\n showResetAction?: boolean;\n};\n\nexport type RadioInput = BaseInput<string> & {\n type: \"radio\";\n options: { label: string; value: string }[];\n};\n\nexport type ObjectInput = BaseInput<Record<string, any>> & {\n type: \"object\";\n fields: ComponentInput[];\n};\n\nexport type CustomInput = BaseInput<any> & {\n type: string;\n fields: ComponentInput[];\n};\n\n// Union of all input types\nexport type ComponentInput =\n | TextInput\n | LongTextInput\n | NumberInput\n | BooleanInput\n | ColorInput\n | FileInput\n | DateTimeInput\n | LexicalInput\n | SelectInput\n | RadioInput\n | TagsInput\n | ObjectInput\n | SlotInput\n | CustomInput;\n"],"mappings":"","ignoreList":[]}
|