@nascentdigital/funnel-editor 4.4.18 → 4.4.20
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/core/components/fields/FieldCardLayout.d.ts +2 -1
- package/dist/core/components/fields/FieldCardLayout.js +3 -2
- package/dist/core/components/fields/asset/AssetPreview.js +6 -1
- package/dist/core/components/fields/collection/CollectionCard.js +8 -3
- package/dist/core/components/fields/object/ObjectCard.js +2 -1
- package/dist/core/components/visuals/Icon.d.ts +1 -1
- package/dist/core/components/visuals/Icon.js +2 -0
- package/dist/core/domain/Collection.d.ts +1 -0
- package/dist/core/domain/Collection.js +8 -0
- package/dist/styles/index.css +16 -0
- package/package.json +3 -3
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Callback, Field, ObjectField } from '@nascentdigital/funnel-core';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
export declare function FieldCardLayout({ className, tip, field, deletable, embedded, selecting, onDelete, onEditing, onActiveChanged, children }: FieldCardLayout.Props): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function FieldCardLayout({ className, tip, field, empty, deletable, embedded, selecting, onDelete, onEditing, onActiveChanged, children }: FieldCardLayout.Props): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export declare namespace FieldCardLayout {
|
|
5
5
|
type Props = {
|
|
6
6
|
className?: string;
|
|
7
7
|
tip?: string;
|
|
8
8
|
field: Field | ObjectField;
|
|
9
|
+
empty?: boolean;
|
|
9
10
|
deletable?: boolean;
|
|
10
11
|
embedded?: boolean;
|
|
11
12
|
selecting?: boolean;
|
|
@@ -13,7 +13,7 @@ const hooks_1 = require("../../hooks");
|
|
|
13
13
|
const factories_1 = require("./factories");
|
|
14
14
|
const FieldHeader_1 = require("./FieldHeader");
|
|
15
15
|
// component
|
|
16
|
-
function FieldCardLayout({ className, tip, field, deletable = false, embedded = false, selecting = false, onDelete = funnel_core_1.Fn.NoOp, onEditing = funnel_core_1.Fn.NoOp, onActiveChanged = funnel_core_1.Fn.NoOp, children }) {
|
|
16
|
+
function FieldCardLayout({ className, tip, field, empty, deletable = false, embedded = false, selecting = false, onDelete = funnel_core_1.Fn.NoOp, onEditing = funnel_core_1.Fn.NoOp, onActiveChanged = funnel_core_1.Fn.NoOp, children }) {
|
|
17
17
|
// bind props + state
|
|
18
18
|
const { schema } = field;
|
|
19
19
|
const [hovering, setHovering] = (0, react_1.useState)(false);
|
|
@@ -57,7 +57,8 @@ function FieldCardLayout({ className, tip, field, deletable = false, embedded =
|
|
|
57
57
|
(0, jsx_runtime_1.jsx)(FieldHeader_1.FieldHeader, { className: "w-full", label: schema.name, tip: tip !== null && tip !== void 0 ? tip : schema.description, active: active, onDelete: deletable
|
|
58
58
|
? () => onDelete(field)
|
|
59
59
|
: undefined }), (0, jsx_runtime_1.jsx)("div", { ref: rootElementRef, className: (0, classnames_1.default)('FieldCard h-[170px]', {
|
|
60
|
-
'pointer-events-none': selecting
|
|
60
|
+
'pointer-events-none': selecting,
|
|
61
|
+
'FieldCard-empty': empty !== null && empty !== void 0 ? empty : !field.hasValue
|
|
61
62
|
}), onClick: selecting ? undefined : onEdit, onKeyDown: selecting ? undefined : client_1.OnKey.enter(onEdit), tabIndex: selecting ? -1 : 0, onFocus: () => setFocused(true), onBlur: () => setFocused(false), children: children })] }), editing && rootElement &&
|
|
62
63
|
(0, jsx_runtime_1.jsx)(factories_1.FieldValueFactory, { itemSchema: schema, field: field, anchor: rootElement, onCommit: onEdited, onCancel: onCancel })] }));
|
|
63
64
|
}
|
|
@@ -1,15 +1,20 @@
|
|
|
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.AssetPreview = AssetPreview;
|
|
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 feedback_1 = require("../../feedback");
|
|
11
|
+
const visuals_1 = require("../../visuals");
|
|
7
12
|
const preview_1 = require("./preview");
|
|
8
13
|
// component
|
|
9
14
|
function AssetPreview({ className, asset, active = false }) {
|
|
10
15
|
// render empty content
|
|
11
16
|
if (!asset) {
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(className, 'h-full flex flex-col justify-center items-center gap-l5'), children: [(0, jsx_runtime_1.jsx)(visuals_1.Icon, { className: "text-content-tertiary", variant: "Image", size: "card" }), (0, jsx_runtime_1.jsx)("p", { className: "label text-content-secondary", children: "Select Asset" })] }));
|
|
13
18
|
}
|
|
14
19
|
// render image
|
|
15
20
|
else if (funnel_core_1.Schema.AssetField.LinkedValue.Image.filter(asset)) {
|
|
@@ -18,6 +18,7 @@ const funnel_ui_1 = require("@nascentdigital/funnel-ui");
|
|
|
18
18
|
const hooks_1 = require("../../../hooks");
|
|
19
19
|
const feedback_1 = require("../../feedback");
|
|
20
20
|
const interaction_1 = require("../../interaction");
|
|
21
|
+
const visuals_1 = require("../../visuals");
|
|
21
22
|
const FieldCardLayout_1 = require("../FieldCardLayout");
|
|
22
23
|
const previews_1 = require("./previews");
|
|
23
24
|
// component
|
|
@@ -31,10 +32,14 @@ function CollectionCard(_a) {
|
|
|
31
32
|
const collection = (0, hooks_1.useCollectionData)({ schema: collectionSchema, value });
|
|
32
33
|
// sync field
|
|
33
34
|
(0, hooks_1.useField)(field);
|
|
34
|
-
// render
|
|
35
|
+
// render empty state
|
|
35
36
|
let content;
|
|
36
|
-
if (!
|
|
37
|
-
content = ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center", children: [(0, jsx_runtime_1.jsx)(
|
|
37
|
+
if (!value) {
|
|
38
|
+
content = ((0, jsx_runtime_1.jsxs)("div", { className: "h-full flex flex-col justify-center items-center gap-l5", children: [(0, jsx_runtime_1.jsx)(visuals_1.Icon, { className: "text-content-tertiary", variant: "LayoutTemplate", size: "card" }), (0, jsx_runtime_1.jsxs)("p", { className: "label text-content-secondary", children: ["Select ", schema.name] })] }));
|
|
39
|
+
}
|
|
40
|
+
// or loader
|
|
41
|
+
else if (!collection) {
|
|
42
|
+
content = ((0, jsx_runtime_1.jsxs)("div", { className: "h-full flex flex-col items-center", children: [(0, jsx_runtime_1.jsx)(interaction_1.Loader, { size: "sm" }), (0, jsx_runtime_1.jsx)("span", { className: "body-sm text-content-secondary", children: "Loading..." })] }));
|
|
38
43
|
}
|
|
39
44
|
// or handle error
|
|
40
45
|
else if (collection instanceof funnel_core_1.IsometricError) {
|
|
@@ -15,6 +15,7 @@ exports.ObjectCard = ObjectCard;
|
|
|
15
15
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
16
|
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
17
17
|
const hooks_1 = require("../../../hooks");
|
|
18
|
+
const visuals_1 = require("../../visuals");
|
|
18
19
|
const FieldCardLayout_1 = require("../FieldCardLayout");
|
|
19
20
|
// component
|
|
20
21
|
function ObjectCard(_a) {
|
|
@@ -27,7 +28,7 @@ function ObjectCard(_a) {
|
|
|
27
28
|
// render error if no value
|
|
28
29
|
let content;
|
|
29
30
|
if (!value) {
|
|
30
|
-
content =
|
|
31
|
+
content = ((0, jsx_runtime_1.jsxs)("div", { className: "h-full flex flex-col justify-center items-center gap-l5", children: [(0, jsx_runtime_1.jsx)(visuals_1.Icon, { className: "text-content-tertiary", variant: "LayoutTemplate", size: "card" }), (0, jsx_runtime_1.jsxs)("p", { className: "label text-content-secondary", children: ["Select ", schema.name] })] }));
|
|
31
32
|
}
|
|
32
33
|
// or render page
|
|
33
34
|
else {
|
|
@@ -5,7 +5,7 @@ export declare namespace Icon {
|
|
|
5
5
|
variant: Variant;
|
|
6
6
|
size?: Size;
|
|
7
7
|
};
|
|
8
|
-
type Size = 'xl' | 'lg' | 'md' | 'sm' | 'xs' | 'nav' | Sizing;
|
|
8
|
+
type Size = 'xl' | 'lg' | 'md' | 'sm' | 'xs' | 'nav' | 'card' | Sizing;
|
|
9
9
|
type Variant = 'Archive' | 'ArrowLeft' | 'Atom' | 'Blocks' | 'Bold' | 'Check' | 'ChevronDown' | 'ChevronRight' | 'ChevronUp' | 'Circle' | 'CircleAlert' | 'CircleCheck' | 'CircleCheckBig' | 'CirclePlus' | 'CircleQuestionMark' | 'CloudCheck' | 'CloudUpload' | 'CornerDownRight' | 'EllipsisVertical' | 'Eye' | 'EyeOff' | 'File' | 'FileDown' | 'FilePlusCorner' | 'FileSearchCorner' | 'Goal' | 'Globe' | 'GripVertical' | 'HatGlasses' | 'History' | 'Highlighter' | 'Image' | 'ImageDown' | 'Info' | 'Italic' | 'Layers' | 'LayoutTemplate' | 'Link' | 'Link2' | 'List' | 'ListChecks' | 'ListIndentDecrease' | 'ListIndentIncrease' | 'ListOrdered' | 'Lock' | 'LockOpen' | 'Mail' | 'MessageSquareQuote' | 'Minus' | 'MonitorCog' | 'Moon' | 'NotebookPen' | 'Pencil' | 'Pin' | 'Plus' | 'Redo' | 'RefreshCw' | 'RotateCcw' | 'RotateCw' | 'SearchCode' | 'Settings' | 'SquarePlay' | 'Star' | 'Strikethrough' | 'Subscript' | 'Sun' | 'Superscript' | 'TextAlignStart' | 'Trash' | 'TriangleAlert' | 'Trophy' | 'Underline' | 'Undo' | 'Upload' | 'UserRound' | 'X';
|
|
10
10
|
namespace Variant {
|
|
11
11
|
function filter(value: any): value is Variant;
|
|
@@ -268,6 +268,8 @@ function getSizing(size) {
|
|
|
268
268
|
switch (size) {
|
|
269
269
|
case 'nav':
|
|
270
270
|
return { size: 20, strokeWidth: 2 };
|
|
271
|
+
case 'card':
|
|
272
|
+
return { size: 32, strokeWidth: 2, absoluteStrokeWidth: true };
|
|
271
273
|
case 'xl':
|
|
272
274
|
return { size: 96, strokeWidth: 3.5, absoluteStrokeWidth: true };
|
|
273
275
|
case 'lg':
|
|
@@ -32,6 +32,7 @@ export declare class Collection implements IAssetStore, ICollectionStore, IPageR
|
|
|
32
32
|
readonly createdOn: number;
|
|
33
33
|
private _updatedOn;
|
|
34
34
|
readonly publishedOn?: number;
|
|
35
|
+
private readonly _subscription;
|
|
35
36
|
private _syncing;
|
|
36
37
|
private _modifiedOn?;
|
|
37
38
|
private _savingOn?;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Collection = void 0;
|
|
4
4
|
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
5
5
|
const rxjs_1 = require("rxjs");
|
|
6
|
+
const Item_1 = require("./Item");
|
|
6
7
|
// model
|
|
7
8
|
class Collection {
|
|
8
9
|
constructor(args) {
|
|
@@ -46,6 +47,13 @@ class Collection {
|
|
|
46
47
|
this._updatedOn = args.updatedOn;
|
|
47
48
|
this.publishedOn = args.publishedOn;
|
|
48
49
|
this._syncing = false;
|
|
50
|
+
// listen to block/field changes
|
|
51
|
+
this._subscription = this.eventBus.events$
|
|
52
|
+
.pipe((0, rxjs_1.filter)(e => (funnel_core_1.Field.Event.filter(e) && e.type === 'changed' && !e.field.sandboxed)
|
|
53
|
+
|| (funnel_core_1.FieldList.Event.filter(e) && e.type === 'changed')
|
|
54
|
+
|| (funnel_core_1.ObjectField.Event.filter(e) && e.type === 'changed')
|
|
55
|
+
|| (Item_1.Item.Event.filter(e) && e.type === 'changed')))
|
|
56
|
+
.subscribe(() => this.raiseEvent('changed'));
|
|
49
57
|
}
|
|
50
58
|
get asRef() {
|
|
51
59
|
const { template, brand, groupId, id, language, version, name, tags, state, valid, createdOn, updatedOn, publishedOn } = this;
|
package/dist/styles/index.css
CHANGED
|
@@ -2708,6 +2708,22 @@ video {
|
|
|
2708
2708
|
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, backdrop-filter, display, content-visibility, overlay, pointer-events;
|
|
2709
2709
|
transition-duration: 200ms;
|
|
2710
2710
|
}
|
|
2711
|
+
.FieldCard.FieldCard-empty{
|
|
2712
|
+
border-style: dashed;
|
|
2713
|
+
border-color: rgb(var(--color-destructive) / .2);
|
|
2714
|
+
--tw-bg-opacity: 1;
|
|
2715
|
+
background-color: rgb(var(--color-background) / var(--tw-bg-opacity, 1));
|
|
2716
|
+
}
|
|
2717
|
+
.FieldCard.FieldCard-empty:focus-visible{
|
|
2718
|
+
border-style: solid;
|
|
2719
|
+
--tw-border-opacity: 1;
|
|
2720
|
+
border-color: rgb(var(--color-destructive-content) / var(--tw-border-opacity, 1));
|
|
2721
|
+
outline-color: rgb(var(--color-destructive-content) / 1);
|
|
2722
|
+
}
|
|
2723
|
+
.FieldCard.FieldCard-empty:not(.FieldCard-disabled):hover{
|
|
2724
|
+
--tw-border-opacity: 1;
|
|
2725
|
+
border-color: rgb(var(--color-destructive) / var(--tw-border-opacity, 1));
|
|
2726
|
+
}
|
|
2711
2727
|
.FieldCard.FieldCard-disabled{
|
|
2712
2728
|
cursor: default;
|
|
2713
2729
|
opacity: .38;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nascentdigital/funnel-editor",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.20",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "restricted"
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"ts-jest": "^29",
|
|
90
90
|
"type-fest": "^4"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
93
|
-
}
|
|
92
|
+
"gitHead": "1e8d8289152d4ce68091e38773c0d766b6f289c3"
|
|
93
|
+
}
|