@webiny/website-builder-sdk 0.0.0-unstable.6f45466a1d → 0.0.0-unstable.7be00a75a9
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.js +29 -36
- package/BindingsApi.js.map +1 -1
- package/BindingsProcessor.js +34 -43
- package/BindingsProcessor.js.map +1 -1
- package/BindingsProcessor.test.js +82 -78
- package/BindingsProcessor.test.js.map +1 -1
- package/BindingsResolver.js +92 -122
- package/BindingsResolver.js.map +1 -1
- package/BindingsResolver.test.js +399 -363
- package/BindingsResolver.test.js.map +1 -1
- package/ComponentInputTraverser.js +28 -49
- package/ComponentInputTraverser.js.map +1 -1
- package/ComponentManifestToAstConverter.js +20 -21
- package/ComponentManifestToAstConverter.js.map +1 -1
- package/ComponentRegistry.js +33 -22
- package/ComponentRegistry.js.map +1 -1
- package/ComponentResolver.js +25 -29
- package/ComponentResolver.js.map +1 -1
- package/ConstraintEvaluator.d.ts +36 -0
- package/ConstraintEvaluator.js +288 -0
- package/ConstraintEvaluator.js.map +1 -0
- package/ConstraintEvaluator.test.d.ts +1 -0
- package/ConstraintEvaluator.test.js +1634 -0
- package/ConstraintEvaluator.test.js.map +1 -0
- package/ContentSdk.d.ts +3 -3
- package/ContentSdk.js +83 -90
- package/ContentSdk.js.map +1 -1
- package/DocumentStore.js +47 -59
- package/DocumentStore.js.map +1 -1
- package/DocumentStoreManager.js +17 -16
- package/DocumentStoreManager.js.map +1 -1
- package/EditingSdk.d.ts +2 -2
- package/EditingSdk.js +87 -121
- package/EditingSdk.js.map +1 -1
- package/ElementFactory.d.ts +2 -3
- package/ElementFactory.js +125 -164
- package/ElementFactory.js.map +1 -1
- package/ElementFactory.test.d.ts +1 -0
- package/ElementFactory.test.js +251 -0
- package/ElementFactory.test.js.map +1 -0
- package/Environment.js +18 -19
- package/Environment.js.map +1 -1
- package/FunctionConverter.js +8 -7
- package/FunctionConverter.js.map +1 -1
- package/HashObject.js +11 -12
- package/HashObject.js.map +1 -1
- package/HotkeyManager.js +41 -48
- package/HotkeyManager.js.map +1 -1
- package/IBindingsUpdater.js +0 -3
- package/IRedirects.js +0 -3
- package/InheritanceProcessor.js +99 -139
- package/InheritanceProcessor.js.map +1 -1
- package/InheritanceProcessor.test.js +178 -179
- package/InheritanceProcessor.test.js.map +1 -1
- package/InheritedValueResolver.js +15 -20
- package/InheritedValueResolver.js.map +1 -1
- package/InputBindingsProcessor.js +187 -289
- package/InputBindingsProcessor.js.map +1 -1
- package/InputsBindingsProcessor.test.js +334 -314
- package/InputsBindingsProcessor.test.js.map +1 -1
- package/InputsUpdater.d.ts +1 -1
- package/InputsUpdater.js +23 -26
- package/InputsUpdater.js.map +1 -1
- package/LiveSdk.d.ts +2 -2
- package/LiveSdk.js +12 -13
- package/LiveSdk.js.map +1 -1
- package/Logger.js +9 -8
- package/Logger.js.map +1 -1
- package/MouseTracker.js +77 -83
- package/MouseTracker.js.map +1 -1
- package/NullSdk.d.ts +4 -3
- package/NullSdk.js +22 -14
- package/NullSdk.js.map +1 -1
- package/PreviewDocument.js +27 -30
- package/PreviewDocument.js.map +1 -1
- package/PreviewSdk.d.ts +2 -2
- package/PreviewSdk.js +16 -17
- package/PreviewSdk.js.map +1 -1
- package/PreviewViewport.js +51 -63
- package/PreviewViewport.js.map +1 -1
- package/ResizeObserver.js +24 -31
- package/ResizeObserver.js.map +1 -1
- package/StylesBindingsProcessor.js +40 -79
- package/StylesBindingsProcessor.js.map +1 -1
- package/StylesUpdater.d.ts +1 -1
- package/StylesUpdater.js +20 -25
- package/StylesUpdater.js.map +1 -1
- package/Theme.js +29 -25
- package/Theme.js.map +1 -1
- package/ViewportManager.js +89 -101
- package/ViewportManager.js.map +1 -1
- package/constants.d.ts +1 -0
- package/constants.js +7 -5
- package/constants.js.map +1 -1
- package/createElement.js +5 -6
- package/createElement.js.map +1 -1
- package/createInput.js +85 -143
- package/createInput.js.map +1 -1
- package/createTheme.js +2 -3
- package/createTheme.js.map +1 -1
- package/dataProviders/ApiClient.js +40 -49
- package/dataProviders/ApiClient.js.map +1 -1
- package/dataProviders/DefaultDataProvider.d.ts +2 -2
- package/dataProviders/DefaultDataProvider.js +55 -44
- package/dataProviders/DefaultDataProvider.js.map +1 -1
- package/dataProviders/GET_PAGE_BY_ID.d.ts +1 -1
- package/dataProviders/GET_PAGE_BY_ID.js +3 -1
- package/dataProviders/GET_PAGE_BY_ID.js.map +1 -1
- package/dataProviders/GET_PAGE_BY_PATH.d.ts +1 -1
- package/dataProviders/GET_PAGE_BY_PATH.js +3 -1
- package/dataProviders/GET_PAGE_BY_PATH.js.map +1 -1
- package/dataProviders/LIST_PUBLISHED_PAGES.d.ts +1 -1
- package/dataProviders/LIST_PUBLISHED_PAGES.js +16 -5
- package/dataProviders/LIST_PUBLISHED_PAGES.js.map +1 -1
- package/dataProviders/NullDataProvider.d.ts +12 -4
- package/dataProviders/NullDataProvider.js +21 -13
- package/dataProviders/NullDataProvider.js.map +1 -1
- package/dataProviders/RedirectsProvider.js +24 -27
- package/dataProviders/RedirectsProvider.js.map +1 -1
- package/defaultBreakpoints.js +23 -22
- package/defaultBreakpoints.js.map +1 -1
- package/documentOperations/$addElementReferenceToParent.d.ts +1 -1
- package/documentOperations/$addElementReferenceToParent.js +30 -26
- package/documentOperations/$addElementReferenceToParent.js.map +1 -1
- package/documentOperations/AddElement.js +8 -7
- package/documentOperations/AddElement.js.map +1 -1
- package/documentOperations/AddToParent.d.ts +2 -2
- package/documentOperations/AddToParent.js +14 -13
- package/documentOperations/AddToParent.js.map +1 -1
- package/documentOperations/IDocumentOperation.js +0 -3
- package/documentOperations/RemoveElement.js +10 -7
- package/documentOperations/RemoveElement.js.map +1 -1
- package/documentOperations/SetGlobalInputBinding.js +23 -22
- package/documentOperations/SetGlobalInputBinding.js.map +1 -1
- package/documentOperations/SetGlobalStyleBinding.js +23 -23
- package/documentOperations/SetGlobalStyleBinding.js.map +1 -1
- package/documentOperations/SetInputBindingOverride.js +30 -29
- package/documentOperations/SetInputBindingOverride.js.map +1 -1
- package/documentOperations/SetStyleBindingOverride.js +30 -31
- package/documentOperations/SetStyleBindingOverride.js.map +1 -1
- package/documentOperations/index.js +9 -8
- package/documentOperations/index.js.map +1 -1
- package/findMatchingAstNode.js +11 -13
- package/findMatchingAstNode.js.map +1 -1
- package/generateElementId.js +2 -2
- package/generateElementId.js.map +1 -1
- package/headersProvider.js +4 -3
- package/headersProvider.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -2
- package/jsonPatch.js +5 -9
- package/jsonPatch.js.map +1 -1
- package/messages.js +12 -11
- package/messages.js.map +1 -1
- package/messenger/MessageOrigin.js +12 -11
- package/messenger/MessageOrigin.js.map +1 -1
- package/messenger/Messenger.js +58 -71
- package/messenger/Messenger.js.map +1 -1
- package/messenger/index.js +0 -2
- package/package.json +16 -16
- package/registerComponentGroup.js +5 -6
- package/registerComponentGroup.js.map +1 -1
- package/types/ShorthandCssProperties.js +0 -3
- package/types/WebsiteBuilderTheme.d.ts +7 -0
- package/types/WebsiteBuilderTheme.js +0 -3
- package/types.d.ts +173 -11
- package/types.js +0 -3
- package/IBindingsUpdater.js.map +0 -1
- package/IRedirects.js.map +0 -1
- package/documentOperations/IDocumentOperation.js.map +0 -1
- package/index.js.map +0 -1
- package/messenger/index.js.map +0 -1
- package/types/ShorthandCssProperties.js.map +0 -1
- package/types/WebsiteBuilderTheme.js.map +0 -1
- package/types.js.map +0 -1
package/types.d.ts
CHANGED
|
@@ -2,10 +2,12 @@ import type * as CSS from "csstype";
|
|
|
2
2
|
import type { BindingsApi } from "./BindingsApi.js";
|
|
3
3
|
import type { ShorthandCssProperties } from "./types/ShorthandCssProperties.js";
|
|
4
4
|
import type { InputFactory } from "./createInput.js";
|
|
5
|
+
import type { Breakpoint } from "./types/WebsiteBuilderTheme.js";
|
|
5
6
|
export type { WebsiteBuilderTheme, Breakpoint } from "./types/WebsiteBuilderTheme.js";
|
|
6
7
|
type CSSProperties = CSS.Properties<string | number>;
|
|
7
8
|
export type ElementMap = Record<string, DocumentElement>;
|
|
8
9
|
export type DocumentState = Record<string, any>;
|
|
10
|
+
export type DocumentMetadata = Record<string, any>;
|
|
9
11
|
export type InputValueBinding<T = any> = ValueBinding<T> & {
|
|
10
12
|
id: string;
|
|
11
13
|
type: string;
|
|
@@ -80,19 +82,126 @@ export type ComponentGroup = {
|
|
|
80
82
|
export type ResponsiveStyles = {
|
|
81
83
|
[key: string]: SerializableCSSStyleDeclaration;
|
|
82
84
|
};
|
|
85
|
+
export type ConstraintElementContext = {
|
|
86
|
+
/** Component name (e.g., "FunnelBuilder/Step") */
|
|
87
|
+
name: string;
|
|
88
|
+
/** Component tags */
|
|
89
|
+
tags: string[];
|
|
90
|
+
/** Get the parent element context. undefined for root. */
|
|
91
|
+
getParent(): ConstraintElementContext | undefined;
|
|
92
|
+
/** Index of this element among siblings in the same parent slot. -1 if not in a list slot. */
|
|
93
|
+
childIndex(): number;
|
|
94
|
+
/** Total siblings in the same parent slot. -1 if not in a list slot. */
|
|
95
|
+
childCount(): number;
|
|
96
|
+
/** True if this element is the last among siblings in its parent slot. */
|
|
97
|
+
isLastChild(): boolean;
|
|
98
|
+
/** True if this element is the first among siblings in its parent slot. */
|
|
99
|
+
isFirstChild(): boolean;
|
|
100
|
+
};
|
|
101
|
+
export type ConstraintContext = {
|
|
102
|
+
/** The component/element this constraint is about */
|
|
103
|
+
component: ConstraintElementContext;
|
|
104
|
+
/** The direct parent element at the drop target */
|
|
105
|
+
parent: ConstraintElementContext;
|
|
106
|
+
/** The target slot name (e.g., "children", "leftColumn", "rightColumn") */
|
|
107
|
+
slot: string;
|
|
108
|
+
/** True if the direct parent is the given component */
|
|
109
|
+
isChildOf: (componentName: string) => boolean;
|
|
110
|
+
/** True if any ancestor (including parent) is the given component */
|
|
111
|
+
isDescendantOf: (componentName: string) => boolean;
|
|
112
|
+
/** Find the nearest ancestor matching a component name */
|
|
113
|
+
getAncestor: (componentName: string) => ConstraintElementContext | undefined;
|
|
114
|
+
/** True if the component being placed has the given tag */
|
|
115
|
+
hasTag: (tag: string) => boolean;
|
|
116
|
+
/** Number of items currently in the target slot */
|
|
117
|
+
slotChildCount: () => number;
|
|
118
|
+
/** Count instances of a component type in the entire document */
|
|
119
|
+
countInstances: (componentName: string) => number;
|
|
120
|
+
/** True if the component has any descendant element carrying the given tag */
|
|
121
|
+
hasDescendantWithTag: (tag: string) => boolean;
|
|
122
|
+
/** Returns the resolved inputs of the nearest ancestor matching componentName, or undefined */
|
|
123
|
+
getAncestorInputs: (componentName: string) => Record<string, any> | undefined;
|
|
124
|
+
/** Returns the resolved inputs of the element this constraint is evaluating */
|
|
125
|
+
getElementInputs: () => Record<string, any>;
|
|
126
|
+
/** Debug logger — safe to call inside serialized constraints */
|
|
127
|
+
log: (...args: any[]) => void;
|
|
128
|
+
/** Block placement with an error message shown to the user */
|
|
129
|
+
block: (message: string) => never;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* A constraint function. Call `ctx.block("message")` to block placement.
|
|
133
|
+
* Returning without blocking means the constraint passes.
|
|
134
|
+
*/
|
|
135
|
+
export type ComponentConstraint = (ctx: ConstraintContext) => void;
|
|
136
|
+
export type Stop = symbol;
|
|
137
|
+
export type Continue = symbol;
|
|
138
|
+
export type HandlerResult = void | Stop | Continue;
|
|
139
|
+
export type OnChangeAction = "create" | "update" | "delete";
|
|
140
|
+
export type OnChangeElementContext = {
|
|
141
|
+
id: string;
|
|
142
|
+
component: ComponentManifest;
|
|
143
|
+
inputs: Record<string, any>;
|
|
144
|
+
};
|
|
145
|
+
export type ManifestAncestorContext = {
|
|
146
|
+
id: string;
|
|
147
|
+
component: ComponentManifest;
|
|
148
|
+
inputs: Record<string, any>;
|
|
149
|
+
updateInputs: (cb: (inputs: Record<string, any>) => void) => void;
|
|
150
|
+
getElement: (id: string) => OnChangeElementContext | undefined;
|
|
151
|
+
};
|
|
152
|
+
export type ComponentChangeContext<TInputs = Record<string, any>> = {
|
|
153
|
+
action: OnChangeAction;
|
|
154
|
+
id: string;
|
|
155
|
+
component: ComponentManifest;
|
|
156
|
+
inputs: TInputs;
|
|
157
|
+
styles: Record<string, any>;
|
|
158
|
+
getAncestor: (componentName: string) => ManifestAncestorContext | undefined;
|
|
159
|
+
getElement: (id: string) => OnChangeElementContext | undefined;
|
|
160
|
+
createElement: (params: any) => any;
|
|
161
|
+
executeCommand: <T = unknown>(command: string, payload?: T) => void;
|
|
162
|
+
breakpoint: string;
|
|
163
|
+
log: (...args: any[]) => void;
|
|
164
|
+
stop: () => Stop;
|
|
165
|
+
continue: () => Continue;
|
|
166
|
+
};
|
|
167
|
+
export type DescendantChangeContext<TInputs = Record<string, any>, TDescendantInputs = Record<string, any>> = {
|
|
168
|
+
action: OnChangeAction;
|
|
169
|
+
descendant: {
|
|
170
|
+
component: ComponentManifest;
|
|
171
|
+
id: string;
|
|
172
|
+
inputs: TDescendantInputs;
|
|
173
|
+
updateInputs: (cb: (inputs: TDescendantInputs) => void) => void;
|
|
174
|
+
};
|
|
175
|
+
inputs: TInputs;
|
|
176
|
+
updateInputs: (cb: (inputs: TInputs) => void) => void;
|
|
177
|
+
getElement: (id: string) => OnChangeElementContext | undefined;
|
|
178
|
+
executeCommand: <T = unknown>(command: string, payload?: T) => void;
|
|
179
|
+
breakpoint: string;
|
|
180
|
+
log: (...args: any[]) => void;
|
|
181
|
+
stop: () => Stop;
|
|
182
|
+
continue: () => Continue;
|
|
183
|
+
};
|
|
184
|
+
export type ComponentChangeHandler<TInputs = Record<string, any>> = (ctx: ComponentChangeContext<TInputs>) => HandlerResult;
|
|
185
|
+
export type DescendantChangeHandler<TInputs = Record<string, any>, TDescendantInputs = Record<string, any>> = (ctx: DescendantChangeContext<TInputs, TDescendantInputs>) => HandlerResult;
|
|
83
186
|
export type ComponentManifest = {
|
|
84
187
|
name: string;
|
|
85
188
|
group?: string;
|
|
86
189
|
label?: string;
|
|
190
|
+
aiContext?: string;
|
|
191
|
+
useInAiContentGeneration?: boolean;
|
|
87
192
|
image?: string;
|
|
88
193
|
inputs: ComponentInput[];
|
|
89
194
|
canDrag?: boolean;
|
|
90
|
-
canDelete?: boolean;
|
|
195
|
+
canDelete?: boolean | ComponentConstraint;
|
|
91
196
|
acceptsChildren?: boolean;
|
|
92
197
|
hideFromToolbar?: boolean;
|
|
93
198
|
hideStyleSettings?: string[];
|
|
94
199
|
autoApplyStyles?: boolean;
|
|
95
|
-
tags
|
|
200
|
+
tags: string[];
|
|
201
|
+
constraints?: ComponentConstraint[];
|
|
202
|
+
descendantConstraints?: ComponentConstraint[];
|
|
203
|
+
onChange?: ComponentChangeHandler | ComponentChangeHandler[];
|
|
204
|
+
onDescendantChange?: DescendantChangeHandler | DescendantChangeHandler[];
|
|
96
205
|
defaults?: {
|
|
97
206
|
inputs?: Record<string, any>;
|
|
98
207
|
styles?: SerializableCSSStyleDeclaration;
|
|
@@ -126,10 +235,14 @@ export type Document = {
|
|
|
126
235
|
state: DocumentState;
|
|
127
236
|
version: number;
|
|
128
237
|
properties: Record<string, any>;
|
|
238
|
+
extensions: Record<string, any>;
|
|
239
|
+
metadata: DocumentMetadata;
|
|
129
240
|
bindings: DocumentBindings;
|
|
130
241
|
elements: ElementMap;
|
|
131
242
|
};
|
|
132
|
-
export type PublicPage = Pick<Page, "id" | "version" | "properties" | "bindings" | "elements" | "extensions" | "state"
|
|
243
|
+
export type PublicPage = Pick<Page, "id" | "version" | "properties" | "bindings" | "elements" | "extensions" | "metadata" | "state"> & {
|
|
244
|
+
languagePaths: Record<string, string>;
|
|
245
|
+
};
|
|
133
246
|
export type PublicRedirect = {
|
|
134
247
|
id: string;
|
|
135
248
|
from: string;
|
|
@@ -137,9 +250,10 @@ export type PublicRedirect = {
|
|
|
137
250
|
permanent: boolean;
|
|
138
251
|
};
|
|
139
252
|
export type EditorPage = EditorDocument & Pick<Page, "properties" | "status" | "location">;
|
|
140
|
-
export
|
|
141
|
-
|
|
142
|
-
}
|
|
253
|
+
export interface EditorOptions {
|
|
254
|
+
isReadOnly?: boolean;
|
|
255
|
+
}
|
|
256
|
+
export type EditorDocument = Document;
|
|
143
257
|
export type Page = Document & {
|
|
144
258
|
id: string;
|
|
145
259
|
status: string;
|
|
@@ -150,7 +264,18 @@ export type Page = Document & {
|
|
|
150
264
|
properties: {
|
|
151
265
|
title: string;
|
|
152
266
|
snippet: string;
|
|
267
|
+
image: {
|
|
268
|
+
id: string;
|
|
269
|
+
name: string;
|
|
270
|
+
size: number;
|
|
271
|
+
mimeType: string;
|
|
272
|
+
src: string;
|
|
273
|
+
width: number;
|
|
274
|
+
height: number;
|
|
275
|
+
};
|
|
153
276
|
path: string;
|
|
277
|
+
language?: string;
|
|
278
|
+
sourcePage?: string;
|
|
154
279
|
tags: string[];
|
|
155
280
|
seo: {
|
|
156
281
|
title: string;
|
|
@@ -159,10 +284,23 @@ export type Page = Document & {
|
|
|
159
284
|
name: string;
|
|
160
285
|
content: string;
|
|
161
286
|
}>;
|
|
287
|
+
canonicalUrl: string;
|
|
288
|
+
noIndex: boolean;
|
|
289
|
+
noFollow: boolean;
|
|
290
|
+
structuredSchema: string;
|
|
162
291
|
};
|
|
163
292
|
social: {
|
|
164
293
|
title: string;
|
|
165
294
|
description: string;
|
|
295
|
+
image: {
|
|
296
|
+
id: string;
|
|
297
|
+
name: string;
|
|
298
|
+
size: number;
|
|
299
|
+
mimeType: string;
|
|
300
|
+
src: string;
|
|
301
|
+
width: number;
|
|
302
|
+
height: number;
|
|
303
|
+
};
|
|
166
304
|
metaTags: Array<{
|
|
167
305
|
property: string;
|
|
168
306
|
content: string;
|
|
@@ -170,6 +308,7 @@ export type Page = Document & {
|
|
|
170
308
|
};
|
|
171
309
|
};
|
|
172
310
|
extensions: Record<string, any>;
|
|
311
|
+
metadata: DocumentMetadata;
|
|
173
312
|
};
|
|
174
313
|
export type Box = {
|
|
175
314
|
depth: number;
|
|
@@ -191,6 +330,8 @@ export type BoxData = ElementBoxData | ElementSlotBoxData;
|
|
|
191
330
|
export type EditorViewportInfo = PreviewViewportInfo & {
|
|
192
331
|
top: number;
|
|
193
332
|
left: number;
|
|
333
|
+
breakpoint: string;
|
|
334
|
+
breakpoints: Breakpoint[];
|
|
194
335
|
};
|
|
195
336
|
export type PreviewViewportInfo = {
|
|
196
337
|
width: number;
|
|
@@ -211,11 +352,26 @@ export type PreviewViewportData = {
|
|
|
211
352
|
};
|
|
212
353
|
export type ApiOptions = Record<string, any>;
|
|
213
354
|
export type GetPageOptions = ApiOptions;
|
|
214
|
-
export
|
|
355
|
+
export interface ListPagesOptions {
|
|
356
|
+
where?: Record<string, any>;
|
|
357
|
+
limit?: number;
|
|
358
|
+
after?: string;
|
|
359
|
+
sort?: string[];
|
|
360
|
+
search?: string;
|
|
361
|
+
}
|
|
362
|
+
export interface ListPagesMeta {
|
|
363
|
+
hasMoreItems: boolean;
|
|
364
|
+
totalCount: number;
|
|
365
|
+
cursor: string | null;
|
|
366
|
+
}
|
|
367
|
+
export interface ListPagesResult {
|
|
368
|
+
data: Array<Omit<PublicPage, "elements" | "bindings">>;
|
|
369
|
+
meta: ListPagesMeta;
|
|
370
|
+
}
|
|
215
371
|
export interface IDataProvider {
|
|
216
372
|
getPageByPath(path: string, options?: GetPageOptions): Promise<PublicPage | null>;
|
|
217
373
|
getPageById(id: string, options?: GetPageOptions): Promise<PublicPage | null>;
|
|
218
|
-
listPages(options?: ListPagesOptions): Promise<
|
|
374
|
+
listPages(options?: ListPagesOptions): Promise<ListPagesResult>;
|
|
219
375
|
}
|
|
220
376
|
export interface IEnvironment {
|
|
221
377
|
isClient(): boolean;
|
|
@@ -224,7 +380,7 @@ export interface IEnvironment {
|
|
|
224
380
|
}
|
|
225
381
|
export interface IContentSdk {
|
|
226
382
|
getPage(path: string): Promise<PublicPage | null>;
|
|
227
|
-
listPages(options?: ListPagesOptions): Promise<
|
|
383
|
+
listPages(options?: ListPagesOptions): Promise<ListPagesResult>;
|
|
228
384
|
}
|
|
229
385
|
export type BaseInput<T = any> = {
|
|
230
386
|
name: string;
|
|
@@ -310,10 +466,16 @@ export type ManifestInputsObject<TInputs, TAllowChildren extends boolean> = TAll
|
|
|
310
466
|
} : {
|
|
311
467
|
[K in keyof TInputs]: InputFactory<K & string>;
|
|
312
468
|
};
|
|
313
|
-
export type ComponentManifestInput<TInputs> = (Omit<ComponentManifest, "inputs" | "acceptsChildren"> & {
|
|
469
|
+
export type ComponentManifestInput<TInputs> = (Omit<ComponentManifest, "inputs" | "acceptsChildren" | "tags" | "onChange" | "onDescendantChange"> & {
|
|
314
470
|
acceptsChildren: true;
|
|
471
|
+
tags?: string[];
|
|
315
472
|
inputs?: ManifestInputsArray<TInputs, true> | ManifestInputsObject<TInputs, true>;
|
|
316
|
-
|
|
473
|
+
onChange?: ComponentChangeHandler<TInputs> | ComponentChangeHandler<TInputs>[];
|
|
474
|
+
onDescendantChange?: DescendantChangeHandler<TInputs> | DescendantChangeHandler<TInputs>[];
|
|
475
|
+
}) | (Omit<ComponentManifest, "inputs" | "acceptsChildren" | "tags" | "onChange" | "onDescendantChange"> & {
|
|
317
476
|
acceptsChildren?: false;
|
|
477
|
+
tags?: string[];
|
|
318
478
|
inputs: ManifestInputsArray<TInputs, false> | ManifestInputsObject<TInputs, false>;
|
|
479
|
+
onChange?: ComponentChangeHandler<TInputs> | ComponentChangeHandler<TInputs>[];
|
|
480
|
+
onDescendantChange?: DescendantChangeHandler<TInputs> | DescendantChangeHandler<TInputs>[];
|
|
319
481
|
});
|
package/types.js
CHANGED
package/IBindingsUpdater.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["IBindingsUpdater.ts"],"sourcesContent":["import type { JsonPatchOperation } from \"~/jsonPatch.js\";\nimport type { Document, DocumentElementBindings } from \"~/types.js\";\n\nexport interface IBindingsUpdater {\n applyToDocument(document: Document): void;\n createJsonPatch(bindings: DocumentElementBindings): JsonPatchOperation[];\n}\n"],"mappings":"","ignoreList":[]}
|
package/IRedirects.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["IRedirects.ts"],"sourcesContent":["import type { PublicRedirect } from \"~/types.js\";\n\nexport interface IRedirects {\n getAllRedirects(): Promise<Map<string, PublicRedirect>>;\n getRedirectByPath(path: string): Promise<PublicRedirect | undefined>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["IDocumentOperation.ts"],"sourcesContent":["import type { Document } from \"~/types.js\";\n\nexport interface IDocumentOperation {\n apply(document: Document): void;\n}\n"],"mappings":"","ignoreList":[]}
|
package/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["StyleSettings"],"sources":["index.ts"],"sourcesContent":["export * from \"./createTheme.js\";\nexport * from \"./EditingSdk.js\";\nexport * from \"./LiveSdk.js\";\nexport * from \"./NullSdk.js\";\nexport * from \"./ContentSdk.js\";\nexport * from \"./Environment.js\";\nexport * from \"./DocumentStore.js\";\nexport * from \"./Logger.js\";\nexport * from \"./FunctionConverter.js\";\nexport * from \"./createInput.js\";\nexport * from \"./MouseTracker.js\";\nexport * from \"./ViewportManager.js\";\nexport * from \"./messenger/Messenger.js\";\nexport * from \"./messenger/MessageOrigin.js\";\nexport type * from \"./types.js\";\nexport * from \"./DocumentStoreManager.js\";\nexport * from \"./BindingsProcessor.js\";\nexport * from \"./ResizeObserver.js\";\nexport * from \"./BindingsResolver.js\";\nexport * from \"./createElement.js\";\nexport * from \"./registerComponentGroup.js\";\nexport * from \"./jsonPatch.js\";\nexport * from \"./headersProvider.js\";\nexport * from \"./ComponentManifestToAstConverter.js\";\nexport * from \"./findMatchingAstNode.js\";\nexport * from \"./InheritanceProcessor.js\";\nexport * from \"./InputBindingsProcessor.js\";\nexport * from \"./StylesBindingsProcessor.js\";\nexport * from \"./ElementFactory.js\";\nexport { StyleSettings } from \"./constants.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAa","ignoreList":[]}
|
package/messenger/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./MessageOrigin.js\";\nexport * from \"./Messenger.js\";\n"],"mappings":"AAAA;AACA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["ShorthandCssProperties.ts"],"sourcesContent":["export type ShorthandCssProperties =\n | \"margin\"\n | \"padding\"\n | \"border\"\n | \"borderWidth\"\n | \"borderStyle\"\n | \"borderColor\"\n | \"borderRadius\"\n | \"outline\"\n | \"outlineOffset\"\n | \"inset\"\n | \"background\"\n | \"borderBlock\"\n | \"borderBlockColor\"\n | \"borderBlockStyle\"\n | \"borderBlockWidth\"\n | \"borderInline\"\n | \"borderInlineColor\"\n | \"borderInlineStyle\"\n | \"borderInlineWidth\"\n | \"borderStartEndRadius\"\n | \"borderStartStartRadius\"\n | \"borderEndEndRadius\"\n | \"borderEndStartRadius\"\n | \"font\"\n | \"fontVariant\"\n | \"textDecoration\"\n | \"textEmphasis\"\n | \"textEmphasisStyle\"\n | \"textEmphasisColor\"\n | \"flex\"\n | \"flexFlow\"\n | \"gap\"\n | \"placeContent\"\n | \"placeItems\"\n | \"placeSelf\"\n | \"grid\"\n | \"listStyle\"\n | \"marker\"\n | \"columns\"\n | \"columnRule\"\n | \"animation\"\n | \"transition\"\n | \"boxShadow\"\n | \"textShadow\"\n | \"scrollMargin\"\n | \"scrollPadding\"\n | \"size\"\n | \"aspectRatio\";\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["WebsiteBuilderTheme.ts"],"sourcesContent":["export type Breakpoint = {\n name: string;\n title: string;\n description: string;\n icon: string;\n minWidth: number;\n maxWidth: number;\n};\n\nexport type WebsiteBuilderTheme = {\n css?: string;\n fonts?: string[];\n breakpoints: Breakpoint[];\n colors: ColorStyle[];\n typography: Typography;\n};\ntype KnownKeys = \"desktop\" | \"tablet\" | \"mobile\";\n\ntype BreakpointBase = Omit<Breakpoint, \"name\">;\n\ntype KnownBreakpoints = Partial<Record<KnownKeys, Partial<BreakpointBase>>>;\n\n// This merges both, while avoiding overlap issues\ntype Breakpoints = KnownBreakpoints & {\n custom?: {\n [K in string as K extends KnownKeys ? never : K]: BreakpointBase;\n };\n};\n\nexport type ColorStyle = {\n id: string;\n label: string;\n value: string;\n};\n\nexport type TypographyStyle = {\n id: string;\n label: string;\n tag: string;\n className: string;\n};\n\nexport type Typography = Record<string, TypographyStyle[]>;\n\nexport type WebsiteBuilderThemeInput = {\n /**\n * CSS to include in the editor.\n */\n css?: string;\n /**\n * Fonts to load when the editor loads.\n */\n fonts?: string[];\n /**\n * {\n * title: \"Desktop\",\n * description: `Desktop styles apply at all breakpoints, unless they're edited at a lower breakpoint. Start your styling here.`,\n * icon: \"Inline SVG or a link to an SVG.\",\n * minWidth: 0,\n * maxWidth: 4000\n * }\n */\n breakpoints?: Breakpoints;\n /**\n * [\n * {\n * id: \"primary\",\n * label: \"Primary\",\n * value: \"#000000\"\n * },\n * ]\n */\n colors?: ColorStyle[];\n /**\n * headings: [\n * {\n * id: \"heading1\",\n * name: \"Heading 1\",\n * tag: \"h1\"\n * },\n * ],\n * paragraphs: [\n * {\n * id: \"paragraph1\",\n * name: \"Paragraph 1\",\n * tag: \"p\",\n * ],\n * quotes: [\n * {\n * id: \"quote\",\n * name: \"Quote\",\n * tag: \"blockquote\"\n * }\n * ]\n */\n typography?: Typography;\n};\n"],"mappings":"","ignoreList":[]}
|
package/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type * as CSS from \"csstype\";\nimport type { BindingsApi } from \"~/BindingsApi.js\";\nimport type { ShorthandCssProperties } from \"./types/ShorthandCssProperties.js\";\nimport type { InputFactory } from \"~/createInput.js\";\nexport type { WebsiteBuilderTheme, Breakpoint } from \"./types/WebsiteBuilderTheme.js\";\n\ntype CSSProperties = 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 ComponentBlueprint<TComponent = any, TManifest = any> = {\n component: TComponent;\n manifest: TManifest;\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\" | \"extensions\" | \"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 extensions: Record<string, any>;\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 // Viewport width (only the visible part)\n width: number;\n // Viewport height (only the visible part)\n height: number;\n // Full iframe width\n scrollWidth: number;\n // Full iframe height\n scrollHeight: number;\n // Iframe horizontal scroll offset\n scrollX: number;\n // Iframe vertical scroll offest\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\nexport type ManifestInputsArray<\n TInputs,\n TAllowChildren extends boolean\n> = TAllowChildren extends true\n ? {\n [K in Exclude<keyof TInputs, \"children\">]: InputFactory<K & string>;\n }[Exclude<keyof TInputs, \"children\">][]\n : {\n [K in keyof TInputs]: InputFactory<K & string>;\n }[keyof TInputs][];\n\nexport type ManifestInputsObject<\n TInputs,\n TAllowChildren extends boolean\n> = TAllowChildren extends true\n ? { [K in Exclude<keyof TInputs, \"children\">]: InputFactory<K & string> }\n : { [K in keyof TInputs]: InputFactory<K & string> };\n\nexport type ComponentManifestInput<TInputs> =\n | (Omit<ComponentManifest, \"inputs\" | \"acceptsChildren\"> & {\n acceptsChildren: true;\n inputs?: ManifestInputsArray<TInputs, true> | ManifestInputsObject<TInputs, true>;\n })\n | (Omit<ComponentManifest, \"inputs\" | \"acceptsChildren\"> & {\n acceptsChildren?: false;\n inputs: ManifestInputsArray<TInputs, false> | ManifestInputsObject<TInputs, false>;\n });\n"],"mappings":"","ignoreList":[]}
|