@measured/puck-plugin-heading-analyzer 0.15.1-canary.fb9aa4e → 0.16.0-canary.4ee30eb

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 (2) hide show
  1. package/dist/index.js +20 -8
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -75732,6 +75732,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
75732
75732
  "No configuration for ",
75733
75733
  item.type
75734
75734
  ] });
75735
+ const componentConfig = config.components[item.type];
75736
+ const label = (_b = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b : item.type.toString();
75735
75737
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
75736
75738
  "div",
75737
75739
  {
@@ -75747,7 +75749,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
75747
75749
  children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
75748
75750
  DraggableComponent,
75749
75751
  {
75750
- label: (_b = config.components[item.type]["label"]) != null ? _b : item.type.toString(),
75752
+ label,
75751
75753
  id: `draggable-${componentId}`,
75752
75754
  index: i2,
75753
75755
  isSelected,
@@ -77298,6 +77300,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
77298
77300
  const selectedItem = itemSelector && data ? getItem2(itemSelector, data) : null;
77299
77301
  const isHovering = hoveringComponent === item.props.id;
77300
77302
  const childIsSelected = isChildOfZone(item, selectedItem, ctx);
77303
+ const componentConfig = config.components[item.type];
77304
+ const label2 = (_a3 = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a3 : item.type.toString();
77301
77305
  return /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)(
77302
77306
  "li",
77303
77307
  {
@@ -77350,7 +77354,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
77350
77354
  ),
77351
77355
  /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)("div", { className: getClassNameLayer("title"), children: [
77352
77356
  /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(LayoutGrid, { size: "16" }) }),
77353
- /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("div", { className: getClassNameLayer("name"), children: (_a3 = config.components[item.type]["label"]) != null ? _a3 : item.type })
77357
+ /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("div", { className: getClassNameLayer("name"), children: label2 })
77354
77358
  ] })
77355
77359
  ]
77356
77360
  }
@@ -77487,9 +77491,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
77487
77491
  var import_react27 = require("react");
77488
77492
  var import_use_debounce3 = (init_index_module(), __toCommonJS(index_module_exports));
77489
77493
  var EMPTY_HISTORY_INDEX = -1;
77490
- function useHistoryStore() {
77491
- const [histories, setHistories] = (0, import_react27.useState)([]);
77492
- const [index, setIndex] = (0, import_react27.useState)(EMPTY_HISTORY_INDEX);
77494
+ function useHistoryStore(initialHistories) {
77495
+ var _a3, _b;
77496
+ const [histories, setHistories] = (0, import_react27.useState)(
77497
+ (_a3 = initialHistories == null ? void 0 : initialHistories.histories) != null ? _a3 : []
77498
+ );
77499
+ const [index, setIndex] = (0, import_react27.useState)(
77500
+ (_b = initialHistories == null ? void 0 : initialHistories.index) != null ? _b : EMPTY_HISTORY_INDEX
77501
+ );
77493
77502
  const hasPast = index > EMPTY_HISTORY_INDEX;
77494
77503
  const hasFuture = index < histories.length - 1;
77495
77504
  const currentHistory = histories[index];
@@ -77942,10 +77951,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
77942
77951
  iframe = {
77943
77952
  enabled: true
77944
77953
  },
77945
- dnd
77954
+ dnd,
77955
+ initialHistories
77946
77956
  }) {
77947
77957
  var _a3;
77948
- const historyStore = useHistoryStore();
77958
+ const historyStore = useHistoryStore(initialHistories);
77949
77959
  const [reducer2] = (0, import_react30.useState)(
77950
77960
  () => createReducer({ config, record: historyStore.record })
77951
77961
  );
@@ -78127,6 +78137,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78127
78137
  (0, import_react30.useEffect)(() => {
78128
78138
  setMounted(true);
78129
78139
  }, []);
78140
+ const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
78141
+ const selectedComponentLabel = selectedItem ? (_a3 = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _a3 : selectedItem.type.toString() : "";
78130
78142
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: `Puck ${getClassName26()}`, children: [
78131
78143
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
78132
78144
  AppProvider,
@@ -78335,7 +78347,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78335
78347
  noPadding: true,
78336
78348
  noBorderTop: true,
78337
78349
  showBreadcrumbs: true,
78338
- title: selectedItem ? (_a3 = config.components[selectedItem.type]["label"]) != null ? _a3 : selectedItem.type : "Page",
78350
+ title: selectedItem ? selectedComponentLabel : "Page",
78339
78351
  children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Fields, {})
78340
78352
  }
78341
78353
  ) })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck-plugin-heading-analyzer",
3
- "version": "0.15.1-canary.fb9aa4e",
3
+ "version": "0.16.0-canary.4ee30eb",
4
4
  "author": "Measured Corporation Ltd <hello@measured.co>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",
@@ -18,7 +18,7 @@
18
18
  "dist"
19
19
  ],
20
20
  "devDependencies": {
21
- "@measured/puck": "^0.15.1-canary.fb9aa4e",
21
+ "@measured/puck": "^0.16.0-canary.4ee30eb",
22
22
  "@types/react": "^18.2.0",
23
23
  "@types/react-dom": "^18.2.0",
24
24
  "eslint": "^7.32.0",