@nascentdigital/funnel-editor 6.1.2 → 6.1.3
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/asset/AssetEditor.js +2 -3
- package/dist/core/components/fields/asset/AssetPicker.js +0 -1
- package/dist/core/domain/Block.d.ts +2 -1
- package/dist/core/domain/BlockConfiguration.js +11 -3
- package/dist/core/domain/IPage.d.ts +2 -1
- package/dist/core/domain/Page.d.ts +4 -4
- package/dist/core/domain/Section.d.ts +1 -1
- package/dist/core/domain/Section.js +4 -2
- package/dist/core/domain/SectionBlock.d.ts +1 -1
- package/dist/core/hooks/usePage.d.ts +2 -2
- package/dist/core/repository/IAssetRepository.d.ts +1 -1
- package/dist/styles/index.css +8 -8
- package/package.json +2 -2
|
@@ -20,7 +20,6 @@ const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
|
20
20
|
const classnames_1 = __importDefault(require("classnames"));
|
|
21
21
|
const react_1 = require("motion/react");
|
|
22
22
|
const react_2 = require("react");
|
|
23
|
-
const client_1 = require("../../../client");
|
|
24
23
|
const hooks_1 = require("../../../hooks");
|
|
25
24
|
const feedback_1 = require("../../feedback");
|
|
26
25
|
const interaction_1 = require("../../interaction");
|
|
@@ -43,7 +42,7 @@ exports.AssetEditor = (0, react_2.forwardRef)(function AssetEditor(_, ref) {
|
|
|
43
42
|
const [error, setError] = (0, react_2.useState)();
|
|
44
43
|
const { nameField, descriptionField } = (0, useAssetFields_1.useAssetFields)();
|
|
45
44
|
const [shared, setShared] = (0, react_2.useState)(false);
|
|
46
|
-
const
|
|
45
|
+
const assetRepository = (0, hooks_1.useAssetRepository)();
|
|
47
46
|
const assetStore = (0, hooks_1.useAssetStore)();
|
|
48
47
|
const { valid, modified } = checkFields({ asset, nameField, descriptionField, shared });
|
|
49
48
|
// export service
|
|
@@ -94,7 +93,7 @@ exports.AssetEditor = (0, react_2.forwardRef)(function AssetEditor(_, ref) {
|
|
|
94
93
|
// create meta
|
|
95
94
|
const metadata = await getAssetMetadata({ asset });
|
|
96
95
|
// upload new file
|
|
97
|
-
const updatedAsset = await
|
|
96
|
+
const updatedAsset = await assetRepository.update({
|
|
98
97
|
id: asset.id,
|
|
99
98
|
name: (_a = funnel_core_1.Schema.TextField.Value.fromData(nameField.value)) !== null && _a !== void 0 ? _a : asset.name,
|
|
100
99
|
description: descriptionField.exists
|
|
@@ -58,7 +58,6 @@ exports.AssetPicker = (0, react_1.forwardRef)(function AssetPicker(_, ref) {
|
|
|
58
58
|
// fetch files
|
|
59
59
|
assetRepo
|
|
60
60
|
.search({
|
|
61
|
-
brand: funnel_core_1.AppConfig.brand(),
|
|
62
61
|
fileType: fileTypes,
|
|
63
62
|
scope: assetStore.getSearchScope(),
|
|
64
63
|
tags: schema.tags.map(funnel_core_1.Schema.Tag.toData),
|
|
@@ -3,7 +3,7 @@ import { StringKeyOf } from 'type-fest';
|
|
|
3
3
|
import { BlockConfiguration } from './BlockConfiguration';
|
|
4
4
|
import { ItemBase } from './ItemBase';
|
|
5
5
|
import ParentContext = ItemBase.ParentContext;
|
|
6
|
-
export declare class Block<TBlock extends
|
|
6
|
+
export declare class Block<TBlock extends Block.SchemaType = Block.SchemaType> extends ItemBase<Block<TBlock>> {
|
|
7
7
|
readonly schema: TBlock;
|
|
8
8
|
readonly config: ReadonlyArray<FieldModel.Config>;
|
|
9
9
|
readonly fields: ReadonlyArray<FieldModel>;
|
|
@@ -39,6 +39,7 @@ export declare class Block<TBlock extends Schema.Block = Schema.Block> extends I
|
|
|
39
39
|
protected onFieldChange(event: Field.Event): void;
|
|
40
40
|
}
|
|
41
41
|
export declare namespace Block {
|
|
42
|
+
type SchemaType = Schema.Block | Schema.PanelledBlock;
|
|
42
43
|
type ConstructorArgs<TBlock extends Schema.Block> = ItemBase.ConstructorArgs & {
|
|
43
44
|
name?: string;
|
|
44
45
|
schema: TBlock;
|
|
@@ -412,12 +412,17 @@ class BlockConfiguration {
|
|
|
412
412
|
}
|
|
413
413
|
// update layout if different
|
|
414
414
|
layoutField.value = funnel_core_1.Schema.EnumField.Value.toData(layout);
|
|
415
|
+
// throw if this isn't a paneled layout (shouldn't happen)
|
|
416
|
+
const { schema } = block;
|
|
417
|
+
if (!(schema instanceof funnel_core_1.Schema.PanelledBlock)) {
|
|
418
|
+
throw new funnel_core_1.InvalidOperationError('Cannot set layout on non-PanelledBlock instance');
|
|
419
|
+
}
|
|
415
420
|
// finish here if no layout change
|
|
416
|
-
if (!
|
|
421
|
+
if (!schema.defaultLayoutConfigs) {
|
|
417
422
|
return;
|
|
418
423
|
}
|
|
419
424
|
// set config for layout
|
|
420
|
-
const configForLayout =
|
|
425
|
+
const configForLayout = schema.defaultLayoutConfigs[layout];
|
|
421
426
|
if (configForLayout) {
|
|
422
427
|
this.setConfigValues(configForLayout);
|
|
423
428
|
}
|
|
@@ -433,7 +438,10 @@ class BlockConfiguration {
|
|
|
433
438
|
}, {});
|
|
434
439
|
// get customized schema (if there are effects)
|
|
435
440
|
const blockSchema = block.schema;
|
|
436
|
-
const { getConfig
|
|
441
|
+
const { getConfig } = blockSchema;
|
|
442
|
+
const getLayout = blockSchema instanceof funnel_core_1.Schema.PanelledBlock
|
|
443
|
+
? blockSchema.getLayout
|
|
444
|
+
: undefined;
|
|
437
445
|
const { updatedConfig = configData, updatedConfigSchema = blockSchema.config, defaultConfig = {} } = getConfig
|
|
438
446
|
? getConfig({ config: configData, fields: fieldData, block: block.schema })
|
|
439
447
|
: {};
|
|
@@ -35,12 +35,13 @@ export interface IPage extends IAssetStore, ICollectionStore, IPageRefStore, ITa
|
|
|
35
35
|
publication: number | undefined;
|
|
36
36
|
slug: string | undefined;
|
|
37
37
|
deleteBlock(area: IPage.Area, key: string): void;
|
|
38
|
-
getItem(identifier: string | undefined):
|
|
38
|
+
getItem(identifier: string | undefined): IPage.Item | undefined;
|
|
39
39
|
}
|
|
40
40
|
export declare namespace IPage {
|
|
41
41
|
type Content = ReadonlyArray<Block | Section>;
|
|
42
42
|
type Area = 'discover' | 'content';
|
|
43
43
|
type Savable = Section | Block | FieldModel;
|
|
44
|
+
type Item = Block | SectionBlock | Section | PageSettings;
|
|
44
45
|
type Errors = {
|
|
45
46
|
page: IPage;
|
|
46
47
|
items: Array<Block | SectionBlock>;
|
|
@@ -70,11 +70,11 @@ export declare class Page implements IAssetStore, ICollectionStore, IPageRefStor
|
|
|
70
70
|
get displayName(): string | Schema.Field.Data.ForSimpleType<Schema.TextField>;
|
|
71
71
|
get discover(): ReadonlyArray<Block>;
|
|
72
72
|
get content(): ReadonlyArray<Section | Block>;
|
|
73
|
-
get seo(): Block<
|
|
74
|
-
get blocks(): (Block<
|
|
73
|
+
get seo(): Block<Block.SchemaType>;
|
|
74
|
+
get blocks(): (Block<Block.SchemaType> | SectionBlock<Schema.Block<string, any, any>>)[];
|
|
75
75
|
get deleteBlocks(): ReadonlyArray<Block>;
|
|
76
|
-
get firstBlock(): Block<
|
|
77
|
-
get firstItem(): Section | Block<
|
|
76
|
+
get firstBlock(): Block<Block.SchemaType> | SectionBlock<Schema.Block<string, any, any>> | undefined;
|
|
77
|
+
get firstItem(): Section | Block<Block.SchemaType>;
|
|
78
78
|
get published(): boolean;
|
|
79
79
|
get modified(): boolean;
|
|
80
80
|
get updatedOn(): number;
|
|
@@ -23,7 +23,7 @@ export declare class Section extends ItemBase<Section> {
|
|
|
23
23
|
get missingBlocks(): number;
|
|
24
24
|
get canAddBlocks(): boolean;
|
|
25
25
|
bind(parentContext: ItemBase.ParentContext): void;
|
|
26
|
-
addBlock(identifier: string): SectionBlock<
|
|
26
|
+
addBlock(identifier: string): SectionBlock<Block.SchemaType>;
|
|
27
27
|
deleteBlock(id: SectionBlock.Id): undefined;
|
|
28
28
|
moveBlock(blockId: SectionBlock.Id, newIndex: number): SectionBlock<Schema.Block<string, any, any>> | undefined;
|
|
29
29
|
repair(): void;
|
|
@@ -42,8 +42,10 @@ class Section extends ItemBase_1.ItemBase {
|
|
|
42
42
|
|| _blocks.some(block => block.modified);
|
|
43
43
|
}
|
|
44
44
|
get valid() {
|
|
45
|
-
|
|
46
|
-
return
|
|
45
|
+
const { blocks, schema: { min, max } } = this;
|
|
46
|
+
return (blocks.length >= min
|
|
47
|
+
&& blocks.length <= max
|
|
48
|
+
&& blocks.every(block => block.valid));
|
|
47
49
|
}
|
|
48
50
|
get changes() {
|
|
49
51
|
return {
|
|
@@ -26,7 +26,7 @@ export declare class SectionBlock<TBlock extends Schema.Block = Schema.Block> ex
|
|
|
26
26
|
getConfiguration(): BlockConfiguration;
|
|
27
27
|
bind(parentContext: ItemBase.ParentContext): void;
|
|
28
28
|
repair(): void;
|
|
29
|
-
static for({ block, parentContext }: SectionBlock.ForArgs): SectionBlock<
|
|
29
|
+
static for({ block, parentContext }: SectionBlock.ForArgs): SectionBlock<Block.SchemaType>;
|
|
30
30
|
}
|
|
31
31
|
export declare namespace SectionBlock {
|
|
32
32
|
type Id = Tagged<string, 'SectionBlock.Id'>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IPage } from '../domain';
|
|
2
|
-
export declare function usePossiblePage(newPage?:
|
|
3
|
-
export declare function usePage(newPage?:
|
|
2
|
+
export declare function usePossiblePage<TPage extends IPage = IPage>(newPage?: TPage): TPage | undefined;
|
|
3
|
+
export declare function usePage<TPage extends IPage = IPage>(newPage?: TPage): TPage;
|
|
4
4
|
export declare const PageContext: import("react").Context<PageContext.Data>;
|
|
5
5
|
export declare namespace PageContext {
|
|
6
6
|
type Data = {
|
|
@@ -7,7 +7,7 @@ export interface IAssetRepository {
|
|
|
7
7
|
}
|
|
8
8
|
export declare namespace IAssetRepository {
|
|
9
9
|
namespace Search {
|
|
10
|
-
type Args = AssetClient.GetAssets.Args
|
|
10
|
+
type Args = Omit<AssetClient.GetAssets.Args, 'brand'>;
|
|
11
11
|
type Result = AssetClient.GetAssets.Result;
|
|
12
12
|
}
|
|
13
13
|
namespace Get {
|
package/dist/styles/index.css
CHANGED
|
@@ -501,10 +501,10 @@ video {
|
|
|
501
501
|
}
|
|
502
502
|
|
|
503
503
|
[popover]{
|
|
504
|
-
inset: var(--toolwind-toggle-
|
|
505
|
-
background-color: var(--toolwind-toggle-
|
|
506
|
-
color: var(--toolwind-toggle-
|
|
507
|
-
margin: var(--toolwind-toggle-
|
|
504
|
+
inset: var(--toolwind-toggle-uG9FzRfZVl, 0px);
|
|
505
|
+
background-color: var(--toolwind-toggle-husOqvrMb8, canvas);
|
|
506
|
+
color: var(--toolwind-toggle-xtluUy1iCF, canvastext);
|
|
507
|
+
margin: var(--toolwind-toggle-wZeGV9HO6v, auto);
|
|
508
508
|
}
|
|
509
509
|
html, body, #__next, #root, .Editor-wrap{
|
|
510
510
|
position: relative;
|
|
@@ -6012,10 +6012,10 @@ img.nd-Visual-image {
|
|
|
6012
6012
|
.anchored\/\[--nd-popup-anchor\]:where(.anchored\/\[--nd-popup-anchor\]){
|
|
6013
6013
|
position: absolute;
|
|
6014
6014
|
view-transition-name: --tw-anchor-view-transition-2j1919322s193433343934192p322r2w33362l;
|
|
6015
|
-
--toolwind-toggle-
|
|
6016
|
-
--toolwind-toggle-
|
|
6017
|
-
--toolwind-toggle-
|
|
6018
|
-
--toolwind-toggle-
|
|
6015
|
+
--toolwind-toggle-uG9FzRfZVl: auto;
|
|
6016
|
+
--toolwind-toggle-husOqvrMb8: transparent;
|
|
6017
|
+
--toolwind-toggle-xtluUy1iCF: inherit;
|
|
6018
|
+
--toolwind-toggle-wZeGV9HO6v: 0px;
|
|
6019
6019
|
}
|
|
6020
6020
|
.counter-l1{
|
|
6021
6021
|
counter-reset: l1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nascentdigital/funnel-editor",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"ts-jest": "^29",
|
|
93
93
|
"type-fest": "^4"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "f22371fb54de07cd115522c18e5c2c51ba72aa49"
|
|
96
96
|
}
|