@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.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) {
@@ -371,45 +485,8 @@ init_react_import();
371
485
  // ../core/reducer/actions/set.ts
372
486
  init_react_import();
373
487
 
374
- // ../core/lib/data/walk-tree.ts
375
- init_react_import();
376
-
377
- // ../core/lib/data/for-each-slot.ts
378
- init_react_import();
379
-
380
- // ../core/lib/data/is-slot.ts
488
+ // ../core/lib/data/walk-app-state.ts
381
489
  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
490
 
414
491
  // ../core/lib/data/for-related-zones.ts
415
492
  init_react_import();
@@ -444,24 +521,168 @@ 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
 
463
- // ../core/lib/data/walk-tree.ts
464
- function walkTree(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
684
+ // ../core/lib/data/walk-app-state.ts
685
+ function walkAppState(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
465
686
  var _a;
466
687
  let newZones = {};
467
688
  const newZoneIndex = {};
@@ -502,10 +723,9 @@ function walkTree(state, config, mapContent = (content) => content, mapNodeOrSki
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 walkTree(state, config, mapContent = (content) => content, mapNodeOrSki
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
@@ -594,7 +815,7 @@ var setAction = (state, action, appStore) => {
594
815
  console.warn(
595
816
  "`set` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
596
817
  );
597
- return walkTree(newState, appStore.config);
818
+ return walkAppState(newState, appStore.config);
598
819
  }
599
820
  return __spreadValues(__spreadValues({}, state), action.state(state));
600
821
  };
@@ -680,18 +901,77 @@ var getIdsForParent = (zoneCompound, state) => {
680
901
  return ((node == null ? void 0 : node.path) || []).map((p) => p.split(":")[0]);
681
902
  };
682
903
 
904
+ // ../core/lib/data/populate-ids.ts
905
+ init_react_import();
906
+
907
+ // ../core/lib/data/walk-tree.ts
908
+ init_react_import();
909
+ function walkTree(data, config, callbackFn) {
910
+ var _a, _b;
911
+ const walkItem = (item) => {
912
+ return mapSlots(
913
+ item,
914
+ (content, parentId, propName) => {
915
+ var _a2;
916
+ return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
917
+ },
918
+ config,
919
+ true
920
+ );
921
+ };
922
+ if ("props" in data) {
923
+ return walkItem(data);
924
+ }
925
+ const _data = data;
926
+ const zones = (_a = _data.zones) != null ? _a : {};
927
+ const mappedContent = _data.content.map(walkItem);
928
+ return {
929
+ root: walkItem(_data.root),
930
+ content: (_b = callbackFn(mappedContent, {
931
+ parentId: "root",
932
+ propName: "default-zone"
933
+ })) != null ? _b : mappedContent,
934
+ zones: Object.keys(zones).reduce(
935
+ (acc, zoneCompound) => __spreadProps(__spreadValues({}, acc), {
936
+ [zoneCompound]: zones[zoneCompound].map(walkItem)
937
+ }),
938
+ {}
939
+ )
940
+ };
941
+ }
942
+
943
+ // ../core/lib/data/populate-ids.ts
944
+ var populateIds = (data, config, override = false) => {
945
+ const id = generateId(data.type);
946
+ return walkTree(
947
+ __spreadProps(__spreadValues({}, data), {
948
+ props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({}, data.props)
949
+ }),
950
+ config,
951
+ (contents) => contents.map((item) => {
952
+ const id2 = generateId(item.type);
953
+ return __spreadProps(__spreadValues({}, item), {
954
+ props: override ? __spreadProps(__spreadValues({}, item.props), { id: id2 }) : __spreadValues({ id: id2 }, item.props)
955
+ });
956
+ })
957
+ );
958
+ };
959
+
683
960
  // ../core/reducer/actions/insert.ts
684
961
  function insertAction(state, action, appStore) {
685
962
  const id = action.id || generateId(action.componentType);
686
- const emptyComponentData = {
687
- type: action.componentType,
688
- props: __spreadProps(__spreadValues({}, appStore.config.components[action.componentType].defaultProps || {}), {
689
- id
690
- })
691
- };
963
+ const emptyComponentData = populateIds(
964
+ {
965
+ type: action.componentType,
966
+ props: __spreadProps(__spreadValues({}, appStore.config.components[action.componentType].defaultProps || {}), {
967
+ id
968
+ })
969
+ },
970
+ appStore.config
971
+ );
692
972
  const [parentId] = action.destinationZone.split(":");
693
973
  const idsInPath = getIdsForParent(action.destinationZone, state);
694
- return walkTree(
974
+ return walkAppState(
695
975
  state,
696
976
  appStore.config,
697
977
  (content, zoneCompound) => {
@@ -729,25 +1009,26 @@ var replaceAction = (state, action, appStore) => {
729
1009
  `Can't change the id during a replace action. Please us "remove" and "insert" to define a new node.`
730
1010
  );
731
1011
  }
732
- return walkTree(
1012
+ const data = populateIds(action.data, appStore.config);
1013
+ return walkAppState(
733
1014
  state,
734
1015
  appStore.config,
735
1016
  (content, zoneCompound) => {
736
1017
  const newContent = [...content];
737
1018
  if (zoneCompound === action.destinationZone) {
738
- newContent[action.destinationIndex] = action.data;
1019
+ newContent[action.destinationIndex] = data;
739
1020
  }
740
1021
  return newContent;
741
1022
  },
742
1023
  (childItem, path) => {
743
1024
  const pathIds = path.map((p) => p.split(":")[0]);
744
- if (childItem.props.id === action.data.props.id) {
745
- return action.data;
1025
+ if (childItem.props.id === data.props.id) {
1026
+ return data;
746
1027
  } else if (childItem.props.id === parentId) {
747
1028
  return childItem;
748
1029
  } else if (idsInPath.indexOf(childItem.props.id) > -1) {
749
1030
  return childItem;
750
- } else if (pathIds.indexOf(action.data.props.id) > -1) {
1031
+ } else if (pathIds.indexOf(data.props.id) > -1) {
751
1032
  return childItem;
752
1033
  }
753
1034
  return null;
@@ -758,7 +1039,7 @@ var replaceAction = (state, action, appStore) => {
758
1039
  // ../core/reducer/actions/replace-root.ts
759
1040
  init_react_import();
760
1041
  var replaceRootAction = (state, action, appStore) => {
761
- return walkTree(
1042
+ return walkAppState(
762
1043
  state,
763
1044
  appStore.config,
764
1045
  (content) => content,
@@ -797,7 +1078,7 @@ function duplicateAction(state, action, appStore) {
797
1078
  id: generateId(item.type)
798
1079
  })
799
1080
  });
800
- const modified = walkTree(
1081
+ const modified = walkAppState(
801
1082
  state,
802
1083
  appStore.config,
803
1084
  (content, zoneCompound) => {
@@ -862,7 +1143,7 @@ var moveAction = (state, action, appStore) => {
862
1143
  if (!item) return state;
863
1144
  const idsInSourcePath = getIdsForParent(action.sourceZone, state);
864
1145
  const idsInDestinationPath = getIdsForParent(action.destinationZone, state);
865
- return walkTree(
1146
+ return walkAppState(
866
1147
  state,
867
1148
  appStore.config,
868
1149
  (content, zoneCompound) => {
@@ -920,7 +1201,7 @@ var removeAction = (state, action, appStore) => {
920
1201
  },
921
1202
  [item.props.id]
922
1203
  );
923
- const newState = walkTree(
1204
+ const newState = walkAppState(
924
1205
  state,
925
1206
  appStore.config,
926
1207
  (content, zoneCompound) => {
@@ -1011,14 +1292,14 @@ var setDataAction = (state, action, appStore) => {
1011
1292
  console.warn(
1012
1293
  "`setData` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
1013
1294
  );
1014
- return walkTree(
1295
+ return walkAppState(
1015
1296
  __spreadProps(__spreadValues({}, state), {
1016
1297
  data: __spreadValues(__spreadValues({}, state.data), action.data)
1017
1298
  }),
1018
1299
  appStore.config
1019
1300
  );
1020
1301
  }
1021
- return walkTree(
1302
+ return walkAppState(
1022
1303
  __spreadProps(__spreadValues({}, state), {
1023
1304
  data: __spreadValues(__spreadValues({}, state.data), action.data(state.data))
1024
1305
  }),
@@ -1321,7 +1602,11 @@ var createNodesSlice = (set, get) => ({
1321
1602
  const s = get().nodes;
1322
1603
  const emptyNode = {
1323
1604
  id,
1324
- methods: { sync: () => null },
1605
+ methods: {
1606
+ sync: () => null,
1607
+ hideOverlay: () => null,
1608
+ showOverlay: () => null
1609
+ },
1325
1610
  element: null
1326
1611
  };
1327
1612
  const existingNode = s.nodes[id];
@@ -1358,7 +1643,7 @@ var import_react7 = require("react");
1358
1643
  init_react_import();
1359
1644
  var flattenData = (state, config) => {
1360
1645
  const data = [];
1361
- walkTree(
1646
+ walkAppState(
1362
1647
  state,
1363
1648
  config,
1364
1649
  (content) => content,
@@ -1372,12 +1657,13 @@ var flattenData = (state, config) => {
1372
1657
 
1373
1658
  // ../core/lib/get-changed.ts
1374
1659
  init_react_import();
1660
+ var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1375
1661
  var getChanged = (newItem, oldItem) => {
1376
1662
  return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1377
1663
  const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1378
1664
  const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1379
1665
  return __spreadProps(__spreadValues({}, acc), {
1380
- [item]: oldItemProps[item] !== newItemProps[item]
1666
+ [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
1381
1667
  });
1382
1668
  }, {}) : {};
1383
1669
  };
@@ -1495,45 +1781,23 @@ var createFieldsSlice = (_set, _get) => {
1495
1781
  return {
1496
1782
  fields: {},
1497
1783
  loading: false,
1498
- lastResolvedData: {}
1784
+ lastResolvedData: {},
1785
+ id: void 0
1499
1786
  };
1500
1787
  };
1501
1788
 
1502
1789
  // ../core/lib/resolve-component-data.ts
1503
1790
  init_react_import();
1504
-
1505
- // ../core/lib/data/map-slots.ts
1506
- init_react_import();
1507
- function mapSlotsAsync(_0, _1) {
1508
- return __async(this, arguments, function* (item, map, recursive = true, isSlot2 = isSlot) {
1509
- const props = __spreadValues({}, item.props);
1510
- const propKeys = Object.keys(props);
1511
- for (let i = 0; i < propKeys.length; i++) {
1512
- const propKey = propKeys[i];
1513
- const itemType = "type" in item ? item.type : "root";
1514
- if (isSlot2(itemType, propKey, props[propKey])) {
1515
- const content = props[propKey];
1516
- const mappedContent = recursive ? yield Promise.all(
1517
- content.map((item2) => __async(this, null, function* () {
1518
- return yield mapSlotsAsync(item2, map, recursive, isSlot2);
1519
- }))
1520
- ) : content;
1521
- props[propKey] = yield map(mappedContent, propKey);
1522
- }
1523
- }
1524
- return __spreadProps(__spreadValues({}, item), { props });
1525
- });
1526
- }
1527
-
1528
- // ../core/lib/resolve-component-data.ts
1529
- var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1791
+ var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1530
1792
  var cache = { lastChange: {} };
1531
- 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") {
1532
1794
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
1533
- if ((configForItem == null ? void 0 : configForItem.resolveData) && item.props) {
1534
- 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) {
1535
1799
  const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1536
- if (item && (0, import_fast_deep_equal.default)(item, oldItem)) {
1800
+ if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
1537
1801
  return { node: resolved, didChange: false };
1538
1802
  }
1539
1803
  const changed = getChanged(item, oldItem);
@@ -1546,46 +1810,42 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
1546
1810
  metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
1547
1811
  trigger
1548
1812
  });
1549
- let resolvedItem = __spreadProps(__spreadValues({}, item), {
1550
- props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
1551
- });
1552
- if (recursive) {
1553
- resolvedItem = yield mapSlotsAsync(
1554
- resolvedItem,
1555
- (content) => __async(void 0, null, function* () {
1556
- return Promise.all(
1557
- content.map(
1558
- (childItem) => __async(void 0, null, function* () {
1559
- return (yield resolveComponentData(
1560
- childItem,
1561
- config,
1562
- metadata,
1563
- onResolveStart,
1564
- onResolveEnd,
1565
- trigger,
1566
- false
1567
- )).node;
1568
- })
1569
- )
1570
- );
1571
- }),
1572
- false,
1573
- createIsSlotConfig(config)
1574
- );
1575
- }
1813
+ resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
1576
1814
  if (Object.keys(readOnly).length) {
1577
1815
  resolvedItem.readOnly = readOnly;
1578
1816
  }
1579
- cache.lastChange[id] = {
1580
- item,
1581
- resolved: resolvedItem
1582
- };
1583
- if (onResolveEnd) {
1584
- onResolveEnd(resolvedItem);
1585
- }
1586
- return { node: resolvedItem, didChange: !(0, import_fast_deep_equal.default)(item, resolvedItem) };
1587
1817
  }
1588
- 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
+ };
1589
1849
  });
1590
1850
 
1591
1851
  // ../core/lib/data/to-root.ts
@@ -1605,7 +1865,8 @@ var toRoot = (item) => {
1605
1865
  return { props: {}, readOnly };
1606
1866
  };
1607
1867
 
1608
- // ../core/store/index.ts
1868
+ // ../core/store/default-app-state.ts
1869
+ init_react_import();
1609
1870
  var defaultAppState = {
1610
1871
  data: { content: [], root: {}, zones: {} },
1611
1872
  ui: {
@@ -1631,6 +1892,8 @@ var defaultAppState = {
1631
1892
  zones: {}
1632
1893
  }
1633
1894
  };
1895
+
1896
+ // ../core/store/index.ts
1634
1897
  var defaultPageFields = {
1635
1898
  title: { type: "text" }
1636
1899
  };
@@ -1770,7 +2033,7 @@ var createAppStore = (initialAppStore) => create()(
1770
2033
  }),
1771
2034
  resolveAndCommitData: () => __async(void 0, null, function* () {
1772
2035
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
1773
- walkTree(
2036
+ walkAppState(
1774
2037
  state,
1775
2038
  config,
1776
2039
  (content) => content,