@measured/puck-plugin-heading-analyzer 0.21.0-canary.a3dabae1 → 0.21.0-canary.a62292fd

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
@@ -268,30 +268,30 @@ var require_flat = __commonJS({
268
268
  });
269
269
 
270
270
  // index.ts
271
- var plugin_heading_analyzer_exports = {};
272
- __export(plugin_heading_analyzer_exports, {
271
+ var index_exports = {};
272
+ __export(index_exports, {
273
273
  default: () => HeadingAnalyzer_default
274
274
  });
275
- module.exports = __toCommonJS(plugin_heading_analyzer_exports);
275
+ module.exports = __toCommonJS(index_exports);
276
276
  init_react_import();
277
277
 
278
278
  // src/HeadingAnalyzer.tsx
279
279
  init_react_import();
280
- var import_react10 = require("react");
280
+ var import_react11 = require("react");
281
281
 
282
282
  // css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
283
283
  init_react_import();
284
- var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_yg0s7_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_yg0s7_6", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_yg0s7_10", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_yg0s7_14" };
284
+ var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_116v6_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_116v6_5", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_116v6_9", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_116v6_13" };
285
285
 
286
286
  // src/HeadingAnalyzer.tsx
287
287
  var import_puck = require("@measured/puck");
288
288
 
289
- // ../core/components/OutlineList/index.tsx
289
+ // ../core/components/SidebarSection/index.tsx
290
290
  init_react_import();
291
291
 
292
- // css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
292
+ // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
293
293
  init_react_import();
294
- var styles_module_default = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
294
+ var styles_module_default = { "SidebarSection": "_SidebarSection_8boj8_1", "SidebarSection-title": "_SidebarSection-title_8boj8_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_8boj8_20", "SidebarSection-content": "_SidebarSection-content_8boj8_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_8boj8_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_8boj8_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_8boj8_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_8boj8_41", "SidebarSection-heading": "_SidebarSection-heading_8boj8_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_8boj8_86" };
295
295
 
296
296
  // ../core/lib/get-class-name-factory.ts
297
297
  init_react_import();
@@ -320,50 +320,29 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
320
320
  };
321
321
  var get_class_name_factory_default = getClassNameFactory;
322
322
 
323
- // ../core/components/OutlineList/index.tsx
323
+ // ../core/components/Heading/index.tsx
324
+ init_react_import();
325
+
326
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
327
+ init_react_import();
328
+ var styles_module_default2 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
329
+
330
+ // ../core/components/Heading/index.tsx
324
331
  var import_jsx_runtime = require("react/jsx-runtime");
325
- var getClassName = get_class_name_factory_default("OutlineList", styles_module_default);
326
- var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default);
327
- var OutlineList = ({ children }) => {
328
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: getClassName(), children });
329
- };
330
- OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
331
- OutlineList.Item = ({
332
- children,
333
- onClick
334
- }) => {
332
+ var getClassName = get_class_name_factory_default("Heading", styles_module_default2);
333
+ var Heading = ({ children, rank, size = "m" }) => {
334
+ const Tag = rank ? `h${rank}` : "span";
335
335
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
336
- "li",
336
+ Tag,
337
337
  {
338
- className: getClassNameItem({ clickable: !!onClick }),
339
- onClick,
338
+ className: getClassName({
339
+ [size]: true
340
+ }),
340
341
  children
341
342
  }
342
343
  );
343
344
  };
344
345
 
345
- // ../core/lib/scroll-into-view.ts
346
- init_react_import();
347
- var scrollIntoView = (el) => {
348
- const oldStyle = __spreadValues({}, el.style);
349
- el.style.scrollMargin = "256px";
350
- if (el) {
351
- el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
352
- el.style.scrollMargin = oldStyle.scrollMargin || "";
353
- }
354
- };
355
-
356
- // ../core/lib/get-frame.ts
357
- init_react_import();
358
- var getFrame = () => {
359
- if (typeof window === "undefined") return;
360
- let frameEl = document.querySelector("#preview-frame");
361
- if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
362
- return frameEl.contentDocument || document;
363
- }
364
- return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
365
- };
366
-
367
346
  // ../../node_modules/lucide-react/dist/esm/lucide-react.js
368
347
  init_react_import();
369
348
 
@@ -451,29 +430,15 @@ var createLucideIcon = (iconName, iconNode) => {
451
430
  return Component;
452
431
  };
453
432
 
454
- // ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
433
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
455
434
  init_react_import();
456
- var Heading1 = createLucideIcon("Heading1", [
457
- ["path", { d: "M4 12h8", key: "17cfdx" }],
458
- ["path", { d: "M4 18V6", key: "1rz3zl" }],
459
- ["path", { d: "M12 18V6", key: "zqpxq5" }],
460
- ["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
435
+ var ChevronRight = createLucideIcon("ChevronRight", [
436
+ ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
461
437
  ]);
462
438
 
463
- // ../core/lib/index.ts
464
- init_react_import();
465
-
466
- // ../core/lib/filter.ts
467
- init_react_import();
468
-
469
- // ../core/lib/data/reorder.ts
470
- init_react_import();
471
-
472
- // ../core/lib/data/replace.ts
473
- init_react_import();
474
-
475
- // ../core/lib/use-reset-auto-zoom.ts
439
+ // ../core/lib/use-breadcrumbs.ts
476
440
  init_react_import();
441
+ var import_react10 = require("react");
477
442
 
478
443
  // ../core/store/index.ts
479
444
  init_react_import();
@@ -544,32 +509,27 @@ var walkField = ({
544
509
  config,
545
510
  recurseSlots = false
546
511
  }) => {
547
- var _a, _b, _c, _d, _e;
512
+ var _a, _b, _c;
548
513
  const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
549
514
  const map = mappers[fieldType];
550
515
  if (map && fieldType === "slot") {
551
516
  const content = value || [];
552
- let mappedContent = content;
553
- if (recurseSlots) {
554
- for (let i = 0; i < content.length; i++) {
555
- const el = content[i];
556
- const componentConfig = config.components[el.type];
557
- if (!componentConfig || !((_b = el.props) == null ? void 0 : _b.id)) {
558
- continue;
559
- }
560
- const fields2 = (_c = componentConfig.fields) != null ? _c : {};
561
- mappedContent.push(
562
- walkField({
563
- value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
564
- fields: fields2,
565
- mappers,
566
- id: el.props.id,
567
- config,
568
- recurseSlots
569
- })
570
- );
517
+ const mappedContent = recurseSlots ? content.map((el) => {
518
+ var _a2;
519
+ const componentConfig = config.components[el.type];
520
+ if (!componentConfig) {
521
+ throw new Error(`Could not find component config for ${el.type}`);
571
522
  }
572
- }
523
+ const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
524
+ return walkField({
525
+ value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
526
+ fields: fields2,
527
+ mappers,
528
+ id: el.props.id,
529
+ config,
530
+ recurseSlots
531
+ });
532
+ }) : content;
573
533
  if (containsPromise(mappedContent)) {
574
534
  return Promise.all(mappedContent);
575
535
  }
@@ -591,7 +551,7 @@ var walkField = ({
591
551
  }
592
552
  if (value && typeof value === "object") {
593
553
  if (Array.isArray(value)) {
594
- const arrayFields = ((_d = fields[propKey]) == null ? void 0 : _d.type) === "array" ? fields[propKey].arrayFields : null;
554
+ const arrayFields = ((_b = fields[propKey]) == null ? void 0 : _b.type) === "array" ? fields[propKey].arrayFields : null;
595
555
  if (!arrayFields) return value;
596
556
  const newValue = value.map(
597
557
  (el, idx) => walkField({
@@ -612,7 +572,7 @@ var walkField = ({
612
572
  } else if ("$$typeof" in value) {
613
573
  return value;
614
574
  } else {
615
- const objectFields = ((_e = fields[propKey]) == null ? void 0 : _e.type) === "object" ? fields[propKey].objectFields : fields;
575
+ const objectFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "object" ? fields[propKey].objectFields : fields;
616
576
  return walkObject({
617
577
  value,
618
578
  fields: objectFields,
@@ -858,10 +818,10 @@ var insert = (list, index, item) => {
858
818
  // ../core/lib/generate-id.ts
859
819
  init_react_import();
860
820
 
861
- // ../../node_modules/uuid/dist/esm-node/index.js
821
+ // ../core/node_modules/uuid/dist/esm-node/index.js
862
822
  init_react_import();
863
823
 
864
- // ../../node_modules/uuid/dist/esm-node/rng.js
824
+ // ../core/node_modules/uuid/dist/esm-node/rng.js
865
825
  init_react_import();
866
826
  var import_crypto = __toESM(require("crypto"));
867
827
  var rnds8Pool = new Uint8Array(256);
@@ -874,7 +834,7 @@ function rng() {
874
834
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
875
835
  }
876
836
 
877
- // ../../node_modules/uuid/dist/esm-node/stringify.js
837
+ // ../core/node_modules/uuid/dist/esm-node/stringify.js
878
838
  init_react_import();
879
839
  var byteToHex = [];
880
840
  for (let i = 0; i < 256; ++i) {
@@ -884,17 +844,17 @@ function unsafeStringify(arr, offset = 0) {
884
844
  return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
885
845
  }
886
846
 
887
- // ../../node_modules/uuid/dist/esm-node/v4.js
847
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
888
848
  init_react_import();
889
849
 
890
- // ../../node_modules/uuid/dist/esm-node/native.js
850
+ // ../core/node_modules/uuid/dist/esm-node/native.js
891
851
  init_react_import();
892
852
  var import_crypto2 = __toESM(require("crypto"));
893
853
  var native_default = {
894
854
  randomUUID: import_crypto2.default.randomUUID
895
855
  };
896
856
 
897
- // ../../node_modules/uuid/dist/esm-node/v4.js
857
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
898
858
  function v4(options, buf, offset) {
899
859
  if (native_default.randomUUID && !buf && !options) {
900
860
  return native_default.randomUUID();
@@ -1046,7 +1006,9 @@ var replaceAction = (state, action, appStore) => {
1046
1006
  });
1047
1007
  });
1048
1008
  });
1049
- const stateWithDeepSlotsRemoved = __spreadValues({}, state);
1009
+ const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
1010
+ ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
1011
+ });
1050
1012
  Object.keys(state.indexes.zones).forEach((zoneCompound) => {
1051
1013
  const id = zoneCompound.split(":")[0];
1052
1014
  if (id === originalId) {
@@ -1448,8 +1410,7 @@ init_react_import();
1448
1410
  var defaultViewports = [
1449
1411
  { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1450
1412
  { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1451
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" },
1452
- { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
1413
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1453
1414
  ];
1454
1415
 
1455
1416
  // ../../node_modules/zustand/esm/vanilla.mjs
@@ -1475,7 +1436,7 @@ var createStoreImpl = (createState) => {
1475
1436
  const initialState = state = createState(setState, getState, api);
1476
1437
  return api;
1477
1438
  };
1478
- var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
1439
+ var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
1479
1440
 
1480
1441
  // ../../node_modules/zustand/esm/react.mjs
1481
1442
  init_react_import();
@@ -1484,8 +1445,8 @@ var identity = (arg) => arg;
1484
1445
  function useStore(api, selector = identity) {
1485
1446
  const slice = import_react4.default.useSyncExternalStore(
1486
1447
  api.subscribe,
1487
- () => selector(api.getState()),
1488
- () => selector(api.getInitialState())
1448
+ import_react4.default.useCallback(() => selector(api.getState()), [api, selector]),
1449
+ import_react4.default.useCallback(() => selector(api.getInitialState()), [api, selector])
1489
1450
  );
1490
1451
  import_react4.default.useDebugValue(slice);
1491
1452
  return slice;
@@ -1496,13 +1457,13 @@ var createImpl = (createState) => {
1496
1457
  Object.assign(useBoundStore, api);
1497
1458
  return useBoundStore;
1498
1459
  };
1499
- var create = (createState) => createState ? createImpl(createState) : createImpl;
1460
+ var create = ((createState) => createState ? createImpl(createState) : createImpl);
1500
1461
 
1501
1462
  // ../../node_modules/zustand/esm/middleware.mjs
1502
1463
  init_react_import();
1503
1464
  var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1504
1465
  const origSubscribe = api.subscribe;
1505
- api.subscribe = (selector, optListener, options) => {
1466
+ api.subscribe = ((selector, optListener, options) => {
1506
1467
  let listener = selector;
1507
1468
  if (optListener) {
1508
1469
  const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
@@ -1519,7 +1480,7 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1519
1480
  }
1520
1481
  }
1521
1482
  return origSubscribe(listener);
1522
- };
1483
+ });
1523
1484
  const initialState = fn(set, get, api);
1524
1485
  return initialState;
1525
1486
  };
@@ -1559,9 +1520,9 @@ function debounce(func, timeout = 300) {
1559
1520
  var tidyState = (state) => {
1560
1521
  return __spreadProps(__spreadValues({}, state), {
1561
1522
  ui: __spreadProps(__spreadValues({}, state.ui), {
1562
- field: {
1523
+ field: __spreadProps(__spreadValues({}, state.ui.field), {
1563
1524
  focus: null
1564
- }
1525
+ })
1565
1526
  })
1566
1527
  });
1567
1528
  };
@@ -1736,9 +1697,9 @@ function createIsCircular(areItemsEqual) {
1736
1697
  function getStrictProperties(object) {
1737
1698
  return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
1738
1699
  }
1739
- var hasOwn = Object.hasOwn || function(object, property) {
1700
+ var hasOwn = Object.hasOwn || (function(object, property) {
1740
1701
  return hasOwnProperty.call(object, property);
1741
- };
1702
+ });
1742
1703
  function sameValueZeroEqual(a, b) {
1743
1704
  return a === b || !a && !b && a !== a && b !== b;
1744
1705
  }
@@ -2128,29 +2089,37 @@ var getChanged = (newItem, oldItem) => {
2128
2089
 
2129
2090
  // ../core/store/slices/permissions.ts
2130
2091
  var createPermissionsSlice = (set, get) => {
2131
- const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
2092
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
2132
2093
  const { state, permissions, config } = get();
2133
2094
  const { cache: cache2, globalPermissions } = permissions;
2134
- const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
2135
- var _a, _b, _c;
2095
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
2096
+ var _a, _b;
2136
2097
  const { config: config2, state: appState, setComponentLoading } = get();
2098
+ const itemCache = cache2[item2.props.id];
2099
+ const nodes = appState.indexes.nodes;
2100
+ const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
2101
+ const parentNode = parentId ? nodes[parentId] : null;
2102
+ const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
2137
2103
  const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
2138
2104
  if (!componentConfig) {
2139
2105
  return;
2140
2106
  }
2141
2107
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
2142
2108
  if (componentConfig.resolvePermissions) {
2143
- const changed = getChanged(item2, (_a = cache2[item2.props.id]) == null ? void 0 : _a.lastData);
2144
- if (Object.values(changed).some((el) => el === true) || force2) {
2109
+ const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
2110
+ const propsChanged = Object.values(changed).some((el) => el === true);
2111
+ const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
2112
+ if (propsChanged || parentChanged || force2) {
2145
2113
  const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
2146
2114
  const resolvedPermissions = yield componentConfig.resolvePermissions(
2147
2115
  item2,
2148
2116
  {
2149
2117
  changed,
2150
- lastPermissions: ((_b = cache2[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
2118
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
2151
2119
  permissions: initialPermissions,
2152
2120
  appState: makeStatePublic(appState),
2153
- lastData: ((_c = cache2[item2.props.id]) == null ? void 0 : _c.lastData) || null
2121
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
2122
+ parent: parentData
2154
2123
  }
2155
2124
  );
2156
2125
  const latest = get().permissions;
@@ -2158,6 +2127,7 @@ var createPermissionsSlice = (set, get) => {
2158
2127
  permissions: __spreadProps(__spreadValues({}, latest), {
2159
2128
  cache: __spreadProps(__spreadValues({}, latest.cache), {
2160
2129
  [item2.props.id]: {
2130
+ lastParentId: parentId,
2161
2131
  lastData: item2,
2162
2132
  lastPermissions: resolvedPermissions
2163
2133
  }
@@ -2171,9 +2141,9 @@ var createPermissionsSlice = (set, get) => {
2171
2141
  }
2172
2142
  }
2173
2143
  });
2174
- const resolveDataForRoot = (force2 = false) => {
2144
+ const resolvePermissionsForRoot = (force2 = false) => {
2175
2145
  const { state: appState } = get();
2176
- resolveDataForItem(
2146
+ resolvePermissionsForItem(
2177
2147
  // Shim the root data in by conforming to component data shape
2178
2148
  {
2179
2149
  type: "root",
@@ -2184,16 +2154,16 @@ var createPermissionsSlice = (set, get) => {
2184
2154
  };
2185
2155
  const { item, type, root } = params;
2186
2156
  if (item) {
2187
- yield resolveDataForItem(item, force);
2157
+ yield resolvePermissionsForItem(item, force);
2188
2158
  } else if (type) {
2189
- flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
2190
- yield resolveDataForItem(item2, force);
2159
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
2160
+ yield resolvePermissionsForItem(item2, force);
2191
2161
  }));
2192
2162
  } else if (root) {
2193
- resolveDataForRoot(force);
2163
+ resolvePermissionsForRoot(force);
2194
2164
  } else {
2195
- flattenData(state, config).map((item2) => __async(void 0, null, function* () {
2196
- yield resolveDataForItem(item2, force);
2165
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
2166
+ yield resolvePermissionsForItem(item2, force);
2197
2167
  }));
2198
2168
  }
2199
2169
  });
@@ -2247,7 +2217,7 @@ var createFieldsSlice = (_set, _get) => {
2247
2217
  // ../core/lib/resolve-component-data.ts
2248
2218
  init_react_import();
2249
2219
  var cache = { lastChange: {} };
2250
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2220
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2251
2221
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
2252
2222
  const resolvedItem = __spreadValues({}, item);
2253
2223
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
@@ -2275,11 +2245,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
2275
2245
  let itemWithResolvedChildren = yield mapFields(
2276
2246
  resolvedItem,
2277
2247
  {
2278
- slot: (_02) => __async(void 0, [_02], function* ({ value }) {
2248
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
2279
2249
  const content = value;
2280
2250
  return yield Promise.all(
2281
2251
  content.map(
2282
- (childItem) => __async(void 0, null, function* () {
2252
+ (childItem) => __async(null, null, function* () {
2283
2253
  return (yield resolveComponentData(
2284
2254
  childItem,
2285
2255
  config,
@@ -2345,8 +2315,7 @@ var defaultAppState = {
2345
2315
  options: [],
2346
2316
  controlsVisible: true
2347
2317
  },
2348
- field: { focus: null },
2349
- plugin: { current: null }
2318
+ field: { focus: null }
2350
2319
  },
2351
2320
  indexes: {
2352
2321
  nodes: {},
@@ -2362,7 +2331,6 @@ var createAppStore = (initialAppStore) => create()(
2362
2331
  subscribeWithSelector((set, get) => {
2363
2332
  var _a, _b;
2364
2333
  return __spreadProps(__spreadValues({
2365
- instanceId: generateId(),
2366
2334
  state: defaultAppState,
2367
2335
  config: { components: {} },
2368
2336
  componentState: {},
@@ -2471,7 +2439,7 @@ var createAppStore = (initialAppStore) => create()(
2471
2439
  const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
2472
2440
  return __spreadProps(__spreadValues({}, s), { state, selectedItem });
2473
2441
  }),
2474
- resolveComponentData: (componentData, trigger) => __async(void 0, null, function* () {
2442
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
2475
2443
  const { config, metadata, setComponentLoading, permissions } = get();
2476
2444
  const timeouts = {};
2477
2445
  return yield resolveComponentData(
@@ -2482,7 +2450,7 @@ var createAppStore = (initialAppStore) => create()(
2482
2450
  const id = "id" in item.props ? item.props.id : "root";
2483
2451
  timeouts[id] = setComponentLoading(id, true, 50);
2484
2452
  },
2485
- (item) => __async(void 0, null, function* () {
2453
+ (item) => __async(null, null, function* () {
2486
2454
  const id = "id" in item.props ? item.props.id : "root";
2487
2455
  if ("type" in item) {
2488
2456
  yield permissions.refreshPermissions({ item });
@@ -2494,7 +2462,7 @@ var createAppStore = (initialAppStore) => create()(
2494
2462
  trigger
2495
2463
  );
2496
2464
  }),
2497
- resolveAndCommitData: () => __async(void 0, null, function* () {
2465
+ resolveAndCommitData: () => __async(null, null, function* () {
2498
2466
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
2499
2467
  walkAppState(
2500
2468
  state,
@@ -2533,14 +2501,203 @@ var createAppStore = (initialAppStore) => create()(
2533
2501
  })
2534
2502
  );
2535
2503
  var appStoreContext = (0, import_react9.createContext)(createAppStore());
2504
+ function useAppStore(selector) {
2505
+ const context = (0, import_react9.useContext)(appStoreContext);
2506
+ return useStore(context, selector);
2507
+ }
2508
+ function useAppStoreApi() {
2509
+ return (0, import_react9.useContext)(appStoreContext);
2510
+ }
2511
+
2512
+ // ../core/lib/use-breadcrumbs.ts
2513
+ var useBreadcrumbs = (renderCount) => {
2514
+ const selectedId = useAppStore((s) => {
2515
+ var _a;
2516
+ return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
2517
+ });
2518
+ const config = useAppStore((s) => s.config);
2519
+ const path = useAppStore((s) => {
2520
+ var _a;
2521
+ return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
2522
+ });
2523
+ const appStore = useAppStoreApi();
2524
+ return (0, import_react10.useMemo)(() => {
2525
+ const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
2526
+ var _a, _b, _c;
2527
+ const [componentId] = zoneCompound.split(":");
2528
+ if (componentId === "root") {
2529
+ return {
2530
+ label: "Page",
2531
+ selector: null
2532
+ };
2533
+ }
2534
+ const node = appStore.getState().state.indexes.nodes[componentId];
2535
+ const parentId = node.path[node.path.length - 1];
2536
+ const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
2537
+ const index = contentIds.indexOf(componentId);
2538
+ const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
2539
+ return {
2540
+ label,
2541
+ selector: node ? {
2542
+ index,
2543
+ zone: node.path[node.path.length - 1]
2544
+ } : null
2545
+ };
2546
+ })) || [];
2547
+ if (renderCount) {
2548
+ return breadcrumbs.slice(breadcrumbs.length - renderCount);
2549
+ }
2550
+ return breadcrumbs;
2551
+ }, [path, renderCount]);
2552
+ };
2553
+
2554
+ // ../core/components/Loader/index.tsx
2555
+ init_react_import();
2556
+
2557
+ // ../core/lib/index.ts
2558
+ init_react_import();
2559
+
2560
+ // ../core/lib/filter.ts
2561
+ init_react_import();
2562
+
2563
+ // ../core/lib/data/reorder.ts
2564
+ init_react_import();
2565
+
2566
+ // ../core/lib/data/replace.ts
2567
+ init_react_import();
2568
+
2569
+ // ../core/lib/use-reset-auto-zoom.ts
2570
+ init_react_import();
2536
2571
 
2537
2572
  // ../core/lib/get-zoom-config.ts
2538
2573
  init_react_import();
2539
2574
 
2575
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
2576
+ init_react_import();
2577
+ var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
2578
+
2579
+ // ../core/components/Loader/index.tsx
2580
+ var import_jsx_runtime2 = require("react/jsx-runtime");
2581
+ var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
2582
+ var Loader = (_a) => {
2583
+ var _b = _a, {
2584
+ color,
2585
+ size = 16
2586
+ } = _b, props = __objRest(_b, [
2587
+ "color",
2588
+ "size"
2589
+ ]);
2590
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2591
+ "span",
2592
+ __spreadValues({
2593
+ className: getClassName2(),
2594
+ style: {
2595
+ width: size,
2596
+ height: size,
2597
+ color
2598
+ },
2599
+ "aria-label": "loading"
2600
+ }, props)
2601
+ );
2602
+ };
2603
+
2604
+ // ../core/components/SidebarSection/index.tsx
2605
+ var import_jsx_runtime3 = require("react/jsx-runtime");
2606
+ var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
2607
+ var SidebarSection = ({
2608
+ children,
2609
+ title,
2610
+ background,
2611
+ showBreadcrumbs,
2612
+ noBorderTop,
2613
+ noPadding,
2614
+ isLoading
2615
+ }) => {
2616
+ const setUi = useAppStore((s) => s.setUi);
2617
+ const breadcrumbs = useBreadcrumbs(1);
2618
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2619
+ "div",
2620
+ {
2621
+ className: getClassName3({ noBorderTop, noPadding }),
2622
+ style: { background },
2623
+ children: [
2624
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
2625
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
2626
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2627
+ "button",
2628
+ {
2629
+ type: "button",
2630
+ className: getClassName3("breadcrumbLabel"),
2631
+ onClick: () => setUi({ itemSelector: breadcrumb.selector }),
2632
+ children: breadcrumb.label
2633
+ }
2634
+ ),
2635
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRight, { size: 16 })
2636
+ ] }, i)) : null,
2637
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
2638
+ ] }) }),
2639
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("content"), children }),
2640
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 32 }) })
2641
+ ]
2642
+ }
2643
+ );
2644
+ };
2645
+
2646
+ // ../core/components/OutlineList/index.tsx
2647
+ init_react_import();
2648
+
2649
+ // css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
2650
+ init_react_import();
2651
+ var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
2652
+
2653
+ // ../core/components/OutlineList/index.tsx
2654
+ var import_jsx_runtime4 = require("react/jsx-runtime");
2655
+ var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
2656
+ var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
2657
+ var OutlineList = ({ children }) => {
2658
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: getClassName4(), children });
2659
+ };
2660
+ OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
2661
+ OutlineList.Item = ({
2662
+ children,
2663
+ onClick
2664
+ }) => {
2665
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2666
+ "li",
2667
+ {
2668
+ className: getClassNameItem({ clickable: !!onClick }),
2669
+ onClick,
2670
+ children
2671
+ }
2672
+ );
2673
+ };
2674
+
2675
+ // ../core/lib/scroll-into-view.ts
2676
+ init_react_import();
2677
+ var scrollIntoView = (el) => {
2678
+ const oldStyle = __spreadValues({}, el.style);
2679
+ el.style.scrollMargin = "256px";
2680
+ if (el) {
2681
+ el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
2682
+ el.style.scrollMargin = oldStyle.scrollMargin || "";
2683
+ }
2684
+ };
2685
+
2686
+ // ../core/lib/get-frame.ts
2687
+ init_react_import();
2688
+ var getFrame = () => {
2689
+ if (typeof window === "undefined") return;
2690
+ let frameEl = document.querySelector("#preview-frame");
2691
+ if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
2692
+ return frameEl.contentDocument || document;
2693
+ }
2694
+ return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
2695
+ };
2696
+
2540
2697
  // src/HeadingAnalyzer.tsx
2541
2698
  var import_react_from_json = __toESM(require("react-from-json"));
2542
- var import_jsx_runtime2 = require("react/jsx-runtime");
2543
- var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2699
+ var import_jsx_runtime5 = require("react/jsx-runtime");
2700
+ var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2544
2701
  var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
2545
2702
  var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
2546
2703
  var getOutline = ({ frame } = {}) => {
@@ -2595,8 +2752,8 @@ function buildHierarchy(frame) {
2595
2752
  var usePuck = (0, import_puck.createUsePuck)();
2596
2753
  var HeadingAnalyzer = () => {
2597
2754
  const data = usePuck((s) => s.appState.data);
2598
- const [hierarchy, setHierarchy] = (0, import_react10.useState)([]);
2599
- (0, import_react10.useEffect)(() => {
2755
+ const [hierarchy, setHierarchy] = (0, import_react11.useState)([]);
2756
+ (0, import_react11.useEffect)(() => {
2600
2757
  const frame = getFrame();
2601
2758
  let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
2602
2759
  const createHierarchy = () => {
@@ -2631,11 +2788,11 @@ var HeadingAnalyzer = () => {
2631
2788
  frameObserver.disconnect();
2632
2789
  };
2633
2790
  }, [data]);
2634
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: getClassName2(), children: [
2635
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2791
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
2792
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2636
2793
  "small",
2637
2794
  {
2638
- className: getClassName2("cssWarning"),
2795
+ className: getClassName5("cssWarning"),
2639
2796
  style: {
2640
2797
  color: "var(--puck-color-red-04)",
2641
2798
  display: "block",
@@ -2644,19 +2801,19 @@ var HeadingAnalyzer = () => {
2644
2801
  children: [
2645
2802
  "Heading analyzer styles not loaded. Please review the",
2646
2803
  " ",
2647
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2804
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2648
2805
  "."
2649
2806
  ]
2650
2807
  }
2651
2808
  ),
2652
- hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: "No headings." }),
2653
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2809
+ hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: "No headings." }),
2810
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2654
2811
  ReactFromJSON,
2655
2812
  {
2656
2813
  mapping: {
2657
- Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: props.children }),
2658
- OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(OutlineList.Item, { children: [
2659
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2814
+ Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: props.children }),
2815
+ OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(OutlineList.Item, { children: [
2816
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2660
2817
  "small",
2661
2818
  {
2662
2819
  className: getClassNameItem2({ missing: props.missing }),
@@ -2674,14 +2831,14 @@ var HeadingAnalyzer = () => {
2674
2831
  }, 2e3);
2675
2832
  }
2676
2833
  },
2677
- children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
2678
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
2834
+ children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2835
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
2679
2836
  "H",
2680
2837
  props.rank
2681
2838
  ] }),
2682
2839
  ": Missing"
2683
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
2684
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
2840
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2841
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
2685
2842
  "H",
2686
2843
  props.rank
2687
2844
  ] }),
@@ -2690,7 +2847,7 @@ var HeadingAnalyzer = () => {
2690
2847
  ] })
2691
2848
  }
2692
2849
  ) }),
2693
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: props.children })
2850
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: props.children })
2694
2851
  ] })
2695
2852
  },
2696
2853
  entry: {
@@ -2711,10 +2868,12 @@ var HeadingAnalyzer = () => {
2711
2868
  ] });
2712
2869
  };
2713
2870
  var headingAnalyzer = {
2714
- name: "heading-analyzer",
2715
- label: "Audit",
2716
- render: HeadingAnalyzer,
2717
- icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Heading1, {})
2871
+ overrides: {
2872
+ fields: ({ children, itemSelector }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2873
+ children,
2874
+ /* @__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, {}) }) })
2875
+ ] })
2876
+ }
2718
2877
  };
2719
2878
  var HeadingAnalyzer_default = headingAnalyzer;
2720
2879
  /*! Bundled license information:
@@ -2727,45 +2886,10 @@ classnames/index.js:
2727
2886
  *)
2728
2887
 
2729
2888
  lucide-react/dist/esm/shared/src/utils.js:
2730
- (**
2731
- * @license lucide-react v0.468.0 - ISC
2732
- *
2733
- * This source code is licensed under the ISC license.
2734
- * See the LICENSE file in the root directory of this source tree.
2735
- *)
2736
-
2737
2889
  lucide-react/dist/esm/defaultAttributes.js:
2738
- (**
2739
- * @license lucide-react v0.468.0 - ISC
2740
- *
2741
- * This source code is licensed under the ISC license.
2742
- * See the LICENSE file in the root directory of this source tree.
2743
- *)
2744
-
2745
2890
  lucide-react/dist/esm/Icon.js:
2746
- (**
2747
- * @license lucide-react v0.468.0 - ISC
2748
- *
2749
- * This source code is licensed under the ISC license.
2750
- * See the LICENSE file in the root directory of this source tree.
2751
- *)
2752
-
2753
2891
  lucide-react/dist/esm/createLucideIcon.js:
2754
- (**
2755
- * @license lucide-react v0.468.0 - ISC
2756
- *
2757
- * This source code is licensed under the ISC license.
2758
- * See the LICENSE file in the root directory of this source tree.
2759
- *)
2760
-
2761
- lucide-react/dist/esm/icons/heading-1.js:
2762
- (**
2763
- * @license lucide-react v0.468.0 - ISC
2764
- *
2765
- * This source code is licensed under the ISC license.
2766
- * See the LICENSE file in the root directory of this source tree.
2767
- *)
2768
-
2892
+ lucide-react/dist/esm/icons/chevron-right.js:
2769
2893
  lucide-react/dist/esm/lucide-react.js:
2770
2894
  (**
2771
2895
  * @license lucide-react v0.468.0 - ISC