@nascentdigital/funnel-editor 7.0.2 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -102,7 +102,7 @@ exports.AssetEditor = (0, react_2.forwardRef)(function AssetEditor(_, ref) {
102
102
  scope: shared
103
103
  ? funnel_core_1.Schema.GlobalAssetScope.instance.data
104
104
  : assetStore.getAssetScope(schema.scope).data,
105
- tags: schema.tags.map(tag => tag.data),
105
+ tags: schema.assetTags.map(tag => tag.data),
106
106
  metadata
107
107
  });
108
108
  // store asset
@@ -54,13 +54,13 @@ exports.AssetPicker = (0, react_1.forwardRef)(function AssetPicker(_, ref) {
54
54
  return;
55
55
  }
56
56
  const scope = assetStore.getSearchScope();
57
- console.debug('[AssetPicker] fetching files for', { fileTypes, tag: schema.tags, scope });
57
+ console.debug('[AssetPicker] fetching files for', { fileTypes, tag: schema.assetTags, scope });
58
58
  // fetch files
59
59
  assetRepo
60
60
  .search({
61
61
  fileType: fileTypes,
62
62
  scope: assetStore.getSearchScope(),
63
- tags: schema.tags.map(funnel_core_1.Schema.Tag.toData),
63
+ tags: schema.assetTags.map(funnel_core_1.Schema.Tag.toData),
64
64
  pagination: 'all',
65
65
  })
66
66
  .then(({ items }) => {
@@ -127,7 +127,7 @@ var VisualTag;
127
127
  return [];
128
128
  }
129
129
  // use specified tags, or all tags if there's no definition
130
- let tags = schema.tags.filter(isVisualTags);
130
+ let tags = schema.assetTags.filter(isVisualTags);
131
131
  if (tags.length === 0) {
132
132
  tags = [
133
133
  ...Object.values(funnel_core_1.Schema.AssetField.Tags.image.tags),
@@ -112,7 +112,7 @@ exports.AssetUploader = (0, react_2.forwardRef)(function AssetUploader(_, ref) {
112
112
  scope: shared
113
113
  ? funnel_core_1.Schema.GlobalAssetScope.instance.data
114
114
  : assetStore.getAssetScope(schema.scope).data,
115
- tags: schema.tags.map(tag => tag.data),
115
+ tags: schema.assetTags.map(tag => tag.data),
116
116
  metadata
117
117
  });
118
118
  // store asset
@@ -11,7 +11,7 @@ export declare namespace PagePicker {
11
11
  }
12
12
  type Options = {
13
13
  pageTypes?: ReadonlyArray<Schema.Page.Type> | 'all';
14
- tags?: ReadonlyArray<Schema.Tag>;
14
+ pageTags?: ReadonlyArray<Schema.Tag>;
15
15
  disabledIds?: ReadonlyArray<Schema.Page.Id>;
16
16
  };
17
17
  type Result = IPage.Ref | undefined;
@@ -36,7 +36,7 @@ exports.PagePicker = (0, react_1.forwardRef)(function PagePicker({ language }, r
36
36
  // export service
37
37
  (0, react_1.useImperativeHandle)(ref, () => ({
38
38
  available: !!pageRefStore,
39
- pick: async ({ pageTypes = [], tags = [], disabledIds = [] } = {}) => {
39
+ pick: async ({ pageTypes = [], pageTags = [], disabledIds = [] } = {}) => {
40
40
  // reset state
41
41
  setPageTypes(pageTypes === 'all' ? [] : pageTypes);
42
42
  setTags(tags);
@@ -38,12 +38,13 @@ export declare class BlockConfiguration {
38
38
  gotToPreviousSlot(): void;
39
39
  get hasBlockConfig(): boolean;
40
40
  get hasPanels(): boolean;
41
- get messageFields(): Record<keyof MessagePanel.Config.Keys<'message'>, FieldModel.Config | undefined>;
42
- get listFields(): Record<keyof ListPanel.Config.Keys<'list'>, FieldModel.Config | undefined>;
43
- get visualFields(): Record<keyof VisualPanel.Config.Keys<'visual'>, FieldModel.Config | undefined>;
41
+ get messageFields(): Record<MessagePanel.Config.Key<'message'>, FieldModel.Config>;
42
+ get listFields(): Record<ListPanel.Config.Key<'list'>, FieldModel.Config>;
43
+ get visualFields(): Record<VisualPanel.Config.Key<'visual'>, FieldModel.Config>;
44
44
  get extendedFields(): Record<string, FieldModel.Config>;
45
45
  get layout(): BlockLayout | undefined;
46
46
  getPossibleField(fieldId: string): FieldModel.Config | undefined;
47
+ getFieldsForTags(...tagsRaw: ReadonlyArray<Schema.FieldTag>): Record<string, FieldModel.Config>;
47
48
  getField(fieldId: string): FieldModel.Config;
48
49
  getFieldData(fieldId: string): Schema.Field.LinkedData | undefined;
49
50
  setPanelLayout(layout: PanelLayout): void;
@@ -266,35 +266,13 @@ class BlockConfiguration {
266
266
  return this.block.schema instanceof funnel_core_1.Schema.PanelledBlock;
267
267
  }
268
268
  get messageFields() {
269
- const keys = funnel_ui_1.MessagePanel.Config.getKeys('message');
270
- return {
271
- textAlign: this.getPossibleField(keys.textAlign),
272
- width: this.getPossibleField(keys.width),
273
- horizontalAlign: this.getPossibleField(keys.horizontalAlign),
274
- verticalAlign: this.getPossibleField(keys.verticalAlign)
275
- };
269
+ return this.getFieldsForTags(funnel_ui_1.MessagePanel.Tag.message);
276
270
  }
277
271
  get listFields() {
278
- const keys = funnel_ui_1.ListPanel.Config.getKeys('list');
279
- return {
280
- layout: this.getPossibleField(keys.layout),
281
- width: this.getPossibleField(keys.width),
282
- horizontalAlign: this.getPossibleField(keys.horizontalAlign),
283
- verticalAlign: this.getPossibleField(keys.verticalAlign)
284
- };
272
+ return this.getFieldsForTags(funnel_ui_1.ListPanelTags.list);
285
273
  }
286
274
  get visualFields() {
287
- const keys = funnel_ui_1.VisualPanel.Config.getKeys('visual');
288
- return {
289
- aspect: this.getPossibleField(keys.aspect),
290
- anchor: this.getPossibleField(keys.anchor),
291
- width: this.getPossibleField(keys.width),
292
- horizontalAlign: this.getPossibleField(keys.horizontalAlign),
293
- controls: this.getPossibleField(keys.controls),
294
- autoPlay: this.getPossibleField(keys.autoPlay),
295
- loop: this.getPossibleField(keys.loop),
296
- mute: this.getPossibleField(keys.mute)
297
- };
275
+ return this.getFieldsForTags(funnel_ui_1.VisualPanel.Tag.visual);
298
276
  }
299
277
  get extendedFields() {
300
278
  // get all top-level keys
@@ -325,6 +303,18 @@ class BlockConfiguration {
325
303
  getPossibleField(fieldId) {
326
304
  return this.fields.find(field => field.id === fieldId);
327
305
  }
306
+ getFieldsForTags(...tagsRaw) {
307
+ const tags = new Set(tagsRaw);
308
+ return this.fields.reduce((fields, field) => {
309
+ // add field if it's mapped
310
+ this.log.i(`getFieldsForTags - comparing for "${field.id}"`, { tags, fieldTags: field.schema.tags, included: tags.isSubsetOf(field.schema.tags) });
311
+ if (tags.isSubsetOf(field.schema.tags)) {
312
+ fields[field.id] = field;
313
+ }
314
+ // keep reducing
315
+ return fields;
316
+ }, {});
317
+ }
328
318
  getField(fieldId) {
329
319
  // return field or throw
330
320
  const field = this.getPossibleField(fieldId);
@@ -7,7 +7,7 @@ const react_1 = require("react");
7
7
  const core_1 = require("../../core");
8
8
  // component
9
9
  exports.CreateCollectionDialog = (0, react_1.forwardRef)(function CreateCollectionDialog(_, ref) {
10
- var _a, _b, _c, _d;
10
+ var _a, _b, _c, _d, _e;
11
11
  // bind state + hooks
12
12
  const [deferral, setDeferral] = (0, react_1.useState)();
13
13
  const [result, setResult] = (0, react_1.useState)();
@@ -26,11 +26,11 @@ exports.CreateCollectionDialog = (0, react_1.forwardRef)(function CreateCollecti
26
26
  name: 'Language',
27
27
  hint: 'Select a language',
28
28
  options: (_a = languageOptions === null || languageOptions === void 0 ? void 0 : languageOptions.languages) !== null && _a !== void 0 ? _a : {},
29
- defaultOption: languageOptions === null || languageOptions === void 0 ? void 0 : languageOptions.defaultLanguage
29
+ defaultOption: (_b = languageOptions === null || languageOptions === void 0 ? void 0 : languageOptions.defaultLanguage) !== null && _b !== void 0 ? _b : 'en'
30
30
  })
31
31
  }, [languageOptions]);
32
32
  const valid = nameField.valid && languageField.valid;
33
- const name = (_c = (_b = funnel_core_1.Schema.TextField.Value.fromData(nameField.value)) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '';
33
+ const name = (_d = (_c = funnel_core_1.Schema.TextField.Value.fromData(nameField.value)) === null || _c === void 0 ? void 0 : _c.trim()) !== null && _d !== void 0 ? _d : '';
34
34
  const multiLanguage = languageField.schema.enum.length > 1;
35
35
  // bind service
36
36
  (0, react_1.useImperativeHandle)(ref, () => ({
@@ -114,7 +114,7 @@ exports.CreateCollectionDialog = (0, react_1.forwardRef)(function CreateCollecti
114
114
  return null;
115
115
  }
116
116
  // render
117
- return ((0, jsx_runtime_1.jsxs)(core_1.MiniEditor, { className: "flex flex-col gap-l8", title: `Create new ${(_d = collectionBrowser.template.name) !== null && _d !== void 0 ? _d : 'collection'}`, open: result === undefined, anchor: anchor, anchorOffset: 4, placement: "left", renderSaveLabel: state => state === 'saving' ? 'Creating...' : 'Create', canSave: onValidate, onSave: onCreate, onClose: onCancel, onClosed: onClosed, children: [(0, jsx_runtime_1.jsx)(core_1.ErrorMessage, { error: error }), (0, jsx_runtime_1.jsxs)(core_1.FieldErrorController, { errorLevel: errorLevel, children: [(0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: nameField, autoFocus: true }), multiLanguage &&
117
+ return ((0, jsx_runtime_1.jsxs)(core_1.MiniEditor, { className: "flex flex-col gap-l8", title: `Create new ${(_e = collectionBrowser.template.name) !== null && _e !== void 0 ? _e : 'collection'}`, open: result === undefined, anchor: anchor, anchorOffset: 4, placement: "left", renderSaveLabel: state => state === 'saving' ? 'Creating...' : 'Create', canSave: onValidate, onSave: onCreate, onClose: onCancel, onClosed: onClosed, children: [(0, jsx_runtime_1.jsx)(core_1.ErrorMessage, { error: error }), (0, jsx_runtime_1.jsxs)(core_1.FieldErrorController, { errorLevel: errorLevel, children: [(0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: nameField, autoFocus: true }), multiLanguage &&
118
118
  (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: languageField })] })] }));
119
119
  });
120
120
  function getLanguageOptions(collectionBrowser) {
@@ -8,7 +8,7 @@ const react_1 = require("react");
8
8
  const core_1 = require("../../core");
9
9
  // component
10
10
  exports.CreatePageDialog = (0, react_1.forwardRef)(function CreatePageDialog(_, ref) {
11
- var _a, _b, _c, _d;
11
+ var _a, _b, _c, _d, _e;
12
12
  // bind state + hooks
13
13
  const [deferral, setDeferral] = (0, react_1.useState)();
14
14
  const [result, setResult] = (0, react_1.useState)();
@@ -38,12 +38,12 @@ exports.CreatePageDialog = (0, react_1.forwardRef)(function CreatePageDialog(_,
38
38
  name: 'Language',
39
39
  hint: 'Select a language',
40
40
  options: (_a = languageOptions === null || languageOptions === void 0 ? void 0 : languageOptions.languages) !== null && _a !== void 0 ? _a : {},
41
- defaultOption: languageOptions === null || languageOptions === void 0 ? void 0 : languageOptions.defaultLanguage
41
+ defaultOption: (_b = languageOptions === null || languageOptions === void 0 ? void 0 : languageOptions.defaultLanguage) !== null && _b !== void 0 ? _b : 'en'
42
42
  })
43
43
  }, [languageOptions]);
44
44
  const slugFieldRef = (0, react_1.useRef)(null);
45
45
  const valid = nameField.valid && slugField.valid && languageField.valid;
46
- const name = (_c = (_b = funnel_core_1.Schema.TextField.Value.fromData(nameField.value)) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '';
46
+ const name = (_d = (_c = funnel_core_1.Schema.TextField.Value.fromData(nameField.value)) === null || _c === void 0 ? void 0 : _c.trim()) !== null && _d !== void 0 ? _d : '';
47
47
  const multiLanguage = languageField.schema.enum.length > 1;
48
48
  // bind service
49
49
  (0, react_1.useImperativeHandle)(ref, () => ({
@@ -163,7 +163,7 @@ exports.CreatePageDialog = (0, react_1.forwardRef)(function CreatePageDialog(_,
163
163
  return null;
164
164
  }
165
165
  // render
166
- return ((0, jsx_runtime_1.jsxs)(core_1.MiniEditor, { className: "flex flex-col gap-l8", title: `Create new ${(_d = template.name) !== null && _d !== void 0 ? _d : 'page'}`, open: result === undefined, anchor: anchor, anchorOffset: 4, placement: "left", renderSaveLabel: state => state === 'saving' ? 'Creating...' : 'Create', canSave: onValidate, onSave: onCreate, onClose: onCancel, onClosed: onClosed, children: [(0, jsx_runtime_1.jsx)(core_1.ErrorMessage, { error: error }), (0, jsx_runtime_1.jsxs)(core_1.FieldErrorController, { errorLevel: errorLevel, children: [(0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: nameField, autoFocus: true }), (0, jsx_runtime_1.jsx)(core_1.TextField, { ref: slugFieldRef, field: slugField, onKeyDown: onSlugKeyDown }), multiLanguage &&
166
+ return ((0, jsx_runtime_1.jsxs)(core_1.MiniEditor, { className: "flex flex-col gap-l8", title: `Create new ${(_e = template.name) !== null && _e !== void 0 ? _e : 'page'}`, open: result === undefined, anchor: anchor, anchorOffset: 4, placement: "left", renderSaveLabel: state => state === 'saving' ? 'Creating...' : 'Create', canSave: onValidate, onSave: onCreate, onClose: onCancel, onClosed: onClosed, children: [(0, jsx_runtime_1.jsx)(core_1.ErrorMessage, { error: error }), (0, jsx_runtime_1.jsxs)(core_1.FieldErrorController, { errorLevel: errorLevel, children: [(0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: nameField, autoFocus: true }), (0, jsx_runtime_1.jsx)(core_1.TextField, { ref: slugFieldRef, field: slugField, onKeyDown: onSlugKeyDown }), multiLanguage &&
167
167
  (0, jsx_runtime_1.jsx)(core_1.FieldEditor, { field: languageField })] })] }));
168
168
  });
169
169
  function getLanguageOptions(site) {
@@ -98,7 +98,7 @@ function BlockConfigButton({ block, target, anchorId: anchorOverrideId, children
98
98
  break;
99
99
  case 'list': {
100
100
  // pull out layout from listFields
101
- const _b = configuration.listFields, { layout: layoutField } = _b, listFields = __rest(_b, ["layout"]);
101
+ const _b = configuration.listFields, { listLayout: layoutField } = _b, listFields = __rest(_b, ["listLayout"]);
102
102
  // helpers
103
103
  const onChangeLayout = async (e) => {
104
104
  var _a;
@@ -141,7 +141,7 @@ function BlockConfigButton({ block, target, anchorId: anchorOverrideId, children
141
141
  title = 'Visual Configuration';
142
142
  tip = 'Cropping changes how the image appears on your site, not your original file.';
143
143
  // get fields
144
- const { aspect: aspectField, anchor: anchorField, width: widthField, horizontalAlign: horizontalAlignField, controls: controlsField, autoPlay: autoPlayField, loop: loopField, mute: muteField, } = configuration.visualFields;
144
+ const { visualAspect: aspectField, visualAnchor: anchorField, visualWidth: widthField, visualHorizontalAlign: horizontalAlignField, visualControls: controlsField, visualAutoPlay: autoPlayField, visualLoop: loopField, visualMute: muteField } = configuration.visualFields;
145
145
  const { value } = (_a = configuration.getFieldData('visual')) !== null && _a !== void 0 ? _a : {};
146
146
  const media = funnel_core_1.Schema.CollectionField.Value.ForInline.filter(value)
147
147
  ? value
@@ -501,10 +501,10 @@ video {
501
501
  }
502
502
 
503
503
  [popover]{
504
- inset: var(--toolwind-toggle-dPaLY0vrOf, 0px);
505
- background-color: var(--toolwind-toggle-YD4oGaSVC1, canvas);
506
- color: var(--toolwind-toggle-SfUGdDTotd, canvastext);
507
- margin: var(--toolwind-toggle-vZWAXnxQvw, auto);
504
+ inset: var(--toolwind-toggle-TEkms9tMqn, 0px);
505
+ background-color: var(--toolwind-toggle-8EFGd3ok2B, canvas);
506
+ color: var(--toolwind-toggle-WhCOz1hius, canvastext);
507
+ margin: var(--toolwind-toggle-3g8glya8P6, auto);
508
508
  }
509
509
  html, body, #__next, #root, .Editor-wrap{
510
510
  position: relative;
@@ -6220,10 +6220,10 @@ img.nd-Visual-image {
6220
6220
  .anchored\/\[--nd-popup-anchor\]:where(.anchored\/\[--nd-popup-anchor\]){
6221
6221
  position: absolute;
6222
6222
  view-transition-name: --tw-anchor-view-transition-2j1919322s193433343934192p322r2w33362l;
6223
- --toolwind-toggle-dPaLY0vrOf: auto;
6224
- --toolwind-toggle-YD4oGaSVC1: transparent;
6225
- --toolwind-toggle-SfUGdDTotd: inherit;
6226
- --toolwind-toggle-vZWAXnxQvw: 0px;
6223
+ --toolwind-toggle-TEkms9tMqn: auto;
6224
+ --toolwind-toggle-8EFGd3ok2B: transparent;
6225
+ --toolwind-toggle-WhCOz1hius: inherit;
6226
+ --toolwind-toggle-3g8glya8P6: 0px;
6227
6227
  }
6228
6228
  .counter-l1{
6229
6229
  counter-reset: l1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nascentdigital/funnel-editor",
3
- "version": "7.0.2",
3
+ "version": "8.0.0",
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": "015e14c2eb8b29467360f09aaafb5c87ffbacb07"
95
+ "gitHead": "5fb91f3eecdfe1bcf18dc78f0ecf99668816d02a"
96
96
  }