@nascentdigital/funnel-editor 4.5.6 → 4.6.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.
- package/dist/collection/hooks/CollectionController.d.ts +1 -1
- package/dist/core/components/ColorModeToggle.js +6 -4
- package/dist/core/components/Header.js +3 -2
- package/dist/core/components/UserEditor.d.ts +2 -2
- package/dist/core/components/feedback/Badge.d.ts +2 -1
- package/dist/core/components/feedback/Badge.js +4 -3
- package/dist/core/components/fields/DynamicPagesEditor.js +7 -6
- package/dist/core/components/fields/EmptyFieldCard.js +4 -4
- package/dist/core/components/fields/FieldCardLayout.js +5 -5
- package/dist/core/components/fields/FieldHeader.js +3 -2
- package/dist/core/components/fields/FieldsPanel.js +4 -4
- package/dist/core/components/fields/FormEditor.js +5 -4
- package/dist/core/components/fields/asset/AssetEditor.d.ts +3 -2
- package/dist/core/components/fields/asset/AssetEditor.js +1 -1
- package/dist/core/components/fields/asset/AssetUploader.d.ts +3 -2
- package/dist/core/components/fields/asset/AssetUploader.js +1 -1
- package/dist/core/components/fields/collection/CollectionCard.js +1 -11
- package/dist/core/components/fields/collection/CollectionPicker.js +3 -2
- package/dist/core/components/fields/collection/previews/index.d.ts +0 -1
- package/dist/core/components/fields/collection/previews/index.js +0 -1
- package/dist/core/components/fields/embed/EmbeddedVideoEditor.d.ts +2 -2
- package/dist/core/components/fields/factories/AssetFactory.d.ts +1 -1
- package/dist/core/components/fields/factories/CollectionFactory.d.ts +1 -1
- package/dist/core/components/fields/factories/EmbeddedVideoFactory.d.ts +2 -2
- package/dist/core/components/fields/factories/FieldValueFactory.d.ts +1 -1
- package/dist/core/components/fields/factories/FieldValueFactory.js +1 -1
- package/dist/core/components/fields/factories/LinkFactory.d.ts +2 -2
- package/dist/core/components/fields/factories/TextFactory.d.ts +2 -2
- package/dist/core/components/fields/form/FormFieldEditor.d.ts +3 -2
- package/dist/core/components/fields/index.d.ts +1 -0
- package/dist/core/components/fields/index.js +1 -0
- package/dist/core/components/fields/link/LinkEditor.d.ts +2 -2
- package/dist/core/components/fields/link/LinkEditor.js +4 -0
- package/dist/core/components/fields/list/CreateFieldButton.d.ts +1 -1
- package/dist/core/components/fields/list/CreateFieldButton.js +4 -5
- package/dist/core/components/fields/list/CreateFieldCard.js +4 -4
- package/dist/core/components/fields/page/PagePicker.js +4 -2
- package/dist/core/components/fields/richtext/FloatingToolbarPlugin.js +3 -2
- package/dist/core/components/fields/richtext/LinkEditor.js +17 -4
- package/dist/core/components/fields/richtext/LinkPopup.js +11 -7
- package/dist/core/components/interaction/AvatarButton.d.ts +2 -1
- package/dist/core/components/interaction/AvatarButton.js +3 -2
- package/dist/core/components/interaction/Button.d.ts +2 -0
- package/dist/core/components/interaction/Button.js +3 -2
- package/dist/core/components/interaction/Combobox.js +2 -2
- package/dist/core/components/interaction/IconButton.d.ts +2 -0
- package/dist/core/components/interaction/IconButton.js +3 -2
- package/dist/core/components/interaction/IconLink.d.ts +1 -1
- package/dist/core/components/interaction/MiniEditor.d.ts +3 -2
- package/dist/core/components/interaction/MiniEditor.js +7 -5
- package/dist/core/components/interaction/Popup.d.ts +20 -15
- package/dist/core/components/interaction/Popup.js +63 -66
- package/dist/core/components/interaction/QuickInput.js +2 -0
- package/dist/core/components/interaction/QuickPicker.d.ts +1 -0
- package/dist/core/components/interaction/QuickPicker.js +5 -5
- package/dist/core/components/interaction/Tabs.d.ts +5 -1
- package/dist/core/components/interaction/Tabs.js +18 -8
- package/dist/core/components/interaction/menu/useMenuController.d.ts +2 -2
- package/dist/core/components/interaction/table/TableItem.d.ts +2 -1
- package/dist/core/components/interaction/table/TableItem.js +5 -3
- package/dist/core/components/layout/InfoPanel.js +4 -2
- package/dist/core/components/visuals/Icon.d.ts +1 -1
- package/dist/core/components/visuals/Icon.js +6 -0
- package/dist/core/components/visuals/index.d.ts +0 -1
- package/dist/core/components/visuals/index.js +0 -1
- package/dist/core/domain/Block.d.ts +4 -0
- package/dist/core/domain/Block.js +7 -0
- package/dist/core/domain/BlockConfiguration.d.ts +11 -3
- package/dist/core/domain/BlockConfiguration.js +77 -14
- package/dist/core/domain/CollectionBrowser.d.ts +2 -2
- package/dist/core/domain/CollectionFieldProxy.d.ts +7 -2
- package/dist/core/domain/CollectionFieldProxy.js +55 -66
- package/dist/core/domain/SectionBlock.d.ts +5 -0
- package/dist/core/domain/SectionBlock.js +15 -0
- package/dist/core/hooks/useBlockConfiguration.d.ts +7 -1
- package/dist/core/hooks/useBlockConfiguration.js +8 -1
- package/dist/core/hooks/usePage.d.ts +2 -2
- package/dist/core/hooks/usePage.js +5 -4
- package/dist/core/repository/CollectionRepository.js +1 -1
- package/dist/core/repository/CollectionSerializer.d.ts +3 -2
- package/dist/core/repository/CollectionSerializer.js +12 -7
- package/dist/core/repository/PageRepository.js +2 -2
- package/dist/core/repository/PageSerializer.d.ts +5 -3
- package/dist/core/repository/PageSerializer.js +10 -11
- package/dist/explore/components/CreateCollectionDialog.d.ts +2 -3
- package/dist/explore/components/CreateCollectionDialog.js +1 -1
- package/dist/explore/components/CreatePageDialog.d.ts +3 -3
- package/dist/explore/components/CreatePageDialog.js +2 -2
- package/dist/explore/screens/CollectionExplorer.js +4 -4
- package/dist/explore/screens/PageExplorer.js +4 -4
- package/dist/page/components/BlockEditor.js +10 -2
- package/dist/page/components/config/BlockConfigButton.d.ts +8 -0
- package/dist/page/components/config/BlockConfigButton.js +320 -0
- package/dist/page/components/config/BlockConfigurationProvider.d.ts +8 -0
- package/dist/page/components/config/BlockConfigurationProvider.js +17 -0
- package/dist/page/components/config/LegacyBlockPreview.d.ts +8 -0
- package/dist/page/components/config/{BlockPreview.js → LegacyBlockPreview.js} +30 -40
- package/dist/page/components/config/index.d.ts +3 -1
- package/dist/page/components/config/index.js +3 -1
- package/dist/page/components/index.d.ts +1 -1
- package/dist/page/components/index.js +1 -1
- package/dist/page/components/nav/NavSection.js +4 -3
- package/dist/page/components/panels/BlockConfigPanel.d.ts +1 -0
- package/dist/page/components/panels/BlockConfigPanel.js +25 -0
- package/dist/page/components/{PageStatus.d.ts → panels/PageStatus.d.ts} +3 -3
- package/dist/page/components/{PageStatus.js → panels/PageStatus.js} +10 -14
- package/dist/page/components/panels/index.d.ts +2 -0
- package/dist/page/components/{status → panels}/index.js +2 -1
- package/dist/page/hooks/PageController.d.ts +2 -2
- package/dist/page/screens/PageEditor.js +8 -1
- package/dist/styles/index.css +174 -56
- package/dist/styles/tailwind.js +7 -3
- package/dist/users/screens/UserExplorer.js +7 -6
- package/package.json +3 -2
- package/dist/core/components/fields/collection/previews/ClientPreview.d.ts +0 -10
- package/dist/core/components/fields/collection/previews/ClientPreview.js +0 -29
- package/dist/core/components/visuals/SkeletonLayout.d.ts +0 -9
- package/dist/core/components/visuals/SkeletonLayout.js +0 -429
- package/dist/page/components/config/BlockConfig.d.ts +0 -8
- package/dist/page/components/config/BlockConfig.js +0 -28
- package/dist/page/components/config/BlockConfigEditor.d.ts +0 -9
- package/dist/page/components/config/BlockConfigEditor.js +0 -114
- package/dist/page/components/config/BlockPreview.d.ts +0 -10
- package/dist/page/components/config/BlockView.d.ts +0 -4
- package/dist/page/components/config/BlockView.js +0 -9
- package/dist/page/components/config/LegacyBlockConfigEditor.d.ts +0 -9
- package/dist/page/components/config/LegacyBlockConfigEditor.js +0 -27
- package/dist/page/components/config/ListPanelEditor.d.ts +0 -8
- package/dist/page/components/config/ListPanelEditor.js +0 -89
- package/dist/page/components/config/MessagePanelEditor.d.ts +0 -8
- package/dist/page/components/config/MessagePanelEditor.js +0 -17
- package/dist/page/components/config/VisualPanelEditor.d.ts +0 -8
- package/dist/page/components/config/VisualPanelEditor.js +0 -76
- package/dist/page/components/status/index.d.ts +0 -1
- /package/dist/page/components/{status → panels}/AutoSave.d.ts +0 -0
- /package/dist/page/components/{status → panels}/AutoSave.js +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BlockConfiguration } from '../../../core';
|
|
2
|
+
export declare function LegacyBlockPreview({ className, configuration }: LegacyBlockPreview.Props): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare namespace LegacyBlockPreview {
|
|
4
|
+
type Props = {
|
|
5
|
+
className?: string;
|
|
6
|
+
configuration: BlockConfiguration;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
@@ -14,53 +14,45 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.LegacyBlockPreview = LegacyBlockPreview;
|
|
18
18
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
20
20
|
const classnames_1 = __importDefault(require("classnames"));
|
|
21
|
-
const react_1 = require("react");
|
|
21
|
+
const react_1 = require("motion/react");
|
|
22
|
+
const react_2 = require("react");
|
|
22
23
|
const core_1 = require("../../../core");
|
|
23
|
-
const ListPanelEditor_1 = require("./ListPanelEditor");
|
|
24
|
-
const MessagePanelEditor_1 = require("./MessagePanelEditor");
|
|
25
|
-
const VisualPanelEditor_1 = require("./VisualPanelEditor");
|
|
26
|
-
const react_2 = require("motion/react");
|
|
27
24
|
// component
|
|
28
|
-
function
|
|
25
|
+
function LegacyBlockPreview({ className, configuration }) {
|
|
29
26
|
// bind props + state + refs
|
|
30
|
-
const { layout } = configuration;
|
|
31
|
-
const
|
|
32
|
-
const previewRef = (0, react_1.useRef)(null);
|
|
27
|
+
const { scope, layout } = configuration;
|
|
28
|
+
const previewRef = (0, react_2.useRef)(null);
|
|
33
29
|
// sync configuration
|
|
34
30
|
(0, core_1.useBlockConfiguration)(configuration);
|
|
35
|
-
// helpers
|
|
36
|
-
const onPanelClick = (panel) => {
|
|
37
|
-
setEditingPanel(panel.type);
|
|
38
|
-
};
|
|
39
31
|
// render
|
|
40
|
-
const tight =
|
|
32
|
+
const tight = scope === 'mobile'
|
|
41
33
|
? layout === null || layout === void 0 ? void 0 : layout.tight.mobile
|
|
42
34
|
: layout === null || layout === void 0 ? void 0 : layout.tight.desktop;
|
|
43
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(react_1.motion.div, { ref: previewRef, className: (0, classnames_1.default)(className, 'w-full flex justify-center'), layout: true, children: (0, jsx_runtime_1.jsx)(react_1.motion.div, { className: (0, classnames_1.default)('bg-surface2 rounded-xs', {
|
|
36
|
+
'min-h-[100px]': !layout,
|
|
37
|
+
'w-[120px]': scope === 'desktop',
|
|
38
|
+
'w-[64px]': scope === 'mobile',
|
|
39
|
+
'pb-l4': tight === 'above',
|
|
40
|
+
'pt-l4': tight === 'below',
|
|
41
|
+
'py-l4': tight === 'none'
|
|
42
|
+
}), layoutRoot: true, layout: true, children: renderLayout({ variant: scope, layout }) }) }) }));
|
|
51
43
|
}
|
|
52
44
|
// helpers
|
|
53
45
|
var Skeleton;
|
|
54
46
|
(function (Skeleton) {
|
|
55
47
|
function HeadlinePart({ className, size }) {
|
|
56
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(react_1.motion.div, { className: (0, classnames_1.default)(className, 'bg-ix-primary rounded-xxs overflow-hidden', {
|
|
57
49
|
'h-6 ': size === 'sm',
|
|
58
50
|
'h-8': size === 'md'
|
|
59
51
|
}), layout: true }));
|
|
60
52
|
}
|
|
61
53
|
Skeleton.HeadlinePart = HeadlinePart;
|
|
62
54
|
function CaptionPart({ className, size }) {
|
|
63
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
55
|
+
return ((0, jsx_runtime_1.jsx)(react_1.motion.div, { className: (0, classnames_1.default)(className, 'h-4 bg-draft/tint3 rounded-px overflow-hidden', {
|
|
64
56
|
'': size === 'sm'
|
|
65
57
|
}), layout: true }));
|
|
66
58
|
}
|
|
@@ -94,14 +86,14 @@ var Skeleton;
|
|
|
94
86
|
}
|
|
95
87
|
Skeleton.LogoPart = LogoPart;
|
|
96
88
|
})(Skeleton || (Skeleton = {}));
|
|
97
|
-
function renderLayout({ className, variant, layout
|
|
89
|
+
function renderLayout({ className, variant, layout }) {
|
|
98
90
|
// TODO: render empty state if there's no layout
|
|
99
91
|
if (!layout) {
|
|
100
92
|
return null;
|
|
101
93
|
}
|
|
102
94
|
// render root layout
|
|
103
95
|
const { type, items } = layout.root;
|
|
104
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
96
|
+
return ((0, jsx_runtime_1.jsx)(react_1.motion.div, { className: getContainerClasses({ className, variant, siblingCount: 1, item: layout.root }), layout: true, children: items.map((item, parentOffset) => (0, jsx_runtime_1.jsx)(react_2.Fragment, { children: renderItem({
|
|
105
97
|
className: (0, classnames_1.default)({
|
|
106
98
|
'flex-1': type === 'row' && variant !== 'mobile'
|
|
107
99
|
}),
|
|
@@ -114,18 +106,17 @@ function renderLayout({ className, variant, layout, onPanelClick }) {
|
|
|
114
106
|
parent: type,
|
|
115
107
|
parentOffset,
|
|
116
108
|
parentSize: items.length
|
|
117
|
-
})
|
|
118
|
-
onPanelClick
|
|
109
|
+
})
|
|
119
110
|
}) }, `${item.type}.${parentOffset}`)) }));
|
|
120
111
|
}
|
|
121
|
-
function renderItem({ className, parent, parentNested, siblingCount, variant, item, itemPosition
|
|
112
|
+
function renderItem({ className, parent, parentNested, siblingCount, variant, item, itemPosition }) {
|
|
122
113
|
// render item
|
|
123
114
|
const { type: itemType } = item;
|
|
124
115
|
switch (itemType) {
|
|
125
116
|
case 'row':
|
|
126
117
|
case 'column':
|
|
127
118
|
case 'stack':
|
|
128
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
119
|
+
return ((0, jsx_runtime_1.jsx)(react_1.motion.div, { className: getContainerClasses({ className, parent, siblingCount, variant, item }), layout: true, children: item.items.map((item, parentOffset, items) => (0, jsx_runtime_1.jsx)(react_2.Fragment, { children: renderItem({
|
|
129
120
|
className: (0, classnames_1.default)({
|
|
130
121
|
'flex-1': itemType === 'row'
|
|
131
122
|
}),
|
|
@@ -138,17 +129,16 @@ function renderItem({ className, parent, parentNested, siblingCount, variant, it
|
|
|
138
129
|
parent: itemType,
|
|
139
130
|
parentOffset,
|
|
140
131
|
parentSize: items.length
|
|
141
|
-
})
|
|
142
|
-
onPanelClick
|
|
132
|
+
})
|
|
143
133
|
}) }, `${item.type}.${parentOffset}`)) }));
|
|
144
134
|
case 'message':
|
|
145
|
-
return renderMessage({ className, parent, parentNested, siblingCount, variant, item, itemPosition
|
|
135
|
+
return renderMessage({ className, parent, parentNested, siblingCount, variant, item, itemPosition });
|
|
146
136
|
case 'visual':
|
|
147
|
-
return renderVisual({ className, parent, parentNested, siblingCount, variant, item, itemPosition
|
|
137
|
+
return renderVisual({ className, parent, parentNested, siblingCount, variant, item, itemPosition });
|
|
148
138
|
case 'list':
|
|
149
|
-
return renderList({ className, parent, parentNested, siblingCount, variant, item, itemPosition
|
|
139
|
+
return renderList({ className, parent, parentNested, siblingCount, variant, item, itemPosition });
|
|
150
140
|
default:
|
|
151
|
-
console.error('[
|
|
141
|
+
console.error('[BlockPreview] no support for BlockLayout item', item);
|
|
152
142
|
return null;
|
|
153
143
|
}
|
|
154
144
|
}
|
|
@@ -216,7 +206,7 @@ function renderList(args) {
|
|
|
216
206
|
const itemCount = variant === 'mobile'
|
|
217
207
|
? itemCountRaw.mobile
|
|
218
208
|
: itemCountRaw.desktop;
|
|
219
|
-
return ((0, jsx_runtime_1.jsx)(EditablePanel, Object.assign({}, args, { panelClassName: getListPanelClasses(args), children: funnel_core_1.ArrayUtils.series(itemCount, 1).map(row => (0, jsx_runtime_1.jsx)(
|
|
209
|
+
return ((0, jsx_runtime_1.jsx)(EditablePanel, Object.assign({}, args, { panelClassName: getListPanelClasses(args), children: funnel_core_1.ArrayUtils.series(itemCount, 1).map(row => (0, jsx_runtime_1.jsx)(react_2.Fragment, { children: renderListItem({ variant, parent, parentNested, layout, itemType, index: row, count: itemCount }) }, `list.${row}`)) })));
|
|
220
210
|
}
|
|
221
211
|
function getListPanelClasses(args) {
|
|
222
212
|
// resolve props
|
|
@@ -332,7 +322,7 @@ function renderGrid(args) {
|
|
|
332
322
|
: itemCountRaw.desktop;
|
|
333
323
|
const { panelClassName, panelItemClassName } = getGridPanelClasses(args);
|
|
334
324
|
// render grid (really a flexbox layout with controlled item widths)
|
|
335
|
-
return ((0, jsx_runtime_1.jsx)(EditablePanel, Object.assign({}, args, { panelClassName: panelClassName, children: funnel_core_1.ArrayUtils.series(itemCount, 1).map(row => (0, jsx_runtime_1.jsx)(
|
|
325
|
+
return ((0, jsx_runtime_1.jsx)(EditablePanel, Object.assign({}, args, { panelClassName: panelClassName, children: funnel_core_1.ArrayUtils.series(itemCount, 1).map(row => (0, jsx_runtime_1.jsx)(react_2.Fragment, { children: renderListItem({
|
|
336
326
|
className: panelItemClassName,
|
|
337
327
|
variant,
|
|
338
328
|
parent,
|
|
@@ -443,7 +433,7 @@ function getPanelClasses({ className, variant, parent, parentNested, item: { ali
|
|
|
443
433
|
function EditablePanel(_a) {
|
|
444
434
|
var { panelClassName, children } = _a, args = __rest(_a, ["panelClassName", "children"]);
|
|
445
435
|
// render
|
|
446
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
436
|
+
return ((0, jsx_runtime_1.jsx)(react_1.motion.div, { className: getPanelWrapClasses(args), layout: true, layoutId: args.item.key, children: (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(panelClassName, 'relative'), children: children }) }, args.item.key));
|
|
447
437
|
}
|
|
448
438
|
// TODO: scrap this
|
|
449
439
|
class ItemPosition {
|
|
@@ -14,4 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./BlockConfigButton"), exports);
|
|
18
|
+
__exportStar(require("./BlockConfigurationProvider"), exports);
|
|
19
|
+
__exportStar(require("./LegacyBlockPreview"), exports);
|
|
@@ -14,10 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./panels"), exports);
|
|
17
18
|
__exportStar(require("./BlockEditor"), exports);
|
|
18
19
|
__exportStar(require("./PageHeader"), exports);
|
|
19
20
|
__exportStar(require("./PageNav"), exports);
|
|
20
21
|
__exportStar(require("./PageNotCreated"), exports);
|
|
21
22
|
__exportStar(require("./PageNotFound"), exports);
|
|
22
|
-
__exportStar(require("./PageStatus"), exports);
|
|
23
23
|
__exportStar(require("./SettingsEditor"), exports);
|
|
@@ -18,12 +18,13 @@ function NavSection({ className, section, selectedItem, onSelectItem }) {
|
|
|
18
18
|
label: block.name,
|
|
19
19
|
icon: core_1.BlockIcon.resolve(block.schema)
|
|
20
20
|
})), [availableBlocks]);
|
|
21
|
+
const anchorId = (0, react_1.useId)();
|
|
21
22
|
const menu = (0, core_1.useMenuController)(items);
|
|
22
23
|
// helpers
|
|
23
|
-
const onOpenBlockMenu = (
|
|
24
|
+
const onOpenBlockMenu = () => {
|
|
24
25
|
// open menu
|
|
25
26
|
menu.selectedItem = undefined;
|
|
26
|
-
menu.open(
|
|
27
|
+
menu.open(anchorId);
|
|
27
28
|
};
|
|
28
29
|
const onAddBlock = (identifier) => {
|
|
29
30
|
// add block
|
|
@@ -41,5 +42,5 @@ function NavSection({ className, section, selectedItem, onSelectItem }) {
|
|
|
41
42
|
};
|
|
42
43
|
// render
|
|
43
44
|
return ((0, jsx_runtime_1.jsxs)("div", { id: section.identifier, className: (0, classnames_1.default)(className, 'flex flex-col gap-l4 p-l5 bg-surface2 rounded-sm'), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center", children: [(0, jsx_runtime_1.jsx)("h3", { className: "heading-xs", children: name }), menu.items.length > 0 &&
|
|
44
|
-
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(core_1.IconButton, { variant: "util", icon: "Plus", size: "sm", onClick: e => onOpenBlockMenu(
|
|
45
|
+
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(core_1.IconButton, { anchorId: anchorId, variant: "util", icon: "Plus", size: "sm", onClick: e => onOpenBlockMenu() }), (0, jsx_runtime_1.jsx)(core_1.Menu, { title: "Add Block", placement: "bottom", controller: menu, onItemClick: onAddBlock })] })] }), (0, jsx_runtime_1.jsx)(core_1.Sortable, { className: "flex flex-col gap-l5", enableItemClick: true, items: section.blocks, renderItem: block => (0, jsx_runtime_1.jsx)(NavBlock_1.NavBlock, { block: block, selectedItem: selectedItem, onSelectItem: onSelectItem, draggable: true }, block.identifier), onChange: onOrderChange })] }));
|
|
45
46
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function BlockConfigPanel(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BlockConfigPanel = BlockConfigPanel;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("motion/react");
|
|
6
|
+
const core_1 = require("../../../core");
|
|
7
|
+
const config_1 = require("../config");
|
|
8
|
+
// panel
|
|
9
|
+
function BlockConfigPanel() {
|
|
10
|
+
// bind state + hooks
|
|
11
|
+
const configuration = (0, core_1.useBlockConfiguration)();
|
|
12
|
+
// skip if there's no config (shouldn't happen)
|
|
13
|
+
if (!configuration || !configuration.hasPanels) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
// render
|
|
17
|
+
const { scope } = configuration;
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(core_1.FadeIn, { layout: true, children: (0, jsx_runtime_1.jsxs)("div", { className: "h-full flex flex-col gap-l6 p-l7 bg-surface1 rounded-xxl", children: [(0, jsx_runtime_1.jsx)(core_1.Tabs, { variant: "highlighted", size: "sm", items: blockScopes, selectedItem: scope, onSelect: scope => configuration.scope = scope }), (0, jsx_runtime_1.jsx)(react_1.motion.section, { className: "p-l6 bg-surface-placeholder-raised rounded-md", layout: true, children: configuration &&
|
|
19
|
+
(0, jsx_runtime_1.jsx)(config_1.LegacyBlockPreview, { configuration: configuration }) }), (0, jsx_runtime_1.jsx)(config_1.BlockConfigButton, { target: "block" })] }) }, "block.config"));
|
|
20
|
+
}
|
|
21
|
+
// helpers
|
|
22
|
+
const blockScopes = [
|
|
23
|
+
{ id: 'desktop', label: 'Desktop' },
|
|
24
|
+
{ id: 'mobile', label: 'Mobile' },
|
|
25
|
+
];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Callback } from '@nascentdigital/funnel-core';
|
|
2
|
-
import { Block, PageSettings, Section, SectionBlock } from '
|
|
3
|
-
export declare function PageStatus({
|
|
2
|
+
import { Block, Page, PageSettings, Section, SectionBlock } from '../../../core';
|
|
3
|
+
export declare function PageStatus({ page, onSelectItem }: PageStatus.Props): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export declare namespace PageStatus {
|
|
5
5
|
type Props = {
|
|
6
|
-
|
|
6
|
+
page: Page;
|
|
7
7
|
selectedItem: Block | SectionBlock | Section | PageSettings | undefined;
|
|
8
8
|
onSelectItem: Callback<Block | SectionBlock | Section | PageSettings>;
|
|
9
9
|
};
|
|
@@ -8,31 +8,27 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
8
8
|
const funnel_cms_1 = require("@nascentdigital/funnel-cms");
|
|
9
9
|
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
10
10
|
const classnames_1 = __importDefault(require("classnames"));
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const status_1 = require("./status");
|
|
11
|
+
const core_1 = require("../../../core");
|
|
12
|
+
const hooks_1 = require("../../hooks");
|
|
13
|
+
const AutoSave_1 = require("./AutoSave");
|
|
15
14
|
// component
|
|
16
|
-
function PageStatus({
|
|
15
|
+
function PageStatus({ page, onSelectItem }) {
|
|
17
16
|
// bind hooks
|
|
18
17
|
const router = (0, core_1.useEditorRouter)();
|
|
19
18
|
const editorApi = (0, core_1.useEditorApi)();
|
|
20
19
|
const controller = (0, hooks_1.usePageController)();
|
|
21
|
-
const page = (0, core_1.usePossiblePage)();
|
|
22
20
|
const dialog = (0, core_1.useDialog)();
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
21
|
+
// sync with page
|
|
22
|
+
(0, core_1.usePage)(page);
|
|
27
23
|
// render
|
|
28
|
-
return
|
|
24
|
+
return renderStatus({ router, editorApi, controller, page, dialog, onSelectItem });
|
|
29
25
|
}
|
|
30
26
|
function renderStatus(args) {
|
|
31
27
|
// render unchanged
|
|
32
28
|
const { page, onSelectItem } = args;
|
|
33
29
|
if (page.state === 'published') {
|
|
34
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(core_1.FadeIn, { children: renderLiveUnchanged(args) }, "live"), page.modified &&
|
|
35
|
-
(0, jsx_runtime_1.jsx)(core_1.FadeIn, { children: (0, jsx_runtime_1.jsx)(
|
|
30
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(core_1.FadeIn, { layout: true, children: renderLiveUnchanged(args) }, "live"), page.modified &&
|
|
31
|
+
(0, jsx_runtime_1.jsx)(core_1.FadeIn, { layout: true, children: (0, jsx_runtime_1.jsx)(AutoSave_1.AutoSave, { className: "mt-l8" }) }, "live-status")] }));
|
|
36
32
|
}
|
|
37
33
|
// or draft invalid/valid
|
|
38
34
|
let status;
|
|
@@ -56,7 +52,7 @@ function renderStatus(args) {
|
|
|
56
52
|
(0, jsx_runtime_1.jsxs)("section", { className: "flex flex-col gap-l4 p-l7 bg-surface1 rounded-xxl", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-l2", children: [(0, jsx_runtime_1.jsx)("h4", { className: "heading-xs text-content-primary", children: "Changes" }), (0, jsx_runtime_1.jsx)(core_1.CountBadge, { variant: "secondary", count: changedBlocks.length })] }), (0, jsx_runtime_1.jsx)("p", { className: "body-sm text-content-secondary text-pretty", children: "These sections have been updated:" }), (0, jsx_runtime_1.jsx)("ul", { className: "flex flex-wrap gap-l4", children: changedBlocks.map(item => (0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)(core_1.StatusChip, { variant: "info", onClick: () => onSelectItem(item), children: item.name }) }, item.identifier)) })] })] }));
|
|
57
53
|
}
|
|
58
54
|
// return packaged item
|
|
59
|
-
return ((0, jsx_runtime_1.jsxs)(core_1.FadeIn, { children: [status, (0, jsx_runtime_1.jsx)(
|
|
55
|
+
return ((0, jsx_runtime_1.jsxs)(core_1.FadeIn, { layout: true, children: [status, (0, jsx_runtime_1.jsx)(AutoSave_1.AutoSave, { className: "mt-l8" })] }, `${publishedOn ? 'updated' : 'draft'}/${invalid ? 'invalid' : 'valid'}`));
|
|
60
56
|
}
|
|
61
57
|
function renderDraftInvalid(args) {
|
|
62
58
|
// bind props
|
|
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./BlockConfigPanel"), exports);
|
|
18
|
+
__exportStar(require("./PageStatus"), exports);
|
|
@@ -18,8 +18,8 @@ export declare class PageController {
|
|
|
18
18
|
get ready(): boolean;
|
|
19
19
|
get target(): PageController.Target;
|
|
20
20
|
get region(): string;
|
|
21
|
-
get language(): "
|
|
22
|
-
get languages(): ("
|
|
21
|
+
get language(): "cy" | "fr" | "fy" | "to" | "br" | "hr" | "li" | "th" | "tr" | "id" | "is" | "tw" | "no" | "aa" | "ab" | "ae" | "af" | "ak" | "am" | "an" | "ar" | "as" | "av" | "ay" | "az" | "ba" | "be" | "bg" | "bh" | "bi" | "bm" | "bn" | "bo" | "bs" | "ca" | "ce" | "ch" | "co" | "cr" | "cs" | "cu" | "cv" | "da" | "de" | "dv" | "dz" | "ee" | "el" | "en" | "eo" | "es" | "et" | "eu" | "fa" | "ff" | "fi" | "fj" | "fo" | "ga" | "gd" | "gl" | "gn" | "gu" | "gv" | "ha" | "he" | "hi" | "ho" | "ht" | "hu" | "hy" | "hz" | "ia" | "ie" | "ig" | "ii" | "ik" | "io" | "it" | "iu" | "ja" | "jv" | "ka" | "kg" | "ki" | "kj" | "kk" | "kl" | "km" | "kn" | "ko" | "kr" | "ks" | "ku" | "kv" | "kw" | "ky" | "la" | "lb" | "lg" | "ln" | "lo" | "lt" | "lu" | "lv" | "mg" | "mh" | "mi" | "mk" | "ml" | "mn" | "mr" | "ms" | "mt" | "my" | "na" | "nb" | "nd" | "ne" | "ng" | "nl" | "nn" | "nr" | "nv" | "ny" | "oc" | "oj" | "om" | "or" | "os" | "pa" | "pi" | "pl" | "ps" | "pt" | "qu" | "rm" | "rn" | "ro" | "ru" | "rw" | "sa" | "sc" | "sd" | "se" | "sg" | "si" | "sk" | "sl" | "sm" | "sn" | "so" | "sq" | "sr" | "ss" | "st" | "su" | "sv" | "sw" | "ta" | "te" | "tg" | "ti" | "tk" | "tl" | "tn" | "ts" | "tt" | "ty" | "ug" | "uk" | "ur" | "uz" | "ve" | "vi" | "vo" | "wa" | "wo" | "xh" | "yi" | "yo" | "za" | "zh" | "zu";
|
|
22
|
+
get languages(): ("cy" | "fr" | "fy" | "to" | "br" | "hr" | "li" | "th" | "tr" | "id" | "is" | "tw" | "no" | "aa" | "ab" | "ae" | "af" | "ak" | "am" | "an" | "ar" | "as" | "av" | "ay" | "az" | "ba" | "be" | "bg" | "bh" | "bi" | "bm" | "bn" | "bo" | "bs" | "ca" | "ce" | "ch" | "co" | "cr" | "cs" | "cu" | "cv" | "da" | "de" | "dv" | "dz" | "ee" | "el" | "en" | "eo" | "es" | "et" | "eu" | "fa" | "ff" | "fi" | "fj" | "fo" | "ga" | "gd" | "gl" | "gn" | "gu" | "gv" | "ha" | "he" | "hi" | "ho" | "ht" | "hu" | "hy" | "hz" | "ia" | "ie" | "ig" | "ii" | "ik" | "io" | "it" | "iu" | "ja" | "jv" | "ka" | "kg" | "ki" | "kj" | "kk" | "kl" | "km" | "kn" | "ko" | "kr" | "ks" | "ku" | "kv" | "kw" | "ky" | "la" | "lb" | "lg" | "ln" | "lo" | "lt" | "lu" | "lv" | "mg" | "mh" | "mi" | "mk" | "ml" | "mn" | "mr" | "ms" | "mt" | "my" | "na" | "nb" | "nd" | "ne" | "ng" | "nl" | "nn" | "nr" | "nv" | "ny" | "oc" | "oj" | "om" | "or" | "os" | "pa" | "pi" | "pl" | "ps" | "pt" | "qu" | "rm" | "rn" | "ro" | "ru" | "rw" | "sa" | "sc" | "sd" | "se" | "sg" | "si" | "sk" | "sl" | "sm" | "sn" | "so" | "sq" | "sr" | "ss" | "st" | "su" | "sv" | "sw" | "ta" | "te" | "tg" | "ti" | "tk" | "tl" | "tn" | "ts" | "tt" | "ty" | "ug" | "uk" | "ur" | "uz" | "ve" | "vi" | "vo" | "wa" | "wo" | "xh" | "yi" | "yo" | "za" | "zh" | "zu")[];
|
|
23
23
|
get templates(): Schema.Site.Pages;
|
|
24
24
|
get currentTemplate(): Schema.Page<Schema.Page.Content, string>;
|
|
25
25
|
get pageTarget(): PageController.Target | undefined;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.PageEditor = PageEditor;
|
|
4
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
8
|
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
9
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
6
10
|
const react_1 = require("motion/react");
|
|
7
11
|
const react_2 = require("react");
|
|
8
12
|
const core_1 = require("../../core");
|
|
9
13
|
const components_1 = require("../components");
|
|
14
|
+
const config_1 = require("../components/config");
|
|
10
15
|
const hooks_1 = require("../hooks");
|
|
11
16
|
// component
|
|
12
17
|
function PageEditor({ templateId, region, language, slug }) {
|
|
@@ -71,7 +76,9 @@ function PageEditor({ templateId, region, language, slug }) {
|
|
|
71
76
|
};
|
|
72
77
|
const onSelectItem = (item) => setItemId(item.identifier);
|
|
73
78
|
// render
|
|
74
|
-
return ((0, jsx_runtime_1.jsx)(hooks_1.PageControllerContext.Provider, { value: controllerContext, children: (0, jsx_runtime_1.jsx)(core_1.PageContext.Provider, { value: pageContext, children: (0, jsx_runtime_1.jsx)(core_1.AssetStoreContext.Provider, { value: page, children: (0, jsx_runtime_1.jsx)(core_1.CollectionStoreContext.Provider, { value: page, 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.PageHeader, { target: target, selectedItem: selectedItem, 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", children: (0, jsx_runtime_1.jsx)(components_1.PageNav, { selectedItem: selectedItem, onSelectItem: onSelectItem }) }), (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, page, selectedItem, onSelectItem }) }) }), (0, jsx_runtime_1.
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)(hooks_1.PageControllerContext.Provider, { value: controllerContext, children: (0, jsx_runtime_1.jsx)(core_1.PageContext.Provider, { value: pageContext, children: (0, jsx_runtime_1.jsx)(core_1.AssetStoreContext.Provider, { value: page, children: (0, jsx_runtime_1.jsx)(core_1.CollectionStoreContext.Provider, { value: page, children: (0, jsx_runtime_1.jsx)(core_1.PageRefStoreContext.Provider, { value: pageRefStoreProxy, children: (0, jsx_runtime_1.jsx)(config_1.BlockConfigurationProvider, { item: selectedItem, 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.PageHeader, { target: target, selectedItem: selectedItem, 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", children: (0, jsx_runtime_1.jsx)(components_1.PageNav, { selectedItem: selectedItem, onSelectItem: onSelectItem }) }), (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, page, selectedItem, onSelectItem }) }) }), (0, jsx_runtime_1.jsxs)(react_1.motion.section, { className: (0, classnames_1.default)('hidden lg:flex lg:w-[320px] shrink-0 overflow-y-scroll scrollbar-thin', 'flex-col gap-l8 pt-l9 px-l8 pb-l8'), layout: true, children: [(0, jsx_runtime_1.jsx)("h2", { className: "label-sm text-content-tertiary uppercase", children: "Inspector" }), (0, jsx_runtime_1.jsxs)(react_1.AnimatePresence, { mode: "popLayout", children: [page && selectedItem && (selectedItem instanceof core_1.Block || selectedItem instanceof core_1.SectionBlock) &&
|
|
80
|
+
(0, jsx_runtime_1.jsx)(components_1.BlockConfigPanel, {}, "block.config"), page && selectedItem &&
|
|
81
|
+
(0, jsx_runtime_1.jsx)(components_1.PageStatus, { page: page, selectedItem: selectedItem, onSelectItem: onSelectItem }, "status")] })] })] }) })] }) }) }) }) }) }) }));
|
|
75
82
|
}
|
|
76
83
|
// helpers
|
|
77
84
|
function coerceTarget({ templateId, slug, region, language }) {
|