@measured/puck-plugin-heading-analyzer 0.20.0-canary.6760121f → 0.20.0-canary.6a211610

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
@@ -462,7 +462,7 @@ var ChevronRight = createLucideIcon("ChevronRight", [
462
462
 
463
463
  // ../core/lib/use-breadcrumbs.ts
464
464
  init_react_import();
465
- import { useMemo as useMemo2 } from "react";
465
+ import { useMemo } from "react";
466
466
 
467
467
  // ../core/store/index.ts
468
468
  init_react_import();
@@ -509,7 +509,7 @@ function forRelatedZones(item, data, cb, path = []) {
509
509
  });
510
510
  }
511
511
 
512
- // ../core/lib/data/map-slots.ts
512
+ // ../core/lib/data/map-fields.ts
513
513
  init_react_import();
514
514
 
515
515
  // ../core/lib/data/default-slots.ts
@@ -519,14 +519,14 @@ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
519
519
  value
520
520
  );
521
521
 
522
- // ../core/lib/data/map-slots.ts
522
+ // ../core/lib/data/map-fields.ts
523
523
  var isPromise = (v) => !!v && typeof v.then === "function";
524
524
  var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
525
525
  var containsPromise = (arr) => arr.some(isPromise);
526
526
  var walkField = ({
527
527
  value,
528
528
  fields,
529
- map,
529
+ mappers,
530
530
  propKey = "",
531
531
  propPath = "",
532
532
  id = "",
@@ -534,7 +534,9 @@ var walkField = ({
534
534
  recurseSlots = false
535
535
  }) => {
536
536
  var _a, _b, _c;
537
- if (((_a = fields[propKey]) == null ? void 0 : _a.type) === "slot") {
537
+ const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
538
+ const map = mappers[fieldType];
539
+ if (map && fieldType === "slot") {
538
540
  const content = value || [];
539
541
  const mappedContent = recurseSlots ? content.map((el) => {
540
542
  var _a2;
@@ -546,7 +548,7 @@ var walkField = ({
546
548
  return walkField({
547
549
  value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
548
550
  fields: fields2,
549
- map,
551
+ mappers,
550
552
  id: el.props.id,
551
553
  config,
552
554
  recurseSlots
@@ -555,7 +557,21 @@ var walkField = ({
555
557
  if (containsPromise(mappedContent)) {
556
558
  return Promise.all(mappedContent);
557
559
  }
558
- return map(mappedContent, id, propPath, fields[propKey], propPath);
560
+ return map({
561
+ value: mappedContent,
562
+ parentId: id,
563
+ propName: propKey,
564
+ field: fields[propKey],
565
+ propPath
566
+ });
567
+ } else if (map && fields[propKey]) {
568
+ return map({
569
+ value,
570
+ parentId: id,
571
+ propName: propKey,
572
+ field: fields[propKey],
573
+ propPath
574
+ });
559
575
  }
560
576
  if (value && typeof value === "object") {
561
577
  if (Array.isArray(value)) {
@@ -565,7 +581,7 @@ var walkField = ({
565
581
  (el, idx) => walkField({
566
582
  value: el,
567
583
  fields: arrayFields,
568
- map,
584
+ mappers,
569
585
  propKey,
570
586
  propPath: `${propPath}[${idx}]`,
571
587
  id,
@@ -584,7 +600,7 @@ var walkField = ({
584
600
  return walkObject({
585
601
  value,
586
602
  fields: objectFields,
587
- map,
603
+ mappers,
588
604
  id,
589
605
  getPropPath: (k) => `${propPath}.${k}`,
590
606
  config,
@@ -597,7 +613,7 @@ var walkField = ({
597
613
  var walkObject = ({
598
614
  value,
599
615
  fields,
600
- map,
616
+ mappers,
601
617
  id,
602
618
  getPropPath,
603
619
  config,
@@ -607,7 +623,7 @@ var walkObject = ({
607
623
  const opts = {
608
624
  value: v,
609
625
  fields,
610
- map,
626
+ mappers,
611
627
  propKey: k,
612
628
  propPath: getPropPath(k),
613
629
  id,
@@ -629,14 +645,14 @@ var walkObject = ({
629
645
  }
630
646
  return flatten(newProps);
631
647
  };
632
- function mapSlots(item, map, config, recurseSlots = false) {
648
+ function mapFields(item, mappers, config, recurseSlots = false) {
633
649
  var _a, _b, _c, _d, _e;
634
650
  const itemType = "type" in item ? item.type : "root";
635
651
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
636
652
  const newProps = walkObject({
637
653
  value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
638
654
  fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
639
- map,
655
+ mappers,
640
656
  id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
641
657
  getPropPath: (k) => k,
642
658
  config,
@@ -659,7 +675,7 @@ var import_flat = __toESM(require_flat());
659
675
  // ../core/lib/data/strip-slots.ts
660
676
  init_react_import();
661
677
  var stripSlots = (data, config) => {
662
- return mapSlots(data, () => null, config);
678
+ return mapFields(data, { slot: () => null }, config);
663
679
  };
664
680
 
665
681
  // ../core/lib/data/flatten-node.ts
@@ -712,18 +728,21 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
712
728
  const mappedItem = mapNodeOrSkip(item, path, index);
713
729
  if (!mappedItem) return item;
714
730
  const id = mappedItem.props.id;
715
- const newProps = __spreadProps(__spreadValues({}, mapSlots(
731
+ const newProps = __spreadProps(__spreadValues({}, mapFields(
716
732
  mappedItem,
717
- (content, parentId2, slotId) => {
718
- const zoneCompound = `${parentId2}:${slotId}`;
719
- const [_2, newContent2] = processContent(
720
- path,
721
- zoneCompound,
722
- content,
723
- "slot",
724
- parentId2
725
- );
726
- return newContent2;
733
+ {
734
+ slot: ({ value, parentId: parentId2, propPath }) => {
735
+ const content = value;
736
+ const zoneCompound = `${parentId2}:${propPath}`;
737
+ const [_2, newContent2] = processContent(
738
+ path,
739
+ zoneCompound,
740
+ content,
741
+ "slot",
742
+ parentId2
743
+ );
744
+ return newContent2;
745
+ }
727
746
  },
728
747
  config
729
748
  ).props), {
@@ -898,11 +917,14 @@ init_react_import();
898
917
  function walkTree(data, config, callbackFn) {
899
918
  var _a, _b;
900
919
  const walkItem = (item) => {
901
- return mapSlots(
920
+ return mapFields(
902
921
  item,
903
- (content, parentId, propName) => {
904
- var _a2;
905
- return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
922
+ {
923
+ slot: ({ value, parentId, propName }) => {
924
+ var _a2;
925
+ const content = value;
926
+ return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
927
+ }
906
928
  },
907
929
  config,
908
930
  true
@@ -988,275 +1010,6 @@ function insertAction(state, action, appStore) {
988
1010
 
989
1011
  // ../core/reducer/actions/replace.ts
990
1012
  init_react_import();
991
-
992
- // ../core/rsc.tsx
993
- init_react_import();
994
-
995
- // ../core/components/ServerRender/index.tsx
996
- init_react_import();
997
-
998
- // ../core/lib/data/setup-zone.ts
999
- init_react_import();
1000
- var setupZone = (data, zoneKey) => {
1001
- if (zoneKey === rootDroppableId) {
1002
- return data;
1003
- }
1004
- const newData = __spreadProps(__spreadValues({}, data), {
1005
- zones: data.zones ? __spreadValues({}, data.zones) : {}
1006
- });
1007
- newData.zones[zoneKey] = newData.zones[zoneKey] || [];
1008
- return newData;
1009
- };
1010
-
1011
- // ../core/lib/use-slots.tsx
1012
- init_react_import();
1013
- import { useMemo } from "react";
1014
- function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
1015
- const slotProps = useMemo(() => {
1016
- const mapped = mapSlots(
1017
- item,
1018
- (content, _parentId, propName, field, propPath) => {
1019
- const wildcardPath = propPath.replace(/\[\d+\]/g, "[*]");
1020
- const isReadOnly = (readOnly == null ? void 0 : readOnly[propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly;
1021
- const render = isReadOnly ? renderSlotRender : renderSlotEdit;
1022
- const Slot = (dzProps) => render(__spreadProps(__spreadValues({
1023
- allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
1024
- disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
1025
- }, dzProps), {
1026
- zone: propName,
1027
- content
1028
- }));
1029
- return Slot;
1030
- },
1031
- config
1032
- ).props;
1033
- return mapped;
1034
- }, [config, item, readOnly, forceReadOnly]);
1035
- const mergedProps = useMemo(
1036
- () => __spreadValues(__spreadValues({}, item.props), slotProps),
1037
- [item.props, slotProps]
1038
- );
1039
- return mergedProps;
1040
- }
1041
-
1042
- // ../core/components/SlotRender/server.tsx
1043
- init_react_import();
1044
- import { forwardRef as forwardRef3 } from "react";
1045
- import { jsx as jsx2 } from "react/jsx-runtime";
1046
- var SlotRenderPure = (props) => /* @__PURE__ */ jsx2(SlotRender, __spreadValues({}, props));
1047
- var Item = ({
1048
- config,
1049
- item,
1050
- metadata
1051
- }) => {
1052
- const Component = config.components[item.type];
1053
- const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx2(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
1054
- return /* @__PURE__ */ jsx2(
1055
- Component.render,
1056
- __spreadProps(__spreadValues({}, props), {
1057
- puck: __spreadProps(__spreadValues({}, props.puck), {
1058
- renderDropZone: DropZoneRender,
1059
- metadata: metadata || {}
1060
- })
1061
- })
1062
- );
1063
- };
1064
- var SlotRender = forwardRef3(
1065
- function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
1066
- return /* @__PURE__ */ jsx2("div", { className, style, ref, children: content.map((item) => {
1067
- if (!config.components[item.type]) {
1068
- return null;
1069
- }
1070
- return /* @__PURE__ */ jsx2(
1071
- Item,
1072
- {
1073
- config,
1074
- item,
1075
- metadata
1076
- },
1077
- item.props.id
1078
- );
1079
- }) });
1080
- }
1081
- );
1082
-
1083
- // ../core/components/ServerRender/index.tsx
1084
- import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
1085
- function DropZoneRender({
1086
- zone,
1087
- data,
1088
- areaId = "root",
1089
- config,
1090
- metadata = {}
1091
- }) {
1092
- let zoneCompound = rootDroppableId;
1093
- let content = (data == null ? void 0 : data.content) || [];
1094
- if (!data || !config) {
1095
- return null;
1096
- }
1097
- if (areaId !== rootAreaId && zone !== rootZone) {
1098
- zoneCompound = `${areaId}:${zone}`;
1099
- content = setupZone(data, zoneCompound).zones[zoneCompound];
1100
- }
1101
- return /* @__PURE__ */ jsx3(Fragment, { children: content.map((item) => {
1102
- const Component = config.components[item.type];
1103
- const props = __spreadProps(__spreadValues({}, item.props), {
1104
- puck: {
1105
- renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ jsx3(
1106
- DropZoneRender,
1107
- {
1108
- zone: zone2,
1109
- data,
1110
- areaId: item.props.id,
1111
- config,
1112
- metadata
1113
- }
1114
- ),
1115
- metadata,
1116
- dragRef: null,
1117
- isEditing: false
1118
- }
1119
- });
1120
- const renderItem = __spreadProps(__spreadValues({}, item), { props });
1121
- const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ jsx3(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
1122
- if (Component) {
1123
- return /* @__PURE__ */ jsx3(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
1124
- }
1125
- return null;
1126
- }) });
1127
- }
1128
-
1129
- // ../core/lib/resolve-all-data.ts
1130
- init_react_import();
1131
-
1132
- // ../core/lib/resolve-component-data.ts
1133
- init_react_import();
1134
-
1135
- // ../core/lib/get-changed.ts
1136
- init_react_import();
1137
- var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1138
- var getChanged = (newItem, oldItem) => {
1139
- return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1140
- const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1141
- const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1142
- return __spreadProps(__spreadValues({}, acc), {
1143
- [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
1144
- });
1145
- }, {}) : {};
1146
- };
1147
-
1148
- // ../core/lib/resolve-component-data.ts
1149
- var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1150
- var cache = { lastChange: {} };
1151
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
1152
- const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
1153
- const resolvedItem = __spreadValues({}, item);
1154
- const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
1155
- const id = "id" in item.props ? item.props.id : "root";
1156
- if (shouldRunResolver) {
1157
- const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1158
- if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
1159
- return { node: resolved, didChange: false };
1160
- }
1161
- const changed = getChanged(item, oldItem);
1162
- if (onResolveStart) {
1163
- onResolveStart(item);
1164
- }
1165
- const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
1166
- changed,
1167
- lastData: oldItem,
1168
- metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
1169
- trigger
1170
- });
1171
- resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
1172
- if (Object.keys(readOnly).length) {
1173
- resolvedItem.readOnly = readOnly;
1174
- }
1175
- }
1176
- let itemWithResolvedChildren = yield mapSlots(
1177
- resolvedItem,
1178
- (content) => __async(void 0, null, function* () {
1179
- return yield Promise.all(
1180
- content.map(
1181
- (childItem) => __async(void 0, null, function* () {
1182
- return (yield resolveComponentData(
1183
- childItem,
1184
- config,
1185
- metadata,
1186
- onResolveStart,
1187
- onResolveEnd,
1188
- trigger
1189
- )).node;
1190
- })
1191
- )
1192
- );
1193
- }),
1194
- config
1195
- );
1196
- if (shouldRunResolver && onResolveEnd) {
1197
- onResolveEnd(resolvedItem);
1198
- }
1199
- cache.lastChange[id] = {
1200
- item,
1201
- resolved: itemWithResolvedChildren
1202
- };
1203
- return {
1204
- node: itemWithResolvedChildren,
1205
- didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
1206
- };
1207
- });
1208
-
1209
- // ../core/lib/data/default-data.ts
1210
- init_react_import();
1211
-
1212
- // ../core/lib/data/to-component.ts
1213
- init_react_import();
1214
-
1215
- // ../core/lib/transform-props.ts
1216
- init_react_import();
1217
-
1218
- // ../core/lib/migrate.ts
1219
- init_react_import();
1220
-
1221
- // ../core/store/default-app-state.ts
1222
- init_react_import();
1223
-
1224
- // ../core/components/ViewportControls/default-viewports.ts
1225
- init_react_import();
1226
- var defaultViewports = [
1227
- { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1228
- { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1229
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1230
- ];
1231
-
1232
- // ../core/store/default-app-state.ts
1233
- var defaultAppState = {
1234
- data: { content: [], root: {}, zones: {} },
1235
- ui: {
1236
- leftSideBarVisible: true,
1237
- rightSideBarVisible: true,
1238
- arrayState: {},
1239
- itemSelector: null,
1240
- componentList: {},
1241
- isDragging: false,
1242
- previewMode: "edit",
1243
- viewports: {
1244
- current: {
1245
- width: defaultViewports[0].width,
1246
- height: defaultViewports[0].height || "auto"
1247
- },
1248
- options: [],
1249
- controlsVisible: true
1250
- },
1251
- field: { focus: null }
1252
- },
1253
- indexes: {
1254
- nodes: {},
1255
- zones: {}
1256
- }
1257
- };
1258
-
1259
- // ../core/reducer/actions/replace.ts
1260
1013
  var replaceAction = (state, action, appStore) => {
1261
1014
  const [parentId] = action.destinationZone.split(":");
1262
1015
  const idsInPath = getIdsForParent(action.destinationZone, state);
@@ -1507,6 +1260,21 @@ var removeAction = (state, action, appStore) => {
1507
1260
 
1508
1261
  // ../core/reducer/actions/register-zone.ts
1509
1262
  init_react_import();
1263
+
1264
+ // ../core/lib/data/setup-zone.ts
1265
+ init_react_import();
1266
+ var setupZone = (data, zoneKey) => {
1267
+ if (zoneKey === rootDroppableId) {
1268
+ return data;
1269
+ }
1270
+ const newData = __spreadProps(__spreadValues({}, data), {
1271
+ zones: data.zones ? __spreadValues({}, data.zones) : {}
1272
+ });
1273
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
1274
+ return newData;
1275
+ };
1276
+
1277
+ // ../core/reducer/actions/register-zone.ts
1510
1278
  var zoneCache = {};
1511
1279
  function registerZoneAction(state, action) {
1512
1280
  if (zoneCache[action.zone]) {
@@ -1659,6 +1427,14 @@ function createReducer({
1659
1427
  );
1660
1428
  }
1661
1429
 
1430
+ // ../core/components/ViewportControls/default-viewports.ts
1431
+ init_react_import();
1432
+ var defaultViewports = [
1433
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1434
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1435
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1436
+ ];
1437
+
1662
1438
  // ../../node_modules/zustand/esm/vanilla.mjs
1663
1439
  init_react_import();
1664
1440
  var createStoreImpl = (createState) => {
@@ -1908,6 +1684,19 @@ var flattenData = (state, config) => {
1908
1684
  return data;
1909
1685
  };
1910
1686
 
1687
+ // ../core/lib/get-changed.ts
1688
+ init_react_import();
1689
+ var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1690
+ var getChanged = (newItem, oldItem) => {
1691
+ return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1692
+ const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1693
+ const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1694
+ return __spreadProps(__spreadValues({}, acc), {
1695
+ [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
1696
+ });
1697
+ }, {}) : {};
1698
+ };
1699
+
1911
1700
  // ../core/store/slices/permissions.ts
1912
1701
  var createPermissionsSlice = (set, get) => {
1913
1702
  const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
@@ -2026,6 +1815,71 @@ var createFieldsSlice = (_set, _get) => {
2026
1815
  };
2027
1816
  };
2028
1817
 
1818
+ // ../core/lib/resolve-component-data.ts
1819
+ init_react_import();
1820
+ var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1821
+ var cache = { lastChange: {} };
1822
+ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
1823
+ const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
1824
+ const resolvedItem = __spreadValues({}, item);
1825
+ const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
1826
+ const id = "id" in item.props ? item.props.id : "root";
1827
+ if (shouldRunResolver) {
1828
+ const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1829
+ if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
1830
+ return { node: resolved, didChange: false };
1831
+ }
1832
+ const changed = getChanged(item, oldItem);
1833
+ if (onResolveStart) {
1834
+ onResolveStart(item);
1835
+ }
1836
+ const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
1837
+ changed,
1838
+ lastData: oldItem,
1839
+ metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
1840
+ trigger
1841
+ });
1842
+ resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
1843
+ if (Object.keys(readOnly).length) {
1844
+ resolvedItem.readOnly = readOnly;
1845
+ }
1846
+ }
1847
+ let itemWithResolvedChildren = yield mapFields(
1848
+ resolvedItem,
1849
+ {
1850
+ slot: (_02) => __async(void 0, [_02], function* ({ value }) {
1851
+ const content = value;
1852
+ return yield Promise.all(
1853
+ content.map(
1854
+ (childItem) => __async(void 0, null, function* () {
1855
+ return (yield resolveComponentData(
1856
+ childItem,
1857
+ config,
1858
+ metadata,
1859
+ onResolveStart,
1860
+ onResolveEnd,
1861
+ trigger
1862
+ )).node;
1863
+ })
1864
+ )
1865
+ );
1866
+ })
1867
+ },
1868
+ config
1869
+ );
1870
+ if (shouldRunResolver && onResolveEnd) {
1871
+ onResolveEnd(resolvedItem);
1872
+ }
1873
+ cache.lastChange[id] = {
1874
+ item,
1875
+ resolved: itemWithResolvedChildren
1876
+ };
1877
+ return {
1878
+ node: itemWithResolvedChildren,
1879
+ didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
1880
+ };
1881
+ });
1882
+
2029
1883
  // ../core/lib/data/to-root.ts
2030
1884
  init_react_import();
2031
1885
  var toRoot = (item) => {
@@ -2043,6 +1897,34 @@ var toRoot = (item) => {
2043
1897
  return { props: {}, readOnly };
2044
1898
  };
2045
1899
 
1900
+ // ../core/store/default-app-state.ts
1901
+ init_react_import();
1902
+ var defaultAppState = {
1903
+ data: { content: [], root: {}, zones: {} },
1904
+ ui: {
1905
+ leftSideBarVisible: true,
1906
+ rightSideBarVisible: true,
1907
+ arrayState: {},
1908
+ itemSelector: null,
1909
+ componentList: {},
1910
+ isDragging: false,
1911
+ previewMode: "edit",
1912
+ viewports: {
1913
+ current: {
1914
+ width: defaultViewports[0].width,
1915
+ height: defaultViewports[0].height || "auto"
1916
+ },
1917
+ options: [],
1918
+ controlsVisible: true
1919
+ },
1920
+ field: { focus: null }
1921
+ },
1922
+ indexes: {
1923
+ nodes: {},
1924
+ zones: {}
1925
+ }
1926
+ };
1927
+
2046
1928
  // ../core/store/index.ts
2047
1929
  var defaultPageFields = {
2048
1930
  title: { type: "text" }
@@ -2064,7 +1946,8 @@ var createAppStore = (initialAppStore) => create()(
2064
1946
  },
2065
1947
  status: "LOADING",
2066
1948
  iframe: {},
2067
- metadata: {}
1949
+ metadata: {},
1950
+ fieldTransforms: {}
2068
1951
  }, initialAppStore), {
2069
1952
  fields: createFieldsSlice(set, get),
2070
1953
  history: createHistorySlice(set, get),
@@ -2240,7 +2123,7 @@ var useBreadcrumbs = (renderCount) => {
2240
2123
  return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
2241
2124
  });
2242
2125
  const appStore = useAppStoreApi();
2243
- return useMemo2(() => {
2126
+ return useMemo(() => {
2244
2127
  const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
2245
2128
  var _a, _b, _c;
2246
2129
  const [componentId] = zoneCompound.split(":");
@@ -2285,12 +2168,18 @@ init_react_import();
2285
2168
  // ../core/lib/data/replace.ts
2286
2169
  init_react_import();
2287
2170
 
2171
+ // ../core/lib/use-reset-auto-zoom.ts
2172
+ init_react_import();
2173
+
2174
+ // ../core/lib/get-zoom-config.ts
2175
+ init_react_import();
2176
+
2288
2177
  // css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
2289
2178
  init_react_import();
2290
2179
  var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
2291
2180
 
2292
2181
  // ../core/components/Loader/index.tsx
2293
- import { jsx as jsx4 } from "react/jsx-runtime";
2182
+ import { jsx as jsx2 } from "react/jsx-runtime";
2294
2183
  var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
2295
2184
  var Loader = (_a) => {
2296
2185
  var _b = _a, {
@@ -2300,7 +2189,7 @@ var Loader = (_a) => {
2300
2189
  "color",
2301
2190
  "size"
2302
2191
  ]);
2303
- return /* @__PURE__ */ jsx4(
2192
+ return /* @__PURE__ */ jsx2(
2304
2193
  "span",
2305
2194
  __spreadValues({
2306
2195
  className: getClassName2(),
@@ -2315,7 +2204,7 @@ var Loader = (_a) => {
2315
2204
  };
2316
2205
 
2317
2206
  // ../core/components/SidebarSection/index.tsx
2318
- import { jsx as jsx5, jsxs } from "react/jsx-runtime";
2207
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
2319
2208
  var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
2320
2209
  var SidebarSection = ({
2321
2210
  children,
@@ -2334,9 +2223,9 @@ var SidebarSection = ({
2334
2223
  className: getClassName3({ noBorderTop, noPadding }),
2335
2224
  style: { background },
2336
2225
  children: [
2337
- /* @__PURE__ */ jsx5("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
2226
+ /* @__PURE__ */ jsx3("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
2338
2227
  showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumb"), children: [
2339
- /* @__PURE__ */ jsx5(
2228
+ /* @__PURE__ */ jsx3(
2340
2229
  "button",
2341
2230
  {
2342
2231
  type: "button",
@@ -2345,12 +2234,12 @@ var SidebarSection = ({
2345
2234
  children: breadcrumb.label
2346
2235
  }
2347
2236
  ),
2348
- /* @__PURE__ */ jsx5(ChevronRight, { size: 16 })
2237
+ /* @__PURE__ */ jsx3(ChevronRight, { size: 16 })
2349
2238
  ] }, i)) : null,
2350
- /* @__PURE__ */ jsx5("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx5(Heading, { rank: "2", size: "xs", children: title }) })
2239
+ /* @__PURE__ */ jsx3("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx3(Heading, { rank: "2", size: "xs", children: title }) })
2351
2240
  ] }) }),
2352
- /* @__PURE__ */ jsx5("div", { className: getClassName3("content"), children }),
2353
- isLoading && /* @__PURE__ */ jsx5("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx5(Loader, { size: 32 }) })
2241
+ /* @__PURE__ */ jsx3("div", { className: getClassName3("content"), children }),
2242
+ isLoading && /* @__PURE__ */ jsx3("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx3(Loader, { size: 32 }) })
2354
2243
  ]
2355
2244
  }
2356
2245
  );
@@ -2364,18 +2253,18 @@ init_react_import();
2364
2253
  var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
2365
2254
 
2366
2255
  // ../core/components/OutlineList/index.tsx
2367
- import { jsx as jsx6 } from "react/jsx-runtime";
2256
+ import { jsx as jsx4 } from "react/jsx-runtime";
2368
2257
  var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
2369
2258
  var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
2370
2259
  var OutlineList = ({ children }) => {
2371
- return /* @__PURE__ */ jsx6("ul", { className: getClassName4(), children });
2260
+ return /* @__PURE__ */ jsx4("ul", { className: getClassName4(), children });
2372
2261
  };
2373
- OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx6("div", { className: getClassNameItem({ clickable: true }), children });
2262
+ OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx4("div", { className: getClassNameItem({ clickable: true }), children });
2374
2263
  OutlineList.Item = ({
2375
2264
  children,
2376
2265
  onClick
2377
2266
  }) => {
2378
- return /* @__PURE__ */ jsx6(
2267
+ return /* @__PURE__ */ jsx4(
2379
2268
  "li",
2380
2269
  {
2381
2270
  className: getClassNameItem({ clickable: !!onClick }),
@@ -2409,7 +2298,7 @@ var getFrame = () => {
2409
2298
 
2410
2299
  // src/HeadingAnalyzer.tsx
2411
2300
  import ReactFromJSONModule from "react-from-json";
2412
- import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
2301
+ import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
2413
2302
  var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2414
2303
  var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
2415
2304
  var ReactFromJSON = ReactFromJSONModule.default || ReactFromJSONModule;
@@ -2514,19 +2403,19 @@ var HeadingAnalyzer = () => {
2514
2403
  children: [
2515
2404
  "Heading analyzer styles not loaded. Please review the",
2516
2405
  " ",
2517
- /* @__PURE__ */ jsx7("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2406
+ /* @__PURE__ */ jsx5("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2518
2407
  "."
2519
2408
  ]
2520
2409
  }
2521
2410
  ),
2522
- hierarchy.length === 0 && /* @__PURE__ */ jsx7("div", { children: "No headings." }),
2523
- /* @__PURE__ */ jsx7(OutlineList, { children: /* @__PURE__ */ jsx7(
2411
+ hierarchy.length === 0 && /* @__PURE__ */ jsx5("div", { children: "No headings." }),
2412
+ /* @__PURE__ */ jsx5(OutlineList, { children: /* @__PURE__ */ jsx5(
2524
2413
  ReactFromJSON,
2525
2414
  {
2526
2415
  mapping: {
2527
- Root: (props) => /* @__PURE__ */ jsx7(Fragment2, { children: props.children }),
2416
+ Root: (props) => /* @__PURE__ */ jsx5(Fragment, { children: props.children }),
2528
2417
  OutlineListItem: (props) => /* @__PURE__ */ jsxs2(OutlineList.Item, { children: [
2529
- /* @__PURE__ */ jsx7(OutlineList.Clickable, { children: /* @__PURE__ */ jsx7(
2418
+ /* @__PURE__ */ jsx5(OutlineList.Clickable, { children: /* @__PURE__ */ jsx5(
2530
2419
  "small",
2531
2420
  {
2532
2421
  className: getClassNameItem2({ missing: props.missing }),
@@ -2544,13 +2433,13 @@ var HeadingAnalyzer = () => {
2544
2433
  }, 2e3);
2545
2434
  }
2546
2435
  },
2547
- children: props.missing ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
2436
+ children: props.missing ? /* @__PURE__ */ jsxs2(Fragment, { children: [
2548
2437
  /* @__PURE__ */ jsxs2("b", { children: [
2549
2438
  "H",
2550
2439
  props.rank
2551
2440
  ] }),
2552
2441
  ": Missing"
2553
- ] }) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
2442
+ ] }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
2554
2443
  /* @__PURE__ */ jsxs2("b", { children: [
2555
2444
  "H",
2556
2445
  props.rank
@@ -2560,7 +2449,7 @@ var HeadingAnalyzer = () => {
2560
2449
  ] })
2561
2450
  }
2562
2451
  ) }),
2563
- /* @__PURE__ */ jsx7(OutlineList, { children: props.children })
2452
+ /* @__PURE__ */ jsx5(OutlineList, { children: props.children })
2564
2453
  ] })
2565
2454
  },
2566
2455
  entry: {
@@ -2582,9 +2471,9 @@ var HeadingAnalyzer = () => {
2582
2471
  };
2583
2472
  var headingAnalyzer = {
2584
2473
  overrides: {
2585
- fields: ({ children, itemSelector }) => /* @__PURE__ */ jsxs2(Fragment2, { children: [
2474
+ fields: ({ children, itemSelector }) => /* @__PURE__ */ jsxs2(Fragment, { children: [
2586
2475
  children,
2587
- /* @__PURE__ */ jsx7("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ jsx7(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ jsx7(HeadingAnalyzer, {}) }) })
2476
+ /* @__PURE__ */ jsx5("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ jsx5(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ jsx5(HeadingAnalyzer, {}) }) })
2588
2477
  ] })
2589
2478
  }
2590
2479
  };