@measured/puck-plugin-heading-analyzer 0.21.0-canary.8db6528d → 0.21.0-canary.a1b03d38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -269,17 +269,17 @@ import { useEffect as useEffect5, useState } from "react";
269
269
 
270
270
  // css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
271
271
  init_react_import();
272
- var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_yg0s7_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_yg0s7_6", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_yg0s7_10", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_yg0s7_14" };
272
+ var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_116v6_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_116v6_5", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_116v6_9", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_116v6_13" };
273
273
 
274
274
  // src/HeadingAnalyzer.tsx
275
275
  import { createUsePuck } from "@measured/puck";
276
276
 
277
- // ../core/components/OutlineList/index.tsx
277
+ // ../core/components/SidebarSection/index.tsx
278
278
  init_react_import();
279
279
 
280
- // css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
280
+ // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
281
281
  init_react_import();
282
- var styles_module_default = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
282
+ 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" };
283
283
 
284
284
  // ../core/lib/get-class-name-factory.ts
285
285
  init_react_import();
@@ -308,50 +308,29 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
308
308
  };
309
309
  var get_class_name_factory_default = getClassNameFactory;
310
310
 
311
- // ../core/components/OutlineList/index.tsx
311
+ // ../core/components/Heading/index.tsx
312
+ init_react_import();
313
+
314
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
315
+ init_react_import();
316
+ 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" };
317
+
318
+ // ../core/components/Heading/index.tsx
312
319
  import { jsx } from "react/jsx-runtime";
313
- var getClassName = get_class_name_factory_default("OutlineList", styles_module_default);
314
- var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default);
315
- var OutlineList = ({ children }) => {
316
- return /* @__PURE__ */ jsx("ul", { className: getClassName(), children });
317
- };
318
- OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx("div", { className: getClassNameItem({ clickable: true }), children });
319
- OutlineList.Item = ({
320
- children,
321
- onClick
322
- }) => {
320
+ var getClassName = get_class_name_factory_default("Heading", styles_module_default2);
321
+ var Heading = ({ children, rank, size = "m" }) => {
322
+ const Tag = rank ? `h${rank}` : "span";
323
323
  return /* @__PURE__ */ jsx(
324
- "li",
324
+ Tag,
325
325
  {
326
- className: getClassNameItem({ clickable: !!onClick }),
327
- onClick,
326
+ className: getClassName({
327
+ [size]: true
328
+ }),
328
329
  children
329
330
  }
330
331
  );
331
332
  };
332
333
 
333
- // ../core/lib/scroll-into-view.ts
334
- init_react_import();
335
- var scrollIntoView = (el) => {
336
- const oldStyle = __spreadValues({}, el.style);
337
- el.style.scrollMargin = "256px";
338
- if (el) {
339
- el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
340
- el.style.scrollMargin = oldStyle.scrollMargin || "";
341
- }
342
- };
343
-
344
- // ../core/lib/get-frame.ts
345
- init_react_import();
346
- var getFrame = () => {
347
- if (typeof window === "undefined") return;
348
- let frameEl = document.querySelector("#preview-frame");
349
- if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
350
- return frameEl.contentDocument || document;
351
- }
352
- return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
353
- };
354
-
355
334
  // ../../node_modules/lucide-react/dist/esm/lucide-react.js
356
335
  init_react_import();
357
336
 
@@ -439,29 +418,15 @@ var createLucideIcon = (iconName, iconNode) => {
439
418
  return Component;
440
419
  };
441
420
 
442
- // ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
421
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
443
422
  init_react_import();
444
- var Heading1 = createLucideIcon("Heading1", [
445
- ["path", { d: "M4 12h8", key: "17cfdx" }],
446
- ["path", { d: "M4 18V6", key: "1rz3zl" }],
447
- ["path", { d: "M12 18V6", key: "zqpxq5" }],
448
- ["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
423
+ var ChevronRight = createLucideIcon("ChevronRight", [
424
+ ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
449
425
  ]);
450
426
 
451
- // ../core/lib/index.ts
452
- init_react_import();
453
-
454
- // ../core/lib/filter.ts
455
- init_react_import();
456
-
457
- // ../core/lib/data/reorder.ts
458
- init_react_import();
459
-
460
- // ../core/lib/data/replace.ts
461
- init_react_import();
462
-
463
- // ../core/lib/use-reset-auto-zoom.ts
427
+ // ../core/lib/use-breadcrumbs.ts
464
428
  init_react_import();
429
+ import { useMemo } from "react";
465
430
 
466
431
  // ../core/store/index.ts
467
432
  init_react_import();
@@ -532,32 +497,27 @@ var walkField = ({
532
497
  config,
533
498
  recurseSlots = false
534
499
  }) => {
535
- var _a, _b, _c, _d;
500
+ var _a, _b, _c;
536
501
  const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
537
502
  const map = mappers[fieldType];
538
503
  if (map && fieldType === "slot") {
539
504
  const content = value || [];
540
- let mappedContent = content;
541
- if (recurseSlots) {
542
- for (let i = 0; i < content.length; i++) {
543
- const el = content[i];
544
- const componentConfig = config.components[el.type];
545
- if (!componentConfig || !el.props) {
546
- continue;
547
- }
548
- const fields2 = (_b = componentConfig.fields) != null ? _b : {};
549
- mappedContent.push(
550
- walkField({
551
- value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
552
- fields: fields2,
553
- mappers,
554
- id: el.props.id,
555
- config,
556
- recurseSlots
557
- })
558
- );
505
+ const mappedContent = recurseSlots ? content.map((el) => {
506
+ var _a2;
507
+ const componentConfig = config.components[el.type];
508
+ if (!componentConfig) {
509
+ throw new Error(`Could not find component config for ${el.type}`);
559
510
  }
560
- }
511
+ const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
512
+ return walkField({
513
+ value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
514
+ fields: fields2,
515
+ mappers,
516
+ id: el.props.id,
517
+ config,
518
+ recurseSlots
519
+ });
520
+ }) : content;
561
521
  if (containsPromise(mappedContent)) {
562
522
  return Promise.all(mappedContent);
563
523
  }
@@ -579,7 +539,7 @@ var walkField = ({
579
539
  }
580
540
  if (value && typeof value === "object") {
581
541
  if (Array.isArray(value)) {
582
- const arrayFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "array" ? fields[propKey].arrayFields : null;
542
+ const arrayFields = ((_b = fields[propKey]) == null ? void 0 : _b.type) === "array" ? fields[propKey].arrayFields : null;
583
543
  if (!arrayFields) return value;
584
544
  const newValue = value.map(
585
545
  (el, idx) => walkField({
@@ -600,7 +560,7 @@ var walkField = ({
600
560
  } else if ("$$typeof" in value) {
601
561
  return value;
602
562
  } else {
603
- const objectFields = ((_d = fields[propKey]) == null ? void 0 : _d.type) === "object" ? fields[propKey].objectFields : fields;
563
+ const objectFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "object" ? fields[propKey].objectFields : fields;
604
564
  return walkObject({
605
565
  value,
606
566
  fields: objectFields,
@@ -846,10 +806,10 @@ var insert = (list, index, item) => {
846
806
  // ../core/lib/generate-id.ts
847
807
  init_react_import();
848
808
 
849
- // ../../node_modules/uuid/dist/esm-node/index.js
809
+ // ../core/node_modules/uuid/dist/esm-node/index.js
850
810
  init_react_import();
851
811
 
852
- // ../../node_modules/uuid/dist/esm-node/rng.js
812
+ // ../core/node_modules/uuid/dist/esm-node/rng.js
853
813
  init_react_import();
854
814
  import crypto from "crypto";
855
815
  var rnds8Pool = new Uint8Array(256);
@@ -862,7 +822,7 @@ function rng() {
862
822
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
863
823
  }
864
824
 
865
- // ../../node_modules/uuid/dist/esm-node/stringify.js
825
+ // ../core/node_modules/uuid/dist/esm-node/stringify.js
866
826
  init_react_import();
867
827
  var byteToHex = [];
868
828
  for (let i = 0; i < 256; ++i) {
@@ -872,17 +832,17 @@ function unsafeStringify(arr, offset = 0) {
872
832
  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]];
873
833
  }
874
834
 
875
- // ../../node_modules/uuid/dist/esm-node/v4.js
835
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
876
836
  init_react_import();
877
837
 
878
- // ../../node_modules/uuid/dist/esm-node/native.js
838
+ // ../core/node_modules/uuid/dist/esm-node/native.js
879
839
  init_react_import();
880
840
  import crypto2 from "crypto";
881
841
  var native_default = {
882
842
  randomUUID: crypto2.randomUUID
883
843
  };
884
844
 
885
- // ../../node_modules/uuid/dist/esm-node/v4.js
845
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
886
846
  function v4(options, buf, offset) {
887
847
  if (native_default.randomUUID && !buf && !options) {
888
848
  return native_default.randomUUID();
@@ -1034,7 +994,9 @@ var replaceAction = (state, action, appStore) => {
1034
994
  });
1035
995
  });
1036
996
  });
1037
- const stateWithDeepSlotsRemoved = __spreadValues({}, state);
997
+ const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
998
+ ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
999
+ });
1038
1000
  Object.keys(state.indexes.zones).forEach((zoneCompound) => {
1039
1001
  const id = zoneCompound.split(":")[0];
1040
1002
  if (id === originalId) {
@@ -1436,8 +1398,7 @@ init_react_import();
1436
1398
  var defaultViewports = [
1437
1399
  { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1438
1400
  { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1439
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" },
1440
- { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
1401
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1441
1402
  ];
1442
1403
 
1443
1404
  // ../../node_modules/zustand/esm/vanilla.mjs
@@ -1463,7 +1424,7 @@ var createStoreImpl = (createState) => {
1463
1424
  const initialState = state = createState(setState, getState, api);
1464
1425
  return api;
1465
1426
  };
1466
- var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
1427
+ var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
1467
1428
 
1468
1429
  // ../../node_modules/zustand/esm/react.mjs
1469
1430
  init_react_import();
@@ -1472,8 +1433,8 @@ var identity = (arg) => arg;
1472
1433
  function useStore(api, selector = identity) {
1473
1434
  const slice = React2.useSyncExternalStore(
1474
1435
  api.subscribe,
1475
- () => selector(api.getState()),
1476
- () => selector(api.getInitialState())
1436
+ React2.useCallback(() => selector(api.getState()), [api, selector]),
1437
+ React2.useCallback(() => selector(api.getInitialState()), [api, selector])
1477
1438
  );
1478
1439
  React2.useDebugValue(slice);
1479
1440
  return slice;
@@ -1484,13 +1445,13 @@ var createImpl = (createState) => {
1484
1445
  Object.assign(useBoundStore, api);
1485
1446
  return useBoundStore;
1486
1447
  };
1487
- var create = (createState) => createState ? createImpl(createState) : createImpl;
1448
+ var create = ((createState) => createState ? createImpl(createState) : createImpl);
1488
1449
 
1489
1450
  // ../../node_modules/zustand/esm/middleware.mjs
1490
1451
  init_react_import();
1491
1452
  var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1492
1453
  const origSubscribe = api.subscribe;
1493
- api.subscribe = (selector, optListener, options) => {
1454
+ api.subscribe = ((selector, optListener, options) => {
1494
1455
  let listener = selector;
1495
1456
  if (optListener) {
1496
1457
  const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
@@ -1507,7 +1468,7 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1507
1468
  }
1508
1469
  }
1509
1470
  return origSubscribe(listener);
1510
- };
1471
+ });
1511
1472
  const initialState = fn(set, get, api);
1512
1473
  return initialState;
1513
1474
  };
@@ -1547,9 +1508,9 @@ function debounce(func, timeout = 300) {
1547
1508
  var tidyState = (state) => {
1548
1509
  return __spreadProps(__spreadValues({}, state), {
1549
1510
  ui: __spreadProps(__spreadValues({}, state.ui), {
1550
- field: {
1511
+ field: __spreadProps(__spreadValues({}, state.ui.field), {
1551
1512
  focus: null
1552
- }
1513
+ })
1553
1514
  })
1554
1515
  });
1555
1516
  };
@@ -1724,9 +1685,9 @@ function createIsCircular(areItemsEqual) {
1724
1685
  function getStrictProperties(object) {
1725
1686
  return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
1726
1687
  }
1727
- var hasOwn = Object.hasOwn || function(object, property) {
1688
+ var hasOwn = Object.hasOwn || (function(object, property) {
1728
1689
  return hasOwnProperty.call(object, property);
1729
- };
1690
+ });
1730
1691
  function sameValueZeroEqual(a, b) {
1731
1692
  return a === b || !a && !b && a !== a && b !== b;
1732
1693
  }
@@ -2116,29 +2077,37 @@ var getChanged = (newItem, oldItem) => {
2116
2077
 
2117
2078
  // ../core/store/slices/permissions.ts
2118
2079
  var createPermissionsSlice = (set, get) => {
2119
- const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
2080
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
2120
2081
  const { state, permissions, config } = get();
2121
2082
  const { cache: cache2, globalPermissions } = permissions;
2122
- const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
2123
- var _a, _b, _c;
2083
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
2084
+ var _a, _b;
2124
2085
  const { config: config2, state: appState, setComponentLoading } = get();
2086
+ const itemCache = cache2[item2.props.id];
2087
+ const nodes = appState.indexes.nodes;
2088
+ const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
2089
+ const parentNode = parentId ? nodes[parentId] : null;
2090
+ const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
2125
2091
  const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
2126
2092
  if (!componentConfig) {
2127
2093
  return;
2128
2094
  }
2129
2095
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
2130
2096
  if (componentConfig.resolvePermissions) {
2131
- const changed = getChanged(item2, (_a = cache2[item2.props.id]) == null ? void 0 : _a.lastData);
2132
- if (Object.values(changed).some((el) => el === true) || force2) {
2097
+ const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
2098
+ const propsChanged = Object.values(changed).some((el) => el === true);
2099
+ const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
2100
+ if (propsChanged || parentChanged || force2) {
2133
2101
  const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
2134
2102
  const resolvedPermissions = yield componentConfig.resolvePermissions(
2135
2103
  item2,
2136
2104
  {
2137
2105
  changed,
2138
- lastPermissions: ((_b = cache2[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
2106
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
2139
2107
  permissions: initialPermissions,
2140
2108
  appState: makeStatePublic(appState),
2141
- lastData: ((_c = cache2[item2.props.id]) == null ? void 0 : _c.lastData) || null
2109
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
2110
+ parent: parentData
2142
2111
  }
2143
2112
  );
2144
2113
  const latest = get().permissions;
@@ -2146,6 +2115,7 @@ var createPermissionsSlice = (set, get) => {
2146
2115
  permissions: __spreadProps(__spreadValues({}, latest), {
2147
2116
  cache: __spreadProps(__spreadValues({}, latest.cache), {
2148
2117
  [item2.props.id]: {
2118
+ lastParentId: parentId,
2149
2119
  lastData: item2,
2150
2120
  lastPermissions: resolvedPermissions
2151
2121
  }
@@ -2159,9 +2129,9 @@ var createPermissionsSlice = (set, get) => {
2159
2129
  }
2160
2130
  }
2161
2131
  });
2162
- const resolveDataForRoot = (force2 = false) => {
2132
+ const resolvePermissionsForRoot = (force2 = false) => {
2163
2133
  const { state: appState } = get();
2164
- resolveDataForItem(
2134
+ resolvePermissionsForItem(
2165
2135
  // Shim the root data in by conforming to component data shape
2166
2136
  {
2167
2137
  type: "root",
@@ -2172,16 +2142,16 @@ var createPermissionsSlice = (set, get) => {
2172
2142
  };
2173
2143
  const { item, type, root } = params;
2174
2144
  if (item) {
2175
- yield resolveDataForItem(item, force);
2145
+ yield resolvePermissionsForItem(item, force);
2176
2146
  } else if (type) {
2177
- flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
2178
- yield resolveDataForItem(item2, force);
2147
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
2148
+ yield resolvePermissionsForItem(item2, force);
2179
2149
  }));
2180
2150
  } else if (root) {
2181
- resolveDataForRoot(force);
2151
+ resolvePermissionsForRoot(force);
2182
2152
  } else {
2183
- flattenData(state, config).map((item2) => __async(void 0, null, function* () {
2184
- yield resolveDataForItem(item2, force);
2153
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
2154
+ yield resolvePermissionsForItem(item2, force);
2185
2155
  }));
2186
2156
  }
2187
2157
  });
@@ -2235,7 +2205,7 @@ var createFieldsSlice = (_set, _get) => {
2235
2205
  // ../core/lib/resolve-component-data.ts
2236
2206
  init_react_import();
2237
2207
  var cache = { lastChange: {} };
2238
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2208
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2239
2209
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
2240
2210
  const resolvedItem = __spreadValues({}, item);
2241
2211
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
@@ -2263,11 +2233,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
2263
2233
  let itemWithResolvedChildren = yield mapFields(
2264
2234
  resolvedItem,
2265
2235
  {
2266
- slot: (_02) => __async(void 0, [_02], function* ({ value }) {
2236
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
2267
2237
  const content = value;
2268
2238
  return yield Promise.all(
2269
2239
  content.map(
2270
- (childItem) => __async(void 0, null, function* () {
2240
+ (childItem) => __async(null, null, function* () {
2271
2241
  return (yield resolveComponentData(
2272
2242
  childItem,
2273
2243
  config,
@@ -2333,8 +2303,7 @@ var defaultAppState = {
2333
2303
  options: [],
2334
2304
  controlsVisible: true
2335
2305
  },
2336
- field: { focus: null },
2337
- plugin: { current: null }
2306
+ field: { focus: null }
2338
2307
  },
2339
2308
  indexes: {
2340
2309
  nodes: {},
@@ -2350,7 +2319,6 @@ var createAppStore = (initialAppStore) => create()(
2350
2319
  subscribeWithSelector((set, get) => {
2351
2320
  var _a, _b;
2352
2321
  return __spreadProps(__spreadValues({
2353
- instanceId: generateId(),
2354
2322
  state: defaultAppState,
2355
2323
  config: { components: {} },
2356
2324
  componentState: {},
@@ -2459,7 +2427,7 @@ var createAppStore = (initialAppStore) => create()(
2459
2427
  const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
2460
2428
  return __spreadProps(__spreadValues({}, s), { state, selectedItem });
2461
2429
  }),
2462
- resolveComponentData: (componentData, trigger) => __async(void 0, null, function* () {
2430
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
2463
2431
  const { config, metadata, setComponentLoading, permissions } = get();
2464
2432
  const timeouts = {};
2465
2433
  return yield resolveComponentData(
@@ -2470,7 +2438,7 @@ var createAppStore = (initialAppStore) => create()(
2470
2438
  const id = "id" in item.props ? item.props.id : "root";
2471
2439
  timeouts[id] = setComponentLoading(id, true, 50);
2472
2440
  },
2473
- (item) => __async(void 0, null, function* () {
2441
+ (item) => __async(null, null, function* () {
2474
2442
  const id = "id" in item.props ? item.props.id : "root";
2475
2443
  if ("type" in item) {
2476
2444
  yield permissions.refreshPermissions({ item });
@@ -2482,7 +2450,7 @@ var createAppStore = (initialAppStore) => create()(
2482
2450
  trigger
2483
2451
  );
2484
2452
  }),
2485
- resolveAndCommitData: () => __async(void 0, null, function* () {
2453
+ resolveAndCommitData: () => __async(null, null, function* () {
2486
2454
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
2487
2455
  walkAppState(
2488
2456
  state,
@@ -2521,14 +2489,203 @@ var createAppStore = (initialAppStore) => create()(
2521
2489
  })
2522
2490
  );
2523
2491
  var appStoreContext = createContext(createAppStore());
2492
+ function useAppStore(selector) {
2493
+ const context = useContext(appStoreContext);
2494
+ return useStore(context, selector);
2495
+ }
2496
+ function useAppStoreApi() {
2497
+ return useContext(appStoreContext);
2498
+ }
2499
+
2500
+ // ../core/lib/use-breadcrumbs.ts
2501
+ var useBreadcrumbs = (renderCount) => {
2502
+ const selectedId = useAppStore((s) => {
2503
+ var _a;
2504
+ return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
2505
+ });
2506
+ const config = useAppStore((s) => s.config);
2507
+ const path = useAppStore((s) => {
2508
+ var _a;
2509
+ return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
2510
+ });
2511
+ const appStore = useAppStoreApi();
2512
+ return useMemo(() => {
2513
+ const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
2514
+ var _a, _b, _c;
2515
+ const [componentId] = zoneCompound.split(":");
2516
+ if (componentId === "root") {
2517
+ return {
2518
+ label: "Page",
2519
+ selector: null
2520
+ };
2521
+ }
2522
+ const node = appStore.getState().state.indexes.nodes[componentId];
2523
+ const parentId = node.path[node.path.length - 1];
2524
+ const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
2525
+ const index = contentIds.indexOf(componentId);
2526
+ const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
2527
+ return {
2528
+ label,
2529
+ selector: node ? {
2530
+ index,
2531
+ zone: node.path[node.path.length - 1]
2532
+ } : null
2533
+ };
2534
+ })) || [];
2535
+ if (renderCount) {
2536
+ return breadcrumbs.slice(breadcrumbs.length - renderCount);
2537
+ }
2538
+ return breadcrumbs;
2539
+ }, [path, renderCount]);
2540
+ };
2541
+
2542
+ // ../core/components/Loader/index.tsx
2543
+ init_react_import();
2544
+
2545
+ // ../core/lib/index.ts
2546
+ init_react_import();
2547
+
2548
+ // ../core/lib/filter.ts
2549
+ init_react_import();
2550
+
2551
+ // ../core/lib/data/reorder.ts
2552
+ init_react_import();
2553
+
2554
+ // ../core/lib/data/replace.ts
2555
+ init_react_import();
2556
+
2557
+ // ../core/lib/use-reset-auto-zoom.ts
2558
+ init_react_import();
2524
2559
 
2525
2560
  // ../core/lib/get-zoom-config.ts
2526
2561
  init_react_import();
2527
2562
 
2563
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
2564
+ init_react_import();
2565
+ var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
2566
+
2567
+ // ../core/components/Loader/index.tsx
2568
+ import { jsx as jsx2 } from "react/jsx-runtime";
2569
+ var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
2570
+ var Loader = (_a) => {
2571
+ var _b = _a, {
2572
+ color,
2573
+ size = 16
2574
+ } = _b, props = __objRest(_b, [
2575
+ "color",
2576
+ "size"
2577
+ ]);
2578
+ return /* @__PURE__ */ jsx2(
2579
+ "span",
2580
+ __spreadValues({
2581
+ className: getClassName2(),
2582
+ style: {
2583
+ width: size,
2584
+ height: size,
2585
+ color
2586
+ },
2587
+ "aria-label": "loading"
2588
+ }, props)
2589
+ );
2590
+ };
2591
+
2592
+ // ../core/components/SidebarSection/index.tsx
2593
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
2594
+ var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
2595
+ var SidebarSection = ({
2596
+ children,
2597
+ title,
2598
+ background,
2599
+ showBreadcrumbs,
2600
+ noBorderTop,
2601
+ noPadding,
2602
+ isLoading
2603
+ }) => {
2604
+ const setUi = useAppStore((s) => s.setUi);
2605
+ const breadcrumbs = useBreadcrumbs(1);
2606
+ return /* @__PURE__ */ jsxs(
2607
+ "div",
2608
+ {
2609
+ className: getClassName3({ noBorderTop, noPadding }),
2610
+ style: { background },
2611
+ children: [
2612
+ /* @__PURE__ */ jsx3("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
2613
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumb"), children: [
2614
+ /* @__PURE__ */ jsx3(
2615
+ "button",
2616
+ {
2617
+ type: "button",
2618
+ className: getClassName3("breadcrumbLabel"),
2619
+ onClick: () => setUi({ itemSelector: breadcrumb.selector }),
2620
+ children: breadcrumb.label
2621
+ }
2622
+ ),
2623
+ /* @__PURE__ */ jsx3(ChevronRight, { size: 16 })
2624
+ ] }, i)) : null,
2625
+ /* @__PURE__ */ jsx3("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx3(Heading, { rank: "2", size: "xs", children: title }) })
2626
+ ] }) }),
2627
+ /* @__PURE__ */ jsx3("div", { className: getClassName3("content"), children }),
2628
+ isLoading && /* @__PURE__ */ jsx3("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx3(Loader, { size: 32 }) })
2629
+ ]
2630
+ }
2631
+ );
2632
+ };
2633
+
2634
+ // ../core/components/OutlineList/index.tsx
2635
+ init_react_import();
2636
+
2637
+ // css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
2638
+ init_react_import();
2639
+ var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
2640
+
2641
+ // ../core/components/OutlineList/index.tsx
2642
+ import { jsx as jsx4 } from "react/jsx-runtime";
2643
+ var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
2644
+ var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
2645
+ var OutlineList = ({ children }) => {
2646
+ return /* @__PURE__ */ jsx4("ul", { className: getClassName4(), children });
2647
+ };
2648
+ OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx4("div", { className: getClassNameItem({ clickable: true }), children });
2649
+ OutlineList.Item = ({
2650
+ children,
2651
+ onClick
2652
+ }) => {
2653
+ return /* @__PURE__ */ jsx4(
2654
+ "li",
2655
+ {
2656
+ className: getClassNameItem({ clickable: !!onClick }),
2657
+ onClick,
2658
+ children
2659
+ }
2660
+ );
2661
+ };
2662
+
2663
+ // ../core/lib/scroll-into-view.ts
2664
+ init_react_import();
2665
+ var scrollIntoView = (el) => {
2666
+ const oldStyle = __spreadValues({}, el.style);
2667
+ el.style.scrollMargin = "256px";
2668
+ if (el) {
2669
+ el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
2670
+ el.style.scrollMargin = oldStyle.scrollMargin || "";
2671
+ }
2672
+ };
2673
+
2674
+ // ../core/lib/get-frame.ts
2675
+ init_react_import();
2676
+ var getFrame = () => {
2677
+ if (typeof window === "undefined") return;
2678
+ let frameEl = document.querySelector("#preview-frame");
2679
+ if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
2680
+ return frameEl.contentDocument || document;
2681
+ }
2682
+ return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
2683
+ };
2684
+
2528
2685
  // src/HeadingAnalyzer.tsx
2529
2686
  import ReactFromJSONModule from "react-from-json";
2530
- import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
2531
- var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2687
+ import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
2688
+ var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2532
2689
  var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
2533
2690
  var ReactFromJSON = ReactFromJSONModule.default || ReactFromJSONModule;
2534
2691
  var getOutline = ({ frame } = {}) => {
@@ -2619,11 +2776,11 @@ var HeadingAnalyzer = () => {
2619
2776
  frameObserver.disconnect();
2620
2777
  };
2621
2778
  }, [data]);
2622
- return /* @__PURE__ */ jsxs("div", { className: getClassName2(), children: [
2623
- /* @__PURE__ */ jsxs(
2779
+ return /* @__PURE__ */ jsxs2("div", { className: getClassName5(), children: [
2780
+ /* @__PURE__ */ jsxs2(
2624
2781
  "small",
2625
2782
  {
2626
- className: getClassName2("cssWarning"),
2783
+ className: getClassName5("cssWarning"),
2627
2784
  style: {
2628
2785
  color: "var(--puck-color-red-04)",
2629
2786
  display: "block",
@@ -2632,19 +2789,19 @@ var HeadingAnalyzer = () => {
2632
2789
  children: [
2633
2790
  "Heading analyzer styles not loaded. Please review the",
2634
2791
  " ",
2635
- /* @__PURE__ */ jsx2("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2792
+ /* @__PURE__ */ jsx5("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2636
2793
  "."
2637
2794
  ]
2638
2795
  }
2639
2796
  ),
2640
- hierarchy.length === 0 && /* @__PURE__ */ jsx2("div", { children: "No headings." }),
2641
- /* @__PURE__ */ jsx2(OutlineList, { children: /* @__PURE__ */ jsx2(
2797
+ hierarchy.length === 0 && /* @__PURE__ */ jsx5("div", { children: "No headings." }),
2798
+ /* @__PURE__ */ jsx5(OutlineList, { children: /* @__PURE__ */ jsx5(
2642
2799
  ReactFromJSON,
2643
2800
  {
2644
2801
  mapping: {
2645
- Root: (props) => /* @__PURE__ */ jsx2(Fragment, { children: props.children }),
2646
- OutlineListItem: (props) => /* @__PURE__ */ jsxs(OutlineList.Item, { children: [
2647
- /* @__PURE__ */ jsx2(OutlineList.Clickable, { children: /* @__PURE__ */ jsx2(
2802
+ Root: (props) => /* @__PURE__ */ jsx5(Fragment, { children: props.children }),
2803
+ OutlineListItem: (props) => /* @__PURE__ */ jsxs2(OutlineList.Item, { children: [
2804
+ /* @__PURE__ */ jsx5(OutlineList.Clickable, { children: /* @__PURE__ */ jsx5(
2648
2805
  "small",
2649
2806
  {
2650
2807
  className: getClassNameItem2({ missing: props.missing }),
@@ -2662,14 +2819,14 @@ var HeadingAnalyzer = () => {
2662
2819
  }, 2e3);
2663
2820
  }
2664
2821
  },
2665
- children: props.missing ? /* @__PURE__ */ jsxs(Fragment, { children: [
2666
- /* @__PURE__ */ jsxs("b", { children: [
2822
+ children: props.missing ? /* @__PURE__ */ jsxs2(Fragment, { children: [
2823
+ /* @__PURE__ */ jsxs2("b", { children: [
2667
2824
  "H",
2668
2825
  props.rank
2669
2826
  ] }),
2670
2827
  ": Missing"
2671
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2672
- /* @__PURE__ */ jsxs("b", { children: [
2828
+ ] }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
2829
+ /* @__PURE__ */ jsxs2("b", { children: [
2673
2830
  "H",
2674
2831
  props.rank
2675
2832
  ] }),
@@ -2678,7 +2835,7 @@ var HeadingAnalyzer = () => {
2678
2835
  ] })
2679
2836
  }
2680
2837
  ) }),
2681
- /* @__PURE__ */ jsx2(OutlineList, { children: props.children })
2838
+ /* @__PURE__ */ jsx5(OutlineList, { children: props.children })
2682
2839
  ] })
2683
2840
  },
2684
2841
  entry: {
@@ -2699,10 +2856,12 @@ var HeadingAnalyzer = () => {
2699
2856
  ] });
2700
2857
  };
2701
2858
  var headingAnalyzer = {
2702
- name: "heading-analyzer",
2703
- label: "Audit",
2704
- render: HeadingAnalyzer,
2705
- icon: /* @__PURE__ */ jsx2(Heading1, {})
2859
+ overrides: {
2860
+ fields: ({ children, itemSelector }) => /* @__PURE__ */ jsxs2(Fragment, { children: [
2861
+ children,
2862
+ /* @__PURE__ */ jsx5("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ jsx5(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ jsx5(HeadingAnalyzer, {}) }) })
2863
+ ] })
2864
+ }
2706
2865
  };
2707
2866
  var HeadingAnalyzer_default = headingAnalyzer;
2708
2867
  export {
@@ -2718,45 +2877,10 @@ classnames/index.js:
2718
2877
  *)
2719
2878
 
2720
2879
  lucide-react/dist/esm/shared/src/utils.js:
2721
- (**
2722
- * @license lucide-react v0.468.0 - ISC
2723
- *
2724
- * This source code is licensed under the ISC license.
2725
- * See the LICENSE file in the root directory of this source tree.
2726
- *)
2727
-
2728
2880
  lucide-react/dist/esm/defaultAttributes.js:
2729
- (**
2730
- * @license lucide-react v0.468.0 - ISC
2731
- *
2732
- * This source code is licensed under the ISC license.
2733
- * See the LICENSE file in the root directory of this source tree.
2734
- *)
2735
-
2736
2881
  lucide-react/dist/esm/Icon.js:
2737
- (**
2738
- * @license lucide-react v0.468.0 - ISC
2739
- *
2740
- * This source code is licensed under the ISC license.
2741
- * See the LICENSE file in the root directory of this source tree.
2742
- *)
2743
-
2744
2882
  lucide-react/dist/esm/createLucideIcon.js:
2745
- (**
2746
- * @license lucide-react v0.468.0 - ISC
2747
- *
2748
- * This source code is licensed under the ISC license.
2749
- * See the LICENSE file in the root directory of this source tree.
2750
- *)
2751
-
2752
- lucide-react/dist/esm/icons/heading-1.js:
2753
- (**
2754
- * @license lucide-react v0.468.0 - ISC
2755
- *
2756
- * This source code is licensed under the ISC license.
2757
- * See the LICENSE file in the root directory of this source tree.
2758
- *)
2759
-
2883
+ lucide-react/dist/esm/icons/chevron-right.js:
2760
2884
  lucide-react/dist/esm/lucide-react.js:
2761
2885
  (**
2762
2886
  * @license lucide-react v0.468.0 - ISC