@measured/puck-plugin-heading-analyzer 0.20.0-canary.d12fc3a9 → 0.20.0-canary.d405985b

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.
Files changed (3) hide show
  1. package/dist/index.js +173 -316
  2. package/dist/index.mjs +152 -295
  3. package/package.json +2 -2
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_react11 = 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();
@@ -1000,275 +1000,6 @@ function insertAction(state, action, appStore) {
1000
1000
 
1001
1001
  // ../core/reducer/actions/replace.ts
1002
1002
  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
1003
  var replaceAction = (state, action, appStore) => {
1273
1004
  const [parentId] = action.destinationZone.split(":");
1274
1005
  const idsInPath = getIdsForParent(action.destinationZone, state);
@@ -1519,6 +1250,21 @@ var removeAction = (state, action, appStore) => {
1519
1250
 
1520
1251
  // ../core/reducer/actions/register-zone.ts
1521
1252
  init_react_import();
1253
+
1254
+ // ../core/lib/data/setup-zone.ts
1255
+ init_react_import();
1256
+ var setupZone = (data, zoneKey) => {
1257
+ if (zoneKey === rootDroppableId) {
1258
+ return data;
1259
+ }
1260
+ const newData = __spreadProps(__spreadValues({}, data), {
1261
+ zones: data.zones ? __spreadValues({}, data.zones) : {}
1262
+ });
1263
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
1264
+ return newData;
1265
+ };
1266
+
1267
+ // ../core/reducer/actions/register-zone.ts
1522
1268
  var zoneCache = {};
1523
1269
  function registerZoneAction(state, action) {
1524
1270
  if (zoneCache[action.zone]) {
@@ -1671,6 +1417,14 @@ function createReducer({
1671
1417
  );
1672
1418
  }
1673
1419
 
1420
+ // ../core/components/ViewportControls/default-viewports.ts
1421
+ init_react_import();
1422
+ var defaultViewports = [
1423
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1424
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1425
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1426
+ ];
1427
+
1674
1428
  // ../../node_modules/zustand/esm/vanilla.mjs
1675
1429
  init_react_import();
1676
1430
  var createStoreImpl = (createState) => {
@@ -1698,15 +1452,15 @@ var createStore = (createState) => createState ? createStoreImpl(createState) :
1698
1452
 
1699
1453
  // ../../node_modules/zustand/esm/react.mjs
1700
1454
  init_react_import();
1701
- var import_react6 = __toESM(require("react"), 1);
1455
+ var import_react4 = __toESM(require("react"), 1);
1702
1456
  var identity = (arg) => arg;
1703
1457
  function useStore(api, selector = identity) {
1704
- const slice = import_react6.default.useSyncExternalStore(
1458
+ const slice = import_react4.default.useSyncExternalStore(
1705
1459
  api.subscribe,
1706
1460
  () => selector(api.getState()),
1707
1461
  () => selector(api.getInitialState())
1708
1462
  );
1709
- import_react6.default.useDebugValue(slice);
1463
+ import_react4.default.useDebugValue(slice);
1710
1464
  return slice;
1711
1465
  }
1712
1466
  var createImpl = (createState) => {
@@ -1745,15 +1499,15 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1745
1499
  var subscribeWithSelector = subscribeWithSelectorImpl;
1746
1500
 
1747
1501
  // ../core/store/index.ts
1748
- var import_react11 = require("react");
1502
+ var import_react9 = require("react");
1749
1503
 
1750
1504
  // ../core/store/slices/history.ts
1751
1505
  init_react_import();
1752
- var import_react8 = require("react");
1506
+ var import_react6 = require("react");
1753
1507
 
1754
1508
  // ../core/lib/use-hotkey.ts
1755
1509
  init_react_import();
1756
- var import_react7 = require("react");
1510
+ var import_react5 = require("react");
1757
1511
  var useHotkeyStore = create()(
1758
1512
  subscribeWithSelector((set) => ({
1759
1513
  held: {},
@@ -1902,7 +1656,7 @@ var createNodesSlice = (set, get) => ({
1902
1656
 
1903
1657
  // ../core/store/slices/permissions.ts
1904
1658
  init_react_import();
1905
- var import_react9 = require("react");
1659
+ var import_react7 = require("react");
1906
1660
 
1907
1661
  // ../core/lib/data/flatten-data.ts
1908
1662
  init_react_import();
@@ -1920,6 +1674,19 @@ var flattenData = (state, config) => {
1920
1674
  return data;
1921
1675
  };
1922
1676
 
1677
+ // ../core/lib/get-changed.ts
1678
+ init_react_import();
1679
+ var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1680
+ var getChanged = (newItem, oldItem) => {
1681
+ return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1682
+ const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1683
+ const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1684
+ return __spreadProps(__spreadValues({}, acc), {
1685
+ [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
1686
+ });
1687
+ }, {}) : {};
1688
+ };
1689
+
1923
1690
  // ../core/store/slices/permissions.ts
1924
1691
  var createPermissionsSlice = (set, get) => {
1925
1692
  const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
@@ -2028,7 +1795,7 @@ var createPermissionsSlice = (set, get) => {
2028
1795
 
2029
1796
  // ../core/store/slices/fields.ts
2030
1797
  init_react_import();
2031
- var import_react10 = require("react");
1798
+ var import_react8 = require("react");
2032
1799
  var createFieldsSlice = (_set, _get) => {
2033
1800
  return {
2034
1801
  fields: {},
@@ -2038,6 +1805,68 @@ var createFieldsSlice = (_set, _get) => {
2038
1805
  };
2039
1806
  };
2040
1807
 
1808
+ // ../core/lib/resolve-component-data.ts
1809
+ init_react_import();
1810
+ var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1811
+ var cache = { lastChange: {} };
1812
+ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
1813
+ const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
1814
+ const resolvedItem = __spreadValues({}, item);
1815
+ const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
1816
+ const id = "id" in item.props ? item.props.id : "root";
1817
+ if (shouldRunResolver) {
1818
+ const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1819
+ if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
1820
+ return { node: resolved, didChange: false };
1821
+ }
1822
+ const changed = getChanged(item, oldItem);
1823
+ if (onResolveStart) {
1824
+ onResolveStart(item);
1825
+ }
1826
+ const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
1827
+ changed,
1828
+ lastData: oldItem,
1829
+ metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
1830
+ trigger
1831
+ });
1832
+ resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
1833
+ if (Object.keys(readOnly).length) {
1834
+ resolvedItem.readOnly = readOnly;
1835
+ }
1836
+ }
1837
+ let itemWithResolvedChildren = yield mapSlots(
1838
+ resolvedItem,
1839
+ (content) => __async(void 0, null, function* () {
1840
+ return yield Promise.all(
1841
+ content.map(
1842
+ (childItem) => __async(void 0, null, function* () {
1843
+ return (yield resolveComponentData(
1844
+ childItem,
1845
+ config,
1846
+ metadata,
1847
+ onResolveStart,
1848
+ onResolveEnd,
1849
+ trigger
1850
+ )).node;
1851
+ })
1852
+ )
1853
+ );
1854
+ }),
1855
+ config
1856
+ );
1857
+ if (shouldRunResolver && onResolveEnd) {
1858
+ onResolveEnd(resolvedItem);
1859
+ }
1860
+ cache.lastChange[id] = {
1861
+ item,
1862
+ resolved: itemWithResolvedChildren
1863
+ };
1864
+ return {
1865
+ node: itemWithResolvedChildren,
1866
+ didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
1867
+ };
1868
+ });
1869
+
2041
1870
  // ../core/lib/data/to-root.ts
2042
1871
  init_react_import();
2043
1872
  var toRoot = (item) => {
@@ -2055,6 +1884,34 @@ var toRoot = (item) => {
2055
1884
  return { props: {}, readOnly };
2056
1885
  };
2057
1886
 
1887
+ // ../core/store/default-app-state.ts
1888
+ init_react_import();
1889
+ var defaultAppState = {
1890
+ data: { content: [], root: {}, zones: {} },
1891
+ ui: {
1892
+ leftSideBarVisible: true,
1893
+ rightSideBarVisible: true,
1894
+ arrayState: {},
1895
+ itemSelector: null,
1896
+ componentList: {},
1897
+ isDragging: false,
1898
+ previewMode: "edit",
1899
+ viewports: {
1900
+ current: {
1901
+ width: defaultViewports[0].width,
1902
+ height: defaultViewports[0].height || "auto"
1903
+ },
1904
+ options: [],
1905
+ controlsVisible: true
1906
+ },
1907
+ field: { focus: null }
1908
+ },
1909
+ indexes: {
1910
+ nodes: {},
1911
+ zones: {}
1912
+ }
1913
+ };
1914
+
2058
1915
  // ../core/store/index.ts
2059
1916
  var defaultPageFields = {
2060
1917
  title: { type: "text" }
@@ -2231,13 +2088,13 @@ var createAppStore = (initialAppStore) => create()(
2231
2088
  });
2232
2089
  })
2233
2090
  );
2234
- var appStoreContext = (0, import_react11.createContext)(createAppStore());
2091
+ var appStoreContext = (0, import_react9.createContext)(createAppStore());
2235
2092
  function useAppStore(selector) {
2236
- const context = (0, import_react11.useContext)(appStoreContext);
2093
+ const context = (0, import_react9.useContext)(appStoreContext);
2237
2094
  return useStore(context, selector);
2238
2095
  }
2239
2096
  function useAppStoreApi() {
2240
- return (0, import_react11.useContext)(appStoreContext);
2097
+ return (0, import_react9.useContext)(appStoreContext);
2241
2098
  }
2242
2099
 
2243
2100
  // ../core/lib/use-breadcrumbs.ts
@@ -2252,7 +2109,7 @@ var useBreadcrumbs = (renderCount) => {
2252
2109
  return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
2253
2110
  });
2254
2111
  const appStore = useAppStoreApi();
2255
- return (0, import_react12.useMemo)(() => {
2112
+ return (0, import_react10.useMemo)(() => {
2256
2113
  const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
2257
2114
  var _a, _b, _c;
2258
2115
  const [componentId] = zoneCompound.split(":");
@@ -2302,7 +2159,7 @@ init_react_import();
2302
2159
  var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
2303
2160
 
2304
2161
  // ../core/components/Loader/index.tsx
2305
- var import_jsx_runtime4 = require("react/jsx-runtime");
2162
+ var import_jsx_runtime2 = require("react/jsx-runtime");
2306
2163
  var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
2307
2164
  var Loader = (_a) => {
2308
2165
  var _b = _a, {
@@ -2312,7 +2169,7 @@ var Loader = (_a) => {
2312
2169
  "color",
2313
2170
  "size"
2314
2171
  ]);
2315
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2172
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2316
2173
  "span",
2317
2174
  __spreadValues({
2318
2175
  className: getClassName2(),
@@ -2327,7 +2184,7 @@ var Loader = (_a) => {
2327
2184
  };
2328
2185
 
2329
2186
  // ../core/components/SidebarSection/index.tsx
2330
- var import_jsx_runtime5 = require("react/jsx-runtime");
2187
+ var import_jsx_runtime3 = require("react/jsx-runtime");
2331
2188
  var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
2332
2189
  var SidebarSection = ({
2333
2190
  children,
@@ -2340,15 +2197,15 @@ var SidebarSection = ({
2340
2197
  }) => {
2341
2198
  const setUi = useAppStore((s) => s.setUi);
2342
2199
  const breadcrumbs = useBreadcrumbs(1);
2343
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2200
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2344
2201
  "div",
2345
2202
  {
2346
2203
  className: getClassName3({ noBorderTop, noPadding }),
2347
2204
  style: { background },
2348
2205
  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)(
2206
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
2207
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
2208
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2352
2209
  "button",
2353
2210
  {
2354
2211
  type: "button",
@@ -2357,12 +2214,12 @@ var SidebarSection = ({
2357
2214
  children: breadcrumb.label
2358
2215
  }
2359
2216
  ),
2360
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChevronRight, { size: 16 })
2217
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRight, { size: 16 })
2361
2218
  ] }, 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 }) })
2219
+ /* @__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
2220
  ] }) }),
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 }) })
2221
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("content"), children }),
2222
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 32 }) })
2366
2223
  ]
2367
2224
  }
2368
2225
  );
@@ -2376,18 +2233,18 @@ init_react_import();
2376
2233
  var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
2377
2234
 
2378
2235
  // ../core/components/OutlineList/index.tsx
2379
- var import_jsx_runtime6 = require("react/jsx-runtime");
2236
+ var import_jsx_runtime4 = require("react/jsx-runtime");
2380
2237
  var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
2381
2238
  var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
2382
2239
  var OutlineList = ({ children }) => {
2383
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { className: getClassName4(), children });
2240
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: getClassName4(), children });
2384
2241
  };
2385
- OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
2242
+ OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
2386
2243
  OutlineList.Item = ({
2387
2244
  children,
2388
2245
  onClick
2389
2246
  }) => {
2390
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2247
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2391
2248
  "li",
2392
2249
  {
2393
2250
  className: getClassNameItem({ clickable: !!onClick }),
@@ -2421,7 +2278,7 @@ var getFrame = () => {
2421
2278
 
2422
2279
  // src/HeadingAnalyzer.tsx
2423
2280
  var import_react_from_json = __toESM(require("react-from-json"));
2424
- var import_jsx_runtime7 = require("react/jsx-runtime");
2281
+ var import_jsx_runtime5 = require("react/jsx-runtime");
2425
2282
  var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2426
2283
  var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
2427
2284
  var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
@@ -2477,8 +2334,8 @@ function buildHierarchy(frame) {
2477
2334
  var usePuck = (0, import_puck.createUsePuck)();
2478
2335
  var HeadingAnalyzer = () => {
2479
2336
  const data = usePuck((s) => s.appState.data);
2480
- const [hierarchy, setHierarchy] = (0, import_react13.useState)([]);
2481
- (0, import_react13.useEffect)(() => {
2337
+ const [hierarchy, setHierarchy] = (0, import_react11.useState)([]);
2338
+ (0, import_react11.useEffect)(() => {
2482
2339
  const frame = getFrame();
2483
2340
  let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
2484
2341
  const createHierarchy = () => {
@@ -2513,8 +2370,8 @@ var HeadingAnalyzer = () => {
2513
2370
  frameObserver.disconnect();
2514
2371
  };
2515
2372
  }, [data]);
2516
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: getClassName5(), children: [
2517
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2373
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
2374
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2518
2375
  "small",
2519
2376
  {
2520
2377
  className: getClassName5("cssWarning"),
@@ -2526,19 +2383,19 @@ var HeadingAnalyzer = () => {
2526
2383
  children: [
2527
2384
  "Heading analyzer styles not loaded. Please review the",
2528
2385
  " ",
2529
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2386
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2530
2387
  "."
2531
2388
  ]
2532
2389
  }
2533
2390
  ),
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)(
2391
+ hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: "No headings." }),
2392
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2536
2393
  ReactFromJSON,
2537
2394
  {
2538
2395
  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)(
2396
+ Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: props.children }),
2397
+ OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(OutlineList.Item, { children: [
2398
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2542
2399
  "small",
2543
2400
  {
2544
2401
  className: getClassNameItem2({ missing: props.missing }),
@@ -2556,14 +2413,14 @@ var HeadingAnalyzer = () => {
2556
2413
  }, 2e3);
2557
2414
  }
2558
2415
  },
2559
- children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
2560
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("b", { children: [
2416
+ children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2417
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
2561
2418
  "H",
2562
2419
  props.rank
2563
2420
  ] }),
2564
2421
  ": Missing"
2565
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
2566
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("b", { children: [
2422
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2423
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
2567
2424
  "H",
2568
2425
  props.rank
2569
2426
  ] }),
@@ -2572,7 +2429,7 @@ var HeadingAnalyzer = () => {
2572
2429
  ] })
2573
2430
  }
2574
2431
  ) }),
2575
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OutlineList, { children: props.children })
2432
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: props.children })
2576
2433
  ] })
2577
2434
  },
2578
2435
  entry: {
@@ -2594,9 +2451,9 @@ var HeadingAnalyzer = () => {
2594
2451
  };
2595
2452
  var headingAnalyzer = {
2596
2453
  overrides: {
2597
- fields: ({ children, itemSelector }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
2454
+ fields: ({ children, itemSelector }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2598
2455
  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, {}) }) })
2456
+ /* @__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
2457
  ] })
2601
2458
  }
2602
2459
  };
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();
@@ -988,275 +988,6 @@ function insertAction(state, action, appStore) {
988
988
 
989
989
  // ../core/reducer/actions/replace.ts
990
990
  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
991
  var replaceAction = (state, action, appStore) => {
1261
992
  const [parentId] = action.destinationZone.split(":");
1262
993
  const idsInPath = getIdsForParent(action.destinationZone, state);
@@ -1507,6 +1238,21 @@ var removeAction = (state, action, appStore) => {
1507
1238
 
1508
1239
  // ../core/reducer/actions/register-zone.ts
1509
1240
  init_react_import();
1241
+
1242
+ // ../core/lib/data/setup-zone.ts
1243
+ init_react_import();
1244
+ var setupZone = (data, zoneKey) => {
1245
+ if (zoneKey === rootDroppableId) {
1246
+ return data;
1247
+ }
1248
+ const newData = __spreadProps(__spreadValues({}, data), {
1249
+ zones: data.zones ? __spreadValues({}, data.zones) : {}
1250
+ });
1251
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
1252
+ return newData;
1253
+ };
1254
+
1255
+ // ../core/reducer/actions/register-zone.ts
1510
1256
  var zoneCache = {};
1511
1257
  function registerZoneAction(state, action) {
1512
1258
  if (zoneCache[action.zone]) {
@@ -1659,6 +1405,14 @@ function createReducer({
1659
1405
  );
1660
1406
  }
1661
1407
 
1408
+ // ../core/components/ViewportControls/default-viewports.ts
1409
+ init_react_import();
1410
+ var defaultViewports = [
1411
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1412
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1413
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1414
+ ];
1415
+
1662
1416
  // ../../node_modules/zustand/esm/vanilla.mjs
1663
1417
  init_react_import();
1664
1418
  var createStoreImpl = (createState) => {
@@ -1908,6 +1662,19 @@ var flattenData = (state, config) => {
1908
1662
  return data;
1909
1663
  };
1910
1664
 
1665
+ // ../core/lib/get-changed.ts
1666
+ init_react_import();
1667
+ var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1668
+ var getChanged = (newItem, oldItem) => {
1669
+ return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1670
+ const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1671
+ const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1672
+ return __spreadProps(__spreadValues({}, acc), {
1673
+ [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
1674
+ });
1675
+ }, {}) : {};
1676
+ };
1677
+
1911
1678
  // ../core/store/slices/permissions.ts
1912
1679
  var createPermissionsSlice = (set, get) => {
1913
1680
  const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
@@ -2026,6 +1793,68 @@ var createFieldsSlice = (_set, _get) => {
2026
1793
  };
2027
1794
  };
2028
1795
 
1796
+ // ../core/lib/resolve-component-data.ts
1797
+ init_react_import();
1798
+ var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1799
+ var cache = { lastChange: {} };
1800
+ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
1801
+ const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
1802
+ const resolvedItem = __spreadValues({}, item);
1803
+ const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
1804
+ const id = "id" in item.props ? item.props.id : "root";
1805
+ if (shouldRunResolver) {
1806
+ const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1807
+ if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
1808
+ return { node: resolved, didChange: false };
1809
+ }
1810
+ const changed = getChanged(item, oldItem);
1811
+ if (onResolveStart) {
1812
+ onResolveStart(item);
1813
+ }
1814
+ const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
1815
+ changed,
1816
+ lastData: oldItem,
1817
+ metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
1818
+ trigger
1819
+ });
1820
+ resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
1821
+ if (Object.keys(readOnly).length) {
1822
+ resolvedItem.readOnly = readOnly;
1823
+ }
1824
+ }
1825
+ let itemWithResolvedChildren = yield mapSlots(
1826
+ resolvedItem,
1827
+ (content) => __async(void 0, null, function* () {
1828
+ return yield Promise.all(
1829
+ content.map(
1830
+ (childItem) => __async(void 0, null, function* () {
1831
+ return (yield resolveComponentData(
1832
+ childItem,
1833
+ config,
1834
+ metadata,
1835
+ onResolveStart,
1836
+ onResolveEnd,
1837
+ trigger
1838
+ )).node;
1839
+ })
1840
+ )
1841
+ );
1842
+ }),
1843
+ config
1844
+ );
1845
+ if (shouldRunResolver && onResolveEnd) {
1846
+ onResolveEnd(resolvedItem);
1847
+ }
1848
+ cache.lastChange[id] = {
1849
+ item,
1850
+ resolved: itemWithResolvedChildren
1851
+ };
1852
+ return {
1853
+ node: itemWithResolvedChildren,
1854
+ didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
1855
+ };
1856
+ });
1857
+
2029
1858
  // ../core/lib/data/to-root.ts
2030
1859
  init_react_import();
2031
1860
  var toRoot = (item) => {
@@ -2043,6 +1872,34 @@ var toRoot = (item) => {
2043
1872
  return { props: {}, readOnly };
2044
1873
  };
2045
1874
 
1875
+ // ../core/store/default-app-state.ts
1876
+ init_react_import();
1877
+ var defaultAppState = {
1878
+ data: { content: [], root: {}, zones: {} },
1879
+ ui: {
1880
+ leftSideBarVisible: true,
1881
+ rightSideBarVisible: true,
1882
+ arrayState: {},
1883
+ itemSelector: null,
1884
+ componentList: {},
1885
+ isDragging: false,
1886
+ previewMode: "edit",
1887
+ viewports: {
1888
+ current: {
1889
+ width: defaultViewports[0].width,
1890
+ height: defaultViewports[0].height || "auto"
1891
+ },
1892
+ options: [],
1893
+ controlsVisible: true
1894
+ },
1895
+ field: { focus: null }
1896
+ },
1897
+ indexes: {
1898
+ nodes: {},
1899
+ zones: {}
1900
+ }
1901
+ };
1902
+
2046
1903
  // ../core/store/index.ts
2047
1904
  var defaultPageFields = {
2048
1905
  title: { type: "text" }
@@ -2240,7 +2097,7 @@ var useBreadcrumbs = (renderCount) => {
2240
2097
  return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
2241
2098
  });
2242
2099
  const appStore = useAppStoreApi();
2243
- return useMemo2(() => {
2100
+ return useMemo(() => {
2244
2101
  const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
2245
2102
  var _a, _b, _c;
2246
2103
  const [componentId] = zoneCompound.split(":");
@@ -2290,7 +2147,7 @@ init_react_import();
2290
2147
  var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
2291
2148
 
2292
2149
  // ../core/components/Loader/index.tsx
2293
- import { jsx as jsx4 } from "react/jsx-runtime";
2150
+ import { jsx as jsx2 } from "react/jsx-runtime";
2294
2151
  var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
2295
2152
  var Loader = (_a) => {
2296
2153
  var _b = _a, {
@@ -2300,7 +2157,7 @@ var Loader = (_a) => {
2300
2157
  "color",
2301
2158
  "size"
2302
2159
  ]);
2303
- return /* @__PURE__ */ jsx4(
2160
+ return /* @__PURE__ */ jsx2(
2304
2161
  "span",
2305
2162
  __spreadValues({
2306
2163
  className: getClassName2(),
@@ -2315,7 +2172,7 @@ var Loader = (_a) => {
2315
2172
  };
2316
2173
 
2317
2174
  // ../core/components/SidebarSection/index.tsx
2318
- import { jsx as jsx5, jsxs } from "react/jsx-runtime";
2175
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
2319
2176
  var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
2320
2177
  var SidebarSection = ({
2321
2178
  children,
@@ -2334,9 +2191,9 @@ var SidebarSection = ({
2334
2191
  className: getClassName3({ noBorderTop, noPadding }),
2335
2192
  style: { background },
2336
2193
  children: [
2337
- /* @__PURE__ */ jsx5("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
2194
+ /* @__PURE__ */ jsx3("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
2338
2195
  showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumb"), children: [
2339
- /* @__PURE__ */ jsx5(
2196
+ /* @__PURE__ */ jsx3(
2340
2197
  "button",
2341
2198
  {
2342
2199
  type: "button",
@@ -2345,12 +2202,12 @@ var SidebarSection = ({
2345
2202
  children: breadcrumb.label
2346
2203
  }
2347
2204
  ),
2348
- /* @__PURE__ */ jsx5(ChevronRight, { size: 16 })
2205
+ /* @__PURE__ */ jsx3(ChevronRight, { size: 16 })
2349
2206
  ] }, i)) : null,
2350
- /* @__PURE__ */ jsx5("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx5(Heading, { rank: "2", size: "xs", children: title }) })
2207
+ /* @__PURE__ */ jsx3("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx3(Heading, { rank: "2", size: "xs", children: title }) })
2351
2208
  ] }) }),
2352
- /* @__PURE__ */ jsx5("div", { className: getClassName3("content"), children }),
2353
- isLoading && /* @__PURE__ */ jsx5("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx5(Loader, { size: 32 }) })
2209
+ /* @__PURE__ */ jsx3("div", { className: getClassName3("content"), children }),
2210
+ isLoading && /* @__PURE__ */ jsx3("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx3(Loader, { size: 32 }) })
2354
2211
  ]
2355
2212
  }
2356
2213
  );
@@ -2364,18 +2221,18 @@ init_react_import();
2364
2221
  var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
2365
2222
 
2366
2223
  // ../core/components/OutlineList/index.tsx
2367
- import { jsx as jsx6 } from "react/jsx-runtime";
2224
+ import { jsx as jsx4 } from "react/jsx-runtime";
2368
2225
  var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
2369
2226
  var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
2370
2227
  var OutlineList = ({ children }) => {
2371
- return /* @__PURE__ */ jsx6("ul", { className: getClassName4(), children });
2228
+ return /* @__PURE__ */ jsx4("ul", { className: getClassName4(), children });
2372
2229
  };
2373
- OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx6("div", { className: getClassNameItem({ clickable: true }), children });
2230
+ OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx4("div", { className: getClassNameItem({ clickable: true }), children });
2374
2231
  OutlineList.Item = ({
2375
2232
  children,
2376
2233
  onClick
2377
2234
  }) => {
2378
- return /* @__PURE__ */ jsx6(
2235
+ return /* @__PURE__ */ jsx4(
2379
2236
  "li",
2380
2237
  {
2381
2238
  className: getClassNameItem({ clickable: !!onClick }),
@@ -2409,7 +2266,7 @@ var getFrame = () => {
2409
2266
 
2410
2267
  // src/HeadingAnalyzer.tsx
2411
2268
  import ReactFromJSONModule from "react-from-json";
2412
- import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
2269
+ import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
2413
2270
  var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2414
2271
  var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
2415
2272
  var ReactFromJSON = ReactFromJSONModule.default || ReactFromJSONModule;
@@ -2514,19 +2371,19 @@ var HeadingAnalyzer = () => {
2514
2371
  children: [
2515
2372
  "Heading analyzer styles not loaded. Please review the",
2516
2373
  " ",
2517
- /* @__PURE__ */ jsx7("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2374
+ /* @__PURE__ */ jsx5("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2518
2375
  "."
2519
2376
  ]
2520
2377
  }
2521
2378
  ),
2522
- hierarchy.length === 0 && /* @__PURE__ */ jsx7("div", { children: "No headings." }),
2523
- /* @__PURE__ */ jsx7(OutlineList, { children: /* @__PURE__ */ jsx7(
2379
+ hierarchy.length === 0 && /* @__PURE__ */ jsx5("div", { children: "No headings." }),
2380
+ /* @__PURE__ */ jsx5(OutlineList, { children: /* @__PURE__ */ jsx5(
2524
2381
  ReactFromJSON,
2525
2382
  {
2526
2383
  mapping: {
2527
- Root: (props) => /* @__PURE__ */ jsx7(Fragment2, { children: props.children }),
2384
+ Root: (props) => /* @__PURE__ */ jsx5(Fragment, { children: props.children }),
2528
2385
  OutlineListItem: (props) => /* @__PURE__ */ jsxs2(OutlineList.Item, { children: [
2529
- /* @__PURE__ */ jsx7(OutlineList.Clickable, { children: /* @__PURE__ */ jsx7(
2386
+ /* @__PURE__ */ jsx5(OutlineList.Clickable, { children: /* @__PURE__ */ jsx5(
2530
2387
  "small",
2531
2388
  {
2532
2389
  className: getClassNameItem2({ missing: props.missing }),
@@ -2544,13 +2401,13 @@ var HeadingAnalyzer = () => {
2544
2401
  }, 2e3);
2545
2402
  }
2546
2403
  },
2547
- children: props.missing ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
2404
+ children: props.missing ? /* @__PURE__ */ jsxs2(Fragment, { children: [
2548
2405
  /* @__PURE__ */ jsxs2("b", { children: [
2549
2406
  "H",
2550
2407
  props.rank
2551
2408
  ] }),
2552
2409
  ": Missing"
2553
- ] }) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
2410
+ ] }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
2554
2411
  /* @__PURE__ */ jsxs2("b", { children: [
2555
2412
  "H",
2556
2413
  props.rank
@@ -2560,7 +2417,7 @@ var HeadingAnalyzer = () => {
2560
2417
  ] })
2561
2418
  }
2562
2419
  ) }),
2563
- /* @__PURE__ */ jsx7(OutlineList, { children: props.children })
2420
+ /* @__PURE__ */ jsx5(OutlineList, { children: props.children })
2564
2421
  ] })
2565
2422
  },
2566
2423
  entry: {
@@ -2582,9 +2439,9 @@ var HeadingAnalyzer = () => {
2582
2439
  };
2583
2440
  var headingAnalyzer = {
2584
2441
  overrides: {
2585
- fields: ({ children, itemSelector }) => /* @__PURE__ */ jsxs2(Fragment2, { children: [
2442
+ fields: ({ children, itemSelector }) => /* @__PURE__ */ jsxs2(Fragment, { children: [
2586
2443
  children,
2587
- /* @__PURE__ */ jsx7("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ jsx7(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ jsx7(HeadingAnalyzer, {}) }) })
2444
+ /* @__PURE__ */ jsx5("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ jsx5(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ jsx5(HeadingAnalyzer, {}) }) })
2588
2445
  ] })
2589
2446
  }
2590
2447
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck-plugin-heading-analyzer",
3
- "version": "0.20.0-canary.d12fc3a9",
3
+ "version": "0.20.0-canary.d405985b",
4
4
  "author": "Chris Villa <chris@puckeditor.com>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",
@@ -25,7 +25,7 @@
25
25
  "dist"
26
26
  ],
27
27
  "devDependencies": {
28
- "@measured/puck": "^0.20.0-canary.d12fc3a9",
28
+ "@measured/puck": "^0.20.0-canary.d405985b",
29
29
  "@types/react": "^19.0.1",
30
30
  "@types/react-dom": "^19.0.2",
31
31
  "eslint": "^7.32.0",