@webiny/website-builder-sdk 6.0.0-alpha.5 β†’ 6.0.0-rc.0

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.
Files changed (64) hide show
  1. package/BindingsProcessor.test.js +1 -0
  2. package/BindingsProcessor.test.js.map +1 -1
  3. package/BindingsResolver.d.ts +1 -1
  4. package/BindingsResolver.js +2 -2
  5. package/BindingsResolver.js.map +1 -1
  6. package/BindingsResolver.test.js +1 -0
  7. package/BindingsResolver.test.js.map +1 -1
  8. package/DocumentStore.d.ts +1 -1
  9. package/ElementFactory.js.map +1 -1
  10. package/HotkeyManager.js +1 -1
  11. package/HotkeyManager.js.map +1 -1
  12. package/InheritanceProcessor.d.ts +2 -2
  13. package/InheritanceProcessor.test.js +1 -0
  14. package/InheritanceProcessor.test.js.map +1 -1
  15. package/InputsBindingsProcessor.test.js +1 -0
  16. package/InputsBindingsProcessor.test.js.map +1 -1
  17. package/InputsUpdater.d.ts +1 -1
  18. package/Logger.d.ts +2 -1
  19. package/README.md +10 -2
  20. package/StylesUpdater.d.ts +1 -1
  21. package/Theme.js +3 -10
  22. package/Theme.js.map +1 -1
  23. package/createInput.d.ts +123 -15
  24. package/createInput.js +32 -0
  25. package/createInput.js.map +1 -1
  26. package/dataProviders/DefaultDataProvider.d.ts +1 -1
  27. package/dataProviders/GET_PAGE_BY_ID.d.ts +1 -1
  28. package/dataProviders/GET_PAGE_BY_ID.js +1 -0
  29. package/dataProviders/GET_PAGE_BY_ID.js.map +1 -1
  30. package/dataProviders/GET_PAGE_BY_PATH.d.ts +1 -1
  31. package/dataProviders/GET_PAGE_BY_PATH.js +1 -0
  32. package/dataProviders/GET_PAGE_BY_PATH.js.map +1 -1
  33. package/dataProviders/LIST_PUBLISHED_PAGES.d.ts +1 -1
  34. package/dataProviders/LIST_PUBLISHED_PAGES.js +1 -0
  35. package/dataProviders/LIST_PUBLISHED_PAGES.js.map +1 -1
  36. package/documentOperations/SetGlobalStyleBinding.js.map +1 -1
  37. package/documentOperations/SetInputBindingOverride.js.map +1 -1
  38. package/documentOperations/SetStyleBindingOverride.js.map +1 -1
  39. package/generateElementId.d.ts +1 -1
  40. package/generateElementId.js +0 -1
  41. package/generateElementId.js.map +1 -1
  42. package/index.d.ts +1 -1
  43. package/index.js +0 -1
  44. package/index.js.map +1 -1
  45. package/jsonPatch.d.ts +1 -1
  46. package/messenger/Messenger.js +6 -6
  47. package/messenger/Messenger.js.map +1 -1
  48. package/package.json +14 -19
  49. package/types/WebsiteBuilderTheme.d.ts +42 -45
  50. package/types/WebsiteBuilderTheme.js.map +1 -1
  51. package/types.d.ts +26 -4
  52. package/types.js.map +1 -1
  53. package/lexical/createDefaultLexicalTheme.d.ts +0 -2
  54. package/lexical/createDefaultLexicalTheme.js +0 -84
  55. package/lexical/createDefaultLexicalTheme.js.map +0 -1
  56. package/lexical/createLexicalTheme.d.ts +0 -2
  57. package/lexical/createLexicalTheme.js +0 -7
  58. package/lexical/createLexicalTheme.js.map +0 -1
  59. package/lexical/deepMerge.d.ts +0 -1
  60. package/lexical/deepMerge.js +0 -23
  61. package/lexical/deepMerge.js.map +0 -1
  62. package/types/LexicalEditorTheme.d.ts +0 -2
  63. package/types/LexicalEditorTheme.js +0 -3
  64. package/types/LexicalEditorTheme.js.map +0 -1
package/README.md CHANGED
@@ -1,3 +1,11 @@
1
- # Website Builder SDK
1
+ # @webiny/website-builder-sdk
2
2
 
3
- An integration SDK for Webiny Website Builder.
3
+ > [!NOTE]
4
+ > This package is part of the [Webiny](https://www.webiny.com) monorepo.
5
+ > It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
6
+
7
+ πŸ“˜ **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
8
+
9
+ ---
10
+
11
+ _This README file is automatically generated during the publish process._
@@ -6,5 +6,5 @@ export declare class StylesUpdater implements IBindingsUpdater {
6
6
  private elementId;
7
7
  constructor(elementId: string, bindings: ElementStylesBindings);
8
8
  applyToDocument(document: Document): void;
9
- createJsonPatch(bindings: DocumentElementBindings): import("./jsonPatch.js").JsonPatchOperation[];
9
+ createJsonPatch(bindings: DocumentElementBindings): import("~/jsonPatch.js").JsonPatchOperation[];
10
10
  }
package/Theme.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import deepMerge from "deepmerge";
2
2
  import { defaultBreakpoints } from "./defaultBreakpoints.js";
3
- import { createLexicalTheme } from "./lexical/createLexicalTheme.js";
4
3
  export class Theme {
5
4
  static from(input) {
6
5
  const {
@@ -17,17 +16,11 @@ export class Theme {
17
16
  });
18
17
  return {
19
18
  css: input.css,
20
- cssVariables: input.cssVariables,
21
19
  fonts: input.fonts,
22
20
  breakpoints: breakpoints.sort((a, b) => b.maxWidth - a.maxWidth),
23
- lexical: createLexicalTheme(input?.lexical),
24
- styles: {
25
- colors: {
26
- ...input?.styles?.colors
27
- },
28
- typography: {
29
- ...input?.styles?.typography
30
- }
21
+ colors: input?.colors ?? [],
22
+ typography: {
23
+ ...input?.typography
31
24
  }
32
25
  };
33
26
  }
package/Theme.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["deepMerge","defaultBreakpoints","createLexicalTheme","Theme","from","input","custom","builtInOverrides","breakpoints","mergedBreakpoints","all","Object","entries","forEach","name","breakpoint","push","css","cssVariables","fonts","sort","a","b","maxWidth","lexical","styles","colors","typography"],"sources":["Theme.ts"],"sourcesContent":["import deepMerge from \"deepmerge\";\nimport type {\n Breakpoint,\n WebsiteBuilderTheme,\n WebsiteBuilderThemeInput\n} from \"~/types/WebsiteBuilderTheme.js\";\nimport { defaultBreakpoints } from \"~/defaultBreakpoints.js\";\nimport { createLexicalTheme } from \"~/lexical/createLexicalTheme.js\";\n\nexport class Theme {\n static from(input: WebsiteBuilderThemeInput): WebsiteBuilderTheme {\n const { custom = {}, ...builtInOverrides } = input?.breakpoints ?? {};\n\n const mergedBreakpoints = deepMerge.all([\n {},\n defaultBreakpoints,\n builtInOverrides,\n custom\n ]) as WebsiteBuilderThemeInput[\"breakpoints\"];\n\n const breakpoints: Breakpoint[] = [];\n Object.entries(mergedBreakpoints ?? {}).forEach(([name, breakpoint]) => {\n breakpoints.push({\n name,\n ...(breakpoint as Omit<Breakpoint, \"name\">)\n });\n });\n\n return {\n css: input.css,\n cssVariables: input.cssVariables,\n fonts: input.fonts,\n breakpoints: breakpoints.sort((a, b) => b.maxWidth - a.maxWidth),\n lexical: createLexicalTheme(input?.lexical),\n styles: {\n colors: {\n ...input?.styles?.colors\n },\n typography: {\n ...input?.styles?.typography\n }\n }\n };\n }\n}\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,WAAW;AAMjC,SAASC,kBAAkB;AAC3B,SAASC,kBAAkB;AAE3B,OAAO,MAAMC,KAAK,CAAC;EACf,OAAOC,IAAIA,CAACC,KAA+B,EAAuB;IAC9D,MAAM;MAAEC,MAAM,GAAG,CAAC,CAAC;MAAE,GAAGC;IAAiB,CAAC,GAAGF,KAAK,EAAEG,WAAW,IAAI,CAAC,CAAC;IAErE,MAAMC,iBAAiB,GAAGT,SAAS,CAACU,GAAG,CAAC,CACpC,CAAC,CAAC,EACFT,kBAAkB,EAClBM,gBAAgB,EAChBD,MAAM,CACT,CAA4C;IAE7C,MAAME,WAAyB,GAAG,EAAE;IACpCG,MAAM,CAACC,OAAO,CAACH,iBAAiB,IAAI,CAAC,CAAC,CAAC,CAACI,OAAO,CAAC,CAAC,CAACC,IAAI,EAAEC,UAAU,CAAC,KAAK;MACpEP,WAAW,CAACQ,IAAI,CAAC;QACbF,IAAI;QACJ,GAAIC;MACR,CAAC,CAAC;IACN,CAAC,CAAC;IAEF,OAAO;MACHE,GAAG,EAAEZ,KAAK,CAACY,GAAG;MACdC,YAAY,EAAEb,KAAK,CAACa,YAAY;MAChCC,KAAK,EAAEd,KAAK,CAACc,KAAK;MAClBX,WAAW,EAAEA,WAAW,CAACY,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKA,CAAC,CAACC,QAAQ,GAAGF,CAAC,CAACE,QAAQ,CAAC;MAChEC,OAAO,EAAEtB,kBAAkB,CAACG,KAAK,EAAEmB,OAAO,CAAC;MAC3CC,MAAM,EAAE;QACJC,MAAM,EAAE;UACJ,GAAGrB,KAAK,EAAEoB,MAAM,EAAEC;QACtB,CAAC;QACDC,UAAU,EAAE;UACR,GAAGtB,KAAK,EAAEoB,MAAM,EAAEE;QACtB;MACJ;IACJ,CAAC;EACL;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["deepMerge","defaultBreakpoints","Theme","from","input","custom","builtInOverrides","breakpoints","mergedBreakpoints","all","Object","entries","forEach","name","breakpoint","push","css","fonts","sort","a","b","maxWidth","colors","typography"],"sources":["Theme.ts"],"sourcesContent":["import deepMerge from \"deepmerge\";\nimport type {\n Breakpoint,\n WebsiteBuilderTheme,\n WebsiteBuilderThemeInput\n} from \"~/types/WebsiteBuilderTheme.js\";\nimport { defaultBreakpoints } from \"~/defaultBreakpoints.js\";\n\nexport class Theme {\n static from(input: WebsiteBuilderThemeInput): WebsiteBuilderTheme {\n const { custom = {}, ...builtInOverrides } = input?.breakpoints ?? {};\n\n const mergedBreakpoints = deepMerge.all([\n {},\n defaultBreakpoints,\n builtInOverrides,\n custom\n ]) as WebsiteBuilderThemeInput[\"breakpoints\"];\n\n const breakpoints: Breakpoint[] = [];\n Object.entries(mergedBreakpoints ?? {}).forEach(([name, breakpoint]) => {\n breakpoints.push({\n name,\n ...(breakpoint as Omit<Breakpoint, \"name\">)\n });\n });\n\n return {\n css: input.css,\n fonts: input.fonts,\n breakpoints: breakpoints.sort((a, b) => b.maxWidth - a.maxWidth),\n colors: input?.colors ?? [],\n typography: {\n ...input?.typography\n }\n };\n }\n}\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,WAAW;AAMjC,SAASC,kBAAkB;AAE3B,OAAO,MAAMC,KAAK,CAAC;EACf,OAAOC,IAAIA,CAACC,KAA+B,EAAuB;IAC9D,MAAM;MAAEC,MAAM,GAAG,CAAC,CAAC;MAAE,GAAGC;IAAiB,CAAC,GAAGF,KAAK,EAAEG,WAAW,IAAI,CAAC,CAAC;IAErE,MAAMC,iBAAiB,GAAGR,SAAS,CAACS,GAAG,CAAC,CACpC,CAAC,CAAC,EACFR,kBAAkB,EAClBK,gBAAgB,EAChBD,MAAM,CACT,CAA4C;IAE7C,MAAME,WAAyB,GAAG,EAAE;IACpCG,MAAM,CAACC,OAAO,CAACH,iBAAiB,IAAI,CAAC,CAAC,CAAC,CAACI,OAAO,CAAC,CAAC,CAACC,IAAI,EAAEC,UAAU,CAAC,KAAK;MACpEP,WAAW,CAACQ,IAAI,CAAC;QACbF,IAAI;QACJ,GAAIC;MACR,CAAC,CAAC;IACN,CAAC,CAAC;IAEF,OAAO;MACHE,GAAG,EAAEZ,KAAK,CAACY,GAAG;MACdC,KAAK,EAAEb,KAAK,CAACa,KAAK;MAClBV,WAAW,EAAEA,WAAW,CAACW,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKA,CAAC,CAACC,QAAQ,GAAGF,CAAC,CAACE,QAAQ,CAAC;MAChEC,MAAM,EAAElB,KAAK,EAAEkB,MAAM,IAAI,EAAE;MAC3BC,UAAU,EAAE;QACR,GAAGnB,KAAK,EAAEmB;MACd;IACJ,CAAC;EACL;AACJ","ignoreList":[]}
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 OmitType<T> = Omit<T, "type">;
3
- export declare function createTextInput(input: OmitType<TextInput>): TextInput;
4
- export declare function createLongTextInput(input: OmitType<LongTextInput>): ComponentInput;
5
- export declare function createNumberInput(input: OmitType<NumberInput>): NumberInput;
6
- export declare function createBooleanInput(input: OmitType<BooleanInput>): BooleanInput;
7
- export declare function createColorInput(input: OmitType<ColorInput>): ColorInput;
8
- export declare function createFileInput(input: OmitType<FileInput>): FileInput;
9
- export declare function createDateInput(input: OmitType<DateTimeInput>): DateTimeInput;
10
- export declare function createLexicalInput(input: OmitType<LexicalInput>): LexicalInput;
11
- export declare function createSelectInput(input: OmitType<SelectInput>): SelectInput;
12
- export declare function createRadioInput(input: OmitType<RadioInput>): RadioInput;
13
- export declare function createObjectInput(input: OmitType<ObjectInput>): ObjectInput;
14
- export declare function createTagsInput(input: OmitType<TagsInput>): TagsInput;
15
- export declare function createSlotInput(input: OmitType<SlotInput>): SlotInput;
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
  }
@@ -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
1
  import type { IDataProvider, PublicPage } from "../types.js";
2
- import type { ApiClient } from "./ApiClient.js";
2
+ import type { ApiClient } from "../dataProviders/ApiClient.js";
3
3
  interface DefaultDataProviderConfig {
4
4
  apiClient: ApiClient;
5
5
  }
@@ -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";
@@ -7,6 +7,7 @@ export const GET_PAGE_BY_ID = /* GraphQL*/`
7
7
  properties
8
8
  elements
9
9
  bindings
10
+ extensions
10
11
  }
11
12
  error {
12
13
  code
@@ -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";
@@ -7,6 +7,7 @@ export const GET_PAGE_BY_PATH = /* GraphQL*/`
7
7
  properties
8
8
  elements
9
9
  bindings
10
+ extensions
10
11
  }
11
12
  error {
12
13
  code
@@ -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 elements\n bindings\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
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 elements\n bindings\n extensions\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
@@ -7,6 +7,7 @@ export const LIST_PUBLISHED_PAGES = /* GraphQL*/`
7
7
  properties
8
8
  elements
9
9
  bindings
10
+ extensions
10
11
  }
11
12
  error {
12
13
  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 elements\n bindings\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,CAAC","ignoreList":[]}
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 elements\n bindings\n extensions\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,CAAC","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,GAAGD,QAAQ,CAACC,MAAM,CAAC,IAAI,CAACL,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC9EG,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
+ {"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,GACxCF,QAAQ,CAACE,SAAS,CAAC,IAAI,CAACL,UAAU,CAAC,IAAI,CAAC,CAAC,GACzC;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
+ {"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,GACxCF,QAAQ,CAACE,SAAS,CAAC,IAAI,CAACL,UAAU,CAAC,IAAI,CAAC,CAAC,GACzC;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":[]}
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":[]}
@@ -1 +1 @@
1
- export declare const generateElementId: (size?: number | undefined) => string;
1
+ export declare const generateElementId: (size?: number) => string;
@@ -1,5 +1,4 @@
1
1
  import { customAlphabet } from "nanoid";
2
- // @ts-expect-error
3
2
  import { lowercase, numbers } from "nanoid-dictionary";
4
3
  const DEFAULT_SIZE = 21;
5
4
  export const generateElementId = customAlphabet(`${lowercase}${numbers}`, DEFAULT_SIZE);
@@ -1 +1 @@
1
- {"version":3,"names":["customAlphabet","lowercase","numbers","DEFAULT_SIZE","generateElementId"],"sources":["generateElementId.ts"],"sourcesContent":["import { customAlphabet } from \"nanoid\";\n// @ts-expect-error\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;AACA,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":[]}
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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["StyleSettings"],"sources":["index.ts"],"sourcesContent":["export * from \"./createTheme.js\";\nexport * from \"./EditingSdk.js\";\nexport * from \"./LiveSdk.js\";\nexport * from \"./NullSdk.js\";\nexport * from \"./ContentSdk.js\";\nexport * from \"./Environment.js\";\nexport * from \"./DocumentStore.js\";\nexport * from \"./Logger.js\";\nexport * from \"./FunctionConverter.js\";\nexport * from \"./createInput.js\";\nexport * from \"./MouseTracker.js\";\nexport * from \"./ViewportManager.js\";\nexport * from \"./messenger/Messenger.js\";\nexport * from \"./messenger/MessageOrigin.js\";\nexport type * from \"./types.js\";\nexport * from \"./DocumentStoreManager.js\";\nexport * from \"./BindingsProcessor.js\";\nexport * from \"./ResizeObserver.js\";\nexport * from \"./BindingsResolver.js\";\nexport * from \"./createElement.js\";\nexport * from \"./registerComponentGroup.js\";\nexport * from \"./jsonPatch.js\";\nexport * from \"./headersProvider.js\";\nexport * from \"./ComponentManifestToAstConverter.js\";\nexport * from \"./findMatchingAstNode.js\";\nexport * from \"./InheritanceProcessor.js\";\nexport * from \"./InputBindingsProcessor.js\";\nexport * from \"./StylesBindingsProcessor.js\";\nexport * from \"./ElementFactory.js\";\nexport { StyleSettings } from \"./constants.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAa","ignoreList":[]}
package/jsonPatch.d.ts CHANGED
@@ -2,5 +2,5 @@ import type { Operation, Validator, PatchResult } from "fast-json-patch";
2
2
  export type { Operation as JsonPatchOperation, PatchResult as JsonPatchResult };
3
3
  export declare const jsonPatch: {
4
4
  compare: (tree1: object | any[], tree2: object | any[], invertible?: boolean) => Operation[];
5
- applyPatch: <T>(document: T, patch: Operation[], validateOperation?: boolean | Validator<T> | undefined, mutateDocument?: boolean, banPrototypeModifications?: boolean) => PatchResult<T>;
5
+ applyPatch: <T>(document: T, patch: Operation[], validateOperation?: boolean | Validator<T>, mutateDocument?: boolean, banPrototypeModifications?: boolean) => PatchResult<T>;
6
6
  };
@@ -1,4 +1,4 @@
1
- import micromatch from "micromatch";
1
+ import { isMatch } from "matcher";
2
2
  import { logger } from "../Logger.js";
3
3
  const ignored = ["preview.mouse.move", "preview.component.register", "preview.scroll",
4
4
  // "preview.viewport",
@@ -23,15 +23,15 @@ export class Messenger {
23
23
  if (!this.target.matches(event)) {
24
24
  return;
25
25
  }
26
- if (!type || !micromatch.isMatch(type, this.pattern)) {
26
+ if (!type || !isMatch(type, this.pattern)) {
27
27
  return;
28
28
  }
29
29
  const logicalType = this.stripPrefix(type);
30
30
  if (!this.isIgnored(logicalType)) {
31
- logger.debug(`${this.getTime()} --> [${this.source.origin}][${logicalType}]`, {
31
+ logger.debug({
32
32
  type,
33
33
  payload
34
- });
34
+ }, `${this.getTime()} --> [${this.source.origin}][${logicalType}]`);
35
35
  }
36
36
  const handlers = this.listeners.get(logicalType);
37
37
  if (handlers) {
@@ -59,10 +59,10 @@ export class Messenger {
59
59
  send(logicalType, payload) {
60
60
  const fullType = this.prefixGlob + logicalType;
61
61
  if (!this.isIgnored(logicalType)) {
62
- logger.debug(`${this.getTime()} <-- [${this.source.origin}][${logicalType}]`, {
62
+ logger.debug({
63
63
  type: fullType,
64
64
  payload
65
- });
65
+ }, `${this.getTime()} <-- [${this.source.origin}][${logicalType}]`);
66
66
  }
67
67
  this.target.window.postMessage({
68
68
  type: fullType,