@measured/puck-plugin-heading-analyzer 0.19.0-canary.1286b503 → 0.19.0-canary.15d05558

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.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) {
@@ -359,45 +473,8 @@ init_react_import();
359
473
  // ../core/reducer/actions/set.ts
360
474
  init_react_import();
361
475
 
362
- // ../core/lib/data/walk-tree.ts
363
- init_react_import();
364
-
365
- // ../core/lib/data/for-each-slot.ts
366
- init_react_import();
367
-
368
- // ../core/lib/data/is-slot.ts
476
+ // ../core/lib/data/walk-app-state.ts
369
477
  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
478
 
402
479
  // ../core/lib/data/for-related-zones.ts
403
480
  init_react_import();
@@ -432,24 +509,168 @@ 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
 
451
- // ../core/lib/data/walk-tree.ts
452
- function walkTree(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
672
+ // ../core/lib/data/walk-app-state.ts
673
+ function walkAppState(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
453
674
  var _a;
454
675
  let newZones = {};
455
676
  const newZoneIndex = {};
@@ -490,10 +711,9 @@ function walkTree(state, config, mapContent = (content) => content, mapNodeOrSki
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 walkTree(state, config, mapContent = (content) => content, mapNodeOrSki
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
@@ -582,7 +803,7 @@ var setAction = (state, action, appStore) => {
582
803
  console.warn(
583
804
  "`set` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
584
805
  );
585
- return walkTree(newState, appStore.config);
806
+ return walkAppState(newState, appStore.config);
586
807
  }
587
808
  return __spreadValues(__spreadValues({}, state), action.state(state));
588
809
  };
@@ -668,18 +889,77 @@ var getIdsForParent = (zoneCompound, state) => {
668
889
  return ((node == null ? void 0 : node.path) || []).map((p) => p.split(":")[0]);
669
890
  };
670
891
 
892
+ // ../core/lib/data/populate-ids.ts
893
+ init_react_import();
894
+
895
+ // ../core/lib/data/walk-tree.ts
896
+ init_react_import();
897
+ function walkTree(data, config, callbackFn) {
898
+ var _a, _b;
899
+ const walkItem = (item) => {
900
+ return mapSlots(
901
+ item,
902
+ (content, parentId, propName) => {
903
+ var _a2;
904
+ return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
905
+ },
906
+ config,
907
+ true
908
+ );
909
+ };
910
+ if ("props" in data) {
911
+ return walkItem(data);
912
+ }
913
+ const _data = data;
914
+ const zones = (_a = _data.zones) != null ? _a : {};
915
+ const mappedContent = _data.content.map(walkItem);
916
+ return {
917
+ root: walkItem(_data.root),
918
+ content: (_b = callbackFn(mappedContent, {
919
+ parentId: "root",
920
+ propName: "default-zone"
921
+ })) != null ? _b : mappedContent,
922
+ zones: Object.keys(zones).reduce(
923
+ (acc, zoneCompound) => __spreadProps(__spreadValues({}, acc), {
924
+ [zoneCompound]: zones[zoneCompound].map(walkItem)
925
+ }),
926
+ {}
927
+ )
928
+ };
929
+ }
930
+
931
+ // ../core/lib/data/populate-ids.ts
932
+ var populateIds = (data, config, override = false) => {
933
+ const id = generateId(data.type);
934
+ return walkTree(
935
+ __spreadProps(__spreadValues({}, data), {
936
+ props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({}, data.props)
937
+ }),
938
+ config,
939
+ (contents) => contents.map((item) => {
940
+ const id2 = generateId(item.type);
941
+ return __spreadProps(__spreadValues({}, item), {
942
+ props: override ? __spreadProps(__spreadValues({}, item.props), { id: id2 }) : __spreadValues({ id: id2 }, item.props)
943
+ });
944
+ })
945
+ );
946
+ };
947
+
671
948
  // ../core/reducer/actions/insert.ts
672
949
  function insertAction(state, action, appStore) {
673
950
  const id = action.id || generateId(action.componentType);
674
- const emptyComponentData = {
675
- type: action.componentType,
676
- props: __spreadProps(__spreadValues({}, appStore.config.components[action.componentType].defaultProps || {}), {
677
- id
678
- })
679
- };
951
+ const emptyComponentData = populateIds(
952
+ {
953
+ type: action.componentType,
954
+ props: __spreadProps(__spreadValues({}, appStore.config.components[action.componentType].defaultProps || {}), {
955
+ id
956
+ })
957
+ },
958
+ appStore.config
959
+ );
680
960
  const [parentId] = action.destinationZone.split(":");
681
961
  const idsInPath = getIdsForParent(action.destinationZone, state);
682
- return walkTree(
962
+ return walkAppState(
683
963
  state,
684
964
  appStore.config,
685
965
  (content, zoneCompound) => {
@@ -717,25 +997,26 @@ var replaceAction = (state, action, appStore) => {
717
997
  `Can't change the id during a replace action. Please us "remove" and "insert" to define a new node.`
718
998
  );
719
999
  }
720
- return walkTree(
1000
+ const data = populateIds(action.data, appStore.config);
1001
+ return walkAppState(
721
1002
  state,
722
1003
  appStore.config,
723
1004
  (content, zoneCompound) => {
724
1005
  const newContent = [...content];
725
1006
  if (zoneCompound === action.destinationZone) {
726
- newContent[action.destinationIndex] = action.data;
1007
+ newContent[action.destinationIndex] = data;
727
1008
  }
728
1009
  return newContent;
729
1010
  },
730
1011
  (childItem, path) => {
731
1012
  const pathIds = path.map((p) => p.split(":")[0]);
732
- if (childItem.props.id === action.data.props.id) {
733
- return action.data;
1013
+ if (childItem.props.id === data.props.id) {
1014
+ return data;
734
1015
  } else if (childItem.props.id === parentId) {
735
1016
  return childItem;
736
1017
  } else if (idsInPath.indexOf(childItem.props.id) > -1) {
737
1018
  return childItem;
738
- } else if (pathIds.indexOf(action.data.props.id) > -1) {
1019
+ } else if (pathIds.indexOf(data.props.id) > -1) {
739
1020
  return childItem;
740
1021
  }
741
1022
  return null;
@@ -746,7 +1027,7 @@ var replaceAction = (state, action, appStore) => {
746
1027
  // ../core/reducer/actions/replace-root.ts
747
1028
  init_react_import();
748
1029
  var replaceRootAction = (state, action, appStore) => {
749
- return walkTree(
1030
+ return walkAppState(
750
1031
  state,
751
1032
  appStore.config,
752
1033
  (content) => content,
@@ -785,7 +1066,7 @@ function duplicateAction(state, action, appStore) {
785
1066
  id: generateId(item.type)
786
1067
  })
787
1068
  });
788
- const modified = walkTree(
1069
+ const modified = walkAppState(
789
1070
  state,
790
1071
  appStore.config,
791
1072
  (content, zoneCompound) => {
@@ -850,7 +1131,7 @@ var moveAction = (state, action, appStore) => {
850
1131
  if (!item) return state;
851
1132
  const idsInSourcePath = getIdsForParent(action.sourceZone, state);
852
1133
  const idsInDestinationPath = getIdsForParent(action.destinationZone, state);
853
- return walkTree(
1134
+ return walkAppState(
854
1135
  state,
855
1136
  appStore.config,
856
1137
  (content, zoneCompound) => {
@@ -908,7 +1189,7 @@ var removeAction = (state, action, appStore) => {
908
1189
  },
909
1190
  [item.props.id]
910
1191
  );
911
- const newState = walkTree(
1192
+ const newState = walkAppState(
912
1193
  state,
913
1194
  appStore.config,
914
1195
  (content, zoneCompound) => {
@@ -999,14 +1280,14 @@ var setDataAction = (state, action, appStore) => {
999
1280
  console.warn(
1000
1281
  "`setData` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
1001
1282
  );
1002
- return walkTree(
1283
+ return walkAppState(
1003
1284
  __spreadProps(__spreadValues({}, state), {
1004
1285
  data: __spreadValues(__spreadValues({}, state.data), action.data)
1005
1286
  }),
1006
1287
  appStore.config
1007
1288
  );
1008
1289
  }
1009
- return walkTree(
1290
+ return walkAppState(
1010
1291
  __spreadProps(__spreadValues({}, state), {
1011
1292
  data: __spreadValues(__spreadValues({}, state.data), action.data(state.data))
1012
1293
  }),
@@ -1309,7 +1590,11 @@ var createNodesSlice = (set, get) => ({
1309
1590
  const s = get().nodes;
1310
1591
  const emptyNode = {
1311
1592
  id,
1312
- methods: { sync: () => null },
1593
+ methods: {
1594
+ sync: () => null,
1595
+ hideOverlay: () => null,
1596
+ showOverlay: () => null
1597
+ },
1313
1598
  element: null
1314
1599
  };
1315
1600
  const existingNode = s.nodes[id];
@@ -1346,7 +1631,7 @@ import { useEffect as useEffect3 } from "react";
1346
1631
  init_react_import();
1347
1632
  var flattenData = (state, config) => {
1348
1633
  const data = [];
1349
- walkTree(
1634
+ walkAppState(
1350
1635
  state,
1351
1636
  config,
1352
1637
  (content) => content,
@@ -1360,12 +1645,13 @@ var flattenData = (state, config) => {
1360
1645
 
1361
1646
  // ../core/lib/get-changed.ts
1362
1647
  init_react_import();
1648
+ var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1363
1649
  var getChanged = (newItem, oldItem) => {
1364
1650
  return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1365
1651
  const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1366
1652
  const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1367
1653
  return __spreadProps(__spreadValues({}, acc), {
1368
- [item]: oldItemProps[item] !== newItemProps[item]
1654
+ [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
1369
1655
  });
1370
1656
  }, {}) : {};
1371
1657
  };
@@ -1483,45 +1769,23 @@ var createFieldsSlice = (_set, _get) => {
1483
1769
  return {
1484
1770
  fields: {},
1485
1771
  loading: false,
1486
- lastResolvedData: {}
1772
+ lastResolvedData: {},
1773
+ id: void 0
1487
1774
  };
1488
1775
  };
1489
1776
 
1490
1777
  // ../core/lib/resolve-component-data.ts
1491
1778
  init_react_import();
1492
-
1493
- // ../core/lib/data/map-slots.ts
1494
- init_react_import();
1495
- function mapSlotsAsync(_0, _1) {
1496
- return __async(this, arguments, function* (item, map, recursive = true, isSlot2 = isSlot) {
1497
- const props = __spreadValues({}, item.props);
1498
- const propKeys = Object.keys(props);
1499
- for (let i = 0; i < propKeys.length; i++) {
1500
- const propKey = propKeys[i];
1501
- const itemType = "type" in item ? item.type : "root";
1502
- if (isSlot2(itemType, propKey, props[propKey])) {
1503
- const content = props[propKey];
1504
- const mappedContent = recursive ? yield Promise.all(
1505
- content.map((item2) => __async(this, null, function* () {
1506
- return yield mapSlotsAsync(item2, map, recursive, isSlot2);
1507
- }))
1508
- ) : content;
1509
- props[propKey] = yield map(mappedContent, propKey);
1510
- }
1511
- }
1512
- return __spreadProps(__spreadValues({}, item), { props });
1513
- });
1514
- }
1515
-
1516
- // ../core/lib/resolve-component-data.ts
1517
- var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1779
+ var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1518
1780
  var cache = { lastChange: {} };
1519
- 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") {
1520
1782
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
1521
- if ((configForItem == null ? void 0 : configForItem.resolveData) && item.props) {
1522
- 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) {
1523
1787
  const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1524
- if (item && (0, import_fast_deep_equal.default)(item, oldItem)) {
1788
+ if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
1525
1789
  return { node: resolved, didChange: false };
1526
1790
  }
1527
1791
  const changed = getChanged(item, oldItem);
@@ -1534,46 +1798,42 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
1534
1798
  metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
1535
1799
  trigger
1536
1800
  });
1537
- let resolvedItem = __spreadProps(__spreadValues({}, item), {
1538
- props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
1539
- });
1540
- if (recursive) {
1541
- resolvedItem = yield mapSlotsAsync(
1542
- resolvedItem,
1543
- (content) => __async(void 0, null, function* () {
1544
- return Promise.all(
1545
- content.map(
1546
- (childItem) => __async(void 0, null, function* () {
1547
- return (yield resolveComponentData(
1548
- childItem,
1549
- config,
1550
- metadata,
1551
- onResolveStart,
1552
- onResolveEnd,
1553
- trigger,
1554
- false
1555
- )).node;
1556
- })
1557
- )
1558
- );
1559
- }),
1560
- false,
1561
- createIsSlotConfig(config)
1562
- );
1563
- }
1801
+ resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
1564
1802
  if (Object.keys(readOnly).length) {
1565
1803
  resolvedItem.readOnly = readOnly;
1566
1804
  }
1567
- cache.lastChange[id] = {
1568
- item,
1569
- resolved: resolvedItem
1570
- };
1571
- if (onResolveEnd) {
1572
- onResolveEnd(resolvedItem);
1573
- }
1574
- return { node: resolvedItem, didChange: !(0, import_fast_deep_equal.default)(item, resolvedItem) };
1575
1805
  }
1576
- 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
+ };
1577
1837
  });
1578
1838
 
1579
1839
  // ../core/lib/data/to-root.ts
@@ -1593,7 +1853,8 @@ var toRoot = (item) => {
1593
1853
  return { props: {}, readOnly };
1594
1854
  };
1595
1855
 
1596
- // ../core/store/index.ts
1856
+ // ../core/store/default-app-state.ts
1857
+ init_react_import();
1597
1858
  var defaultAppState = {
1598
1859
  data: { content: [], root: {}, zones: {} },
1599
1860
  ui: {
@@ -1619,6 +1880,8 @@ var defaultAppState = {
1619
1880
  zones: {}
1620
1881
  }
1621
1882
  };
1883
+
1884
+ // ../core/store/index.ts
1622
1885
  var defaultPageFields = {
1623
1886
  title: { type: "text" }
1624
1887
  };
@@ -1758,7 +2021,7 @@ var createAppStore = (initialAppStore) => create()(
1758
2021
  }),
1759
2022
  resolveAndCommitData: () => __async(void 0, null, function* () {
1760
2023
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
1761
- walkTree(
2024
+ walkAppState(
1762
2025
  state,
1763
2026
  config,
1764
2027
  (content) => content,