@measured/puck-plugin-heading-analyzer 0.19.0-canary.fb0e8e24 → 0.19.1-canary.083aa3d5

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,164 @@ 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 { flatten: flatten2, unflatten } = import_flat.default;
679
+ var flattenNode = (node, config) => {
680
+ return __spreadProps(__spreadValues({}, node), {
681
+ props: flatten2(stripSlots(node, config).props)
460
682
  });
461
683
  };
462
684
 
@@ -502,10 +724,9 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
502
724
  const mappedItem = mapNodeOrSkip(item, path, index);
503
725
  if (!mappedItem) return item;
504
726
  const id = mappedItem.props.id;
505
- const newProps = __spreadValues({}, mappedItem.props);
506
- forEachSlot(
727
+ const newProps = __spreadProps(__spreadValues({}, mapSlots(
507
728
  mappedItem,
508
- (parentId2, slotId, content) => {
729
+ (content, parentId2, slotId) => {
509
730
  const zoneCompound = `${parentId2}:${slotId}`;
510
731
  const [_2, newContent2] = processContent(
511
732
  path,
@@ -514,18 +735,19 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
514
735
  "slot",
515
736
  parentId2
516
737
  );
517
- newProps[slotId] = newContent2;
738
+ return newContent2;
518
739
  },
519
- false,
520
- createIsSlotConfig(config)
521
- );
740
+ config
741
+ ).props), {
742
+ id
743
+ });
522
744
  processRelatedZones(item, id, path);
523
745
  const newItem = __spreadProps(__spreadValues({}, item), { props: newProps });
524
746
  const thisZoneCompound = path[path.length - 1];
525
747
  const [parentId, zone] = thisZoneCompound ? thisZoneCompound.split(":") : [null, ""];
526
748
  newNodeIndex[id] = {
527
749
  data: newItem,
528
- flatData: stripSlots(newItem),
750
+ flatData: flattenNode(newItem, config),
529
751
  path,
530
752
  parentId,
531
753
  zone
@@ -685,56 +907,17 @@ init_react_import();
685
907
 
686
908
  // ../core/lib/data/walk-tree.ts
687
909
  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
910
  function walkTree(data, config, callbackFn) {
731
911
  var _a, _b;
732
- const isSlot2 = createIsSlotConfig(config);
733
912
  const walkItem = (item) => {
734
- return mapSlotsSync(
913
+ return mapSlots(
735
914
  item,
736
- (content, parentId, propName) => callbackFn(content, { parentId, propName }),
737
- isSlot2
915
+ (content, parentId, propName) => {
916
+ var _a2;
917
+ return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
918
+ },
919
+ config,
920
+ true
738
921
  );
739
922
  };
740
923
  if ("props" in data) {
@@ -763,7 +946,7 @@ var populateIds = (data, config, override = false) => {
763
946
  const id = generateId(data.type);
764
947
  return walkTree(
765
948
  __spreadProps(__spreadValues({}, data), {
766
- props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({ id }, data.props)
949
+ props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({}, data.props)
767
950
  }),
768
951
  config,
769
952
  (contents) => contents.map((item) => {
@@ -1420,7 +1603,11 @@ var createNodesSlice = (set, get) => ({
1420
1603
  const s = get().nodes;
1421
1604
  const emptyNode = {
1422
1605
  id,
1423
- methods: { sync: () => null },
1606
+ methods: {
1607
+ sync: () => null,
1608
+ hideOverlay: () => null,
1609
+ showOverlay: () => null
1610
+ },
1424
1611
  element: null
1425
1612
  };
1426
1613
  const existingNode = s.nodes[id];
@@ -1471,12 +1658,13 @@ var flattenData = (state, config) => {
1471
1658
 
1472
1659
  // ../core/lib/get-changed.ts
1473
1660
  init_react_import();
1661
+ var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1474
1662
  var getChanged = (newItem, oldItem) => {
1475
1663
  return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1476
1664
  const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1477
1665
  const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1478
1666
  return __spreadProps(__spreadValues({}, acc), {
1479
- [item]: oldItemProps[item] !== newItemProps[item]
1667
+ [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
1480
1668
  });
1481
1669
  }, {}) : {};
1482
1670
  };
@@ -1594,20 +1782,23 @@ var createFieldsSlice = (_set, _get) => {
1594
1782
  return {
1595
1783
  fields: {},
1596
1784
  loading: false,
1597
- lastResolvedData: {}
1785
+ lastResolvedData: {},
1786
+ id: void 0
1598
1787
  };
1599
1788
  };
1600
1789
 
1601
1790
  // ../core/lib/resolve-component-data.ts
1602
1791
  init_react_import();
1603
- var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1792
+ var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1604
1793
  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) {
1794
+ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
1606
1795
  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";
1796
+ const resolvedItem = __spreadValues({}, item);
1797
+ const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
1798
+ const id = "id" in item.props ? item.props.id : "root";
1799
+ if (shouldRunResolver) {
1609
1800
  const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1610
- if (item && (0, import_fast_deep_equal.default)(item, oldItem)) {
1801
+ if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
1611
1802
  return { node: resolved, didChange: false };
1612
1803
  }
1613
1804
  const changed = getChanged(item, oldItem);
@@ -1620,46 +1811,42 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
1620
1811
  metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
1621
1812
  trigger
1622
1813
  });
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
- }
1814
+ resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
1650
1815
  if (Object.keys(readOnly).length) {
1651
1816
  resolvedItem.readOnly = readOnly;
1652
1817
  }
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
1818
  }
1662
- return { node: item, didChange: false };
1819
+ let itemWithResolvedChildren = yield mapSlots(
1820
+ resolvedItem,
1821
+ (content) => __async(void 0, null, function* () {
1822
+ return yield Promise.all(
1823
+ content.map(
1824
+ (childItem) => __async(void 0, null, function* () {
1825
+ return (yield resolveComponentData(
1826
+ childItem,
1827
+ config,
1828
+ metadata,
1829
+ onResolveStart,
1830
+ onResolveEnd,
1831
+ trigger
1832
+ )).node;
1833
+ })
1834
+ )
1835
+ );
1836
+ }),
1837
+ config
1838
+ );
1839
+ if (shouldRunResolver && onResolveEnd) {
1840
+ onResolveEnd(resolvedItem);
1841
+ }
1842
+ cache.lastChange[id] = {
1843
+ item,
1844
+ resolved: itemWithResolvedChildren
1845
+ };
1846
+ return {
1847
+ node: itemWithResolvedChildren,
1848
+ didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
1849
+ };
1663
1850
  });
1664
1851
 
1665
1852
  // ../core/lib/data/to-root.ts
@@ -1679,7 +1866,8 @@ var toRoot = (item) => {
1679
1866
  return { props: {}, readOnly };
1680
1867
  };
1681
1868
 
1682
- // ../core/store/index.ts
1869
+ // ../core/store/default-app-state.ts
1870
+ init_react_import();
1683
1871
  var defaultAppState = {
1684
1872
  data: { content: [], root: {}, zones: {} },
1685
1873
  ui: {
@@ -1705,6 +1893,8 @@ var defaultAppState = {
1705
1893
  zones: {}
1706
1894
  }
1707
1895
  };
1896
+
1897
+ // ../core/store/index.ts
1708
1898
  var defaultPageFields = {
1709
1899
  title: { type: "text" }
1710
1900
  };
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,164 @@ 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 { flatten: flatten2, unflatten } = import_flat.default;
667
+ var flattenNode = (node, config) => {
668
+ return __spreadProps(__spreadValues({}, node), {
669
+ props: flatten2(stripSlots(node, config).props)
448
670
  });
449
671
  };
450
672
 
@@ -490,10 +712,9 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
490
712
  const mappedItem = mapNodeOrSkip(item, path, index);
491
713
  if (!mappedItem) return item;
492
714
  const id = mappedItem.props.id;
493
- const newProps = __spreadValues({}, mappedItem.props);
494
- forEachSlot(
715
+ const newProps = __spreadProps(__spreadValues({}, mapSlots(
495
716
  mappedItem,
496
- (parentId2, slotId, content) => {
717
+ (content, parentId2, slotId) => {
497
718
  const zoneCompound = `${parentId2}:${slotId}`;
498
719
  const [_2, newContent2] = processContent(
499
720
  path,
@@ -502,18 +723,19 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
502
723
  "slot",
503
724
  parentId2
504
725
  );
505
- newProps[slotId] = newContent2;
726
+ return newContent2;
506
727
  },
507
- false,
508
- createIsSlotConfig(config)
509
- );
728
+ config
729
+ ).props), {
730
+ id
731
+ });
510
732
  processRelatedZones(item, id, path);
511
733
  const newItem = __spreadProps(__spreadValues({}, item), { props: newProps });
512
734
  const thisZoneCompound = path[path.length - 1];
513
735
  const [parentId, zone] = thisZoneCompound ? thisZoneCompound.split(":") : [null, ""];
514
736
  newNodeIndex[id] = {
515
737
  data: newItem,
516
- flatData: stripSlots(newItem),
738
+ flatData: flattenNode(newItem, config),
517
739
  path,
518
740
  parentId,
519
741
  zone
@@ -673,56 +895,17 @@ init_react_import();
673
895
 
674
896
  // ../core/lib/data/walk-tree.ts
675
897
  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
898
  function walkTree(data, config, callbackFn) {
719
899
  var _a, _b;
720
- const isSlot2 = createIsSlotConfig(config);
721
900
  const walkItem = (item) => {
722
- return mapSlotsSync(
901
+ return mapSlots(
723
902
  item,
724
- (content, parentId, propName) => callbackFn(content, { parentId, propName }),
725
- isSlot2
903
+ (content, parentId, propName) => {
904
+ var _a2;
905
+ return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
906
+ },
907
+ config,
908
+ true
726
909
  );
727
910
  };
728
911
  if ("props" in data) {
@@ -751,7 +934,7 @@ var populateIds = (data, config, override = false) => {
751
934
  const id = generateId(data.type);
752
935
  return walkTree(
753
936
  __spreadProps(__spreadValues({}, data), {
754
- props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({ id }, data.props)
937
+ props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({}, data.props)
755
938
  }),
756
939
  config,
757
940
  (contents) => contents.map((item) => {
@@ -1408,7 +1591,11 @@ var createNodesSlice = (set, get) => ({
1408
1591
  const s = get().nodes;
1409
1592
  const emptyNode = {
1410
1593
  id,
1411
- methods: { sync: () => null },
1594
+ methods: {
1595
+ sync: () => null,
1596
+ hideOverlay: () => null,
1597
+ showOverlay: () => null
1598
+ },
1412
1599
  element: null
1413
1600
  };
1414
1601
  const existingNode = s.nodes[id];
@@ -1459,12 +1646,13 @@ var flattenData = (state, config) => {
1459
1646
 
1460
1647
  // ../core/lib/get-changed.ts
1461
1648
  init_react_import();
1649
+ var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1462
1650
  var getChanged = (newItem, oldItem) => {
1463
1651
  return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1464
1652
  const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1465
1653
  const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1466
1654
  return __spreadProps(__spreadValues({}, acc), {
1467
- [item]: oldItemProps[item] !== newItemProps[item]
1655
+ [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
1468
1656
  });
1469
1657
  }, {}) : {};
1470
1658
  };
@@ -1582,20 +1770,23 @@ var createFieldsSlice = (_set, _get) => {
1582
1770
  return {
1583
1771
  fields: {},
1584
1772
  loading: false,
1585
- lastResolvedData: {}
1773
+ lastResolvedData: {},
1774
+ id: void 0
1586
1775
  };
1587
1776
  };
1588
1777
 
1589
1778
  // ../core/lib/resolve-component-data.ts
1590
1779
  init_react_import();
1591
- var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1780
+ var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1592
1781
  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) {
1782
+ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
1594
1783
  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";
1784
+ const resolvedItem = __spreadValues({}, item);
1785
+ const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
1786
+ const id = "id" in item.props ? item.props.id : "root";
1787
+ if (shouldRunResolver) {
1597
1788
  const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1598
- if (item && (0, import_fast_deep_equal.default)(item, oldItem)) {
1789
+ if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
1599
1790
  return { node: resolved, didChange: false };
1600
1791
  }
1601
1792
  const changed = getChanged(item, oldItem);
@@ -1608,46 +1799,42 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
1608
1799
  metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
1609
1800
  trigger
1610
1801
  });
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
- }
1802
+ resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
1638
1803
  if (Object.keys(readOnly).length) {
1639
1804
  resolvedItem.readOnly = readOnly;
1640
1805
  }
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
1806
  }
1650
- return { node: item, didChange: false };
1807
+ let itemWithResolvedChildren = yield mapSlots(
1808
+ resolvedItem,
1809
+ (content) => __async(void 0, null, function* () {
1810
+ return yield Promise.all(
1811
+ content.map(
1812
+ (childItem) => __async(void 0, null, function* () {
1813
+ return (yield resolveComponentData(
1814
+ childItem,
1815
+ config,
1816
+ metadata,
1817
+ onResolveStart,
1818
+ onResolveEnd,
1819
+ trigger
1820
+ )).node;
1821
+ })
1822
+ )
1823
+ );
1824
+ }),
1825
+ config
1826
+ );
1827
+ if (shouldRunResolver && onResolveEnd) {
1828
+ onResolveEnd(resolvedItem);
1829
+ }
1830
+ cache.lastChange[id] = {
1831
+ item,
1832
+ resolved: itemWithResolvedChildren
1833
+ };
1834
+ return {
1835
+ node: itemWithResolvedChildren,
1836
+ didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
1837
+ };
1651
1838
  });
1652
1839
 
1653
1840
  // ../core/lib/data/to-root.ts
@@ -1667,7 +1854,8 @@ var toRoot = (item) => {
1667
1854
  return { props: {}, readOnly };
1668
1855
  };
1669
1856
 
1670
- // ../core/store/index.ts
1857
+ // ../core/store/default-app-state.ts
1858
+ init_react_import();
1671
1859
  var defaultAppState = {
1672
1860
  data: { content: [], root: {}, zones: {} },
1673
1861
  ui: {
@@ -1693,6 +1881,8 @@ var defaultAppState = {
1693
1881
  zones: {}
1694
1882
  }
1695
1883
  };
1884
+
1885
+ // ../core/store/index.ts
1696
1886
  var defaultPageFields = {
1697
1887
  title: { type: "text" }
1698
1888
  };
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.1-canary.083aa3d5",
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.1-canary.083aa3d5",
29
29
  "@types/react": "^19.0.1",
30
30
  "@types/react-dom": "^19.0.2",
31
31
  "eslint": "^7.32.0",