@webiny/website-builder-sdk 0.0.0-unstable.df7a8bb475 → 0.0.0-unstable.e1999482d0

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 (362) 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.d.ts +4 -1
  8. package/BindingsResolver.js +92 -122
  9. package/BindingsResolver.js.map +1 -1
  10. package/BindingsResolver.test.js +399 -363
  11. package/BindingsResolver.test.js.map +1 -1
  12. package/ComponentInputTraverser.js +29 -49
  13. package/ComponentInputTraverser.js.map +1 -1
  14. package/ComponentManifestToAstConverter.d.ts +33 -1
  15. package/ComponentManifestToAstConverter.js +164 -21
  16. package/ComponentManifestToAstConverter.js.map +1 -1
  17. package/ComponentRegistry.d.ts +2 -1
  18. package/ComponentRegistry.js +40 -22
  19. package/ComponentRegistry.js.map +1 -1
  20. package/ComponentResolver.d.ts +6 -3
  21. package/ComponentResolver.js +30 -29
  22. package/ComponentResolver.js.map +1 -1
  23. package/ConstraintEvaluator.d.ts +41 -0
  24. package/ConstraintEvaluator.js +304 -0
  25. package/ConstraintEvaluator.js.map +1 -0
  26. package/ConstraintEvaluator.test.d.ts +1 -0
  27. package/ConstraintEvaluator.test.js +1771 -0
  28. package/ConstraintEvaluator.test.js.map +1 -0
  29. package/ContentSdk.d.ts +80 -4
  30. package/ContentSdk.js +190 -89
  31. package/ContentSdk.js.map +1 -1
  32. package/DocumentStore.d.ts +5 -0
  33. package/DocumentStore.js +49 -59
  34. package/DocumentStore.js.map +1 -1
  35. package/DocumentStore.test.d.ts +1 -0
  36. package/DocumentStore.test.js +126 -0
  37. package/DocumentStore.test.js.map +1 -0
  38. package/DocumentStoreManager.d.ts +9 -2
  39. package/DocumentStoreManager.js +36 -16
  40. package/DocumentStoreManager.js.map +1 -1
  41. package/EditingSdk.d.ts +19 -3
  42. package/EditingSdk.js +112 -121
  43. package/EditingSdk.js.map +1 -1
  44. package/ElementBindings.d.ts +28 -0
  45. package/ElementBindings.js +88 -0
  46. package/ElementBindings.js.map +1 -0
  47. package/ElementBindings.test.d.ts +1 -0
  48. package/ElementBindings.test.js +127 -0
  49. package/ElementBindings.test.js.map +1 -0
  50. package/ElementFactory.d.ts +13 -4
  51. package/ElementFactory.js +170 -164
  52. package/ElementFactory.js.map +1 -1
  53. package/ElementFactory.test.d.ts +1 -0
  54. package/ElementFactory.test.js +511 -0
  55. package/ElementFactory.test.js.map +1 -0
  56. package/ElementSelection.d.ts +20 -0
  57. package/ElementSelection.js +32 -0
  58. package/ElementSelection.js.map +1 -0
  59. package/ElementSelection.test.d.ts +1 -0
  60. package/ElementSelection.test.js +73 -0
  61. package/ElementSelection.test.js.map +1 -0
  62. package/Environment.d.ts +7 -0
  63. package/Environment.js +19 -19
  64. package/Environment.js.map +1 -1
  65. package/Environment.test.d.ts +1 -0
  66. package/Environment.test.js +39 -0
  67. package/Environment.test.js.map +1 -0
  68. package/FunctionConverter.js +8 -7
  69. package/FunctionConverter.js.map +1 -1
  70. package/GlobalComponentLanguage.d.ts +31 -0
  71. package/GlobalComponentLanguage.js +37 -0
  72. package/GlobalComponentLanguage.js.map +1 -0
  73. package/HashObject.js +11 -12
  74. package/HashObject.js.map +1 -1
  75. package/HotkeyManager.js +40 -47
  76. package/HotkeyManager.js.map +1 -1
  77. package/IBindingsUpdater.js +0 -3
  78. package/IRedirects.js +0 -3
  79. package/InheritanceProcessor.js +99 -139
  80. package/InheritanceProcessor.js.map +1 -1
  81. package/InheritanceProcessor.test.js +184 -177
  82. package/InheritanceProcessor.test.js.map +1 -1
  83. package/InheritedValueResolver.d.ts +6 -0
  84. package/InheritedValueResolver.js +22 -20
  85. package/InheritedValueResolver.js.map +1 -1
  86. package/InputBindingsProcessor.js +193 -289
  87. package/InputBindingsProcessor.js.map +1 -1
  88. package/InputRenderer.test.d.ts +1 -0
  89. package/InputRenderer.test.js +186 -0
  90. package/InputRenderer.test.js.map +1 -0
  91. package/InputsBindingsProcessor.test.js +464 -314
  92. package/InputsBindingsProcessor.test.js.map +1 -1
  93. package/InputsUpdater.d.ts +1 -1
  94. package/InputsUpdater.js +24 -26
  95. package/InputsUpdater.js.map +1 -1
  96. package/LayoutContentArea.d.ts +68 -0
  97. package/LayoutContentArea.js +78 -0
  98. package/LayoutContentArea.js.map +1 -0
  99. package/LayoutContentArea.test.d.ts +1 -0
  100. package/LayoutContentArea.test.js +111 -0
  101. package/LayoutContentArea.test.js.map +1 -0
  102. package/LiveSdk.d.ts +6 -3
  103. package/LiveSdk.js +16 -13
  104. package/LiveSdk.js.map +1 -1
  105. package/Logger.js +9 -8
  106. package/Logger.js.map +1 -1
  107. package/MouseTracker.js +77 -83
  108. package/MouseTracker.js.map +1 -1
  109. package/NullSdk.d.ts +5 -3
  110. package/NullSdk.js +25 -14
  111. package/NullSdk.js.map +1 -1
  112. package/PreviewDocument.d.ts +3 -1
  113. package/PreviewDocument.js +30 -30
  114. package/PreviewDocument.js.map +1 -1
  115. package/PreviewSdk.d.ts +7 -3
  116. package/PreviewSdk.js +23 -17
  117. package/PreviewSdk.js.map +1 -1
  118. package/PreviewViewport.d.ts +5 -0
  119. package/PreviewViewport.js +60 -63
  120. package/PreviewViewport.js.map +1 -1
  121. package/PreviewViewport.test.d.ts +1 -0
  122. package/PreviewViewport.test.js +27 -0
  123. package/PreviewViewport.test.js.map +1 -0
  124. package/RadioOptionInputs.test.d.ts +1 -0
  125. package/RadioOptionInputs.test.js +521 -0
  126. package/RadioOptionInputs.test.js.map +1 -0
  127. package/ResizeObserver.js +24 -31
  128. package/ResizeObserver.js.map +1 -1
  129. package/StylesBindingsProcessor.js +41 -79
  130. package/StylesBindingsProcessor.js.map +1 -1
  131. package/StylesUpdater.d.ts +1 -1
  132. package/StylesUpdater.js +23 -25
  133. package/StylesUpdater.js.map +1 -1
  134. package/Theme.js +30 -25
  135. package/Theme.js.map +1 -1
  136. package/ViewportManager.js +89 -101
  137. package/ViewportManager.js.map +1 -1
  138. package/asset/deliveryUrl.d.ts +41 -0
  139. package/asset/deliveryUrl.js +34 -0
  140. package/asset/deliveryUrl.js.map +1 -0
  141. package/asset/deliveryUrl.test.d.ts +1 -0
  142. package/asset/deliveryUrl.test.js +127 -0
  143. package/asset/deliveryUrl.test.js.map +1 -0
  144. package/asset/geometry.d.ts +7 -0
  145. package/asset/geometry.js +10 -0
  146. package/asset/geometry.js.map +1 -0
  147. package/asset/imageSrcSet.d.ts +63 -0
  148. package/asset/imageSrcSet.js +98 -0
  149. package/asset/imageSrcSet.js.map +1 -0
  150. package/asset/imageSrcSet.test.d.ts +1 -0
  151. package/asset/imageSrcSet.test.js +103 -0
  152. package/asset/imageSrcSet.test.js.map +1 -0
  153. package/asset/index.d.ts +5 -0
  154. package/asset/index.js +5 -0
  155. package/asset/normalize.d.ts +24 -0
  156. package/asset/normalize.js +106 -0
  157. package/asset/normalize.js.map +1 -0
  158. package/asset/normalize.test.d.ts +1 -0
  159. package/asset/normalize.test.js +263 -0
  160. package/asset/normalize.test.js.map +1 -0
  161. package/asset/types.d.ts +2 -0
  162. package/asset/types.js +0 -0
  163. package/componentLoader/ComponentLoader.d.ts +16 -0
  164. package/componentLoader/ComponentLoader.js +0 -0
  165. package/componentLoader/RegistryOnlyComponentLoader.d.ts +9 -0
  166. package/componentLoader/RegistryOnlyComponentLoader.js +8 -0
  167. package/componentLoader/RegistryOnlyComponentLoader.js.map +1 -0
  168. package/componentLoader/createComponentLoader.d.ts +7 -0
  169. package/componentLoader/createComponentLoader.js +10 -0
  170. package/componentLoader/createComponentLoader.js.map +1 -0
  171. package/componentLoader/defaultComponentLoader.d.ts +7 -0
  172. package/componentLoader/defaultComponentLoader.js +8 -0
  173. package/componentLoader/defaultComponentLoader.js.map +1 -0
  174. package/componentLoader/index.d.ts +3 -0
  175. package/componentLoader/index.js +3 -0
  176. package/constants.d.ts +1 -0
  177. package/constants.js +7 -5
  178. package/constants.js.map +1 -1
  179. package/contentClientState.test.d.ts +1 -0
  180. package/contentClientState.test.js +404 -0
  181. package/contentClientState.test.js.map +1 -0
  182. package/contentEntry/ContentEntryBindingsResolver.d.ts +33 -0
  183. package/contentEntry/ContentEntryBindingsResolver.js +52 -0
  184. package/contentEntry/ContentEntryBindingsResolver.js.map +1 -0
  185. package/contentEntry/ContentEntryCache.d.ts +49 -0
  186. package/contentEntry/ContentEntryCache.js +51 -0
  187. package/contentEntry/ContentEntryCache.js.map +1 -0
  188. package/contentEntry/resolveContentEntry.d.ts +74 -0
  189. package/contentEntry/resolveContentEntry.js +53 -0
  190. package/contentEntry/resolveContentEntry.js.map +1 -0
  191. package/contentEntry/resolveContentEntry.test.d.ts +1 -0
  192. package/contentEntry/resolveContentEntry.test.js +213 -0
  193. package/contentEntry/resolveContentEntry.test.js.map +1 -0
  194. package/createComponent.d.ts +5 -0
  195. package/createComponent.js +32 -0
  196. package/createComponent.js.map +1 -0
  197. package/createContentClient.d.ts +17 -0
  198. package/createContentClient.js +16 -0
  199. package/createContentClient.js.map +1 -0
  200. package/createContentClient.test.d.ts +1 -0
  201. package/createContentClient.test.js +165 -0
  202. package/createContentClient.test.js.map +1 -0
  203. package/createElement.js +5 -6
  204. package/createElement.js.map +1 -1
  205. package/createGlobalElementDocument.d.ts +6 -0
  206. package/createGlobalElementDocument.js +23 -0
  207. package/createGlobalElementDocument.js.map +1 -0
  208. package/createInput.d.ts +10 -2
  209. package/createInput.js +92 -143
  210. package/createInput.js.map +1 -1
  211. package/createTheme.js +2 -3
  212. package/createTheme.js.map +1 -1
  213. package/dataProviders/ApiClient.d.ts +13 -5
  214. package/dataProviders/ApiClient.js +58 -49
  215. package/dataProviders/ApiClient.js.map +1 -1
  216. package/dataProviders/ApiClient.test.d.ts +1 -0
  217. package/dataProviders/ApiClient.test.js +116 -0
  218. package/dataProviders/ApiClient.test.js.map +1 -0
  219. package/dataProviders/DefaultDataProvider.d.ts +7 -2
  220. package/dataProviders/DefaultDataProvider.js +103 -45
  221. package/dataProviders/DefaultDataProvider.js.map +1 -1
  222. package/dataProviders/DefaultDataProvider.test.d.ts +1 -0
  223. package/dataProviders/DefaultDataProvider.test.js +81 -0
  224. package/dataProviders/DefaultDataProvider.test.js.map +1 -0
  225. package/dataProviders/GET_EXPERIMENT_PAUSED.d.ts +1 -0
  226. package/dataProviders/GET_EXPERIMENT_PAUSED.js +17 -0
  227. package/dataProviders/GET_EXPERIMENT_PAUSED.js.map +1 -0
  228. package/dataProviders/GET_LAYOUT_BY_SLUG.d.ts +1 -0
  229. package/dataProviders/GET_LAYOUT_BY_SLUG.js +27 -0
  230. package/dataProviders/GET_LAYOUT_BY_SLUG.js.map +1 -0
  231. package/dataProviders/GET_PAGE_BY_ID.d.ts +1 -1
  232. package/dataProviders/GET_PAGE_BY_ID.js +10 -1
  233. package/dataProviders/GET_PAGE_BY_ID.js.map +1 -1
  234. package/dataProviders/GET_PAGE_BY_PATH.d.ts +1 -1
  235. package/dataProviders/GET_PAGE_BY_PATH.js +10 -1
  236. package/dataProviders/GET_PAGE_BY_PATH.js.map +1 -1
  237. package/dataProviders/GET_PAGE_EXPERIMENT.d.ts +1 -0
  238. package/dataProviders/GET_PAGE_EXPERIMENT.js +32 -0
  239. package/dataProviders/GET_PAGE_EXPERIMENT.js.map +1 -0
  240. package/dataProviders/GET_VARIANT_CONTENT.d.ts +1 -0
  241. package/dataProviders/GET_VARIANT_CONTENT.js +24 -0
  242. package/dataProviders/GET_VARIANT_CONTENT.js.map +1 -0
  243. package/dataProviders/LIST_PUBLISHED_PAGES.d.ts +1 -1
  244. package/dataProviders/LIST_PUBLISHED_PAGES.js +16 -5
  245. package/dataProviders/LIST_PUBLISHED_PAGES.js.map +1 -1
  246. package/dataProviders/NullDataProvider.d.ts +17 -4
  247. package/dataProviders/NullDataProvider.js +33 -13
  248. package/dataProviders/NullDataProvider.js.map +1 -1
  249. package/dataProviders/RedirectsProvider.js +24 -27
  250. package/dataProviders/RedirectsProvider.js.map +1 -1
  251. package/dataProviders/queries.test.d.ts +1 -0
  252. package/dataProviders/queries.test.js +53 -0
  253. package/dataProviders/queries.test.js.map +1 -0
  254. package/defaultBreakpoints.js +43 -22
  255. package/defaultBreakpoints.js.map +1 -1
  256. package/documentOperations/$addElementReferenceToParent.d.ts +1 -1
  257. package/documentOperations/$addElementReferenceToParent.js +30 -26
  258. package/documentOperations/$addElementReferenceToParent.js.map +1 -1
  259. package/documentOperations/AddElement.js +8 -7
  260. package/documentOperations/AddElement.js.map +1 -1
  261. package/documentOperations/AddToParent.d.ts +2 -2
  262. package/documentOperations/AddToParent.js +14 -13
  263. package/documentOperations/AddToParent.js.map +1 -1
  264. package/documentOperations/IDocumentOperation.js +0 -3
  265. package/documentOperations/RemoveElement.js +10 -7
  266. package/documentOperations/RemoveElement.js.map +1 -1
  267. package/documentOperations/SetGlobalInputBinding.js +23 -22
  268. package/documentOperations/SetGlobalInputBinding.js.map +1 -1
  269. package/documentOperations/SetGlobalStyleBinding.js +23 -23
  270. package/documentOperations/SetGlobalStyleBinding.js.map +1 -1
  271. package/documentOperations/SetInputBindingOverride.js +30 -29
  272. package/documentOperations/SetInputBindingOverride.js.map +1 -1
  273. package/documentOperations/SetStyleBindingOverride.js +30 -31
  274. package/documentOperations/SetStyleBindingOverride.js.map +1 -1
  275. package/documentOperations/index.js +9 -8
  276. package/documentOperations/index.js.map +1 -1
  277. package/experiments/PostHogAnalyticsProvider.d.ts +31 -0
  278. package/experiments/PostHogAnalyticsProvider.js +28 -0
  279. package/experiments/PostHogAnalyticsProvider.js.map +1 -0
  280. package/experiments/analyticsProvider.d.ts +4 -0
  281. package/experiments/analyticsProvider.js +11 -0
  282. package/experiments/analyticsProvider.js.map +1 -0
  283. package/experiments/bucketing.d.ts +27 -0
  284. package/experiments/bucketing.js +91 -0
  285. package/experiments/bucketing.js.map +1 -0
  286. package/experiments/bucketing.test.d.ts +1 -0
  287. package/experiments/bucketing.test.js +183 -0
  288. package/experiments/bucketing.test.js.map +1 -0
  289. package/experiments/index.d.ts +5 -0
  290. package/experiments/index.js +5 -0
  291. package/experiments/render.d.ts +82 -0
  292. package/experiments/render.js +149 -0
  293. package/experiments/render.js.map +1 -0
  294. package/experiments/types.d.ts +108 -0
  295. package/experiments/types.js +4 -0
  296. package/experiments/types.js.map +1 -0
  297. package/findMatchingAstNode.js +11 -13
  298. package/findMatchingAstNode.js.map +1 -1
  299. package/generateElementId.js +2 -1
  300. package/generateElementId.js.map +1 -1
  301. package/globalElements.d.ts +43 -0
  302. package/globalElements.js +79 -0
  303. package/globalElements.js.map +1 -0
  304. package/globalElements.test.d.ts +1 -0
  305. package/globalElements.test.js +343 -0
  306. package/globalElements.test.js.map +1 -0
  307. package/headersProvider.d.ts +1 -2
  308. package/headersProvider.js +4 -3
  309. package/headersProvider.js.map +1 -1
  310. package/image/geometry.d.ts +54 -0
  311. package/image/geometry.js +112 -0
  312. package/image/geometry.js.map +1 -0
  313. package/image/geometry.test.d.ts +1 -0
  314. package/image/geometry.test.js +190 -0
  315. package/image/geometry.test.js.map +1 -0
  316. package/image/index.d.ts +3 -0
  317. package/image/index.js +3 -0
  318. package/image/presets.d.ts +6 -0
  319. package/image/presets.js +20 -0
  320. package/image/presets.js.map +1 -0
  321. package/image/types.d.ts +10 -0
  322. package/image/types.js +0 -0
  323. package/index.d.ts +21 -0
  324. package/index.js +21 -2
  325. package/jsonPatch.js +5 -9
  326. package/jsonPatch.js.map +1 -1
  327. package/listItemId.d.ts +17 -0
  328. package/listItemId.js +14 -0
  329. package/listItemId.js.map +1 -0
  330. package/listItemId.test.d.ts +1 -0
  331. package/listItemId.test.js +265 -0
  332. package/listItemId.test.js.map +1 -0
  333. package/messages.d.ts +3 -0
  334. package/messages.js +15 -11
  335. package/messages.js.map +1 -1
  336. package/messenger/MessageOrigin.js +12 -11
  337. package/messenger/MessageOrigin.js.map +1 -1
  338. package/messenger/Messenger.js +58 -71
  339. package/messenger/Messenger.js.map +1 -1
  340. package/messenger/index.js +0 -2
  341. package/package.json +17 -16
  342. package/radioOptionInputs.d.ts +24 -0
  343. package/radioOptionInputs.js +26 -0
  344. package/radioOptionInputs.js.map +1 -0
  345. package/registerComponentGroup.js +5 -6
  346. package/registerComponentGroup.js.map +1 -1
  347. package/types/ShorthandCssProperties.js +0 -3
  348. package/types/WebsiteBuilderTheme.d.ts +12 -0
  349. package/types/WebsiteBuilderTheme.js +0 -3
  350. package/types.d.ts +338 -18
  351. package/types.js +0 -3
  352. package/withGlobalElementDefaults.d.ts +8 -0
  353. package/withGlobalElementDefaults.js +60 -0
  354. package/withGlobalElementDefaults.js.map +1 -0
  355. package/IBindingsUpdater.js.map +0 -1
  356. package/IRedirects.js.map +0 -1
  357. package/documentOperations/IDocumentOperation.js.map +0 -1
  358. package/index.js.map +0 -1
  359. package/messenger/index.js.map +0 -1
  360. package/types/ShorthandCssProperties.js.map +0 -1
  361. package/types/WebsiteBuilderTheme.js.map +0 -1
  362. package/types.js.map +0 -1
package/types.d.ts CHANGED
@@ -2,10 +2,13 @@ import type * as CSS from "csstype";
2
2
  import type { BindingsApi } from "./BindingsApi.js";
3
3
  import type { ShorthandCssProperties } from "./types/ShorthandCssProperties.js";
4
4
  import type { InputFactory } from "./createInput.js";
5
+ import type { Breakpoint } from "./types/WebsiteBuilderTheme.js";
6
+ import type { ActiveExperiment, VariantContent } from "./experiments/types.js";
5
7
  export type { WebsiteBuilderTheme, Breakpoint } from "./types/WebsiteBuilderTheme.js";
6
8
  type CSSProperties = CSS.Properties<string | number>;
7
9
  export type ElementMap = Record<string, DocumentElement>;
8
10
  export type DocumentState = Record<string, any>;
11
+ export type DocumentMetadata = Record<string, any>;
9
12
  export type InputValueBinding<T = any> = ValueBinding<T> & {
10
13
  id: string;
11
14
  type: string;
@@ -75,24 +78,138 @@ export type ComponentGroup = {
75
78
  name: string;
76
79
  label: string;
77
80
  description?: string;
81
+ icon?: string;
78
82
  filter?: (component: ComponentManifest, context: ComponentGroupFilterContext) => boolean;
79
83
  };
80
84
  export type ResponsiveStyles = {
81
85
  [key: string]: SerializableCSSStyleDeclaration;
82
86
  };
87
+ export type ConstraintElementContext = {
88
+ /** Component name (e.g., "FunnelBuilder/Step") */
89
+ name: string;
90
+ /** Component tags */
91
+ tags: string[];
92
+ /** Get the parent element context. undefined for root. */
93
+ getParent(): ConstraintElementContext | undefined;
94
+ /** Index of this element among siblings in the same parent slot. -1 if not in a list slot. */
95
+ childIndex(): number;
96
+ /** Total siblings in the same parent slot. -1 if not in a list slot. */
97
+ childCount(): number;
98
+ /** True if this element is the last among siblings in its parent slot. */
99
+ isLastChild(): boolean;
100
+ /** True if this element is the first among siblings in its parent slot. */
101
+ isFirstChild(): boolean;
102
+ };
103
+ export type ConstraintContext = {
104
+ /** The component/element this constraint is about */
105
+ component: ConstraintElementContext;
106
+ /** The direct parent element at the drop target */
107
+ parent: ConstraintElementContext;
108
+ /** The target slot name (e.g., "children", "leftColumn", "rightColumn") */
109
+ slot: string;
110
+ /** True if the direct parent is the given component */
111
+ isChildOf: (componentName: string) => boolean;
112
+ /** True if any ancestor (including parent) is the given component */
113
+ isDescendantOf: (componentName: string) => boolean;
114
+ /** Find the nearest ancestor matching a component name */
115
+ getAncestor: (componentName: string) => ConstraintElementContext | undefined;
116
+ /** True if the component being placed has the given tag */
117
+ hasTag: (tag: string) => boolean;
118
+ /** Number of items currently in the target slot */
119
+ slotChildCount: () => number;
120
+ /** Count instances of a component type in the entire document */
121
+ countInstances: (componentName: string) => number;
122
+ /** True if the component has any descendant element carrying the given tag */
123
+ hasDescendantWithTag: (tag: string) => boolean;
124
+ /** Returns the resolved inputs of the nearest ancestor matching componentName, or undefined */
125
+ getAncestorInputs: (componentName: string) => Record<string, any> | undefined;
126
+ /** Returns the resolved inputs of the element this constraint is evaluating */
127
+ getElementInputs: () => Record<string, any>;
128
+ /** Debug logger — safe to call inside serialized constraints */
129
+ log: (...args: any[]) => void;
130
+ /** Block placement with an error message shown to the user */
131
+ block: (message: string) => never;
132
+ };
133
+ /**
134
+ * A constraint function. Call `ctx.block("message")` to block placement.
135
+ * Returning without blocking means the constraint passes.
136
+ */
137
+ export type ComponentConstraint = (ctx: ConstraintContext) => void;
138
+ export type Stop = symbol;
139
+ export type Continue = symbol;
140
+ export type HandlerResult = void | Stop | Continue;
141
+ export type OnChangeAction = "create" | "update" | "delete";
142
+ export type OnChangeElementContext = {
143
+ id: string;
144
+ component: ComponentManifest;
145
+ inputs: Record<string, any>;
146
+ };
147
+ export type ManifestAncestorContext = {
148
+ id: string;
149
+ component: ComponentManifest;
150
+ inputs: Record<string, any>;
151
+ updateInputs: (cb: (inputs: Record<string, any>) => void) => void;
152
+ getElement: (id: string) => OnChangeElementContext | undefined;
153
+ };
154
+ export type ComponentChangeContext<TInputs = Record<string, any>> = {
155
+ action: OnChangeAction;
156
+ id: string;
157
+ component: ComponentManifest;
158
+ inputs: TInputs;
159
+ styles: Record<string, any>;
160
+ getAncestor: (componentName: string) => ManifestAncestorContext | undefined;
161
+ getElement: (id: string) => OnChangeElementContext | undefined;
162
+ createElement: (params: any) => any;
163
+ executeCommand: <T = unknown>(command: string, payload?: T) => void;
164
+ breakpoint: string;
165
+ log: (...args: any[]) => void;
166
+ stop: () => Stop;
167
+ continue: () => Continue;
168
+ };
169
+ export type DescendantChangeContext<TInputs = Record<string, any>, TDescendantInputs = Record<string, any>> = {
170
+ action: OnChangeAction;
171
+ descendant: {
172
+ component: ComponentManifest;
173
+ id: string;
174
+ inputs: TDescendantInputs;
175
+ updateInputs: (cb: (inputs: TDescendantInputs) => void) => void;
176
+ };
177
+ inputs: TInputs;
178
+ updateInputs: (cb: (inputs: TInputs) => void) => void;
179
+ getElement: (id: string) => OnChangeElementContext | undefined;
180
+ executeCommand: <T = unknown>(command: string, payload?: T) => void;
181
+ breakpoint: string;
182
+ log: (...args: any[]) => void;
183
+ stop: () => Stop;
184
+ continue: () => Continue;
185
+ };
186
+ export type ComponentChangeHandler<TInputs = Record<string, any>> = (ctx: ComponentChangeContext<TInputs>) => HandlerResult;
187
+ export type DescendantChangeHandler<TInputs = Record<string, any>, TDescendantInputs = Record<string, any>> = (ctx: DescendantChangeContext<TInputs, TDescendantInputs>) => HandlerResult;
83
188
  export type ComponentManifest = {
84
189
  name: string;
85
190
  group?: string;
86
191
  label?: string;
192
+ aiContext?: string;
193
+ useInAiContentGeneration?: boolean;
87
194
  image?: string;
88
195
  inputs: ComponentInput[];
89
196
  canDrag?: boolean;
90
- canDelete?: boolean;
197
+ canDelete?: boolean | ComponentConstraint;
91
198
  acceptsChildren?: boolean;
92
199
  hideFromToolbar?: boolean;
200
+ /**
201
+ * A global component has exactly one instance per site, stored outside of pages.
202
+ * The frontend layout decides where it renders, via `<GlobalComponent>`.
203
+ */
204
+ global?: boolean;
93
205
  hideStyleSettings?: string[];
94
206
  autoApplyStyles?: boolean;
95
- tags?: string[];
207
+ applyDefaultStyles?: boolean;
208
+ tags: string[];
209
+ constraints?: ComponentConstraint[];
210
+ descendantConstraints?: ComponentConstraint[];
211
+ onChange?: ComponentChangeHandler | ComponentChangeHandler[];
212
+ onDescendantChange?: DescendantChangeHandler | DescendantChangeHandler[];
96
213
  defaults?: {
97
214
  inputs?: Record<string, any>;
98
215
  styles?: SerializableCSSStyleDeclaration;
@@ -121,15 +238,64 @@ export type DocumentElement = {
121
238
  export type SerializableCSSStyleDeclaration = {
122
239
  [K in keyof CssProperties]?: CssProperties[K];
123
240
  };
241
+ export type DocumentCache = Record<string, unknown>;
124
242
  export type Document = {
125
243
  id: string;
126
244
  state: DocumentState;
127
245
  version: number;
128
246
  properties: Record<string, any>;
247
+ extensions: Record<string, any>;
248
+ metadata: DocumentMetadata;
129
249
  bindings: DocumentBindings;
130
250
  elements: ElementMap;
131
- };
132
- export type PublicPage = Pick<Page, "id" | "version" | "properties" | "bindings" | "elements" | "extensions" | "state">;
251
+ layout?: PageLayout | null;
252
+ previewPage?: PreviewPage | null;
253
+ __cache?: DocumentCache;
254
+ };
255
+ /**
256
+ * A page shown inside a layout in the layout editor, in place of its page content placeholder.
257
+ * It's only shown: it's never saved with the layout.
258
+ */
259
+ export type PreviewPage = Pick<Document, "id" | "properties" | "elements" | "bindings">;
260
+ /**
261
+ * A page layout built in the layout editor: elements placed around one `Webiny/LayoutContent` element
262
+ * (main content), where the page renders its own content, and any `Webiny/NamedContent` areas. Global components are placed in it like on a page, by placement
263
+ * elements: their instances (`$global:{name}`) come with the page. Its bindings may also hold overrides of
264
+ * global components, under their element ids.
265
+ */
266
+ export type PageLayout = Pick<Document, "elements" | "bindings"> & {
267
+ id: string;
268
+ entryId?: string;
269
+ properties?: Record<string, any>;
270
+ };
271
+ /**
272
+ * Elements and bindings of global components, keyed `$global:{componentName}` (plus anything nested inside).
273
+ * Pages are delivered with the stored global components merged into their own elements and bindings.
274
+ */
275
+ export type GlobalDocument = Pick<Document, "elements" | "bindings">;
276
+ /**
277
+ * The stored instance of one global component in one language. Each global component is stored as its
278
+ * own record per language.
279
+ */
280
+ export type GlobalComponentRecord = GlobalDocument & {
281
+ name: string;
282
+ language: string;
283
+ };
284
+ export type PublicPage = Pick<Page, "id" | "version" | "properties" | "bindings" | "elements" | "extensions" | "metadata" | "state" | "layout"> & {
285
+ languagePaths: Record<string, string>;
286
+ };
287
+ /**
288
+ * A layout delivered by slug, for content code renders in it (e.g. a CMS entry): composed like a page with no
289
+ * content of its own. `elements` and `bindings` hold the instances of the global components, in the requested
290
+ * language, and `layout` is the layout itself, whose Main content is where the content goes.
291
+ */
292
+ export type PublicLayout = Pick<Document, "elements" | "bindings"> & {
293
+ layout: PageLayout;
294
+ };
295
+ export interface GetLayoutParams {
296
+ slug: string;
297
+ language?: string | null;
298
+ }
133
299
  export type PublicRedirect = {
134
300
  id: string;
135
301
  from: string;
@@ -137,9 +303,10 @@ export type PublicRedirect = {
137
303
  permanent: boolean;
138
304
  };
139
305
  export type EditorPage = EditorDocument & Pick<Page, "properties" | "status" | "location">;
140
- export type EditorDocument = Document & {
141
- metadata: Record<string, any>;
142
- };
306
+ export interface EditorOptions {
307
+ isReadOnly?: boolean;
308
+ }
309
+ export type EditorDocument = Document;
143
310
  export type Page = Document & {
144
311
  id: string;
145
312
  status: string;
@@ -150,7 +317,19 @@ export type Page = Document & {
150
317
  properties: {
151
318
  title: string;
152
319
  snippet: string;
320
+ image: {
321
+ id: string;
322
+ name: string;
323
+ size: number;
324
+ mimeType: string;
325
+ src: string;
326
+ width: number;
327
+ height: number;
328
+ };
153
329
  path: string;
330
+ language?: string;
331
+ sourcePage?: string;
332
+ layout?: string | null;
154
333
  tags: string[];
155
334
  seo: {
156
335
  title: string;
@@ -159,10 +338,23 @@ export type Page = Document & {
159
338
  name: string;
160
339
  content: string;
161
340
  }>;
341
+ canonicalUrl: string;
342
+ noIndex: boolean;
343
+ noFollow: boolean;
344
+ structuredSchema: string;
162
345
  };
163
346
  social: {
164
347
  title: string;
165
348
  description: string;
349
+ image: {
350
+ id: string;
351
+ name: string;
352
+ size: number;
353
+ mimeType: string;
354
+ src: string;
355
+ width: number;
356
+ height: number;
357
+ };
166
358
  metaTags: Array<{
167
359
  property: string;
168
360
  content: string;
@@ -170,6 +362,7 @@ export type Page = Document & {
170
362
  };
171
363
  };
172
364
  extensions: Record<string, any>;
365
+ metadata: DocumentMetadata;
173
366
  };
174
367
  export type Box = {
175
368
  depth: number;
@@ -191,6 +384,8 @@ export type BoxData = ElementBoxData | ElementSlotBoxData;
191
384
  export type EditorViewportInfo = PreviewViewportInfo & {
192
385
  top: number;
193
386
  left: number;
387
+ breakpoint: string;
388
+ breakpoints: Breakpoint[];
194
389
  };
195
390
  export type PreviewViewportInfo = {
196
391
  width: number;
@@ -208,14 +403,34 @@ export type EditorViewportData = {
208
403
  export type PreviewViewportData = {
209
404
  boxes: BoxesData;
210
405
  viewport: PreviewViewportInfo;
406
+ layout: string[];
211
407
  };
212
408
  export type ApiOptions = Record<string, any>;
213
409
  export type GetPageOptions = ApiOptions;
214
- export type ListPagesOptions = ApiOptions;
410
+ export interface ListPagesOptions {
411
+ where?: Record<string, any>;
412
+ limit?: number;
413
+ after?: string;
414
+ sort?: string[];
415
+ search?: string;
416
+ }
417
+ export interface ListPagesMeta {
418
+ hasMoreItems: boolean;
419
+ totalCount: number;
420
+ cursor: string | null;
421
+ }
422
+ export interface ListPagesResult {
423
+ data: Array<Omit<PublicPage, "elements" | "bindings">>;
424
+ meta: ListPagesMeta;
425
+ }
215
426
  export interface IDataProvider {
216
427
  getPageByPath(path: string, options?: GetPageOptions): Promise<PublicPage | null>;
217
428
  getPageById(id: string, options?: GetPageOptions): Promise<PublicPage | null>;
218
- listPages(options?: ListPagesOptions): Promise<PublicPage[]>;
429
+ getLayoutBySlug(params: GetLayoutParams): Promise<PublicLayout | null>;
430
+ listPages(options?: ListPagesOptions): Promise<ListPagesResult>;
431
+ getPageExperiment(path: string): Promise<ActiveExperiment | null>;
432
+ getVariantContent(variantId: string): Promise<VariantContent | null>;
433
+ getExperimentPaused(experimentId: string): Promise<boolean>;
219
434
  }
220
435
  export interface IEnvironment {
221
436
  isClient(): boolean;
@@ -224,8 +439,27 @@ export interface IEnvironment {
224
439
  }
225
440
  export interface IContentSdk {
226
441
  getPage(path: string): Promise<PublicPage | null>;
227
- listPages(options?: ListPagesOptions): Promise<PublicPage[]>;
442
+ getLayout(params: GetLayoutParams): Promise<PublicLayout | null>;
443
+ listPages(options?: ListPagesOptions): Promise<ListPagesResult>;
228
444
  }
445
+ /**
446
+ * An input's renderer with settings for it. The settings belong to the named renderer: Webiny passes
447
+ * them to it untouched (`ElementInputRendererProps.settings`) and never reads them itself. `name` is
448
+ * required, so an input factory that spreads the author's input over its default renderer can't end
449
+ * up with settings and no renderer.
450
+ */
451
+ export type InputRendererConfig = {
452
+ name: string;
453
+ settings?: Record<string, any>;
454
+ };
455
+ /**
456
+ * The renderer as the editor resolves it (`InputAstNode.renderer`): always an object, `name` is `""`
457
+ * when the input names no renderer, `settings` is `{}` when it has none.
458
+ */
459
+ export type ResolvedInputRenderer = {
460
+ name: string;
461
+ settings: Record<string, any>;
462
+ };
229
463
  export type BaseInput<T = any> = {
230
464
  name: string;
231
465
  type: string;
@@ -239,7 +473,11 @@ export type BaseInput<T = any> = {
239
473
  responsive?: boolean;
240
474
  required?: boolean;
241
475
  hideFromUi?: boolean;
242
- renderer?: string;
476
+ /**
477
+ * The editor's renderer for this input: its name, or `{ name, settings }` to give the renderer
478
+ * settings (e.g. `{ name: "Webiny/Textarea", settings: { maxLength: 54 } }`).
479
+ */
480
+ renderer?: string | InputRendererConfig;
243
481
  list?: boolean;
244
482
  translatable?: boolean;
245
483
  };
@@ -284,12 +522,88 @@ export type SelectInput = BaseInput<string> & {
284
522
  }[];
285
523
  showResetAction?: boolean;
286
524
  };
525
+ /**
526
+ * A radio option. `image` is a URL or a data URI, for renderers that draw options as pictures.
527
+ * `inputs` are shown while the option is selected. When any option has `inputs`, the radio is
528
+ * stored as an object: `<radio>/value` holds the selected option, and the options' inputs are its
529
+ * other children, merged by name (see `ComponentManifestToAstConverter`).
530
+ */
531
+ export type RadioOption = {
532
+ value: string;
533
+ label?: string;
534
+ description?: string;
535
+ image?: string;
536
+ inputs?: ComponentInput[];
537
+ };
287
538
  export type RadioInput = BaseInput<string> & {
288
539
  type: "radio";
289
- options: {
290
- label: string;
291
- value: string;
292
- }[];
540
+ options: RadioOption[];
541
+ };
542
+ export interface ContentEntryReference {
543
+ id: string;
544
+ modelId: string;
545
+ }
546
+ /**
547
+ * Query-mode configuration, declared by the component author. The editor then
548
+ * builds a query within these bounds (see `ContentEntryQueryValue`).
549
+ */
550
+ /**
551
+ * A field the editor may sort by: a bare read-API sort key, or a key paired with
552
+ * a display label shown in the editor.
553
+ */
554
+ export type ContentEntrySortField = string | {
555
+ field: string;
556
+ label?: string;
557
+ };
558
+ export interface ContentEntryQueryConfig {
559
+ /**
560
+ * Fields the editor may sort by (one at a time). Each `field` is a CMS read-API
561
+ * sort key — value fields as `values_<fieldId>` (e.g. `values_title`), meta
562
+ * fields bare (e.g. `createdOn`). Provide a `label` for a friendlier UI; a bare
563
+ * string uses the key as its label.
564
+ */
565
+ sort?: {
566
+ fields: ContentEntrySortField[];
567
+ };
568
+ /** Editor-configurable result limit, with an optional default and hard cap. */
569
+ limit?: {
570
+ default?: number;
571
+ max?: number;
572
+ };
573
+ /** Show a free-text search box (matches fullTextSearch-enabled fields). */
574
+ search?: boolean;
575
+ /** Enable "load more" pagination in the rendered component. */
576
+ pagination?: boolean;
577
+ }
578
+ /**
579
+ * The value stored for a query-mode input: the editor's chosen query.
580
+ * `modelId` identifies the CMS model so the frontend SDK can resolve the
581
+ * query without component manifests.
582
+ */
583
+ export interface ContentEntryQueryValue {
584
+ modelId: string;
585
+ sort?: {
586
+ field: string;
587
+ order: "asc" | "desc";
588
+ };
589
+ limit?: number;
590
+ search?: string;
591
+ }
592
+ export type ContentEntryInput = BaseInput<ContentEntryReference | ContentEntryReference[] | ContentEntryQueryValue> & {
593
+ type: "contentEntry";
594
+ /**
595
+ * The content model(s) the editor may pick entries from. Author-fixed.
596
+ */
597
+ models: string[];
598
+ /**
599
+ * "manual" (default): the editor hand-picks entries (stored as references).
600
+ * "query": the editor configures a dynamic query on the fixed model.
601
+ */
602
+ mode?: "manual" | "query";
603
+ /**
604
+ * Query-mode configuration. Only used when `mode` is "query".
605
+ */
606
+ query?: ContentEntryQueryConfig;
293
607
  };
294
608
  export type ObjectInput = BaseInput<Record<string, any>> & {
295
609
  type: "object";
@@ -299,7 +613,7 @@ export type CustomInput = BaseInput<any> & {
299
613
  type: string;
300
614
  fields: ComponentInput[];
301
615
  };
302
- export type ComponentInput = TextInput | LongTextInput | NumberInput | BooleanInput | ColorInput | FileInput | DateTimeInput | LexicalInput | SelectInput | RadioInput | TagsInput | ObjectInput | SlotInput | CustomInput;
616
+ export type ComponentInput = TextInput | LongTextInput | NumberInput | BooleanInput | ColorInput | FileInput | DateTimeInput | LexicalInput | SelectInput | RadioInput | TagsInput | ObjectInput | SlotInput | ContentEntryInput | CustomInput;
303
617
  export type ManifestInputsArray<TInputs, TAllowChildren extends boolean> = TAllowChildren extends true ? {
304
618
  [K in Exclude<keyof TInputs, "children">]: InputFactory<K & string>;
305
619
  }[Exclude<keyof TInputs, "children">][] : {
@@ -310,10 +624,16 @@ export type ManifestInputsObject<TInputs, TAllowChildren extends boolean> = TAll
310
624
  } : {
311
625
  [K in keyof TInputs]: InputFactory<K & string>;
312
626
  };
313
- export type ComponentManifestInput<TInputs> = (Omit<ComponentManifest, "inputs" | "acceptsChildren"> & {
627
+ export type ComponentManifestInput<TInputs> = (Omit<ComponentManifest, "inputs" | "acceptsChildren" | "tags" | "onChange" | "onDescendantChange"> & {
314
628
  acceptsChildren: true;
629
+ tags?: string[];
315
630
  inputs?: ManifestInputsArray<TInputs, true> | ManifestInputsObject<TInputs, true>;
316
- }) | (Omit<ComponentManifest, "inputs" | "acceptsChildren"> & {
631
+ onChange?: ComponentChangeHandler<TInputs> | ComponentChangeHandler<TInputs>[];
632
+ onDescendantChange?: DescendantChangeHandler<TInputs> | DescendantChangeHandler<TInputs>[];
633
+ }) | (Omit<ComponentManifest, "inputs" | "acceptsChildren" | "tags" | "onChange" | "onDescendantChange"> & {
317
634
  acceptsChildren?: false;
635
+ tags?: string[];
318
636
  inputs: ManifestInputsArray<TInputs, false> | ManifestInputsObject<TInputs, false>;
637
+ onChange?: ComponentChangeHandler<TInputs> | ComponentChangeHandler<TInputs>[];
638
+ onDescendantChange?: DescendantChangeHandler<TInputs> | DescendantChangeHandler<TInputs>[];
319
639
  });
package/types.js CHANGED
@@ -1,3 +0,0 @@
1
- export {};
2
-
3
- //# sourceMappingURL=types.js.map
@@ -0,0 +1,8 @@
1
+ import type { ComponentManifest, GlobalDocument } from "./types.js";
2
+ /**
3
+ * Add a default instance for every registered global component that has no stored instance,
4
+ * so a global defined in code appears immediately, without a data backfill.
5
+ * The page may still come with bindings for such a global: the layout's and the page's overrides, merged by
6
+ * the backend. They're kept over the defaults.
7
+ */
8
+ export declare const withGlobalElementDefaults: (globals: GlobalDocument, components: Record<string, ComponentManifest>) => GlobalDocument;
@@ -0,0 +1,60 @@
1
+ import { GlobalElementId } from "./globalElements.js";
2
+ import { createGlobalElementDocument } from "./createGlobalElementDocument.js";
3
+ const withGlobalElementDefaults = (globals, components)=>{
4
+ const missing = Object.values(components).filter((manifest)=>manifest.global && !globals.elements[GlobalElementId.fromName(manifest.name).toString()]);
5
+ if (!missing.length) return globals;
6
+ const result = {
7
+ elements: {
8
+ ...globals.elements
9
+ },
10
+ bindings: {
11
+ ...globals.bindings
12
+ }
13
+ };
14
+ for (const manifest of missing){
15
+ const defaults = createGlobalElementDocument(manifest.name, components);
16
+ Object.assign(result.elements, defaults.elements);
17
+ for(const id in defaults.bindings){
18
+ const delivered = globals.bindings[id];
19
+ result.bindings[id] = delivered ? withDefaultBindings(defaults.bindings[id], delivered) : defaults.bindings[id];
20
+ }
21
+ }
22
+ return result;
23
+ };
24
+ const withDefaultBindings = (defaults, delivered)=>{
25
+ const overrides = {
26
+ ...defaults.overrides
27
+ };
28
+ for(const breakpoint in delivered.overrides){
29
+ const base = defaults.overrides?.[breakpoint];
30
+ const value = delivered.overrides[breakpoint];
31
+ overrides[breakpoint] = {
32
+ ...base,
33
+ ...value,
34
+ inputs: {
35
+ ...base?.inputs,
36
+ ...value?.inputs
37
+ },
38
+ styles: {
39
+ ...base?.styles,
40
+ ...value?.styles
41
+ }
42
+ };
43
+ }
44
+ return {
45
+ ...defaults,
46
+ ...delivered,
47
+ inputs: {
48
+ ...defaults.inputs,
49
+ ...delivered.inputs
50
+ },
51
+ styles: {
52
+ ...defaults.styles,
53
+ ...delivered.styles
54
+ },
55
+ overrides
56
+ };
57
+ };
58
+ export { withGlobalElementDefaults };
59
+
60
+ //# sourceMappingURL=withGlobalElementDefaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withGlobalElementDefaults.js","sources":["../src/withGlobalElementDefaults.ts"],"sourcesContent":["import type { ComponentManifest, DocumentElementBindings, GlobalDocument } from \"./types.js\";\nimport { GlobalElementId } from \"./globalElements.js\";\nimport { createGlobalElementDocument } from \"./createGlobalElementDocument.js\";\n\n/**\n * Add a default instance for every registered global component that has no stored instance,\n * so a global defined in code appears immediately, without a data backfill.\n * The page may still come with bindings for such a global: the layout's and the page's overrides, merged by\n * the backend. They're kept over the defaults.\n */\nexport const withGlobalElementDefaults = (\n globals: GlobalDocument,\n components: Record<string, ComponentManifest>\n): GlobalDocument => {\n const missing = Object.values(components).filter(manifest => {\n return (\n manifest.global && !globals.elements[GlobalElementId.fromName(manifest.name).toString()]\n );\n });\n\n if (!missing.length) {\n return globals;\n }\n\n const result: GlobalDocument = {\n elements: { ...globals.elements },\n bindings: { ...globals.bindings }\n };\n\n for (const manifest of missing) {\n const defaults = createGlobalElementDocument(manifest.name, components);\n Object.assign(result.elements, defaults.elements);\n for (const id in defaults.bindings) {\n const delivered = globals.bindings[id];\n result.bindings[id] = delivered\n ? withDefaultBindings(defaults.bindings[id], delivered)\n : defaults.bindings[id];\n }\n }\n\n return result;\n};\n\n/**\n * The defaults are only the bottom layer: what's delivered wins per input and per style, also per\n * breakpoint override, so overriding one input of a global keeps the rest of its defaults.\n */\nconst withDefaultBindings = (\n defaults: DocumentElementBindings,\n delivered: DocumentElementBindings\n): DocumentElementBindings => {\n const overrides: NonNullable<DocumentElementBindings[\"overrides\"]> = {\n ...defaults.overrides\n };\n for (const breakpoint in delivered.overrides) {\n const base = defaults.overrides?.[breakpoint];\n const value = delivered.overrides[breakpoint];\n overrides[breakpoint] = {\n ...base,\n ...value,\n inputs: { ...base?.inputs, ...value?.inputs },\n styles: { ...base?.styles, ...value?.styles }\n };\n }\n\n return {\n ...defaults,\n ...delivered,\n inputs: { ...defaults.inputs, ...delivered.inputs },\n styles: { ...defaults.styles, ...delivered.styles },\n overrides\n };\n};\n"],"names":["withGlobalElementDefaults","globals","components","missing","Object","manifest","GlobalElementId","result","defaults","createGlobalElementDocument","id","delivered","withDefaultBindings","overrides","breakpoint","base","value"],"mappings":";;AAUO,MAAMA,4BAA4B,CACrCC,SACAC;IAEA,MAAMC,UAAUC,OAAO,MAAM,CAACF,YAAY,MAAM,CAACG,CAAAA,WAEzCA,SAAS,MAAM,IAAI,CAACJ,QAAQ,QAAQ,CAACK,gBAAgB,QAAQ,CAACD,SAAS,IAAI,EAAE,QAAQ,GAAG;IAIhG,IAAI,CAACF,QAAQ,MAAM,EACf,OAAOF;IAGX,MAAMM,SAAyB;QAC3B,UAAU;YAAE,GAAGN,QAAQ,QAAQ;QAAC;QAChC,UAAU;YAAE,GAAGA,QAAQ,QAAQ;QAAC;IACpC;IAEA,KAAK,MAAMI,YAAYF,QAAS;QAC5B,MAAMK,WAAWC,4BAA4BJ,SAAS,IAAI,EAAEH;QAC5DE,OAAO,MAAM,CAACG,OAAO,QAAQ,EAAEC,SAAS,QAAQ;QAChD,IAAK,MAAME,MAAMF,SAAS,QAAQ,CAAE;YAChC,MAAMG,YAAYV,QAAQ,QAAQ,CAACS,GAAG;YACtCH,OAAO,QAAQ,CAACG,GAAG,GAAGC,YAChBC,oBAAoBJ,SAAS,QAAQ,CAACE,GAAG,EAAEC,aAC3CH,SAAS,QAAQ,CAACE,GAAG;QAC/B;IACJ;IAEA,OAAOH;AACX;AAMA,MAAMK,sBAAsB,CACxBJ,UACAG;IAEA,MAAME,YAA+D;QACjE,GAAGL,SAAS,SAAS;IACzB;IACA,IAAK,MAAMM,cAAcH,UAAU,SAAS,CAAE;QAC1C,MAAMI,OAAOP,SAAS,SAAS,EAAE,CAACM,WAAW;QAC7C,MAAME,QAAQL,UAAU,SAAS,CAACG,WAAW;QAC7CD,SAAS,CAACC,WAAW,GAAG;YACpB,GAAGC,IAAI;YACP,GAAGC,KAAK;YACR,QAAQ;gBAAE,GAAGD,MAAM,MAAM;gBAAE,GAAGC,OAAO,MAAM;YAAC;YAC5C,QAAQ;gBAAE,GAAGD,MAAM,MAAM;gBAAE,GAAGC,OAAO,MAAM;YAAC;QAChD;IACJ;IAEA,OAAO;QACH,GAAGR,QAAQ;QACX,GAAGG,SAAS;QACZ,QAAQ;YAAE,GAAGH,SAAS,MAAM;YAAE,GAAGG,UAAU,MAAM;QAAC;QAClD,QAAQ;YAAE,GAAGH,SAAS,MAAM;YAAE,GAAGG,UAAU,MAAM;QAAC;QAClDE;IACJ;AACJ"}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["IBindingsUpdater.ts"],"sourcesContent":["import type { JsonPatchOperation } from \"~/jsonPatch.js\";\nimport type { Document, DocumentElementBindings } from \"~/types.js\";\n\nexport interface IBindingsUpdater {\n applyToDocument(document: Document): void;\n createJsonPatch(bindings: DocumentElementBindings): JsonPatchOperation[];\n}\n"],"mappings":"","ignoreList":[]}
package/IRedirects.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["IRedirects.ts"],"sourcesContent":["import type { PublicRedirect } from \"~/types.js\";\n\nexport interface IRedirects {\n getAllRedirects(): Promise<Map<string, PublicRedirect>>;\n getRedirectByPath(path: string): Promise<PublicRedirect | undefined>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["IDocumentOperation.ts"],"sourcesContent":["import type { Document } from \"~/types.js\";\n\nexport interface IDocumentOperation {\n apply(document: Document): void;\n}\n"],"mappings":"","ignoreList":[]}
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"names":["StyleSettings"],"sources":["index.ts"],"sourcesContent":["export * from \"./createTheme.js\";\nexport * from \"./EditingSdk.js\";\nexport * from \"./LiveSdk.js\";\nexport * from \"./NullSdk.js\";\nexport * from \"./ContentSdk.js\";\nexport * from \"./Environment.js\";\nexport * from \"./DocumentStore.js\";\nexport * from \"./Logger.js\";\nexport * from \"./FunctionConverter.js\";\nexport * from \"./createInput.js\";\nexport * from \"./MouseTracker.js\";\nexport * from \"./ViewportManager.js\";\nexport * from \"./messenger/Messenger.js\";\nexport * from \"./messenger/MessageOrigin.js\";\nexport type * from \"./types.js\";\nexport * from \"./DocumentStoreManager.js\";\nexport * from \"./BindingsProcessor.js\";\nexport * from \"./ResizeObserver.js\";\nexport * from \"./BindingsResolver.js\";\nexport * from \"./createElement.js\";\nexport * from \"./registerComponentGroup.js\";\nexport * from \"./jsonPatch.js\";\nexport * from \"./headersProvider.js\";\nexport * from \"./ComponentManifestToAstConverter.js\";\nexport * from \"./findMatchingAstNode.js\";\nexport * from \"./InheritanceProcessor.js\";\nexport * from \"./InputBindingsProcessor.js\";\nexport * from \"./StylesBindingsProcessor.js\";\nexport * from \"./ElementFactory.js\";\nexport { 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":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./MessageOrigin.js\";\nexport * from \"./Messenger.js\";\n"],"mappings":"AAAA;AACA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["ShorthandCssProperties.ts"],"sourcesContent":["export type ShorthandCssProperties =\n | \"margin\"\n | \"padding\"\n | \"border\"\n | \"borderWidth\"\n | \"borderStyle\"\n | \"borderColor\"\n | \"borderRadius\"\n | \"outline\"\n | \"outlineOffset\"\n | \"inset\"\n | \"background\"\n | \"borderBlock\"\n | \"borderBlockColor\"\n | \"borderBlockStyle\"\n | \"borderBlockWidth\"\n | \"borderInline\"\n | \"borderInlineColor\"\n | \"borderInlineStyle\"\n | \"borderInlineWidth\"\n | \"borderStartEndRadius\"\n | \"borderStartStartRadius\"\n | \"borderEndEndRadius\"\n | \"borderEndStartRadius\"\n | \"font\"\n | \"fontVariant\"\n | \"textDecoration\"\n | \"textEmphasis\"\n | \"textEmphasisStyle\"\n | \"textEmphasisColor\"\n | \"flex\"\n | \"flexFlow\"\n | \"gap\"\n | \"placeContent\"\n | \"placeItems\"\n | \"placeSelf\"\n | \"grid\"\n | \"listStyle\"\n | \"marker\"\n | \"columns\"\n | \"columnRule\"\n | \"animation\"\n | \"transition\"\n | \"boxShadow\"\n | \"textShadow\"\n | \"scrollMargin\"\n | \"scrollPadding\"\n | \"size\"\n | \"aspectRatio\";\n"],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["WebsiteBuilderTheme.ts"],"sourcesContent":["export type Breakpoint = {\n name: string;\n title: string;\n description: string;\n icon: string;\n minWidth: number;\n maxWidth: number;\n};\n\nexport type WebsiteBuilderTheme = {\n css?: string;\n fonts?: string[];\n breakpoints: Breakpoint[];\n colors: ColorStyle[];\n typography: Typography;\n};\ntype KnownKeys = \"desktop\" | \"tablet\" | \"mobile\";\n\ntype BreakpointBase = Omit<Breakpoint, \"name\">;\n\ntype KnownBreakpoints = Partial<Record<KnownKeys, Partial<BreakpointBase>>>;\n\n// This merges both, while avoiding overlap issues\ntype Breakpoints = KnownBreakpoints & {\n custom?: {\n [K in string as K extends KnownKeys ? never : K]: BreakpointBase;\n };\n};\n\nexport type ColorStyle = {\n id: string;\n label: string;\n value: string;\n};\n\nexport type TypographyStyle = {\n id: string;\n label: string;\n tag: string;\n className: string;\n};\n\nexport type Typography = Record<string, TypographyStyle[]>;\n\nexport type WebsiteBuilderThemeInput = {\n /**\n * CSS to include in the editor.\n */\n css?: string;\n /**\n * Fonts to load when the editor loads.\n */\n fonts?: string[];\n /**\n * {\n * title: \"Desktop\",\n * description: `Desktop styles apply at all breakpoints, unless they're edited at a lower breakpoint. Start your styling here.`,\n * icon: \"Inline SVG or a link to an SVG.\",\n * minWidth: 0,\n * maxWidth: 4000\n * }\n */\n breakpoints?: Breakpoints;\n /**\n * [\n * {\n * id: \"primary\",\n * label: \"Primary\",\n * value: \"#000000\"\n * },\n * ]\n */\n colors?: ColorStyle[];\n /**\n * headings: [\n * {\n * id: \"heading1\",\n * name: \"Heading 1\",\n * tag: \"h1\"\n * },\n * ],\n * paragraphs: [\n * {\n * id: \"paragraph1\",\n * name: \"Paragraph 1\",\n * tag: \"p\",\n * ],\n * quotes: [\n * {\n * id: \"quote\",\n * name: \"Quote\",\n * tag: \"blockquote\"\n * }\n * ]\n */\n typography?: Typography;\n};\n"],"mappings":"","ignoreList":[]}
package/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type * as CSS from \"csstype\";\nimport type { BindingsApi } from \"~/BindingsApi.js\";\nimport type { ShorthandCssProperties } from \"./types/ShorthandCssProperties.js\";\nimport type { InputFactory } from \"~/createInput.js\";\nexport type { WebsiteBuilderTheme, Breakpoint } from \"./types/WebsiteBuilderTheme.js\";\n\ntype CSSProperties = CSS.Properties<string | number>;\n\nexport type ElementMap = Record<string, DocumentElement>;\n\nexport type DocumentState = Record<string, any>;\n\nexport type InputValueBinding<T = any> = ValueBinding<T> & {\n id: string;\n type: string;\n translatable?: boolean;\n list?: boolean;\n};\n\nexport type StyleValueBinding<T = any> = ValueBinding<T>;\n\nexport type ValueBinding<T = any> = {\n static?: T;\n expression?: string;\n};\n\nexport type RepeatValueBinding = {\n expression: string;\n};\n\nexport type CssProperties = Omit<CSSProperties, ShorthandCssProperties>;\n\nexport type DocumentElementStyleBindings = Partial<{\n [K in keyof CssProperties]: StyleValueBinding<CssProperties[K]>;\n}>;\n\nexport type DocumentElementInputBindings = {\n [inputName: string]: InputValueBinding;\n};\n\nexport type DocumentElementBindings = {\n $repeat?: RepeatValueBinding;\n inputs?: DocumentElementInputBindings;\n styles?: DocumentElementStyleBindings;\n metadata?: Record<string, any>;\n overrides?: {\n [key: string]: {\n inputs?: DocumentElementInputBindings;\n styles?: DocumentElementStyleBindings;\n };\n };\n};\n\nexport type DocumentBindings = {\n [elementId: string]: DocumentElementBindings;\n};\n\nexport type ResolvedComponent<TComponent = any> = {\n component: TComponent;\n inputs: Record<string, any>;\n manifest: ComponentManifest;\n styles: SerializableCSSStyleDeclaration;\n};\n\nexport type ResolvedElement = {\n id: string;\n inputs: Record<string, any>;\n styles: SerializableCSSStyleDeclaration;\n};\n\nexport type Component = {\n component: any;\n manifest: ComponentManifest;\n};\n\nexport type ComponentBlueprint<TComponent = any, TManifest = any> = {\n component: TComponent;\n manifest: TManifest;\n};\n\nexport type ComponentGroupItem = {\n // Name of the component.\n name: string;\n // Optionally, define an exact element to insert.\n item?: DocumentElementTemplate;\n};\n\nexport type SerializedComponentGroup = ComponentGroup & {\n filter?: string;\n};\n\nexport type ComponentGroupFilterContext = {\n document: EditorDocument;\n};\n\nexport type ComponentGroup = {\n name: string;\n label: string;\n description?: string;\n filter?: (component: ComponentManifest, context: ComponentGroupFilterContext) => boolean;\n};\n\nexport type ResponsiveStyles = {\n [key: string]: SerializableCSSStyleDeclaration;\n};\n\nexport type ComponentManifest = {\n name: string;\n group?: string;\n label?: string;\n image?: string;\n inputs: ComponentInput[];\n canDrag?: boolean;\n canDelete?: boolean;\n acceptsChildren?: boolean;\n hideFromToolbar?: boolean;\n hideStyleSettings?: string[];\n autoApplyStyles?: boolean;\n tags?: string[];\n defaults?: {\n inputs?: Record<string, any>;\n styles?: SerializableCSSStyleDeclaration;\n overrides?: {\n [breakpoint: string]: {\n inputs?: Record<string, any>;\n styles?: SerializableCSSStyleDeclaration;\n };\n };\n };\n};\n\nexport type DocumentElementTemplate = Omit<DocumentElement, \"id\">;\n\nexport type ElementComponent = {\n name: string;\n};\n\nexport type DocumentElement = {\n type: \"Webiny/Element\";\n id: string;\n component: ElementComponent;\n parent?: {\n id: string;\n slot: string;\n };\n styles?: ResponsiveStyles;\n};\n\nexport type SerializableCSSStyleDeclaration = {\n [K in keyof CssProperties]?: CssProperties[K];\n};\n\nexport type Document = {\n id: string;\n state: DocumentState;\n version: number;\n properties: Record<string, any>;\n bindings: DocumentBindings;\n elements: ElementMap;\n};\n\nexport type PublicPage = Pick<\n Page,\n \"id\" | \"version\" | \"properties\" | \"bindings\" | \"elements\" | \"extensions\" | \"state\"\n>;\n\nexport type PublicRedirect = {\n id: string;\n from: string;\n to: string;\n permanent: boolean;\n};\n\nexport type EditorPage = EditorDocument & Pick<Page, \"properties\" | \"status\" | \"location\">;\n\nexport type EditorDocument = Document & {\n metadata: Record<string, any>;\n};\n\nexport type Page = Document & {\n id: string;\n status: string;\n version: number;\n location: {\n folderId: string;\n };\n properties: {\n title: string;\n snippet: string;\n /*image: {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n };*/\n path: string;\n tags: string[];\n seo: {\n title: string;\n description: string;\n metaTags: Array<{ name: string; content: string }>;\n };\n social: {\n title: string;\n description: string;\n /*image: {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n };*/\n metaTags: Array<{ property: string; content: string }>;\n };\n };\n extensions: Record<string, any>;\n};\n\nexport type Box = {\n depth: number;\n parentId: string;\n parentSlot: string;\n parentIndex: number;\n width: number;\n height: number;\n top: number;\n left: number;\n};\n\nexport type ElementBoxData = Box & {\n type: \"element\";\n};\n\nexport type ElementSlotBoxData = Box & {\n type: \"element-slot\";\n};\n\nexport type BoxData = ElementBoxData | ElementSlotBoxData;\n\nexport type EditorViewportInfo = PreviewViewportInfo & {\n top: number;\n left: number;\n};\n\nexport type PreviewViewportInfo = {\n // Viewport width (only the visible part)\n width: number;\n // Viewport height (only the visible part)\n height: number;\n // Full iframe width\n scrollWidth: number;\n // Full iframe height\n scrollHeight: number;\n // Iframe horizontal scroll offset\n scrollX: number;\n // Iframe vertical scroll offest\n scrollY: number;\n};\n\nexport type BoxesData = Record<string, BoxData>;\n\nexport type EditorViewportData = {\n boxes: BoxesData;\n viewport: EditorViewportInfo;\n};\n\nexport type PreviewViewportData = {\n boxes: BoxesData;\n viewport: PreviewViewportInfo;\n};\n\nexport type ApiOptions = Record<string, any>;\n\nexport type GetPageOptions = ApiOptions;\nexport type ListPagesOptions = ApiOptions;\n\nexport interface IDataProvider {\n getPageByPath(path: string, options?: GetPageOptions): Promise<PublicPage | null>;\n getPageById(id: string, options?: GetPageOptions): Promise<PublicPage | null>;\n listPages(options?: ListPagesOptions): Promise<PublicPage[]>;\n}\n\nexport interface IEnvironment {\n isClient(): boolean;\n isServer(): boolean;\n isPreview(): boolean;\n}\n\nexport interface IContentSdk {\n getPage(path: string): Promise<PublicPage | null>;\n listPages(options?: ListPagesOptions): Promise<PublicPage[]>;\n}\n\n// Input types\n\n// inputTypes.ts\nexport type BaseInput<T = any> = {\n name: string;\n type: string;\n onChange?: (\n bindings: ReturnType<BindingsApi[\"getPublicApi\"]>,\n context: { breakpoint: string }\n ) => void;\n label?: string;\n description?: string;\n helperText?: string;\n defaultValue?: T;\n responsive?: boolean;\n required?: boolean;\n hideFromUi?: boolean;\n renderer?: string;\n list?: boolean;\n translatable?: boolean;\n};\n\n// Discriminated union per input type\nexport type TextInput = BaseInput<string> & {\n type: \"text\";\n};\n\nexport type SlotInput = BaseInput<any> & {\n type: \"slot\";\n components?: string[];\n};\n\nexport type TagsInput = BaseInput<string[]> & {\n type: \"text\";\n};\n\nexport type LongTextInput = BaseInput<string> & {\n type: \"longText\";\n};\n\nexport type NumberInput = BaseInput<number> & {\n type: \"number\";\n minValue?: number;\n};\n\nexport type BooleanInput = BaseInput<boolean> & {\n type: \"boolean\";\n};\n\nexport type ColorInput = BaseInput<string> & {\n type: \"color\";\n};\n\nexport type FileInput = BaseInput<string> & {\n type: \"file\";\n allowedFileTypes: string[];\n};\n\nexport type DateTimeInput = BaseInput<string> & {\n type: \"datetime\";\n};\n\nexport type LexicalInput = BaseInput<string> & {\n type: \"lexical\";\n};\n\nexport type SelectInput = BaseInput<string> & {\n type: \"select\";\n options: { label: string; value: string }[];\n showResetAction?: boolean;\n};\n\nexport type RadioInput = BaseInput<string> & {\n type: \"radio\";\n options: { label: string; value: string }[];\n};\n\nexport type ObjectInput = BaseInput<Record<string, any>> & {\n type: \"object\";\n fields: ComponentInput[];\n};\n\nexport type CustomInput = BaseInput<any> & {\n type: string;\n fields: ComponentInput[];\n};\n\n// Union of all input types\nexport type ComponentInput =\n | TextInput\n | LongTextInput\n | NumberInput\n | BooleanInput\n | ColorInput\n | FileInput\n | DateTimeInput\n | LexicalInput\n | SelectInput\n | RadioInput\n | TagsInput\n | ObjectInput\n | SlotInput\n | CustomInput;\n\nexport type ManifestInputsArray<\n TInputs,\n TAllowChildren extends boolean\n> = TAllowChildren extends true\n ? {\n [K in Exclude<keyof TInputs, \"children\">]: InputFactory<K & string>;\n }[Exclude<keyof TInputs, \"children\">][]\n : {\n [K in keyof TInputs]: InputFactory<K & string>;\n }[keyof TInputs][];\n\nexport type ManifestInputsObject<\n TInputs,\n TAllowChildren extends boolean\n> = TAllowChildren extends true\n ? { [K in Exclude<keyof TInputs, \"children\">]: InputFactory<K & string> }\n : { [K in keyof TInputs]: InputFactory<K & string> };\n\nexport type ComponentManifestInput<TInputs> =\n | (Omit<ComponentManifest, \"inputs\" | \"acceptsChildren\"> & {\n acceptsChildren: true;\n inputs?: ManifestInputsArray<TInputs, true> | ManifestInputsObject<TInputs, true>;\n })\n | (Omit<ComponentManifest, \"inputs\" | \"acceptsChildren\"> & {\n acceptsChildren?: false;\n inputs: ManifestInputsArray<TInputs, false> | ManifestInputsObject<TInputs, false>;\n });\n"],"mappings":"","ignoreList":[]}