@measured/puck-plugin-heading-analyzer 0.19.4-canary.f09540db → 0.20.0-canary.0708ce21

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
@@ -313,7 +313,7 @@ init_react_import();
313
313
 
314
314
  // src/HeadingAnalyzer.tsx
315
315
  init_react_import();
316
- var import_react13 = require("react");
316
+ var import_react12 = require("react");
317
317
 
318
318
  // css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
319
319
  init_react_import();
@@ -474,7 +474,7 @@ var ChevronRight = createLucideIcon("ChevronRight", [
474
474
 
475
475
  // ../core/lib/use-breadcrumbs.ts
476
476
  init_react_import();
477
- var import_react12 = require("react");
477
+ var import_react10 = require("react");
478
478
 
479
479
  // ../core/store/index.ts
480
480
  init_react_import();
@@ -521,7 +521,7 @@ function forRelatedZones(item, data, cb, path = []) {
521
521
  });
522
522
  }
523
523
 
524
- // ../core/lib/data/map-slots.ts
524
+ // ../core/lib/data/map-fields.ts
525
525
  init_react_import();
526
526
 
527
527
  // ../core/lib/data/default-slots.ts
@@ -531,14 +531,14 @@ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
531
531
  value
532
532
  );
533
533
 
534
- // ../core/lib/data/map-slots.ts
534
+ // ../core/lib/data/map-fields.ts
535
535
  var isPromise = (v) => !!v && typeof v.then === "function";
536
536
  var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
537
537
  var containsPromise = (arr) => arr.some(isPromise);
538
538
  var walkField = ({
539
539
  value,
540
540
  fields,
541
- map,
541
+ mappers,
542
542
  propKey = "",
543
543
  propPath = "",
544
544
  id = "",
@@ -546,7 +546,9 @@ var walkField = ({
546
546
  recurseSlots = false
547
547
  }) => {
548
548
  var _a, _b, _c;
549
- if (((_a = fields[propKey]) == null ? void 0 : _a.type) === "slot") {
549
+ const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
550
+ const map = mappers[fieldType];
551
+ if (map && fieldType === "slot") {
550
552
  const content = value || [];
551
553
  const mappedContent = recurseSlots ? content.map((el) => {
552
554
  var _a2;
@@ -558,7 +560,7 @@ var walkField = ({
558
560
  return walkField({
559
561
  value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
560
562
  fields: fields2,
561
- map,
563
+ mappers,
562
564
  id: el.props.id,
563
565
  config,
564
566
  recurseSlots
@@ -567,7 +569,21 @@ var walkField = ({
567
569
  if (containsPromise(mappedContent)) {
568
570
  return Promise.all(mappedContent);
569
571
  }
570
- return map(mappedContent, id, propPath, fields[propKey], propPath);
572
+ return map({
573
+ value: mappedContent,
574
+ parentId: id,
575
+ propName: propKey,
576
+ field: fields[propKey],
577
+ propPath
578
+ });
579
+ } else if (map && fields[propKey]) {
580
+ return map({
581
+ value,
582
+ parentId: id,
583
+ propName: propKey,
584
+ field: fields[propKey],
585
+ propPath
586
+ });
571
587
  }
572
588
  if (value && typeof value === "object") {
573
589
  if (Array.isArray(value)) {
@@ -577,7 +593,7 @@ var walkField = ({
577
593
  (el, idx) => walkField({
578
594
  value: el,
579
595
  fields: arrayFields,
580
- map,
596
+ mappers,
581
597
  propKey,
582
598
  propPath: `${propPath}[${idx}]`,
583
599
  id,
@@ -596,7 +612,7 @@ var walkField = ({
596
612
  return walkObject({
597
613
  value,
598
614
  fields: objectFields,
599
- map,
615
+ mappers,
600
616
  id,
601
617
  getPropPath: (k) => `${propPath}.${k}`,
602
618
  config,
@@ -609,7 +625,7 @@ var walkField = ({
609
625
  var walkObject = ({
610
626
  value,
611
627
  fields,
612
- map,
628
+ mappers,
613
629
  id,
614
630
  getPropPath,
615
631
  config,
@@ -619,7 +635,7 @@ var walkObject = ({
619
635
  const opts = {
620
636
  value: v,
621
637
  fields,
622
- map,
638
+ mappers,
623
639
  propKey: k,
624
640
  propPath: getPropPath(k),
625
641
  id,
@@ -641,14 +657,14 @@ var walkObject = ({
641
657
  }
642
658
  return flatten(newProps);
643
659
  };
644
- function mapSlots(item, map, config, recurseSlots = false) {
660
+ function mapFields(item, mappers, config, recurseSlots = false) {
645
661
  var _a, _b, _c, _d, _e;
646
662
  const itemType = "type" in item ? item.type : "root";
647
663
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
648
664
  const newProps = walkObject({
649
665
  value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
650
666
  fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
651
- map,
667
+ mappers,
652
668
  id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
653
669
  getPropPath: (k) => k,
654
670
  config,
@@ -671,7 +687,7 @@ var import_flat = __toESM(require_flat());
671
687
  // ../core/lib/data/strip-slots.ts
672
688
  init_react_import();
673
689
  var stripSlots = (data, config) => {
674
- return mapSlots(data, () => null, config);
690
+ return mapFields(data, { slot: () => null }, config);
675
691
  };
676
692
 
677
693
  // ../core/lib/data/flatten-node.ts
@@ -724,18 +740,21 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
724
740
  const mappedItem = mapNodeOrSkip(item, path, index);
725
741
  if (!mappedItem) return item;
726
742
  const id = mappedItem.props.id;
727
- const newProps = __spreadProps(__spreadValues({}, mapSlots(
743
+ const newProps = __spreadProps(__spreadValues({}, mapFields(
728
744
  mappedItem,
729
- (content, parentId2, slotId) => {
730
- const zoneCompound = `${parentId2}:${slotId}`;
731
- const [_2, newContent2] = processContent(
732
- path,
733
- zoneCompound,
734
- content,
735
- "slot",
736
- parentId2
737
- );
738
- return newContent2;
745
+ {
746
+ slot: ({ value, parentId: parentId2, propPath }) => {
747
+ const content = value;
748
+ const zoneCompound = `${parentId2}:${propPath}`;
749
+ const [_2, newContent2] = processContent(
750
+ path,
751
+ zoneCompound,
752
+ content,
753
+ "slot",
754
+ parentId2
755
+ );
756
+ return newContent2;
757
+ }
739
758
  },
740
759
  config
741
760
  ).props), {
@@ -910,11 +929,14 @@ init_react_import();
910
929
  function walkTree(data, config, callbackFn) {
911
930
  var _a, _b;
912
931
  const walkItem = (item) => {
913
- return mapSlots(
932
+ return mapFields(
914
933
  item,
915
- (content, parentId, propName) => {
916
- var _a2;
917
- return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
934
+ {
935
+ slot: ({ value, parentId, propName }) => {
936
+ var _a2;
937
+ const content = value;
938
+ return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
939
+ }
918
940
  },
919
941
  config,
920
942
  true
@@ -1000,275 +1022,6 @@ function insertAction(state, action, appStore) {
1000
1022
 
1001
1023
  // ../core/reducer/actions/replace.ts
1002
1024
  init_react_import();
1003
-
1004
- // ../core/rsc.tsx
1005
- init_react_import();
1006
-
1007
- // ../core/components/ServerRender/index.tsx
1008
- init_react_import();
1009
-
1010
- // ../core/lib/data/setup-zone.ts
1011
- init_react_import();
1012
- var setupZone = (data, zoneKey) => {
1013
- if (zoneKey === rootDroppableId) {
1014
- return data;
1015
- }
1016
- const newData = __spreadProps(__spreadValues({}, data), {
1017
- zones: data.zones ? __spreadValues({}, data.zones) : {}
1018
- });
1019
- newData.zones[zoneKey] = newData.zones[zoneKey] || [];
1020
- return newData;
1021
- };
1022
-
1023
- // ../core/lib/use-slots.tsx
1024
- init_react_import();
1025
- var import_react4 = require("react");
1026
- function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
1027
- const slotProps = (0, import_react4.useMemo)(() => {
1028
- const mapped = mapSlots(
1029
- item,
1030
- (content, _parentId, propName, field, propPath) => {
1031
- const wildcardPath = propPath.replace(/\[\d+\]/g, "[*]");
1032
- const isReadOnly = (readOnly == null ? void 0 : readOnly[propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly;
1033
- const render = isReadOnly ? renderSlotRender : renderSlotEdit;
1034
- const Slot = (dzProps) => render(__spreadProps(__spreadValues({
1035
- allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
1036
- disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
1037
- }, dzProps), {
1038
- zone: propName,
1039
- content
1040
- }));
1041
- return Slot;
1042
- },
1043
- config
1044
- ).props;
1045
- return mapped;
1046
- }, [config, item, readOnly, forceReadOnly]);
1047
- const mergedProps = (0, import_react4.useMemo)(
1048
- () => __spreadValues(__spreadValues({}, item.props), slotProps),
1049
- [item.props, slotProps]
1050
- );
1051
- return mergedProps;
1052
- }
1053
-
1054
- // ../core/components/SlotRender/server.tsx
1055
- init_react_import();
1056
- var import_react5 = require("react");
1057
- var import_jsx_runtime2 = require("react/jsx-runtime");
1058
- var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotRender, __spreadValues({}, props));
1059
- var Item = ({
1060
- config,
1061
- item,
1062
- metadata
1063
- }) => {
1064
- const Component = config.components[item.type];
1065
- const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
1066
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1067
- Component.render,
1068
- __spreadProps(__spreadValues({}, props), {
1069
- puck: __spreadProps(__spreadValues({}, props.puck), {
1070
- renderDropZone: DropZoneRender,
1071
- metadata: metadata || {}
1072
- })
1073
- })
1074
- );
1075
- };
1076
- var SlotRender = (0, import_react5.forwardRef)(
1077
- function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
1078
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className, style, ref, children: content.map((item) => {
1079
- if (!config.components[item.type]) {
1080
- return null;
1081
- }
1082
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1083
- Item,
1084
- {
1085
- config,
1086
- item,
1087
- metadata
1088
- },
1089
- item.props.id
1090
- );
1091
- }) });
1092
- }
1093
- );
1094
-
1095
- // ../core/components/ServerRender/index.tsx
1096
- var import_jsx_runtime3 = require("react/jsx-runtime");
1097
- function DropZoneRender({
1098
- zone,
1099
- data,
1100
- areaId = "root",
1101
- config,
1102
- metadata = {}
1103
- }) {
1104
- let zoneCompound = rootDroppableId;
1105
- let content = (data == null ? void 0 : data.content) || [];
1106
- if (!data || !config) {
1107
- return null;
1108
- }
1109
- if (areaId !== rootAreaId && zone !== rootZone) {
1110
- zoneCompound = `${areaId}:${zone}`;
1111
- content = setupZone(data, zoneCompound).zones[zoneCompound];
1112
- }
1113
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: content.map((item) => {
1114
- const Component = config.components[item.type];
1115
- const props = __spreadProps(__spreadValues({}, item.props), {
1116
- puck: {
1117
- renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1118
- DropZoneRender,
1119
- {
1120
- zone: zone2,
1121
- data,
1122
- areaId: item.props.id,
1123
- config,
1124
- metadata
1125
- }
1126
- ),
1127
- metadata,
1128
- dragRef: null,
1129
- isEditing: false
1130
- }
1131
- });
1132
- const renderItem = __spreadProps(__spreadValues({}, item), { props });
1133
- const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
1134
- if (Component) {
1135
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
1136
- }
1137
- return null;
1138
- }) });
1139
- }
1140
-
1141
- // ../core/lib/resolve-all-data.ts
1142
- init_react_import();
1143
-
1144
- // ../core/lib/resolve-component-data.ts
1145
- init_react_import();
1146
-
1147
- // ../core/lib/get-changed.ts
1148
- init_react_import();
1149
- var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1150
- var getChanged = (newItem, oldItem) => {
1151
- return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1152
- const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1153
- const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1154
- return __spreadProps(__spreadValues({}, acc), {
1155
- [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
1156
- });
1157
- }, {}) : {};
1158
- };
1159
-
1160
- // ../core/lib/resolve-component-data.ts
1161
- var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1162
- var cache = { lastChange: {} };
1163
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
1164
- const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
1165
- const resolvedItem = __spreadValues({}, item);
1166
- const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
1167
- const id = "id" in item.props ? item.props.id : "root";
1168
- if (shouldRunResolver) {
1169
- const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1170
- if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
1171
- return { node: resolved, didChange: false };
1172
- }
1173
- const changed = getChanged(item, oldItem);
1174
- if (onResolveStart) {
1175
- onResolveStart(item);
1176
- }
1177
- const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
1178
- changed,
1179
- lastData: oldItem,
1180
- metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
1181
- trigger
1182
- });
1183
- resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
1184
- if (Object.keys(readOnly).length) {
1185
- resolvedItem.readOnly = readOnly;
1186
- }
1187
- }
1188
- let itemWithResolvedChildren = yield mapSlots(
1189
- resolvedItem,
1190
- (content) => __async(void 0, null, function* () {
1191
- return yield Promise.all(
1192
- content.map(
1193
- (childItem) => __async(void 0, null, function* () {
1194
- return (yield resolveComponentData(
1195
- childItem,
1196
- config,
1197
- metadata,
1198
- onResolveStart,
1199
- onResolveEnd,
1200
- trigger
1201
- )).node;
1202
- })
1203
- )
1204
- );
1205
- }),
1206
- config
1207
- );
1208
- if (shouldRunResolver && onResolveEnd) {
1209
- onResolveEnd(resolvedItem);
1210
- }
1211
- cache.lastChange[id] = {
1212
- item,
1213
- resolved: itemWithResolvedChildren
1214
- };
1215
- return {
1216
- node: itemWithResolvedChildren,
1217
- didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
1218
- };
1219
- });
1220
-
1221
- // ../core/lib/data/default-data.ts
1222
- init_react_import();
1223
-
1224
- // ../core/lib/data/to-component.ts
1225
- init_react_import();
1226
-
1227
- // ../core/lib/transform-props.ts
1228
- init_react_import();
1229
-
1230
- // ../core/lib/migrate.ts
1231
- init_react_import();
1232
-
1233
- // ../core/store/default-app-state.ts
1234
- init_react_import();
1235
-
1236
- // ../core/components/ViewportControls/default-viewports.ts
1237
- init_react_import();
1238
- var defaultViewports = [
1239
- { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1240
- { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1241
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1242
- ];
1243
-
1244
- // ../core/store/default-app-state.ts
1245
- var defaultAppState = {
1246
- data: { content: [], root: {}, zones: {} },
1247
- ui: {
1248
- leftSideBarVisible: true,
1249
- rightSideBarVisible: true,
1250
- arrayState: {},
1251
- itemSelector: null,
1252
- componentList: {},
1253
- isDragging: false,
1254
- previewMode: "edit",
1255
- viewports: {
1256
- current: {
1257
- width: defaultViewports[0].width,
1258
- height: defaultViewports[0].height || "auto"
1259
- },
1260
- options: [],
1261
- controlsVisible: true
1262
- },
1263
- field: { focus: null }
1264
- },
1265
- indexes: {
1266
- nodes: {},
1267
- zones: {}
1268
- }
1269
- };
1270
-
1271
- // ../core/reducer/actions/replace.ts
1272
1025
  var replaceAction = (state, action, appStore) => {
1273
1026
  const [parentId] = action.destinationZone.split(":");
1274
1027
  const idsInPath = getIdsForParent(action.destinationZone, state);
@@ -1519,6 +1272,21 @@ var removeAction = (state, action, appStore) => {
1519
1272
 
1520
1273
  // ../core/reducer/actions/register-zone.ts
1521
1274
  init_react_import();
1275
+
1276
+ // ../core/lib/data/setup-zone.ts
1277
+ init_react_import();
1278
+ var setupZone = (data, zoneKey) => {
1279
+ if (zoneKey === rootDroppableId) {
1280
+ return data;
1281
+ }
1282
+ const newData = __spreadProps(__spreadValues({}, data), {
1283
+ zones: data.zones ? __spreadValues({}, data.zones) : {}
1284
+ });
1285
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
1286
+ return newData;
1287
+ };
1288
+
1289
+ // ../core/reducer/actions/register-zone.ts
1522
1290
  var zoneCache = {};
1523
1291
  function registerZoneAction(state, action) {
1524
1292
  if (zoneCache[action.zone]) {
@@ -1671,6 +1439,14 @@ function createReducer({
1671
1439
  );
1672
1440
  }
1673
1441
 
1442
+ // ../core/components/ViewportControls/default-viewports.ts
1443
+ init_react_import();
1444
+ var defaultViewports = [
1445
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1446
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1447
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1448
+ ];
1449
+
1674
1450
  // ../../node_modules/zustand/esm/vanilla.mjs
1675
1451
  init_react_import();
1676
1452
  var createStoreImpl = (createState) => {
@@ -1698,15 +1474,15 @@ var createStore = (createState) => createState ? createStoreImpl(createState) :
1698
1474
 
1699
1475
  // ../../node_modules/zustand/esm/react.mjs
1700
1476
  init_react_import();
1701
- var import_react6 = __toESM(require("react"), 1);
1477
+ var import_react4 = __toESM(require("react"), 1);
1702
1478
  var identity = (arg) => arg;
1703
1479
  function useStore(api, selector = identity) {
1704
- const slice = import_react6.default.useSyncExternalStore(
1480
+ const slice = import_react4.default.useSyncExternalStore(
1705
1481
  api.subscribe,
1706
1482
  () => selector(api.getState()),
1707
1483
  () => selector(api.getInitialState())
1708
1484
  );
1709
- import_react6.default.useDebugValue(slice);
1485
+ import_react4.default.useDebugValue(slice);
1710
1486
  return slice;
1711
1487
  }
1712
1488
  var createImpl = (createState) => {
@@ -1745,15 +1521,15 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1745
1521
  var subscribeWithSelector = subscribeWithSelectorImpl;
1746
1522
 
1747
1523
  // ../core/store/index.ts
1748
- var import_react11 = require("react");
1524
+ var import_react9 = require("react");
1749
1525
 
1750
1526
  // ../core/store/slices/history.ts
1751
1527
  init_react_import();
1752
- var import_react8 = require("react");
1528
+ var import_react6 = require("react");
1753
1529
 
1754
1530
  // ../core/lib/use-hotkey.ts
1755
1531
  init_react_import();
1756
- var import_react7 = require("react");
1532
+ var import_react5 = require("react");
1757
1533
  var useHotkeyStore = create()(
1758
1534
  subscribeWithSelector((set) => ({
1759
1535
  held: {},
@@ -1902,7 +1678,7 @@ var createNodesSlice = (set, get) => ({
1902
1678
 
1903
1679
  // ../core/store/slices/permissions.ts
1904
1680
  init_react_import();
1905
- var import_react9 = require("react");
1681
+ var import_react7 = require("react");
1906
1682
 
1907
1683
  // ../core/lib/data/flatten-data.ts
1908
1684
  init_react_import();
@@ -1920,6 +1696,19 @@ var flattenData = (state, config) => {
1920
1696
  return data;
1921
1697
  };
1922
1698
 
1699
+ // ../core/lib/get-changed.ts
1700
+ init_react_import();
1701
+ var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1702
+ var getChanged = (newItem, oldItem) => {
1703
+ return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1704
+ const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1705
+ const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1706
+ return __spreadProps(__spreadValues({}, acc), {
1707
+ [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
1708
+ });
1709
+ }, {}) : {};
1710
+ };
1711
+
1923
1712
  // ../core/store/slices/permissions.ts
1924
1713
  var createPermissionsSlice = (set, get) => {
1925
1714
  const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
@@ -2028,7 +1817,7 @@ var createPermissionsSlice = (set, get) => {
2028
1817
 
2029
1818
  // ../core/store/slices/fields.ts
2030
1819
  init_react_import();
2031
- var import_react10 = require("react");
1820
+ var import_react8 = require("react");
2032
1821
  var createFieldsSlice = (_set, _get) => {
2033
1822
  return {
2034
1823
  fields: {},
@@ -2038,6 +1827,71 @@ var createFieldsSlice = (_set, _get) => {
2038
1827
  };
2039
1828
  };
2040
1829
 
1830
+ // ../core/lib/resolve-component-data.ts
1831
+ init_react_import();
1832
+ var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1833
+ var cache = { lastChange: {} };
1834
+ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
1835
+ const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
1836
+ const resolvedItem = __spreadValues({}, item);
1837
+ const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
1838
+ const id = "id" in item.props ? item.props.id : "root";
1839
+ if (shouldRunResolver) {
1840
+ const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1841
+ if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
1842
+ return { node: resolved, didChange: false };
1843
+ }
1844
+ const changed = getChanged(item, oldItem);
1845
+ if (onResolveStart) {
1846
+ onResolveStart(item);
1847
+ }
1848
+ const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
1849
+ changed,
1850
+ lastData: oldItem,
1851
+ metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
1852
+ trigger
1853
+ });
1854
+ resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
1855
+ if (Object.keys(readOnly).length) {
1856
+ resolvedItem.readOnly = readOnly;
1857
+ }
1858
+ }
1859
+ let itemWithResolvedChildren = yield mapFields(
1860
+ resolvedItem,
1861
+ {
1862
+ slot: (_02) => __async(void 0, [_02], function* ({ value }) {
1863
+ const content = value;
1864
+ return yield Promise.all(
1865
+ content.map(
1866
+ (childItem) => __async(void 0, null, function* () {
1867
+ return (yield resolveComponentData(
1868
+ childItem,
1869
+ config,
1870
+ metadata,
1871
+ onResolveStart,
1872
+ onResolveEnd,
1873
+ trigger
1874
+ )).node;
1875
+ })
1876
+ )
1877
+ );
1878
+ })
1879
+ },
1880
+ config
1881
+ );
1882
+ if (shouldRunResolver && onResolveEnd) {
1883
+ onResolveEnd(resolvedItem);
1884
+ }
1885
+ cache.lastChange[id] = {
1886
+ item,
1887
+ resolved: itemWithResolvedChildren
1888
+ };
1889
+ return {
1890
+ node: itemWithResolvedChildren,
1891
+ didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
1892
+ };
1893
+ });
1894
+
2041
1895
  // ../core/lib/data/to-root.ts
2042
1896
  init_react_import();
2043
1897
  var toRoot = (item) => {
@@ -2055,6 +1909,34 @@ var toRoot = (item) => {
2055
1909
  return { props: {}, readOnly };
2056
1910
  };
2057
1911
 
1912
+ // ../core/store/default-app-state.ts
1913
+ init_react_import();
1914
+ var defaultAppState = {
1915
+ data: { content: [], root: {}, zones: {} },
1916
+ ui: {
1917
+ leftSideBarVisible: true,
1918
+ rightSideBarVisible: true,
1919
+ arrayState: {},
1920
+ itemSelector: null,
1921
+ componentList: {},
1922
+ isDragging: false,
1923
+ previewMode: "edit",
1924
+ viewports: {
1925
+ current: {
1926
+ width: defaultViewports[0].width,
1927
+ height: defaultViewports[0].height || "auto"
1928
+ },
1929
+ options: [],
1930
+ controlsVisible: true
1931
+ },
1932
+ field: { focus: null }
1933
+ },
1934
+ indexes: {
1935
+ nodes: {},
1936
+ zones: {}
1937
+ }
1938
+ };
1939
+
2058
1940
  // ../core/store/index.ts
2059
1941
  var defaultPageFields = {
2060
1942
  title: { type: "text" }
@@ -2076,7 +1958,8 @@ var createAppStore = (initialAppStore) => create()(
2076
1958
  },
2077
1959
  status: "LOADING",
2078
1960
  iframe: {},
2079
- metadata: {}
1961
+ metadata: {},
1962
+ fieldTransforms: {}
2080
1963
  }, initialAppStore), {
2081
1964
  fields: createFieldsSlice(set, get),
2082
1965
  history: createHistorySlice(set, get),
@@ -2231,13 +2114,13 @@ var createAppStore = (initialAppStore) => create()(
2231
2114
  });
2232
2115
  })
2233
2116
  );
2234
- var appStoreContext = (0, import_react11.createContext)(createAppStore());
2117
+ var appStoreContext = (0, import_react9.createContext)(createAppStore());
2235
2118
  function useAppStore(selector) {
2236
- const context = (0, import_react11.useContext)(appStoreContext);
2119
+ const context = (0, import_react9.useContext)(appStoreContext);
2237
2120
  return useStore(context, selector);
2238
2121
  }
2239
2122
  function useAppStoreApi() {
2240
- return (0, import_react11.useContext)(appStoreContext);
2123
+ return (0, import_react9.useContext)(appStoreContext);
2241
2124
  }
2242
2125
 
2243
2126
  // ../core/lib/use-breadcrumbs.ts
@@ -2252,7 +2135,7 @@ var useBreadcrumbs = (renderCount) => {
2252
2135
  return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
2253
2136
  });
2254
2137
  const appStore = useAppStoreApi();
2255
- return (0, import_react12.useMemo)(() => {
2138
+ return (0, import_react10.useMemo)(() => {
2256
2139
  const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
2257
2140
  var _a, _b, _c;
2258
2141
  const [componentId] = zoneCompound.split(":");
@@ -2297,12 +2180,19 @@ init_react_import();
2297
2180
  // ../core/lib/data/replace.ts
2298
2181
  init_react_import();
2299
2182
 
2183
+ // ../core/lib/use-reset-auto-zoom.ts
2184
+ init_react_import();
2185
+ var import_react11 = require("react");
2186
+
2187
+ // ../core/lib/get-zoom-config.ts
2188
+ init_react_import();
2189
+
2300
2190
  // css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
2301
2191
  init_react_import();
2302
2192
  var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
2303
2193
 
2304
2194
  // ../core/components/Loader/index.tsx
2305
- var import_jsx_runtime4 = require("react/jsx-runtime");
2195
+ var import_jsx_runtime2 = require("react/jsx-runtime");
2306
2196
  var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
2307
2197
  var Loader = (_a) => {
2308
2198
  var _b = _a, {
@@ -2312,7 +2202,7 @@ var Loader = (_a) => {
2312
2202
  "color",
2313
2203
  "size"
2314
2204
  ]);
2315
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2205
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2316
2206
  "span",
2317
2207
  __spreadValues({
2318
2208
  className: getClassName2(),
@@ -2327,7 +2217,7 @@ var Loader = (_a) => {
2327
2217
  };
2328
2218
 
2329
2219
  // ../core/components/SidebarSection/index.tsx
2330
- var import_jsx_runtime5 = require("react/jsx-runtime");
2220
+ var import_jsx_runtime3 = require("react/jsx-runtime");
2331
2221
  var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
2332
2222
  var SidebarSection = ({
2333
2223
  children,
@@ -2340,15 +2230,15 @@ var SidebarSection = ({
2340
2230
  }) => {
2341
2231
  const setUi = useAppStore((s) => s.setUi);
2342
2232
  const breadcrumbs = useBreadcrumbs(1);
2343
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2233
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2344
2234
  "div",
2345
2235
  {
2346
2236
  className: getClassName3({ noBorderTop, noPadding }),
2347
2237
  style: { background },
2348
2238
  children: [
2349
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
2350
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
2351
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2239
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
2240
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
2241
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2352
2242
  "button",
2353
2243
  {
2354
2244
  type: "button",
@@ -2357,12 +2247,12 @@ var SidebarSection = ({
2357
2247
  children: breadcrumb.label
2358
2248
  }
2359
2249
  ),
2360
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChevronRight, { size: 16 })
2250
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRight, { size: 16 })
2361
2251
  ] }, i)) : null,
2362
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
2252
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
2363
2253
  ] }) }),
2364
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName3("content"), children }),
2365
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Loader, { size: 32 }) })
2254
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("content"), children }),
2255
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 32 }) })
2366
2256
  ]
2367
2257
  }
2368
2258
  );
@@ -2376,18 +2266,18 @@ init_react_import();
2376
2266
  var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
2377
2267
 
2378
2268
  // ../core/components/OutlineList/index.tsx
2379
- var import_jsx_runtime6 = require("react/jsx-runtime");
2269
+ var import_jsx_runtime4 = require("react/jsx-runtime");
2380
2270
  var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
2381
2271
  var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
2382
2272
  var OutlineList = ({ children }) => {
2383
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { className: getClassName4(), children });
2273
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: getClassName4(), children });
2384
2274
  };
2385
- OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
2275
+ OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
2386
2276
  OutlineList.Item = ({
2387
2277
  children,
2388
2278
  onClick
2389
2279
  }) => {
2390
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2280
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2391
2281
  "li",
2392
2282
  {
2393
2283
  className: getClassNameItem({ clickable: !!onClick }),
@@ -2421,7 +2311,7 @@ var getFrame = () => {
2421
2311
 
2422
2312
  // src/HeadingAnalyzer.tsx
2423
2313
  var import_react_from_json = __toESM(require("react-from-json"));
2424
- var import_jsx_runtime7 = require("react/jsx-runtime");
2314
+ var import_jsx_runtime5 = require("react/jsx-runtime");
2425
2315
  var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2426
2316
  var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
2427
2317
  var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
@@ -2477,8 +2367,8 @@ function buildHierarchy(frame) {
2477
2367
  var usePuck = (0, import_puck.createUsePuck)();
2478
2368
  var HeadingAnalyzer = () => {
2479
2369
  const data = usePuck((s) => s.appState.data);
2480
- const [hierarchy, setHierarchy] = (0, import_react13.useState)([]);
2481
- (0, import_react13.useEffect)(() => {
2370
+ const [hierarchy, setHierarchy] = (0, import_react12.useState)([]);
2371
+ (0, import_react12.useEffect)(() => {
2482
2372
  const frame = getFrame();
2483
2373
  let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
2484
2374
  const createHierarchy = () => {
@@ -2513,8 +2403,8 @@ var HeadingAnalyzer = () => {
2513
2403
  frameObserver.disconnect();
2514
2404
  };
2515
2405
  }, [data]);
2516
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: getClassName5(), children: [
2517
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2406
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
2407
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2518
2408
  "small",
2519
2409
  {
2520
2410
  className: getClassName5("cssWarning"),
@@ -2526,19 +2416,19 @@ var HeadingAnalyzer = () => {
2526
2416
  children: [
2527
2417
  "Heading analyzer styles not loaded. Please review the",
2528
2418
  " ",
2529
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2419
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2530
2420
  "."
2531
2421
  ]
2532
2422
  }
2533
2423
  ),
2534
- hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: "No headings." }),
2535
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2424
+ hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: "No headings." }),
2425
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2536
2426
  ReactFromJSON,
2537
2427
  {
2538
2428
  mapping: {
2539
- Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: props.children }),
2540
- OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(OutlineList.Item, { children: [
2541
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2429
+ Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: props.children }),
2430
+ OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(OutlineList.Item, { children: [
2431
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2542
2432
  "small",
2543
2433
  {
2544
2434
  className: getClassNameItem2({ missing: props.missing }),
@@ -2556,14 +2446,14 @@ var HeadingAnalyzer = () => {
2556
2446
  }, 2e3);
2557
2447
  }
2558
2448
  },
2559
- children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
2560
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("b", { children: [
2449
+ children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2450
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
2561
2451
  "H",
2562
2452
  props.rank
2563
2453
  ] }),
2564
2454
  ": Missing"
2565
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
2566
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("b", { children: [
2455
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2456
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
2567
2457
  "H",
2568
2458
  props.rank
2569
2459
  ] }),
@@ -2572,7 +2462,7 @@ var HeadingAnalyzer = () => {
2572
2462
  ] })
2573
2463
  }
2574
2464
  ) }),
2575
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OutlineList, { children: props.children })
2465
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: props.children })
2576
2466
  ] })
2577
2467
  },
2578
2468
  entry: {
@@ -2594,9 +2484,9 @@ var HeadingAnalyzer = () => {
2594
2484
  };
2595
2485
  var headingAnalyzer = {
2596
2486
  overrides: {
2597
- fields: ({ children, itemSelector }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
2487
+ fields: ({ children, itemSelector }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2598
2488
  children,
2599
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HeadingAnalyzer, {}) }) })
2489
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeadingAnalyzer, {}) }) })
2600
2490
  ] })
2601
2491
  }
2602
2492
  };