@nascentdigital/funnel-editor 5.0.2 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/collection/hooks/CollectionController.d.ts +7 -2
  2. package/dist/collection/hooks/CollectionController.js +2 -2
  3. package/dist/collection/screens/CollectionEditor.js +5 -4
  4. package/dist/components.d.ts +4 -1
  5. package/dist/components.js +5 -1
  6. package/dist/core/client/EditorApiClient.js +1 -1
  7. package/dist/core/components/fields/page/PagePicker.js +1 -1
  8. package/dist/core/components/interaction/Popup.js +23 -11
  9. package/dist/core/components/layout/InfoPanel.js +1 -1
  10. package/dist/core/components/visuals/Icon.d.ts +1 -1
  11. package/dist/core/components/visuals/Icon.js +3 -0
  12. package/dist/core/domain/IPage.d.ts +13 -14
  13. package/dist/core/domain/IPage.js +30 -0
  14. package/dist/core/domain/Page.d.ts +3 -5
  15. package/dist/core/domain/Page.js +8 -1
  16. package/dist/core/domain/PageOverview.d.ts +6 -0
  17. package/dist/core/domain/PageOverview.js +17 -0
  18. package/dist/core/domain/PageRefStoreProxy.d.ts +4 -6
  19. package/dist/core/domain/PageRefStoreProxy.js +16 -50
  20. package/dist/core/domain/PageStatus.d.ts +28 -0
  21. package/dist/core/domain/PageStatus.js +2 -0
  22. package/dist/core/domain/PageSummary.d.ts +9 -7
  23. package/dist/core/domain/PageSummary.js +12 -16
  24. package/dist/core/domain/Pages.js +1 -4
  25. package/dist/core/domain/Section.js +2 -2
  26. package/dist/core/domain/index.d.ts +1 -0
  27. package/dist/core/domain/index.js +1 -0
  28. package/dist/core/repository/IPageRepository.d.ts +5 -1
  29. package/dist/core/repository/PageRepository.d.ts +1 -0
  30. package/dist/core/repository/PageRepository.js +14 -5
  31. package/dist/explore/components/CreateCollectionDialog.js +1 -1
  32. package/dist/explore/screens/PageExplorer.js +2 -1
  33. package/dist/page/components/BlockEditor.d.ts +3 -1
  34. package/dist/page/components/BlockEditor.js +4 -3
  35. package/dist/page/components/config/BlockConfigurationProvider.d.ts +10 -2
  36. package/dist/page/components/config/BlockConfigurationProvider.js +11 -3
  37. package/dist/page/components/config/BlockPreview.d.ts +4 -2
  38. package/dist/page/components/config/BlockPreview.js +5 -11
  39. package/dist/page/components/config/index.d.ts +1 -0
  40. package/dist/page/components/config/index.js +1 -0
  41. package/dist/page/components/config/useBlockConfiguration$.d.ts +3 -0
  42. package/dist/page/components/config/useBlockConfiguration$.js +22 -0
  43. package/dist/page/components/panels/BlockConfigPanel.js +3 -3
  44. package/dist/page/hooks/PageController.d.ts +3 -3
  45. package/dist/page/hooks/PageController.js +4 -3
  46. package/dist/page/screens/PageEditor.js +4 -4
  47. package/dist/styles/index.css +40 -19
  48. package/dist/styles/tailwind.js +2 -1
  49. package/package.json +3 -3
@@ -4,7 +4,6 @@ export declare class PageSummary {
4
4
  readonly template: Schema.Page;
5
5
  readonly brand: string;
6
6
  readonly groupId: Schema.Page.GroupId;
7
- readonly region: string;
8
7
  readonly slug?: string;
9
8
  readonly pages: ReadonlyArray<PageSummary.PageRef>;
10
9
  readonly status: PageSummary.Status;
@@ -12,10 +11,10 @@ export declare class PageSummary {
12
11
  get type(): Schema.Page.Type;
13
12
  get variant(): Schema.Page.Variant;
14
13
  get hasPages(): boolean;
15
- hasLanguage(language: Language): boolean;
16
- getPage(language: Language): PageSummary.PageRef | undefined;
17
- getClosestPageRef(language: Language, fallback?: Language): IPage.Ref;
18
- isInGroup({ template, region }: PageSummary.IsInGroupArgs): boolean;
14
+ hasLanguage(region: string, language: Language): boolean;
15
+ getPage(region: string, language: Language): PageSummary.PageRef | undefined;
16
+ getClosestPageRef({ region, language, fallbackLanguage }: PageSummary.GetClosestPageRefArgs): IPage.Ref;
17
+ isInGroup({ template }: PageSummary.IsInGroupArgs): boolean;
19
18
  }
20
19
  export declare namespace PageSummary {
21
20
  type Status = 'draft' | 'ready' | 'live' | 'unpublished' | 'changed' | 'empty';
@@ -23,13 +22,16 @@ export declare namespace PageSummary {
23
22
  template: Schema.Page;
24
23
  brand: string;
25
24
  groupId: Schema.Page.GroupId;
26
- region: string;
27
25
  slug?: string;
28
26
  pages: PageSummary.PageRef[];
29
27
  };
30
28
  type PageRef = Schema.Page.Data.AsGroup.Instance & Pick<Schema.Page.Data.AsLink, 'state' | 'errors' | 'createdOn' | 'updatedOn' | 'publishedOn'>;
29
+ type GetClosestPageRefArgs = {
30
+ region: string;
31
+ language: Language;
32
+ fallbackLanguage?: Language;
33
+ };
31
34
  type IsInGroupArgs = {
32
35
  template: Schema.Page;
33
- region: string;
34
36
  };
35
37
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PageSummary = void 0;
4
4
  const funnel_core_1 = require("@nascentdigital/funnel-core");
5
+ const IPage_1 = require("./IPage");
5
6
  // class
6
7
  class PageSummary {
7
8
  constructor(args) {
@@ -9,7 +10,6 @@ class PageSummary {
9
10
  this.template = args.template;
10
11
  this.brand = args.brand;
11
12
  this.groupId = args.groupId;
12
- this.region = args.region;
13
13
  this.slug = args.slug;
14
14
  this.pages = args.pages;
15
15
  this.status = getStatus(args.pages);
@@ -23,24 +23,20 @@ class PageSummary {
23
23
  get hasPages() {
24
24
  return this.groupId !== funnel_core_1.Schema.Page.GroupId.empty;
25
25
  }
26
- hasLanguage(language) {
27
- return this.pages.some(page => page.language === language);
26
+ hasLanguage(region, language) {
27
+ return this.pages.some(page => page.region === region && page.language === language);
28
28
  }
29
- getPage(language) {
30
- return this.pages.find(page => page.language === language);
29
+ getPage(region, language) {
30
+ return this.pages.find(page => page.region === region && page.language === language);
31
31
  }
32
- getClosestPageRef(language, fallback) {
33
- var _a, _b;
34
- const { template, brand, groupId, region, pages } = this;
35
- const ref = (_b = (_a = pages.find(page => page.language === language)) !== null && _a !== void 0 ? _a : (fallback && pages.find(page => page.language === fallback))) !== null && _b !== void 0 ? _b : pages[0];
36
- return Object.assign(Object.assign({}, ref), { template,
37
- brand,
38
- groupId,
39
- region, tags: template.tags.flatMap(tagGroup => tagGroup.parse(ref.tags)) });
32
+ getClosestPageRef({ region, language, fallbackLanguage }) {
33
+ var _a, _b, _c, _d, _e;
34
+ const { template, brand, groupId, pages } = this;
35
+ const ref = (_e = (_d = (_c = (_b = (_a = pages.find(page => page.region === region && page.language === language)) !== null && _a !== void 0 ? _a : (fallbackLanguage && pages.find(page => page.region === region && page.language === fallbackLanguage))) !== null && _b !== void 0 ? _b : pages.find(page => page.language === language)) !== null && _c !== void 0 ? _c : (fallbackLanguage && pages.find(page => page.language === fallbackLanguage))) !== null && _d !== void 0 ? _d : pages.find(page => page.region === region)) !== null && _e !== void 0 ? _e : pages[0];
36
+ return IPage_1.IPage.Ref.fromData(Object.assign(Object.assign({}, ref), { groupId, type: template.type, brand }));
40
37
  }
41
- isInGroup({ template, region }) {
42
- return this.template.type === template.type
43
- && this.region === region;
38
+ isInGroup({ template }) {
39
+ return this.template.type === template.type;
44
40
  }
45
41
  }
46
42
  exports.PageSummary = PageSummary;
@@ -57,14 +57,11 @@ class Pages {
57
57
  : 'syncing';
58
58
  // load all pages for the region
59
59
  const { site, template, pageType, tags } = this;
60
- const { region } = site;
61
60
  const { items: pages } = await site.repository.search({
62
61
  template,
63
- region: region.id,
64
62
  tags: tags.map(tag => tag.data),
65
63
  pagination: 'all'
66
64
  });
67
- console.debug(`[PageCollection/sync] fetched ${pages.length} "${pageType}" pages`);
68
65
  // group/convert the pages into summaries
69
66
  const itemsArgs = [];
70
67
  const itemsArgsMap = new Map();
@@ -77,7 +74,6 @@ class Pages {
77
74
  template,
78
75
  brand: page.brand,
79
76
  groupId: page.groupId,
80
- region: region.id,
81
77
  slug: page.slug,
82
78
  pages: []
83
79
  };
@@ -88,6 +84,7 @@ class Pages {
88
84
  // add page to args
89
85
  args.pages.push({
90
86
  id: page.id,
87
+ region: page.region,
91
88
  language: page.language,
92
89
  slug: page.slug,
93
90
  name: page.name,
@@ -29,9 +29,9 @@ class Section extends ItemBase_1.ItemBase {
29
29
  .map(key => availableBlocks.find(block => block.key === key))
30
30
  .filter(funnel_core_1.Value.isDefined)
31
31
  .map(SectionBlock_1.SectionBlock.for);
32
- // mark as activated
33
- this.activated = true;
34
32
  }
33
+ // mark as activated
34
+ this.activated = true;
35
35
  }
36
36
  get identifier() {
37
37
  return this.key;
@@ -20,6 +20,7 @@ export * from './Page';
20
20
  export * from './PageOverview';
21
21
  export * from './PageRefStoreProxy';
22
22
  export * from './PageSettings';
23
+ export * from './PageStatus';
23
24
  export * from './PageSummary';
24
25
  export * from './Pages';
25
26
  export * from './Section';
@@ -36,6 +36,7 @@ __exportStar(require("./Page"), exports);
36
36
  __exportStar(require("./PageOverview"), exports);
37
37
  __exportStar(require("./PageRefStoreProxy"), exports);
38
38
  __exportStar(require("./PageSettings"), exports);
39
+ __exportStar(require("./PageStatus"), exports);
39
40
  __exportStar(require("./PageSummary"), exports);
40
41
  __exportStar(require("./Pages"), exports);
41
42
  __exportStar(require("./Section"), exports);
@@ -8,12 +8,12 @@ export interface IPageRepository {
8
8
  save(page: IPage): Promise<IPage>;
9
9
  unpublish(page: IPage): Promise<void>;
10
10
  getOverview(args: IPageRepository.GetOverview.Args): Promise<IPageRepository.GetOverview.Result>;
11
+ getSummaries(args: IPageRepository.GetSummaries.Args): Promise<IPageRepository.GetSummaries.Result>;
11
12
  }
12
13
  export declare namespace IPageRepository {
13
14
  namespace Search {
14
15
  type Args = Omit<PageClient.Search.Args, 'version' | 'brand' | 'type' | 'region'> & {
15
16
  template: Schema.Page;
16
- region: string;
17
17
  };
18
18
  type Result = Pagination.Paginated<IPage.Ref>;
19
19
  }
@@ -37,4 +37,8 @@ export declare namespace IPageRepository {
37
37
  };
38
38
  type Result = PageOverview[];
39
39
  }
40
+ namespace GetSummaries {
41
+ type Args = Omit<PageClient.GetSummaries.Args, 'brand'>;
42
+ type Result = IPage.Ref[];
43
+ }
40
44
  }
@@ -14,6 +14,7 @@ export declare class PageRepository implements IPageRepository {
14
14
  save(page: Page): Promise<Page>;
15
15
  unpublish(page: Page): Promise<void>;
16
16
  getOverview(args: IPageRepository.GetOverview.Args): Promise<IPageRepository.GetOverview.Result>;
17
+ getSummaries(args: IPageRepository.GetSummaries.Args): Promise<IPageRepository.GetSummaries.Result>;
17
18
  private serializePageUpdate;
18
19
  }
19
20
  export declare namespace PageRepository {
@@ -23,14 +23,13 @@ class PageRepository {
23
23
  }
24
24
  async search(args) {
25
25
  // query pages
26
- const { template, region } = args, query = __rest(args, ["template", "region"]);
27
- const _a = await this.editorApi.searchPages(Object.assign(Object.assign({}, query), { version: 'draft', brand: funnel_core_1.AppConfig.brand(), region, type: template.type })), { items } = _a, pagination = __rest(_a, ["items"]);
26
+ const { template } = args, query = __rest(args, ["template"]);
27
+ const _a = await this.editorApi.searchPages(Object.assign(Object.assign({}, query), { version: 'draft', brand: funnel_core_1.AppConfig.brand(), type: template.type })), { items } = _a, pagination = __rest(_a, ["items"]);
28
28
  // return result
29
29
  return Object.assign({ items: items.map((_a) => {
30
30
  var _b;
31
31
  var { tags } = _a, item = __rest(_a, ["tags"]);
32
- return (Object.assign(Object.assign({}, item), { template,
33
- region, name: (_b = item.name) !== null && _b !== void 0 ? _b : `Unnamed ${template.name} page`, tags: template.tags.flatMap(tagGroup => tagGroup.parse(tags)) }));
32
+ return (Object.assign(Object.assign({}, item), { template, name: (_b = item.name) !== null && _b !== void 0 ? _b : `Unnamed ${template.name} page`, tags: template.tags.flatMap(tagGroup => tagGroup.parse(tags)) }));
34
33
  }) }, pagination);
35
34
  }
36
35
  async load(args) {
@@ -57,7 +56,7 @@ class PageRepository {
57
56
  const { eventBus, template } = args, query = __rest(args, ["eventBus", "template"]);
58
57
  const data = await this.editorApi.createPage(Object.assign(Object.assign({}, query), { type: template.type }));
59
58
  // return page
60
- return PageSerializer_1.PageSerializer.deserializePageWithSummary(Object.assign(Object.assign({ region: data.group.region }, args), data));
59
+ return PageSerializer_1.PageSerializer.deserializePageWithSummary(Object.assign(Object.assign({}, args), data));
61
60
  }
62
61
  async save(page) {
63
62
  // get page update
@@ -95,6 +94,16 @@ class PageRepository {
95
94
  async getOverview(args) {
96
95
  return this.editorApi.getPagesOverview(Object.assign(Object.assign({}, args), { version: 'draft' }));
97
96
  }
97
+ async getSummaries(args) {
98
+ // fetch page summaries
99
+ const summaries = await this.editorApi.getPageSummaries(args);
100
+ // return as page ref
101
+ return summaries.map(summary => {
102
+ var _a;
103
+ const template = funnel_core_1.Schema.Site.getPage(summary.type, summary.region);
104
+ return Object.assign(Object.assign({}, summary), { template, tags: template.parseTags((_a = summary.tags) !== null && _a !== void 0 ? _a : []) });
105
+ });
106
+ }
98
107
  serializePageUpdate(page, savables) {
99
108
  var _a, _b;
100
109
  // root page updates
@@ -114,7 +114,7 @@ exports.CreateCollectionDialog = (0, react_1.forwardRef)(function CreateCollecti
114
114
  return null;
115
115
  }
116
116
  // render
117
- return ((0, jsx_runtime_1.jsxs)(core_1.MiniEditor, { className: "flex flex-col gap-l8", title: `Create new ${(_d = collectionBrowser.template.name) !== null && _d !== void 0 ? _d : 'collection'}`, open: result === undefined, anchor: anchor, anchorOffset: 4, placement: "bottom-end", renderSaveLabel: state => state === 'saving' ? 'Creating...' : 'Create', canSave: onValidate, onSave: onCreate, onClose: onCancel, onClosed: onClosed, children: [(0, jsx_runtime_1.jsx)(core_1.ErrorMessage, { error: error }), (0, jsx_runtime_1.jsxs)(core_1.FieldErrorController, { errorLevel: errorLevel, children: [(0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: nameField, autoFocus: true }), multiLanguage &&
117
+ return ((0, jsx_runtime_1.jsxs)(core_1.MiniEditor, { className: "flex flex-col gap-l8", title: `Create new ${(_d = collectionBrowser.template.name) !== null && _d !== void 0 ? _d : 'collection'}`, open: result === undefined, anchor: anchor, anchorOffset: 4, placement: "left", renderSaveLabel: state => state === 'saving' ? 'Creating...' : 'Create', canSave: onValidate, onSave: onCreate, onClose: onCancel, onClosed: onClosed, children: [(0, jsx_runtime_1.jsx)(core_1.ErrorMessage, { error: error }), (0, jsx_runtime_1.jsxs)(core_1.FieldErrorController, { errorLevel: errorLevel, children: [(0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: nameField, autoFocus: true }), multiLanguage &&
118
118
  (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: languageField })] })] }));
119
119
  });
120
120
  function getLanguageOptions(collectionBrowser) {
@@ -72,9 +72,10 @@ function renderPages({ template, groupedPages, onCreatePage, onOpenPage }) {
72
72
  }
73
73
  function groupPages(site, summaries) {
74
74
  // group pages
75
+ const { region: { id: region }, defaultLanguage: language } = site;
75
76
  const groupedPages = summaries
76
77
  // enrich summaries with links
77
- .map(summary => ({ summary, link: summary.getClosestPageRef(site.defaultLanguage) }))
78
+ .map(summary => ({ summary, link: summary.getClosestPageRef({ region, language }) }))
78
79
  // group summaries based on status
79
80
  .reduce((groupedPages, linkedSummary) => {
80
81
  // bind page to group (drop empty pages groups, which shouldn't occur)
@@ -1,10 +1,12 @@
1
1
  import { Callback } from '@nascentdigital/funnel-core';
2
+ import { ReactNode } from 'react';
2
3
  import { Block, PageSettings, Section, SectionBlock } from '../../core';
3
- export declare function BlockEditor({ className, block, onSelectItem }: BlockEditor.Props): import("react/jsx-runtime").JSX.Element | null;
4
+ export declare function BlockEditor({ className, block, headerActions, onSelectItem }: BlockEditor.Props): import("react/jsx-runtime").JSX.Element | null;
4
5
  export declare namespace BlockEditor {
5
6
  type Props = {
6
7
  className?: string;
7
8
  block: Block | SectionBlock;
9
+ headerActions?: ReactNode;
8
10
  onSelectItem: Callback<Block | SectionBlock | Section | PageSettings>;
9
11
  };
10
12
  }
@@ -10,8 +10,9 @@ const react_1 = require("react");
10
10
  const core_1 = require("../../core");
11
11
  const config_1 = require("./config");
12
12
  // component
13
- function BlockEditor({ className, block, onSelectItem }) {
13
+ function BlockEditor({ className, block, headerActions, onSelectItem }) {
14
14
  // bind props + hooks
15
+ const page = (0, core_1.usePage)();
15
16
  const dialog = (0, core_1.useDialog)();
16
17
  const menu = (0, core_1.useMenuController)(blockMenu);
17
18
  const anchorId = (0, react_1.useId)();
@@ -58,8 +59,8 @@ function BlockEditor({ className, block, onSelectItem }) {
58
59
  };
59
60
  // render editor
60
61
  const { messageFields, visualFields, listsFields, extendedFields } = block;
61
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(className, 'max-h-full h-full flex flex-col'), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center px-l6 pt-l10 pb-l4", children: [(0, jsx_runtime_1.jsx)("h2", { className: "heading-lg flex-1", children: block.name }), (0, jsx_runtime_1.jsx)("div", { className: "shrink-0 flex items-center gap-l5", children: block.canDelete &&
62
- (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(core_1.IconButton, { anchorId: anchorId, className: "DeleteAction text-content-primary hover:text-destructive shrink-0", variant: "util", icon: "EllipsisVertical", onClick: e => menu.open(anchorId) }), (0, jsx_runtime_1.jsx)(core_1.Menu, { controller: menu, onItemClick: onMenuClick })] }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 flex flex-col gap-l8 px-l6 pb-l10 overflow-y-scroll scrollbar-thin scroller-fade-top bg-background", tabIndex: -1, children: [messageFields.length > 0 &&
62
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(className, 'max-h-full h-full flex flex-col'), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center px-l6 pt-l10 pb-l4", children: [(0, jsx_runtime_1.jsx)("h2", { className: "heading-lg flex-1", children: (0, jsx_runtime_1.jsx)("a", { href: core_1.IPage.getPreviewUrl(page.url).href, target: `${page.brand}.preview`, children: block.name }) }), (0, jsx_runtime_1.jsxs)("div", { className: "shrink-0 flex items-center gap-l5", children: [headerActions, block.canDelete &&
63
+ (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(core_1.IconButton, { anchorId: anchorId, className: "DeleteAction text-content-primary hover:text-destructive shrink-0", variant: "util", icon: "EllipsisVertical", onClick: e => menu.open(anchorId) }), (0, jsx_runtime_1.jsx)(core_1.Menu, { controller: menu, onItemClick: onMenuClick })] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 flex flex-col gap-l8 px-l6 pb-l10 overflow-y-scroll scrollbar-thin scroller-fade-top bg-background", tabIndex: -1, children: [messageFields.length > 0 &&
63
64
  (0, jsx_runtime_1.jsx)(core_1.FieldsPanel, { title: "Messaging", actions: (0, jsx_runtime_1.jsx)(config_1.BlockConfigButton, { target: "message" }), fields: messageFields }), visualFields.length > 0 &&
64
65
  (0, jsx_runtime_1.jsx)(core_1.FieldsPanel, { title: "Visual", actions: (0, jsx_runtime_1.jsx)(config_1.BlockConfigButton, { target: "visual" }), fields: visualFields }), listsFields.length > 0 &&
65
66
  (0, jsx_runtime_1.jsx)(core_1.FieldsPanel, { title: "List", actions: (0, jsx_runtime_1.jsx)(config_1.BlockConfigButton, { target: "list" }), fields: listsFields }), extendedFields.length > 0 &&
@@ -1,8 +1,16 @@
1
1
  import { PropsWithChildren } from 'react';
2
- import { Block, PageSettings, Section, SectionBlock } from '../../../core';
3
- export declare function BlockConfigurationProvider({ item, children }: BlockConfigurationProvider.Props): import("react/jsx-runtime").JSX.Element;
2
+ import { Observable } from 'rxjs';
3
+ import { Block, BlockConfiguration, PageSettings, Section, SectionBlock } from '../../../core';
4
+ export declare const BlockConfigurationProvider: import("react").ForwardRefExoticComponent<{
5
+ children?: import("react").ReactNode | undefined;
6
+ } & {
7
+ item?: Block | SectionBlock | Section | PageSettings;
8
+ } & import("react").RefAttributes<BlockConfigurationProvider.Ref>>;
4
9
  export declare namespace BlockConfigurationProvider {
5
10
  type Props = PropsWithChildren & {
6
11
  item?: Block | SectionBlock | Section | PageSettings;
7
12
  };
13
+ interface Ref {
14
+ readonly configuration$: Observable<BlockConfiguration | undefined>;
15
+ }
8
16
  }
@@ -1,17 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BlockConfigurationProvider = BlockConfigurationProvider;
3
+ exports.BlockConfigurationProvider = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const rxjs_1 = require("rxjs");
6
7
  const core_1 = require("../../../core");
7
8
  // provider
8
- function BlockConfigurationProvider({ item, children }) {
9
+ exports.BlockConfigurationProvider = (0, react_1.forwardRef)(function BlockConfigurationProvider({ item, children }, ref) {
9
10
  // bind context
10
11
  const context = (0, react_1.useMemo)(() => ({
11
12
  configuration: item instanceof core_1.Block || item instanceof core_1.SectionBlock
12
13
  ? item.getConfiguration()
13
14
  : undefined
14
15
  }), [item]);
16
+ const configuration$ = (0, react_1.useMemo)(() => new rxjs_1.BehaviorSubject(undefined), []);
17
+ // bind interface
18
+ (0, react_1.useImperativeHandle)(ref, () => ({ configuration$ }), [configuration$]);
19
+ // sync configuration when context updates
20
+ (0, react_1.useEffect)(() => {
21
+ configuration$.next(context.configuration);
22
+ }, [configuration$, context]);
15
23
  // render
16
24
  return ((0, jsx_runtime_1.jsx)(core_1.BlockConfigurationContext.Provider, { value: context, children: children }));
17
- }
25
+ });
@@ -1,8 +1,10 @@
1
+ import { BlockLayout } from '@nascentdigital/funnel-core';
1
2
  import { BlockConfiguration } from '../../../core';
2
- export declare function BlockPreview({ className, configuration }: BlockPreview.Props): import("react/jsx-runtime").JSX.Element;
3
+ export declare function BlockPreview({ className, scope, layout }: BlockPreview.Props): import("react/jsx-runtime").JSX.Element;
3
4
  export declare namespace BlockPreview {
4
5
  type Props = {
5
6
  className?: string;
6
- configuration?: BlockConfiguration;
7
+ scope: BlockConfiguration.Scope;
8
+ layout: BlockLayout;
7
9
  };
8
10
  }
@@ -10,12 +10,11 @@ const classnames_1 = __importDefault(require("classnames"));
10
10
  const react_1 = require("motion/react");
11
11
  const preview_1 = require("./preview");
12
12
  // components
13
- function BlockPreview({ className, configuration }) {
13
+ function BlockPreview({ className, scope, layout }) {
14
14
  // bind props
15
- const { scope = 'desktop', layout } = configuration !== null && configuration !== void 0 ? configuration : {};
16
15
  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;
16
+ ? layout.tight.mobile
17
+ : layout.tight.desktop;
19
18
  // render
20
19
  return ((0, jsx_runtime_1.jsx)(react_1.motion.section, { className: (0, classnames_1.default)(className, 'bg-surface2 rounded-xs interpolate-all', {
21
20
  'min-h-[100px]': !layout,
@@ -24,14 +23,9 @@ function BlockPreview({ className, configuration }) {
24
23
  'pb-l4': tight === 'above',
25
24
  'pt-l4': tight === 'below',
26
25
  'py-l4': tight === 'none'
27
- }), layoutRoot: true, layout: true, children: configuration && renderLayout({ configuration }) }));
26
+ }), layoutRoot: true, layout: true, children: renderLayout({ scope, layout }) }));
28
27
  }
29
- function renderLayout({ configuration }) {
30
- // skip if there's no layout
31
- const { scope, layout } = configuration;
32
- if (!layout) {
33
- return null;
34
- }
28
+ function renderLayout({ scope, layout }) {
35
29
  // render layout based on root type
36
30
  const mobile = scope === 'mobile';
37
31
  const { root } = layout;
@@ -1,3 +1,4 @@
1
1
  export * from './BlockConfigButton';
2
2
  export * from './BlockConfigurationProvider';
3
3
  export * from './BlockPreview';
4
+ export * from './useBlockConfiguration$';
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./BlockConfigButton"), exports);
18
18
  __exportStar(require("./BlockConfigurationProvider"), exports);
19
19
  __exportStar(require("./BlockPreview"), exports);
20
+ __exportStar(require("./useBlockConfiguration$"), exports);
@@ -0,0 +1,3 @@
1
+ import { Observable } from 'rxjs';
2
+ import { BlockConfiguration } from '../../../core';
3
+ export declare function useBlockConfiguration$(configuration$?: Observable<BlockConfiguration | undefined>): BlockConfiguration | undefined;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useBlockConfiguration$ = useBlockConfiguration$;
4
+ const react_1 = require("react");
5
+ function useBlockConfiguration$(configuration$) {
6
+ // bind hooks
7
+ const [configuration, setConfiguration] = (0, react_1.useState)();
8
+ // sync configuration
9
+ (0, react_1.useEffect)(() => {
10
+ // skip if there's no stream
11
+ if (!configuration$) {
12
+ setConfiguration(undefined);
13
+ return;
14
+ }
15
+ // watch stream and sync
16
+ const subscription = configuration$.subscribe(setConfiguration);
17
+ // stop on unmount
18
+ return () => subscription.unsubscribe();
19
+ }, [configuration$]);
20
+ // return configuration
21
+ return configuration;
22
+ }
@@ -11,12 +11,12 @@ function BlockConfigPanel() {
11
11
  const id = (0, react_1.useId)();
12
12
  const configuration = (0, core_1.useBlockConfiguration)();
13
13
  // skip if there's no config (shouldn't happen)
14
- if (!configuration || !configuration.hasPanels) {
14
+ const { scope = 'desktop', layout } = configuration !== null && configuration !== void 0 ? configuration : {};
15
+ if (!configuration || !configuration.hasPanels || !layout) {
15
16
  return null;
16
17
  }
17
18
  // render
18
- const { scope } = configuration;
19
- return ((0, jsx_runtime_1.jsx)(core_1.FadeIn, { children: (0, jsx_runtime_1.jsxs)(core_1.Popup.AnchorElement, { tag: "div", anchorId: id, className: "h-full flex flex-col gap-l6 py-l7 bg-surface1 rounded-xxl interpolate-all", children: [(0, jsx_runtime_1.jsx)(core_1.Tabs, { className: "mx-l7", variant: "highlighted", size: "sm", items: blockScopes, selectedItem: scope, onSelect: scope => configuration.scope = scope }), (0, jsx_runtime_1.jsx)(config_1.BlockPreview, { className: "self-center", configuration: configuration }), (0, jsx_runtime_1.jsx)("div", { className: "px-l7", children: (0, jsx_runtime_1.jsx)(config_1.BlockConfigButton, { anchorId: id, target: "block" }) })] }) }, "block.config"));
19
+ return ((0, jsx_runtime_1.jsx)(core_1.FadeIn, { children: (0, jsx_runtime_1.jsxs)(core_1.Popup.AnchorElement, { tag: "div", anchorId: id, className: "h-full flex flex-col gap-l6 py-l7 bg-surface1 rounded-xxl interpolate-all", children: [(0, jsx_runtime_1.jsx)(core_1.Tabs, { className: "mx-l7", variant: "highlighted", size: "sm", items: blockScopes, selectedItem: scope, onSelect: scope => configuration.scope = scope }), (0, jsx_runtime_1.jsx)(config_1.BlockPreview, { className: "self-center", scope: scope, layout: layout }), (0, jsx_runtime_1.jsx)("div", { className: "px-l7", children: (0, jsx_runtime_1.jsx)(config_1.BlockConfigButton, { anchorId: id, target: "block" }) })] }) }, "block.config"));
20
20
  }
21
21
  // helpers
22
22
  const blockScopes = [
@@ -1,5 +1,5 @@
1
1
  import { Schema } from '@nascentdigital/funnel-core';
2
- import { AppState, EditorApiClient, IPage, Page, PageRepository, PageSummary } from '../../core';
2
+ import { AppState, IPage, Page, PageRepository, PageSummary } from '../../core';
3
3
  import { IPageController } from './IPageController';
4
4
  export declare class PageController implements IPageController {
5
5
  private readonly _eventBus;
@@ -11,7 +11,7 @@ export declare class PageController implements IPageController {
11
11
  private _page?;
12
12
  private _pageSubscription?;
13
13
  private _saveQueuedFor?;
14
- constructor({ appState, editorApi }: PageController.ConstructorArgs);
14
+ constructor({ appState, pageRepository }: PageController.ConstructorArgs);
15
15
  get events$(): import("rxjs").Observable<IPage.Event | IPageController.Event>;
16
16
  get saved$(): import("rxjs").Observable<[IPageController.StateChangedEvent, IPageController.StateChangedEvent]>;
17
17
  get state(): IPageController.State;
@@ -38,6 +38,6 @@ export declare class PageController implements IPageController {
38
38
  export declare namespace PageController {
39
39
  type ConstructorArgs = {
40
40
  appState: AppState;
41
- editorApi: EditorApiClient;
41
+ pageRepository: PageRepository;
42
42
  };
43
43
  }
@@ -7,11 +7,11 @@ const core_1 = require("../../core");
7
7
  const IPageController_1 = require("./IPageController");
8
8
  // class
9
9
  class PageController {
10
- constructor({ appState, editorApi }) {
10
+ constructor({ appState, pageRepository }) {
11
11
  // initialize instance variables
12
12
  this._eventBus = new funnel_core_1.EventBus();
13
13
  this.appState = appState;
14
- this.repository = new core_1.PageRepository(editorApi);
14
+ this.repository = pageRepository;
15
15
  this._state = 'uninitialized';
16
16
  }
17
17
  get events$() {
@@ -206,11 +206,12 @@ class PageController {
206
206
  if (existingSummary
207
207
  && existingSummary.isInGroup(target)
208
208
  && existingSummary.groupId !== funnel_core_1.Schema.Page.GroupId.empty) {
209
- const { template, slug, language } = target;
209
+ const { template, slug, region, language } = target;
210
210
  result = await this.repository.createLanguage({
211
211
  template,
212
212
  groupId: existingSummary.groupId,
213
213
  slug,
214
+ region,
214
215
  language,
215
216
  eventBus
216
217
  });
@@ -21,19 +21,19 @@ function PageEditor({ templateId, region, language, slug }) {
21
21
  const splash = (0, core_1.useSplash)();
22
22
  const router = (0, core_1.useEditorRouter)();
23
23
  const target = (0, react_2.useMemo)(() => coerceTarget({ templateId, slug, region, language }), [templateId, slug, region, language]);
24
- const editorApi = (0, core_1.useEditorApi)();
24
+ const pageRepository = (0, core_1.usePageRepository)();
25
25
  const { controller, controllerContext } = (0, react_2.useMemo)(() => {
26
26
  // return controller + context
27
- const controller = new hooks_1.PageController({ appState, editorApi });
27
+ const controller = new hooks_1.PageController({ appState, pageRepository });
28
28
  return {
29
29
  controller,
30
30
  controllerContext: { controller }
31
31
  };
32
- }, [appState, editorApi]);
32
+ }, [appState, pageRepository]);
33
33
  const { page } = controller;
34
34
  const pageContext = (0, react_2.useMemo)(() => ({ page }), [page]);
35
35
  const selectedItem = (0, react_2.useMemo)(() => page === null || page === void 0 ? void 0 : page.coerceItem(itemId), [page, itemId]);
36
- const pageRefStoreProxy = (0, react_2.useMemo)(() => new core_1.PageRefStoreProxy({ language, editorApi }), [editorApi, language]);
36
+ const pageRefStoreProxy = (0, react_2.useMemo)(() => new core_1.PageRefStoreProxy({ pageRepository, language }), [pageRepository, language]);
37
37
  // load any needed page refs
38
38
  (0, react_2.useEffect)(() => {
39
39
  // bail if no page
@@ -501,12 +501,12 @@ video {
501
501
  }
502
502
 
503
503
  [popover]{
504
- inset: var(--toolwind-toggle-oQHJpc9jXV, 0px);
505
- background-color: var(--toolwind-toggle-GCBdFMAuDL, canvas);
506
- color: var(--toolwind-toggle-I8FwR2AIO0, canvastext);
507
- margin: var(--toolwind-toggle-irGpFytKLG, auto);
504
+ inset: var(--toolwind-toggle-AcLhegQ593, 0px);
505
+ background-color: var(--toolwind-toggle-pOdFeExQFr, canvas);
506
+ color: var(--toolwind-toggle-vbIn7qRdsp, canvastext);
507
+ margin: var(--toolwind-toggle-nEH1eNUgT7, auto);
508
508
  }
509
- html, body, #__next, .Editor-wrap{
509
+ html, body, #__next, #root, .Editor-wrap{
510
510
  position: relative;
511
511
  height: 100lvh;
512
512
  max-height: 100lvh;
@@ -549,6 +549,31 @@ video {
549
549
  overflow: scroll;
550
550
  }
551
551
 
552
+
553
+ html.Editor-widget{
554
+ height: -moz-max-content;
555
+ height: max-content;
556
+ max-height: -moz-max-content;
557
+ max-height: max-content;
558
+ min-height: -moz-max-content;
559
+ min-height: max-content;
560
+ background-color: transparent;
561
+ }
562
+
563
+ html.Editor-widget body, html.Editor-widget #__next, html.Editor-widget #root, html.Editor-widget .Editor-wrap{
564
+ height: -moz-max-content;
565
+ height: max-content;
566
+ max-height: -moz-max-content;
567
+ max-height: max-content;
568
+ min-height: -moz-max-content;
569
+ min-height: max-content;
570
+ background-color: transparent;
571
+ }
572
+
573
+ html.Editor-widget nextjs-portal {
574
+ display: none !important;
575
+ }
576
+
552
577
  /* colors: light mode */
553
578
  html, *.light-mode {
554
579
  --color-background: 247 250 252;
@@ -3641,17 +3666,13 @@ video {
3641
3666
  border-radius: 12px;
3642
3667
  --tw-bg-opacity: 1;
3643
3668
  background-color: rgb(var(--color-modal-surface1) / var(--tw-bg-opacity, 1));
3644
- --tw-shadow: 0 15px 50px 0 rgba(26,32,44,0.25);
3669
+ --tw-shadow: 0 15px 50px 0 var(--color-shadow1, rgba(26, 32, 44, 0.25));
3645
3670
  --tw-shadow-colored: 0 15px 50px 0 var(--tw-shadow-color);
3646
3671
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
3647
3672
  }
3648
- @media (prefers-color-scheme: dark){
3649
-
3650
- .Picker-root{
3651
- --tw-shadow: 0 15px 50px 0 rgba(26,32,44,0.75);
3652
- --tw-shadow-colored: 0 15px 50px 0 var(--tw-shadow-color);
3653
- box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
3654
- }
3673
+ .Picker-root.Picker-sm{
3674
+ height: 340px;
3675
+ width: 512px;
3655
3676
  }
3656
3677
  .segmented-button-group{
3657
3678
  display: inline-grid;
@@ -5866,8 +5887,8 @@ img.nd-Visual-image {
5866
5887
  opacity: 0;
5867
5888
  }
5868
5889
  .shadow-dialog{
5869
- --tw-shadow: 0 15px 50px 0 var(--color-shadow1), rgba(26, 32, 44, 0.25);
5870
- --tw-shadow-colored: 0 15px 50px 0 var(--tw-shadow-color), rgba(26, 32, 44, 0.25);
5890
+ --tw-shadow: 0 15px 50px 0 var(--color-shadow1, rgba(26, 32, 44, 0.25));
5891
+ --tw-shadow-colored: 0 15px 50px 0 var(--tw-shadow-color);
5871
5892
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
5872
5893
  }
5873
5894
  .shadow-miniEditor{
@@ -5996,10 +6017,10 @@ img.nd-Visual-image {
5996
6017
  .anchored\/\[--nd-popup-anchor\]:where(.anchored\/\[--nd-popup-anchor\]){
5997
6018
  position: absolute;
5998
6019
  view-transition-name: --tw-anchor-view-transition-2j1919322s193433343934192p322r2w33362l;
5999
- --toolwind-toggle-oQHJpc9jXV: auto;
6000
- --toolwind-toggle-GCBdFMAuDL: transparent;
6001
- --toolwind-toggle-I8FwR2AIO0: inherit;
6002
- --toolwind-toggle-irGpFytKLG: 0px;
6020
+ --toolwind-toggle-AcLhegQ593: auto;
6021
+ --toolwind-toggle-pOdFeExQFr: transparent;
6022
+ --toolwind-toggle-vbIn7qRdsp: inherit;
6023
+ --toolwind-toggle-nEH1eNUgT7: 0px;
6003
6024
  }
6004
6025
  .counter-l1{
6005
6026
  counter-reset: l1;