@webiny/website-builder-sdk 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.e6f0dc8ca7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BindingsApi.d.ts +4 -4
- package/BindingsApi.js +3 -3
- package/BindingsApi.js.map +1 -1
- package/BindingsProcessor.d.ts +1 -1
- package/BindingsProcessor.js.map +1 -1
- package/BindingsProcessor.test.js +2 -1
- package/BindingsProcessor.test.js.map +1 -1
- package/BindingsResolver.d.ts +2 -2
- package/BindingsResolver.js +3 -6
- package/BindingsResolver.js.map +1 -1
- package/BindingsResolver.test.js +4 -3
- package/BindingsResolver.test.js.map +1 -1
- package/ComponentInputTraverser.d.ts +1 -1
- package/ComponentInputTraverser.js.map +1 -1
- package/ComponentManifestToAstConverter.d.ts +1 -1
- package/ComponentManifestToAstConverter.js.map +1 -1
- package/ComponentRegistry.js +30 -0
- package/ComponentRegistry.js.map +1 -1
- package/ComponentResolver.d.ts +2 -2
- package/ComponentResolver.js +3 -3
- package/ComponentResolver.js.map +1 -1
- package/ConstraintEvaluator.d.ts +36 -0
- package/ConstraintEvaluator.js +395 -0
- package/ConstraintEvaluator.js.map +1 -0
- package/ConstraintEvaluator.test.d.ts +1 -0
- package/ConstraintEvaluator.test.js +1456 -0
- package/ConstraintEvaluator.test.js.map +1 -0
- package/ContentSdk.d.ts +13 -7
- package/ContentSdk.js +26 -10
- package/ContentSdk.js.map +1 -1
- package/DocumentStore.d.ts +3 -3
- package/DocumentStore.js +1 -1
- package/DocumentStore.js.map +1 -1
- package/DocumentStoreManager.d.ts +2 -2
- package/DocumentStoreManager.js +1 -1
- package/DocumentStoreManager.js.map +1 -1
- package/EditingSdk.d.ts +4 -4
- package/EditingSdk.js +12 -15
- package/EditingSdk.js.map +1 -1
- package/ElementFactory.d.ts +5 -6
- package/ElementFactory.js +25 -16
- package/ElementFactory.js.map +1 -1
- package/ElementFactory.test.d.ts +1 -0
- package/ElementFactory.test.js +280 -0
- package/ElementFactory.test.js.map +1 -0
- package/HashObject.js +14 -0
- package/HashObject.js.map +1 -1
- package/HotkeyManager.js +1 -1
- package/HotkeyManager.js.map +1 -1
- package/IBindingsUpdater.d.ts +2 -2
- package/IBindingsUpdater.js.map +1 -1
- package/IRedirects.d.ts +5 -0
- package/IRedirects.js +3 -0
- package/IRedirects.js.map +1 -0
- package/InheritanceProcessor.d.ts +4 -4
- package/InheritanceProcessor.js.map +1 -1
- package/InheritanceProcessor.test.js +2 -1
- package/InheritanceProcessor.test.js.map +1 -1
- package/InheritedValueResolver.d.ts +1 -1
- package/InheritedValueResolver.js.map +1 -1
- package/InputBindingsProcessor.d.ts +4 -4
- package/InputBindingsProcessor.js +29 -11
- package/InputBindingsProcessor.js.map +1 -1
- package/InputsBindingsProcessor.test.js +4 -2
- package/InputsBindingsProcessor.test.js.map +1 -1
- package/InputsUpdater.d.ts +5 -5
- package/InputsUpdater.js +2 -2
- package/InputsUpdater.js.map +1 -1
- package/LiveSdk.d.ts +2 -2
- package/LiveSdk.js +1 -1
- package/LiveSdk.js.map +1 -1
- package/Logger.d.ts +2 -1
- package/Logger.js +7 -4
- package/Logger.js.map +1 -1
- package/NullSdk.d.ts +5 -3
- package/NullSdk.js +10 -0
- package/NullSdk.js.map +1 -1
- package/PreviewDocument.js +1 -1
- package/PreviewDocument.js.map +1 -1
- package/PreviewSdk.d.ts +2 -2
- package/PreviewSdk.js +3 -3
- package/PreviewSdk.js.map +1 -1
- package/PreviewViewport.d.ts +1 -2
- package/PreviewViewport.js +1 -21
- package/PreviewViewport.js.map +1 -1
- package/README.md +10 -2
- package/StylesBindingsProcessor.d.ts +2 -2
- package/StylesBindingsProcessor.js +4 -4
- package/StylesBindingsProcessor.js.map +1 -1
- package/StylesUpdater.d.ts +4 -4
- package/StylesUpdater.js +2 -2
- package/StylesUpdater.js.map +1 -1
- package/Theme.d.ts +1 -1
- package/Theme.js +6 -11
- package/Theme.js.map +1 -1
- package/ViewportManager.d.ts +3 -1
- package/ViewportManager.js +8 -1
- package/ViewportManager.js.map +1 -1
- package/constants.d.ts +1 -0
- package/constants.js +2 -1
- package/constants.js.map +1 -1
- package/createElement.d.ts +1 -1
- package/createElement.js.map +1 -1
- package/createInput.d.ts +124 -16
- package/createInput.js +33 -1
- package/createInput.js.map +1 -1
- package/createTheme.d.ts +2 -1
- package/createTheme.js.map +1 -1
- package/dataProviders/ApiClient.d.ts +6 -1
- package/dataProviders/ApiClient.js +19 -8
- package/dataProviders/ApiClient.js.map +1 -1
- package/dataProviders/DefaultDataProvider.d.ts +4 -3
- package/dataProviders/DefaultDataProvider.js +32 -6
- package/dataProviders/DefaultDataProvider.js.map +1 -1
- package/dataProviders/GET_PAGE_BY_ID.d.ts +1 -1
- package/dataProviders/GET_PAGE_BY_ID.js +2 -0
- 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 +2 -0
- 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 +15 -4
- package/dataProviders/LIST_PUBLISHED_PAGES.js.map +1 -1
- package/dataProviders/NullDataProvider.d.ts +13 -4
- package/dataProviders/NullDataProvider.js +11 -1
- package/dataProviders/NullDataProvider.js.map +1 -1
- package/dataProviders/RedirectsProvider.d.ts +11 -0
- package/dataProviders/RedirectsProvider.js +32 -0
- package/dataProviders/RedirectsProvider.js.map +1 -0
- package/defaultBreakpoints.d.ts +1 -1
- package/defaultBreakpoints.js.map +1 -1
- package/documentOperations/$addElementReferenceToParent.d.ts +1 -1
- package/documentOperations/$addElementReferenceToParent.js +9 -2
- package/documentOperations/$addElementReferenceToParent.js.map +1 -1
- package/documentOperations/AddElement.d.ts +1 -1
- package/documentOperations/AddElement.js.map +1 -1
- package/documentOperations/AddToParent.d.ts +3 -3
- package/documentOperations/AddToParent.js.map +1 -1
- package/documentOperations/RemoveElement.d.ts +1 -1
- package/documentOperations/RemoveElement.js +9 -0
- package/documentOperations/RemoveElement.js.map +1 -1
- package/documentOperations/SetGlobalInputBinding.d.ts +1 -1
- package/documentOperations/SetGlobalInputBinding.js.map +1 -1
- package/documentOperations/SetGlobalStyleBinding.d.ts +1 -1
- package/documentOperations/SetGlobalStyleBinding.js.map +1 -1
- package/documentOperations/SetInputBindingOverride.d.ts +1 -1
- package/documentOperations/SetInputBindingOverride.js.map +1 -1
- package/documentOperations/SetStyleBindingOverride.d.ts +1 -1
- package/documentOperations/SetStyleBindingOverride.js.map +1 -1
- package/documentOperations/index.d.ts +8 -8
- package/documentOperations/index.js +7 -7
- package/documentOperations/index.js.map +1 -1
- package/findMatchingAstNode.d.ts +1 -1
- package/findMatchingAstNode.js.map +1 -1
- package/generateElementId.d.ts +1 -1
- package/generateElementId.js +0 -1
- package/generateElementId.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +2 -3
- package/index.js.map +1 -1
- package/jsonPatch.d.ts +1 -1
- package/messenger/Messenger.js +6 -6
- package/messenger/Messenger.js.map +1 -1
- package/package.json +14 -20
- package/registerComponentGroup.d.ts +1 -1
- package/registerComponentGroup.js +1 -1
- package/registerComponentGroup.js.map +1 -1
- package/types/WebsiteBuilderTheme.d.ts +52 -42
- package/types/WebsiteBuilderTheme.js.map +1 -1
- package/types.d.ts +207 -20
- package/types.js.map +1 -1
- package/lexical/createDefaultLexicalTheme.d.ts +0 -2
- package/lexical/createDefaultLexicalTheme.js +0 -84
- package/lexical/createDefaultLexicalTheme.js.map +0 -1
- package/lexical/createLexicalTheme.d.ts +0 -2
- package/lexical/createLexicalTheme.js +0 -7
- package/lexical/createLexicalTheme.js.map +0 -1
- package/lexical/deepMerge.d.ts +0 -1
- package/lexical/deepMerge.js +0 -23
- package/lexical/deepMerge.js.map +0 -1
- package/types/LexicalEditorTheme.d.ts +0 -2
- package/types/LexicalEditorTheme.js +0 -3
- package/types/LexicalEditorTheme.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/website-builder-sdk",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.0.0-unstable.e6f0dc8ca7",
|
|
4
|
+
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/webiny/webiny-js.git"
|
|
@@ -12,37 +12,31 @@
|
|
|
12
12
|
"author": "Pavel Denisjuk",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"csstype": "3.
|
|
15
|
+
"csstype": "3.2.3",
|
|
16
16
|
"deep-equal": "2.2.3",
|
|
17
17
|
"deepmerge": "4.3.1",
|
|
18
18
|
"fast-json-patch": "3.1.1",
|
|
19
19
|
"fast-json-stable-stringify": "2.1.0",
|
|
20
20
|
"is-hotkey": "0.2.0",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"nanoid": "
|
|
26
|
-
"
|
|
27
|
-
"pino": "
|
|
28
|
-
"pino-pretty": "9.4.0"
|
|
21
|
+
"lodash": "4.18.1",
|
|
22
|
+
"matcher": "6.0.0",
|
|
23
|
+
"mobx": "6.15.3",
|
|
24
|
+
"nanoid": "5.1.11",
|
|
25
|
+
"nanoid-dictionary": "5.0.0",
|
|
26
|
+
"pino": "10.3.1",
|
|
27
|
+
"pino-pretty": "13.1.3"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
30
|
"@types/deep-equal": "1.0.4",
|
|
32
31
|
"@types/is-hotkey": "0.1.10",
|
|
33
|
-
"@
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"typescript": "5.3.3"
|
|
32
|
+
"@webiny/build-tools": "0.0.0-unstable.e6f0dc8ca7",
|
|
33
|
+
"typescript": "6.0.3",
|
|
34
|
+
"vitest": "4.1.5"
|
|
37
35
|
},
|
|
38
36
|
"publishConfig": {
|
|
39
37
|
"access": "public",
|
|
40
38
|
"directory": "dist"
|
|
41
39
|
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"build": "yarn webiny run build",
|
|
44
|
-
"watch": "yarn webiny run watch"
|
|
45
|
-
},
|
|
46
40
|
"adio": {
|
|
47
41
|
"ignore": {
|
|
48
42
|
"dependencies": [
|
|
@@ -50,5 +44,5 @@
|
|
|
50
44
|
]
|
|
51
45
|
}
|
|
52
46
|
},
|
|
53
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "e6f0dc8ca741c1fcc3fec9a5b9e86fdd49544641"
|
|
54
48
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ComponentGroup } from "./types";
|
|
1
|
+
import type { ComponentGroup } from "./types.js";
|
|
2
2
|
export declare const registerComponentGroup: (group: ComponentGroup) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["contentSdk","registerComponentGroup","group","editingSdk","getEditingSdk"],"sources":["registerComponentGroup.ts"],"sourcesContent":["import type { ComponentGroup } from \"./types\";\nimport { contentSdk } from \"./ContentSdk\";\n\nexport const registerComponentGroup = (group: ComponentGroup) => {\n const editingSdk = contentSdk.getEditingSdk();\n\n if (!editingSdk) {\n return;\n }\n\n editingSdk.registerComponentGroup(group);\n};\n"],"mappings":"AACA,SAASA,UAAU;AAEnB,OAAO,MAAMC,sBAAsB,GAAIC,KAAqB,IAAK;EAC7D,MAAMC,UAAU,GAAGH,UAAU,CAACI,aAAa,CAAC,CAAC;EAE7C,IAAI,CAACD,UAAU,EAAE;IACb;EACJ;EAEAA,UAAU,CAACF,sBAAsB,CAACC,KAAK,CAAC;AAC5C,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["contentSdk","registerComponentGroup","group","editingSdk","getEditingSdk"],"sources":["registerComponentGroup.ts"],"sourcesContent":["import type { ComponentGroup } from \"./types.js\";\nimport { contentSdk } from \"./ContentSdk.js\";\n\nexport const registerComponentGroup = (group: ComponentGroup) => {\n const editingSdk = contentSdk.getEditingSdk();\n\n if (!editingSdk) {\n return;\n }\n\n editingSdk.registerComponentGroup(group);\n};\n"],"mappings":"AACA,SAASA,UAAU;AAEnB,OAAO,MAAMC,sBAAsB,GAAIC,KAAqB,IAAK;EAC7D,MAAMC,UAAU,GAAGH,UAAU,CAACI,aAAa,CAAC,CAAC;EAE7C,IAAI,CAACD,UAAU,EAAE;IACb;EACJ;EAEAA,UAAU,CAACF,sBAAsB,CAACC,KAAK,CAAC;AAC5C,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { LexicalEditorTheme } from "./LexicalEditorTheme";
|
|
2
1
|
export type Breakpoint = {
|
|
3
2
|
name: string;
|
|
4
3
|
title: string;
|
|
@@ -8,13 +7,11 @@ export type Breakpoint = {
|
|
|
8
7
|
maxWidth: number;
|
|
9
8
|
};
|
|
10
9
|
export type WebsiteBuilderTheme = {
|
|
11
|
-
|
|
10
|
+
css?: string;
|
|
11
|
+
fonts?: string[];
|
|
12
12
|
breakpoints: Breakpoint[];
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
typography: Typography;
|
|
16
|
-
};
|
|
17
|
-
lexical: LexicalEditorTheme;
|
|
13
|
+
colors: ColorStyle[];
|
|
14
|
+
typography: Typography;
|
|
18
15
|
};
|
|
19
16
|
type KnownKeys = "desktop" | "tablet" | "mobile";
|
|
20
17
|
type BreakpointBase = Omit<Breakpoint, "name">;
|
|
@@ -24,16 +21,27 @@ type Breakpoints = KnownBreakpoints & {
|
|
|
24
21
|
[K in string as K extends KnownKeys ? never : K]: BreakpointBase;
|
|
25
22
|
};
|
|
26
23
|
};
|
|
27
|
-
export type
|
|
24
|
+
export type ColorStyle = {
|
|
25
|
+
id: string;
|
|
26
|
+
label: string;
|
|
27
|
+
value: string;
|
|
28
|
+
};
|
|
28
29
|
export type TypographyStyle = {
|
|
29
30
|
id: string;
|
|
30
|
-
|
|
31
|
+
label: string;
|
|
31
32
|
tag: string;
|
|
32
33
|
className: string;
|
|
33
34
|
};
|
|
34
|
-
export type Typography =
|
|
35
|
+
export type Typography = Record<string, TypographyStyle[]>;
|
|
35
36
|
export type WebsiteBuilderThemeInput = {
|
|
36
|
-
|
|
37
|
+
/**
|
|
38
|
+
* CSS to include in the editor.
|
|
39
|
+
*/
|
|
40
|
+
css?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Fonts to load when the editor loads.
|
|
43
|
+
*/
|
|
44
|
+
fonts?: string[];
|
|
37
45
|
/**
|
|
38
46
|
* {
|
|
39
47
|
* title: "Desktop",
|
|
@@ -44,36 +52,38 @@ export type WebsiteBuilderThemeInput = {
|
|
|
44
52
|
* }
|
|
45
53
|
*/
|
|
46
54
|
breakpoints?: Breakpoints;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
55
|
+
/**
|
|
56
|
+
* [
|
|
57
|
+
* {
|
|
58
|
+
* id: "primary",
|
|
59
|
+
* label: "Primary",
|
|
60
|
+
* value: "#000000"
|
|
61
|
+
* },
|
|
62
|
+
* ]
|
|
63
|
+
*/
|
|
64
|
+
colors?: ColorStyle[];
|
|
65
|
+
/**
|
|
66
|
+
* headings: [
|
|
67
|
+
* {
|
|
68
|
+
* id: "heading1",
|
|
69
|
+
* name: "Heading 1",
|
|
70
|
+
* tag: "h1"
|
|
71
|
+
* },
|
|
72
|
+
* ],
|
|
73
|
+
* paragraphs: [
|
|
74
|
+
* {
|
|
75
|
+
* id: "paragraph1",
|
|
76
|
+
* name: "Paragraph 1",
|
|
77
|
+
* tag: "p",
|
|
78
|
+
* ],
|
|
79
|
+
* quotes: [
|
|
80
|
+
* {
|
|
81
|
+
* id: "quote",
|
|
82
|
+
* name: "Quote",
|
|
83
|
+
* tag: "blockquote"
|
|
84
|
+
* }
|
|
85
|
+
* ]
|
|
86
|
+
*/
|
|
87
|
+
typography?: Typography;
|
|
78
88
|
};
|
|
79
89
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["WebsiteBuilderTheme.ts"],"sourcesContent":["
|
|
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.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type * as CSS from "csstype";
|
|
2
|
-
import type { BindingsApi } from "./BindingsApi";
|
|
3
|
-
import type { ShorthandCssProperties } from "./types/ShorthandCssProperties";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
2
|
+
import type { BindingsApi } from "./BindingsApi.js";
|
|
3
|
+
import type { ShorthandCssProperties } from "./types/ShorthandCssProperties.js";
|
|
4
|
+
import type { InputFactory } from "./createInput.js";
|
|
5
|
+
import type { Breakpoint } from "./types/WebsiteBuilderTheme.js";
|
|
6
|
+
export type { WebsiteBuilderTheme, Breakpoint } from "./types/WebsiteBuilderTheme.js";
|
|
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;
|
|
@@ -57,6 +59,10 @@ export type Component = {
|
|
|
57
59
|
component: any;
|
|
58
60
|
manifest: ComponentManifest;
|
|
59
61
|
};
|
|
62
|
+
export type ComponentBlueprint<TComponent = any, TManifest = any> = {
|
|
63
|
+
component: TComponent;
|
|
64
|
+
manifest: TManifest;
|
|
65
|
+
};
|
|
60
66
|
export type ComponentGroupItem = {
|
|
61
67
|
name: string;
|
|
62
68
|
item?: DocumentElementTemplate;
|
|
@@ -76,19 +82,126 @@ export type ComponentGroup = {
|
|
|
76
82
|
export type ResponsiveStyles = {
|
|
77
83
|
[key: string]: SerializableCSSStyleDeclaration;
|
|
78
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;
|
|
79
186
|
export type ComponentManifest = {
|
|
80
187
|
name: string;
|
|
81
188
|
group?: string;
|
|
82
189
|
label?: string;
|
|
190
|
+
aiContext?: string;
|
|
191
|
+
useInAiContentGeneration?: boolean;
|
|
83
192
|
image?: string;
|
|
84
|
-
inputs
|
|
193
|
+
inputs: ComponentInput[];
|
|
85
194
|
canDrag?: boolean;
|
|
86
|
-
canDelete?: boolean;
|
|
195
|
+
canDelete?: boolean | ComponentConstraint;
|
|
87
196
|
acceptsChildren?: boolean;
|
|
88
197
|
hideFromToolbar?: boolean;
|
|
89
198
|
hideStyleSettings?: string[];
|
|
90
199
|
autoApplyStyles?: boolean;
|
|
91
|
-
tags
|
|
200
|
+
tags: string[];
|
|
201
|
+
constraints?: ComponentConstraint[];
|
|
202
|
+
descendantConstraints?: ComponentConstraint[];
|
|
203
|
+
onChange?: ComponentChangeHandler | ComponentChangeHandler[];
|
|
204
|
+
onDescendantChange?: DescendantChangeHandler | DescendantChangeHandler[];
|
|
92
205
|
defaults?: {
|
|
93
206
|
inputs?: Record<string, any>;
|
|
94
207
|
styles?: SerializableCSSStyleDeclaration;
|
|
@@ -122,14 +235,25 @@ export type Document = {
|
|
|
122
235
|
state: DocumentState;
|
|
123
236
|
version: number;
|
|
124
237
|
properties: Record<string, any>;
|
|
238
|
+
extensions: Record<string, any>;
|
|
239
|
+
metadata: DocumentMetadata;
|
|
125
240
|
bindings: DocumentBindings;
|
|
126
241
|
elements: ElementMap;
|
|
127
242
|
};
|
|
128
|
-
export type PublicPage = Pick<Page, "id" | "version" | "properties" | "bindings" | "elements" | "state"
|
|
129
|
-
|
|
130
|
-
export type EditorDocument = Document & {
|
|
131
|
-
metadata: Record<string, any>;
|
|
243
|
+
export type PublicPage = Pick<Page, "id" | "version" | "properties" | "bindings" | "elements" | "extensions" | "metadata" | "state"> & {
|
|
244
|
+
languagePaths: Record<string, string>;
|
|
132
245
|
};
|
|
246
|
+
export type PublicRedirect = {
|
|
247
|
+
id: string;
|
|
248
|
+
from: string;
|
|
249
|
+
to: string;
|
|
250
|
+
permanent: boolean;
|
|
251
|
+
};
|
|
252
|
+
export type EditorPage = EditorDocument & Pick<Page, "properties" | "status" | "location">;
|
|
253
|
+
export interface EditorOptions {
|
|
254
|
+
isReadOnly?: boolean;
|
|
255
|
+
}
|
|
256
|
+
export type EditorDocument = Document;
|
|
133
257
|
export type Page = Document & {
|
|
134
258
|
id: string;
|
|
135
259
|
status: string;
|
|
@@ -140,7 +264,18 @@ export type Page = Document & {
|
|
|
140
264
|
properties: {
|
|
141
265
|
title: string;
|
|
142
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
|
+
};
|
|
143
276
|
path: string;
|
|
277
|
+
language?: string;
|
|
278
|
+
sourcePage?: string;
|
|
144
279
|
tags: string[];
|
|
145
280
|
seo: {
|
|
146
281
|
title: string;
|
|
@@ -149,16 +284,31 @@ export type Page = Document & {
|
|
|
149
284
|
name: string;
|
|
150
285
|
content: string;
|
|
151
286
|
}>;
|
|
287
|
+
canonicalUrl: string;
|
|
288
|
+
noIndex: boolean;
|
|
289
|
+
noFollow: boolean;
|
|
290
|
+
structuredSchema: string;
|
|
152
291
|
};
|
|
153
292
|
social: {
|
|
154
293
|
title: string;
|
|
155
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
|
+
};
|
|
156
304
|
metaTags: Array<{
|
|
157
305
|
property: string;
|
|
158
306
|
content: string;
|
|
159
307
|
}>;
|
|
160
308
|
};
|
|
161
309
|
};
|
|
310
|
+
extensions: Record<string, any>;
|
|
311
|
+
metadata: DocumentMetadata;
|
|
162
312
|
};
|
|
163
313
|
export type Box = {
|
|
164
314
|
depth: number;
|
|
@@ -180,10 +330,14 @@ export type BoxData = ElementBoxData | ElementSlotBoxData;
|
|
|
180
330
|
export type EditorViewportInfo = PreviewViewportInfo & {
|
|
181
331
|
top: number;
|
|
182
332
|
left: number;
|
|
333
|
+
breakpoint: string;
|
|
334
|
+
breakpoints: Breakpoint[];
|
|
183
335
|
};
|
|
184
336
|
export type PreviewViewportInfo = {
|
|
185
337
|
width: number;
|
|
186
338
|
height: number;
|
|
339
|
+
scrollWidth: number;
|
|
340
|
+
scrollHeight: number;
|
|
187
341
|
scrollX: number;
|
|
188
342
|
scrollY: number;
|
|
189
343
|
};
|
|
@@ -198,11 +352,26 @@ export type PreviewViewportData = {
|
|
|
198
352
|
};
|
|
199
353
|
export type ApiOptions = Record<string, any>;
|
|
200
354
|
export type GetPageOptions = ApiOptions;
|
|
201
|
-
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
|
+
}
|
|
202
371
|
export interface IDataProvider {
|
|
203
372
|
getPageByPath(path: string, options?: GetPageOptions): Promise<PublicPage | null>;
|
|
204
373
|
getPageById(id: string, options?: GetPageOptions): Promise<PublicPage | null>;
|
|
205
|
-
listPages(options?: ListPagesOptions): Promise<
|
|
374
|
+
listPages(options?: ListPagesOptions): Promise<ListPagesResult>;
|
|
206
375
|
}
|
|
207
376
|
export interface IEnvironment {
|
|
208
377
|
isClient(): boolean;
|
|
@@ -211,13 +380,8 @@ export interface IEnvironment {
|
|
|
211
380
|
}
|
|
212
381
|
export interface IContentSdk {
|
|
213
382
|
getPage(path: string): Promise<PublicPage | null>;
|
|
214
|
-
listPages(options?: ListPagesOptions): Promise<
|
|
383
|
+
listPages(options?: ListPagesOptions): Promise<ListPagesResult>;
|
|
215
384
|
}
|
|
216
|
-
export type Breakpoint = {
|
|
217
|
-
name: string;
|
|
218
|
-
minWidth: number;
|
|
219
|
-
maxWidth: number;
|
|
220
|
-
};
|
|
221
385
|
export type BaseInput<T = any> = {
|
|
222
386
|
name: string;
|
|
223
387
|
type: string;
|
|
@@ -292,3 +456,26 @@ export type CustomInput = BaseInput<any> & {
|
|
|
292
456
|
fields: ComponentInput[];
|
|
293
457
|
};
|
|
294
458
|
export type ComponentInput = TextInput | LongTextInput | NumberInput | BooleanInput | ColorInput | FileInput | DateTimeInput | LexicalInput | SelectInput | RadioInput | TagsInput | ObjectInput | SlotInput | CustomInput;
|
|
459
|
+
export type ManifestInputsArray<TInputs, TAllowChildren extends boolean> = TAllowChildren extends true ? {
|
|
460
|
+
[K in Exclude<keyof TInputs, "children">]: InputFactory<K & string>;
|
|
461
|
+
}[Exclude<keyof TInputs, "children">][] : {
|
|
462
|
+
[K in keyof TInputs]: InputFactory<K & string>;
|
|
463
|
+
}[keyof TInputs][];
|
|
464
|
+
export type ManifestInputsObject<TInputs, TAllowChildren extends boolean> = TAllowChildren extends true ? {
|
|
465
|
+
[K in Exclude<keyof TInputs, "children">]: InputFactory<K & string>;
|
|
466
|
+
} : {
|
|
467
|
+
[K in keyof TInputs]: InputFactory<K & string>;
|
|
468
|
+
};
|
|
469
|
+
export type ComponentManifestInput<TInputs> = (Omit<ComponentManifest, "inputs" | "acceptsChildren" | "tags" | "onChange" | "onDescendantChange"> & {
|
|
470
|
+
acceptsChildren: true;
|
|
471
|
+
tags?: string[];
|
|
472
|
+
inputs?: ManifestInputsArray<TInputs, true> | ManifestInputsObject<TInputs, true>;
|
|
473
|
+
onChange?: ComponentChangeHandler<TInputs> | ComponentChangeHandler<TInputs>[];
|
|
474
|
+
onDescendantChange?: DescendantChangeHandler<TInputs> | DescendantChangeHandler<TInputs>[];
|
|
475
|
+
}) | (Omit<ComponentManifest, "inputs" | "acceptsChildren" | "tags" | "onChange" | "onDescendantChange"> & {
|
|
476
|
+
acceptsChildren?: false;
|
|
477
|
+
tags?: string[];
|
|
478
|
+
inputs: ManifestInputsArray<TInputs, false> | ManifestInputsObject<TInputs, false>;
|
|
479
|
+
onChange?: ComponentChangeHandler<TInputs> | ComponentChangeHandler<TInputs>[];
|
|
480
|
+
onDescendantChange?: DescendantChangeHandler<TInputs> | DescendantChangeHandler<TInputs>[];
|
|
481
|
+
});
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type * as CSS from \"csstype\";\nimport type { BindingsApi } from \"~/BindingsApi\";\nimport type { ShorthandCssProperties } from \"./types/ShorthandCssProperties\";\nexport type { WebsiteBuilderTheme } from \"./types/WebsiteBuilderTheme\";\n\ninterface CSSProperties extends CSS.Properties<string | number> {}\n\nexport type ElementMap = Record<string, DocumentElement>;\n\nexport type DocumentState = Record<string, any>;\n\nexport type InputValueBinding<T = any> = ValueBinding<T> & {\n id: string;\n type: string;\n translatable?: boolean;\n list?: boolean;\n};\n\nexport type StyleValueBinding<T = any> = ValueBinding<T>;\n\nexport type ValueBinding<T = any> = {\n static?: T;\n expression?: string;\n};\n\nexport type RepeatValueBinding = {\n expression: string;\n};\n\nexport type CssProperties = Omit<CSSProperties, ShorthandCssProperties>;\n\nexport type DocumentElementStyleBindings = Partial<{\n [K in keyof CssProperties]: StyleValueBinding<CssProperties[K]>;\n}>;\n\nexport type DocumentElementInputBindings = {\n [inputName: string]: InputValueBinding;\n};\n\nexport type DocumentElementBindings = {\n $repeat?: RepeatValueBinding;\n inputs?: DocumentElementInputBindings;\n styles?: DocumentElementStyleBindings;\n metadata?: Record<string, any>;\n overrides?: {\n [key: string]: {\n inputs?: DocumentElementInputBindings;\n styles?: DocumentElementStyleBindings;\n };\n };\n};\n\nexport type DocumentBindings = {\n [elementId: string]: DocumentElementBindings;\n};\n\nexport type ResolvedComponent<TComponent = any> = {\n component: TComponent;\n inputs: Record<string, any>;\n manifest: ComponentManifest;\n styles: SerializableCSSStyleDeclaration;\n};\n\nexport type ResolvedElement = {\n id: string;\n inputs: Record<string, any>;\n styles: SerializableCSSStyleDeclaration;\n};\n\nexport type Component = {\n component: any;\n manifest: ComponentManifest;\n};\n\nexport type ComponentGroupItem = {\n // Name of the component.\n name: string;\n // Optionally, define an exact element to insert.\n item?: DocumentElementTemplate;\n};\n\nexport type SerializedComponentGroup = ComponentGroup & {\n filter?: string;\n};\n\nexport type ComponentGroupFilterContext = {\n document: EditorDocument;\n};\n\nexport type ComponentGroup = {\n name: string;\n label: string;\n description?: string;\n filter?: (component: ComponentManifest, context: ComponentGroupFilterContext) => boolean;\n};\n\nexport type ResponsiveStyles = {\n [key: string]: SerializableCSSStyleDeclaration;\n};\n\nexport type ComponentManifest = {\n name: string;\n group?: string;\n label?: string;\n image?: string;\n inputs?: ComponentInput[];\n canDrag?: boolean;\n canDelete?: boolean;\n acceptsChildren?: boolean;\n hideFromToolbar?: boolean;\n hideStyleSettings?: string[];\n autoApplyStyles?: boolean;\n tags?: string[];\n defaults?: {\n inputs?: Record<string, any>;\n styles?: SerializableCSSStyleDeclaration;\n overrides?: {\n [breakpoint: string]: {\n inputs?: Record<string, any>;\n styles?: SerializableCSSStyleDeclaration;\n };\n };\n };\n};\n\nexport type DocumentElementTemplate = Omit<DocumentElement, \"id\">;\n\nexport type ElementComponent = {\n name: string;\n};\n\nexport type DocumentElement = {\n type: \"Webiny/Element\";\n id: string;\n component: ElementComponent;\n parent?: {\n id: string;\n slot: string;\n };\n styles?: ResponsiveStyles;\n};\n\nexport type SerializableCSSStyleDeclaration = {\n [K in keyof CssProperties]?: CssProperties[K];\n};\n\nexport type Document = {\n id: string;\n state: DocumentState;\n version: number;\n properties: Record<string, any>;\n bindings: DocumentBindings;\n elements: ElementMap;\n};\n\nexport type PublicPage = Pick<\n Page,\n \"id\" | \"version\" | \"properties\" | \"bindings\" | \"elements\" | \"state\"\n>;\n\nexport type EditorPage = EditorDocument & Pick<Page, \"properties\" | \"status\" | \"location\">;\n\nexport type EditorDocument = Document & {\n metadata: Record<string, any>;\n};\n\nexport type Page = Document & {\n id: string;\n status: string;\n version: number;\n location: {\n folderId: string;\n };\n properties: {\n title: string;\n snippet: string;\n /*image: {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n };*/\n path: string;\n tags: string[];\n seo: {\n title: string;\n description: string;\n metaTags: Array<{ name: string; content: string }>;\n };\n social: {\n title: string;\n description: string;\n /*image: {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n };*/\n metaTags: Array<{ property: string; content: string }>;\n };\n };\n};\n\nexport type Box = {\n depth: number;\n parentId: string;\n parentSlot: string;\n parentIndex: number;\n width: number;\n height: number;\n top: number;\n left: number;\n};\n\nexport type ElementBoxData = Box & {\n type: \"element\";\n};\n\nexport type ElementSlotBoxData = Box & {\n type: \"element-slot\";\n};\n\nexport type BoxData = ElementBoxData | ElementSlotBoxData;\n\nexport type EditorViewportInfo = PreviewViewportInfo & {\n top: number;\n left: number;\n};\n\nexport type PreviewViewportInfo = {\n width: number;\n height: number;\n scrollX: number;\n scrollY: number;\n};\n\nexport type BoxesData = Record<string, BoxData>;\n\nexport type EditorViewportData = {\n boxes: BoxesData;\n viewport: EditorViewportInfo;\n};\n\nexport type PreviewViewportData = {\n boxes: BoxesData;\n viewport: PreviewViewportInfo;\n};\n\nexport type ApiOptions = Record<string, any>;\n\nexport type GetPageOptions = ApiOptions;\nexport type ListPagesOptions = ApiOptions;\n\nexport interface IDataProvider {\n getPageByPath(path: string, options?: GetPageOptions): Promise<PublicPage | null>;\n getPageById(id: string, options?: GetPageOptions): Promise<PublicPage | null>;\n listPages(options?: ListPagesOptions): Promise<PublicPage[]>;\n}\n\nexport interface IEnvironment {\n isClient(): boolean;\n isServer(): boolean;\n isPreview(): boolean;\n}\n\nexport interface IContentSdk {\n getPage(path: string): Promise<PublicPage | null>;\n listPages(options?: ListPagesOptions): Promise<PublicPage[]>;\n}\n\nexport type Breakpoint = {\n name: string;\n minWidth: number;\n maxWidth: number;\n};\n\n// Input types\n\n// inputTypes.ts\nexport type BaseInput<T = any> = {\n name: string;\n type: string;\n onChange?: (\n bindings: ReturnType<BindingsApi[\"getPublicApi\"]>,\n context: { breakpoint: string }\n ) => void;\n label?: string;\n description?: string;\n helperText?: string;\n defaultValue?: T;\n responsive?: boolean;\n required?: boolean;\n hideFromUi?: boolean;\n renderer?: string;\n list?: boolean;\n translatable?: boolean;\n};\n\n// Discriminated union per input type\nexport type TextInput = BaseInput<string> & {\n type: \"text\";\n};\n\nexport type SlotInput = BaseInput<any> & {\n type: \"slot\";\n components?: string[];\n};\n\nexport type TagsInput = BaseInput<string[]> & {\n type: \"text\";\n};\n\nexport type LongTextInput = BaseInput<string> & {\n type: \"longText\";\n};\n\nexport type NumberInput = BaseInput<number> & {\n type: \"number\";\n minValue?: number;\n};\n\nexport type BooleanInput = BaseInput<boolean> & {\n type: \"boolean\";\n};\n\nexport type ColorInput = BaseInput<string> & {\n type: \"color\";\n};\n\nexport type FileInput = BaseInput<string> & {\n type: \"file\";\n allowedFileTypes: string[];\n};\n\nexport type DateTimeInput = BaseInput<string> & {\n type: \"datetime\";\n};\n\nexport type LexicalInput = BaseInput<string> & {\n type: \"lexical\";\n};\n\nexport type SelectInput = BaseInput<string> & {\n type: \"select\";\n options: { label: string; value: string }[];\n showResetAction?: boolean;\n};\n\nexport type RadioInput = BaseInput<string> & {\n type: \"radio\";\n options: { label: string; value: string }[];\n};\n\nexport type ObjectInput = BaseInput<Record<string, any>> & {\n type: \"object\";\n fields: ComponentInput[];\n};\n\nexport type CustomInput = BaseInput<any> & {\n type: string;\n fields: ComponentInput[];\n};\n\n// Union of all input types\nexport type ComponentInput =\n | TextInput\n | LongTextInput\n | NumberInput\n | BooleanInput\n | ColorInput\n | FileInput\n | DateTimeInput\n | LexicalInput\n | SelectInput\n | RadioInput\n | TagsInput\n | ObjectInput\n | SlotInput\n | CustomInput;\n"],"mappings":"","ignoreList":[]}
|
|
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":[]}
|