@measured/puck-plugin-heading-analyzer 0.19.0-canary.fb0e8e24 → 0.19.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/index.d.mts CHANGED
@@ -14,6 +14,7 @@ type BaseField = {
14
14
  label?: string;
15
15
  labelIcon?: ReactElement;
16
16
  metadata?: Metadata;
17
+ visible?: boolean;
17
18
  };
18
19
  type TextField = BaseField & {
19
20
  type: "text";
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ type BaseField = {
14
14
  label?: string;
15
15
  labelIcon?: ReactElement;
16
16
  metadata?: Metadata;
17
+ visible?: boolean;
17
18
  };
18
19
  type TextField = BaseField & {
19
20
  type: "text";
package/dist/index.js CHANGED
@@ -153,6 +153,120 @@ var require_classnames = __commonJS({
153
153
  }
154
154
  });
155
155
 
156
+ // ../../node_modules/flat/index.js
157
+ var require_flat = __commonJS({
158
+ "../../node_modules/flat/index.js"(exports2, module2) {
159
+ "use strict";
160
+ init_react_import();
161
+ module2.exports = flatten3;
162
+ flatten3.flatten = flatten3;
163
+ flatten3.unflatten = unflatten2;
164
+ function isBuffer(obj) {
165
+ return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
166
+ }
167
+ function keyIdentity(key) {
168
+ return key;
169
+ }
170
+ function flatten3(target, opts) {
171
+ opts = opts || {};
172
+ const delimiter = opts.delimiter || ".";
173
+ const maxDepth = opts.maxDepth;
174
+ const transformKey = opts.transformKey || keyIdentity;
175
+ const output = {};
176
+ function step(object, prev, currentDepth) {
177
+ currentDepth = currentDepth || 1;
178
+ Object.keys(object).forEach(function(key) {
179
+ const value = object[key];
180
+ const isarray = opts.safe && Array.isArray(value);
181
+ const type = Object.prototype.toString.call(value);
182
+ const isbuffer = isBuffer(value);
183
+ const isobject = type === "[object Object]" || type === "[object Array]";
184
+ const newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);
185
+ if (!isarray && !isbuffer && isobject && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) {
186
+ return step(value, newKey, currentDepth + 1);
187
+ }
188
+ output[newKey] = value;
189
+ });
190
+ }
191
+ step(target);
192
+ return output;
193
+ }
194
+ function unflatten2(target, opts) {
195
+ opts = opts || {};
196
+ const delimiter = opts.delimiter || ".";
197
+ const overwrite = opts.overwrite || false;
198
+ const transformKey = opts.transformKey || keyIdentity;
199
+ const result = {};
200
+ const isbuffer = isBuffer(target);
201
+ if (isbuffer || Object.prototype.toString.call(target) !== "[object Object]") {
202
+ return target;
203
+ }
204
+ function getkey(key) {
205
+ const parsedKey = Number(key);
206
+ return isNaN(parsedKey) || key.indexOf(".") !== -1 || opts.object ? key : parsedKey;
207
+ }
208
+ function addKeys(keyPrefix, recipient, target2) {
209
+ return Object.keys(target2).reduce(function(result2, key) {
210
+ result2[keyPrefix + delimiter + key] = target2[key];
211
+ return result2;
212
+ }, recipient);
213
+ }
214
+ function isEmpty(val) {
215
+ const type = Object.prototype.toString.call(val);
216
+ const isArray = type === "[object Array]";
217
+ const isObject = type === "[object Object]";
218
+ if (!val) {
219
+ return true;
220
+ } else if (isArray) {
221
+ return !val.length;
222
+ } else if (isObject) {
223
+ return !Object.keys(val).length;
224
+ }
225
+ }
226
+ target = Object.keys(target).reduce(function(result2, key) {
227
+ const type = Object.prototype.toString.call(target[key]);
228
+ const isObject = type === "[object Object]" || type === "[object Array]";
229
+ if (!isObject || isEmpty(target[key])) {
230
+ result2[key] = target[key];
231
+ return result2;
232
+ } else {
233
+ return addKeys(
234
+ key,
235
+ result2,
236
+ flatten3(target[key], opts)
237
+ );
238
+ }
239
+ }, {});
240
+ Object.keys(target).forEach(function(key) {
241
+ const split = key.split(delimiter).map(transformKey);
242
+ let key1 = getkey(split.shift());
243
+ let key2 = getkey(split[0]);
244
+ let recipient = result;
245
+ while (key2 !== void 0) {
246
+ if (key1 === "__proto__") {
247
+ return;
248
+ }
249
+ const type = Object.prototype.toString.call(recipient[key1]);
250
+ const isobject = type === "[object Object]" || type === "[object Array]";
251
+ if (!overwrite && !isobject && typeof recipient[key1] !== "undefined") {
252
+ return;
253
+ }
254
+ if (overwrite && !isobject || !overwrite && recipient[key1] == null) {
255
+ recipient[key1] = typeof key2 === "number" && !opts.object ? [] : {};
256
+ }
257
+ recipient = recipient[key1];
258
+ if (split.length > 0) {
259
+ key1 = getkey(split.shift());
260
+ key2 = getkey(split[0]);
261
+ }
262
+ }
263
+ recipient[key1] = unflatten2(target[key], opts);
264
+ });
265
+ return result;
266
+ }
267
+ }
268
+ });
269
+
156
270
  // ../../node_modules/fast-deep-equal/index.js
157
271
  var require_fast_deep_equal = __commonJS({
158
272
  "../../node_modules/fast-deep-equal/index.js"(exports2, module2) {
@@ -374,43 +488,6 @@ init_react_import();
374
488
  // ../core/lib/data/walk-app-state.ts
375
489
  init_react_import();
376
490
 
377
- // ../core/lib/data/for-each-slot.ts
378
- init_react_import();
379
-
380
- // ../core/lib/data/is-slot.ts
381
- init_react_import();
382
- var isSlot = (prop) => {
383
- var _a, _b;
384
- return Array.isArray(prop) && typeof ((_a = prop[0]) == null ? void 0 : _a.type) === "string" && typeof ((_b = prop[0]) == null ? void 0 : _b.props) === "object";
385
- };
386
- var createIsSlotConfig = (config) => (itemType, propName, propValue) => {
387
- var _a, _b;
388
- const configForComponent = itemType === "root" ? config == null ? void 0 : config.root : config == null ? void 0 : config.components[itemType];
389
- if (!configForComponent) return isSlot(propValue);
390
- return ((_b = (_a = configForComponent.fields) == null ? void 0 : _a[propName]) == null ? void 0 : _b.type) === "slot";
391
- };
392
-
393
- // ../core/lib/data/for-each-slot.ts
394
- var forEachSlot = (item, cb, recursive = false, isSlot2 = isSlot) => {
395
- const props = item.props || {};
396
- const propKeys = Object.keys(props);
397
- for (let i = 0; i < propKeys.length; i++) {
398
- const propKey = propKeys[i];
399
- const itemType = "type" in item ? item.type : "root";
400
- if (isSlot2(itemType, propKey, props[propKey])) {
401
- const content = props[propKey];
402
- cb(props.id, propKey, content);
403
- if (recursive) {
404
- content.forEach(
405
- (childItem) => __async(void 0, null, function* () {
406
- return forEachSlot(childItem, cb, true, isSlot2);
407
- })
408
- );
409
- }
410
- }
411
- }
412
- };
413
-
414
491
  // ../core/lib/data/for-related-zones.ts
415
492
  init_react_import();
416
493
 
@@ -444,19 +521,163 @@ function forRelatedZones(item, data, cb, path = []) {
444
521
  });
445
522
  }
446
523
 
524
+ // ../core/lib/data/map-slots.ts
525
+ init_react_import();
526
+
527
+ // ../core/lib/data/default-slots.ts
528
+ init_react_import();
529
+ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
530
+ (acc, fieldName) => fields[fieldName].type === "slot" ? __spreadValues({ [fieldName]: [] }, acc) : acc,
531
+ value
532
+ );
533
+
534
+ // ../core/lib/data/map-slots.ts
535
+ var isPromise = (v) => !!v && typeof v.then === "function";
536
+ var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
537
+ var containsPromise = (arr) => arr.some(isPromise);
538
+ var walkField = ({
539
+ value,
540
+ fields,
541
+ map,
542
+ propKey = "",
543
+ propPath = "",
544
+ id = "",
545
+ config,
546
+ recurseSlots = false
547
+ }) => {
548
+ var _a, _b, _c;
549
+ if (((_a = fields[propKey]) == null ? void 0 : _a.type) === "slot") {
550
+ const content = value || [];
551
+ const mappedContent = recurseSlots ? content.map((el) => {
552
+ var _a2;
553
+ const componentConfig = config.components[el.type];
554
+ if (!componentConfig) {
555
+ throw new Error(`Could not find component config for ${el.type}`);
556
+ }
557
+ const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
558
+ return walkField({
559
+ value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
560
+ fields: fields2,
561
+ map,
562
+ id: el.props.id,
563
+ config,
564
+ recurseSlots
565
+ });
566
+ }) : content;
567
+ if (containsPromise(mappedContent)) {
568
+ return Promise.all(mappedContent);
569
+ }
570
+ return map(mappedContent, id, propPath, fields[propKey], propPath);
571
+ }
572
+ if (value && typeof value === "object") {
573
+ if (Array.isArray(value)) {
574
+ const arrayFields = ((_b = fields[propKey]) == null ? void 0 : _b.type) === "array" ? fields[propKey].arrayFields : null;
575
+ if (!arrayFields) return value;
576
+ const newValue = value.map(
577
+ (el, idx) => walkField({
578
+ value: el,
579
+ fields: arrayFields,
580
+ map,
581
+ propKey,
582
+ propPath: `${propPath}[${idx}]`,
583
+ id,
584
+ config,
585
+ recurseSlots
586
+ })
587
+ );
588
+ if (containsPromise(newValue)) {
589
+ return Promise.all(newValue);
590
+ }
591
+ return newValue;
592
+ } else if ("$$typeof" in value) {
593
+ return value;
594
+ } else {
595
+ const objectFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "object" ? fields[propKey].objectFields : fields;
596
+ return walkObject({
597
+ value,
598
+ fields: objectFields,
599
+ map,
600
+ id,
601
+ getPropPath: (k) => `${propPath}.${k}`,
602
+ config,
603
+ recurseSlots
604
+ });
605
+ }
606
+ }
607
+ return value;
608
+ };
609
+ var walkObject = ({
610
+ value,
611
+ fields,
612
+ map,
613
+ id,
614
+ getPropPath,
615
+ config,
616
+ recurseSlots
617
+ }) => {
618
+ const newProps = Object.entries(value).map(([k, v]) => {
619
+ const opts = {
620
+ value: v,
621
+ fields,
622
+ map,
623
+ propKey: k,
624
+ propPath: getPropPath(k),
625
+ id,
626
+ config,
627
+ recurseSlots
628
+ };
629
+ const newValue = walkField(opts);
630
+ if (isPromise(newValue)) {
631
+ return newValue.then((resolvedValue) => ({
632
+ [k]: resolvedValue
633
+ }));
634
+ }
635
+ return {
636
+ [k]: newValue
637
+ };
638
+ }, {});
639
+ if (containsPromise(newProps)) {
640
+ return Promise.all(newProps).then(flatten);
641
+ }
642
+ return flatten(newProps);
643
+ };
644
+ function mapSlots(item, map, config, recurseSlots = false) {
645
+ var _a, _b, _c, _d, _e;
646
+ const itemType = "type" in item ? item.type : "root";
647
+ const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
648
+ const newProps = walkObject({
649
+ value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
650
+ fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
651
+ map,
652
+ id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
653
+ getPropPath: (k) => k,
654
+ config,
655
+ recurseSlots
656
+ });
657
+ if (isPromise(newProps)) {
658
+ return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
659
+ props: resolvedProps
660
+ }));
661
+ }
662
+ return __spreadProps(__spreadValues({}, item), {
663
+ props: newProps
664
+ });
665
+ }
666
+
667
+ // ../core/lib/data/flatten-node.ts
668
+ init_react_import();
669
+ var import_flat = __toESM(require_flat());
670
+
447
671
  // ../core/lib/data/strip-slots.ts
448
672
  init_react_import();
449
- var stripSlots = (data) => {
450
- return __spreadProps(__spreadValues({}, data), {
451
- props: Object.entries(data.props).reduce(
452
- (acc, [propKey, propVal]) => {
453
- if (isSlot(propVal)) {
454
- return acc;
455
- }
456
- return __spreadProps(__spreadValues({}, acc), { [propKey]: propVal });
457
- },
458
- { id: data.props.id }
459
- )
673
+ var stripSlots = (data, config) => {
674
+ return mapSlots(data, () => null, config);
675
+ };
676
+
677
+ // ../core/lib/data/flatten-node.ts
678
+ var flattenNode = (node, config) => {
679
+ return __spreadProps(__spreadValues({}, node), {
680
+ props: (0, import_flat.flatten)(stripSlots(node, config).props)
460
681
  });
461
682
  };
462
683
 
@@ -502,10 +723,9 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
502
723
  const mappedItem = mapNodeOrSkip(item, path, index);
503
724
  if (!mappedItem) return item;
504
725
  const id = mappedItem.props.id;
505
- const newProps = __spreadValues({}, mappedItem.props);
506
- forEachSlot(
726
+ const newProps = __spreadProps(__spreadValues({}, mapSlots(
507
727
  mappedItem,
508
- (parentId2, slotId, content) => {
728
+ (content, parentId2, slotId) => {
509
729
  const zoneCompound = `${parentId2}:${slotId}`;
510
730
  const [_2, newContent2] = processContent(
511
731
  path,
@@ -514,18 +734,19 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
514
734
  "slot",
515
735
  parentId2
516
736
  );
517
- newProps[slotId] = newContent2;
737
+ return newContent2;
518
738
  },
519
- false,
520
- createIsSlotConfig(config)
521
- );
739
+ config
740
+ ).props), {
741
+ id
742
+ });
522
743
  processRelatedZones(item, id, path);
523
744
  const newItem = __spreadProps(__spreadValues({}, item), { props: newProps });
524
745
  const thisZoneCompound = path[path.length - 1];
525
746
  const [parentId, zone] = thisZoneCompound ? thisZoneCompound.split(":") : [null, ""];
526
747
  newNodeIndex[id] = {
527
748
  data: newItem,
528
- flatData: stripSlots(newItem),
749
+ flatData: flattenNode(newItem, config),
529
750
  path,
530
751
  parentId,
531
752
  zone
@@ -685,56 +906,17 @@ init_react_import();
685
906
 
686
907
  // ../core/lib/data/walk-tree.ts
687
908
  init_react_import();
688
-
689
- // ../core/lib/data/map-slots.ts
690
- init_react_import();
691
- function mapSlotsAsync(_0, _1) {
692
- return __async(this, arguments, function* (item, map, recursive = true, isSlot2 = isSlot) {
693
- const props = __spreadValues({}, item.props);
694
- const propKeys = Object.keys(props);
695
- for (let i = 0; i < propKeys.length; i++) {
696
- const propKey = propKeys[i];
697
- const itemType = "type" in item ? item.type : "root";
698
- if (isSlot2(itemType, propKey, props[propKey])) {
699
- const content = props[propKey];
700
- const mappedContent = recursive ? yield Promise.all(
701
- content.map((item2) => __async(this, null, function* () {
702
- return yield mapSlotsAsync(item2, map, recursive, isSlot2);
703
- }))
704
- ) : content;
705
- props[propKey] = yield map(mappedContent, propKey);
706
- }
707
- }
708
- return __spreadProps(__spreadValues({}, item), { props });
709
- });
710
- }
711
- function mapSlotsSync(item, map, isSlot2 = isSlot) {
712
- var _a, _b;
713
- const props = __spreadValues({}, item.props);
714
- const propKeys = Object.keys(props);
715
- for (let i = 0; i < propKeys.length; i++) {
716
- const propKey = propKeys[i];
717
- const itemType = "type" in item ? item.type : "root";
718
- if (isSlot2(itemType, propKey, props[propKey])) {
719
- const content = props[propKey];
720
- const mappedContent = content.map((item2) => {
721
- return mapSlotsSync(item2, map, isSlot2);
722
- });
723
- props[propKey] = (_b = map(mappedContent, (_a = props.id) != null ? _a : "root", propKey)) != null ? _b : mappedContent;
724
- }
725
- }
726
- return __spreadProps(__spreadValues({}, item), { props });
727
- }
728
-
729
- // ../core/lib/data/walk-tree.ts
730
909
  function walkTree(data, config, callbackFn) {
731
910
  var _a, _b;
732
- const isSlot2 = createIsSlotConfig(config);
733
911
  const walkItem = (item) => {
734
- return mapSlotsSync(
912
+ return mapSlots(
735
913
  item,
736
- (content, parentId, propName) => callbackFn(content, { parentId, propName }),
737
- isSlot2
914
+ (content, parentId, propName) => {
915
+ var _a2;
916
+ return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
917
+ },
918
+ config,
919
+ true
738
920
  );
739
921
  };
740
922
  if ("props" in data) {
@@ -763,7 +945,7 @@ var populateIds = (data, config, override = false) => {
763
945
  const id = generateId(data.type);
764
946
  return walkTree(
765
947
  __spreadProps(__spreadValues({}, data), {
766
- props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({ id }, data.props)
948
+ props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({}, data.props)
767
949
  }),
768
950
  config,
769
951
  (contents) => contents.map((item) => {
@@ -1420,7 +1602,11 @@ var createNodesSlice = (set, get) => ({
1420
1602
  const s = get().nodes;
1421
1603
  const emptyNode = {
1422
1604
  id,
1423
- methods: { sync: () => null },
1605
+ methods: {
1606
+ sync: () => null,
1607
+ hideOverlay: () => null,
1608
+ showOverlay: () => null
1609
+ },
1424
1610
  element: null
1425
1611
  };
1426
1612
  const existingNode = s.nodes[id];
@@ -1471,12 +1657,13 @@ var flattenData = (state, config) => {
1471
1657
 
1472
1658
  // ../core/lib/get-changed.ts
1473
1659
  init_react_import();
1660
+ var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1474
1661
  var getChanged = (newItem, oldItem) => {
1475
1662
  return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1476
1663
  const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1477
1664
  const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1478
1665
  return __spreadProps(__spreadValues({}, acc), {
1479
- [item]: oldItemProps[item] !== newItemProps[item]
1666
+ [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
1480
1667
  });
1481
1668
  }, {}) : {};
1482
1669
  };
@@ -1594,20 +1781,23 @@ var createFieldsSlice = (_set, _get) => {
1594
1781
  return {
1595
1782
  fields: {},
1596
1783
  loading: false,
1597
- lastResolvedData: {}
1784
+ lastResolvedData: {},
1785
+ id: void 0
1598
1786
  };
1599
1787
  };
1600
1788
 
1601
1789
  // ../core/lib/resolve-component-data.ts
1602
1790
  init_react_import();
1603
- var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1791
+ var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1604
1792
  var cache = { lastChange: {} };
1605
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", recursive = true) {
1793
+ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
1606
1794
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
1607
- if ((configForItem == null ? void 0 : configForItem.resolveData) && item.props) {
1608
- const id = "id" in item.props ? item.props.id : "root";
1795
+ const resolvedItem = __spreadValues({}, item);
1796
+ const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
1797
+ const id = "id" in item.props ? item.props.id : "root";
1798
+ if (shouldRunResolver) {
1609
1799
  const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1610
- if (item && (0, import_fast_deep_equal.default)(item, oldItem)) {
1800
+ if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
1611
1801
  return { node: resolved, didChange: false };
1612
1802
  }
1613
1803
  const changed = getChanged(item, oldItem);
@@ -1620,46 +1810,42 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
1620
1810
  metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
1621
1811
  trigger
1622
1812
  });
1623
- let resolvedItem = __spreadProps(__spreadValues({}, item), {
1624
- props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
1625
- });
1626
- if (recursive) {
1627
- resolvedItem = yield mapSlotsAsync(
1628
- resolvedItem,
1629
- (content) => __async(void 0, null, function* () {
1630
- return Promise.all(
1631
- content.map(
1632
- (childItem) => __async(void 0, null, function* () {
1633
- return (yield resolveComponentData(
1634
- childItem,
1635
- config,
1636
- metadata,
1637
- onResolveStart,
1638
- onResolveEnd,
1639
- trigger,
1640
- false
1641
- )).node;
1642
- })
1643
- )
1644
- );
1645
- }),
1646
- false,
1647
- createIsSlotConfig(config)
1648
- );
1649
- }
1813
+ resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
1650
1814
  if (Object.keys(readOnly).length) {
1651
1815
  resolvedItem.readOnly = readOnly;
1652
1816
  }
1653
- cache.lastChange[id] = {
1654
- item,
1655
- resolved: resolvedItem
1656
- };
1657
- if (onResolveEnd) {
1658
- onResolveEnd(resolvedItem);
1659
- }
1660
- return { node: resolvedItem, didChange: !(0, import_fast_deep_equal.default)(item, resolvedItem) };
1661
1817
  }
1662
- return { node: item, didChange: false };
1818
+ let itemWithResolvedChildren = yield mapSlots(
1819
+ resolvedItem,
1820
+ (content) => __async(void 0, null, function* () {
1821
+ return yield Promise.all(
1822
+ content.map(
1823
+ (childItem) => __async(void 0, null, function* () {
1824
+ return (yield resolveComponentData(
1825
+ childItem,
1826
+ config,
1827
+ metadata,
1828
+ onResolveStart,
1829
+ onResolveEnd,
1830
+ trigger
1831
+ )).node;
1832
+ })
1833
+ )
1834
+ );
1835
+ }),
1836
+ config
1837
+ );
1838
+ if (shouldRunResolver && onResolveEnd) {
1839
+ onResolveEnd(resolvedItem);
1840
+ }
1841
+ cache.lastChange[id] = {
1842
+ item,
1843
+ resolved: itemWithResolvedChildren
1844
+ };
1845
+ return {
1846
+ node: itemWithResolvedChildren,
1847
+ didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
1848
+ };
1663
1849
  });
1664
1850
 
1665
1851
  // ../core/lib/data/to-root.ts
@@ -1679,7 +1865,8 @@ var toRoot = (item) => {
1679
1865
  return { props: {}, readOnly };
1680
1866
  };
1681
1867
 
1682
- // ../core/store/index.ts
1868
+ // ../core/store/default-app-state.ts
1869
+ init_react_import();
1683
1870
  var defaultAppState = {
1684
1871
  data: { content: [], root: {}, zones: {} },
1685
1872
  ui: {
@@ -1705,6 +1892,8 @@ var defaultAppState = {
1705
1892
  zones: {}
1706
1893
  }
1707
1894
  };
1895
+
1896
+ // ../core/store/index.ts
1708
1897
  var defaultPageFields = {
1709
1898
  title: { type: "text" }
1710
1899
  };
package/dist/index.mjs CHANGED
@@ -146,6 +146,120 @@ var require_classnames = __commonJS({
146
146
  }
147
147
  });
148
148
 
149
+ // ../../node_modules/flat/index.js
150
+ var require_flat = __commonJS({
151
+ "../../node_modules/flat/index.js"(exports, module) {
152
+ "use strict";
153
+ init_react_import();
154
+ module.exports = flatten3;
155
+ flatten3.flatten = flatten3;
156
+ flatten3.unflatten = unflatten2;
157
+ function isBuffer(obj) {
158
+ return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
159
+ }
160
+ function keyIdentity(key) {
161
+ return key;
162
+ }
163
+ function flatten3(target, opts) {
164
+ opts = opts || {};
165
+ const delimiter = opts.delimiter || ".";
166
+ const maxDepth = opts.maxDepth;
167
+ const transformKey = opts.transformKey || keyIdentity;
168
+ const output = {};
169
+ function step(object, prev, currentDepth) {
170
+ currentDepth = currentDepth || 1;
171
+ Object.keys(object).forEach(function(key) {
172
+ const value = object[key];
173
+ const isarray = opts.safe && Array.isArray(value);
174
+ const type = Object.prototype.toString.call(value);
175
+ const isbuffer = isBuffer(value);
176
+ const isobject = type === "[object Object]" || type === "[object Array]";
177
+ const newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);
178
+ if (!isarray && !isbuffer && isobject && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) {
179
+ return step(value, newKey, currentDepth + 1);
180
+ }
181
+ output[newKey] = value;
182
+ });
183
+ }
184
+ step(target);
185
+ return output;
186
+ }
187
+ function unflatten2(target, opts) {
188
+ opts = opts || {};
189
+ const delimiter = opts.delimiter || ".";
190
+ const overwrite = opts.overwrite || false;
191
+ const transformKey = opts.transformKey || keyIdentity;
192
+ const result = {};
193
+ const isbuffer = isBuffer(target);
194
+ if (isbuffer || Object.prototype.toString.call(target) !== "[object Object]") {
195
+ return target;
196
+ }
197
+ function getkey(key) {
198
+ const parsedKey = Number(key);
199
+ return isNaN(parsedKey) || key.indexOf(".") !== -1 || opts.object ? key : parsedKey;
200
+ }
201
+ function addKeys(keyPrefix, recipient, target2) {
202
+ return Object.keys(target2).reduce(function(result2, key) {
203
+ result2[keyPrefix + delimiter + key] = target2[key];
204
+ return result2;
205
+ }, recipient);
206
+ }
207
+ function isEmpty(val) {
208
+ const type = Object.prototype.toString.call(val);
209
+ const isArray = type === "[object Array]";
210
+ const isObject = type === "[object Object]";
211
+ if (!val) {
212
+ return true;
213
+ } else if (isArray) {
214
+ return !val.length;
215
+ } else if (isObject) {
216
+ return !Object.keys(val).length;
217
+ }
218
+ }
219
+ target = Object.keys(target).reduce(function(result2, key) {
220
+ const type = Object.prototype.toString.call(target[key]);
221
+ const isObject = type === "[object Object]" || type === "[object Array]";
222
+ if (!isObject || isEmpty(target[key])) {
223
+ result2[key] = target[key];
224
+ return result2;
225
+ } else {
226
+ return addKeys(
227
+ key,
228
+ result2,
229
+ flatten3(target[key], opts)
230
+ );
231
+ }
232
+ }, {});
233
+ Object.keys(target).forEach(function(key) {
234
+ const split = key.split(delimiter).map(transformKey);
235
+ let key1 = getkey(split.shift());
236
+ let key2 = getkey(split[0]);
237
+ let recipient = result;
238
+ while (key2 !== void 0) {
239
+ if (key1 === "__proto__") {
240
+ return;
241
+ }
242
+ const type = Object.prototype.toString.call(recipient[key1]);
243
+ const isobject = type === "[object Object]" || type === "[object Array]";
244
+ if (!overwrite && !isobject && typeof recipient[key1] !== "undefined") {
245
+ return;
246
+ }
247
+ if (overwrite && !isobject || !overwrite && recipient[key1] == null) {
248
+ recipient[key1] = typeof key2 === "number" && !opts.object ? [] : {};
249
+ }
250
+ recipient = recipient[key1];
251
+ if (split.length > 0) {
252
+ key1 = getkey(split.shift());
253
+ key2 = getkey(split[0]);
254
+ }
255
+ }
256
+ recipient[key1] = unflatten2(target[key], opts);
257
+ });
258
+ return result;
259
+ }
260
+ }
261
+ });
262
+
149
263
  // ../../node_modules/fast-deep-equal/index.js
150
264
  var require_fast_deep_equal = __commonJS({
151
265
  "../../node_modules/fast-deep-equal/index.js"(exports, module) {
@@ -362,43 +476,6 @@ init_react_import();
362
476
  // ../core/lib/data/walk-app-state.ts
363
477
  init_react_import();
364
478
 
365
- // ../core/lib/data/for-each-slot.ts
366
- init_react_import();
367
-
368
- // ../core/lib/data/is-slot.ts
369
- init_react_import();
370
- var isSlot = (prop) => {
371
- var _a, _b;
372
- return Array.isArray(prop) && typeof ((_a = prop[0]) == null ? void 0 : _a.type) === "string" && typeof ((_b = prop[0]) == null ? void 0 : _b.props) === "object";
373
- };
374
- var createIsSlotConfig = (config) => (itemType, propName, propValue) => {
375
- var _a, _b;
376
- const configForComponent = itemType === "root" ? config == null ? void 0 : config.root : config == null ? void 0 : config.components[itemType];
377
- if (!configForComponent) return isSlot(propValue);
378
- return ((_b = (_a = configForComponent.fields) == null ? void 0 : _a[propName]) == null ? void 0 : _b.type) === "slot";
379
- };
380
-
381
- // ../core/lib/data/for-each-slot.ts
382
- var forEachSlot = (item, cb, recursive = false, isSlot2 = isSlot) => {
383
- const props = item.props || {};
384
- const propKeys = Object.keys(props);
385
- for (let i = 0; i < propKeys.length; i++) {
386
- const propKey = propKeys[i];
387
- const itemType = "type" in item ? item.type : "root";
388
- if (isSlot2(itemType, propKey, props[propKey])) {
389
- const content = props[propKey];
390
- cb(props.id, propKey, content);
391
- if (recursive) {
392
- content.forEach(
393
- (childItem) => __async(void 0, null, function* () {
394
- return forEachSlot(childItem, cb, true, isSlot2);
395
- })
396
- );
397
- }
398
- }
399
- }
400
- };
401
-
402
479
  // ../core/lib/data/for-related-zones.ts
403
480
  init_react_import();
404
481
 
@@ -432,19 +509,163 @@ function forRelatedZones(item, data, cb, path = []) {
432
509
  });
433
510
  }
434
511
 
512
+ // ../core/lib/data/map-slots.ts
513
+ init_react_import();
514
+
515
+ // ../core/lib/data/default-slots.ts
516
+ init_react_import();
517
+ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
518
+ (acc, fieldName) => fields[fieldName].type === "slot" ? __spreadValues({ [fieldName]: [] }, acc) : acc,
519
+ value
520
+ );
521
+
522
+ // ../core/lib/data/map-slots.ts
523
+ var isPromise = (v) => !!v && typeof v.then === "function";
524
+ var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
525
+ var containsPromise = (arr) => arr.some(isPromise);
526
+ var walkField = ({
527
+ value,
528
+ fields,
529
+ map,
530
+ propKey = "",
531
+ propPath = "",
532
+ id = "",
533
+ config,
534
+ recurseSlots = false
535
+ }) => {
536
+ var _a, _b, _c;
537
+ if (((_a = fields[propKey]) == null ? void 0 : _a.type) === "slot") {
538
+ const content = value || [];
539
+ const mappedContent = recurseSlots ? content.map((el) => {
540
+ var _a2;
541
+ const componentConfig = config.components[el.type];
542
+ if (!componentConfig) {
543
+ throw new Error(`Could not find component config for ${el.type}`);
544
+ }
545
+ const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
546
+ return walkField({
547
+ value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
548
+ fields: fields2,
549
+ map,
550
+ id: el.props.id,
551
+ config,
552
+ recurseSlots
553
+ });
554
+ }) : content;
555
+ if (containsPromise(mappedContent)) {
556
+ return Promise.all(mappedContent);
557
+ }
558
+ return map(mappedContent, id, propPath, fields[propKey], propPath);
559
+ }
560
+ if (value && typeof value === "object") {
561
+ if (Array.isArray(value)) {
562
+ const arrayFields = ((_b = fields[propKey]) == null ? void 0 : _b.type) === "array" ? fields[propKey].arrayFields : null;
563
+ if (!arrayFields) return value;
564
+ const newValue = value.map(
565
+ (el, idx) => walkField({
566
+ value: el,
567
+ fields: arrayFields,
568
+ map,
569
+ propKey,
570
+ propPath: `${propPath}[${idx}]`,
571
+ id,
572
+ config,
573
+ recurseSlots
574
+ })
575
+ );
576
+ if (containsPromise(newValue)) {
577
+ return Promise.all(newValue);
578
+ }
579
+ return newValue;
580
+ } else if ("$$typeof" in value) {
581
+ return value;
582
+ } else {
583
+ const objectFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "object" ? fields[propKey].objectFields : fields;
584
+ return walkObject({
585
+ value,
586
+ fields: objectFields,
587
+ map,
588
+ id,
589
+ getPropPath: (k) => `${propPath}.${k}`,
590
+ config,
591
+ recurseSlots
592
+ });
593
+ }
594
+ }
595
+ return value;
596
+ };
597
+ var walkObject = ({
598
+ value,
599
+ fields,
600
+ map,
601
+ id,
602
+ getPropPath,
603
+ config,
604
+ recurseSlots
605
+ }) => {
606
+ const newProps = Object.entries(value).map(([k, v]) => {
607
+ const opts = {
608
+ value: v,
609
+ fields,
610
+ map,
611
+ propKey: k,
612
+ propPath: getPropPath(k),
613
+ id,
614
+ config,
615
+ recurseSlots
616
+ };
617
+ const newValue = walkField(opts);
618
+ if (isPromise(newValue)) {
619
+ return newValue.then((resolvedValue) => ({
620
+ [k]: resolvedValue
621
+ }));
622
+ }
623
+ return {
624
+ [k]: newValue
625
+ };
626
+ }, {});
627
+ if (containsPromise(newProps)) {
628
+ return Promise.all(newProps).then(flatten);
629
+ }
630
+ return flatten(newProps);
631
+ };
632
+ function mapSlots(item, map, config, recurseSlots = false) {
633
+ var _a, _b, _c, _d, _e;
634
+ const itemType = "type" in item ? item.type : "root";
635
+ const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
636
+ const newProps = walkObject({
637
+ value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
638
+ fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
639
+ map,
640
+ id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
641
+ getPropPath: (k) => k,
642
+ config,
643
+ recurseSlots
644
+ });
645
+ if (isPromise(newProps)) {
646
+ return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
647
+ props: resolvedProps
648
+ }));
649
+ }
650
+ return __spreadProps(__spreadValues({}, item), {
651
+ props: newProps
652
+ });
653
+ }
654
+
655
+ // ../core/lib/data/flatten-node.ts
656
+ init_react_import();
657
+ var import_flat = __toESM(require_flat());
658
+
435
659
  // ../core/lib/data/strip-slots.ts
436
660
  init_react_import();
437
- var stripSlots = (data) => {
438
- return __spreadProps(__spreadValues({}, data), {
439
- props: Object.entries(data.props).reduce(
440
- (acc, [propKey, propVal]) => {
441
- if (isSlot(propVal)) {
442
- return acc;
443
- }
444
- return __spreadProps(__spreadValues({}, acc), { [propKey]: propVal });
445
- },
446
- { id: data.props.id }
447
- )
661
+ var stripSlots = (data, config) => {
662
+ return mapSlots(data, () => null, config);
663
+ };
664
+
665
+ // ../core/lib/data/flatten-node.ts
666
+ var flattenNode = (node, config) => {
667
+ return __spreadProps(__spreadValues({}, node), {
668
+ props: (0, import_flat.flatten)(stripSlots(node, config).props)
448
669
  });
449
670
  };
450
671
 
@@ -490,10 +711,9 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
490
711
  const mappedItem = mapNodeOrSkip(item, path, index);
491
712
  if (!mappedItem) return item;
492
713
  const id = mappedItem.props.id;
493
- const newProps = __spreadValues({}, mappedItem.props);
494
- forEachSlot(
714
+ const newProps = __spreadProps(__spreadValues({}, mapSlots(
495
715
  mappedItem,
496
- (parentId2, slotId, content) => {
716
+ (content, parentId2, slotId) => {
497
717
  const zoneCompound = `${parentId2}:${slotId}`;
498
718
  const [_2, newContent2] = processContent(
499
719
  path,
@@ -502,18 +722,19 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
502
722
  "slot",
503
723
  parentId2
504
724
  );
505
- newProps[slotId] = newContent2;
725
+ return newContent2;
506
726
  },
507
- false,
508
- createIsSlotConfig(config)
509
- );
727
+ config
728
+ ).props), {
729
+ id
730
+ });
510
731
  processRelatedZones(item, id, path);
511
732
  const newItem = __spreadProps(__spreadValues({}, item), { props: newProps });
512
733
  const thisZoneCompound = path[path.length - 1];
513
734
  const [parentId, zone] = thisZoneCompound ? thisZoneCompound.split(":") : [null, ""];
514
735
  newNodeIndex[id] = {
515
736
  data: newItem,
516
- flatData: stripSlots(newItem),
737
+ flatData: flattenNode(newItem, config),
517
738
  path,
518
739
  parentId,
519
740
  zone
@@ -673,56 +894,17 @@ init_react_import();
673
894
 
674
895
  // ../core/lib/data/walk-tree.ts
675
896
  init_react_import();
676
-
677
- // ../core/lib/data/map-slots.ts
678
- init_react_import();
679
- function mapSlotsAsync(_0, _1) {
680
- return __async(this, arguments, function* (item, map, recursive = true, isSlot2 = isSlot) {
681
- const props = __spreadValues({}, item.props);
682
- const propKeys = Object.keys(props);
683
- for (let i = 0; i < propKeys.length; i++) {
684
- const propKey = propKeys[i];
685
- const itemType = "type" in item ? item.type : "root";
686
- if (isSlot2(itemType, propKey, props[propKey])) {
687
- const content = props[propKey];
688
- const mappedContent = recursive ? yield Promise.all(
689
- content.map((item2) => __async(this, null, function* () {
690
- return yield mapSlotsAsync(item2, map, recursive, isSlot2);
691
- }))
692
- ) : content;
693
- props[propKey] = yield map(mappedContent, propKey);
694
- }
695
- }
696
- return __spreadProps(__spreadValues({}, item), { props });
697
- });
698
- }
699
- function mapSlotsSync(item, map, isSlot2 = isSlot) {
700
- var _a, _b;
701
- const props = __spreadValues({}, item.props);
702
- const propKeys = Object.keys(props);
703
- for (let i = 0; i < propKeys.length; i++) {
704
- const propKey = propKeys[i];
705
- const itemType = "type" in item ? item.type : "root";
706
- if (isSlot2(itemType, propKey, props[propKey])) {
707
- const content = props[propKey];
708
- const mappedContent = content.map((item2) => {
709
- return mapSlotsSync(item2, map, isSlot2);
710
- });
711
- props[propKey] = (_b = map(mappedContent, (_a = props.id) != null ? _a : "root", propKey)) != null ? _b : mappedContent;
712
- }
713
- }
714
- return __spreadProps(__spreadValues({}, item), { props });
715
- }
716
-
717
- // ../core/lib/data/walk-tree.ts
718
897
  function walkTree(data, config, callbackFn) {
719
898
  var _a, _b;
720
- const isSlot2 = createIsSlotConfig(config);
721
899
  const walkItem = (item) => {
722
- return mapSlotsSync(
900
+ return mapSlots(
723
901
  item,
724
- (content, parentId, propName) => callbackFn(content, { parentId, propName }),
725
- isSlot2
902
+ (content, parentId, propName) => {
903
+ var _a2;
904
+ return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
905
+ },
906
+ config,
907
+ true
726
908
  );
727
909
  };
728
910
  if ("props" in data) {
@@ -751,7 +933,7 @@ var populateIds = (data, config, override = false) => {
751
933
  const id = generateId(data.type);
752
934
  return walkTree(
753
935
  __spreadProps(__spreadValues({}, data), {
754
- props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({ id }, data.props)
936
+ props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({}, data.props)
755
937
  }),
756
938
  config,
757
939
  (contents) => contents.map((item) => {
@@ -1408,7 +1590,11 @@ var createNodesSlice = (set, get) => ({
1408
1590
  const s = get().nodes;
1409
1591
  const emptyNode = {
1410
1592
  id,
1411
- methods: { sync: () => null },
1593
+ methods: {
1594
+ sync: () => null,
1595
+ hideOverlay: () => null,
1596
+ showOverlay: () => null
1597
+ },
1412
1598
  element: null
1413
1599
  };
1414
1600
  const existingNode = s.nodes[id];
@@ -1459,12 +1645,13 @@ var flattenData = (state, config) => {
1459
1645
 
1460
1646
  // ../core/lib/get-changed.ts
1461
1647
  init_react_import();
1648
+ var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1462
1649
  var getChanged = (newItem, oldItem) => {
1463
1650
  return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1464
1651
  const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1465
1652
  const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1466
1653
  return __spreadProps(__spreadValues({}, acc), {
1467
- [item]: oldItemProps[item] !== newItemProps[item]
1654
+ [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
1468
1655
  });
1469
1656
  }, {}) : {};
1470
1657
  };
@@ -1582,20 +1769,23 @@ var createFieldsSlice = (_set, _get) => {
1582
1769
  return {
1583
1770
  fields: {},
1584
1771
  loading: false,
1585
- lastResolvedData: {}
1772
+ lastResolvedData: {},
1773
+ id: void 0
1586
1774
  };
1587
1775
  };
1588
1776
 
1589
1777
  // ../core/lib/resolve-component-data.ts
1590
1778
  init_react_import();
1591
- var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1779
+ var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1592
1780
  var cache = { lastChange: {} };
1593
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", recursive = true) {
1781
+ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
1594
1782
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
1595
- if ((configForItem == null ? void 0 : configForItem.resolveData) && item.props) {
1596
- const id = "id" in item.props ? item.props.id : "root";
1783
+ const resolvedItem = __spreadValues({}, item);
1784
+ const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
1785
+ const id = "id" in item.props ? item.props.id : "root";
1786
+ if (shouldRunResolver) {
1597
1787
  const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1598
- if (item && (0, import_fast_deep_equal.default)(item, oldItem)) {
1788
+ if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
1599
1789
  return { node: resolved, didChange: false };
1600
1790
  }
1601
1791
  const changed = getChanged(item, oldItem);
@@ -1608,46 +1798,42 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
1608
1798
  metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
1609
1799
  trigger
1610
1800
  });
1611
- let resolvedItem = __spreadProps(__spreadValues({}, item), {
1612
- props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
1613
- });
1614
- if (recursive) {
1615
- resolvedItem = yield mapSlotsAsync(
1616
- resolvedItem,
1617
- (content) => __async(void 0, null, function* () {
1618
- return Promise.all(
1619
- content.map(
1620
- (childItem) => __async(void 0, null, function* () {
1621
- return (yield resolveComponentData(
1622
- childItem,
1623
- config,
1624
- metadata,
1625
- onResolveStart,
1626
- onResolveEnd,
1627
- trigger,
1628
- false
1629
- )).node;
1630
- })
1631
- )
1632
- );
1633
- }),
1634
- false,
1635
- createIsSlotConfig(config)
1636
- );
1637
- }
1801
+ resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
1638
1802
  if (Object.keys(readOnly).length) {
1639
1803
  resolvedItem.readOnly = readOnly;
1640
1804
  }
1641
- cache.lastChange[id] = {
1642
- item,
1643
- resolved: resolvedItem
1644
- };
1645
- if (onResolveEnd) {
1646
- onResolveEnd(resolvedItem);
1647
- }
1648
- return { node: resolvedItem, didChange: !(0, import_fast_deep_equal.default)(item, resolvedItem) };
1649
1805
  }
1650
- return { node: item, didChange: false };
1806
+ let itemWithResolvedChildren = yield mapSlots(
1807
+ resolvedItem,
1808
+ (content) => __async(void 0, null, function* () {
1809
+ return yield Promise.all(
1810
+ content.map(
1811
+ (childItem) => __async(void 0, null, function* () {
1812
+ return (yield resolveComponentData(
1813
+ childItem,
1814
+ config,
1815
+ metadata,
1816
+ onResolveStart,
1817
+ onResolveEnd,
1818
+ trigger
1819
+ )).node;
1820
+ })
1821
+ )
1822
+ );
1823
+ }),
1824
+ config
1825
+ );
1826
+ if (shouldRunResolver && onResolveEnd) {
1827
+ onResolveEnd(resolvedItem);
1828
+ }
1829
+ cache.lastChange[id] = {
1830
+ item,
1831
+ resolved: itemWithResolvedChildren
1832
+ };
1833
+ return {
1834
+ node: itemWithResolvedChildren,
1835
+ didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
1836
+ };
1651
1837
  });
1652
1838
 
1653
1839
  // ../core/lib/data/to-root.ts
@@ -1667,7 +1853,8 @@ var toRoot = (item) => {
1667
1853
  return { props: {}, readOnly };
1668
1854
  };
1669
1855
 
1670
- // ../core/store/index.ts
1856
+ // ../core/store/default-app-state.ts
1857
+ init_react_import();
1671
1858
  var defaultAppState = {
1672
1859
  data: { content: [], root: {}, zones: {} },
1673
1860
  ui: {
@@ -1693,6 +1880,8 @@ var defaultAppState = {
1693
1880
  zones: {}
1694
1881
  }
1695
1882
  };
1883
+
1884
+ // ../core/store/index.ts
1696
1885
  var defaultPageFields = {
1697
1886
  title: { type: "text" }
1698
1887
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck-plugin-heading-analyzer",
3
- "version": "0.19.0-canary.fb0e8e24",
3
+ "version": "0.19.0",
4
4
  "author": "Chris Villa <chris@puckeditor.com>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",
@@ -25,7 +25,7 @@
25
25
  "dist"
26
26
  ],
27
27
  "devDependencies": {
28
- "@measured/puck": "^0.19.0-canary.fb0e8e24",
28
+ "@measured/puck": "^0.19.0",
29
29
  "@types/react": "^19.0.1",
30
30
  "@types/react-dom": "^19.0.2",
31
31
  "eslint": "^7.32.0",