@nascentdigital/funnel-editor 4.6.0 → 4.6.7
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.
- package/dist/components.d.ts +9 -0
- package/dist/components.js +27 -0
- package/dist/core/components/fields/page/PagePicker.d.ts +2 -2
- package/dist/core/components/interaction/DateTimePicker.d.ts +0 -1
- package/dist/core/components/interaction/DateTimePicker.js +0 -2
- package/dist/core/components/interaction/Popup.js +1 -0
- package/dist/core/components/transitions/FadeIn.js +2 -14
- package/dist/core/domain/Block.d.ts +1 -0
- package/dist/core/domain/Block.js +6 -4
- package/dist/core/domain/BlockConfiguration.js +5 -0
- package/dist/core/domain/Collection.d.ts +3 -3
- package/dist/core/domain/IPage.d.ts +58 -0
- package/dist/core/domain/IPage.js +20 -0
- package/dist/core/domain/IPageRefStore.d.ts +3 -3
- package/dist/core/domain/ItemBase.d.ts +6 -6
- package/dist/core/domain/ItemBase.js +5 -5
- package/dist/core/domain/Page.d.ts +9 -22
- package/dist/core/domain/Page.js +1 -16
- package/dist/core/domain/PageOverview.d.ts +2 -2
- package/dist/core/domain/PageRefStoreProxy.d.ts +4 -4
- package/dist/core/domain/PageSettings.d.ts +3 -3
- package/dist/core/domain/PageSummary.d.ts +2 -2
- package/dist/core/domain/index.d.ts +1 -0
- package/dist/core/domain/index.js +1 -0
- package/dist/core/hooks/usePage.d.ts +4 -4
- package/dist/core/hooks/usePageRef.d.ts +1 -1
- package/dist/core/repository/PageRepository.d.ts +2 -2
- package/dist/core/repository/PageSerializer.d.ts +34 -1
- package/dist/core/repository/PageSerializer.js +4 -0
- package/dist/page/components/PageHeader.d.ts +2 -2
- package/dist/page/components/PageNotCreated.d.ts +2 -2
- package/dist/page/components/PageNotFound.d.ts +2 -2
- package/dist/page/components/config/BlockConfigButton.d.ts +2 -1
- package/dist/page/components/config/BlockConfigButton.js +14 -11
- package/dist/page/components/config/BlockPreview.d.ts +8 -0
- package/dist/page/components/config/BlockPreview.js +53 -0
- package/dist/page/components/config/index.d.ts +1 -1
- package/dist/page/components/config/index.js +1 -1
- package/dist/page/components/config/preview/ColumnLayout.d.ts +10 -0
- package/dist/page/components/config/preview/ColumnLayout.js +15 -0
- package/dist/page/components/config/preview/ItemLayout.d.ts +12 -0
- package/dist/page/components/config/preview/ItemLayout.js +45 -0
- package/dist/page/components/config/preview/ListPanel.d.ts +12 -0
- package/dist/page/components/config/preview/ListPanel.js +14 -0
- package/dist/page/components/config/preview/MessagePanel.d.ts +12 -0
- package/dist/page/components/config/preview/MessagePanel.js +21 -0
- package/dist/page/components/config/preview/Panel.d.ts +15 -0
- package/dist/page/components/config/preview/Panel.js +74 -0
- package/dist/page/components/config/preview/RowLayout.d.ts +10 -0
- package/dist/page/components/config/preview/RowLayout.js +26 -0
- package/dist/page/components/config/preview/StackLayout.d.ts +10 -0
- package/dist/page/components/config/preview/StackLayout.js +15 -0
- package/dist/page/components/config/preview/VisualPanel.d.ts +12 -0
- package/dist/page/components/config/preview/VisualPanel.js +27 -0
- package/dist/page/components/config/preview/index.d.ts +3 -0
- package/dist/page/components/config/preview/index.js +19 -0
- package/dist/page/components/panels/BlockConfigPanel.js +4 -4
- package/dist/page/hooks/IPageController.d.ts +42 -0
- package/dist/page/hooks/IPageController.js +32 -0
- package/dist/page/hooks/PageController.d.ts +11 -36
- package/dist/page/hooks/PageController.js +7 -33
- package/dist/page/hooks/index.d.ts +1 -0
- package/dist/page/hooks/index.js +1 -0
- package/dist/page/hooks/usePageController.d.ts +3 -3
- package/dist/styles/index.css +805 -54
- package/package.json +3 -2
- package/dist/page/components/config/LegacyBlockPreview.d.ts +0 -8
- package/dist/page/components/config/LegacyBlockPreview.js +0 -452
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './core/domain';
|
|
2
|
+
export * from './core/components';
|
|
3
|
+
export * from './core/hooks';
|
|
4
|
+
export * from './core/repository/PageTarget';
|
|
5
|
+
export * from './core/repository/PageSerializer';
|
|
6
|
+
export * from './page/hooks';
|
|
7
|
+
export * from './page/components/PageNav';
|
|
8
|
+
export * from './page/components/BlockEditor';
|
|
9
|
+
export * from './page/components/SettingsEditor';
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
// core
|
|
18
|
+
__exportStar(require("./core/domain"), exports);
|
|
19
|
+
__exportStar(require("./core/components"), exports);
|
|
20
|
+
__exportStar(require("./core/hooks"), exports);
|
|
21
|
+
__exportStar(require("./core/repository/PageTarget"), exports);
|
|
22
|
+
__exportStar(require("./core/repository/PageSerializer"), exports);
|
|
23
|
+
// page
|
|
24
|
+
__exportStar(require("./page/hooks"), exports);
|
|
25
|
+
__exportStar(require("./page/components/PageNav"), exports);
|
|
26
|
+
__exportStar(require("./page/components/BlockEditor"), exports);
|
|
27
|
+
__exportStar(require("./page/components/SettingsEditor"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Language, Schema } from '@nascentdigital/funnel-core';
|
|
2
|
-
import {
|
|
2
|
+
import { IPage } from '../../../domain';
|
|
3
3
|
export declare const PagePicker: import("react").ForwardRefExoticComponent<PagePicker.Props & import("react").RefAttributes<PagePicker.Ref>>;
|
|
4
4
|
export declare namespace PagePicker {
|
|
5
5
|
type Props = {
|
|
@@ -14,5 +14,5 @@ export declare namespace PagePicker {
|
|
|
14
14
|
tags?: ReadonlyArray<Schema.Tag>;
|
|
15
15
|
disabledIds?: ReadonlyArray<Schema.Page.Id>;
|
|
16
16
|
};
|
|
17
|
-
type Result =
|
|
17
|
+
type Result = IPage.Ref | undefined;
|
|
18
18
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Callback, Timestamp } from '@nascentdigital/funnel-core';
|
|
2
|
-
import 'flatpickr/dist/themes/dark.css';
|
|
3
2
|
export declare function DateTimePicker({ className, disabled, placeholder, date, onChange, ...optionsRaw }: DateTimePicker.Props): import("react/jsx-runtime").JSX.Element;
|
|
4
3
|
export declare namespace DateTimePicker {
|
|
5
4
|
type Props = {
|
|
@@ -19,8 +19,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
19
19
|
const client_1 = require("@nascentdigital/funnel-ui/client");
|
|
20
20
|
const flatpickr_1 = __importDefault(require("flatpickr"));
|
|
21
21
|
const react_1 = require("react");
|
|
22
|
-
// styles
|
|
23
|
-
require("flatpickr/dist/themes/dark.css");
|
|
24
22
|
// component
|
|
25
23
|
function DateTimePicker(_a) {
|
|
26
24
|
var { className, disabled = false, placeholder, date, onChange } = _a, optionsRaw = __rest(_a, ["className", "disabled", "placeholder", "date", "onChange"]);
|
|
@@ -142,6 +142,7 @@ function getPopupClassNames({ anchor, placement }) {
|
|
|
142
142
|
'anchored-top-span-right': placement === 'top-start',
|
|
143
143
|
'anchored-bottom': placement === 'bottom',
|
|
144
144
|
'anchored-left': placement === 'left',
|
|
145
|
+
'anchored-left-span-bottom': placement === 'left-start',
|
|
145
146
|
'anchored-right': placement === 'right',
|
|
146
147
|
'anchored-bottom-span-left': placement === 'bottom-end'
|
|
147
148
|
})
|
|
@@ -18,24 +18,12 @@ exports.FadeIn = FadeIn;
|
|
|
18
18
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
const classnames_1 = __importDefault(require("classnames"));
|
|
20
20
|
const react_1 = require("motion/react");
|
|
21
|
+
const interaction_1 = require("../interaction");
|
|
21
22
|
// component
|
|
22
23
|
function FadeIn(_a) {
|
|
23
24
|
var { className, variant = 'default' } = _a, props = __rest(_a, ["className", "variant"]);
|
|
24
25
|
// render
|
|
25
26
|
return ((0, jsx_runtime_1.jsx)(react_1.motion.div, Object.assign({ className: (0, classnames_1.default)(className, {
|
|
26
27
|
'will-change-[opacity,filter]': variant === 'blur'
|
|
27
|
-
}), variants:
|
|
28
|
+
}), variants: interaction_1.Animate.Variants.fade, initial: "initial", animate: "animate", exit: "exit" }, props)));
|
|
28
29
|
}
|
|
29
|
-
// helper
|
|
30
|
-
const Animations = {
|
|
31
|
-
default: {
|
|
32
|
-
initial: { opacity: 0 },
|
|
33
|
-
animate: { opacity: 1, transition: { duration: 0.4, ease: 'easeIn' } },
|
|
34
|
-
exit: { opacity: 0, transition: { duration: 0.2, ease: 'easeOut' } }
|
|
35
|
-
},
|
|
36
|
-
blur: {
|
|
37
|
-
initial: { opacity: 0, filter: 'blur(5px)' },
|
|
38
|
-
animate: { opacity: 1, filter: 'blur(0px)' },
|
|
39
|
-
exit: { opacity: 0, filter: 'blur(5px)', transition: { duration: 0.2 } }
|
|
40
|
-
}
|
|
41
|
-
};
|
|
@@ -18,6 +18,7 @@ export declare class Block<TBlock extends Schema.Block = Schema.Block> extends I
|
|
|
18
18
|
get identifier(): string;
|
|
19
19
|
get name(): string;
|
|
20
20
|
get state(): "undefined" | "invalid" | "valid";
|
|
21
|
+
get fieldChanged$(): import("rxjs").Observable<Field.Event>;
|
|
21
22
|
get value(): Schema.Block.Data;
|
|
22
23
|
get modified(): boolean;
|
|
23
24
|
get changes(): Block.Changes;
|
|
@@ -39,10 +39,7 @@ class Block extends ItemBase_1.ItemBase {
|
|
|
39
39
|
this.listsFields = this.fields.filter(field => field.id === 'list');
|
|
40
40
|
this.extendedFields = this.fields.filter(field => !messageKeys.includes(field.id) && field.id !== 'visual' && field.id !== 'list');
|
|
41
41
|
// listen to field changes
|
|
42
|
-
this.
|
|
43
|
-
.pipe((0, rxjs_1.filter)(funnel_core_1.Field.Event.filter), (0, rxjs_1.filter)(event => (event.type === 'changed' || event.type === 'reset')
|
|
44
|
-
&& this.fields.includes(event.field)))
|
|
45
|
-
.subscribe(event => this.onFieldChange(event));
|
|
42
|
+
this.fieldChanged$.subscribe(event => this.onFieldChange(event));
|
|
46
43
|
}
|
|
47
44
|
get identifier() {
|
|
48
45
|
return this.key;
|
|
@@ -57,6 +54,11 @@ class Block extends ItemBase_1.ItemBase {
|
|
|
57
54
|
: 'invalid'
|
|
58
55
|
: 'undefined';
|
|
59
56
|
}
|
|
57
|
+
get fieldChanged$() {
|
|
58
|
+
return this.eventBus.events$
|
|
59
|
+
.pipe((0, rxjs_1.filter)(funnel_core_1.Field.Event.filter), (0, rxjs_1.filter)(event => (event.type === 'changed' || event.type === 'reset')
|
|
60
|
+
&& this.fields.includes(event.field)));
|
|
61
|
+
}
|
|
60
62
|
get value() {
|
|
61
63
|
const { schema, config, fields } = this;
|
|
62
64
|
return {
|
|
@@ -30,6 +30,9 @@ class BlockConfiguration {
|
|
|
30
30
|
// sync
|
|
31
31
|
this.reset();
|
|
32
32
|
// force sync if a field is modified
|
|
33
|
+
this.block.fieldChanged$
|
|
34
|
+
.pipe((0, rxjs_1.debounceTime)(100))
|
|
35
|
+
.subscribe(() => this.sync());
|
|
33
36
|
this.eventBus.events$
|
|
34
37
|
.pipe((0, rxjs_1.filter)(event => funnel_core_1.Field.Event.filter(event) && event.type === 'changed'))
|
|
35
38
|
.subscribe(() => this.sync());
|
|
@@ -87,6 +90,7 @@ class BlockConfiguration {
|
|
|
87
90
|
return [
|
|
88
91
|
...Object.values(this.extendedFields),
|
|
89
92
|
this.getEditableField('contentAlign'),
|
|
93
|
+
this.getEditableField('contentSplit')
|
|
90
94
|
].filter(funnel_core_1.Value.isDefined);
|
|
91
95
|
}
|
|
92
96
|
get mobileFields() {
|
|
@@ -185,6 +189,7 @@ class BlockConfiguration {
|
|
|
185
189
|
'layout',
|
|
186
190
|
'slotVariation',
|
|
187
191
|
'contentAlign',
|
|
192
|
+
'contentSplit',
|
|
188
193
|
...Object.values(funnel_ui_1.MessagePanel.Config.getKeys('message')),
|
|
189
194
|
...Object.values(funnel_ui_1.ListPanel.Config.getKeys('list')),
|
|
190
195
|
...Object.values(funnel_ui_1.VisualPanel.Config.getKeys('visual'))
|
|
@@ -4,10 +4,10 @@ import { Observable } from 'rxjs';
|
|
|
4
4
|
import { Asset } from './Asset';
|
|
5
5
|
import { IAssetStore } from './IAssetStore';
|
|
6
6
|
import { ICollectionStore } from './ICollectionStore';
|
|
7
|
+
import { IPage } from './IPage';
|
|
7
8
|
import { IPageRefStore } from './IPageRefStore';
|
|
8
9
|
import { ITagged } from './ITagged';
|
|
9
10
|
import { Item } from './Item';
|
|
10
|
-
import { Page } from './Page';
|
|
11
11
|
export declare class Collection implements IAssetStore, ICollectionStore, IPageRefStore, ITagged {
|
|
12
12
|
readonly template: Schema.Collection;
|
|
13
13
|
readonly eventBus: EventBus;
|
|
@@ -73,8 +73,8 @@ export declare class Collection implements IAssetStore, ICollectionStore, IPageR
|
|
|
73
73
|
getCollection(collectionId: Schema.Collection.Id): Schema.Collection.Data.AsLink | undefined;
|
|
74
74
|
addCollection(collection: Schema.Collection.Data.AsLink): void;
|
|
75
75
|
removeCollection(collectionId: Schema.Collection.Id): boolean;
|
|
76
|
-
getPageRef(pageId: Schema.Page.Id | undefined):
|
|
77
|
-
addPageRef(page:
|
|
76
|
+
getPageRef(pageId: Schema.Page.Id | undefined): IPage.Ref | undefined;
|
|
77
|
+
addPageRef(page: IPage.Ref): void;
|
|
78
78
|
removePageRef(pageId: string): boolean;
|
|
79
79
|
onSaveStart(): void;
|
|
80
80
|
onSaveComplete(updatedOn: number, changeSetId: Schema.ChangeSet.Id): void;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { EventBus, Field, FieldList, Language, ObjectField, Schema } from '@nascentdigital/funnel-core';
|
|
2
|
+
import type { Observable } from 'rxjs';
|
|
3
|
+
import type { Block } from './Block';
|
|
4
|
+
import type { IAssetStore } from './IAssetStore';
|
|
5
|
+
import type { ICollectionStore } from './ICollectionStore';
|
|
6
|
+
import type { IPageRefStore } from './IPageRefStore';
|
|
7
|
+
import type { ITagged } from './ITagged';
|
|
8
|
+
import type { Item } from './Item';
|
|
9
|
+
import type { PageSettings } from './PageSettings';
|
|
10
|
+
import type { Section } from './Section';
|
|
11
|
+
export interface IPage extends IAssetStore, ICollectionStore, IPageRefStore, ITagged {
|
|
12
|
+
readonly template: Schema.Page;
|
|
13
|
+
readonly id: Schema.Page.Id;
|
|
14
|
+
readonly groupId: Schema.Page.GroupId;
|
|
15
|
+
readonly brand: string;
|
|
16
|
+
readonly language: Language;
|
|
17
|
+
readonly region: string;
|
|
18
|
+
readonly events$: Observable<IPage.Events>;
|
|
19
|
+
readonly settings: PageSettings;
|
|
20
|
+
readonly discover: ReadonlyArray<Block>;
|
|
21
|
+
readonly content: IPage.Content;
|
|
22
|
+
readonly published: boolean;
|
|
23
|
+
readonly hasSlug: boolean;
|
|
24
|
+
readonly url: string;
|
|
25
|
+
readonly createdOn: number;
|
|
26
|
+
readonly updatedOn: number;
|
|
27
|
+
publication: number | undefined;
|
|
28
|
+
slug: string | undefined;
|
|
29
|
+
deleteBlock(area: IPage.Area, key: string): void;
|
|
30
|
+
}
|
|
31
|
+
export declare namespace IPage {
|
|
32
|
+
type Content = ReadonlyArray<Block | Section>;
|
|
33
|
+
type Area = 'discover' | 'content';
|
|
34
|
+
type Ref = {
|
|
35
|
+
template: Schema.Page;
|
|
36
|
+
id: Schema.Page.Id;
|
|
37
|
+
groupId: Schema.Page.GroupId;
|
|
38
|
+
brand: string;
|
|
39
|
+
language: Language;
|
|
40
|
+
region: string;
|
|
41
|
+
url: string;
|
|
42
|
+
slug?: string;
|
|
43
|
+
name: string;
|
|
44
|
+
tags: Schema.Tag[];
|
|
45
|
+
createdOn: number;
|
|
46
|
+
updatedOn: number;
|
|
47
|
+
publishedOn?: number;
|
|
48
|
+
};
|
|
49
|
+
type Events = Event | Item.Event | Field.Event | ObjectField.Event | FieldList.Event;
|
|
50
|
+
interface Event extends EventBus.Event<'Page', Event.Type> {
|
|
51
|
+
page: IPage;
|
|
52
|
+
}
|
|
53
|
+
namespace Event {
|
|
54
|
+
type Type = 'changed' | 'modified';
|
|
55
|
+
function filter(event: EventBus.Event): event is Event;
|
|
56
|
+
function create(event: EventBus.Args<Event>): Event;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IPage = void 0;
|
|
4
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
5
|
+
// extension
|
|
6
|
+
var IPage;
|
|
7
|
+
(function (IPage) {
|
|
8
|
+
let Event;
|
|
9
|
+
(function (Event) {
|
|
10
|
+
// methods
|
|
11
|
+
function filter(event) {
|
|
12
|
+
return event.domain === 'Page';
|
|
13
|
+
}
|
|
14
|
+
Event.filter = filter;
|
|
15
|
+
function create(event) {
|
|
16
|
+
return funnel_core_1.EventBus.createEvent(Object.assign({ domain: 'Page' }, event));
|
|
17
|
+
}
|
|
18
|
+
Event.create = create;
|
|
19
|
+
})(Event = IPage.Event || (IPage.Event = {}));
|
|
20
|
+
})(IPage || (exports.IPage = IPage = {}));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Language, Schema } from '@nascentdigital/funnel-core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import {
|
|
3
|
+
import { IPage } from './IPage';
|
|
4
4
|
export interface IPageRefStore {
|
|
5
5
|
readonly stable$: Observable<boolean>;
|
|
6
6
|
readonly syncing: boolean;
|
|
7
7
|
readonly modified: boolean;
|
|
8
8
|
readonly language: Language;
|
|
9
|
-
getPageRef(pageId: Schema.Page.Id):
|
|
10
|
-
addPageRef(ref:
|
|
9
|
+
getPageRef(pageId: Schema.Page.Id | undefined): IPage.Ref | undefined;
|
|
10
|
+
addPageRef(ref: IPage.Ref): void;
|
|
11
11
|
removePageRef(pageId: Schema.Page.Id): boolean;
|
|
12
12
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventBus } from '@nascentdigital/funnel-core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { Block,
|
|
3
|
+
import { Block, IPage, Item, Section, SectionBlock } from './';
|
|
4
4
|
export declare abstract class ItemBase<T extends Item.Type> {
|
|
5
5
|
readonly key: Item.Key;
|
|
6
6
|
private _required;
|
|
@@ -21,10 +21,10 @@ export declare abstract class ItemBase<T extends Item.Type> {
|
|
|
21
21
|
protected onActivate(): void;
|
|
22
22
|
abstract get modified(): boolean;
|
|
23
23
|
abstract get valid(): boolean;
|
|
24
|
-
get root():
|
|
24
|
+
get root(): IPage;
|
|
25
25
|
private get parentContext();
|
|
26
|
-
get parent(): Section |
|
|
27
|
-
get area():
|
|
26
|
+
get parent(): Section | IPage;
|
|
27
|
+
get area(): IPage.Area;
|
|
28
28
|
bind(parentContext: ItemBase.ParentContext): void;
|
|
29
29
|
getClosestBlock(direction?: 'prev' | 'next'): SectionBlock | Block | undefined;
|
|
30
30
|
delete(): undefined;
|
|
@@ -39,7 +39,7 @@ export declare namespace ItemBase {
|
|
|
39
39
|
exists: boolean;
|
|
40
40
|
};
|
|
41
41
|
type ParentContext = {
|
|
42
|
-
parent:
|
|
43
|
-
area:
|
|
42
|
+
parent: IPage | Section;
|
|
43
|
+
area: IPage.Area;
|
|
44
44
|
};
|
|
45
45
|
}
|
|
@@ -99,10 +99,10 @@ class ItemBase {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
// look at page (use sanity check)
|
|
102
|
-
const page = parent instanceof _1.
|
|
103
|
-
? parent
|
|
104
|
-
: parent
|
|
105
|
-
if (
|
|
102
|
+
const page = parent instanceof _1.Section
|
|
103
|
+
? parent.parent
|
|
104
|
+
: parent;
|
|
105
|
+
if (page instanceof _1.Section) {
|
|
106
106
|
throw new funnel_core_1.IllegalStateError('Expected parent to be Page');
|
|
107
107
|
}
|
|
108
108
|
// type guard
|
|
@@ -140,7 +140,7 @@ class ItemBase {
|
|
|
140
140
|
parent.deleteBlock(this.id);
|
|
141
141
|
}
|
|
142
142
|
// or delete block from page
|
|
143
|
-
else if (this instanceof _1.Block && parent instanceof _1.
|
|
143
|
+
else if (this instanceof _1.Block && !(parent instanceof _1.Section)) {
|
|
144
144
|
parent.deleteBlock(area, this.key);
|
|
145
145
|
}
|
|
146
146
|
// or do nothing
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AssetClient } from '@nascentdigital/funnel-cms';
|
|
2
|
-
import { EventBus,
|
|
2
|
+
import { EventBus, FieldModel, Language, Schema } from '@nascentdigital/funnel-core';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
|
-
import { Asset, Block, IAssetStore, ICollectionStore, IPageRefStore, ITagged,
|
|
4
|
+
import { Asset, Block, IAssetStore, ICollectionStore, IPage, IPageRefStore, ITagged, PageSummary, Section, SectionBlock } from './';
|
|
5
5
|
import { PageSettings } from './PageSettings';
|
|
6
6
|
export declare class Page implements IAssetStore, ICollectionStore, IPageRefStore, ITagged {
|
|
7
7
|
readonly template: Schema.Page;
|
|
@@ -41,7 +41,7 @@ export declare class Page implements IAssetStore, ICollectionStore, IPageRefStor
|
|
|
41
41
|
private _modifiedOn?;
|
|
42
42
|
private _savingOn?;
|
|
43
43
|
constructor(args: Page.ConstructorArgs);
|
|
44
|
-
get events$(): Observable<
|
|
44
|
+
get events$(): Observable<IPage.Events>;
|
|
45
45
|
get stable$(): Observable<boolean>;
|
|
46
46
|
get state(): Schema.Page.State;
|
|
47
47
|
private set state(value);
|
|
@@ -84,7 +84,7 @@ export declare class Page implements IAssetStore, ICollectionStore, IPageRefStor
|
|
|
84
84
|
get initialErrors(): boolean;
|
|
85
85
|
get errors(): Page.Errors;
|
|
86
86
|
get hasErrors(): boolean;
|
|
87
|
-
get asRef():
|
|
87
|
+
get asRef(): IPage.Ref;
|
|
88
88
|
/**
|
|
89
89
|
* Synchronizes computed properties with the latest data (e.g. updating `url` from route template or name)
|
|
90
90
|
*/
|
|
@@ -92,7 +92,7 @@ export declare class Page implements IAssetStore, ICollectionStore, IPageRefStor
|
|
|
92
92
|
getItem(identifier: string | undefined): Block | SectionBlock | Section | PageSettings | undefined;
|
|
93
93
|
getPreviewBlock(): Block | undefined;
|
|
94
94
|
coerceItem(identifier: string | undefined): Block | SectionBlock | Section | PageSettings;
|
|
95
|
-
deleteBlock(area:
|
|
95
|
+
deleteBlock(area: IPage.Area, key: string): boolean;
|
|
96
96
|
getAssetScope(range: Schema.AssetScope.Range): Schema.AssetScope;
|
|
97
97
|
getSearchScope(): AssetClient.GetAssets.Scope;
|
|
98
98
|
getAsset(assetId: Asset.Id): Asset | undefined;
|
|
@@ -101,8 +101,8 @@ export declare class Page implements IAssetStore, ICollectionStore, IPageRefStor
|
|
|
101
101
|
getCollection(collectionId: Schema.Collection.Id): Schema.Collection.Data.AsLink | undefined;
|
|
102
102
|
addCollection(collection: Schema.Collection.Data.AsLink): void;
|
|
103
103
|
removeCollection(collectionId: Schema.Collection.Id): boolean;
|
|
104
|
-
getPageRef(pageId: Schema.Page.Id | undefined):
|
|
105
|
-
addPageRef(page:
|
|
104
|
+
getPageRef(pageId: Schema.Page.Id | undefined): IPage.Ref | undefined;
|
|
105
|
+
addPageRef(page: IPage.Ref): void;
|
|
106
106
|
removePageRef(pageId: string): boolean;
|
|
107
107
|
repair(): void;
|
|
108
108
|
onSaveStart(): void;
|
|
@@ -127,9 +127,9 @@ export declare namespace Page {
|
|
|
127
127
|
name: string;
|
|
128
128
|
tags: Schema.Tag[];
|
|
129
129
|
discover: Blocks;
|
|
130
|
-
content: Content;
|
|
130
|
+
content: Page.Content;
|
|
131
131
|
files?: Asset[];
|
|
132
|
-
pages?: Ref[];
|
|
132
|
+
pages?: IPage.Ref[];
|
|
133
133
|
collections?: Schema.Collection.Data.AsLink[];
|
|
134
134
|
state: Schema.Page.State;
|
|
135
135
|
errors: boolean;
|
|
@@ -155,18 +155,5 @@ export declare namespace Page {
|
|
|
155
155
|
summary: PageSummary;
|
|
156
156
|
page?: Page;
|
|
157
157
|
};
|
|
158
|
-
type Area = 'discover' | 'content';
|
|
159
158
|
type Target = Block | SectionBlock | Section | FieldModel;
|
|
160
|
-
type Ref = Pick<ConstructorArgs, 'id' | 'groupId' | 'brand' | 'template' | 'region' | 'language' | 'url' | 'slug' | 'tags' | 'createdOn' | 'updatedOn' | 'publishedOn'> & {
|
|
161
|
-
name: string;
|
|
162
|
-
};
|
|
163
|
-
type Events = Event | Item.Event | Field.Event | ObjectField.Event | FieldList.Event;
|
|
164
|
-
interface Event extends EventBus.Event<'Page', Event.Type> {
|
|
165
|
-
page: Page;
|
|
166
|
-
}
|
|
167
|
-
namespace Event {
|
|
168
|
-
type Type = 'changed' | 'modified';
|
|
169
|
-
function filter(event: EventBus.Event): event is Event;
|
|
170
|
-
function create(event: EventBus.Args<Event>): Event;
|
|
171
|
-
}
|
|
172
159
|
}
|
package/dist/core/domain/Page.js
CHANGED
|
@@ -680,22 +680,7 @@ class Page {
|
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
682
|
raiseEvent(type) {
|
|
683
|
-
this.eventBus.publish(
|
|
683
|
+
this.eventBus.publish(_1.IPage.Event.create({ type, page: this }));
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
686
|
exports.Page = Page;
|
|
687
|
-
// types
|
|
688
|
-
(function (Page) {
|
|
689
|
-
let Event;
|
|
690
|
-
(function (Event) {
|
|
691
|
-
// methods
|
|
692
|
-
function filter(event) {
|
|
693
|
-
return event.domain === 'Page';
|
|
694
|
-
}
|
|
695
|
-
Event.filter = filter;
|
|
696
|
-
function create(event) {
|
|
697
|
-
return funnel_core_1.EventBus.createEvent(Object.assign({ domain: 'Page' }, event));
|
|
698
|
-
}
|
|
699
|
-
Event.create = create;
|
|
700
|
-
})(Event = Page.Event || (Page.Event = {}));
|
|
701
|
-
})(Page || (exports.Page = Page = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Language, Schema } from '@nascentdigital/funnel-core';
|
|
2
|
-
import {
|
|
2
|
+
import { IPage } from './IPage';
|
|
3
3
|
export type PageOverview = StaticPageOverview | DynamicPageOverview;
|
|
4
4
|
export declare abstract class PageOverviewBase {
|
|
5
5
|
readonly template: Schema.Page;
|
|
@@ -19,7 +19,7 @@ export declare class StaticPageOverview extends PageOverviewBase {
|
|
|
19
19
|
constructor({ refs, ...args }: StaticPageOverview.ConstructorArgs);
|
|
20
20
|
get isEmpty(): boolean;
|
|
21
21
|
hasLanguage(language: Language): boolean;
|
|
22
|
-
getClosestPageRef(language: Language, fallback?: Language):
|
|
22
|
+
getClosestPageRef(language: Language, fallback?: Language): IPage.Ref | undefined;
|
|
23
23
|
}
|
|
24
24
|
export declare namespace StaticPageOverview {
|
|
25
25
|
type ConstructorArgs = Omit<PageOverviewBase.ConstructorArgs, 'variant'> & {
|
|
@@ -2,7 +2,7 @@ import { Language, Schema } from '@nascentdigital/funnel-core';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { EditorApiClient } from '../client';
|
|
4
4
|
import { IPageRefStore } from './IPageRefStore';
|
|
5
|
-
import {
|
|
5
|
+
import { IPage } from './IPage';
|
|
6
6
|
export declare class PageRefStoreProxy implements IPageRefStore {
|
|
7
7
|
readonly language: Language;
|
|
8
8
|
private _parentStore;
|
|
@@ -16,8 +16,8 @@ export declare class PageRefStoreProxy implements IPageRefStore {
|
|
|
16
16
|
get modified(): boolean;
|
|
17
17
|
bindParent(parent: IPageRefStore): PageRefStoreProxy;
|
|
18
18
|
load(pageIds?: Schema.Page.Id[]): Promise<void>;
|
|
19
|
-
getPageRef(pageId: Schema.Page.Id | undefined):
|
|
20
|
-
addPageRef(page:
|
|
19
|
+
getPageRef(pageId: Schema.Page.Id | undefined): IPage.Ref | undefined;
|
|
20
|
+
addPageRef(page: IPage.Ref): void;
|
|
21
21
|
removePageRef(pageId: Schema.Page.Id): boolean;
|
|
22
22
|
}
|
|
23
23
|
export declare namespace PageRefStoreProxy {
|
|
@@ -25,7 +25,7 @@ export declare namespace PageRefStoreProxy {
|
|
|
25
25
|
editorApi: EditorApiClient;
|
|
26
26
|
parent?: IPageRefStore;
|
|
27
27
|
language: Language;
|
|
28
|
-
pages?: ReadonlyArray<
|
|
28
|
+
pages?: ReadonlyArray<IPage.Ref>;
|
|
29
29
|
pageIds?: ReadonlyArray<Schema.Page.Id>;
|
|
30
30
|
};
|
|
31
31
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IPage } from './IPage';
|
|
2
2
|
export declare class PageSettings {
|
|
3
|
-
readonly page:
|
|
3
|
+
readonly page: IPage;
|
|
4
4
|
readonly id = "__settings";
|
|
5
5
|
readonly name = "Settings";
|
|
6
|
-
constructor(page:
|
|
6
|
+
constructor(page: IPage);
|
|
7
7
|
get identifier(): string;
|
|
8
8
|
}
|
|
9
9
|
export declare namespace PageSettings {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Language, Schema } from '@nascentdigital/funnel-core';
|
|
2
|
-
import {
|
|
2
|
+
import { IPage } from './IPage';
|
|
3
3
|
export declare class PageSummary {
|
|
4
4
|
readonly template: Schema.Page;
|
|
5
5
|
readonly brand: string;
|
|
@@ -14,7 +14,7 @@ export declare class PageSummary {
|
|
|
14
14
|
get hasPages(): boolean;
|
|
15
15
|
hasLanguage(language: Language): boolean;
|
|
16
16
|
getPage(language: Language): PageSummary.PageRef | undefined;
|
|
17
|
-
getClosestPageRef(language: Language, fallback?: Language):
|
|
17
|
+
getClosestPageRef(language: Language, fallback?: Language): IPage.Ref;
|
|
18
18
|
isInGroup({ template, region }: PageSummary.IsInGroupArgs): boolean;
|
|
19
19
|
}
|
|
20
20
|
export declare namespace PageSummary {
|
|
@@ -10,6 +10,7 @@ export * from './CollectionSummary';
|
|
|
10
10
|
export * from './Collections';
|
|
11
11
|
export * from './IAssetStore';
|
|
12
12
|
export * from './ICollectionStore';
|
|
13
|
+
export * from './IPage';
|
|
13
14
|
export * from './IPageRefStore';
|
|
14
15
|
export * from './ITagged';
|
|
15
16
|
export * from './Item';
|
|
@@ -26,6 +26,7 @@ __exportStar(require("./CollectionSummary"), exports);
|
|
|
26
26
|
__exportStar(require("./Collections"), exports);
|
|
27
27
|
__exportStar(require("./IAssetStore"), exports);
|
|
28
28
|
__exportStar(require("./ICollectionStore"), exports);
|
|
29
|
+
__exportStar(require("./IPage"), exports);
|
|
29
30
|
__exportStar(require("./IPageRefStore"), exports);
|
|
30
31
|
__exportStar(require("./ITagged"), exports);
|
|
31
32
|
__exportStar(require("./Item"), exports);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function usePossiblePage(newPage?:
|
|
3
|
-
export declare function usePage(newPage?:
|
|
1
|
+
import { IPage } from '../domain';
|
|
2
|
+
export declare function usePossiblePage(newPage?: IPage): IPage | undefined;
|
|
3
|
+
export declare function usePage(newPage?: IPage): IPage;
|
|
4
4
|
export declare const PageContext: import("react").Context<PageContext.Data>;
|
|
5
5
|
export declare namespace PageContext {
|
|
6
6
|
type Data = {
|
|
7
|
-
page?:
|
|
7
|
+
page?: IPage;
|
|
8
8
|
};
|
|
9
9
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Schema } from '@nascentdigital/funnel-core';
|
|
2
|
-
export declare function usePageRef(pageId?: Schema.Page.Id): import("..").
|
|
2
|
+
export declare function usePageRef(pageId?: Schema.Page.Id): import("..").IPage.Ref | undefined;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { PageClient, Pagination } from '@nascentdigital/funnel-cms';
|
|
2
2
|
import { EventBus, PartialBy } from '@nascentdigital/funnel-core';
|
|
3
3
|
import { EditorApiClient } from '../client';
|
|
4
|
-
import { Page } from '../domain';
|
|
4
|
+
import { Page, IPage } from '../domain';
|
|
5
5
|
import { PageTarget } from './PageTarget';
|
|
6
6
|
export declare class PageRepository {
|
|
7
7
|
readonly editorApi: EditorApiClient;
|
|
8
8
|
constructor(editorApi: EditorApiClient);
|
|
9
|
-
search(args: PageRepository.SearchArgs): Promise<Pagination.Paginated<
|
|
9
|
+
search(args: PageRepository.SearchArgs): Promise<Pagination.Paginated<IPage.Ref>>;
|
|
10
10
|
load(args: PageRepository.LoadArgs): Promise<Page.WithSummary | undefined>;
|
|
11
11
|
create({ eventBus, name, ...args }: PageRepository.CreateNewArgs): Promise<Page.WithSummary>;
|
|
12
12
|
createLanguage(args: PageRepository.CreateLanguageArgs): Promise<Page.WithSummary>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventBus, Schema } from '@nascentdigital/funnel-core';
|
|
2
|
-
import { Page } from '../domain';
|
|
2
|
+
import { Block, Page, Section, SectionBlock } from '../domain';
|
|
3
3
|
import { PageTarget } from './PageTarget';
|
|
4
4
|
export declare namespace PageSerializer {
|
|
5
5
|
type DeserializePageWithSummaryArgs = Schema.Page.Data.AsGroup & PageTarget & {
|
|
@@ -12,4 +12,37 @@ export declare namespace PageSerializer {
|
|
|
12
12
|
eventBus: EventBus;
|
|
13
13
|
};
|
|
14
14
|
function deserializePage({ flattenedPage, target, eventBus }: DeserializePageArgs): Page;
|
|
15
|
+
type DeserializeContentArgs = {
|
|
16
|
+
key: string;
|
|
17
|
+
eventBus: EventBus;
|
|
18
|
+
schema: Schema.Section | Schema.Block;
|
|
19
|
+
content: Schema.Section.Data | Schema.Block.Data | undefined;
|
|
20
|
+
snapshot: Schema.Section.Data | Schema.Block.Data | undefined;
|
|
21
|
+
};
|
|
22
|
+
function deserializeContent({ key, schema, content, eventBus, snapshot }: DeserializeContentArgs): Block | Section;
|
|
23
|
+
type DeserializeSectionArgs = {
|
|
24
|
+
key: string;
|
|
25
|
+
eventBus: EventBus;
|
|
26
|
+
schema: Schema.Section;
|
|
27
|
+
content: Schema.Section.Data | undefined;
|
|
28
|
+
snapshot: Schema.Section.Data | undefined;
|
|
29
|
+
};
|
|
30
|
+
function deserializeSection({ key, eventBus, schema, content, snapshot }: DeserializeSectionArgs): Section;
|
|
31
|
+
type DeserializeSectionBlockArgs = {
|
|
32
|
+
id: string;
|
|
33
|
+
key: string;
|
|
34
|
+
eventBus: EventBus;
|
|
35
|
+
schema: Schema.Block;
|
|
36
|
+
content: Schema.Section.Data.ForBlock | undefined;
|
|
37
|
+
snapshot: Schema.Section.Data.ForBlock | undefined;
|
|
38
|
+
};
|
|
39
|
+
function deserializeSectionBlock({ id, key, eventBus, schema, content, snapshot }: DeserializeSectionBlockArgs): SectionBlock;
|
|
40
|
+
type DeserializeBlockArgs = {
|
|
41
|
+
key: string;
|
|
42
|
+
eventBus: EventBus;
|
|
43
|
+
schema: Schema.Block;
|
|
44
|
+
content: Schema.Block.Data | undefined;
|
|
45
|
+
snapshot: Schema.Block.Data | undefined;
|
|
46
|
+
};
|
|
47
|
+
function deserializeBlock({ key, eventBus, schema, content: blockContent, snapshot }: DeserializeBlockArgs): Block;
|
|
15
48
|
}
|