@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
package/dist/EditorApp.js CHANGED
@@ -36,5 +36,5 @@ function EditorApp({ fonts }) {
36
36
  return null;
37
37
  }
38
38
  // render
39
- return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('Editor-wrap', ...fonts), children: (0, jsx_runtime_1.jsx)(core_1.AppStateContainer, { children: (0, jsx_runtime_1.jsx)(core_1.SettingsContainer, { children: (0, jsx_runtime_1.jsx)(react_hotkeys_hook_1.HotkeysProvider, { children: (0, jsx_runtime_1.jsx)(core_1.EditorApiContainer, { children: (0, jsx_runtime_1.jsx)(core_1.AuthContainer, { children: (0, jsx_runtime_1.jsx)(client_1.BreakpointContainer, { breakpoints: { xs: 0, sm: 480, md: 768, lg: 980, xl: 1200 }, children: (0, jsx_runtime_1.jsx)(core_1.DialogContainer, { children: (0, jsx_runtime_1.jsx)(core_1.CenterSheetContainer, { children: (0, jsx_runtime_1.jsx)(core_1.SplashContainer, { children: (0, jsx_runtime_1.jsx)(core_1.SiteConfigContainer, { children: (0, jsx_runtime_1.jsx)(EditorRoutes_1.EditorRoutes, {}) }) }) }) }) }) }) }) }) }) }) }));
39
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('Editor-wrap', ...fonts), children: (0, jsx_runtime_1.jsx)(core_1.AppStateContainer, { children: (0, jsx_runtime_1.jsx)(core_1.SettingsContainer, { children: (0, jsx_runtime_1.jsx)(react_hotkeys_hook_1.HotkeysProvider, { children: (0, jsx_runtime_1.jsx)(core_1.EditorApiContainer, { children: (0, jsx_runtime_1.jsx)(core_1.AssetRepositoryContainer, { children: (0, jsx_runtime_1.jsx)(core_1.CollectionRepositoryContainer, { children: (0, jsx_runtime_1.jsx)(core_1.PageRepositoryContainer, { children: (0, jsx_runtime_1.jsx)(core_1.AuthContainer, { children: (0, jsx_runtime_1.jsx)(client_1.BreakpointContainer, { breakpoints: { xs: 0, sm: 480, md: 768, lg: 980, xl: 1200 }, children: (0, jsx_runtime_1.jsx)(core_1.DialogContainer, { children: (0, jsx_runtime_1.jsx)(core_1.CenterSheetContainer, { children: (0, jsx_runtime_1.jsx)(core_1.SplashContainer, { children: (0, jsx_runtime_1.jsx)(core_1.SiteConfigContainer, { children: (0, jsx_runtime_1.jsx)(EditorRoutes_1.EditorRoutes, {}) }) }) }) }) }) }) }) }) }) }) }) }) }) }));
40
40
  }
@@ -20,21 +20,23 @@ const users_1 = require("./users");
20
20
  // routes
21
21
  function EditorRoutes() {
22
22
  // bind hooks
23
- const { editorApi, authenticated } = (0, core_1.useAuthenticator)();
23
+ const { authenticated } = (0, core_1.useAuthenticator)();
24
+ const pageRepo = (0, core_1.usePageRepository)();
25
+ const collectionRepo = (0, core_1.useCollectionRepository)();
24
26
  const router = (0, core_1.useEditorRouter)();
25
27
  const { ready, route, region: { id: region } = {} } = router;
26
28
  const siteConfig = (0, core_1.useSiteConfig)();
27
29
  const appState = (0, core_1.useAppState)();
28
30
  const siteContext = (0, react_1.useMemo)(() => ({
29
31
  site: authenticated && region
30
- ? new core_1.Site({ appState, editorApi, region })
32
+ ? new core_1.Site({ appState, repository: pageRepo, region })
31
33
  : undefined
32
- }), [appState, editorApi, authenticated, region]);
34
+ }), [appState, pageRepo, authenticated, region]);
33
35
  const collectionsContext = (0, react_1.useMemo)(() => ({
34
36
  collections: authenticated
35
- ? new core_1.Collections({ appState, editorApi })
37
+ ? new core_1.Collections({ appState, repository: collectionRepo })
36
38
  : undefined
37
- }), [appState, editorApi, authenticated]);
39
+ }), [appState, collectionRepo, authenticated]);
38
40
  // show loader while warming up
39
41
  if (!ready) {
40
42
  return null;
@@ -26,7 +26,7 @@ function ChangeSetViewer({ changeSetId }) {
26
26
  }
27
27
  }, [splash, ready]);
28
28
  // render
29
- return ((0, jsx_runtime_1.jsxs)("div", { className: "w-dvw h-dvh flex flex-col", children: [(0, jsx_runtime_1.jsx)(core_1.Header, { back: "back", breadcrumbs: ['Publishing'], onBack: () => router.navigateToChangeSets() }), (0, jsx_runtime_1.jsx)("div", { className: "relative flex-1 overflow-y-scroll shrink-0", children: (0, jsx_runtime_1.jsx)("div", { className: "container-sm container-p", children: (0, jsx_runtime_1.jsx)(core_1.LoadingUntilReady, { className: "flex flex-col gap-l10 py-l14", ready: ready, children: renderChangeSet({ user, editorApi, router, multiSelectRef, multiSelect, dialog, result, changeIds }) }) }) })] }));
29
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "w-dvw h-dvh flex flex-col", children: [(0, jsx_runtime_1.jsx)(core_1.Header, { back: "back", breadcrumbs: ['Publishing'], onBack: () => router.navigateToChangeSets() }), (0, jsx_runtime_1.jsx)("div", { className: "relative flex-1 overflow-y-scroll shrink-0", tabIndex: -1, children: (0, jsx_runtime_1.jsx)("div", { className: "container-sm container-p", children: (0, jsx_runtime_1.jsx)(core_1.LoadingUntilReady, { className: "flex flex-col gap-l10 py-l14", ready: ready, children: renderChangeSet({ user, editorApi, router, multiSelectRef, multiSelect, dialog, result, changeIds }) }) }) })] }));
30
30
  }
31
31
  function renderChangeSet({ user, editorApi, multiSelectRef, multiSelect, router, dialog, result, changeIds }) {
32
32
  // skip if pending
@@ -19,7 +19,7 @@ function ChangeSetsExplorer() {
19
19
  }
20
20
  }, [splash, ready]);
21
21
  // render
22
- return ((0, jsx_runtime_1.jsxs)("div", { className: "w-dvw h-dvh flex flex-col", children: [(0, jsx_runtime_1.jsx)(core_1.Header, { back: "back", breadcrumbs: ['Dashboard'], onBack: () => router.navigateToDashboard() }), (0, jsx_runtime_1.jsx)("div", { className: "relative flex-1 overflow-y-scroll shrink-0", children: (0, jsx_runtime_1.jsx)("div", { className: "container-sm container-p", children: (0, jsx_runtime_1.jsx)(core_1.LoadingUntilReady, { className: "flex flex-col gap-l10 py-l14", ready: ready, children: renderChangeSets({ router, browser }) }) }) })] }));
22
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "w-dvw h-dvh flex flex-col", children: [(0, jsx_runtime_1.jsx)(core_1.Header, { back: "back", breadcrumbs: ['Dashboard'], onBack: () => router.navigateToDashboard() }), (0, jsx_runtime_1.jsx)("div", { className: "relative flex-1 overflow-y-scroll shrink-0", tabIndex: -1, children: (0, jsx_runtime_1.jsx)("div", { className: "container-sm container-p", children: (0, jsx_runtime_1.jsx)(core_1.LoadingUntilReady, { className: "flex flex-col gap-l10 py-l14", ready: ready, children: renderChangeSets({ router, browser }) }) }) })] }));
23
23
  }
24
24
  function renderChangeSets({ router, browser }) {
25
25
  // skip if loading
@@ -50,7 +50,6 @@ function renderChangeSets({ router, browser }) {
50
50
  router.navigateToChangeSet(item.id)
51
51
  .catch(console.error);
52
52
  };
53
- console.debug('[ChangeSetExplorer] rendering', { unpublished, published });
54
53
  // render
55
54
  return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h2", { className: "heading-lg text-content-primary", children: "Browse Changes" }), unpublished.length > 0 &&
56
55
  (0, jsx_runtime_1.jsx)(core_1.Table, { className: "flex-1", title: "Work in progress", children: unpublished.map(({ groupId, latest }) => (0, jsx_runtime_1.jsx)(core_1.TableItem, { details: latest.errors
@@ -1,6 +1,6 @@
1
- import { EventBus } from '@nascentdigital/funnel-core';
2
- import { Collection, CollectionGroup, CollectionRepository, CollectionTarget, EditorApiClient } from '../../core';
3
- export declare class CollectionController {
1
+ import { Collection, CollectionGroup, CollectionRepository, CollectionTarget, EditorApiClient, ICollection } from '../../core';
2
+ import { ICollectionController } from './ICollectionController';
3
+ export declare class CollectionController implements ICollectionController {
4
4
  private readonly _eventBus;
5
5
  readonly repository: CollectionRepository;
6
6
  private _state;
@@ -10,8 +10,8 @@ export declare class CollectionController {
10
10
  private _saveQueuedFor?;
11
11
  private _subscription?;
12
12
  constructor(editorApi: EditorApiClient);
13
- get events$(): import("rxjs").Observable<Collection.Event | CollectionController.Event>;
14
- get state(): CollectionController.State;
13
+ get events$(): import("rxjs").Observable<ICollection.Event | ICollectionController.Event>;
14
+ get state(): ICollectionController.State;
15
15
  private set state(value);
16
16
  get ready(): boolean;
17
17
  get target(): CollectionTarget;
@@ -27,14 +27,3 @@ export declare class CollectionController {
27
27
  unpublish(): Promise<void>;
28
28
  private raiseEvent;
29
29
  }
30
- export declare namespace CollectionController {
31
- type State = 'uninitialized' | 'initializing' | 'loading' | 'ready' | 'saving' | 'unpublishing' | 'error';
32
- interface Event extends EventBus.Event<'CollectionController', Event.Type> {
33
- controller: CollectionController;
34
- }
35
- namespace Event {
36
- type Type = 'state.changed' | 'collection.changed' | 'collectionGroup.changed';
37
- function filter(event: EventBus.Event): event is Event;
38
- function create(event: EventBus.Args<Event>): Event;
39
- }
40
- }
@@ -4,6 +4,7 @@ exports.CollectionController = void 0;
4
4
  const funnel_core_1 = require("@nascentdigital/funnel-core");
5
5
  const rxjs_1 = require("rxjs");
6
6
  const core_1 = require("../../core");
7
+ const ICollectionController_1 = require("./ICollectionController");
7
8
  // class
8
9
  class CollectionController {
9
10
  constructor(editorApi) {
@@ -14,13 +15,12 @@ class CollectionController {
14
15
  }
15
16
  get events$() {
16
17
  return this._eventBus.events$
17
- .pipe((0, rxjs_1.filter)(e => CollectionController.Event.filter(e) || core_1.Collection.Event.filter(e)));
18
+ .pipe((0, rxjs_1.filter)(e => ICollectionController_1.ICollectionController.Event.filter(e) || core_1.ICollection.Event.filter(e)));
18
19
  }
19
20
  get state() {
20
21
  return this._state;
21
22
  }
22
23
  set state(value) {
23
- var _a;
24
24
  // skip if unchanged
25
25
  if (this._state === value) {
26
26
  console.debug('[CollectionController/state] skipping redundant update', value);
@@ -32,7 +32,7 @@ class CollectionController {
32
32
  // raise event
33
33
  this.raiseEvent('state.changed');
34
34
  // save again if it's queued for the same page
35
- if (this._saveQueuedFor && this._saveQueuedFor === ((_a = this._collectionGroup) === null || _a === void 0 ? void 0 : _a.collection)) {
35
+ if (this._saveQueuedFor && this._saveQueuedFor === this._collection) {
36
36
  console.debug('[CollectionController/setState] initiating queued save');
37
37
  this.save().catch(console.error);
38
38
  }
@@ -84,10 +84,6 @@ class CollectionController {
84
84
  console.debug('[CollectionController] updating to new collection', collection);
85
85
  // update collection
86
86
  this._collection = collection;
87
- // bind to collection group (should be bound)
88
- if (this._collectionGroup) {
89
- this._collectionGroup.collection = collection;
90
- }
91
87
  // subscribe to collection changes (if there's a page)
92
88
  if (collection) {
93
89
  console.debug('[CollectionController] binding subscription for', collection);
@@ -95,7 +91,7 @@ class CollectionController {
95
91
  this._subscription = collection.events$
96
92
  .pipe((0, rxjs_1.filter)(e => {
97
93
  // handle collection events
98
- if (core_1.Collection.Event.filter(e)) {
94
+ if (core_1.ICollection.Event.filter(e)) {
99
95
  return e.type === 'modified';
100
96
  }
101
97
  // or item/object/list events
@@ -110,7 +106,7 @@ class CollectionController {
110
106
  return funnel_core_1.Field.Event.filter(e) && (e.type === 'changed' || e.type === 'reset');
111
107
  }
112
108
  }), (0, rxjs_1.debounce)(e => {
113
- if ((core_1.Collection.Event.filter(e) && e.type === 'modified')
109
+ if ((core_1.ICollection.Event.filter(e) && e.type === 'modified')
114
110
  || core_1.Item.Event.filter(e)
115
111
  || funnel_core_1.FieldList.Event.filter(e)
116
112
  || (funnel_core_1.Field.Event.filter(e) && e.field.isComposite)) {
@@ -121,8 +117,7 @@ class CollectionController {
121
117
  }
122
118
  }))
123
119
  .subscribe(async () => {
124
- var _a;
125
- if (collection.modified && ((_a = this._collectionGroup) === null || _a === void 0 ? void 0 : _a.collection) === collection) {
120
+ if (collection.modified && this._collection === collection) {
126
121
  console.debug('[CollectionController] saving modified collection', collection);
127
122
  await this.save();
128
123
  }
@@ -140,6 +135,7 @@ class CollectionController {
140
135
  this.raiseEvent('collection.changed');
141
136
  }
142
137
  async load(target, forced = false) {
138
+ var _a;
143
139
  // skip if target is the same
144
140
  if (!forced && core_1.CollectionTarget.equals(this._target, target)) {
145
141
  return;
@@ -150,14 +146,14 @@ class CollectionController {
150
146
  this.state = this._state === 'uninitialized'
151
147
  ? 'initializing'
152
148
  : 'loading';
153
- // try to fetch new page
149
+ // try to fetch collection
154
150
  try {
155
- // load summary/page
156
- const collectionGroup = await this.repository.load(Object.assign(Object.assign({}, target), { eventBus: this._eventBus }));
157
- console.debug('[CollectionController] loaded', collectionGroup);
151
+ // load summary/collection
152
+ const { group, collection } = (_a = await this.repository.load(Object.assign(Object.assign({}, target), { eventBus: this._eventBus }))) !== null && _a !== void 0 ? _a : {};
153
+ console.debug('[CollectionController] loaded', group);
158
154
  // (re)bind group
159
- this._collectionGroup = collectionGroup;
160
- this.collection = collectionGroup === null || collectionGroup === void 0 ? void 0 : collectionGroup.collection;
155
+ this._collectionGroup = group;
156
+ this.collection = collection;
161
157
  // update state
162
158
  this.state = 'ready';
163
159
  }
@@ -192,7 +188,7 @@ class CollectionController {
192
188
  // create language in existing group
193
189
  const eventBus = this._eventBus;
194
190
  const { template, language } = target;
195
- const result = await this.repository.createLanguage({
191
+ const { group, collection } = await this.repository.createLanguage({
196
192
  eventBus,
197
193
  language,
198
194
  template,
@@ -200,10 +196,10 @@ class CollectionController {
200
196
  type: existingGroup.template.type,
201
197
  version: 1
202
198
  });
203
- console.debug('[CollectionController] created', result);
199
+ console.debug('[CollectionController] created', group);
204
200
  // (re)bind data
205
- this.collectionGroup = result;
206
- this.collection = result.collection;
201
+ this.collectionGroup = group;
202
+ this.collection = collection;
207
203
  // update state
208
204
  this.state = 'ready';
209
205
  }
@@ -299,22 +295,7 @@ class CollectionController {
299
295
  }
300
296
  }
301
297
  raiseEvent(type) {
302
- this._eventBus.publish(CollectionController.Event.create({ type, controller: this }));
298
+ this._eventBus.publish(ICollectionController_1.ICollectionController.Event.create({ type, controller: this }));
303
299
  }
304
300
  }
305
301
  exports.CollectionController = CollectionController;
306
- // extension
307
- (function (CollectionController) {
308
- let Event;
309
- (function (Event) {
310
- // methods
311
- function filter(event) {
312
- return event.domain === 'CollectionController';
313
- }
314
- Event.filter = filter;
315
- function create(event) {
316
- return funnel_core_1.EventBus.createEvent(Object.assign({ domain: 'CollectionController' }, event));
317
- }
318
- Event.create = create;
319
- })(Event = CollectionController.Event || (CollectionController.Event = {}));
320
- })(CollectionController || (exports.CollectionController = CollectionController = {}));
@@ -0,0 +1,24 @@
1
+ import { EventBus, Language } from '@nascentdigital/funnel-core';
2
+ import type { Observable } from 'rxjs';
3
+ import type { CollectionGroup, CollectionTarget, ICollection } from '../../core';
4
+ export interface ICollectionController {
5
+ readonly state: ICollectionController.State;
6
+ readonly events$: Observable<ICollectionController.Event | ICollection.Event>;
7
+ readonly collection: ICollection | undefined;
8
+ readonly collectionGroup: CollectionGroup | undefined;
9
+ readonly languages: ReadonlyArray<Language>;
10
+ createLanguage(target: CollectionTarget): Promise<void>;
11
+ unpublish(): Promise<void>;
12
+ reload(): Promise<void>;
13
+ }
14
+ export declare namespace ICollectionController {
15
+ type State = 'uninitialized' | 'initializing' | 'loading' | 'ready' | 'saving' | 'unpublishing' | 'error';
16
+ interface Event extends EventBus.Event<'CollectionController', Event.Type> {
17
+ controller: ICollectionController;
18
+ }
19
+ namespace Event {
20
+ type Type = 'state.changed' | 'collection.changed' | 'collectionGroup.changed';
21
+ function filter(event: EventBus.Event): event is Event;
22
+ function create(event: EventBus.Args<Event>): Event;
23
+ }
24
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ICollectionController = void 0;
4
+ const funnel_core_1 = require("@nascentdigital/funnel-core");
5
+ // extension
6
+ var ICollectionController;
7
+ (function (ICollectionController) {
8
+ let Event;
9
+ (function (Event) {
10
+ // methods
11
+ function filter(event) {
12
+ return event.domain === 'CollectionController';
13
+ }
14
+ Event.filter = filter;
15
+ function create(event) {
16
+ return funnel_core_1.EventBus.createEvent(Object.assign({ domain: 'CollectionController' }, event));
17
+ }
18
+ Event.create = create;
19
+ })(Event = ICollectionController.Event || (ICollectionController.Event = {}));
20
+ })(ICollectionController || (exports.ICollectionController = ICollectionController = {}));
@@ -1,2 +1,3 @@
1
1
  export * from './CollectionController';
2
+ export * from './ICollectionController';
2
3
  export * from './useCollectionController';
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./CollectionController"), exports);
18
+ __exportStar(require("./ICollectionController"), exports);
18
19
  __exportStar(require("./useCollectionController"), exports);
@@ -1,8 +1,8 @@
1
- import { CollectionController } from './CollectionController';
2
- export declare function useCollectionController(collectionController?: CollectionController): CollectionController;
1
+ import { ICollectionController } from './ICollectionController';
2
+ export declare function useCollectionController(collectionController?: ICollectionController): ICollectionController;
3
3
  export declare const CollectionControllerContext: import("react").Context<CollectionControllerContext.Type>;
4
4
  export declare namespace CollectionControllerContext {
5
5
  type Type = {
6
- controller: CollectionController;
6
+ controller: ICollectionController;
7
7
  };
8
8
  }
@@ -52,7 +52,7 @@ function CollectionEditor({ type, groupId, language }) {
52
52
  await router.navigateToCollectionItems({ type });
53
53
  };
54
54
  // render
55
- return ((0, jsx_runtime_1.jsx)(hooks_1.CollectionControllerContext.Provider, { value: controllerContext, children: (0, jsx_runtime_1.jsx)(core_1.CollectionContext.Provider, { value: collectionContext, children: (0, jsx_runtime_1.jsx)(core_1.AssetStoreContext.Provider, { value: collection, children: (0, jsx_runtime_1.jsx)(core_1.CollectionStoreContext.Provider, { value: collection, children: (0, jsx_runtime_1.jsx)(core_1.PageRefStoreContext.Provider, { value: pageRefStoreProxy, children: (0, jsx_runtime_1.jsxs)("div", { className: "w-dvw h-dvh flex flex-col bg-background", children: [(0, jsx_runtime_1.jsx)(components_1.CollectionHeader, { target: target, onBack: onHeaderBack }), (0, jsx_runtime_1.jsx)("div", { className: "relative flex-1", children: (0, jsx_runtime_1.jsxs)("div", { className: "absolute inset-0 flex", children: [(0, jsx_runtime_1.jsx)("section", { className: "w-[220px] lg:w-[240px] xl:w-[280px] shrink-0 overflow-y-scroll scrollbar-thin" }), (0, jsx_runtime_1.jsx)("section", { className: "flex-1 h-full max-h-full max-w-[1000px] mx-auto", children: (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { mode: "wait", initial: false, children: renderContent({ target, controller }) }) }), (0, jsx_runtime_1.jsx)("section", { className: "hidden lg:block lg:w-[320px] shrink-0 overflow-y-scroll scrollbar-thin", children: (0, jsx_runtime_1.jsx)(components_1.CollectionStatus, {}) })] }) })] }) }) }) }) }) }));
55
+ return ((0, jsx_runtime_1.jsx)(hooks_1.CollectionControllerContext.Provider, { value: controllerContext, children: (0, jsx_runtime_1.jsx)(core_1.CollectionContext.Provider, { value: collectionContext, children: (0, jsx_runtime_1.jsx)(core_1.AssetStoreContext.Provider, { value: collection, children: (0, jsx_runtime_1.jsx)(core_1.CollectionStoreContext.Provider, { value: collection, children: (0, jsx_runtime_1.jsx)(core_1.PageRefStoreContext.Provider, { value: pageRefStoreProxy, children: (0, jsx_runtime_1.jsxs)("div", { className: "w-dvw h-dvh flex flex-col bg-background", children: [(0, jsx_runtime_1.jsx)(components_1.CollectionHeader, { target: target, onBack: onHeaderBack }), (0, jsx_runtime_1.jsx)("div", { className: "relative flex-1", children: (0, jsx_runtime_1.jsxs)("div", { className: "absolute inset-0 flex", children: [(0, jsx_runtime_1.jsx)("section", { className: "w-[220px] lg:w-[240px] xl:w-[280px] shrink-0 overflow-y-scroll scrollbar-thin", tabIndex: -1 }), (0, jsx_runtime_1.jsx)("section", { className: "flex-1 h-full max-h-full max-w-[1000px] mx-auto", children: (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { mode: "wait", initial: false, children: renderContent({ target, controller }) }) }), (0, jsx_runtime_1.jsx)("section", { className: "hidden lg:block lg:w-[320px] shrink-0 overflow-y-scroll scrollbar-thin", tabIndex: -1, children: (0, jsx_runtime_1.jsx)(components_1.CollectionStatus, {}) })] }) })] }) }) }) }) }) }));
56
56
  }
57
57
  function renderContent({ target, controller }) {
58
58
  // render loader if not ready
@@ -70,7 +70,7 @@ function renderContent({ target, controller }) {
70
70
  }
71
71
  // otherwise, render editor
72
72
  else {
73
- return ((0, jsx_runtime_1.jsxs)(core_1.FadeIn, { className: "h-full max-h-full flex flex-col gap-l10 py-l10", children: [(0, jsx_runtime_1.jsx)(core_1.FieldsPanel, { title: "Content", className: "px-l6", fields: [collection.nameField, ...collection.fields] }), collection.tagGroups.length > 0 &&
73
+ return ((0, jsx_runtime_1.jsxs)(core_1.FadeIn, { className: "flex-1 flex flex-col gap-l10 px-l6 py-l10 overflow-y-scroll scrollbar-thin bg-background", children: [(0, jsx_runtime_1.jsx)(core_1.FieldsPanel, { title: "Content", fields: [collection.nameField, ...collection.fields] }), collection.tagGroups.length > 0 &&
74
74
  (0, jsx_runtime_1.jsx)("div", { className: "px-l6", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-l8 p-l8 bg-surface1 rounded-md", children: [(0, jsx_runtime_1.jsx)("h2", { className: "display-xxs flex-1", children: "Tags" }), (0, jsx_runtime_1.jsx)(core_1.TagEditor, { className: "bg-surface2 p-l6 rounded-sm", tagged: collection })] }) })] }, "fields"));
75
75
  }
76
76
  }
@@ -0,0 +1,20 @@
1
+ import { PageNav } from './page/components/PageNav';
2
+ import { BlockEditor } from './page/components/BlockEditor';
3
+ export * from './core/app';
4
+ export * from './core/domain';
5
+ export * from './core/components';
6
+ export * from './core/hooks';
7
+ export * from './core/repository/CollectionTarget';
8
+ export * from './core/repository/FieldSerializer';
9
+ export * from './core/repository/IAssetRepository';
10
+ export * from './core/repository/ICollectionRepository';
11
+ export * from './core/repository/IPageRepository';
12
+ export * from './core/repository/PageSerializer';
13
+ export * from './core/repository/PageTarget';
14
+ export * from './core/repository/SerializeCollectionUpdate';
15
+ export * from './core/repository/SerializePageUpdate';
16
+ export * from './core/repository/TagSerializer';
17
+ export * from './page/hooks';
18
+ export * from './page/components/SettingsEditor';
19
+ export * from './collection/hooks';
20
+ export { PageNav, BlockEditor };
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.BlockEditor = exports.PageNav = void 0;
18
+ const PageNav_1 = require("./page/components/PageNav");
19
+ Object.defineProperty(exports, "PageNav", { enumerable: true, get: function () { return PageNav_1.PageNav; } });
20
+ const BlockEditor_1 = require("./page/components/BlockEditor");
21
+ Object.defineProperty(exports, "BlockEditor", { enumerable: true, get: function () { return BlockEditor_1.BlockEditor; } });
22
+ // core
23
+ __exportStar(require("./core/app"), exports);
24
+ __exportStar(require("./core/domain"), exports);
25
+ __exportStar(require("./core/components"), exports);
26
+ __exportStar(require("./core/hooks"), exports);
27
+ __exportStar(require("./core/repository/CollectionTarget"), exports);
28
+ __exportStar(require("./core/repository/FieldSerializer"), exports);
29
+ __exportStar(require("./core/repository/IAssetRepository"), exports);
30
+ __exportStar(require("./core/repository/ICollectionRepository"), exports);
31
+ __exportStar(require("./core/repository/IPageRepository"), exports);
32
+ __exportStar(require("./core/repository/PageSerializer"), exports);
33
+ __exportStar(require("./core/repository/PageTarget"), exports);
34
+ __exportStar(require("./core/repository/SerializeCollectionUpdate"), exports);
35
+ __exportStar(require("./core/repository/SerializePageUpdate"), exports);
36
+ __exportStar(require("./core/repository/TagSerializer"), exports);
37
+ // page
38
+ __exportStar(require("./page/hooks"), exports);
39
+ __exportStar(require("./page/components/SettingsEditor"), exports);
40
+ // collection
41
+ __exportStar(require("./collection/hooks"), exports);
@@ -14,5 +14,5 @@ exports.MinimalDialogLayout = (0, react_1.forwardRef)(function DialogLayout({ cl
14
14
  return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(className, 'min-w-[400px] sm:max-w-screen-sm max-h-dvh', 'flex flex-col py-l8 bg-surface1 rounded-md shadow-popup'), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-start justify-between gap-l8 px-l8", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex-1", children: [(0, jsx_runtime_1.jsx)("h1", { className: "heading-md text-content-primary", children: title }), caption &&
15
15
  (0, jsx_runtime_1.jsx)("div", { className: "body-sm text-content-secondary", children: caption })] }), (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { className: (0, classnames_1.default)('text-content-primary interpolate-slow', {
16
16
  'opacity-none pointer-events-none': !onClose,
17
- }), icon: "X", disabled: !onClose, onClick: onClose })] }), (0, jsx_runtime_1.jsx)("div", { ref: ref, className: "max-h-full flex-1 pt-l8 px-l8 overflow-x-visible overflow-y-scroll", children: children })] }));
17
+ }), icon: "X", disabled: !onClose, onClick: onClose })] }), (0, jsx_runtime_1.jsx)("div", { ref: ref, className: "max-h-full flex-1 pt-l8 px-l8 overflow-x-visible overflow-y-scroll", tabIndex: -1, children: children })] }));
18
18
  });
@@ -1,12 +1,13 @@
1
1
  import { Field, Schema } from '@nascentdigital/funnel-core';
2
2
  import { FieldLayout } from './FieldLayout';
3
3
  import { FieldSize } from './FieldSize';
4
- export declare function BooleanField({ className, field, variant, size }: BooleanField.Props): import("react/jsx-runtime").JSX.Element;
4
+ export declare function BooleanField({ className, field, variant, size, disableDelete }: BooleanField.Props): import("react/jsx-runtime").JSX.Element;
5
5
  export declare namespace BooleanField {
6
6
  type Props = {
7
7
  className?: string;
8
8
  field: Field<Schema.BooleanField>;
9
9
  variant?: FieldLayout.Variant;
10
10
  size?: FieldSize;
11
+ disableDelete?: boolean;
11
12
  };
12
13
  }
@@ -7,7 +7,7 @@ const hooks_1 = require("../../hooks");
7
7
  const interaction_1 = require("../interaction");
8
8
  const FieldLayout_1 = require("./FieldLayout");
9
9
  // component
10
- function BooleanField({ className, field, variant = 'minimal', size = 'md' }) {
10
+ function BooleanField({ className, field, variant = 'minimal', size = 'md', disableDelete }) {
11
11
  // bind toolbar
12
12
  const { id, name, value: data, schema } = field;
13
13
  const value = funnel_core_1.Schema.BooleanField.Value.fromData(data);
@@ -25,5 +25,5 @@ function BooleanField({ className, field, variant = 'minimal', size = 'md' }) {
25
25
  break;
26
26
  }
27
27
  // render
28
- return ((0, jsx_runtime_1.jsx)(FieldLayout_1.FieldLayout, { className: className, field: field, variant: variant, size: size, children: component }));
28
+ return ((0, jsx_runtime_1.jsx)(FieldLayout_1.FieldLayout, { className: className, field: field, variant: variant, size: size, disableDelete: disableDelete, children: component }));
29
29
  }
@@ -1,12 +1,13 @@
1
1
  import { Field, Schema } from '@nascentdigital/funnel-core';
2
2
  import { FieldLayout } from './FieldLayout';
3
3
  import { FieldSize } from './FieldSize';
4
- export declare function DateField({ className, field, variant, size }: DateField.Props): import("react/jsx-runtime").JSX.Element;
4
+ export declare function DateField({ className, field, variant, size, disableDelete }: DateField.Props): import("react/jsx-runtime").JSX.Element;
5
5
  export declare namespace DateField {
6
6
  type Props = {
7
7
  className?: string;
8
8
  field: Field<Schema.DateField>;
9
9
  variant?: FieldLayout.Variant;
10
10
  size?: FieldSize;
11
+ disableDelete?: boolean;
11
12
  };
12
13
  }
@@ -7,12 +7,12 @@ const hooks_1 = require("../../hooks");
7
7
  const interaction_1 = require("../interaction");
8
8
  const FieldLayout_1 = require("./FieldLayout");
9
9
  // component
10
- function DateField({ className, field, variant, size = 'md' }) {
10
+ function DateField({ className, field, variant, size = 'md', disableDelete }) {
11
11
  // bind toolbar
12
12
  const { id, name, value: data, schema } = field;
13
13
  const value = funnel_core_1.Schema.DateField.Value.fromData(data);
14
14
  // sync field
15
15
  (0, hooks_1.useField)(field);
16
16
  // render
17
- return ((0, jsx_runtime_1.jsx)(FieldLayout_1.FieldLayout, { className: className, field: field, variant: variant, size: size, children: (0, jsx_runtime_1.jsx)(interaction_1.DatePicker, { minDate: schema.minDate, maxDate: schema.maxDate, selected: value, onChange: value => field.value = value && funnel_core_1.Schema.DateField.Value.toData(value) }) }));
17
+ return ((0, jsx_runtime_1.jsx)(FieldLayout_1.FieldLayout, { className: className, field: field, variant: variant, size: size, disableDelete: disableDelete, children: (0, jsx_runtime_1.jsx)(interaction_1.DatePicker, { minDate: schema.minDate, maxDate: schema.maxDate, selected: value, onChange: value => field.value = value && funnel_core_1.Schema.DateField.Value.toData(value) }) }));
18
18
  }
@@ -1,9 +1,10 @@
1
1
  import { Field, Schema } from '@nascentdigital/funnel-core';
2
- export declare function DynamicPagesEditor({ className, dynamicPages }: DynamicPagesEditor.Props): import("react/jsx-runtime").JSX.Element;
2
+ export declare function DynamicPagesEditor({ className, dynamicPages, disableDelete }: DynamicPagesEditor.Props): import("react/jsx-runtime").JSX.Element;
3
3
  export declare namespace DynamicPagesEditor {
4
4
  type Props = {
5
5
  className?: string;
6
6
  dynamicPages: Field<Schema.DynamicPagesField>;
7
+ disableDelete?: boolean;
7
8
  };
8
9
  type ItemData = Schema.Field.Data<Schema.PageField<'preview'>> & {
9
10
  id: string;
@@ -14,7 +14,7 @@ const interaction_1 = require("../interaction");
14
14
  const dynamicPages_1 = require("./dynamicPages");
15
15
  const page_1 = require("./page");
16
16
  // component
17
- function DynamicPagesEditor({ className, dynamicPages }) {
17
+ function DynamicPagesEditor({ className, dynamicPages, disableDelete }) {
18
18
  var _a, _b;
19
19
  // get language and region
20
20
  const page = (0, hooks_1.usePage)();
@@ -1,7 +1,7 @@
1
1
  import { Field, Schema } from '@nascentdigital/funnel-core';
2
2
  import { FieldLayout } from './FieldLayout';
3
3
  import { FieldSize } from './FieldSize';
4
- export declare function EnumField({ className, field, variant, size, disabled }: EnumField.Props): import("react/jsx-runtime").JSX.Element;
4
+ export declare function EnumField({ className, field, variant, size, disabled, disableDelete }: EnumField.Props): import("react/jsx-runtime").JSX.Element;
5
5
  export declare namespace EnumField {
6
6
  type Props = {
7
7
  className?: string;
@@ -9,5 +9,6 @@ export declare namespace EnumField {
9
9
  variant?: FieldLayout.Variant;
10
10
  size?: FieldSize;
11
11
  disabled?: boolean;
12
+ disableDelete?: boolean;
12
13
  };
13
14
  }
@@ -11,7 +11,7 @@ const hooks_1 = require("../../hooks");
11
11
  const interaction_1 = require("../interaction");
12
12
  const FieldLayout_1 = require("./FieldLayout");
13
13
  // component
14
- function EnumField({ className, field, variant, size = 'md', disabled }) {
14
+ function EnumField({ className, field, variant, size = 'md', disabled, disableDelete }) {
15
15
  // bind toolbar
16
16
  const { id, value: data, schema } = field;
17
17
  const value = funnel_core_1.Schema.EnumField.Value.fromData(data);
@@ -30,7 +30,7 @@ function EnumField({ className, field, variant, size = 'md', disabled }) {
30
30
  throw new funnel_core_1.NotImplementedError('No support for EnumField with "radio" semantics');
31
31
  }
32
32
  // render
33
- return ((0, jsx_runtime_1.jsx)(FieldLayout_1.FieldLayout, { className: (0, classnames_1.default)(className, 'w-full'), field: field, variant: variant, size: size, children: picker }));
33
+ return ((0, jsx_runtime_1.jsx)(FieldLayout_1.FieldLayout, { className: (0, classnames_1.default)(className, 'w-full'), field: field, variant: variant, size: size, disableDelete: disableDelete, children: picker }));
34
34
  }
35
35
  // helper
36
36
  function getComboboxOptions(schema) {
@@ -7,6 +7,7 @@ export declare namespace FieldCard {
7
7
  deletable?: boolean;
8
8
  selecting?: boolean;
9
9
  embedded?: boolean;
10
+ required?: boolean;
10
11
  onDelete?: Callback<Field | ObjectField>;
11
12
  onEditing?: Callback<boolean>;
12
13
  };
@@ -13,10 +13,12 @@ var __rest = (this && this.__rest) || function (s, e) {
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.FieldCard = FieldCard;
15
15
  const jsx_runtime_1 = require("react/jsx-runtime");
16
+ const funnel_ui_1 = require("@nascentdigital/funnel-ui");
16
17
  const asset_1 = require("./asset");
17
18
  const collection_1 = require("./collection");
18
19
  const embed_1 = require("./embed");
19
20
  const link_1 = require("./link");
21
+ const media_1 = require("./media");
20
22
  const object_1 = require("./object");
21
23
  const page_1 = require("./page");
22
24
  // component
@@ -35,7 +37,12 @@ function FieldCard(_a) {
35
37
  case 'page':
36
38
  return ((0, jsx_runtime_1.jsx)(page_1.PageCard, Object.assign({}, props, { field: field })));
37
39
  case 'collection':
38
- return ((0, jsx_runtime_1.jsx)(collection_1.CollectionCard, Object.assign({}, props, { field: field })));
40
+ if (field.schema.type === funnel_ui_1.Media.schema.type) {
41
+ return ((0, jsx_runtime_1.jsx)(media_1.MediaCard, Object.assign({}, props, { field: field })));
42
+ }
43
+ else {
44
+ return ((0, jsx_runtime_1.jsx)(collection_1.CollectionCard, Object.assign({}, props, { field: field })));
45
+ }
39
46
  case 'object':
40
47
  return ((0, jsx_runtime_1.jsx)(object_1.ObjectCard, Object.assign({}, props, { field: field })));
41
48
  default:
@@ -1,7 +1,7 @@
1
1
  import { Callback, FieldModel } from '@nascentdigital/funnel-core';
2
2
  import { FieldLayout } from './FieldLayout';
3
3
  import { FieldSize } from './FieldSize';
4
- export declare function FieldEditor({ className, field, variant, size, standalone, autoFocus: autoFocusRaw, disabled, secured, onValidChanged }: FieldEditor.Props): import("react/jsx-runtime").JSX.Element;
4
+ export declare function FieldEditor({ className, field, variant, size, standalone, autoFocus: autoFocusRaw, disabled, secured, disableDelete, onValidChanged }: FieldEditor.Props): import("react/jsx-runtime").JSX.Element;
5
5
  export declare namespace FieldEditor {
6
6
  type Props = {
7
7
  className?: string;
@@ -12,6 +12,7 @@ export declare namespace FieldEditor {
12
12
  autoFocus?: boolean;
13
13
  secured?: boolean;
14
14
  disabled?: boolean;
15
+ disableDelete?: boolean;
15
16
  onValidChanged?: Callback<boolean>;
16
17
  };
17
18
  }