@webiny/website-builder-sdk 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.f6dc066313
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/BindingsProcessor.test.js +1 -0
- package/BindingsProcessor.test.js.map +1 -1
- package/BindingsResolver.d.ts +1 -1
- package/BindingsResolver.js +2 -2
- package/BindingsResolver.js.map +1 -1
- package/BindingsResolver.test.js +1 -0
- package/BindingsResolver.test.js.map +1 -1
- package/ContentSdk.d.ts +3 -3
- package/ContentSdk.js +4 -4
- package/ContentSdk.js.map +1 -1
- package/DocumentStore.d.ts +1 -1
- package/EditingSdk.d.ts +2 -2
- package/EditingSdk.js +4 -7
- package/EditingSdk.js.map +1 -1
- package/ElementFactory.js.map +1 -1
- package/HotkeyManager.js +1 -1
- package/HotkeyManager.js.map +1 -1
- package/InheritanceProcessor.d.ts +2 -2
- package/InheritanceProcessor.test.js +1 -0
- package/InheritanceProcessor.test.js.map +1 -1
- package/InputsBindingsProcessor.test.js +1 -0
- package/InputsBindingsProcessor.test.js.map +1 -1
- package/InputsUpdater.d.ts +1 -1
- package/LiveSdk.d.ts +2 -2
- package/LiveSdk.js.map +1 -1
- package/Logger.d.ts +2 -1
- package/NullSdk.d.ts +2 -2
- package/NullSdk.js +8 -1
- package/NullSdk.js.map +1 -1
- package/PreviewSdk.d.ts +2 -2
- package/PreviewSdk.js +2 -2
- package/PreviewSdk.js.map +1 -1
- package/PreviewViewport.d.ts +0 -1
- package/PreviewViewport.js +0 -20
- package/PreviewViewport.js.map +1 -1
- package/README.md +10 -2
- package/StylesUpdater.d.ts +1 -1
- package/Theme.js +3 -10
- package/Theme.js.map +1 -1
- package/ViewportManager.d.ts +2 -0
- package/ViewportManager.js +4 -0
- package/ViewportManager.js.map +1 -1
- package/createInput.d.ts +123 -15
- package/createInput.js +32 -0
- package/createInput.js.map +1 -1
- package/dataProviders/DefaultDataProvider.d.ts +3 -3
- package/dataProviders/DefaultDataProvider.js +16 -3
- package/dataProviders/DefaultDataProvider.js.map +1 -1
- package/dataProviders/GET_PAGE_BY_ID.d.ts +1 -1
- package/dataProviders/GET_PAGE_BY_ID.js +1 -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 +1 -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 +8 -1
- package/dataProviders/NullDataProvider.js +8 -1
- package/dataProviders/NullDataProvider.js.map +1 -1
- package/documentOperations/SetGlobalStyleBinding.js.map +1 -1
- package/documentOperations/SetInputBindingOverride.js.map +1 -1
- package/documentOperations/SetStyleBindingOverride.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 +1 -1
- package/index.js +0 -1
- package/index.js.map +1 -1
- package/jsonPatch.d.ts +1 -1
- package/messenger/Messenger.js +9 -7
- package/messenger/Messenger.js.map +1 -1
- package/package.json +14 -19
- package/types/WebsiteBuilderTheme.d.ts +42 -45
- package/types/WebsiteBuilderTheme.js.map +1 -1
- package/types.d.ts +49 -7
- 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/createInput.d.ts
CHANGED
|
@@ -1,17 +1,125 @@
|
|
|
1
1
|
import type { TextInput, LongTextInput, NumberInput, BooleanInput, ColorInput, FileInput, LexicalInput, SelectInput, RadioInput, ObjectInput, DateTimeInput, ComponentInput, TagsInput, SlotInput } from "./types.js";
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
export type InputFactory<Name extends string> = ReturnType<typeof createTextInput<Name>> | ReturnType<typeof createLongTextInput<Name>> | ReturnType<typeof createNumberInput<Name>> | ReturnType<typeof createBooleanInput<Name>> | ReturnType<typeof createColorInput<Name>> | ReturnType<typeof createFileInput<Name>> | ReturnType<typeof createDateInput<Name>> | ReturnType<typeof createLexicalInput<Name>> | ReturnType<typeof createSelectInput<Name>> | ReturnType<typeof createRadioInput<Name>> | ReturnType<typeof createObjectInput<Name>> | ReturnType<typeof createTagsInput<Name>> | ReturnType<typeof createSlotInput<Name>>;
|
|
3
|
+
/**
|
|
4
|
+
* TypeScript Overload Resolution and Input Factory Design
|
|
5
|
+
*
|
|
6
|
+
* Each input factory (e.g., createTextInput) is defined with two TypeScript overload signatures:
|
|
7
|
+
* 1. One overload requires a `name` property in the input (used for array-based APIs, where inference is needed).
|
|
8
|
+
* 2. The other overload omits the `name` property (used for object-based APIs, where the key provides the name).
|
|
9
|
+
*
|
|
10
|
+
* TypeScript resolves overloads by scanning from top to bottom and picking the first matching signature.
|
|
11
|
+
* The implementation signature uses `any` for the argument, and the return type is unified to match all overloads.
|
|
12
|
+
*
|
|
13
|
+
* In array mode, the `name` must be explicitly provided in the input object, so inference for `TName` works.
|
|
14
|
+
* In object mode, the input does not require a `name` property; instead, the key in the object (e.g., `{ foo: createTextInput({ ... }) }`)
|
|
15
|
+
* provides the name via contextual typing from the consuming function (such as `createComponent`). TypeScript uses this context
|
|
16
|
+
* to resolve the correct type for `TName` even when `name` is omitted from the input.
|
|
17
|
+
*
|
|
18
|
+
* This pattern ensures that all returned input objects are typed as `{ name: TName }`, whether `name` is provided explicitly or inferred,
|
|
19
|
+
* so consumers of these factories do not need to worry about the presence of the `name` property in the result.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createTextInput<TName extends string>(input: {
|
|
22
|
+
name: TName;
|
|
23
|
+
} & Omit<TextInput, "type" | "name">): TextInput & {
|
|
24
|
+
name: TName;
|
|
25
|
+
};
|
|
26
|
+
export declare function createTextInput<TName extends string>(input: Omit<TextInput, "type" | "name">): TextInput & {
|
|
27
|
+
name: TName;
|
|
28
|
+
};
|
|
29
|
+
export declare function createLongTextInput<TName extends string>(input: {
|
|
30
|
+
name: TName;
|
|
31
|
+
} & Omit<LongTextInput, "type" | "name">): LongTextInput & {
|
|
32
|
+
name: TName;
|
|
33
|
+
};
|
|
34
|
+
export declare function createLongTextInput<TName extends string>(input: Omit<LongTextInput, "type" | "name">): LongTextInput & {
|
|
35
|
+
name: TName;
|
|
36
|
+
};
|
|
37
|
+
export declare function createNumberInput<TName extends string>(input: {
|
|
38
|
+
name: TName;
|
|
39
|
+
} & Omit<NumberInput, "type" | "name">): NumberInput & {
|
|
40
|
+
name: TName;
|
|
41
|
+
};
|
|
42
|
+
export declare function createNumberInput<TName extends string>(input: Omit<NumberInput, "type" | "name">): NumberInput & {
|
|
43
|
+
name: TName;
|
|
44
|
+
};
|
|
45
|
+
export declare function createBooleanInput<TName extends string>(input: {
|
|
46
|
+
name: TName;
|
|
47
|
+
} & Omit<BooleanInput, "type" | "name">): BooleanInput & {
|
|
48
|
+
name: TName;
|
|
49
|
+
};
|
|
50
|
+
export declare function createBooleanInput<TName extends string>(input: Omit<BooleanInput, "type" | "name">): BooleanInput & {
|
|
51
|
+
name: TName;
|
|
52
|
+
};
|
|
53
|
+
export declare function createColorInput<TName extends string>(input: {
|
|
54
|
+
name: TName;
|
|
55
|
+
} & Omit<ColorInput, "type" | "name">): ColorInput & {
|
|
56
|
+
name: TName;
|
|
57
|
+
};
|
|
58
|
+
export declare function createColorInput<TName extends string>(input: Omit<ColorInput, "type" | "name">): ColorInput & {
|
|
59
|
+
name: TName;
|
|
60
|
+
};
|
|
61
|
+
export declare function createFileInput<TName extends string>(input: {
|
|
62
|
+
name: TName;
|
|
63
|
+
} & Omit<FileInput, "type" | "name">): FileInput & {
|
|
64
|
+
name: TName;
|
|
65
|
+
};
|
|
66
|
+
export declare function createFileInput<TName extends string>(input: Omit<FileInput, "type" | "name">): FileInput & {
|
|
67
|
+
name: TName;
|
|
68
|
+
};
|
|
69
|
+
export declare function createDateInput<TName extends string>(input: {
|
|
70
|
+
name: TName;
|
|
71
|
+
} & Omit<DateTimeInput, "type" | "name">): DateTimeInput & {
|
|
72
|
+
name: TName;
|
|
73
|
+
};
|
|
74
|
+
export declare function createDateInput<TName extends string>(input: Omit<DateTimeInput, "type" | "name">): DateTimeInput & {
|
|
75
|
+
name: TName;
|
|
76
|
+
};
|
|
77
|
+
export declare function createLexicalInput<TName extends string>(input: {
|
|
78
|
+
name: TName;
|
|
79
|
+
} & Omit<LexicalInput, "type" | "name">): LexicalInput & {
|
|
80
|
+
name: TName;
|
|
81
|
+
};
|
|
82
|
+
export declare function createLexicalInput<TName extends string>(input: Omit<LexicalInput, "type" | "name">): LexicalInput & {
|
|
83
|
+
name: TName;
|
|
84
|
+
};
|
|
85
|
+
export declare function createSelectInput<TName extends string>(input: {
|
|
86
|
+
name: TName;
|
|
87
|
+
} & Omit<SelectInput, "type" | "name">): SelectInput & {
|
|
88
|
+
name: TName;
|
|
89
|
+
};
|
|
90
|
+
export declare function createSelectInput<TName extends string>(input: Omit<SelectInput, "type" | "name">): SelectInput & {
|
|
91
|
+
name: TName;
|
|
92
|
+
};
|
|
93
|
+
export declare function createRadioInput<TName extends string>(input: {
|
|
94
|
+
name: TName;
|
|
95
|
+
} & Omit<RadioInput, "type" | "name">): RadioInput & {
|
|
96
|
+
name: TName;
|
|
97
|
+
};
|
|
98
|
+
export declare function createRadioInput<TName extends string>(input: Omit<RadioInput, "type" | "name">): RadioInput & {
|
|
99
|
+
name: TName;
|
|
100
|
+
};
|
|
101
|
+
export declare function createObjectInput<TName extends string>(input: {
|
|
102
|
+
name: TName;
|
|
103
|
+
} & Omit<ObjectInput, "type" | "name">): ObjectInput & {
|
|
104
|
+
name: TName;
|
|
105
|
+
};
|
|
106
|
+
export declare function createObjectInput<TName extends string>(input: Omit<ObjectInput, "type" | "name">): ObjectInput & {
|
|
107
|
+
name: TName;
|
|
108
|
+
};
|
|
109
|
+
export declare function createTagsInput<TName extends string>(input: {
|
|
110
|
+
name: TName;
|
|
111
|
+
} & Omit<TagsInput, "type" | "name">): TagsInput & {
|
|
112
|
+
name: TName;
|
|
113
|
+
};
|
|
114
|
+
export declare function createTagsInput<TName extends string>(input: Omit<TagsInput, "type" | "name">): TagsInput & {
|
|
115
|
+
name: TName;
|
|
116
|
+
};
|
|
117
|
+
export declare function createSlotInput<TName extends string>(input: {
|
|
118
|
+
name: TName;
|
|
119
|
+
} & Omit<SlotInput, "type" | "name">): SlotInput & {
|
|
120
|
+
name: TName;
|
|
121
|
+
};
|
|
122
|
+
export declare function createSlotInput<TName extends string>(input: Omit<SlotInput, "type" | "name">): SlotInput & {
|
|
123
|
+
name: TName;
|
|
124
|
+
};
|
|
16
125
|
export declare function createInput(input: ComponentInput): ComponentInput;
|
|
17
|
-
export {};
|
package/createInput.js
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import { functionConverter } from "./FunctionConverter.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TypeScript Overload Resolution and Input Factory Design
|
|
5
|
+
*
|
|
6
|
+
* Each input factory (e.g., createTextInput) is defined with two TypeScript overload signatures:
|
|
7
|
+
* 1. One overload requires a `name` property in the input (used for array-based APIs, where inference is needed).
|
|
8
|
+
* 2. The other overload omits the `name` property (used for object-based APIs, where the key provides the name).
|
|
9
|
+
*
|
|
10
|
+
* TypeScript resolves overloads by scanning from top to bottom and picking the first matching signature.
|
|
11
|
+
* The implementation signature uses `any` for the argument, and the return type is unified to match all overloads.
|
|
12
|
+
*
|
|
13
|
+
* In array mode, the `name` must be explicitly provided in the input object, so inference for `TName` works.
|
|
14
|
+
* In object mode, the input does not require a `name` property; instead, the key in the object (e.g., `{ foo: createTextInput({ ... }) }`)
|
|
15
|
+
* provides the name via contextual typing from the consuming function (such as `createComponent`). TypeScript uses this context
|
|
16
|
+
* to resolve the correct type for `TName` even when `name` is omitted from the input.
|
|
17
|
+
*
|
|
18
|
+
* This pattern ensures that all returned input objects are typed as `{ name: TName }`, whether `name` is provided explicitly or inferred,
|
|
19
|
+
* so consumers of these factories do not need to worry about the presence of the `name` property in the result.
|
|
20
|
+
*/
|
|
2
21
|
// Text
|
|
22
|
+
|
|
3
23
|
export function createTextInput(input) {
|
|
4
24
|
return createInput({
|
|
5
25
|
type: "text",
|
|
@@ -9,6 +29,7 @@ export function createTextInput(input) {
|
|
|
9
29
|
}
|
|
10
30
|
|
|
11
31
|
// Long Text
|
|
32
|
+
|
|
12
33
|
export function createLongTextInput(input) {
|
|
13
34
|
return createInput({
|
|
14
35
|
type: "longText",
|
|
@@ -18,6 +39,7 @@ export function createLongTextInput(input) {
|
|
|
18
39
|
}
|
|
19
40
|
|
|
20
41
|
// Number
|
|
42
|
+
|
|
21
43
|
export function createNumberInput(input) {
|
|
22
44
|
return createInput({
|
|
23
45
|
type: "number",
|
|
@@ -27,6 +49,7 @@ export function createNumberInput(input) {
|
|
|
27
49
|
}
|
|
28
50
|
|
|
29
51
|
// Boolean
|
|
52
|
+
|
|
30
53
|
export function createBooleanInput(input) {
|
|
31
54
|
return createInput({
|
|
32
55
|
type: "boolean",
|
|
@@ -36,6 +59,7 @@ export function createBooleanInput(input) {
|
|
|
36
59
|
}
|
|
37
60
|
|
|
38
61
|
// Color
|
|
62
|
+
|
|
39
63
|
export function createColorInput(input) {
|
|
40
64
|
return createInput({
|
|
41
65
|
type: "color",
|
|
@@ -45,6 +69,7 @@ export function createColorInput(input) {
|
|
|
45
69
|
}
|
|
46
70
|
|
|
47
71
|
// File
|
|
72
|
+
|
|
48
73
|
export function createFileInput(input) {
|
|
49
74
|
return createInput({
|
|
50
75
|
type: "file",
|
|
@@ -54,6 +79,7 @@ export function createFileInput(input) {
|
|
|
54
79
|
}
|
|
55
80
|
|
|
56
81
|
// Date
|
|
82
|
+
|
|
57
83
|
export function createDateInput(input) {
|
|
58
84
|
return createInput({
|
|
59
85
|
type: "datetime",
|
|
@@ -63,6 +89,7 @@ export function createDateInput(input) {
|
|
|
63
89
|
}
|
|
64
90
|
|
|
65
91
|
// Rich Text
|
|
92
|
+
|
|
66
93
|
export function createLexicalInput(input) {
|
|
67
94
|
return createInput({
|
|
68
95
|
type: "lexical",
|
|
@@ -72,6 +99,7 @@ export function createLexicalInput(input) {
|
|
|
72
99
|
}
|
|
73
100
|
|
|
74
101
|
// Select
|
|
102
|
+
|
|
75
103
|
export function createSelectInput(input) {
|
|
76
104
|
return createInput({
|
|
77
105
|
type: "select",
|
|
@@ -81,6 +109,7 @@ export function createSelectInput(input) {
|
|
|
81
109
|
}
|
|
82
110
|
|
|
83
111
|
// Radio
|
|
112
|
+
|
|
84
113
|
export function createRadioInput(input) {
|
|
85
114
|
return createInput({
|
|
86
115
|
type: "radio",
|
|
@@ -90,6 +119,7 @@ export function createRadioInput(input) {
|
|
|
90
119
|
}
|
|
91
120
|
|
|
92
121
|
// Object
|
|
122
|
+
|
|
93
123
|
export function createObjectInput(input) {
|
|
94
124
|
return createInput({
|
|
95
125
|
type: "object",
|
|
@@ -99,6 +129,7 @@ export function createObjectInput(input) {
|
|
|
99
129
|
}
|
|
100
130
|
|
|
101
131
|
// Tags
|
|
132
|
+
|
|
102
133
|
export function createTagsInput(input) {
|
|
103
134
|
return createInput({
|
|
104
135
|
type: "text",
|
|
@@ -112,6 +143,7 @@ export function createSlotInput(input) {
|
|
|
112
143
|
type: "slot",
|
|
113
144
|
list: true,
|
|
114
145
|
renderer: "Webiny/Slot",
|
|
146
|
+
defaultValue: [],
|
|
115
147
|
...input
|
|
116
148
|
});
|
|
117
149
|
}
|
package/createInput.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["functionConverter","createTextInput","input","createInput","type","renderer","createLongTextInput","createNumberInput","createBooleanInput","createColorInput","createFileInput","createDateInput","createLexicalInput","createSelectInput","createRadioInput","createObjectInput","createTagsInput","list","createSlotInput","onChange","serialize"],"sources":["createInput.ts"],"sourcesContent":["import type {\n TextInput,\n LongTextInput,\n NumberInput,\n BooleanInput,\n ColorInput,\n FileInput,\n LexicalInput,\n SelectInput,\n RadioInput,\n ObjectInput,\n DateTimeInput,\n ComponentInput,\n TagsInput,\n SlotInput\n} from \"./types.js\";\nimport { functionConverter } from \"~/FunctionConverter.js\";\n\ntype OmitType<T> = Omit<T, \"type\">;\n\n// Text\nexport function createTextInput(input: OmitType<TextInput>) {\n return createInput({\n type: \"text\",\n renderer: \"Webiny/Input\",\n ...input\n }) as TextInput;\n}\n\n// Long Text\nexport function createLongTextInput(input: OmitType<LongTextInput>) {\n return createInput({\n type: \"longText\",\n renderer: \"Webiny/Textarea\",\n ...input\n });\n}\n\n// Number\nexport function createNumberInput(input: OmitType<NumberInput>) {\n return createInput({\n type: \"number\",\n renderer: \"Webiny/Number\",\n ...input\n }) as NumberInput;\n}\n\n// Boolean\nexport function createBooleanInput(input: OmitType<BooleanInput>) {\n return createInput({\n type: \"boolean\",\n renderer: \"Webiny/Switch\",\n ...input\n }) as BooleanInput;\n}\n\n// Color\nexport function createColorInput(input: OmitType<ColorInput>) {\n return createInput({\n type: \"color\",\n renderer: \"Webiny/ColorPicker\",\n ...input\n }) as ColorInput;\n}\n\n// File\nexport function createFileInput(input: OmitType<FileInput>) {\n return createInput({\n type: \"file\",\n renderer: \"Webiny/FileManager\",\n ...input\n }) as FileInput;\n}\n\n// Date\nexport function createDateInput(input: OmitType<DateTimeInput>) {\n return createInput({\n type: \"datetime\",\n renderer: \"Webiny/DateTime\",\n ...input\n }) as DateTimeInput;\n}\n\n// Rich Text\nexport function createLexicalInput(input: OmitType<LexicalInput>) {\n return createInput({\n type: \"lexical\",\n renderer: \"Webiny/Lexical\",\n ...input\n }) as LexicalInput;\n}\n\n// Select\nexport function createSelectInput(input: OmitType<SelectInput>) {\n return createInput({\n type: \"select\",\n renderer: \"Webiny/Select\",\n ...input\n }) as SelectInput;\n}\n\n// Radio\nexport function createRadioInput(input: OmitType<RadioInput>) {\n return createInput({\n type: \"radio\",\n renderer: \"Webiny/RadioGroup\",\n ...input\n }) as RadioInput;\n}\n\n// Object\nexport function createObjectInput(input: OmitType<ObjectInput>) {\n return createInput({\n type: \"object\",\n renderer: \"Webiny/Object\",\n ...input\n }) as ObjectInput;\n}\n\n// Tags\nexport function createTagsInput(input: OmitType<TagsInput>) {\n return createInput({\n type: \"text\",\n list: true,\n renderer: \"Webiny/Tags\",\n ...input\n }) as TagsInput;\n}\n\nexport function createSlotInput(input: OmitType<SlotInput>) {\n return createInput({\n type: \"slot\",\n list: true,\n renderer: \"Webiny/Slot\",\n ...input\n }) as SlotInput;\n}\n\n// Implementation\nexport function createInput(input: ComponentInput): ComponentInput {\n if (input.onChange) {\n // @ts-expect-error We don't use this function on the frontend, so this is ok.\n input.onChange = functionConverter.serialize(input.onChange!);\n }\n return input;\n}\n"],"mappings":"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","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["functionConverter","createTextInput","input","createInput","type","renderer","createLongTextInput","createNumberInput","createBooleanInput","createColorInput","createFileInput","createDateInput","createLexicalInput","createSelectInput","createRadioInput","createObjectInput","createTagsInput","list","createSlotInput","defaultValue","onChange","serialize"],"sources":["createInput.ts"],"sourcesContent":["import type {\n TextInput,\n LongTextInput,\n NumberInput,\n BooleanInput,\n ColorInput,\n FileInput,\n LexicalInput,\n SelectInput,\n RadioInput,\n ObjectInput,\n DateTimeInput,\n ComponentInput,\n TagsInput,\n SlotInput\n} from \"./types.js\";\nimport { functionConverter } from \"~/FunctionConverter.js\";\n\nexport type InputFactory<Name extends string> =\n | ReturnType<typeof createTextInput<Name>>\n | ReturnType<typeof createLongTextInput<Name>>\n | ReturnType<typeof createNumberInput<Name>>\n | ReturnType<typeof createBooleanInput<Name>>\n | ReturnType<typeof createColorInput<Name>>\n | ReturnType<typeof createFileInput<Name>>\n | ReturnType<typeof createDateInput<Name>>\n | ReturnType<typeof createLexicalInput<Name>>\n | ReturnType<typeof createSelectInput<Name>>\n | ReturnType<typeof createRadioInput<Name>>\n | ReturnType<typeof createObjectInput<Name>>\n | ReturnType<typeof createTagsInput<Name>>\n | ReturnType<typeof createSlotInput<Name>>;\n\n/**\n * TypeScript Overload Resolution and Input Factory Design\n *\n * Each input factory (e.g., createTextInput) is defined with two TypeScript overload signatures:\n * 1. One overload requires a `name` property in the input (used for array-based APIs, where inference is needed).\n * 2. The other overload omits the `name` property (used for object-based APIs, where the key provides the name).\n *\n * TypeScript resolves overloads by scanning from top to bottom and picking the first matching signature.\n * The implementation signature uses `any` for the argument, and the return type is unified to match all overloads.\n *\n * In array mode, the `name` must be explicitly provided in the input object, so inference for `TName` works.\n * In object mode, the input does not require a `name` property; instead, the key in the object (e.g., `{ foo: createTextInput({ ... }) }`)\n * provides the name via contextual typing from the consuming function (such as `createComponent`). TypeScript uses this context\n * to resolve the correct type for `TName` even when `name` is omitted from the input.\n *\n * This pattern ensures that all returned input objects are typed as `{ name: TName }`, whether `name` is provided explicitly or inferred,\n * so consumers of these factories do not need to worry about the presence of the `name` property in the result.\n */\n// Text\nexport function createTextInput<TName extends string>(\n input: { name: TName } & Omit<TextInput, \"type\" | \"name\">\n): TextInput & { name: TName };\nexport function createTextInput<TName extends string>(\n input: Omit<TextInput, \"type\" | \"name\">\n): TextInput & { name: TName };\nexport function createTextInput<TName extends string>(input: any): TextInput & { name: TName } {\n return createInput({\n type: \"text\",\n renderer: \"Webiny/Input\",\n ...input\n }) as TextInput & { name: TName };\n}\n\n// Long Text\nexport function createLongTextInput<TName extends string>(\n input: { name: TName } & Omit<LongTextInput, \"type\" | \"name\">\n): LongTextInput & { name: TName };\nexport function createLongTextInput<TName extends string>(\n input: Omit<LongTextInput, \"type\" | \"name\">\n): LongTextInput & { name: TName };\nexport function createLongTextInput<TName extends string>(\n input: any\n): LongTextInput & { name: TName } {\n return createInput({\n type: \"longText\",\n renderer: \"Webiny/Textarea\",\n ...input\n }) as LongTextInput & { name: TName };\n}\n\n// Number\nexport function createNumberInput<TName extends string>(\n input: { name: TName } & Omit<NumberInput, \"type\" | \"name\">\n): NumberInput & { name: TName };\nexport function createNumberInput<TName extends string>(\n input: Omit<NumberInput, \"type\" | \"name\">\n): NumberInput & { name: TName };\nexport function createNumberInput<TName extends string>(input: any): NumberInput & { name: TName } {\n return createInput({\n type: \"number\",\n renderer: \"Webiny/Number\",\n ...input\n }) as NumberInput & { name: TName };\n}\n\n// Boolean\nexport function createBooleanInput<TName extends string>(\n input: { name: TName } & Omit<BooleanInput, \"type\" | \"name\">\n): BooleanInput & { name: TName };\nexport function createBooleanInput<TName extends string>(\n input: Omit<BooleanInput, \"type\" | \"name\">\n): BooleanInput & { name: TName };\nexport function createBooleanInput<TName extends string>(\n input: any\n): BooleanInput & { name: TName } {\n return createInput({\n type: \"boolean\",\n renderer: \"Webiny/Switch\",\n ...input\n }) as BooleanInput & { name: TName };\n}\n\n// Color\nexport function createColorInput<TName extends string>(\n input: { name: TName } & Omit<ColorInput, \"type\" | \"name\">\n): ColorInput & { name: TName };\nexport function createColorInput<TName extends string>(\n input: Omit<ColorInput, \"type\" | \"name\">\n): ColorInput & { name: TName };\nexport function createColorInput<TName extends string>(input: any): ColorInput & { name: TName } {\n return createInput({\n type: \"color\",\n renderer: \"Webiny/ColorPicker\",\n ...input\n }) as ColorInput & { name: TName };\n}\n\n// File\nexport function createFileInput<TName extends string>(\n input: { name: TName } & Omit<FileInput, \"type\" | \"name\">\n): FileInput & { name: TName };\nexport function createFileInput<TName extends string>(\n input: Omit<FileInput, \"type\" | \"name\">\n): FileInput & { name: TName };\nexport function createFileInput<TName extends string>(input: any): FileInput & { name: TName } {\n return createInput({\n type: \"file\",\n renderer: \"Webiny/FileManager\",\n ...input\n }) as FileInput & { name: TName };\n}\n\n// Date\nexport function createDateInput<TName extends string>(\n input: { name: TName } & Omit<DateTimeInput, \"type\" | \"name\">\n): DateTimeInput & { name: TName };\nexport function createDateInput<TName extends string>(\n input: Omit<DateTimeInput, \"type\" | \"name\">\n): DateTimeInput & { name: TName };\nexport function createDateInput<TName extends string>(input: any): DateTimeInput & { name: TName } {\n return createInput({\n type: \"datetime\",\n renderer: \"Webiny/DateTime\",\n ...input\n }) as DateTimeInput & { name: TName };\n}\n\n// Rich Text\nexport function createLexicalInput<TName extends string>(\n input: { name: TName } & Omit<LexicalInput, \"type\" | \"name\">\n): LexicalInput & { name: TName };\nexport function createLexicalInput<TName extends string>(\n input: Omit<LexicalInput, \"type\" | \"name\">\n): LexicalInput & { name: TName };\nexport function createLexicalInput<TName extends string>(\n input: any\n): LexicalInput & { name: TName } {\n return createInput({\n type: \"lexical\",\n renderer: \"Webiny/Lexical\",\n ...input\n }) as LexicalInput & { name: TName };\n}\n\n// Select\nexport function createSelectInput<TName extends string>(\n input: { name: TName } & Omit<SelectInput, \"type\" | \"name\">\n): SelectInput & { name: TName };\nexport function createSelectInput<TName extends string>(\n input: Omit<SelectInput, \"type\" | \"name\">\n): SelectInput & { name: TName };\nexport function createSelectInput<TName extends string>(input: any): SelectInput & { name: TName } {\n return createInput({\n type: \"select\",\n renderer: \"Webiny/Select\",\n ...input\n }) as SelectInput & { name: TName };\n}\n\n// Radio\nexport function createRadioInput<TName extends string>(\n input: { name: TName } & Omit<RadioInput, \"type\" | \"name\">\n): RadioInput & { name: TName };\nexport function createRadioInput<TName extends string>(\n input: Omit<RadioInput, \"type\" | \"name\">\n): RadioInput & { name: TName };\nexport function createRadioInput<TName extends string>(input: any): RadioInput & { name: TName } {\n return createInput({\n type: \"radio\",\n renderer: \"Webiny/RadioGroup\",\n ...input\n }) as RadioInput & { name: TName };\n}\n\n// Object\nexport function createObjectInput<TName extends string>(\n input: { name: TName } & Omit<ObjectInput, \"type\" | \"name\">\n): ObjectInput & { name: TName };\nexport function createObjectInput<TName extends string>(\n input: Omit<ObjectInput, \"type\" | \"name\">\n): ObjectInput & { name: TName };\nexport function createObjectInput<TName extends string>(input: any): ObjectInput & { name: TName } {\n return createInput({\n type: \"object\",\n renderer: \"Webiny/Object\",\n ...input\n }) as ObjectInput & { name: TName };\n}\n\n// Tags\nexport function createTagsInput<TName extends string>(\n input: { name: TName } & Omit<TagsInput, \"type\" | \"name\">\n): TagsInput & { name: TName };\nexport function createTagsInput<TName extends string>(\n input: Omit<TagsInput, \"type\" | \"name\">\n): TagsInput & { name: TName };\nexport function createTagsInput<TName extends string>(input: any): TagsInput & { name: TName } {\n return createInput({\n type: \"text\",\n list: true,\n renderer: \"Webiny/Tags\",\n ...input\n }) as TagsInput & { name: TName };\n}\n\nexport function createSlotInput<TName extends string>(\n input: { name: TName } & Omit<SlotInput, \"type\" | \"name\">\n): SlotInput & { name: TName };\nexport function createSlotInput<TName extends string>(\n input: Omit<SlotInput, \"type\" | \"name\">\n): SlotInput & { name: TName };\nexport function createSlotInput<TName extends string>(input: any): SlotInput & { name: TName } {\n return createInput({\n type: \"slot\",\n list: true,\n renderer: \"Webiny/Slot\",\n defaultValue: [],\n ...input\n }) as SlotInput & { name: TName };\n}\n\n// Implementation\nexport function createInput(input: ComponentInput): ComponentInput {\n if (input.onChange) {\n // @ts-expect-error We don't use this function on the frontend, so this is ok.\n input.onChange = functionConverter.serialize(input.onChange!);\n }\n return input;\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IDataProvider, PublicPage } from "../types.js";
|
|
2
|
-
import type { ApiClient } from "
|
|
1
|
+
import type { IDataProvider, ListPagesOptions, ListPagesResult, PublicPage } from "../types.js";
|
|
2
|
+
import type { ApiClient } from "../dataProviders/ApiClient.js";
|
|
3
3
|
interface DefaultDataProviderConfig {
|
|
4
4
|
apiClient: ApiClient;
|
|
5
5
|
}
|
|
@@ -8,7 +8,7 @@ export declare class DefaultDataProvider implements IDataProvider {
|
|
|
8
8
|
constructor(config: DefaultDataProviderConfig);
|
|
9
9
|
getPageByPath(path: string): Promise<PublicPage | null>;
|
|
10
10
|
getPageById(id: string): Promise<PublicPage | null>;
|
|
11
|
-
listPages(): Promise<
|
|
11
|
+
listPages(options?: ListPagesOptions): Promise<ListPagesResult>;
|
|
12
12
|
private checkForErrors;
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -26,17 +26,30 @@ export class DefaultDataProvider {
|
|
|
26
26
|
this.checkForErrors("getPageById", result.websiteBuilder.getPageById);
|
|
27
27
|
return result.websiteBuilder.getPageById.data;
|
|
28
28
|
}
|
|
29
|
-
async listPages() {
|
|
29
|
+
async listPages(options) {
|
|
30
|
+
const {
|
|
31
|
+
where,
|
|
32
|
+
...rest
|
|
33
|
+
} = options ?? {};
|
|
30
34
|
const result = await this.config.apiClient.query({
|
|
31
35
|
query: LIST_PUBLISHED_PAGES,
|
|
32
36
|
variables: {
|
|
33
37
|
where: {
|
|
38
|
+
...where,
|
|
34
39
|
published: true
|
|
35
|
-
}
|
|
40
|
+
},
|
|
41
|
+
...rest
|
|
36
42
|
}
|
|
37
43
|
});
|
|
38
44
|
this.checkForErrors("listPages", result.websiteBuilder.listPages);
|
|
39
|
-
return
|
|
45
|
+
return {
|
|
46
|
+
data: result.websiteBuilder.listPages.data ?? [],
|
|
47
|
+
meta: result.websiteBuilder.listPages.meta ?? {
|
|
48
|
+
hasMoreItems: false,
|
|
49
|
+
totalCount: 0,
|
|
50
|
+
cursor: null
|
|
51
|
+
}
|
|
52
|
+
};
|
|
40
53
|
}
|
|
41
54
|
checkForErrors(action, data) {
|
|
42
55
|
if (data.error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GET_PAGE_BY_PATH","GET_PAGE_BY_ID","LIST_PUBLISHED_PAGES","ignoreActions","DefaultDataProvider","constructor","config","getPageByPath","path","result","apiClient","query","variables","checkForErrors","websiteBuilder","data","getPageById","id","listPages","where","published","action","error","some","item","includes","console","message"],"sources":["DefaultDataProvider.ts"],"sourcesContent":["import type { IDataProvider, PublicPage } from \"~/types.js\";\nimport type { ApiClient } from \"~/dataProviders/ApiClient.js\";\nimport { GET_PAGE_BY_PATH } from \"./GET_PAGE_BY_PATH.js\";\nimport { GET_PAGE_BY_ID } from \"./GET_PAGE_BY_ID.js\";\nimport { LIST_PUBLISHED_PAGES } from \"./LIST_PUBLISHED_PAGES.js\";\n\ninterface DefaultDataProviderConfig {\n apiClient: ApiClient;\n}\n\nconst ignoreActions = [\".well-known\", \"_next\"];\n\nexport class DefaultDataProvider implements IDataProvider {\n private config: DefaultDataProviderConfig;\n\n constructor(config: DefaultDataProviderConfig) {\n this.config = config;\n }\n\n public async getPageByPath(path: string): Promise<PublicPage | null> {\n const result = await this.config.apiClient.query({\n query: GET_PAGE_BY_PATH,\n variables: {\n path\n }\n });\n\n this.checkForErrors(`getPageByPath:${path}`, result.websiteBuilder.getPageByPath);\n\n return result.websiteBuilder.getPageByPath.data;\n }\n\n public async getPageById(id: string): Promise<PublicPage | null> {\n const result = await this.config.apiClient.query({\n query: GET_PAGE_BY_ID,\n variables: {\n id\n }\n });\n\n this.checkForErrors(\"getPageById\", result.websiteBuilder.getPageById);\n\n return result.websiteBuilder.getPageById.data;\n }\n\n public async listPages() {\n const result = await this.config.apiClient.query({\n query: LIST_PUBLISHED_PAGES,\n variables: {\n where: {\n published: true\n }\n }\n });\n\n this.checkForErrors(\"listPages\", result.websiteBuilder.listPages);\n\n return result.websiteBuilder.listPages.data ?? [];\n }\n\n private checkForErrors(action: string, data: any) {\n if (data.error) {\n // TODO: investigate how these ignored actions make their way to the SDK.\n if (ignoreActions.some(item => action.includes(item))) {\n return;\n }\n console.error(`Could not execute \"${action}\". Reason: ${data.error.message}`);\n }\n }\n}\n"],"mappings":"AAEA,SAASA,gBAAgB;AACzB,SAASC,cAAc;AACvB,SAASC,oBAAoB;AAM7B,MAAMC,aAAa,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC;AAE9C,OAAO,MAAMC,mBAAmB,CAA0B;EAGtDC,WAAWA,CAACC,MAAiC,EAAE;IAC3C,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAaC,aAAaA,CAACC,IAAY,EAA8B;IACjE,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACH,MAAM,CAACI,SAAS,CAACC,KAAK,CAAC;MAC7CA,KAAK,EAAEX,gBAAgB;MACvBY,SAAS,EAAE;QACPJ;MACJ;IACJ,CAAC,CAAC;IAEF,IAAI,CAACK,cAAc,CAAC,iBAAiBL,IAAI,EAAE,EAAEC,MAAM,CAACK,cAAc,CAACP,aAAa,CAAC;IAEjF,OAAOE,MAAM,CAACK,cAAc,CAACP,aAAa,CAACQ,IAAI;EACnD;EAEA,MAAaC,WAAWA,CAACC,EAAU,EAA8B;IAC7D,MAAMR,MAAM,GAAG,MAAM,IAAI,CAACH,MAAM,CAACI,SAAS,CAACC,KAAK,CAAC;MAC7CA,KAAK,EAAEV,cAAc;MACrBW,SAAS,EAAE;QACPK;MACJ;IACJ,CAAC,CAAC;IAEF,IAAI,CAACJ,cAAc,CAAC,aAAa,EAAEJ,MAAM,CAACK,cAAc,CAACE,WAAW,CAAC;IAErE,OAAOP,MAAM,CAACK,cAAc,CAACE,WAAW,CAACD,IAAI;EACjD;EAEA,MAAaG,SAASA,
|
|
1
|
+
{"version":3,"names":["GET_PAGE_BY_PATH","GET_PAGE_BY_ID","LIST_PUBLISHED_PAGES","ignoreActions","DefaultDataProvider","constructor","config","getPageByPath","path","result","apiClient","query","variables","checkForErrors","websiteBuilder","data","getPageById","id","listPages","options","where","rest","published","meta","hasMoreItems","totalCount","cursor","action","error","some","item","includes","console","message"],"sources":["DefaultDataProvider.ts"],"sourcesContent":["import type { IDataProvider, ListPagesOptions, ListPagesResult, PublicPage } from \"~/types.js\";\nimport type { ApiClient } from \"~/dataProviders/ApiClient.js\";\nimport { GET_PAGE_BY_PATH } from \"./GET_PAGE_BY_PATH.js\";\nimport { GET_PAGE_BY_ID } from \"./GET_PAGE_BY_ID.js\";\nimport { LIST_PUBLISHED_PAGES } from \"./LIST_PUBLISHED_PAGES.js\";\n\ninterface DefaultDataProviderConfig {\n apiClient: ApiClient;\n}\n\nconst ignoreActions = [\".well-known\", \"_next\"];\n\nexport class DefaultDataProvider implements IDataProvider {\n private config: DefaultDataProviderConfig;\n\n constructor(config: DefaultDataProviderConfig) {\n this.config = config;\n }\n\n public async getPageByPath(path: string): Promise<PublicPage | null> {\n const result = await this.config.apiClient.query({\n query: GET_PAGE_BY_PATH,\n variables: {\n path\n }\n });\n\n this.checkForErrors(`getPageByPath:${path}`, result.websiteBuilder.getPageByPath);\n\n return result.websiteBuilder.getPageByPath.data;\n }\n\n public async getPageById(id: string): Promise<PublicPage | null> {\n const result = await this.config.apiClient.query({\n query: GET_PAGE_BY_ID,\n variables: {\n id\n }\n });\n\n this.checkForErrors(\"getPageById\", result.websiteBuilder.getPageById);\n\n return result.websiteBuilder.getPageById.data;\n }\n\n public async listPages(options?: ListPagesOptions): Promise<ListPagesResult> {\n const { where, ...rest } = options ?? {};\n\n const result = await this.config.apiClient.query({\n query: LIST_PUBLISHED_PAGES,\n variables: {\n where: {\n ...where,\n published: true\n },\n ...rest\n }\n });\n\n this.checkForErrors(\"listPages\", result.websiteBuilder.listPages);\n\n return {\n data: result.websiteBuilder.listPages.data ?? [],\n meta: result.websiteBuilder.listPages.meta ?? {\n hasMoreItems: false,\n totalCount: 0,\n cursor: null\n }\n };\n }\n\n private checkForErrors(action: string, data: any) {\n if (data.error) {\n // TODO: investigate how these ignored actions make their way to the SDK.\n if (ignoreActions.some(item => action.includes(item))) {\n return;\n }\n console.error(`Could not execute \"${action}\". Reason: ${data.error.message}`);\n }\n }\n}\n"],"mappings":"AAEA,SAASA,gBAAgB;AACzB,SAASC,cAAc;AACvB,SAASC,oBAAoB;AAM7B,MAAMC,aAAa,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC;AAE9C,OAAO,MAAMC,mBAAmB,CAA0B;EAGtDC,WAAWA,CAACC,MAAiC,EAAE;IAC3C,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAaC,aAAaA,CAACC,IAAY,EAA8B;IACjE,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACH,MAAM,CAACI,SAAS,CAACC,KAAK,CAAC;MAC7CA,KAAK,EAAEX,gBAAgB;MACvBY,SAAS,EAAE;QACPJ;MACJ;IACJ,CAAC,CAAC;IAEF,IAAI,CAACK,cAAc,CAAC,iBAAiBL,IAAI,EAAE,EAAEC,MAAM,CAACK,cAAc,CAACP,aAAa,CAAC;IAEjF,OAAOE,MAAM,CAACK,cAAc,CAACP,aAAa,CAACQ,IAAI;EACnD;EAEA,MAAaC,WAAWA,CAACC,EAAU,EAA8B;IAC7D,MAAMR,MAAM,GAAG,MAAM,IAAI,CAACH,MAAM,CAACI,SAAS,CAACC,KAAK,CAAC;MAC7CA,KAAK,EAAEV,cAAc;MACrBW,SAAS,EAAE;QACPK;MACJ;IACJ,CAAC,CAAC;IAEF,IAAI,CAACJ,cAAc,CAAC,aAAa,EAAEJ,MAAM,CAACK,cAAc,CAACE,WAAW,CAAC;IAErE,OAAOP,MAAM,CAACK,cAAc,CAACE,WAAW,CAACD,IAAI;EACjD;EAEA,MAAaG,SAASA,CAACC,OAA0B,EAA4B;IACzE,MAAM;MAAEC,KAAK;MAAE,GAAGC;IAAK,CAAC,GAAGF,OAAO,IAAI,CAAC,CAAC;IAExC,MAAMV,MAAM,GAAG,MAAM,IAAI,CAACH,MAAM,CAACI,SAAS,CAACC,KAAK,CAAC;MAC7CA,KAAK,EAAET,oBAAoB;MAC3BU,SAAS,EAAE;QACPQ,KAAK,EAAE;UACH,GAAGA,KAAK;UACRE,SAAS,EAAE;QACf,CAAC;QACD,GAAGD;MACP;IACJ,CAAC,CAAC;IAEF,IAAI,CAACR,cAAc,CAAC,WAAW,EAAEJ,MAAM,CAACK,cAAc,CAACI,SAAS,CAAC;IAEjE,OAAO;MACHH,IAAI,EAAEN,MAAM,CAACK,cAAc,CAACI,SAAS,CAACH,IAAI,IAAI,EAAE;MAChDQ,IAAI,EAAEd,MAAM,CAACK,cAAc,CAACI,SAAS,CAACK,IAAI,IAAI;QAC1CC,YAAY,EAAE,KAAK;QACnBC,UAAU,EAAE,CAAC;QACbC,MAAM,EAAE;MACZ;IACJ,CAAC;EACL;EAEQb,cAAcA,CAACc,MAAc,EAAEZ,IAAS,EAAE;IAC9C,IAAIA,IAAI,CAACa,KAAK,EAAE;MACZ;MACA,IAAIzB,aAAa,CAAC0B,IAAI,CAACC,IAAI,IAAIH,MAAM,CAACI,QAAQ,CAACD,IAAI,CAAC,CAAC,EAAE;QACnD;MACJ;MACAE,OAAO,CAACJ,KAAK,CAAC,sBAAsBD,MAAM,cAAcZ,IAAI,CAACa,KAAK,CAACK,OAAO,EAAE,CAAC;IACjF;EACJ;AACJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GET_PAGE_BY_ID = "\n query GetPageById($id: ID!) {\n websiteBuilder {\n getPageById(id: $id) {\n data {\n id\n properties\n elements\n bindings\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
|
|
1
|
+
export declare const GET_PAGE_BY_ID = "\n query GetPageById($id: ID!) {\n websiteBuilder {\n getPageById(id: $id) {\n data {\n id\n properties\n elements\n bindings\n extensions\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GET_PAGE_BY_ID"],"sources":["GET_PAGE_BY_ID.ts"],"sourcesContent":["export const GET_PAGE_BY_ID = /* GraphQL*/ `\n query GetPageById($id: ID!) {\n websiteBuilder {\n getPageById(id: $id) {\n data {\n id\n properties\n elements\n bindings\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"mappings":"AAAA,OAAO,MAAMA,cAAc,GAAG,YAAa;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["GET_PAGE_BY_ID"],"sources":["GET_PAGE_BY_ID.ts"],"sourcesContent":["export const GET_PAGE_BY_ID = /* GraphQL*/ `\n query GetPageById($id: ID!) {\n websiteBuilder {\n getPageById(id: $id) {\n data {\n id\n properties\n elements\n bindings\n extensions\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"mappings":"AAAA,OAAO,MAAMA,cAAc,GAAG,YAAa;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GET_PAGE_BY_PATH = "\n query GetPageByPath($path: String!) {\n websiteBuilder {\n getPageByPath(path: $path) {\n data {\n id\n properties\n elements\n bindings\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
|
|
1
|
+
export declare const GET_PAGE_BY_PATH = "\n query GetPageByPath($path: String!) {\n websiteBuilder {\n getPageByPath(path: $path) {\n data {\n id\n properties\n elements\n bindings\n extensions\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GET_PAGE_BY_PATH"],"sources":["GET_PAGE_BY_PATH.ts"],"sourcesContent":["export const GET_PAGE_BY_PATH = /* GraphQL*/ `\n query GetPageByPath($path: String!) {\n websiteBuilder {\n getPageByPath(path: $path) {\n data {\n id\n properties\n elements\n bindings\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB,GAAG,YAAa;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["GET_PAGE_BY_PATH"],"sources":["GET_PAGE_BY_PATH.ts"],"sourcesContent":["export const GET_PAGE_BY_PATH = /* GraphQL*/ `\n query GetPageByPath($path: String!) {\n websiteBuilder {\n getPageByPath(path: $path) {\n data {\n id\n properties\n elements\n bindings\n extensions\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB,GAAG,YAAa;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIST_PUBLISHED_PAGES = "\n query ListPublishedPages($where: WbPagesListWhereInput) {\n websiteBuilder {\n listPages(where: $where) {\n data {\n id\n properties\n
|
|
1
|
+
export declare const LIST_PUBLISHED_PAGES = "\n query ListPublishedPages(\n $where: WbPagesListWhereInput\n $limit: Int\n $after: String\n $sort: [WbPageListSorter]\n $search: String\n ) {\n websiteBuilder {\n listPages(where: $where, limit: $limit, after: $after, sort: $sort, search: $search) {\n data {\n id\n properties\n metadata\n extensions\n }\n meta {\n hasMoreItems\n totalCount\n cursor\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
export const LIST_PUBLISHED_PAGES = /* GraphQL*/`
|
|
2
|
-
query ListPublishedPages(
|
|
2
|
+
query ListPublishedPages(
|
|
3
|
+
$where: WbPagesListWhereInput
|
|
4
|
+
$limit: Int
|
|
5
|
+
$after: String
|
|
6
|
+
$sort: [WbPageListSorter]
|
|
7
|
+
$search: String
|
|
8
|
+
) {
|
|
3
9
|
websiteBuilder {
|
|
4
|
-
listPages(where: $where) {
|
|
10
|
+
listPages(where: $where, limit: $limit, after: $after, sort: $sort, search: $search) {
|
|
5
11
|
data {
|
|
6
12
|
id
|
|
7
13
|
properties
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
metadata
|
|
15
|
+
extensions
|
|
16
|
+
}
|
|
17
|
+
meta {
|
|
18
|
+
hasMoreItems
|
|
19
|
+
totalCount
|
|
20
|
+
cursor
|
|
10
21
|
}
|
|
11
22
|
error {
|
|
12
23
|
code
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LIST_PUBLISHED_PAGES"],"sources":["LIST_PUBLISHED_PAGES.ts"],"sourcesContent":["export const LIST_PUBLISHED_PAGES = /* GraphQL*/ `\n query ListPublishedPages($where: WbPagesListWhereInput) {\n websiteBuilder {\n listPages(where: $where) {\n data {\n id\n properties\n
|
|
1
|
+
{"version":3,"names":["LIST_PUBLISHED_PAGES"],"sources":["LIST_PUBLISHED_PAGES.ts"],"sourcesContent":["export const LIST_PUBLISHED_PAGES = /* GraphQL*/ `\n query ListPublishedPages(\n $where: WbPagesListWhereInput\n $limit: Int\n $after: String\n $sort: [WbPageListSorter]\n $search: String\n ) {\n websiteBuilder {\n listPages(where: $where, limit: $limit, after: $after, sort: $sort, search: $search) {\n data {\n id\n properties\n metadata\n extensions\n }\n meta {\n hasMoreItems\n totalCount\n cursor\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"mappings":"AAAA,OAAO,MAAMA,oBAAoB,GAAG,YAAa;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -2,6 +2,13 @@ import type { IDataProvider, Page, PublicRedirect } from "../types.js";
|
|
|
2
2
|
export declare class NullDataProvider implements IDataProvider {
|
|
3
3
|
getPageById(): Promise<Page | null>;
|
|
4
4
|
getPageByPath(): Promise<Page | null>;
|
|
5
|
-
listPages(): Promise<
|
|
5
|
+
listPages(): Promise<{
|
|
6
|
+
data: never[];
|
|
7
|
+
meta: {
|
|
8
|
+
hasMoreItems: boolean;
|
|
9
|
+
totalCount: number;
|
|
10
|
+
cursor: null;
|
|
11
|
+
};
|
|
12
|
+
}>;
|
|
6
13
|
listRedirects(): Promise<PublicRedirect[]>;
|
|
7
14
|
}
|
|
@@ -6,7 +6,14 @@ export class NullDataProvider {
|
|
|
6
6
|
return Promise.resolve(null);
|
|
7
7
|
}
|
|
8
8
|
async listPages() {
|
|
9
|
-
return
|
|
9
|
+
return {
|
|
10
|
+
data: [],
|
|
11
|
+
meta: {
|
|
12
|
+
hasMoreItems: false,
|
|
13
|
+
totalCount: 0,
|
|
14
|
+
cursor: null
|
|
15
|
+
}
|
|
16
|
+
};
|
|
10
17
|
}
|
|
11
18
|
listRedirects() {
|
|
12
19
|
return Promise.resolve([]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NullDataProvider","getPageById","Promise","resolve","getPageByPath","listPages","listRedirects"],"sources":["NullDataProvider.ts"],"sourcesContent":["import type { IDataProvider, Page, PublicRedirect } from \"~/types.js\";\n\nexport class NullDataProvider implements IDataProvider {\n getPageById(): Promise<Page | null> {\n return Promise.resolve(null);\n }\n\n getPageByPath(): Promise<Page | null> {\n return Promise.resolve(null);\n }\n\n public async listPages() {\n return [];\n }\n\n listRedirects(): Promise<PublicRedirect[]> {\n return Promise.resolve([]);\n }\n}\n"],"mappings":"AAEA,OAAO,MAAMA,gBAAgB,CAA0B;EACnDC,WAAWA,CAAA,EAAyB;IAChC,OAAOC,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC;EAChC;EAEAC,aAAaA,CAAA,EAAyB;IAClC,OAAOF,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC;EAChC;EAEA,MAAaE,SAASA,CAAA,EAAG;IACrB,OAAO,EAAE;
|
|
1
|
+
{"version":3,"names":["NullDataProvider","getPageById","Promise","resolve","getPageByPath","listPages","data","meta","hasMoreItems","totalCount","cursor","listRedirects"],"sources":["NullDataProvider.ts"],"sourcesContent":["import type { IDataProvider, Page, PublicRedirect } from \"~/types.js\";\n\nexport class NullDataProvider implements IDataProvider {\n getPageById(): Promise<Page | null> {\n return Promise.resolve(null);\n }\n\n getPageByPath(): Promise<Page | null> {\n return Promise.resolve(null);\n }\n\n public async listPages() {\n return { data: [], meta: { hasMoreItems: false, totalCount: 0, cursor: null } };\n }\n\n listRedirects(): Promise<PublicRedirect[]> {\n return Promise.resolve([]);\n }\n}\n"],"mappings":"AAEA,OAAO,MAAMA,gBAAgB,CAA0B;EACnDC,WAAWA,CAAA,EAAyB;IAChC,OAAOC,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC;EAChC;EAEAC,aAAaA,CAAA,EAAyB;IAClC,OAAOF,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC;EAChC;EAEA,MAAaE,SAASA,CAAA,EAAG;IACrB,OAAO;MAAEC,IAAI,EAAE,EAAE;MAAEC,IAAI,EAAE;QAAEC,YAAY,EAAE,KAAK;QAAEC,UAAU,EAAE,CAAC;QAAEC,MAAM,EAAE;MAAK;IAAE,CAAC;EACnF;EAEAC,aAAaA,CAAA,EAA8B;IACvC,OAAOT,OAAO,CAACC,OAAO,CAAC,EAAE,CAAC;EAC9B;AACJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SetGlobalStyleBinding","constructor","elementId","bindingPath","binding","apply","document","bindings","styles"],"sources":["SetGlobalStyleBinding.ts"],"sourcesContent":["import type { Document, StyleValueBinding } from \"~/types.js\";\nimport type { IDocumentOperation } from \"./IDocumentOperation.js\";\n\nexport class SetGlobalStyleBinding implements IDocumentOperation {\n private readonly elementId: string;\n private readonly bindingPath: string;\n private readonly binding: StyleValueBinding;\n\n constructor(elementId: string, bindingPath: string, binding: StyleValueBinding) {\n this.elementId = elementId;\n this.bindingPath = bindingPath;\n this.binding = binding;\n }\n\n apply(document: Document) {\n const bindings = document.bindings[this.elementId] ?? { styles: {} };\n // @ts-expect-error String doesn't play well with CSSProperties.\n const binding = bindings.styles ? bindings.styles[this.bindingPath] ?? {} : {};\n document.bindings[this.elementId] = {\n ...bindings,\n styles: {\n ...bindings.styles,\n [this.bindingPath]: {\n ...binding,\n ...this.binding\n }\n }\n };\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,qBAAqB,CAA+B;EAK7DC,WAAWA,CAACC,SAAiB,EAAEC,WAAmB,EAAEC,OAA0B,EAAE;IAC5E,IAAI,CAACF,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,OAAO,GAAGA,OAAO;EAC1B;EAEAC,KAAKA,CAACC,QAAkB,EAAE;IACtB,MAAMC,QAAQ,GAAGD,QAAQ,CAACC,QAAQ,CAAC,IAAI,CAACL,SAAS,CAAC,IAAI;MAAEM,MAAM,EAAE,CAAC;IAAE,CAAC;IACpE;IACA,MAAMJ,OAAO,GAAGG,QAAQ,CAACC,MAAM,
|
|
1
|
+
{"version":3,"names":["SetGlobalStyleBinding","constructor","elementId","bindingPath","binding","apply","document","bindings","styles"],"sources":["SetGlobalStyleBinding.ts"],"sourcesContent":["import type { Document, StyleValueBinding } from \"~/types.js\";\nimport type { IDocumentOperation } from \"./IDocumentOperation.js\";\n\nexport class SetGlobalStyleBinding implements IDocumentOperation {\n private readonly elementId: string;\n private readonly bindingPath: string;\n private readonly binding: StyleValueBinding;\n\n constructor(elementId: string, bindingPath: string, binding: StyleValueBinding) {\n this.elementId = elementId;\n this.bindingPath = bindingPath;\n this.binding = binding;\n }\n\n apply(document: Document) {\n const bindings = document.bindings[this.elementId] ?? { styles: {} };\n // @ts-expect-error String doesn't play well with CSSProperties.\n const binding = bindings.styles ? (bindings.styles[this.bindingPath] ?? {}) : {};\n document.bindings[this.elementId] = {\n ...bindings,\n styles: {\n ...bindings.styles,\n [this.bindingPath]: {\n ...binding,\n ...this.binding\n }\n }\n };\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,qBAAqB,CAA+B;EAK7DC,WAAWA,CAACC,SAAiB,EAAEC,WAAmB,EAAEC,OAA0B,EAAE;IAC5E,IAAI,CAACF,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,OAAO,GAAGA,OAAO;EAC1B;EAEAC,KAAKA,CAACC,QAAkB,EAAE;IACtB,MAAMC,QAAQ,GAAGD,QAAQ,CAACC,QAAQ,CAAC,IAAI,CAACL,SAAS,CAAC,IAAI;MAAEM,MAAM,EAAE,CAAC;IAAE,CAAC;IACpE;IACA,MAAMJ,OAAO,GAAGG,QAAQ,CAACC,MAAM,GAAID,QAAQ,CAACC,MAAM,CAAC,IAAI,CAACL,WAAW,CAAC,IAAI,CAAC,CAAC,GAAI,CAAC,CAAC;IAChFG,QAAQ,CAACC,QAAQ,CAAC,IAAI,CAACL,SAAS,CAAC,GAAG;MAChC,GAAGK,QAAQ;MACXC,MAAM,EAAE;QACJ,GAAGD,QAAQ,CAACC,MAAM;QAClB,CAAC,IAAI,CAACL,WAAW,GAAG;UAChB,GAAGC,OAAO;UACV,GAAG,IAAI,CAACA;QACZ;MACJ;IACJ,CAAC;EACL;AACJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SetInputBindingOverride","constructor","elementId","bindingPath","binding","breakpoint","apply","document","bindings","breakpointOverrides","overrides","inputs"],"sources":["SetInputBindingOverride.ts"],"sourcesContent":["import type { Document, InputValueBinding } from \"~/types.js\";\nimport type { IDocumentOperation } from \"./IDocumentOperation.js\";\n\nexport class SetInputBindingOverride implements IDocumentOperation {\n private readonly elementId: string;\n private breakpoint: string;\n private readonly bindingPath: string;\n private readonly binding: InputValueBinding;\n\n constructor(\n elementId: string,\n bindingPath: string,\n binding: InputValueBinding,\n breakpoint: string\n ) {\n this.elementId = elementId;\n this.bindingPath = bindingPath;\n this.binding = binding;\n this.breakpoint = breakpoint;\n }\n\n apply(document: Document) {\n const bindings = document.bindings[this.elementId] ?? {};\n const breakpointOverrides = bindings.overrides\n ? bindings.overrides[this.breakpoint] ?? {}\n : { inputs: {} };\n\n const binding = breakpointOverrides.inputs\n ? breakpointOverrides.inputs[this.bindingPath]\n : {};\n\n document.bindings[this.elementId] = {\n ...bindings,\n overrides: {\n ...(bindings.overrides || {}),\n [this.breakpoint]: {\n ...breakpointOverrides,\n inputs: {\n ...(breakpointOverrides.inputs || {}),\n [this.bindingPath]: {\n ...binding,\n ...this.binding\n }\n }\n }\n }\n };\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,uBAAuB,CAA+B;EAM/DC,WAAWA,CACPC,SAAiB,EACjBC,WAAmB,EACnBC,OAA0B,EAC1BC,UAAkB,EACpB;IACE,IAAI,CAACH,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,UAAU,GAAGA,UAAU;EAChC;EAEAC,KAAKA,CAACC,QAAkB,EAAE;IACtB,MAAMC,QAAQ,GAAGD,QAAQ,CAACC,QAAQ,CAAC,IAAI,CAACN,SAAS,CAAC,IAAI,CAAC,CAAC;IACxD,MAAMO,mBAAmB,GAAGD,QAAQ,CAACE,SAAS,
|
|
1
|
+
{"version":3,"names":["SetInputBindingOverride","constructor","elementId","bindingPath","binding","breakpoint","apply","document","bindings","breakpointOverrides","overrides","inputs"],"sources":["SetInputBindingOverride.ts"],"sourcesContent":["import type { Document, InputValueBinding } from \"~/types.js\";\nimport type { IDocumentOperation } from \"./IDocumentOperation.js\";\n\nexport class SetInputBindingOverride implements IDocumentOperation {\n private readonly elementId: string;\n private breakpoint: string;\n private readonly bindingPath: string;\n private readonly binding: InputValueBinding;\n\n constructor(\n elementId: string,\n bindingPath: string,\n binding: InputValueBinding,\n breakpoint: string\n ) {\n this.elementId = elementId;\n this.bindingPath = bindingPath;\n this.binding = binding;\n this.breakpoint = breakpoint;\n }\n\n apply(document: Document) {\n const bindings = document.bindings[this.elementId] ?? {};\n const breakpointOverrides = bindings.overrides\n ? (bindings.overrides[this.breakpoint] ?? {})\n : { inputs: {} };\n\n const binding = breakpointOverrides.inputs\n ? breakpointOverrides.inputs[this.bindingPath]\n : {};\n\n document.bindings[this.elementId] = {\n ...bindings,\n overrides: {\n ...(bindings.overrides || {}),\n [this.breakpoint]: {\n ...breakpointOverrides,\n inputs: {\n ...(breakpointOverrides.inputs || {}),\n [this.bindingPath]: {\n ...binding,\n ...this.binding\n }\n }\n }\n }\n };\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,uBAAuB,CAA+B;EAM/DC,WAAWA,CACPC,SAAiB,EACjBC,WAAmB,EACnBC,OAA0B,EAC1BC,UAAkB,EACpB;IACE,IAAI,CAACH,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,UAAU,GAAGA,UAAU;EAChC;EAEAC,KAAKA,CAACC,QAAkB,EAAE;IACtB,MAAMC,QAAQ,GAAGD,QAAQ,CAACC,QAAQ,CAAC,IAAI,CAACN,SAAS,CAAC,IAAI,CAAC,CAAC;IACxD,MAAMO,mBAAmB,GAAGD,QAAQ,CAACE,SAAS,GACvCF,QAAQ,CAACE,SAAS,CAAC,IAAI,CAACL,UAAU,CAAC,IAAI,CAAC,CAAC,GAC1C;MAAEM,MAAM,EAAE,CAAC;IAAE,CAAC;IAEpB,MAAMP,OAAO,GAAGK,mBAAmB,CAACE,MAAM,GACpCF,mBAAmB,CAACE,MAAM,CAAC,IAAI,CAACR,WAAW,CAAC,GAC5C,CAAC,CAAC;IAERI,QAAQ,CAACC,QAAQ,CAAC,IAAI,CAACN,SAAS,CAAC,GAAG;MAChC,GAAGM,QAAQ;MACXE,SAAS,EAAE;QACP,IAAIF,QAAQ,CAACE,SAAS,IAAI,CAAC,CAAC,CAAC;QAC7B,CAAC,IAAI,CAACL,UAAU,GAAG;UACf,GAAGI,mBAAmB;UACtBE,MAAM,EAAE;YACJ,IAAIF,mBAAmB,CAACE,MAAM,IAAI,CAAC,CAAC,CAAC;YACrC,CAAC,IAAI,CAACR,WAAW,GAAG;cAChB,GAAGC,OAAO;cACV,GAAG,IAAI,CAACA;YACZ;UACJ;QACJ;MACJ;IACJ,CAAC;EACL;AACJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SetStyleBindingOverride","constructor","elementId","bindingPath","binding","breakpoint","apply","document","bindings","breakpointOverrides","overrides","styles"],"sources":["SetStyleBindingOverride.ts"],"sourcesContent":["import type { Document, StyleValueBinding } from \"~/types.js\";\nimport type { IDocumentOperation } from \"./IDocumentOperation.js\";\n\nexport class SetStyleBindingOverride implements IDocumentOperation {\n private readonly elementId: string;\n private breakpoint: string;\n private readonly bindingPath: string;\n private readonly binding: StyleValueBinding;\n\n constructor(\n elementId: string,\n bindingPath: string,\n binding: StyleValueBinding,\n breakpoint: string\n ) {\n this.elementId = elementId;\n this.bindingPath = bindingPath;\n this.binding = binding;\n this.breakpoint = breakpoint;\n }\n\n apply(document: Document) {\n const bindings = document.bindings[this.elementId] ?? {};\n const breakpointOverrides = bindings.overrides\n ? bindings.overrides[this.breakpoint] ?? {}\n : { styles: {} };\n\n const binding = breakpointOverrides.styles\n ? // @ts-expect-error String doesn't play well with CSSProperties.\n breakpointOverrides.styles[this.bindingPath]\n : {};\n\n document.bindings[this.elementId] = {\n ...bindings,\n overrides: {\n ...(bindings.overrides || {}),\n [this.breakpoint]: {\n ...breakpointOverrides,\n styles: {\n ...(breakpointOverrides.styles || {}),\n [this.bindingPath]: {\n ...binding,\n ...this.binding\n }\n }\n }\n }\n };\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,uBAAuB,CAA+B;EAM/DC,WAAWA,CACPC,SAAiB,EACjBC,WAAmB,EACnBC,OAA0B,EAC1BC,UAAkB,EACpB;IACE,IAAI,CAACH,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,UAAU,GAAGA,UAAU;EAChC;EAEAC,KAAKA,CAACC,QAAkB,EAAE;IACtB,MAAMC,QAAQ,GAAGD,QAAQ,CAACC,QAAQ,CAAC,IAAI,CAACN,SAAS,CAAC,IAAI,CAAC,CAAC;IACxD,MAAMO,mBAAmB,GAAGD,QAAQ,CAACE,SAAS,
|
|
1
|
+
{"version":3,"names":["SetStyleBindingOverride","constructor","elementId","bindingPath","binding","breakpoint","apply","document","bindings","breakpointOverrides","overrides","styles"],"sources":["SetStyleBindingOverride.ts"],"sourcesContent":["import type { Document, StyleValueBinding } from \"~/types.js\";\nimport type { IDocumentOperation } from \"./IDocumentOperation.js\";\n\nexport class SetStyleBindingOverride implements IDocumentOperation {\n private readonly elementId: string;\n private breakpoint: string;\n private readonly bindingPath: string;\n private readonly binding: StyleValueBinding;\n\n constructor(\n elementId: string,\n bindingPath: string,\n binding: StyleValueBinding,\n breakpoint: string\n ) {\n this.elementId = elementId;\n this.bindingPath = bindingPath;\n this.binding = binding;\n this.breakpoint = breakpoint;\n }\n\n apply(document: Document) {\n const bindings = document.bindings[this.elementId] ?? {};\n const breakpointOverrides = bindings.overrides\n ? (bindings.overrides[this.breakpoint] ?? {})\n : { styles: {} };\n\n const binding = breakpointOverrides.styles\n ? // @ts-expect-error String doesn't play well with CSSProperties.\n breakpointOverrides.styles[this.bindingPath]\n : {};\n\n document.bindings[this.elementId] = {\n ...bindings,\n overrides: {\n ...(bindings.overrides || {}),\n [this.breakpoint]: {\n ...breakpointOverrides,\n styles: {\n ...(breakpointOverrides.styles || {}),\n [this.bindingPath]: {\n ...binding,\n ...this.binding\n }\n }\n }\n }\n };\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,uBAAuB,CAA+B;EAM/DC,WAAWA,CACPC,SAAiB,EACjBC,WAAmB,EACnBC,OAA0B,EAC1BC,UAAkB,EACpB;IACE,IAAI,CAACH,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,UAAU,GAAGA,UAAU;EAChC;EAEAC,KAAKA,CAACC,QAAkB,EAAE;IACtB,MAAMC,QAAQ,GAAGD,QAAQ,CAACC,QAAQ,CAAC,IAAI,CAACN,SAAS,CAAC,IAAI,CAAC,CAAC;IACxD,MAAMO,mBAAmB,GAAGD,QAAQ,CAACE,SAAS,GACvCF,QAAQ,CAACE,SAAS,CAAC,IAAI,CAACL,UAAU,CAAC,IAAI,CAAC,CAAC,GAC1C;MAAEM,MAAM,EAAE,CAAC;IAAE,CAAC;IAEpB,MAAMP,OAAO,GAAGK,mBAAmB,CAACE,MAAM;IACpC;IACAF,mBAAmB,CAACE,MAAM,CAAC,IAAI,CAACR,WAAW,CAAC,GAC5C,CAAC,CAAC;IAERI,QAAQ,CAACC,QAAQ,CAAC,IAAI,CAACN,SAAS,CAAC,GAAG;MAChC,GAAGM,QAAQ;MACXE,SAAS,EAAE;QACP,IAAIF,QAAQ,CAACE,SAAS,IAAI,CAAC,CAAC,CAAC;QAC7B,CAAC,IAAI,CAACL,UAAU,GAAG;UACf,GAAGI,mBAAmB;UACtBE,MAAM,EAAE;YACJ,IAAIF,mBAAmB,CAACE,MAAM,IAAI,CAAC,CAAC,CAAC;YACrC,CAAC,IAAI,CAACR,WAAW,GAAG;cAChB,GAAGC,OAAO;cACV,GAAG,IAAI,CAACA;YACZ;UACJ;QACJ;MACJ;IACJ,CAAC;EACL;AACJ","ignoreList":[]}
|
package/generateElementId.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const generateElementId: (size?: number
|
|
1
|
+
export declare const generateElementId: (size?: number) => string;
|
package/generateElementId.js
CHANGED
package/generateElementId.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["customAlphabet","lowercase","numbers","DEFAULT_SIZE","generateElementId"],"sources":["generateElementId.ts"],"sourcesContent":["import { customAlphabet } from \"nanoid\";\
|
|
1
|
+
{"version":3,"names":["customAlphabet","lowercase","numbers","DEFAULT_SIZE","generateElementId"],"sources":["generateElementId.ts"],"sourcesContent":["import { customAlphabet } from \"nanoid\";\nimport { lowercase, numbers } from \"nanoid-dictionary\";\n\nconst DEFAULT_SIZE = 21;\n\nexport const generateElementId = customAlphabet(`${lowercase}${numbers}`, DEFAULT_SIZE);\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,QAAQ;AACvC,SAASC,SAAS,EAAEC,OAAO,QAAQ,mBAAmB;AAEtD,MAAMC,YAAY,GAAG,EAAE;AAEvB,OAAO,MAAMC,iBAAiB,GAAGJ,cAAc,CAAC,GAAGC,SAAS,GAAGC,OAAO,EAAE,EAAEC,YAAY,CAAC","ignoreList":[]}
|
package/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export * from "./MouseTracker.js";
|
|
|
12
12
|
export * from "./ViewportManager.js";
|
|
13
13
|
export * from "./messenger/Messenger.js";
|
|
14
14
|
export * from "./messenger/MessageOrigin.js";
|
|
15
|
-
export * from "./types.js";
|
|
15
|
+
export type * from "./types.js";
|
|
16
16
|
export * from "./DocumentStoreManager.js";
|
|
17
17
|
export * from "./BindingsProcessor.js";
|
|
18
18
|
export * from "./ResizeObserver.js";
|
package/index.js
CHANGED
|
@@ -12,7 +12,6 @@ export * from "./MouseTracker.js";
|
|
|
12
12
|
export * from "./ViewportManager.js";
|
|
13
13
|
export * from "./messenger/Messenger.js";
|
|
14
14
|
export * from "./messenger/MessageOrigin.js";
|
|
15
|
-
export * from "./types.js";
|
|
16
15
|
export * from "./DocumentStoreManager.js";
|
|
17
16
|
export * from "./BindingsProcessor.js";
|
|
18
17
|
export * from "./ResizeObserver.js";
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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 * from \"./types.js\";\nexport * from \"./DocumentStoreManager.js\";\nexport * from \"./BindingsProcessor.js\";\nexport * from \"./ResizeObserver.js\";\nexport * from \"./BindingsResolver.js\";\nexport * from \"./createElement.js\";\nexport * from \"./registerComponentGroup.js\";\nexport * from \"./jsonPatch.js\";\nexport * from \"./headersProvider.js\";\nexport * from \"./ComponentManifestToAstConverter.js\";\nexport * from \"./findMatchingAstNode.js\";\nexport * from \"./InheritanceProcessor.js\";\nexport * from \"./InputBindingsProcessor.js\";\nexport * from \"./StylesBindingsProcessor.js\";\nexport * from \"./ElementFactory.js\";\nexport { StyleSettings } from \"./constants.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"names":["StyleSettings"],"sources":["index.ts"],"sourcesContent":["export * from \"./createTheme.js\";\nexport * from \"./EditingSdk.js\";\nexport * from \"./LiveSdk.js\";\nexport * from \"./NullSdk.js\";\nexport * from \"./ContentSdk.js\";\nexport * from \"./Environment.js\";\nexport * from \"./DocumentStore.js\";\nexport * from \"./Logger.js\";\nexport * from \"./FunctionConverter.js\";\nexport * from \"./createInput.js\";\nexport * from \"./MouseTracker.js\";\nexport * from \"./ViewportManager.js\";\nexport * from \"./messenger/Messenger.js\";\nexport * from \"./messenger/MessageOrigin.js\";\nexport type * from \"./types.js\";\nexport * from \"./DocumentStoreManager.js\";\nexport * from \"./BindingsProcessor.js\";\nexport * from \"./ResizeObserver.js\";\nexport * from \"./BindingsResolver.js\";\nexport * from \"./createElement.js\";\nexport * from \"./registerComponentGroup.js\";\nexport * from \"./jsonPatch.js\";\nexport * from \"./headersProvider.js\";\nexport * from \"./ComponentManifestToAstConverter.js\";\nexport * from \"./findMatchingAstNode.js\";\nexport * from \"./InheritanceProcessor.js\";\nexport * from \"./InputBindingsProcessor.js\";\nexport * from \"./StylesBindingsProcessor.js\";\nexport * from \"./ElementFactory.js\";\nexport { StyleSettings } from \"./constants.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAa","ignoreList":[]}
|