@nascentdigital/funnel-editor 4.6.1 → 5.0.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 (209) hide show
  1. package/dist/EditorApp.js +1 -1
  2. package/dist/EditorRoutes.js +7 -5
  3. package/dist/changesets/screens/ChangeSetViewer.js +1 -1
  4. package/dist/changesets/screens/ChangeSetsExplorer.js +1 -2
  5. package/dist/collection/hooks/CollectionController.d.ts +5 -16
  6. package/dist/collection/hooks/CollectionController.js +18 -37
  7. package/dist/collection/hooks/ICollectionController.d.ts +24 -0
  8. package/dist/collection/hooks/ICollectionController.js +20 -0
  9. package/dist/collection/hooks/index.d.ts +1 -0
  10. package/dist/collection/hooks/index.js +1 -0
  11. package/dist/collection/hooks/useCollectionController.d.ts +3 -3
  12. package/dist/collection/screens/CollectionEditor.js +2 -2
  13. package/dist/components.d.ts +20 -0
  14. package/dist/components.js +41 -0
  15. package/dist/core/components/feedback/dialog/MinimalDialogLayout.js +1 -1
  16. package/dist/core/components/fields/BooleanField.d.ts +2 -1
  17. package/dist/core/components/fields/BooleanField.js +2 -2
  18. package/dist/core/components/fields/DateField.d.ts +2 -1
  19. package/dist/core/components/fields/DateField.js +2 -2
  20. package/dist/core/components/fields/DynamicPagesEditor.d.ts +2 -1
  21. package/dist/core/components/fields/DynamicPagesEditor.js +1 -1
  22. package/dist/core/components/fields/EnumField.d.ts +2 -1
  23. package/dist/core/components/fields/EnumField.js +2 -2
  24. package/dist/core/components/fields/FieldCard.d.ts +1 -0
  25. package/dist/core/components/fields/FieldCard.js +8 -1
  26. package/dist/core/components/fields/FieldEditor.d.ts +2 -1
  27. package/dist/core/components/fields/FieldEditor.js +11 -11
  28. package/dist/core/components/fields/FieldLayout.d.ts +2 -1
  29. package/dist/core/components/fields/FieldLayout.js +3 -3
  30. package/dist/core/components/fields/ListEditor.d.ts +2 -1
  31. package/dist/core/components/fields/ListEditor.js +5 -6
  32. package/dist/core/components/fields/OptInField.d.ts +2 -1
  33. package/dist/core/components/fields/OptInField.js +2 -2
  34. package/dist/core/components/fields/RichTextEditor.js +1 -1
  35. package/dist/core/components/fields/RichTextField.d.ts +2 -1
  36. package/dist/core/components/fields/RichTextField.js +3 -5
  37. package/dist/core/components/fields/TextField.d.ts +2 -0
  38. package/dist/core/components/fields/TextField.js +2 -2
  39. package/dist/core/components/fields/TimestampField.d.ts +2 -1
  40. package/dist/core/components/fields/TimestampField.js +3 -3
  41. package/dist/core/components/fields/asset/AssetEditor.js +12 -44
  42. package/dist/core/components/fields/asset/AssetPicker.js +6 -6
  43. package/dist/core/components/fields/asset/AssetUploader.js +23 -31
  44. package/dist/core/components/fields/asset/preview/VideoPreview.js +16 -11
  45. package/dist/core/components/fields/asset/useAssetFields.d.ts +2 -17
  46. package/dist/core/components/fields/asset/useAssetFields.js +0 -21
  47. package/dist/core/components/fields/collection/CollectionEditor.js +1 -1
  48. package/dist/core/components/fields/collection/CollectionPicker.d.ts +2 -2
  49. package/dist/core/components/fields/collection/CollectionPicker.js +3 -4
  50. package/dist/core/components/fields/dynamicPages/PagePriorityDialog.js +1 -1
  51. package/dist/core/components/fields/embed/EmbeddedVideoEditor.js +34 -27
  52. package/dist/core/components/fields/factories/FieldValueFactory.js +11 -4
  53. package/dist/core/components/fields/factories/MediaFactory.d.ts +13 -0
  54. package/dist/core/components/fields/factories/MediaFactory.js +256 -0
  55. package/dist/core/components/fields/list/CreateFieldButton.js +1 -1
  56. package/dist/core/components/fields/media/MediaCard.d.ts +7 -0
  57. package/dist/core/components/fields/media/MediaCard.js +92 -0
  58. package/dist/core/components/fields/media/MediaEditor.d.ts +37 -0
  59. package/dist/core/components/fields/media/MediaEditor.js +235 -0
  60. package/dist/core/components/fields/media/MediaPicker.d.ts +15 -0
  61. package/dist/core/components/fields/media/MediaPicker.js +251 -0
  62. package/dist/core/components/fields/media/index.d.ts +3 -0
  63. package/dist/core/components/fields/media/index.js +19 -0
  64. package/dist/core/components/fields/object/ObjectEditor.js +1 -1
  65. package/dist/core/components/fields/page/PagePicker.d.ts +2 -2
  66. package/dist/core/components/fields/page/PagePicker.js +1 -1
  67. package/dist/core/components/interaction/Combobox.js +1 -1
  68. package/dist/core/components/interaction/DateTimePicker.d.ts +0 -1
  69. package/dist/core/components/interaction/DateTimePicker.js +0 -2
  70. package/dist/core/components/interaction/MultiSelectControls.js +2 -5
  71. package/dist/core/components/interaction/Popup.js +1 -0
  72. package/dist/core/components/interaction/QuickEditor.js +1 -1
  73. package/dist/core/components/interaction/QuickPicker.js +1 -1
  74. package/dist/core/components/interaction/SideSheet.js +1 -1
  75. package/dist/core/components/interaction/centersheet/CenterSheet.js +7 -1
  76. package/dist/core/components/interaction/centersheet/CenterSheetContainer.js +3 -1
  77. package/dist/core/components/transitions/FadeIn.js +2 -14
  78. package/dist/core/components/visuals/Icon.d.ts +1 -1
  79. package/dist/core/components/visuals/Icon.js +3 -0
  80. package/dist/core/containers/AssetRepositoryContainer.d.ts +2 -0
  81. package/dist/core/containers/AssetRepositoryContainer.js +18 -0
  82. package/dist/core/containers/CollectionRepositoryContainer.d.ts +2 -0
  83. package/dist/core/containers/CollectionRepositoryContainer.js +18 -0
  84. package/dist/core/containers/PageRepositoryContainer.d.ts +2 -0
  85. package/dist/core/containers/PageRepositoryContainer.js +18 -0
  86. package/dist/core/containers/index.d.ts +3 -0
  87. package/dist/core/containers/index.js +19 -0
  88. package/dist/core/domain/Block.d.ts +1 -0
  89. package/dist/core/domain/Block.js +8 -5
  90. package/dist/core/domain/BlockConfiguration.d.ts +4 -1
  91. package/dist/core/domain/BlockConfiguration.js +64 -3
  92. package/dist/core/domain/Collection.d.ts +10 -28
  93. package/dist/core/domain/Collection.js +2 -16
  94. package/dist/core/domain/CollectionBrowser.d.ts +3 -2
  95. package/dist/core/domain/CollectionBrowser.js +3 -3
  96. package/dist/core/domain/CollectionFieldProxy.d.ts +12 -8
  97. package/dist/core/domain/CollectionFieldProxy.js +14 -8
  98. package/dist/core/domain/CollectionGroup.d.ts +0 -5
  99. package/dist/core/domain/CollectionGroup.js +0 -7
  100. package/dist/core/domain/CollectionSummary.d.ts +2 -2
  101. package/dist/core/domain/Collections.d.ts +3 -3
  102. package/dist/core/domain/Collections.js +4 -4
  103. package/dist/core/domain/ICollection.d.ts +71 -0
  104. package/dist/core/domain/ICollection.js +20 -0
  105. package/dist/core/domain/IPage.d.ts +72 -0
  106. package/dist/core/domain/IPage.js +20 -0
  107. package/dist/core/domain/IPageRefStore.d.ts +3 -3
  108. package/dist/core/domain/ItemBase.d.ts +6 -6
  109. package/dist/core/domain/ItemBase.js +5 -5
  110. package/dist/core/domain/Page.d.ts +9 -22
  111. package/dist/core/domain/Page.js +3 -18
  112. package/dist/core/domain/PageOverview.d.ts +2 -2
  113. package/dist/core/domain/PageRefStoreProxy.d.ts +4 -4
  114. package/dist/core/domain/PageSettings.d.ts +3 -3
  115. package/dist/core/domain/PageSummary.d.ts +2 -2
  116. package/dist/core/domain/Pages.js +4 -6
  117. package/dist/core/domain/SectionBlock.js +2 -1
  118. package/dist/core/domain/Site.d.ts +4 -4
  119. package/dist/core/domain/Site.js +3 -3
  120. package/dist/core/domain/index.d.ts +2 -1
  121. package/dist/core/domain/index.js +2 -1
  122. package/dist/core/hooks/index.d.ts +4 -3
  123. package/dist/core/hooks/index.js +4 -3
  124. package/dist/core/hooks/useAssetRepository.d.ts +3 -0
  125. package/dist/core/hooks/useAssetRepository.js +11 -0
  126. package/dist/core/hooks/useCollection.d.ts +4 -4
  127. package/dist/core/hooks/useCollectionRepository.d.ts +3 -2
  128. package/dist/core/hooks/useCollectionRepository.js +4 -4
  129. package/dist/core/hooks/usePage.d.ts +4 -4
  130. package/dist/core/hooks/usePageRef.d.ts +1 -1
  131. package/dist/core/hooks/usePageRepository.d.ts +3 -2
  132. package/dist/core/hooks/usePageRepository.js +4 -4
  133. package/dist/core/hooks/useTempFields.d.ts +2 -3
  134. package/dist/core/index.d.ts +1 -0
  135. package/dist/core/index.js +1 -0
  136. package/dist/core/repository/AssetRepository.d.ts +10 -0
  137. package/dist/core/repository/AssetRepository.js +22 -0
  138. package/dist/core/repository/CollectionRepository.d.ts +21 -20
  139. package/dist/core/repository/CollectionRepository.js +23 -161
  140. package/dist/core/repository/CollectionSerializer.d.ts +4 -1
  141. package/dist/core/repository/CollectionSerializer.js +3 -3
  142. package/dist/core/repository/IAssetRepository.d.ts +25 -0
  143. package/dist/core/repository/ICollectionRepository.d.ts +62 -0
  144. package/dist/core/repository/ICollectionRepository.js +2 -0
  145. package/dist/core/repository/IPageRepository.d.ts +40 -0
  146. package/dist/core/repository/IPageRepository.js +2 -0
  147. package/dist/core/repository/PageRepository.d.ts +6 -9
  148. package/dist/core/repository/PageRepository.js +7 -280
  149. package/dist/core/repository/PageSerializer.d.ts +34 -1
  150. package/dist/core/repository/PageSerializer.js +4 -0
  151. package/dist/core/repository/SerializeCollectionUpdate.d.ts +8 -0
  152. package/dist/core/repository/SerializeCollectionUpdate.js +168 -0
  153. package/dist/core/repository/SerializePageUpdate.d.ts +11 -0
  154. package/dist/core/repository/SerializePageUpdate.js +292 -0
  155. package/dist/core/repository/index.d.ts +4 -0
  156. package/dist/core/repository/index.js +4 -0
  157. package/dist/dashboard/screens/Dashboard.js +1 -1
  158. package/dist/devtools/screens/Devtools.js +1 -1
  159. package/dist/explore/components/CreatePageDialog.d.ts +2 -2
  160. package/dist/explore/screens/CollectionExplorer.js +1 -1
  161. package/dist/explore/screens/CollectionsExplorer.js +1 -1
  162. package/dist/explore/screens/PageExplorer.js +1 -1
  163. package/dist/explore/screens/SiteExplorer.js +1 -1
  164. package/dist/page/components/BlockEditor.js +1 -1
  165. package/dist/page/components/PageHeader.d.ts +2 -2
  166. package/dist/page/components/PageNotCreated.d.ts +2 -2
  167. package/dist/page/components/PageNotFound.d.ts +2 -2
  168. package/dist/page/components/SettingsEditor.js +0 -7
  169. package/dist/page/components/config/BlockConfigButton.d.ts +2 -1
  170. package/dist/page/components/config/BlockConfigButton.js +84 -24
  171. package/dist/page/components/config/BlockPreview.d.ts +8 -0
  172. package/dist/page/components/config/BlockPreview.js +53 -0
  173. package/dist/page/components/config/index.d.ts +1 -1
  174. package/dist/page/components/config/index.js +1 -1
  175. package/dist/page/components/config/preview/ColumnLayout.d.ts +10 -0
  176. package/dist/page/components/config/preview/ColumnLayout.js +15 -0
  177. package/dist/page/components/config/preview/ItemLayout.d.ts +12 -0
  178. package/dist/page/components/config/preview/ItemLayout.js +45 -0
  179. package/dist/page/components/config/preview/ListPanel.d.ts +12 -0
  180. package/dist/page/components/config/preview/ListPanel.js +14 -0
  181. package/dist/page/components/config/preview/MessagePanel.d.ts +12 -0
  182. package/dist/page/components/config/preview/MessagePanel.js +21 -0
  183. package/dist/page/components/config/preview/Panel.d.ts +15 -0
  184. package/dist/page/components/config/preview/Panel.js +74 -0
  185. package/dist/page/components/config/preview/RowLayout.d.ts +10 -0
  186. package/dist/page/components/config/preview/RowLayout.js +26 -0
  187. package/dist/page/components/config/preview/StackLayout.d.ts +10 -0
  188. package/dist/page/components/config/preview/StackLayout.js +15 -0
  189. package/dist/page/components/config/preview/VisualPanel.d.ts +12 -0
  190. package/dist/page/components/config/preview/VisualPanel.js +27 -0
  191. package/dist/page/components/config/preview/index.d.ts +3 -0
  192. package/dist/page/components/config/preview/index.js +19 -0
  193. package/dist/page/components/panels/BlockConfigPanel.js +4 -4
  194. package/dist/page/hooks/IPageController.d.ts +42 -0
  195. package/dist/page/hooks/IPageController.js +32 -0
  196. package/dist/page/hooks/PageController.d.ts +11 -36
  197. package/dist/page/hooks/PageController.js +7 -33
  198. package/dist/page/hooks/index.d.ts +1 -0
  199. package/dist/page/hooks/index.js +1 -0
  200. package/dist/page/hooks/usePageController.d.ts +3 -3
  201. package/dist/page/screens/PageEditor.js +1 -1
  202. package/dist/styles/index.css +809 -60
  203. package/dist/styles/tailwind.js +1 -0
  204. package/dist/users/screens/UserExplorer.js +1 -1
  205. package/package.json +3 -2
  206. package/dist/core/domain/TranslateSchema.d.ts +0 -7
  207. package/dist/page/components/config/LegacyBlockPreview.d.ts +0 -8
  208. package/dist/page/components/config/LegacyBlockPreview.js +0 -452
  209. /package/dist/core/{domain/TranslateSchema.js → repository/IAssetRepository.js} +0 -0
@@ -25,15 +25,18 @@ const rxjs_1 = require("rxjs");
25
25
  const core_1 = require("../../../core");
26
26
  const hooks_1 = require("../../hooks");
27
27
  // component
28
- function BlockConfigButton({ target, children = 'Configure' }) {
28
+ function BlockConfigButton({ target, anchorId: anchorOverrideId, children = 'Configure' }) {
29
29
  var _a;
30
30
  // bind state + hooks
31
31
  const [open, setOpen] = (0, react_2.useState)(false);
32
32
  const anchorId = (0, react_2.useId)();
33
+ const nestedAnchorId = (0, react_2.useId)();
33
34
  const panelLayoutPickerRef = (0, react_2.useRef)(null);
34
35
  const listLayoutPickerRef = (0, react_2.useRef)(null);
35
36
  const configuration = (0, core_1.useBlockConfiguration)();
36
37
  const pageController = (0, hooks_1.usePageController)();
38
+ const collectionStore = (0, core_1.useCollectionStore)();
39
+ const assetStore = (0, core_1.useAssetStore)();
37
40
  // skip if there's no config
38
41
  if (!configuration) {
39
42
  return null;
@@ -56,7 +59,7 @@ function BlockConfigButton({ target, children = 'Configure' }) {
56
59
  // pick new layout
57
60
  const { schema: layoutSchema, value: layoutData } = layoutField;
58
61
  const selectedLayout = await ((_a = panelLayoutPickerRef.current) === null || _a === void 0 ? void 0 : _a.open({
59
- anchor: anchorId,
62
+ anchor: nestedAnchorId,
60
63
  anchorOffset: 4,
61
64
  placement: 'top',
62
65
  items: Object.entries(layoutSchema.options).map(([layout, option]) => ({
@@ -72,7 +75,7 @@ function BlockConfigButton({ target, children = 'Configure' }) {
72
75
  };
73
76
  // set variables
74
77
  size = 'sm';
75
- placement = 'left';
78
+ placement = anchorOverrideId ? 'left-start' : 'left';
76
79
  title = 'Block Configuration';
77
80
  // render content
78
81
  const { scope, layoutField, blocksFields = [], desktopFields = [], mobileFields = [] } = configuration;
@@ -82,7 +85,7 @@ function BlockConfigButton({ target, children = 'Configure' }) {
82
85
  const { options: slotOptions = [], currentIndex: slotIndex = 0 } = configuration.slotState;
83
86
  content = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("section", { className: "grid grid-cols-2 gap-x-l5 gap-y-l4", children: [blocksFields.length > 0 &&
84
87
  (0, jsx_runtime_1.jsx)(core_1.FieldErrorController, { children: blocksFields.map(field => (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { className: "col-span-full", field: field, size: "xs" }, field.id)) }), layoutField && layoutField.schema.enum.length > 1 &&
85
- (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l2", children: [(0, jsx_runtime_1.jsx)(core_1.FieldHeader, { label: "Layout", size: "xs" }), (0, jsx_runtime_1.jsx)(core_1.Button, { anchorId: anchorId, variant: "secondary", size: "xs", iconLeft: "LayoutTemplate", onClick: onChangePanelLayout, children: "Change" })] }), slotOptions.length > 1 &&
88
+ (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l2", children: [(0, jsx_runtime_1.jsx)(core_1.FieldHeader, { label: "Layout", size: "xs" }), (0, jsx_runtime_1.jsx)(core_1.Button, { anchorId: nestedAnchorId, variant: "secondary", size: "xs", iconLeft: "LayoutTemplate", onClick: onChangePanelLayout, children: "Change" })] }), slotOptions.length > 1 &&
86
89
  (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l2", children: [(0, jsx_runtime_1.jsx)(core_1.FieldHeader, { label: "Arrangement", size: "xs" }), slotOptions.length === 2
87
90
  ?
88
91
  (0, jsx_runtime_1.jsx)(core_1.Button, { variant: "secondary", size: "xs", iconLeft: "ArrowLeftRight", onClick: () => configuration === null || configuration === void 0 ? void 0 : configuration.gotToNextSlot(), children: "Swap" })
@@ -113,7 +116,7 @@ function BlockConfigButton({ target, children = 'Configure' }) {
113
116
  // pick new layout
114
117
  const { value: layoutData } = layoutField;
115
118
  const selectedLayout = await ((_a = listLayoutPickerRef.current) === null || _a === void 0 ? void 0 : _a.open({
116
- anchor: anchorId,
119
+ anchor: nestedAnchorId,
117
120
  anchorOffset: 4,
118
121
  placement: 'top',
119
122
  items: Object.entries(layoutSchema.options).map(([layout, option]) => ({
@@ -132,7 +135,7 @@ function BlockConfigButton({ target, children = 'Configure' }) {
132
135
  placement = 'bottom-end';
133
136
  title = 'List Configuration';
134
137
  // render content
135
- content = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l4", children: [(0, jsx_runtime_1.jsx)(core_1.Button, { anchorId: anchorId, variant: "secondary", size: "xs", iconLeft: "LayoutTemplate", onClick: onChangeLayout, children: "Change" }), Object.values(listFields)
138
+ content = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l4", children: [(0, jsx_runtime_1.jsx)(core_1.Button, { anchorId: nestedAnchorId, variant: "secondary", size: "xs", iconLeft: "LayoutTemplate", onClick: onChangeLayout, children: "Change" }), Object.values(listFields)
136
139
  .filter(funnel_core_1.Value.isDefined)
137
140
  .map(field => (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: field, size: "xs" }, field.id))] }), (0, jsx_runtime_1.jsx)(core_1.QuickPicker, { ref: listLayoutPickerRef, variant: "card", title: "Pick List Layout", description: "Select an available layout for this list.", renderItem: (item) => renderListLayoutItem(item) })] }));
138
141
  break;
@@ -144,18 +147,36 @@ function BlockConfigButton({ target, children = 'Configure' }) {
144
147
  title = 'Visual Configuration';
145
148
  tip = 'Cropping changes how the image appears on your site, not your original file.';
146
149
  // get fields
147
- const { aspect: aspectField, anchor: anchorField, width: widthField, horizontalAlign: horizontalAlignField } = configuration.visualFields;
150
+ const { aspect: aspectField, anchor: anchorField, width: widthField, horizontalAlign: horizontalAlignField, controls: controlsField, autoPlay: autoPlayField, loop: loopField, mute: muteField, } = configuration.visualFields;
148
151
  const { value } = (_a = configuration.getFieldData('visual')) !== null && _a !== void 0 ? _a : {};
149
- const visual = funnel_core_1.Schema.AssetField.LinkedValue.Visual.filter(value)
152
+ const media = funnel_core_1.Schema.CollectionField.Value.ForInline.filter(value)
150
153
  ? value
151
- : undefined;
154
+ : funnel_core_1.Schema.CollectionField.Value.ForRef.filter(value)
155
+ ? collectionStore.getCollection(value.id)
156
+ : undefined;
157
+ // helpers
158
+ const renderOptionButton = (field) => {
159
+ var _a;
160
+ // skip if there's no field
161
+ if (!field) {
162
+ return null;
163
+ }
164
+ // render
165
+ const enabled = ((_a = field.value) === null || _a === void 0 ? void 0 : _a.value) === true;
166
+ return ((0, jsx_runtime_1.jsx)(core_1.Button, { variant: enabled ? 'primary' : 'secondary', size: "xs", onClick: () => field.value = funnel_core_1.Schema.BooleanField.Value.toData(!enabled), children: field.schema.name }));
167
+ };
168
+ // content
152
169
  content = ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l9", children: [(0, jsx_runtime_1.jsxs)("section", { className: "flex flex-col gap-l4", children: [aspectField &&
153
170
  (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: aspectField, size: "xs" }), anchorField
154
171
  ? (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: anchorField, size: "xs" })
155
172
  :
156
- (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(core_1.FieldHeader, { label: "Anchor", size: "xs" }), (0, jsx_runtime_1.jsx)("p", { className: "label-xs text-content-secondary text-pretty", children: "Your current image size and aspect ratio don't require and anchor (there's no cropping)." })] })] }), visual && renderVisual({
173
+ (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(core_1.FieldHeader, { label: "Anchor", size: "xs" }), (0, jsx_runtime_1.jsx)("p", { className: "label-xs text-content-secondary text-pretty", children: "Your current image size and aspect ratio don't require and anchor (there's no cropping)." })] }), widthField &&
174
+ (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: widthField, size: "xs" }, widthField.id), horizontalAlignField &&
175
+ (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: horizontalAlignField, size: "xs" }, horizontalAlignField.id), (controlsField || autoPlayField || loopField || muteField) &&
176
+ (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l2", children: [(0, jsx_runtime_1.jsx)(core_1.FieldHeader, { label: "Video Options", size: "xs" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-wrap gap-l4 items-center", children: [renderOptionButton(controlsField), renderOptionButton(autoPlayField)] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-wrap gap-l4 items-center", children: [renderOptionButton(loopField), renderOptionButton(muteField)] })] })] }), funnel_ui_1.Media.Value.filter(media) && renderVisual({
177
+ assetStore,
157
178
  configuration,
158
- visual,
179
+ visual: media,
159
180
  aspectField: aspectField,
160
181
  anchorField: anchorField
161
182
  })] }));
@@ -180,10 +201,10 @@ function BlockConfigButton({ target, children = 'Configure' }) {
180
201
  configuration.reset();
181
202
  };
182
203
  // render
183
- return ((0, jsx_runtime_1.jsx)(core_1.MiniEditor, { title: title, size: size, anchor: (0, jsx_runtime_1.jsx)(core_1.Button, { variant: "secondary", size: "xs", onClick: () => setOpen(true), children: children }), anchorOffset: 4, placement: placement, open: open, onSave: onSave, disableSave: !configuration.modified, onClose: () => setOpen(false), onClosed: onClosed, customActions: (0, jsx_runtime_1.jsx)(core_1.Button, { variant: "secondary", size: "xs", iconLeft: configuration.scope === 'mobile'
184
- ? 'Smartphone'
185
- : 'Monitor', onClick: () => configuration.scope = configuration.scope === 'desktop' ? 'mobile' : 'desktop', children: configuration.scope === 'mobile' ? 'Mobile' : 'Desktop' }), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l4", children: [tip &&
186
- (0, jsx_runtime_1.jsx)(core_1.Note, { variant: "tip", size: size, children: (0, jsx_runtime_1.jsx)(funnel_ui_1.Markup, { markdown: `**Tip:** ${tip}` }) }), content] }) }));
204
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(core_1.Button, { anchorId: anchorId, variant: "secondary", size: "xs", onClick: () => setOpen(true), children: children }), (0, jsx_runtime_1.jsx)(core_1.MiniEditor, { title: title, size: size, anchor: anchorOverrideId || anchorId, anchorOffset: 4, placement: placement, open: open, onSave: onSave, disableSave: !configuration.modified, onClose: () => setOpen(false), onClosed: onClosed, customActions: (0, jsx_runtime_1.jsx)(core_1.Button, { variant: "secondary", size: "xs", iconLeft: configuration.scope === 'mobile'
205
+ ? 'Smartphone'
206
+ : 'Monitor', onClick: () => configuration.scope = configuration.scope === 'desktop' ? 'mobile' : 'desktop', children: configuration.scope === 'mobile' ? 'Mobile' : 'Desktop' }), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l4", children: [tip &&
207
+ (0, jsx_runtime_1.jsx)(core_1.Note, { variant: "tip", size: size, children: (0, jsx_runtime_1.jsx)(funnel_ui_1.Markup, { markdown: `**Tip:** ${tip}` }) }), content] }) })] }));
187
208
  }
188
209
  function renderPanelLayoutItem(item) {
189
210
  const panel = (className = 'flex-1') => ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('bg-surface-placeholder rounded-[2px]', className) }));
@@ -277,14 +298,46 @@ function renderListLayoutItem(item) {
277
298
  // render item in frame
278
299
  return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('w-full h-full flex justify-center items-center'), children: content }));
279
300
  }
280
- function renderVisual({ configuration, visual, aspectField, anchorField }) {
281
- var _a, _b, _c;
301
+ function renderVisual({ assetStore, configuration, visual, aspectField, anchorField }) {
302
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
303
+ // get dimensions
304
+ let width = undefined;
305
+ let height = undefined;
306
+ let image = undefined;
307
+ let video = undefined;
308
+ let embeddedVideo = undefined;
309
+ if (funnel_ui_1.Media.Value.isImage(visual) && ((_c = (_b = (_a = visual.fields) === null || _a === void 0 ? void 0 : _a.image) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.id)) {
310
+ const asset = assetStore.getAsset(visual.fields.image.value.id);
311
+ image = asset === null || asset === void 0 ? void 0 : asset.value;
312
+ const { dimensions } = (_d = image === null || image === void 0 ? void 0 : image.metadata) !== null && _d !== void 0 ? _d : {};
313
+ width = (_e = dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) !== null && _e !== void 0 ? _e : undefined;
314
+ height = (_f = dimensions === null || dimensions === void 0 ? void 0 : dimensions.height) !== null && _f !== void 0 ? _f : undefined;
315
+ }
316
+ else if (funnel_ui_1.Media.Value.isVideo(visual) && ((_h = (_g = visual.fields) === null || _g === void 0 ? void 0 : _g.video) === null || _h === void 0 ? void 0 : _h.value)) {
317
+ // link local video
318
+ const { video: { value: { local, remote } }, cover: coverRaw } = visual.fields;
319
+ if ((_j = local === null || local === void 0 ? void 0 : local.value) === null || _j === void 0 ? void 0 : _j.id) {
320
+ const asset = assetStore.getAsset(local.value.id);
321
+ video = asset === null || asset === void 0 ? void 0 : asset.value;
322
+ const { dimensions } = (_k = video === null || video === void 0 ? void 0 : video.metadata) !== null && _k !== void 0 ? _k : {};
323
+ width = (_l = dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) !== null && _l !== void 0 ? _l : undefined;
324
+ height = (_m = dimensions === null || dimensions === void 0 ? void 0 : dimensions.height) !== null && _m !== void 0 ? _m : undefined;
325
+ }
326
+ // or remote
327
+ else if (remote === null || remote === void 0 ? void 0 : remote.value) {
328
+ embeddedVideo = remote.value;
329
+ width = embeddedVideo.dimensions.width;
330
+ height = embeddedVideo.dimensions.height;
331
+ }
332
+ }
333
+ // slop if there's no asset
334
+ if (!width || !height) {
335
+ return null;
336
+ }
282
337
  // determine layout info
283
- const { metadata, name, description } = visual;
284
- const { dimensions: { width, height } } = metadata;
285
338
  const isPortrait = width < height;
286
- const aspect = (_b = (_a = aspectField === null || aspectField === void 0 ? void 0 : aspectField.value) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 'auto';
287
- const anchor = (_c = anchorField === null || anchorField === void 0 ? void 0 : anchorField.value) === null || _c === void 0 ? void 0 : _c.value;
339
+ const aspect = (_p = (_o = aspectField === null || aspectField === void 0 ? void 0 : aspectField.value) === null || _o === void 0 ? void 0 : _o.value) !== null && _p !== void 0 ? _p : 'auto';
340
+ const anchor = (_q = anchorField === null || anchorField === void 0 ? void 0 : anchorField.value) === null || _q === void 0 ? void 0 : _q.value;
288
341
  const anchorDirection = anchorField
289
342
  ? anchorField.schema.isValidOption('left')
290
343
  ? 'x'
@@ -294,9 +347,13 @@ function renderVisual({ configuration, visual, aspectField, anchorField }) {
294
347
  return ((0, jsx_runtime_1.jsx)("section", { className: (0, classnames_1.default)('w-full h-[210px]', 'flex flex-col justify-center items-center', 'bg-background rounded-xs'), children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)('relative bg-destructive', {
295
348
  'h-full max-h-full w-auto': isPortrait,
296
349
  'w-full': !isPortrait
297
- }), children: [funnel_core_1.Schema.AssetField.LinkedValue.Image.filter(visual)
298
- ? renderImage({ configuration, visual })
299
- : renderVideo({ configuration, visual }), aspect !== 'auto' && anchor && anchorDirection &&
350
+ }), children: [image
351
+ ? renderImage({ assetStore, configuration, visual: image })
352
+ : video
353
+ ? renderVideo({ assetStore, configuration, visual: video })
354
+ : embeddedVideo
355
+ ? renderStreamingVideo({ assetStore, configuration, visual: embeddedVideo })
356
+ : null, aspect !== 'auto' && anchor && anchorDirection &&
300
357
  (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('absolute inset-0 z-supersurface flex', {
301
358
  'flex-col': anchorDirection === 'y'
302
359
  }), children: (0, jsx_runtime_1.jsxs)(react_1.AnimatePresence, { mode: "popLayout", children: [anchor !== 'left' && anchor !== 'top' &&
@@ -318,3 +375,6 @@ function renderImage({ visual }) {
318
375
  function renderVideo({ visual }) {
319
376
  return ((0, jsx_runtime_1.jsx)("video", { className: "max-w-full max-h-full", src: visual.url, autoPlay: true, muted: true, loop: true, playsInline: true }));
320
377
  }
378
+ function renderStreamingVideo({ visual }) {
379
+ return ((0, jsx_runtime_1.jsx)("img", { className: "max-w-full max-h-full", src: visual.thumbUrl, alt: "Video preview" }));
380
+ }
@@ -0,0 +1,8 @@
1
+ import { BlockConfiguration } from '../../../core';
2
+ export declare function BlockPreview({ className, configuration }: BlockPreview.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace BlockPreview {
4
+ type Props = {
5
+ className?: string;
6
+ configuration?: BlockConfiguration;
7
+ };
8
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BlockPreview = BlockPreview;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const funnel_core_1 = require("@nascentdigital/funnel-core");
9
+ const classnames_1 = __importDefault(require("classnames"));
10
+ const react_1 = require("motion/react");
11
+ const preview_1 = require("./preview");
12
+ // components
13
+ function BlockPreview({ className, configuration }) {
14
+ // bind props
15
+ const { scope = 'desktop', layout } = configuration !== null && configuration !== void 0 ? configuration : {};
16
+ const tight = scope === 'mobile'
17
+ ? layout === null || layout === void 0 ? void 0 : layout.tight.mobile
18
+ : layout === null || layout === void 0 ? void 0 : layout.tight.desktop;
19
+ // render
20
+ return ((0, jsx_runtime_1.jsx)(react_1.motion.section, { className: (0, classnames_1.default)(className, 'bg-surface2 rounded-xs interpolate-all', {
21
+ 'min-h-[100px]': !layout,
22
+ 'w-[240px]': scope === 'desktop',
23
+ 'w-[136px]': scope === 'mobile',
24
+ 'pb-l4': tight === 'above',
25
+ 'pt-l4': tight === 'below',
26
+ 'py-l4': tight === 'none'
27
+ }), layoutRoot: true, layout: true, children: configuration && renderLayout({ configuration }) }));
28
+ }
29
+ function renderLayout({ configuration }) {
30
+ // skip if there's no layout
31
+ const { scope, layout } = configuration;
32
+ if (!layout) {
33
+ return null;
34
+ }
35
+ // render layout based on root type
36
+ const mobile = scope === 'mobile';
37
+ const { root } = layout;
38
+ switch (root.type) {
39
+ // row (force column if mobile)
40
+ case 'row':
41
+ return mobile
42
+ ? (0, jsx_runtime_1.jsx)(preview_1.ColumnLayout, { layout: root, mobile: mobile })
43
+ : (0, jsx_runtime_1.jsx)(preview_1.RowLayout, { layout: root, mobile: mobile });
44
+ // column
45
+ case 'column':
46
+ return (0, jsx_runtime_1.jsx)(preview_1.ColumnLayout, { layout: root, mobile: mobile });
47
+ // stack
48
+ case 'stack':
49
+ return (0, jsx_runtime_1.jsx)(preview_1.StackLayout, { layout: root, mobile: mobile });
50
+ default:
51
+ throw new funnel_core_1.NotImplementedError(`Unsupported layout: ${layout.root.type}`);
52
+ }
53
+ }
@@ -1,3 +1,3 @@
1
1
  export * from './BlockConfigButton';
2
2
  export * from './BlockConfigurationProvider';
3
- export * from './LegacyBlockPreview';
3
+ export * from './BlockPreview';
@@ -16,4 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./BlockConfigButton"), exports);
18
18
  __exportStar(require("./BlockConfigurationProvider"), exports);
19
- __exportStar(require("./LegacyBlockPreview"), exports);
19
+ __exportStar(require("./BlockPreview"), exports);
@@ -0,0 +1,10 @@
1
+ import { BlockLayout } from '@nascentdigital/funnel-core';
2
+ export declare function ColumnLayout({ className, layout, mobile, nested }: ColumnLayout.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace ColumnLayout {
4
+ type Props = {
5
+ className?: string;
6
+ layout: BlockLayout.Container;
7
+ mobile: boolean;
8
+ nested?: boolean;
9
+ };
10
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ColumnLayout = ColumnLayout;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const ItemLayout_1 = require("./ItemLayout");
10
+ // components
11
+ function ColumnLayout({ className, layout, mobile, nested = false }) {
12
+ // render
13
+ const { items } = layout;
14
+ return ((0, jsx_runtime_1.jsx)(ItemLayout_1.ItemLayout, { className: (0, classnames_1.default)(className, 'flex flex-col gap-l4'), parentType: "column", items: items, mobile: mobile, nested: nested }));
15
+ }
@@ -0,0 +1,12 @@
1
+ import { BlockLayout, Transform } from '@nascentdigital/funnel-core';
2
+ export declare function ItemLayout({ className, itemClassName, parentType, items, mobile, nested }: ItemLayout.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace ItemLayout {
4
+ type Props = {
5
+ className?: string;
6
+ itemClassName?: Transform<BlockLayout.NestedItem, string>;
7
+ parentType: BlockLayout.Container['type'];
8
+ items: ReadonlyArray<BlockLayout.NestedItem>;
9
+ mobile: boolean;
10
+ nested: boolean;
11
+ };
12
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ItemLayout = ItemLayout;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const funnel_core_1 = require("@nascentdigital/funnel-core");
9
+ const classnames_1 = __importDefault(require("classnames"));
10
+ const react_1 = require("motion/react");
11
+ const ColumnLayout_1 = require("./ColumnLayout");
12
+ const ListPanel_1 = require("./ListPanel");
13
+ const MessagePanel_1 = require("./MessagePanel");
14
+ const RowLayout_1 = require("./RowLayout");
15
+ const StackLayout_1 = require("./StackLayout");
16
+ const VisualPanel_1 = require("./VisualPanel");
17
+ // components
18
+ function ItemLayout({ className, itemClassName = () => '', parentType, items, mobile, nested }) {
19
+ // render
20
+ return ((0, jsx_runtime_1.jsx)(react_1.motion.div, { className: (0, classnames_1.default)(className), layout: true, children: items.map((item, itemOffset) => renderItem({ className: itemClassName(item), parentType, item, itemOffset, mobile, nested })) }));
21
+ }
22
+ function renderItem({ className, parentType, item, itemOffset, mobile, nested }) {
23
+ // render based on type
24
+ const key = funnel_core_1.BlockLayout.Container.filter(item)
25
+ ? `${item.type}.${itemOffset}`
26
+ : item.key;
27
+ switch (item.type) {
28
+ // containers (nested)
29
+ case 'row':
30
+ return mobile
31
+ ? (0, jsx_runtime_1.jsx)(ColumnLayout_1.ColumnLayout, { layout: item, mobile: mobile, nested: true }, key)
32
+ : (0, jsx_runtime_1.jsx)(RowLayout_1.RowLayout, { layout: item, mobile: mobile, nested: true }, key);
33
+ case 'column':
34
+ return (0, jsx_runtime_1.jsx)(ColumnLayout_1.ColumnLayout, { layout: item, mobile: mobile, nested: true }, key);
35
+ case 'stack':
36
+ return (0, jsx_runtime_1.jsx)(StackLayout_1.StackLayout, { layout: item, mobile: mobile, nested: true }, key);
37
+ // panels
38
+ case 'message':
39
+ return ((0, jsx_runtime_1.jsx)(MessagePanel_1.MessagePanel, { className: className, parentType: parentType, itemOffset: itemOffset, panel: item, mobile: mobile, nested: nested }, key));
40
+ case 'list':
41
+ return ((0, jsx_runtime_1.jsx)(ListPanel_1.ListPanel, { className: className, parentType: parentType, itemOffset: itemOffset, panel: item, mobile: mobile, nested: nested }, key));
42
+ case 'visual':
43
+ return ((0, jsx_runtime_1.jsx)(VisualPanel_1.VisualPanel, { className: className, parentType: parentType, itemOffset: itemOffset, panel: item, mobile: mobile, nested: nested }, key));
44
+ }
45
+ }
@@ -0,0 +1,12 @@
1
+ import { BlockLayout } from '@nascentdigital/funnel-core';
2
+ export declare function ListPanel({ className, parentType, itemOffset, panel, mobile, nested }: ListPanel.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace ListPanel {
4
+ type Props = {
5
+ className?: string;
6
+ parentType: BlockLayout.Container['type'];
7
+ itemOffset: number;
8
+ panel: BlockLayout.List;
9
+ mobile: boolean;
10
+ nested: boolean;
11
+ };
12
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ListPanel = ListPanel;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const Panel_1 = require("./Panel");
10
+ // components
11
+ function ListPanel({ className, parentType, itemOffset, panel, mobile, nested }) {
12
+ // render
13
+ return ((0, jsx_runtime_1.jsx)(Panel_1.Panel, { className: className, contentClassName: (0, classnames_1.default)('flex flex-col p-6 bg-background rounded-xs', {}), parentType: parentType, itemOffset: itemOffset, panel: panel, mobile: mobile, nested: nested, disableSizing: mobile, children: (0, jsx_runtime_1.jsx)("div", { children: "List Panel" }) }));
14
+ }
@@ -0,0 +1,12 @@
1
+ import { BlockLayout } from '@nascentdigital/funnel-core';
2
+ export declare function MessagePanel({ className, parentType, itemOffset, panel, mobile, nested }: MessagePanel.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace MessagePanel {
4
+ type Props = {
5
+ className?: string;
6
+ parentType: BlockLayout.Container['type'];
7
+ itemOffset: number;
8
+ panel: BlockLayout.Message;
9
+ mobile: boolean;
10
+ nested: boolean;
11
+ };
12
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MessagePanel = MessagePanel;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const react_1 = require("motion/react");
10
+ const Panel_1 = require("./Panel");
11
+ // components
12
+ function MessagePanel({ className, parentType, itemOffset, panel, mobile, nested }) {
13
+ // render
14
+ const { textAlign: { mobile: textAlignMobile, desktop: textAlignDesktop } } = panel;
15
+ const textAlign = mobile ? textAlignMobile : textAlignDesktop;
16
+ return ((0, jsx_runtime_1.jsxs)(Panel_1.Panel, { className: className, contentClassName: (0, classnames_1.default)('flex flex-col p-6 bg-background rounded-xs', {
17
+ 'items-start': textAlign === 'left',
18
+ 'items-center': textAlign === 'center',
19
+ 'items-end': textAlign === 'right'
20
+ }), parentType: parentType, itemOffset: itemOffset, panel: panel, mobile: mobile, nested: nested, disableSizing: mobile, children: [(0, jsx_runtime_1.jsx)(react_1.motion.div, { className: "w-full h-8 mb-4 bg-ix-primary rounded-xxs overflow-hidden", layout: true }), (0, jsx_runtime_1.jsx)(react_1.motion.div, { className: "w-full h-4 mb-3 bg-draft/tint3 rounded-px overflow-hidden", layout: true }), (0, jsx_runtime_1.jsx)(react_1.motion.div, { className: "w-full h-4 mb-3 bg-draft/tint3 rounded-px overflow-hidden", layout: true }), (0, jsx_runtime_1.jsx)(react_1.motion.div, { className: "w-1/2 h-4 bg-draft/tint3 rounded-px overflow-hidden", layout: true })] }));
21
+ }
@@ -0,0 +1,15 @@
1
+ import { BlockLayout } from '@nascentdigital/funnel-core';
2
+ import { PropsWithChildren } from 'react';
3
+ export declare function Panel({ className, contentClassName, parentType, itemOffset, panel, mobile, nested, disableSizing, children }: Panel.Props): import("react/jsx-runtime").JSX.Element;
4
+ export declare namespace Panel {
5
+ type Props = PropsWithChildren & {
6
+ className?: string;
7
+ contentClassName?: string;
8
+ parentType: BlockLayout.Container['type'];
9
+ itemOffset: number;
10
+ panel: BlockLayout.Panel;
11
+ mobile: boolean;
12
+ nested: boolean;
13
+ disableSizing: boolean;
14
+ };
15
+ }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Panel = Panel;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const react_1 = require("motion/react");
10
+ // components
11
+ function Panel({ className, contentClassName, parentType, itemOffset, panel, mobile, nested, disableSizing, children }) {
12
+ // render
13
+ const { key, mobileOrder, alignY, fullBleed: { mobile: fullBleedMobile, desktop: fullBleedDesktop } } = panel;
14
+ const fullBleed = mobile ? fullBleedMobile : fullBleedDesktop;
15
+ return ((0, jsx_runtime_1.jsx)(react_1.motion.div, { className: (0, classnames_1.default)(className, {
16
+ // mobile
17
+ 'flex flex-col': mobile,
18
+ 'justify-start': mobile && alignY === 'start',
19
+ 'justify-center': mobile && alignY === 'center',
20
+ 'justify-end': mobile && alignY === 'end',
21
+ 'order-first': mobile && mobileOrder === 'first',
22
+ 'order-last': mobile && mobileOrder === 'last',
23
+ // desktop
24
+ 'grid grid-cols-12': !mobile,
25
+ 'items-start': !mobile && alignY === 'start',
26
+ 'items-center': !mobile && alignY === 'center',
27
+ 'items-end': !mobile && alignY === 'end',
28
+ // '-ml-l4': itemPosition.left && fullBleed.desktop,
29
+ // '-mr-l4': itemPosition.right && fullBleed.desktop
30
+ // spacing (row)
31
+ 'pl-l4': parentType === 'row' && itemOffset === 0 && !fullBleed,
32
+ 'pr-l4': parentType === 'row' && itemOffset === 1 && !fullBleed,
33
+ // spacing (column/stack)
34
+ 'px-l4': (parentType === 'column' || (parentType === 'stack' && panel.type === 'visual')) && !fullBleed,
35
+ 'px-l6 py-l4': parentType === 'stack' && panel.type !== 'visual' && !fullBleed
36
+ }), layoutId: key, layout: true, children: (0, jsx_runtime_1.jsx)(react_1.motion.div, { className: getContentClasses({ className: (0, classnames_1.default)(contentClassName, 'relative'), panel, disableSizing }), layout: true, children: children }) }, key));
37
+ }
38
+ function getContentClasses({ className, panel: { alignX, size }, disableSizing }) {
39
+ // force full width for mobile
40
+ if (disableSizing) {
41
+ return className;
42
+ }
43
+ // or size for desktop
44
+ switch (size) {
45
+ case 'xs':
46
+ return (0, classnames_1.default)(className, 'col-span-4', {
47
+ 'col-start-1': alignX === 'start',
48
+ 'col-start-5': alignX === 'center',
49
+ 'col-end-13': alignX === 'end'
50
+ });
51
+ case 'sm':
52
+ return (0, classnames_1.default)(className, 'col-span-6', {
53
+ 'col-start-1': alignX === 'start',
54
+ 'col-start-4': alignX === 'center',
55
+ 'col-end-13': alignX === 'end'
56
+ });
57
+ case 'md':
58
+ return (0, classnames_1.default)(className, 'col-span-8', {
59
+ 'col-start-1': alignX === 'start',
60
+ 'col-start-3': alignX === 'center',
61
+ 'col-end-13': alignX === 'end'
62
+ });
63
+ case 'lg':
64
+ return (0, classnames_1.default)(className, 'col-span-10', {
65
+ 'col-start-1': alignX === 'start',
66
+ 'col-start-2': alignX === 'center',
67
+ 'col-end-13': alignX === 'end'
68
+ });
69
+ case 'full':
70
+ return (0, classnames_1.default)(className, 'col-span-full');
71
+ default:
72
+ return className;
73
+ }
74
+ }
@@ -0,0 +1,10 @@
1
+ import { BlockLayout } from '@nascentdigital/funnel-core';
2
+ export declare function RowLayout({ className, layout, mobile, nested }: RowLayout.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace RowLayout {
4
+ type Props = {
5
+ className?: string;
6
+ layout: BlockLayout.Row | BlockLayout.Row.Nested;
7
+ mobile: boolean;
8
+ nested?: boolean;
9
+ };
10
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RowLayout = RowLayout;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const ItemLayout_1 = require("./ItemLayout");
10
+ // components
11
+ function RowLayout({ className, layout, mobile, nested = false }) {
12
+ // render
13
+ const { alignY, ratio, items } = layout;
14
+ return ((0, jsx_runtime_1.jsx)(ItemLayout_1.ItemLayout, { className: (0, classnames_1.default)(className, 'grid gap-l5', {
15
+ 'items-start': alignY === 'start',
16
+ 'items-center': alignY === 'center',
17
+ 'items-end': alignY === 'end',
18
+ 'grid-cols-[1fr,1fr]': ratio.desktop === '1/1',
19
+ 'grid-cols-[1fr,2fr]': ratio.desktop === '1/2',
20
+ 'grid-cols-[1fr,3fr]': ratio.desktop === '1/3',
21
+ 'grid-cols-[2fr,1fr]': ratio.desktop === '2/1',
22
+ 'grid-cols-[2fr,3fr]': ratio.desktop === '2/3',
23
+ 'grid-cols-[3fr,1fr]': ratio.desktop === '3/1',
24
+ 'grid-cols-[3fr,2fr]': ratio.desktop === '3/2'
25
+ }), itemClassName: () => 'flex-1', parentType: "row", items: items, mobile: mobile, nested: nested }));
26
+ }
@@ -0,0 +1,10 @@
1
+ import { BlockLayout } from '@nascentdigital/funnel-core';
2
+ export declare function StackLayout({ className, layout, mobile, nested }: StackLayout.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace StackLayout {
4
+ type Props = {
5
+ className?: string;
6
+ layout: BlockLayout.Container;
7
+ mobile: boolean;
8
+ nested?: boolean;
9
+ };
10
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.StackLayout = StackLayout;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const ItemLayout_1 = require("./ItemLayout");
10
+ // components
11
+ function StackLayout({ className, layout, mobile, nested = false }) {
12
+ // render
13
+ const { items } = layout;
14
+ return ((0, jsx_runtime_1.jsx)(ItemLayout_1.ItemLayout, { className: (0, classnames_1.default)(className, 'stacked-stretch'), parentType: "stack", items: items, mobile: mobile, nested: nested }));
15
+ }
@@ -0,0 +1,12 @@
1
+ import { BlockLayout } from '@nascentdigital/funnel-core';
2
+ export declare function VisualPanel({ className, parentType, itemOffset, panel, mobile, nested }: VisualPanel.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace VisualPanel {
4
+ type Props = {
5
+ className?: string;
6
+ parentType: BlockLayout.Container['type'];
7
+ itemOffset: number;
8
+ panel: BlockLayout.Visual;
9
+ mobile: boolean;
10
+ nested: boolean;
11
+ };
12
+ }