@webiny/website-builder-sdk 0.0.0-unstable.e6f0dc8ca7 → 0.0.0-unstable.eb81deee7e
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.d.ts +4 -1
- package/BindingsResolver.js +99 -119
- package/BindingsResolver.js.map +1 -1
- package/BindingsResolver.test.js +399 -363
- package/BindingsResolver.test.js.map +1 -1
- package/ComponentInputTraverser.js +32 -49
- package/ComponentInputTraverser.js.map +1 -1
- package/ComponentManifestToAstConverter.js +20 -21
- package/ComponentManifestToAstConverter.js.map +1 -1
- package/ComponentRegistry.d.ts +9 -0
- package/ComponentRegistry.js +30 -44
- package/ComponentRegistry.js.map +1 -1
- package/ComponentResolver.d.ts +3 -2
- package/ComponentResolver.js +39 -29
- package/ComponentResolver.js.map +1 -1
- package/ComponentResolver.test.d.ts +1 -0
- package/ComponentResolver.test.js +81 -0
- package/ComponentResolver.test.js.map +1 -0
- package/ConstraintEvaluator.js +246 -353
- package/ConstraintEvaluator.js.map +1 -1
- package/ConstraintEvaluator.test.js +1616 -1438
- package/ConstraintEvaluator.test.js.map +1 -1
- package/ContentSdk.d.ts +14 -0
- package/ContentSdk.js +113 -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.js +92 -121
- package/EditingSdk.js.map +1 -1
- package/ElementFactory.js +164 -172
- package/ElementFactory.js.map +1 -1
- package/ElementFactory.objectListDefaults.test.d.ts +1 -0
- package/ElementFactory.objectListDefaults.test.js +423 -0
- package/ElementFactory.objectListDefaults.test.js.map +1 -0
- package/ElementFactory.test.js +335 -262
- package/ElementFactory.test.js.map +1 -1
- 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 -26
- package/HashObject.js.map +1 -1
- package/HotkeyManager.js +40 -47
- 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.d.ts +18 -1
- package/InheritedValueResolver.js +18 -20
- package/InheritedValueResolver.js.map +1 -1
- package/InputBindingsProcessor.d.ts +23 -2
- package/InputBindingsProcessor.js +200 -307
- package/InputBindingsProcessor.js.map +1 -1
- package/InputBindingsProcessorTokens.test.d.ts +1 -0
- package/InputBindingsProcessorTokens.test.js +400 -0
- package/InputBindingsProcessorTokens.test.js.map +1 -0
- package/InputsBindingsProcessor.test.js +334 -315
- package/InputsBindingsProcessor.test.js.map +1 -1
- package/InputsUpdater.js +23 -26
- package/InputsUpdater.js.map +1 -1
- 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.js +22 -21
- package/NullSdk.js.map +1 -1
- package/PreviewDocument.d.ts +1 -0
- package/PreviewDocument.js +30 -30
- package/PreviewDocument.js.map +1 -1
- package/PreviewSdk.d.ts +2 -1
- package/PreviewSdk.js +19 -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.d.ts +12 -2
- package/StylesBindingsProcessor.js +62 -79
- package/StylesBindingsProcessor.js.map +1 -1
- package/StylesUpdater.js +20 -25
- package/StylesUpdater.js.map +1 -1
- package/Theme.js +30 -25
- package/Theme.js.map +1 -1
- package/ViewportManager.js +89 -101
- package/ViewportManager.js.map +1 -1
- package/assertBindingShapes.d.ts +31 -0
- package/assertBindingShapes.js +64 -0
- package/assertBindingShapes.js.map +1 -0
- package/assertBindingShapes.test.d.ts +1 -0
- package/assertBindingShapes.test.js +131 -0
- package/assertBindingShapes.test.js.map +1 -0
- package/asset/deliveryUrl.d.ts +41 -0
- package/asset/deliveryUrl.js +34 -0
- package/asset/deliveryUrl.js.map +1 -0
- package/asset/deliveryUrl.test.d.ts +1 -0
- package/asset/deliveryUrl.test.js +127 -0
- package/asset/deliveryUrl.test.js.map +1 -0
- package/asset/geometry.d.ts +7 -0
- package/asset/geometry.js +10 -0
- package/asset/geometry.js.map +1 -0
- package/asset/imageSrcSet.d.ts +63 -0
- package/asset/imageSrcSet.js +98 -0
- package/asset/imageSrcSet.js.map +1 -0
- package/asset/imageSrcSet.test.d.ts +1 -0
- package/asset/imageSrcSet.test.js +103 -0
- package/asset/imageSrcSet.test.js.map +1 -0
- package/asset/index.d.ts +5 -0
- package/asset/index.js +5 -0
- package/asset/normalize.d.ts +24 -0
- package/asset/normalize.js +106 -0
- package/asset/normalize.js.map +1 -0
- package/asset/normalize.test.d.ts +1 -0
- package/asset/normalize.test.js +263 -0
- package/asset/normalize.test.js.map +1 -0
- package/asset/types.d.ts +2 -0
- package/asset/types.js +0 -0
- package/constants.js +7 -6
- package/constants.js.map +1 -1
- package/contentEntry/ContentEntryBindingsResolver.d.ts +30 -0
- package/contentEntry/ContentEntryBindingsResolver.js +45 -0
- package/contentEntry/ContentEntryBindingsResolver.js.map +1 -0
- package/contentEntry/ContentEntryCache.d.ts +46 -0
- package/contentEntry/ContentEntryCache.js +50 -0
- package/contentEntry/ContentEntryCache.js.map +1 -0
- package/contentEntry/resolveContentEntry.d.ts +74 -0
- package/contentEntry/resolveContentEntry.js +53 -0
- package/contentEntry/resolveContentEntry.js.map +1 -0
- package/contentEntry/resolveContentEntry.test.d.ts +1 -0
- package/contentEntry/resolveContentEntry.test.js +213 -0
- package/contentEntry/resolveContentEntry.test.js.map +1 -0
- package/createComponent.d.ts +5 -0
- package/createComponent.js +32 -0
- package/createComponent.js.map +1 -0
- package/createElement.js +5 -6
- package/createElement.js.map +1 -1
- package/createInput.d.ts +10 -2
- package/createInput.js +92 -143
- package/createInput.js.map +1 -1
- package/createTheme.js +2 -3
- package/createTheme.js.map +1 -1
- package/dataProviders/ApiClient.d.ts +10 -5
- package/dataProviders/ApiClient.js +40 -49
- package/dataProviders/ApiClient.js.map +1 -1
- package/dataProviders/DefaultDataProvider.d.ts +4 -0
- package/dataProviders/DefaultDataProvider.js +91 -58
- package/dataProviders/DefaultDataProvider.js.map +1 -1
- package/dataProviders/GET_EXPERIMENT_PAUSED.d.ts +1 -0
- package/dataProviders/GET_EXPERIMENT_PAUSED.js +17 -0
- package/dataProviders/GET_EXPERIMENT_PAUSED.js.map +1 -0
- package/dataProviders/GET_PAGE_BY_ID.js +2 -1
- package/dataProviders/GET_PAGE_BY_ID.js.map +1 -1
- package/dataProviders/GET_PAGE_BY_PATH.js +2 -1
- package/dataProviders/GET_PAGE_BY_PATH.js.map +1 -1
- package/dataProviders/GET_PAGE_EXPERIMENT.d.ts +1 -0
- package/dataProviders/GET_PAGE_EXPERIMENT.js +32 -0
- package/dataProviders/GET_PAGE_EXPERIMENT.js.map +1 -0
- package/dataProviders/GET_VARIANT_CONTENT.d.ts +1 -0
- package/dataProviders/GET_VARIANT_CONTENT.js +24 -0
- package/dataProviders/GET_VARIANT_CONTENT.js.map +1 -0
- package/dataProviders/LIST_PUBLISHED_PAGES.js +2 -1
- package/dataProviders/LIST_PUBLISHED_PAGES.js.map +1 -1
- package/dataProviders/NullDataProvider.d.ts +4 -0
- package/dataProviders/NullDataProvider.js +30 -20
- package/dataProviders/NullDataProvider.js.map +1 -1
- package/dataProviders/RedirectsProvider.js +24 -27
- package/dataProviders/RedirectsProvider.js.map +1 -1
- package/defaultBreakpoints.js +43 -22
- package/defaultBreakpoints.js.map +1 -1
- package/documentOperations/$addElementReferenceToParent.js +29 -32
- package/documentOperations/$addElementReferenceToParent.js.map +1 -1
- package/documentOperations/AddElement.js +8 -7
- package/documentOperations/AddElement.js.map +1 -1
- package/documentOperations/AddToParent.js +14 -13
- package/documentOperations/AddToParent.js.map +1 -1
- package/documentOperations/IDocumentOperation.js +0 -3
- package/documentOperations/RemoveElement.js +9 -15
- 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/experiments/PostHogAnalyticsProvider.d.ts +31 -0
- package/experiments/PostHogAnalyticsProvider.js +28 -0
- package/experiments/PostHogAnalyticsProvider.js.map +1 -0
- package/experiments/analyticsProvider.d.ts +4 -0
- package/experiments/analyticsProvider.js +11 -0
- package/experiments/analyticsProvider.js.map +1 -0
- package/experiments/bucketing.d.ts +27 -0
- package/experiments/bucketing.js +91 -0
- package/experiments/bucketing.js.map +1 -0
- package/experiments/bucketing.test.d.ts +1 -0
- package/experiments/bucketing.test.js +183 -0
- package/experiments/bucketing.test.js.map +1 -0
- package/experiments/index.d.ts +5 -0
- package/experiments/index.js +5 -0
- package/experiments/render.d.ts +79 -0
- package/experiments/render.js +149 -0
- package/experiments/render.js.map +1 -0
- package/experiments/types.d.ts +108 -0
- package/experiments/types.js +4 -0
- package/experiments/types.js.map +1 -0
- package/findMatchingAstNode.js +11 -13
- package/findMatchingAstNode.js.map +1 -1
- package/generateElementId.js +2 -1
- package/generateElementId.js.map +1 -1
- package/headersProvider.js +4 -3
- package/headersProvider.js.map +1 -1
- package/image/geometry.d.ts +54 -0
- package/image/geometry.js +112 -0
- package/image/geometry.js.map +1 -0
- package/image/geometry.test.d.ts +1 -0
- package/image/geometry.test.js +190 -0
- package/image/geometry.test.js.map +1 -0
- package/image/index.d.ts +3 -0
- package/image/index.js +3 -0
- package/image/presets.d.ts +6 -0
- package/image/presets.js +20 -0
- package/image/presets.js.map +1 -0
- package/image/types.d.ts +10 -0
- package/image/types.js +0 -0
- package/index.d.ts +10 -0
- package/index.js +10 -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 -69
- package/messenger/Messenger.js.map +1 -1
- package/messenger/index.js +0 -2
- package/package.json +12 -9
- package/registerComponentGroup.js +5 -6
- package/registerComponentGroup.js.map +1 -1
- package/tokenBinding.d.ts +26 -0
- package/tokenBinding.js +15 -0
- package/tokenBinding.js.map +1 -0
- package/tokenBinding.test.d.ts +1 -0
- package/tokenBinding.test.js +165 -0
- package/tokenBinding.test.js.map +1 -0
- package/types/ShorthandCssProperties.js +0 -3
- package/types/WebsiteBuilderTheme.d.ts +12 -0
- package/types/WebsiteBuilderTheme.js +0 -3
- package/types.d.ts +96 -1
- 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
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { BindingsResolver } from "./BindingsResolver.js";
|
|
3
|
+
import { StylesBindingsProcessor } from "./StylesBindingsProcessor.js";
|
|
4
|
+
import { createTokenReference, isTokenBinding, tokenToCssValue } from "./tokenBinding.js";
|
|
5
|
+
describe("token bindings", ()=>{
|
|
6
|
+
it("recognises a token binding and nothing else", ()=>{
|
|
7
|
+
expect(isTokenBinding({
|
|
8
|
+
token: {
|
|
9
|
+
path: "color.surface.page"
|
|
10
|
+
}
|
|
11
|
+
})).toBe(true);
|
|
12
|
+
expect(isTokenBinding({
|
|
13
|
+
static: "#fff"
|
|
14
|
+
})).toBe(false);
|
|
15
|
+
expect(isTokenBinding({
|
|
16
|
+
expression: "$state.x"
|
|
17
|
+
})).toBe(false);
|
|
18
|
+
expect(isTokenBinding(void 0)).toBe(false);
|
|
19
|
+
});
|
|
20
|
+
it("derives the CSS variable from the token path", ()=>{
|
|
21
|
+
expect(tokenToCssValue({
|
|
22
|
+
path: "color.action.primary.background"
|
|
23
|
+
})).toBe("var(--wby-color-action-primary-background)");
|
|
24
|
+
});
|
|
25
|
+
it("emits the stored fallback, so content survives the theme being deactivated", ()=>{
|
|
26
|
+
expect(tokenToCssValue({
|
|
27
|
+
path: "color.surface.page",
|
|
28
|
+
fallback: "#F8FAFC"
|
|
29
|
+
})).toBe("var(--wby-color-surface-page, #F8FAFC)");
|
|
30
|
+
});
|
|
31
|
+
it("captures the resolved value as the fallback when a reference is created", ()=>{
|
|
32
|
+
expect(createTokenReference("color.surface.page", "#F8FAFC")).toEqual({
|
|
33
|
+
path: "color.surface.page",
|
|
34
|
+
fallback: "#F8FAFC"
|
|
35
|
+
});
|
|
36
|
+
expect(createTokenReference("color.surface.page")).toEqual({
|
|
37
|
+
path: "color.surface.page"
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
describe("BindingsResolver with token bindings", ()=>{
|
|
42
|
+
const resolve = (bindings)=>{
|
|
43
|
+
const resolver = new BindingsResolver({});
|
|
44
|
+
const [resolved] = resolver.resolveElement({
|
|
45
|
+
element: {
|
|
46
|
+
type: "Webiny/Element",
|
|
47
|
+
id: "el-1",
|
|
48
|
+
component: {
|
|
49
|
+
name: "Test"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
elementBindings: bindings,
|
|
53
|
+
inputAst: []
|
|
54
|
+
});
|
|
55
|
+
return resolved;
|
|
56
|
+
};
|
|
57
|
+
it("renders a token reference as a CSS variable", ()=>{
|
|
58
|
+
const resolved = resolve({
|
|
59
|
+
styles: {
|
|
60
|
+
backgroundColor: {
|
|
61
|
+
token: {
|
|
62
|
+
path: "color.surface.page"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
expect(resolved.styles.backgroundColor).toBe("var(--wby-color-surface-page)");
|
|
68
|
+
});
|
|
69
|
+
it("renders a literal unchanged", ()=>{
|
|
70
|
+
const resolved = resolve({
|
|
71
|
+
styles: {
|
|
72
|
+
backgroundColor: {
|
|
73
|
+
static: "#123456"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
expect(resolved.styles.backgroundColor).toBe("#123456");
|
|
78
|
+
});
|
|
79
|
+
it("renders references and literals side by side in the same element", ()=>{
|
|
80
|
+
const resolved = resolve({
|
|
81
|
+
styles: {
|
|
82
|
+
backgroundColor: {
|
|
83
|
+
token: {
|
|
84
|
+
path: "color.surface.page",
|
|
85
|
+
fallback: "#FFF"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
borderTopColor: {
|
|
89
|
+
static: "#123456"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
expect(resolved.styles.backgroundColor).toBe("var(--wby-color-surface-page, #FFF)");
|
|
94
|
+
expect(resolved.styles.borderTopColor).toBe("#123456");
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
describe("StylesBindingsProcessor with token bindings", ()=>{
|
|
98
|
+
const bindings = {
|
|
99
|
+
styles: {
|
|
100
|
+
backgroundColor: {
|
|
101
|
+
token: {
|
|
102
|
+
path: "color.surface.page",
|
|
103
|
+
fallback: "#FFF"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
borderTopColor: {
|
|
107
|
+
static: "#123456"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const processor = ()=>new StylesBindingsProcessor("el-1", [
|
|
112
|
+
"desktop",
|
|
113
|
+
"mobile"
|
|
114
|
+
], bindings);
|
|
115
|
+
it("flattens a token binding to its CSS variable so the preview renders", ()=>{
|
|
116
|
+
expect(processor().toDeepStyles(bindings.styles)).toEqual({
|
|
117
|
+
backgroundColor: "var(--wby-color-surface-page, #FFF)",
|
|
118
|
+
borderTopColor: "#123456"
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
it("reports which properties came from tokens", ()=>{
|
|
122
|
+
expect(processor().toTokenMap(bindings.styles)).toEqual({
|
|
123
|
+
backgroundColor: {
|
|
124
|
+
path: "color.surface.page",
|
|
125
|
+
fallback: "#FFF"
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
it("writes a token reference rather than a literal when one is supplied", ()=>{
|
|
130
|
+
const update = processor().createUpdate({
|
|
131
|
+
backgroundColor: "var(--wby-color-surface-raised)"
|
|
132
|
+
}, "desktop", {
|
|
133
|
+
backgroundColor: {
|
|
134
|
+
path: "color.surface.raised"
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
const document = {
|
|
138
|
+
bindings: {
|
|
139
|
+
"el-1": {}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
update.applyToDocument(document);
|
|
143
|
+
expect(document.bindings["el-1"].styles.backgroundColor).toEqual({
|
|
144
|
+
token: {
|
|
145
|
+
path: "color.surface.raised"
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
it("replaces a reference with a literal when no token is supplied", ()=>{
|
|
150
|
+
const update = processor().createUpdate({
|
|
151
|
+
backgroundColor: "#00FF00"
|
|
152
|
+
}, "desktop");
|
|
153
|
+
const document = {
|
|
154
|
+
bindings: {
|
|
155
|
+
"el-1": {}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
update.applyToDocument(document);
|
|
159
|
+
expect(document.bindings["el-1"].styles.backgroundColor).toEqual({
|
|
160
|
+
static: "#00FF00"
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
//# sourceMappingURL=tokenBinding.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenBinding.test.js","sources":["../src/tokenBinding.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport { BindingsResolver } from \"./BindingsResolver.js\";\nimport { StylesBindingsProcessor } from \"./StylesBindingsProcessor.js\";\nimport { createTokenReference, isTokenBinding, tokenToCssValue } from \"./tokenBinding.js\";\nimport type { DocumentElementBindings } from \"./types.js\";\n\ndescribe(\"token bindings\", () => {\n it(\"recognises a token binding and nothing else\", () => {\n expect(isTokenBinding({ token: { path: \"color.surface.page\" } })).toBe(true);\n expect(isTokenBinding({ static: \"#fff\" })).toBe(false);\n expect(isTokenBinding({ expression: \"$state.x\" })).toBe(false);\n expect(isTokenBinding(undefined)).toBe(false);\n });\n\n it(\"derives the CSS variable from the token path\", () => {\n expect(tokenToCssValue({ path: \"color.action.primary.background\" })).toBe(\n \"var(--wby-color-action-primary-background)\"\n );\n });\n\n it(\"emits the stored fallback, so content survives the theme being deactivated\", () => {\n expect(tokenToCssValue({ path: \"color.surface.page\", fallback: \"#F8FAFC\" })).toBe(\n \"var(--wby-color-surface-page, #F8FAFC)\"\n );\n });\n\n it(\"captures the resolved value as the fallback when a reference is created\", () => {\n expect(createTokenReference(\"color.surface.page\", \"#F8FAFC\")).toEqual({\n path: \"color.surface.page\",\n fallback: \"#F8FAFC\"\n });\n expect(createTokenReference(\"color.surface.page\")).toEqual({\n path: \"color.surface.page\"\n });\n });\n});\n\ndescribe(\"BindingsResolver with token bindings\", () => {\n const resolve = (bindings: DocumentElementBindings) => {\n const resolver = new BindingsResolver({});\n const [resolved] = resolver.resolveElement({\n element: {\n type: \"Webiny/Element\",\n id: \"el-1\",\n component: { name: \"Test\" } as never\n },\n elementBindings: bindings,\n inputAst: []\n });\n return resolved;\n };\n\n it(\"renders a token reference as a CSS variable\", () => {\n const resolved = resolve({\n styles: { backgroundColor: { token: { path: \"color.surface.page\" } } }\n });\n\n expect(resolved.styles.backgroundColor).toBe(\"var(--wby-color-surface-page)\");\n });\n\n it(\"renders a literal unchanged\", () => {\n const resolved = resolve({ styles: { backgroundColor: { static: \"#123456\" } } });\n\n expect(resolved.styles.backgroundColor).toBe(\"#123456\");\n });\n\n it(\"renders references and literals side by side in the same element\", () => {\n const resolved = resolve({\n styles: {\n backgroundColor: { token: { path: \"color.surface.page\", fallback: \"#FFF\" } },\n borderTopColor: { static: \"#123456\" }\n }\n });\n\n expect(resolved.styles.backgroundColor).toBe(\"var(--wby-color-surface-page, #FFF)\");\n expect(resolved.styles.borderTopColor).toBe(\"#123456\");\n });\n});\n\ndescribe(\"StylesBindingsProcessor with token bindings\", () => {\n const bindings: DocumentElementBindings = {\n styles: {\n backgroundColor: { token: { path: \"color.surface.page\", fallback: \"#FFF\" } },\n borderTopColor: { static: \"#123456\" }\n }\n };\n\n const processor = () => new StylesBindingsProcessor(\"el-1\", [\"desktop\", \"mobile\"], bindings);\n\n it(\"flattens a token binding to its CSS variable so the preview renders\", () => {\n expect(processor().toDeepStyles(bindings.styles)).toEqual({\n backgroundColor: \"var(--wby-color-surface-page, #FFF)\",\n borderTopColor: \"#123456\"\n });\n });\n\n it(\"reports which properties came from tokens\", () => {\n expect(processor().toTokenMap(bindings.styles)).toEqual({\n backgroundColor: { path: \"color.surface.page\", fallback: \"#FFF\" }\n });\n });\n\n it(\"writes a token reference rather than a literal when one is supplied\", () => {\n const update = processor().createUpdate(\n { backgroundColor: \"var(--wby-color-surface-raised)\" },\n \"desktop\",\n { backgroundColor: { path: \"color.surface.raised\" } }\n );\n\n const document = { bindings: { \"el-1\": {} } } as never;\n update.applyToDocument(document);\n\n expect((document as any).bindings[\"el-1\"].styles.backgroundColor).toEqual({\n token: { path: \"color.surface.raised\" }\n });\n });\n\n it(\"replaces a reference with a literal when no token is supplied\", () => {\n const update = processor().createUpdate({ backgroundColor: \"#00FF00\" }, \"desktop\");\n\n const document = { bindings: { \"el-1\": {} } } as never;\n update.applyToDocument(document);\n\n // No stale `token` left behind — a binding holds one or the other, never both.\n expect((document as any).bindings[\"el-1\"].styles.backgroundColor).toEqual({\n static: \"#00FF00\"\n });\n });\n});\n"],"names":["describe","it","expect","isTokenBinding","undefined","tokenToCssValue","createTokenReference","resolve","bindings","resolver","BindingsResolver","resolved","processor","StylesBindingsProcessor","update","document"],"mappings":"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"}
|
|
@@ -11,7 +11,9 @@ export type WebsiteBuilderTheme = {
|
|
|
11
11
|
fonts?: string[];
|
|
12
12
|
breakpoints: Breakpoint[];
|
|
13
13
|
colors: ColorStyle[];
|
|
14
|
+
fontSizes?: FontSizes;
|
|
14
15
|
typography: Typography;
|
|
16
|
+
allowCustomColors?: boolean;
|
|
15
17
|
};
|
|
16
18
|
type KnownKeys = "desktop" | "tablet" | "mobile";
|
|
17
19
|
type BreakpointBase = Omit<Breakpoint, "name">;
|
|
@@ -33,6 +35,7 @@ export type TypographyStyle = {
|
|
|
33
35
|
className: string;
|
|
34
36
|
};
|
|
35
37
|
export type Typography = Record<string, TypographyStyle[]>;
|
|
38
|
+
export type FontSizes = string[];
|
|
36
39
|
export type WebsiteBuilderThemeInput = {
|
|
37
40
|
/**
|
|
38
41
|
* CSS to include in the editor.
|
|
@@ -42,6 +45,11 @@ export type WebsiteBuilderThemeInput = {
|
|
|
42
45
|
* Fonts to load when the editor loads.
|
|
43
46
|
*/
|
|
44
47
|
fonts?: string[];
|
|
48
|
+
/**
|
|
49
|
+
* Font sizes to use in the editor.
|
|
50
|
+
* Define this if you want to see a font size dropdown in the editor.
|
|
51
|
+
*/
|
|
52
|
+
fontSizes?: FontSizes;
|
|
45
53
|
/**
|
|
46
54
|
* {
|
|
47
55
|
* title: "Desktop",
|
|
@@ -85,5 +93,9 @@ export type WebsiteBuilderThemeInput = {
|
|
|
85
93
|
* ]
|
|
86
94
|
*/
|
|
87
95
|
typography?: Typography;
|
|
96
|
+
/**
|
|
97
|
+
* Allow custom color selection (ChromePicker) in the Lexical editor's font color toolbar action.
|
|
98
|
+
*/
|
|
99
|
+
allowCustomColors?: boolean;
|
|
88
100
|
};
|
|
89
101
|
export {};
|
package/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { BindingsApi } from "./BindingsApi.js";
|
|
|
3
3
|
import type { ShorthandCssProperties } from "./types/ShorthandCssProperties.js";
|
|
4
4
|
import type { InputFactory } from "./createInput.js";
|
|
5
5
|
import type { Breakpoint } from "./types/WebsiteBuilderTheme.js";
|
|
6
|
+
import type { ActiveExperiment, VariantContent } from "./experiments/types.js";
|
|
6
7
|
export type { WebsiteBuilderTheme, Breakpoint } from "./types/WebsiteBuilderTheme.js";
|
|
7
8
|
type CSSProperties = CSS.Properties<string | number>;
|
|
8
9
|
export type ElementMap = Record<string, DocumentElement>;
|
|
@@ -15,9 +16,30 @@ export type InputValueBinding<T = any> = ValueBinding<T> & {
|
|
|
15
16
|
list?: boolean;
|
|
16
17
|
};
|
|
17
18
|
export type StyleValueBinding<T = any> = ValueBinding<T>;
|
|
19
|
+
/**
|
|
20
|
+
* A reference to a design token, stored in place of a literal value.
|
|
21
|
+
*
|
|
22
|
+
* `path` is a dot-path into the theme's token document (`color.action.primary.background`). The
|
|
23
|
+
* CSS variable name is derived from it at render time — see `tokenBinding.ts` for why the variable
|
|
24
|
+
* string itself is deliberately not stored.
|
|
25
|
+
*/
|
|
26
|
+
export type TokenReference = {
|
|
27
|
+
path: string;
|
|
28
|
+
/**
|
|
29
|
+
* The value the token resolved to when it was picked, emitted as the `var()` fallback so
|
|
30
|
+
* content keeps rendering if the theme is later deactivated.
|
|
31
|
+
*/
|
|
32
|
+
fallback?: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* A bound value. Exactly one of these is meaningful at a time, and all three must be able to
|
|
36
|
+
* coexist in the same field across a document indefinitely: a project can hold literals authored
|
|
37
|
+
* before it adopted a theme and token references authored after, with no migration between them.
|
|
38
|
+
*/
|
|
18
39
|
export type ValueBinding<T = any> = {
|
|
19
40
|
static?: T;
|
|
20
41
|
expression?: string;
|
|
42
|
+
token?: TokenReference;
|
|
21
43
|
};
|
|
22
44
|
export type RepeatValueBinding = {
|
|
23
45
|
expression: string;
|
|
@@ -77,6 +99,7 @@ export type ComponentGroup = {
|
|
|
77
99
|
name: string;
|
|
78
100
|
label: string;
|
|
79
101
|
description?: string;
|
|
102
|
+
icon?: string;
|
|
80
103
|
filter?: (component: ComponentManifest, context: ComponentGroupFilterContext) => boolean;
|
|
81
104
|
};
|
|
82
105
|
export type ResponsiveStyles = {
|
|
@@ -197,6 +220,7 @@ export type ComponentManifest = {
|
|
|
197
220
|
hideFromToolbar?: boolean;
|
|
198
221
|
hideStyleSettings?: string[];
|
|
199
222
|
autoApplyStyles?: boolean;
|
|
223
|
+
applyDefaultStyles?: boolean;
|
|
200
224
|
tags: string[];
|
|
201
225
|
constraints?: ComponentConstraint[];
|
|
202
226
|
descendantConstraints?: ComponentConstraint[];
|
|
@@ -230,6 +254,7 @@ export type DocumentElement = {
|
|
|
230
254
|
export type SerializableCSSStyleDeclaration = {
|
|
231
255
|
[K in keyof CssProperties]?: CssProperties[K];
|
|
232
256
|
};
|
|
257
|
+
export type DocumentCache = Record<string, unknown>;
|
|
233
258
|
export type Document = {
|
|
234
259
|
id: string;
|
|
235
260
|
state: DocumentState;
|
|
@@ -239,6 +264,7 @@ export type Document = {
|
|
|
239
264
|
metadata: DocumentMetadata;
|
|
240
265
|
bindings: DocumentBindings;
|
|
241
266
|
elements: ElementMap;
|
|
267
|
+
__cache?: DocumentCache;
|
|
242
268
|
};
|
|
243
269
|
export type PublicPage = Pick<Page, "id" | "version" | "properties" | "bindings" | "elements" | "extensions" | "metadata" | "state"> & {
|
|
244
270
|
languagePaths: Record<string, string>;
|
|
@@ -372,6 +398,9 @@ export interface IDataProvider {
|
|
|
372
398
|
getPageByPath(path: string, options?: GetPageOptions): Promise<PublicPage | null>;
|
|
373
399
|
getPageById(id: string, options?: GetPageOptions): Promise<PublicPage | null>;
|
|
374
400
|
listPages(options?: ListPagesOptions): Promise<ListPagesResult>;
|
|
401
|
+
getPageExperiment(path: string): Promise<ActiveExperiment | null>;
|
|
402
|
+
getVariantContent(variantId: string): Promise<VariantContent | null>;
|
|
403
|
+
getExperimentPaused(experimentId: string): Promise<boolean>;
|
|
375
404
|
}
|
|
376
405
|
export interface IEnvironment {
|
|
377
406
|
isClient(): boolean;
|
|
@@ -447,6 +476,72 @@ export type RadioInput = BaseInput<string> & {
|
|
|
447
476
|
value: string;
|
|
448
477
|
}[];
|
|
449
478
|
};
|
|
479
|
+
export interface ContentEntryReference {
|
|
480
|
+
id: string;
|
|
481
|
+
modelId: string;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Query-mode configuration, declared by the component author. The editor then
|
|
485
|
+
* builds a query within these bounds (see `ContentEntryQueryValue`).
|
|
486
|
+
*/
|
|
487
|
+
/**
|
|
488
|
+
* A field the editor may sort by: a bare read-API sort key, or a key paired with
|
|
489
|
+
* a display label shown in the editor.
|
|
490
|
+
*/
|
|
491
|
+
export type ContentEntrySortField = string | {
|
|
492
|
+
field: string;
|
|
493
|
+
label?: string;
|
|
494
|
+
};
|
|
495
|
+
export interface ContentEntryQueryConfig {
|
|
496
|
+
/**
|
|
497
|
+
* Fields the editor may sort by (one at a time). Each `field` is a CMS read-API
|
|
498
|
+
* sort key — value fields as `values_<fieldId>` (e.g. `values_title`), meta
|
|
499
|
+
* fields bare (e.g. `createdOn`). Provide a `label` for a friendlier UI; a bare
|
|
500
|
+
* string uses the key as its label.
|
|
501
|
+
*/
|
|
502
|
+
sort?: {
|
|
503
|
+
fields: ContentEntrySortField[];
|
|
504
|
+
};
|
|
505
|
+
/** Editor-configurable result limit, with an optional default and hard cap. */
|
|
506
|
+
limit?: {
|
|
507
|
+
default?: number;
|
|
508
|
+
max?: number;
|
|
509
|
+
};
|
|
510
|
+
/** Show a free-text search box (matches fullTextSearch-enabled fields). */
|
|
511
|
+
search?: boolean;
|
|
512
|
+
/** Enable "load more" pagination in the rendered component. */
|
|
513
|
+
pagination?: boolean;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* The value stored for a query-mode input: the editor's chosen query.
|
|
517
|
+
* `modelId` identifies the CMS model so the frontend SDK can resolve the
|
|
518
|
+
* query without component manifests.
|
|
519
|
+
*/
|
|
520
|
+
export interface ContentEntryQueryValue {
|
|
521
|
+
modelId: string;
|
|
522
|
+
sort?: {
|
|
523
|
+
field: string;
|
|
524
|
+
order: "asc" | "desc";
|
|
525
|
+
};
|
|
526
|
+
limit?: number;
|
|
527
|
+
search?: string;
|
|
528
|
+
}
|
|
529
|
+
export type ContentEntryInput = BaseInput<ContentEntryReference | ContentEntryReference[] | ContentEntryQueryValue> & {
|
|
530
|
+
type: "contentEntry";
|
|
531
|
+
/**
|
|
532
|
+
* The content model(s) the editor may pick entries from. Author-fixed.
|
|
533
|
+
*/
|
|
534
|
+
models: string[];
|
|
535
|
+
/**
|
|
536
|
+
* "manual" (default): the editor hand-picks entries (stored as references).
|
|
537
|
+
* "query": the editor configures a dynamic query on the fixed model.
|
|
538
|
+
*/
|
|
539
|
+
mode?: "manual" | "query";
|
|
540
|
+
/**
|
|
541
|
+
* Query-mode configuration. Only used when `mode` is "query".
|
|
542
|
+
*/
|
|
543
|
+
query?: ContentEntryQueryConfig;
|
|
544
|
+
};
|
|
450
545
|
export type ObjectInput = BaseInput<Record<string, any>> & {
|
|
451
546
|
type: "object";
|
|
452
547
|
fields: ComponentInput[];
|
|
@@ -455,7 +550,7 @@ export type CustomInput = BaseInput<any> & {
|
|
|
455
550
|
type: string;
|
|
456
551
|
fields: ComponentInput[];
|
|
457
552
|
};
|
|
458
|
-
export type ComponentInput = TextInput | LongTextInput | NumberInput | BooleanInput | ColorInput | FileInput | DateTimeInput | LexicalInput | SelectInput | RadioInput | TagsInput | ObjectInput | SlotInput | CustomInput;
|
|
553
|
+
export type ComponentInput = TextInput | LongTextInput | NumberInput | BooleanInput | ColorInput | FileInput | DateTimeInput | LexicalInput | SelectInput | RadioInput | TagsInput | ObjectInput | SlotInput | ContentEntryInput | CustomInput;
|
|
459
554
|
export type ManifestInputsArray<TInputs, TAllowChildren extends boolean> = TAllowChildren extends true ? {
|
|
460
555
|
[K in Exclude<keyof TInputs, "children">]: InputFactory<K & string>;
|
|
461
556
|
}[Exclude<keyof TInputs, "children">][] : {
|
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 * from \"./ConstraintEvaluator.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;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\";\nimport type { Breakpoint } from \"~/types/WebsiteBuilderTheme.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 DocumentMetadata = 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 ConstraintElementContext = {\n /** Component name (e.g., \"FunnelBuilder/Step\") */\n name: string;\n /** Component tags */\n tags: string[];\n\n /** Get the parent element context. undefined for root. */\n getParent(): ConstraintElementContext | undefined;\n\n /** Index of this element among siblings in the same parent slot. -1 if not in a list slot. */\n childIndex(): number;\n /** Total siblings in the same parent slot. -1 if not in a list slot. */\n childCount(): number;\n /** True if this element is the last among siblings in its parent slot. */\n isLastChild(): boolean;\n /** True if this element is the first among siblings in its parent slot. */\n isFirstChild(): boolean;\n};\n\nexport type ConstraintContext = {\n /** The component/element this constraint is about */\n component: ConstraintElementContext;\n /** The direct parent element at the drop target */\n parent: ConstraintElementContext;\n /** The target slot name (e.g., \"children\", \"leftColumn\", \"rightColumn\") */\n slot: string;\n /** True if the direct parent is the given component */\n isChildOf: (componentName: string) => boolean;\n /** True if any ancestor (including parent) is the given component */\n isDescendantOf: (componentName: string) => boolean;\n /** Find the nearest ancestor matching a component name */\n getAncestor: (componentName: string) => ConstraintElementContext | undefined;\n /** True if the component being placed has the given tag */\n hasTag: (tag: string) => boolean;\n /** Number of items currently in the target slot */\n slotChildCount: () => number;\n /** Count instances of a component type in the entire document */\n countInstances: (componentName: string) => number;\n /** True if the component has any descendant element carrying the given tag */\n hasDescendantWithTag: (tag: string) => boolean;\n /** Returns the resolved inputs of the nearest ancestor matching componentName, or undefined */\n getAncestorInputs: (componentName: string) => Record<string, any> | undefined;\n /** Returns the resolved inputs of the element this constraint is evaluating */\n getElementInputs: () => Record<string, any>;\n /** Debug logger — safe to call inside serialized constraints */\n log: (...args: any[]) => void;\n /** Block placement with an error message shown to the user */\n block: (message: string) => never;\n};\n\n/**\n * A constraint function. Call `ctx.block(\"message\")` to block placement.\n * Returning without blocking means the constraint passes.\n */\nexport type ComponentConstraint = (ctx: ConstraintContext) => void;\n\n// Flow-control symbols\nexport type Stop = symbol;\nexport type Continue = symbol;\nexport type HandlerResult = void | Stop | Continue;\n\nexport type OnChangeAction = \"create\" | \"update\" | \"delete\";\n\nexport type OnChangeElementContext = {\n id: string;\n component: ComponentManifest;\n inputs: Record<string, any>;\n};\n\nexport type ManifestAncestorContext = {\n id: string;\n component: ComponentManifest;\n inputs: Record<string, any>;\n updateInputs: (cb: (inputs: Record<string, any>) => void) => void;\n getElement: (id: string) => OnChangeElementContext | undefined;\n};\n\nexport type ComponentChangeContext<TInputs = Record<string, any>> = {\n action: OnChangeAction;\n id: string;\n component: ComponentManifest;\n inputs: TInputs;\n styles: Record<string, any>;\n getAncestor: (componentName: string) => ManifestAncestorContext | undefined;\n getElement: (id: string) => OnChangeElementContext | undefined;\n createElement: (params: any) => any;\n executeCommand: <T = unknown>(command: string, payload?: T) => void;\n breakpoint: string;\n log: (...args: any[]) => void;\n stop: () => Stop;\n continue: () => Continue;\n};\n\nexport type DescendantChangeContext<\n TInputs = Record<string, any>,\n TDescendantInputs = Record<string, any>\n> = {\n action: OnChangeAction;\n descendant: {\n component: ComponentManifest;\n id: string;\n inputs: TDescendantInputs;\n updateInputs: (cb: (inputs: TDescendantInputs) => void) => void;\n };\n inputs: TInputs;\n updateInputs: (cb: (inputs: TInputs) => void) => void;\n getElement: (id: string) => OnChangeElementContext | undefined;\n executeCommand: <T = unknown>(command: string, payload?: T) => void;\n breakpoint: string;\n log: (...args: any[]) => void;\n stop: () => Stop;\n continue: () => Continue;\n};\n\nexport type ComponentChangeHandler<TInputs = Record<string, any>> = (\n ctx: ComponentChangeContext<TInputs>\n) => HandlerResult;\n\nexport type DescendantChangeHandler<\n TInputs = Record<string, any>,\n TDescendantInputs = Record<string, any>\n> = (ctx: DescendantChangeContext<TInputs, TDescendantInputs>) => HandlerResult;\n\nexport type ComponentManifest = {\n name: string;\n group?: string;\n label?: string;\n aiContext?: string;\n useInAiContentGeneration?: boolean;\n image?: string;\n inputs: ComponentInput[];\n canDrag?: boolean;\n canDelete?: boolean | ComponentConstraint;\n acceptsChildren?: boolean;\n hideFromToolbar?: boolean;\n hideStyleSettings?: string[];\n autoApplyStyles?: boolean;\n tags: string[];\n constraints?: ComponentConstraint[];\n descendantConstraints?: ComponentConstraint[];\n onChange?: ComponentChangeHandler | ComponentChangeHandler[];\n onDescendantChange?: DescendantChangeHandler | DescendantChangeHandler[];\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 extensions: Record<string, any>;\n metadata: DocumentMetadata;\n bindings: DocumentBindings;\n elements: ElementMap;\n};\n\nexport type PublicPage = Pick<\n Page,\n \"id\" | \"version\" | \"properties\" | \"bindings\" | \"elements\" | \"extensions\" | \"metadata\" | \"state\"\n> & {\n languagePaths: Record<string, string>;\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 interface EditorOptions {\n isReadOnly?: boolean;\n}\nexport type EditorDocument = Document;\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 width: number;\n height: number;\n };\n path: string;\n language?: string;\n sourcePage?: string;\n tags: string[];\n seo: {\n title: string;\n description: string;\n metaTags: Array<{ name: string; content: string }>;\n canonicalUrl: string;\n noIndex: boolean;\n noFollow: boolean;\n structuredSchema: 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 width: number;\n height: number;\n };\n metaTags: Array<{ property: string; content: string }>;\n };\n };\n extensions: Record<string, any>;\n metadata: DocumentMetadata;\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 // Current breakpoint name\n breakpoint: string;\n breakpoints: Breakpoint[];\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;\n\nexport interface ListPagesOptions {\n where?: Record<string, any>;\n limit?: number;\n after?: string;\n sort?: string[];\n search?: string;\n}\n\nexport interface ListPagesMeta {\n hasMoreItems: boolean;\n totalCount: number;\n cursor: string | null;\n}\n\nexport interface ListPagesResult {\n data: Array<Omit<PublicPage, \"elements\" | \"bindings\">>;\n meta: ListPagesMeta;\n}\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<ListPagesResult>;\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<ListPagesResult>;\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<\n ComponentManifest,\n \"inputs\" | \"acceptsChildren\" | \"tags\" | \"onChange\" | \"onDescendantChange\"\n > & {\n acceptsChildren: true;\n tags?: string[];\n inputs?: ManifestInputsArray<TInputs, true> | ManifestInputsObject<TInputs, true>;\n onChange?: ComponentChangeHandler<TInputs> | ComponentChangeHandler<TInputs>[];\n onDescendantChange?:\n | DescendantChangeHandler<TInputs>\n | DescendantChangeHandler<TInputs>[];\n })\n | (Omit<\n ComponentManifest,\n \"inputs\" | \"acceptsChildren\" | \"tags\" | \"onChange\" | \"onDescendantChange\"\n > & {\n acceptsChildren?: false;\n tags?: string[];\n inputs: ManifestInputsArray<TInputs, false> | ManifestInputsObject<TInputs, false>;\n onChange?: ComponentChangeHandler<TInputs> | ComponentChangeHandler<TInputs>[];\n onDescendantChange?:\n | DescendantChangeHandler<TInputs>\n | DescendantChangeHandler<TInputs>[];\n });\n"],"mappings":"","ignoreList":[]}
|