@webiny/website-builder-sdk 6.3.0 → 6.4.0-beta.1

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 (154) hide show
  1. package/BindingsApi.js +29 -36
  2. package/BindingsApi.js.map +1 -1
  3. package/BindingsProcessor.js +34 -43
  4. package/BindingsProcessor.js.map +1 -1
  5. package/BindingsProcessor.test.js +82 -78
  6. package/BindingsProcessor.test.js.map +1 -1
  7. package/BindingsResolver.js +92 -119
  8. package/BindingsResolver.js.map +1 -1
  9. package/BindingsResolver.test.js +399 -363
  10. package/BindingsResolver.test.js.map +1 -1
  11. package/ComponentInputTraverser.js +28 -49
  12. package/ComponentInputTraverser.js.map +1 -1
  13. package/ComponentManifestToAstConverter.js +20 -21
  14. package/ComponentManifestToAstConverter.js.map +1 -1
  15. package/ComponentRegistry.js +26 -45
  16. package/ComponentRegistry.js.map +1 -1
  17. package/ComponentResolver.js +25 -29
  18. package/ComponentResolver.js.map +1 -1
  19. package/ConstraintEvaluator.js +246 -353
  20. package/ConstraintEvaluator.js.map +1 -1
  21. package/ConstraintEvaluator.test.js +1616 -1438
  22. package/ConstraintEvaluator.test.js.map +1 -1
  23. package/ContentSdk.js +83 -90
  24. package/ContentSdk.js.map +1 -1
  25. package/DocumentStore.js +47 -59
  26. package/DocumentStore.js.map +1 -1
  27. package/DocumentStoreManager.js +17 -16
  28. package/DocumentStoreManager.js.map +1 -1
  29. package/EditingSdk.js +87 -121
  30. package/EditingSdk.js.map +1 -1
  31. package/ElementFactory.js +126 -174
  32. package/ElementFactory.js.map +1 -1
  33. package/ElementFactory.test.js +234 -263
  34. package/ElementFactory.test.js.map +1 -1
  35. package/Environment.js +18 -19
  36. package/Environment.js.map +1 -1
  37. package/FunctionConverter.js +8 -7
  38. package/FunctionConverter.js.map +1 -1
  39. package/HashObject.js +11 -26
  40. package/HashObject.js.map +1 -1
  41. package/HotkeyManager.js +40 -47
  42. package/HotkeyManager.js.map +1 -1
  43. package/IBindingsUpdater.js +0 -3
  44. package/IRedirects.js +0 -3
  45. package/InheritanceProcessor.js +99 -139
  46. package/InheritanceProcessor.js.map +1 -1
  47. package/InheritanceProcessor.test.js +178 -179
  48. package/InheritanceProcessor.test.js.map +1 -1
  49. package/InheritedValueResolver.js +15 -20
  50. package/InheritedValueResolver.js.map +1 -1
  51. package/InputBindingsProcessor.js +187 -307
  52. package/InputBindingsProcessor.js.map +1 -1
  53. package/InputsBindingsProcessor.test.js +334 -315
  54. package/InputsBindingsProcessor.test.js.map +1 -1
  55. package/InputsUpdater.js +23 -26
  56. package/InputsUpdater.js.map +1 -1
  57. package/LiveSdk.js +12 -13
  58. package/LiveSdk.js.map +1 -1
  59. package/Logger.js +9 -8
  60. package/Logger.js.map +1 -1
  61. package/MouseTracker.js +77 -83
  62. package/MouseTracker.js.map +1 -1
  63. package/NullSdk.js +22 -21
  64. package/NullSdk.js.map +1 -1
  65. package/PreviewDocument.js +27 -30
  66. package/PreviewDocument.js.map +1 -1
  67. package/PreviewSdk.js +16 -17
  68. package/PreviewSdk.js.map +1 -1
  69. package/PreviewViewport.js +51 -63
  70. package/PreviewViewport.js.map +1 -1
  71. package/ResizeObserver.js +24 -31
  72. package/ResizeObserver.js.map +1 -1
  73. package/StylesBindingsProcessor.js +40 -79
  74. package/StylesBindingsProcessor.js.map +1 -1
  75. package/StylesUpdater.js +20 -25
  76. package/StylesUpdater.js.map +1 -1
  77. package/Theme.js +28 -25
  78. package/Theme.js.map +1 -1
  79. package/ViewportManager.js +89 -101
  80. package/ViewportManager.js.map +1 -1
  81. package/constants.js +7 -6
  82. package/constants.js.map +1 -1
  83. package/createElement.js +5 -6
  84. package/createElement.js.map +1 -1
  85. package/createInput.js +85 -143
  86. package/createInput.js.map +1 -1
  87. package/createTheme.js +2 -3
  88. package/createTheme.js.map +1 -1
  89. package/dataProviders/ApiClient.js +40 -49
  90. package/dataProviders/ApiClient.js.map +1 -1
  91. package/dataProviders/DefaultDataProvider.js +56 -58
  92. package/dataProviders/DefaultDataProvider.js.map +1 -1
  93. package/dataProviders/GET_PAGE_BY_ID.js +2 -1
  94. package/dataProviders/GET_PAGE_BY_ID.js.map +1 -1
  95. package/dataProviders/GET_PAGE_BY_PATH.js +2 -1
  96. package/dataProviders/GET_PAGE_BY_PATH.js.map +1 -1
  97. package/dataProviders/LIST_PUBLISHED_PAGES.js +2 -1
  98. package/dataProviders/LIST_PUBLISHED_PAGES.js.map +1 -1
  99. package/dataProviders/NullDataProvider.js +21 -20
  100. package/dataProviders/NullDataProvider.js.map +1 -1
  101. package/dataProviders/RedirectsProvider.js +24 -27
  102. package/dataProviders/RedirectsProvider.js.map +1 -1
  103. package/defaultBreakpoints.js +23 -22
  104. package/defaultBreakpoints.js.map +1 -1
  105. package/documentOperations/$addElementReferenceToParent.js +29 -32
  106. package/documentOperations/$addElementReferenceToParent.js.map +1 -1
  107. package/documentOperations/AddElement.js +8 -7
  108. package/documentOperations/AddElement.js.map +1 -1
  109. package/documentOperations/AddToParent.js +14 -13
  110. package/documentOperations/AddToParent.js.map +1 -1
  111. package/documentOperations/IDocumentOperation.js +0 -3
  112. package/documentOperations/RemoveElement.js +9 -15
  113. package/documentOperations/RemoveElement.js.map +1 -1
  114. package/documentOperations/SetGlobalInputBinding.js +23 -22
  115. package/documentOperations/SetGlobalInputBinding.js.map +1 -1
  116. package/documentOperations/SetGlobalStyleBinding.js +23 -23
  117. package/documentOperations/SetGlobalStyleBinding.js.map +1 -1
  118. package/documentOperations/SetInputBindingOverride.js +30 -29
  119. package/documentOperations/SetInputBindingOverride.js.map +1 -1
  120. package/documentOperations/SetStyleBindingOverride.js +30 -31
  121. package/documentOperations/SetStyleBindingOverride.js.map +1 -1
  122. package/documentOperations/index.js +9 -8
  123. package/documentOperations/index.js.map +1 -1
  124. package/findMatchingAstNode.js +11 -13
  125. package/findMatchingAstNode.js.map +1 -1
  126. package/generateElementId.js +2 -1
  127. package/generateElementId.js.map +1 -1
  128. package/headersProvider.js +4 -3
  129. package/headersProvider.js.map +1 -1
  130. package/index.js +0 -2
  131. package/jsonPatch.js +5 -9
  132. package/jsonPatch.js.map +1 -1
  133. package/messages.js +12 -11
  134. package/messages.js.map +1 -1
  135. package/messenger/MessageOrigin.js +12 -11
  136. package/messenger/MessageOrigin.js.map +1 -1
  137. package/messenger/Messenger.js +58 -69
  138. package/messenger/Messenger.js.map +1 -1
  139. package/messenger/index.js +0 -2
  140. package/package.json +5 -5
  141. package/registerComponentGroup.js +5 -6
  142. package/registerComponentGroup.js.map +1 -1
  143. package/types/ShorthandCssProperties.js +0 -3
  144. package/types/WebsiteBuilderTheme.js +0 -3
  145. package/types.d.ts +3 -0
  146. package/types.js +0 -3
  147. package/IBindingsUpdater.js.map +0 -1
  148. package/IRedirects.js.map +0 -1
  149. package/documentOperations/IDocumentOperation.js.map +0 -1
  150. package/index.js.map +0 -1
  151. package/messenger/index.js.map +0 -1
  152. package/types/ShorthandCssProperties.js.map +0 -1
  153. package/types/WebsiteBuilderTheme.js.map +0 -1
  154. package/types.js.map +0 -1
package/Theme.js.map CHANGED
@@ -1 +1 @@
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":[]}
1
+ {"version":3,"file":"Theme.js","sources":["../src/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"],"names":["Theme","input","custom","builtInOverrides","mergedBreakpoints","deepMerge","defaultBreakpoints","breakpoints","Object","name","breakpoint","a","b"],"mappings":";;AAQO,MAAMA;IACT,OAAO,KAAKC,KAA+B,EAAuB;QAC9D,MAAM,EAAEC,SAAS,CAAC,CAAC,EAAE,GAAGC,kBAAkB,GAAGF,OAAO,eAAe,CAAC;QAEpE,MAAMG,oBAAoBC,UAAAA,GAAa,CAAC;YACpC,CAAC;YACDC;YACAH;YACAD;SACH;QAED,MAAMK,cAA4B,EAAE;QACpCC,OAAO,OAAO,CAACJ,qBAAqB,CAAC,GAAG,OAAO,CAAC,CAAC,CAACK,MAAMC,WAAW;YAC/DH,YAAY,IAAI,CAAC;gBACbE;gBACA,GAAIC,UAAU;YAClB;QACJ;QAEA,OAAO;YACH,KAAKT,MAAM,GAAG;YACd,OAAOA,MAAM,KAAK;YAClB,aAAaM,YAAY,IAAI,CAAC,CAACI,GAAGC,IAAMA,EAAE,QAAQ,GAAGD,EAAE,QAAQ;YAC/D,QAAQV,OAAO,UAAU,EAAE;YAC3B,YAAY;gBACR,GAAGA,OAAO,UAAU;YACxB;QACJ;IACJ;AACJ"}
@@ -1,110 +1,98 @@
1
1
  "use client";
2
-
3
2
  import { environment } from "./Environment.js";
4
- export class ViewportManager {
5
- /**
6
- * We need this fallback breakpoint for server environments.
7
- */
8
- breakpoints = [{
9
- name: "desktop",
10
- title: "",
11
- description: "",
12
- icon: "",
13
- minWidth: 0,
14
- maxWidth: 4000
15
- }];
16
- constructor(timeout = 150) {
17
- this.changeTimeout = timeout;
18
- this.changeStartSubscribers = new Set();
19
- this.changeEndSubscribers = new Set();
20
- this.isChanging = false;
21
- this.changeTimer = null;
22
- this.handleViewportChange = this.handleViewportChange.bind(this);
23
- this.handleResize = this.handleResize.bind(this);
24
- if (environment.isClient()) {
25
- window.addEventListener("resize", this.handleResize, {
26
- passive: true
27
- });
3
+ class ViewportManager {
4
+ constructor(timeout = 150){
5
+ this.breakpoints = [
6
+ {
7
+ name: "desktop",
8
+ title: "",
9
+ description: "",
10
+ icon: "",
11
+ minWidth: 0,
12
+ maxWidth: 4000
13
+ }
14
+ ];
15
+ this.changeTimeout = timeout;
16
+ this.changeStartSubscribers = new Set();
17
+ this.changeEndSubscribers = new Set();
18
+ this.isChanging = false;
19
+ this.changeTimer = null;
20
+ this.handleViewportChange = this.handleViewportChange.bind(this);
21
+ this.handleResize = this.handleResize.bind(this);
22
+ if (environment.isClient()) window.addEventListener("resize", this.handleResize, {
23
+ passive: true
24
+ });
28
25
  }
29
- }
30
- setBreakpoints(breakpoints) {
31
- this.breakpoints = breakpoints;
32
- }
33
- onViewportChangeStart(callback) {
34
- this.changeStartSubscribers.add(callback);
35
- return () => this.changeStartSubscribers.delete(callback);
36
- }
37
- onViewportChangeEnd(callback) {
38
- this.changeEndSubscribers.add(callback);
39
- return () => this.changeEndSubscribers.delete(callback);
40
- }
41
-
42
- /**
43
- * Get the current viewport information
44
- */
45
- getViewport() {
46
- return this.getViewportInfo();
47
- }
48
- destroy() {
49
- if (environment.isClient()) {
50
- window.removeEventListener("resize", this.handleResize);
51
- if (this.changeTimer !== null) {
52
- clearTimeout(this.changeTimer);
53
- }
54
- this.changeStartSubscribers.clear();
55
- this.changeEndSubscribers.clear();
26
+ setBreakpoints(breakpoints) {
27
+ this.breakpoints = breakpoints;
28
+ }
29
+ onViewportChangeStart(callback) {
30
+ this.changeStartSubscribers.add(callback);
31
+ return ()=>this.changeStartSubscribers.delete(callback);
32
+ }
33
+ onViewportChangeEnd(callback) {
34
+ this.changeEndSubscribers.add(callback);
35
+ return ()=>this.changeEndSubscribers.delete(callback);
36
+ }
37
+ getViewport() {
38
+ return this.getViewportInfo();
39
+ }
40
+ destroy() {
41
+ if (environment.isClient()) {
42
+ window.removeEventListener("resize", this.handleResize);
43
+ if (null !== this.changeTimer) clearTimeout(this.changeTimer);
44
+ this.changeStartSubscribers.clear();
45
+ this.changeEndSubscribers.clear();
46
+ }
47
+ }
48
+ handleResize() {
49
+ this.handleViewportChange();
50
+ }
51
+ handleViewportChange() {
52
+ const viewportInfo = this.getViewportInfo();
53
+ if (!this.isChanging) {
54
+ this.isChanging = true;
55
+ this.notifySubscribers(this.changeStartSubscribers, viewportInfo);
56
+ }
57
+ if (null !== this.changeTimer) clearTimeout(this.changeTimer);
58
+ this.changeTimer = window.setTimeout(()=>{
59
+ this.isChanging = false;
60
+ this.notifySubscribers(this.changeEndSubscribers, viewportInfo);
61
+ }, this.changeTimeout);
56
62
  }
57
- }
58
- handleResize() {
59
- this.handleViewportChange();
60
- }
61
- handleViewportChange() {
62
- const viewportInfo = this.getViewportInfo();
63
- if (!this.isChanging) {
64
- this.isChanging = true;
65
- this.notifySubscribers(this.changeStartSubscribers, viewportInfo);
63
+ getViewportInfo() {
64
+ const modes = [
65
+ ...this.breakpoints
66
+ ].reverse();
67
+ const viewport = environment.isClient() ? {
68
+ width: window.innerWidth,
69
+ height: window.innerHeight,
70
+ scrollWidth: window.document.body.scrollWidth,
71
+ scrollHeight: window.document.body.scrollHeight,
72
+ scrollX: window.scrollX,
73
+ scrollY: window.scrollY
74
+ } : {
75
+ height: 0,
76
+ width: 2000,
77
+ scrollHeight: 0,
78
+ scrollWidth: 2000,
79
+ scrollX: 0,
80
+ scrollY: 0
81
+ };
82
+ const [breakpoint] = modes.filter((mode)=>mode.maxWidth >= viewport.width);
83
+ return {
84
+ ...viewport,
85
+ breakpoint: breakpoint.name,
86
+ breakpoints: this.breakpoints
87
+ };
66
88
  }
67
- if (this.changeTimer !== null) {
68
- clearTimeout(this.changeTimer);
89
+ notifySubscribers(subscribers, viewportInfo) {
90
+ subscribers.forEach((callback)=>{
91
+ if ("function" == typeof callback) callback(viewportInfo);
92
+ });
69
93
  }
70
- this.changeTimer = window.setTimeout(() => {
71
- this.isChanging = false;
72
- this.notifySubscribers(this.changeEndSubscribers, viewportInfo);
73
- }, this.changeTimeout);
74
- }
75
- getViewportInfo() {
76
- const modes = [...this.breakpoints].reverse();
77
- const viewport = environment.isClient() ? {
78
- width: window.innerWidth,
79
- height: window.innerHeight,
80
- scrollWidth: window.document.body.scrollWidth,
81
- scrollHeight: window.document.body.scrollHeight,
82
- scrollX: window.scrollX,
83
- scrollY: window.scrollY
84
- } : {
85
- // During SSR or Next.js build, viewport is not available.
86
- height: 0,
87
- width: 2000,
88
- scrollHeight: 0,
89
- scrollWidth: 2000,
90
- scrollX: 0,
91
- scrollY: 0
92
- };
93
- const [breakpoint] = modes.filter(mode => mode.maxWidth >= viewport.width);
94
- return {
95
- ...viewport,
96
- breakpoint: breakpoint.name,
97
- breakpoints: this.breakpoints
98
- };
99
- }
100
- notifySubscribers(subscribers, viewportInfo) {
101
- subscribers.forEach(callback => {
102
- if (typeof callback === "function") {
103
- callback(viewportInfo);
104
- }
105
- });
106
- }
107
94
  }
108
- export const viewportManager = new ViewportManager();
95
+ const viewportManager = new ViewportManager();
96
+ export { ViewportManager, viewportManager };
109
97
 
110
98
  //# sourceMappingURL=ViewportManager.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["environment","ViewportManager","breakpoints","name","title","description","icon","minWidth","maxWidth","constructor","timeout","changeTimeout","changeStartSubscribers","Set","changeEndSubscribers","isChanging","changeTimer","handleViewportChange","bind","handleResize","isClient","window","addEventListener","passive","setBreakpoints","onViewportChangeStart","callback","add","delete","onViewportChangeEnd","getViewport","getViewportInfo","destroy","removeEventListener","clearTimeout","clear","viewportInfo","notifySubscribers","setTimeout","modes","reverse","viewport","width","innerWidth","height","innerHeight","scrollWidth","document","body","scrollHeight","scrollX","scrollY","breakpoint","filter","mode","subscribers","forEach","viewportManager"],"sources":["ViewportManager.ts"],"sourcesContent":["\"use client\";\nimport type { Breakpoint } from \"~/types.js\";\nimport { environment } from \"~/Environment.js\";\n\nexport interface ViewportInfo {\n width: number;\n height: number;\n scrollWidth: number;\n scrollHeight: number;\n scrollX: number;\n scrollY: number;\n breakpoint: string;\n breakpoints: Breakpoint[];\n}\n\nexport class ViewportManager {\n private readonly changeTimeout: number;\n private readonly changeStartSubscribers: Set<(info: ViewportInfo) => void>;\n private readonly changeEndSubscribers: Set<(info: ViewportInfo) => void>;\n private isChanging: boolean;\n private changeTimer: number | null;\n\n /**\n * We need this fallback breakpoint for server environments.\n */\n private breakpoints: Breakpoint[] = [\n {\n name: \"desktop\",\n title: \"\",\n description: \"\",\n icon: \"\",\n minWidth: 0,\n maxWidth: 4000\n }\n ];\n\n constructor(timeout: number = 150) {\n this.changeTimeout = timeout;\n this.changeStartSubscribers = new Set();\n this.changeEndSubscribers = new Set();\n this.isChanging = false;\n this.changeTimer = null;\n\n this.handleViewportChange = this.handleViewportChange.bind(this);\n this.handleResize = this.handleResize.bind(this);\n\n if (environment.isClient()) {\n window.addEventListener(\"resize\", this.handleResize, { passive: true });\n }\n }\n\n public setBreakpoints(breakpoints: Breakpoint[]) {\n this.breakpoints = breakpoints;\n }\n\n public onViewportChangeStart(callback: (info: ViewportInfo) => void): () => void {\n this.changeStartSubscribers.add(callback);\n return () => this.changeStartSubscribers.delete(callback);\n }\n\n public onViewportChangeEnd(callback: (info: ViewportInfo) => void): () => void {\n this.changeEndSubscribers.add(callback);\n return () => this.changeEndSubscribers.delete(callback);\n }\n\n /**\n * Get the current viewport information\n */\n public getViewport(): ViewportInfo {\n return this.getViewportInfo();\n }\n\n public destroy(): void {\n if (environment.isClient()) {\n window.removeEventListener(\"resize\", this.handleResize);\n if (this.changeTimer !== null) {\n clearTimeout(this.changeTimer);\n }\n this.changeStartSubscribers.clear();\n this.changeEndSubscribers.clear();\n }\n }\n\n private handleResize(): void {\n this.handleViewportChange();\n }\n\n private handleViewportChange(): void {\n const viewportInfo = this.getViewportInfo();\n\n if (!this.isChanging) {\n this.isChanging = true;\n this.notifySubscribers(this.changeStartSubscribers, viewportInfo);\n }\n\n if (this.changeTimer !== null) {\n clearTimeout(this.changeTimer);\n }\n\n this.changeTimer = window.setTimeout(() => {\n this.isChanging = false;\n this.notifySubscribers(this.changeEndSubscribers, viewportInfo);\n }, this.changeTimeout);\n }\n\n private getViewportInfo(): ViewportInfo {\n const modes = [...this.breakpoints].reverse();\n const viewport = environment.isClient()\n ? {\n width: window.innerWidth,\n height: window.innerHeight,\n scrollWidth: window.document.body.scrollWidth,\n scrollHeight: window.document.body.scrollHeight,\n scrollX: window.scrollX,\n scrollY: window.scrollY\n }\n : {\n // During SSR or Next.js build, viewport is not available.\n height: 0,\n width: 2000,\n scrollHeight: 0,\n scrollWidth: 2000,\n scrollX: 0,\n scrollY: 0\n };\n\n const [breakpoint] = modes.filter(mode => mode.maxWidth >= viewport.width);\n\n return { ...viewport, breakpoint: breakpoint.name, breakpoints: this.breakpoints };\n }\n\n private notifySubscribers(\n subscribers: Set<(info: ViewportInfo) => void>,\n viewportInfo: ViewportInfo\n ): void {\n subscribers.forEach(callback => {\n if (typeof callback === \"function\") {\n callback(viewportInfo);\n }\n });\n }\n}\n\nexport const viewportManager = new ViewportManager();\n"],"mappings":"AAAA,YAAY;;AAEZ,S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,CAACrC,WAAW,CAAC,CAACsC,OAAO,CAAC,CAAC;IAC7C,MAAMC,QAAQ,GAAGzC,WAAW,CAACoB,QAAQ,CAAC,CAAC,GACjC;MACIsB,KAAK,EAAErB,MAAM,CAACsB,UAAU;MACxBC,MAAM,EAAEvB,MAAM,CAACwB,WAAW;MAC1BC,WAAW,EAAEzB,MAAM,CAAC0B,QAAQ,CAACC,IAAI,CAACF,WAAW;MAC7CG,YAAY,EAAE5B,MAAM,CAAC0B,QAAQ,CAACC,IAAI,CAACC,YAAY;MAC/CC,OAAO,EAAE7B,MAAM,CAAC6B,OAAO;MACvBC,OAAO,EAAE9B,MAAM,CAAC8B;IACpB,CAAC,GACD;MACI;MACAP,MAAM,EAAE,CAAC;MACTF,KAAK,EAAE,IAAI;MACXO,YAAY,EAAE,CAAC;MACfH,WAAW,EAAE,IAAI;MACjBI,OAAO,EAAE,CAAC;MACVC,OAAO,EAAE;IACb,CAAC;IAEP,MAAM,CAACC,UAAU,CAAC,GAAGb,KAAK,CAACc,MAAM,CAACC,IAAI,IAAIA,IAAI,CAAC9C,QAAQ,IAAIiC,QAAQ,CAACC,KAAK,CAAC;IAE1E,OAAO;MAAE,GAAGD,QAAQ;MAAEW,UAAU,EAAEA,UAAU,CAACjD,IAAI;MAAED,WAAW,EAAE,IAAI,CAACA;IAAY,CAAC;EACtF;EAEQmC,iBAAiBA,CACrBkB,WAA8C,EAC9CnB,YAA0B,EACtB;IACJmB,WAAW,CAACC,OAAO,CAAC9B,QAAQ,IAAI;MAC5B,IAAI,OAAOA,QAAQ,KAAK,UAAU,EAAE;QAChCA,QAAQ,CAACU,YAAY,CAAC;MAC1B;IACJ,CAAC,CAAC;EACN;AACJ;AAEA,OAAO,MAAMqB,eAAe,GAAG,IAAIxD,eAAe,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ViewportManager.js","sources":["../src/ViewportManager.ts"],"sourcesContent":["\"use client\";\nimport type { Breakpoint } from \"~/types.js\";\nimport { environment } from \"~/Environment.js\";\n\nexport interface ViewportInfo {\n width: number;\n height: number;\n scrollWidth: number;\n scrollHeight: number;\n scrollX: number;\n scrollY: number;\n breakpoint: string;\n breakpoints: Breakpoint[];\n}\n\nexport class ViewportManager {\n private readonly changeTimeout: number;\n private readonly changeStartSubscribers: Set<(info: ViewportInfo) => void>;\n private readonly changeEndSubscribers: Set<(info: ViewportInfo) => void>;\n private isChanging: boolean;\n private changeTimer: number | null;\n\n /**\n * We need this fallback breakpoint for server environments.\n */\n private breakpoints: Breakpoint[] = [\n {\n name: \"desktop\",\n title: \"\",\n description: \"\",\n icon: \"\",\n minWidth: 0,\n maxWidth: 4000\n }\n ];\n\n constructor(timeout: number = 150) {\n this.changeTimeout = timeout;\n this.changeStartSubscribers = new Set();\n this.changeEndSubscribers = new Set();\n this.isChanging = false;\n this.changeTimer = null;\n\n this.handleViewportChange = this.handleViewportChange.bind(this);\n this.handleResize = this.handleResize.bind(this);\n\n if (environment.isClient()) {\n window.addEventListener(\"resize\", this.handleResize, { passive: true });\n }\n }\n\n public setBreakpoints(breakpoints: Breakpoint[]) {\n this.breakpoints = breakpoints;\n }\n\n public onViewportChangeStart(callback: (info: ViewportInfo) => void): () => void {\n this.changeStartSubscribers.add(callback);\n return () => this.changeStartSubscribers.delete(callback);\n }\n\n public onViewportChangeEnd(callback: (info: ViewportInfo) => void): () => void {\n this.changeEndSubscribers.add(callback);\n return () => this.changeEndSubscribers.delete(callback);\n }\n\n /**\n * Get the current viewport information\n */\n public getViewport(): ViewportInfo {\n return this.getViewportInfo();\n }\n\n public destroy(): void {\n if (environment.isClient()) {\n window.removeEventListener(\"resize\", this.handleResize);\n if (this.changeTimer !== null) {\n clearTimeout(this.changeTimer);\n }\n this.changeStartSubscribers.clear();\n this.changeEndSubscribers.clear();\n }\n }\n\n private handleResize(): void {\n this.handleViewportChange();\n }\n\n private handleViewportChange(): void {\n const viewportInfo = this.getViewportInfo();\n\n if (!this.isChanging) {\n this.isChanging = true;\n this.notifySubscribers(this.changeStartSubscribers, viewportInfo);\n }\n\n if (this.changeTimer !== null) {\n clearTimeout(this.changeTimer);\n }\n\n this.changeTimer = window.setTimeout(() => {\n this.isChanging = false;\n this.notifySubscribers(this.changeEndSubscribers, viewportInfo);\n }, this.changeTimeout);\n }\n\n private getViewportInfo(): ViewportInfo {\n const modes = [...this.breakpoints].reverse();\n const viewport = environment.isClient()\n ? {\n width: window.innerWidth,\n height: window.innerHeight,\n scrollWidth: window.document.body.scrollWidth,\n scrollHeight: window.document.body.scrollHeight,\n scrollX: window.scrollX,\n scrollY: window.scrollY\n }\n : {\n // During SSR or Next.js build, viewport is not available.\n height: 0,\n width: 2000,\n scrollHeight: 0,\n scrollWidth: 2000,\n scrollX: 0,\n scrollY: 0\n };\n\n const [breakpoint] = modes.filter(mode => mode.maxWidth >= viewport.width);\n\n return { ...viewport, breakpoint: breakpoint.name, breakpoints: this.breakpoints };\n }\n\n private notifySubscribers(\n subscribers: Set<(info: ViewportInfo) => void>,\n viewportInfo: ViewportInfo\n ): void {\n subscribers.forEach(callback => {\n if (typeof callback === \"function\") {\n callback(viewportInfo);\n }\n });\n }\n}\n\nexport const viewportManager = new ViewportManager();\n"],"names":["ViewportManager","timeout","Set","environment","window","breakpoints","callback","clearTimeout","viewportInfo","modes","viewport","breakpoint","mode","subscribers","viewportManager"],"mappings":";;AAeO,MAAMA;IAqBT,YAAYC,UAAkB,GAAG,CAAE;QAZlC,KACO,WAAW,GAAiB;YAChC;gBACI,MAAM;gBACN,OAAO;gBACP,aAAa;gBACb,MAAM;gBACN,UAAU;gBACV,UAAU;YACd;SACH;QAGG,IAAI,CAAC,aAAa,GAAGA;QACrB,IAAI,CAAC,sBAAsB,GAAG,IAAIC;QAClC,IAAI,CAAC,oBAAoB,GAAG,IAAIA;QAChC,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,WAAW,GAAG;QAEnB,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC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AU,GAAG;YAClB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,oBAAoB,EAAEI;QACtD,GAAG,IAAI,CAAC,aAAa;IACzB;IAEQ,kBAAgC;QACpC,MAAMC,QAAQ;eAAI,IAAI,CAAC,WAAW;SAAC,CAAC,OAAO;QAC3C,MAAMC,WAAWP,YAAY,QAAQ,KAC/B;YACI,OAAOC,OAAO,UAAU;YACxB,QAAQA,OAAO,WAAW;YAC1B,aAAaA,OAAO,QAAQ,CAAC,IAAI,CAAC,WAAW;YAC7C,cAAcA,OAAO,QAAQ,CAAC,IAAI,CAAC,YAAY;YAC/C,SAASA,OAAO,OAAO;YACvB,SAASA,OAAO,OAAO;QAC3B,IACA;YAEI,QAAQ;YACR,OAAO;YACP,cAAc;YACd,aAAa;YACb,SAAS;YACT,SAAS;QACb;QAEN,MAAM,CAACO,WAAW,GAAGF,MAAM,MAAM,CAACG,CAAAA,OAAQA,KAAK,QAAQ,IAAIF,SAAS,KAAK;QAEzE,OAAO;YAAE,GAAGA,QAAQ;YAAE,YAAYC,WAAW,IAAI;YAAE,aAAa,IAAI,CAAC,WAAW;QAAC;IACrF;IAEQ,kBACJE,WAA8C,EAC9CL,YAA0B,EACtB;QACJK,YAAY,OAAO,CAACP,CAAAA;YAChB,IAAI,AAAoB,cAApB,OAAOA,UACPA,SAASE;QAEjB;IACJ;AACJ;AAEO,MAAMM,kBAAkB,IAAId"}
package/constants.js CHANGED
@@ -1,9 +1,10 @@
1
- export const StyleSettings = {
2
- Layout: "layout",
3
- Visibility: "visibility",
4
- Background: "background",
5
- MarginPadding: "marginPadding",
6
- Border: "border"
1
+ const StyleSettings = {
2
+ Layout: "layout",
3
+ Visibility: "visibility",
4
+ Background: "background",
5
+ MarginPadding: "marginPadding",
6
+ Border: "border"
7
7
  };
8
+ export { StyleSettings };
8
9
 
9
10
  //# sourceMappingURL=constants.js.map
package/constants.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["StyleSettings","Layout","Visibility","Background","MarginPadding","Border"],"sources":["constants.ts"],"sourcesContent":["export const StyleSettings = {\n Layout: \"layout\",\n Visibility: \"visibility\",\n Background: \"background\",\n MarginPadding: \"marginPadding\",\n Border: \"border\"\n};\n"],"mappings":"AAAA,OAAO,MAAMA,aAAa,GAAG;EACzBC,MAAM,EAAE,QAAQ;EAChBC,UAAU,EAAE,YAAY;EACxBC,UAAU,EAAE,YAAY;EACxBC,aAAa,EAAE,eAAe;EAC9BC,MAAM,EAAE;AACZ,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export const StyleSettings = {\n Layout: \"layout\",\n Visibility: \"visibility\",\n Background: \"background\",\n MarginPadding: \"marginPadding\",\n Border: \"border\"\n};\n"],"names":["StyleSettings"],"mappings":"AAAO,MAAMA,gBAAgB;IACzB,QAAQ;IACR,YAAY;IACZ,YAAY;IACZ,eAAe;IACf,QAAQ;AACZ"}
package/createElement.js CHANGED
@@ -1,8 +1,7 @@
1
- export const createElement = params => {
2
- return {
3
- action: "CreateElement",
4
- params
5
- };
6
- };
1
+ const createElement = (params)=>({
2
+ action: "CreateElement",
3
+ params
4
+ });
5
+ export { createElement };
7
6
 
8
7
  //# sourceMappingURL=createElement.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createElement","params","action"],"sources":["createElement.ts"],"sourcesContent":["import type { ResponsiveStyles } from \"~/types.js\";\n\nexport interface CreateElementParams {\n component: string;\n inputs?: Record<string, any>;\n styles?: ResponsiveStyles;\n}\n\nexport const createElement = (params: CreateElementParams) => {\n return {\n action: \"CreateElement\",\n params\n };\n};\n"],"mappings":"AAQA,OAAO,MAAMA,aAAa,GAAIC,MAA2B,IAAK;EAC1D,OAAO;IACHC,MAAM,EAAE,eAAe;IACvBD;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"createElement.js","sources":["../src/createElement.ts"],"sourcesContent":["import type { ResponsiveStyles } from \"~/types.js\";\n\nexport interface CreateElementParams {\n component: string;\n inputs?: Record<string, any>;\n styles?: ResponsiveStyles;\n}\n\nexport const createElement = (params: CreateElementParams) => {\n return {\n action: \"CreateElement\",\n params\n };\n};\n"],"names":["createElement","params"],"mappings":"AAQO,MAAMA,gBAAgB,CAACC,SACnB;QACH,QAAQ;QACRA;IACJ"}
package/createInput.js CHANGED
@@ -1,160 +1,102 @@
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
- */
21
- // Text
22
-
23
- export function createTextInput(input) {
24
- return createInput({
25
- type: "text",
26
- renderer: "Webiny/Input",
27
- ...input
28
- });
2
+ function createTextInput(input) {
3
+ return createInput({
4
+ type: "text",
5
+ renderer: "Webiny/Input",
6
+ ...input
7
+ });
29
8
  }
30
-
31
- // Long Text
32
-
33
- export function createLongTextInput(input) {
34
- return createInput({
35
- type: "longText",
36
- renderer: "Webiny/Textarea",
37
- ...input
38
- });
9
+ function createLongTextInput(input) {
10
+ return createInput({
11
+ type: "longText",
12
+ renderer: "Webiny/Textarea",
13
+ ...input
14
+ });
39
15
  }
40
-
41
- // Number
42
-
43
- export function createNumberInput(input) {
44
- return createInput({
45
- type: "number",
46
- renderer: "Webiny/Number",
47
- ...input
48
- });
16
+ function createNumberInput(input) {
17
+ return createInput({
18
+ type: "number",
19
+ renderer: "Webiny/Number",
20
+ ...input
21
+ });
49
22
  }
50
-
51
- // Boolean
52
-
53
- export function createBooleanInput(input) {
54
- return createInput({
55
- type: "boolean",
56
- renderer: "Webiny/Switch",
57
- ...input
58
- });
23
+ function createBooleanInput(input) {
24
+ return createInput({
25
+ type: "boolean",
26
+ renderer: "Webiny/Switch",
27
+ ...input
28
+ });
59
29
  }
60
-
61
- // Color
62
-
63
- export function createColorInput(input) {
64
- return createInput({
65
- type: "color",
66
- renderer: "Webiny/ColorPicker",
67
- ...input
68
- });
30
+ function createColorInput(input) {
31
+ return createInput({
32
+ type: "color",
33
+ renderer: "Webiny/ColorPicker",
34
+ ...input
35
+ });
69
36
  }
70
-
71
- // File
72
-
73
- export function createFileInput(input) {
74
- return createInput({
75
- type: "file",
76
- renderer: "Webiny/FileManager",
77
- ...input
78
- });
37
+ function createFileInput(input) {
38
+ return createInput({
39
+ type: "file",
40
+ renderer: "Webiny/FileManager",
41
+ ...input
42
+ });
79
43
  }
80
-
81
- // Date
82
-
83
- export function createDateInput(input) {
84
- return createInput({
85
- type: "datetime",
86
- renderer: "Webiny/DateTime",
87
- ...input
88
- });
44
+ function createDateInput(input) {
45
+ return createInput({
46
+ type: "datetime",
47
+ renderer: "Webiny/DateTime",
48
+ ...input
49
+ });
89
50
  }
90
-
91
- // Rich Text
92
-
93
- export function createLexicalInput(input) {
94
- return createInput({
95
- type: "lexical",
96
- renderer: "Webiny/Lexical",
97
- ...input
98
- });
51
+ function createLexicalInput(input) {
52
+ return createInput({
53
+ type: "lexical",
54
+ renderer: "Webiny/Lexical",
55
+ ...input
56
+ });
99
57
  }
100
-
101
- // Select
102
-
103
- export function createSelectInput(input) {
104
- return createInput({
105
- type: "select",
106
- renderer: "Webiny/Select",
107
- ...input
108
- });
58
+ function createSelectInput(input) {
59
+ return createInput({
60
+ type: "select",
61
+ renderer: "Webiny/Select",
62
+ ...input
63
+ });
109
64
  }
110
-
111
- // Radio
112
-
113
- export function createRadioInput(input) {
114
- return createInput({
115
- type: "radio",
116
- renderer: "Webiny/RadioGroup",
117
- ...input
118
- });
65
+ function createRadioInput(input) {
66
+ return createInput({
67
+ type: "radio",
68
+ renderer: "Webiny/RadioGroup",
69
+ ...input
70
+ });
119
71
  }
120
-
121
- // Object
122
-
123
- export function createObjectInput(input) {
124
- return createInput({
125
- type: "object",
126
- renderer: "Webiny/Object",
127
- ...input
128
- });
72
+ function createObjectInput(input) {
73
+ return createInput({
74
+ type: "object",
75
+ renderer: "Webiny/Object",
76
+ ...input
77
+ });
129
78
  }
130
-
131
- // Tags
132
-
133
- export function createTagsInput(input) {
134
- return createInput({
135
- type: "text",
136
- list: true,
137
- renderer: "Webiny/Tags",
138
- ...input
139
- });
79
+ function createTagsInput(input) {
80
+ return createInput({
81
+ type: "text",
82
+ list: true,
83
+ renderer: "Webiny/Tags",
84
+ ...input
85
+ });
140
86
  }
141
- export function createSlotInput(input) {
142
- return createInput({
143
- type: "slot",
144
- list: true,
145
- renderer: "Webiny/Slot",
146
- defaultValue: [],
147
- ...input
148
- });
87
+ function createSlotInput(input) {
88
+ return createInput({
89
+ type: "slot",
90
+ list: true,
91
+ renderer: "Webiny/Slot",
92
+ defaultValue: [],
93
+ ...input
94
+ });
149
95
  }
150
-
151
- // Implementation
152
- export function createInput(input) {
153
- if (input.onChange) {
154
- // @ts-expect-error We don't use this function on the frontend, so this is ok.
155
- input.onChange = functionConverter.serialize(input.onChange);
156
- }
157
- return input;
96
+ function createInput(input) {
97
+ if (input.onChange) input.onChange = functionConverter.serialize(input.onChange);
98
+ return input;
158
99
  }
100
+ export { createBooleanInput, createColorInput, createDateInput, createFileInput, createInput, createLexicalInput, createLongTextInput, createNumberInput, createObjectInput, createRadioInput, createSelectInput, createSlotInput, createTagsInput, createTextInput };
159
101
 
160
102
  //# sourceMappingURL=createInput.js.map
@@ -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","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":"AAgBA,SAASA,iBAAiB;;AAiB1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,OAAO,SAASC,eAAeA,CAAuBC,KAAU,EAA+B;EAC3F,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,MAAM;IACZC,QAAQ,EAAE,cAAc;IACxB,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;;AAOA,OAAO,SAASI,mBAAmBA,CAC/BJ,KAAU,EACqB;EAC/B,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,UAAU;IAChBC,QAAQ,EAAE,iBAAiB;IAC3B,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;;AAOA,OAAO,SAASK,iBAAiBA,CAAuBL,KAAU,EAAiC;EAC/F,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,QAAQ;IACdC,QAAQ,EAAE,eAAe;IACzB,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;;AAOA,OAAO,SAASM,kBAAkBA,CAC9BN,KAAU,EACoB;EAC9B,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,SAAS;IACfC,QAAQ,EAAE,eAAe;IACzB,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;;AAOA,OAAO,SAASO,gBAAgBA,CAAuBP,KAAU,EAAgC;EAC7F,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,OAAO;IACbC,QAAQ,EAAE,oBAAoB;IAC9B,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;;AAOA,OAAO,SAASQ,eAAeA,CAAuBR,KAAU,EAA+B;EAC3F,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C,IAAI,EAAE,MAAM;IACZa,IAAI,EAAE,IAAI;IACVZ,QAAQ,EAAE,aAAa;IACvBc,YAAY,EAAE,EAAE;IAChB,GAAGjB;EACP,CAAC,CAAC;AACN;;AAEA;AACA,OAAO,SAASC,WAAWA,CAACD,KAAqB,EAAkB;EAC/D,IAAIA,KAAK,CAACkB,QAAQ,EAAE;IAChB;IACAlB,KAAK,CAACkB,QAAQ,GAAGpB,iBAAiB,CAACqB,SAAS,CAACnB,KAAK,CAACkB,QAAS,CAAC;EACjE;EACA,OAAOlB,KAAK;AAChB","ignoreList":[]}
1
+ {"version":3,"file":"createInput.js","sources":["../src/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"],"names":["createTextInput","input","createInput","createLongTextInput","createNumberInput","createBooleanInput","createColorInput","createFileInput","createDateInput","createLexicalInput","createSelectInput","createRadioInput","createObjectInput","createTagsInput","createSlotInput","functionConverter"],"mappings":";AA0DO,SAASA,gBAAsCC,KAAU;IAC5D,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASE,oBACZF,KAAU;IAEV,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASG,kBAAwCH,KAAU;IAC9D,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASI,mBACZJ,KAAU;IAEV,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASK,iBAAuCL,KAAU;IAC7D,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASM,gBAAsCN,KAAU;IAC5D,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASO,gBAAsCP,KAAU;IAC5D,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASQ,mBACZR,KAAU;IAEV,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASS,kBAAwCT,KAAU;IAC9D,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASU,iBAAuCV,KAAU;IAC7D,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASW,kBAAwCX,KAAU;IAC9D,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASY,gBAAsCZ,KAAU;IAC5D,OAAOC,YAAY;QACf,MAAM;QACN,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AAQO,SAASa,gBAAsCb,KAAU;IAC5D,OAAOC,YAAY;QACf,MAAM;QACN,MAAM;QACN,UAAU;QACV,cAAc,EAAE;QAChB,GAAGD,KAAK;IACZ;AACJ;AAGO,SAASC,YAAYD,KAAqB;IAC7C,IAAIA,MAAM,QAAQ,EAEdA,MAAM,QAAQ,GAAGc,kBAAkB,SAAS,CAACd,MAAM,QAAQ;IAE/D,OAAOA;AACX"}
package/createTheme.js CHANGED
@@ -1,5 +1,4 @@
1
- export const createTheme = theme => {
2
- return theme;
3
- };
1
+ const createTheme = (theme)=>theme;
2
+ export { createTheme };
4
3
 
5
4
  //# sourceMappingURL=createTheme.js.map