@measured/puck-plugin-heading-analyzer 0.15.1-canary.9b20506 → 0.16.0-canary.345374c

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.css CHANGED
@@ -1,3 +1,17 @@
1
+ /* css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css/#css-module-data */
2
+ ._HeadingAnalyzer_116v6_1 {
3
+ display: block;
4
+ }
5
+ ._HeadingAnalyzer-cssWarning_116v6_5 {
6
+ display: none !important;
7
+ }
8
+ ._HeadingAnalyzerItem_116v6_9 {
9
+ display: inline;
10
+ }
11
+ ._HeadingAnalyzerItem--missing_116v6_13 {
12
+ color: var(--puck-color-red-04);
13
+ }
14
+
1
15
  /* css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css/#css-module-data */
2
16
  ._SidebarSection_125qe_1 {
3
17
  display: flex;
package/dist/index.js CHANGED
@@ -42996,7 +42996,7 @@ var require_factoryWithTypeCheckers = __commonJS({
42996
42996
  function validate2(props, propName, componentName, location, propFullName) {
42997
42997
  if (!(props[propName] instanceof expectedClass)) {
42998
42998
  var expectedClassName = expectedClass.name || ANONYMOUS;
42999
- var actualClassName = getClassName5(props[propName]);
42999
+ var actualClassName = getClassName6(props[propName]);
43000
43000
  return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
43001
43001
  }
43002
43002
  return null;
@@ -43248,7 +43248,7 @@ var require_factoryWithTypeCheckers = __commonJS({
43248
43248
  return type;
43249
43249
  }
43250
43250
  }
43251
- function getClassName5(propValue) {
43251
+ function getClassName6(propValue) {
43252
43252
  if (!propValue.constructor || !propValue.constructor.name) {
43253
43253
  return ANONYMOUS;
43254
43254
  }
@@ -73976,7 +73976,7 @@ var require_dist = __commonJS({
73976
73976
  init_react_import2();
73977
73977
  var styles_module_default32 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
73978
73978
  var import_jsx_runtime9 = require("react/jsx-runtime");
73979
- var getClassName5 = get_class_name_factory_default2("Loader", styles_module_default32);
73979
+ var getClassName6 = get_class_name_factory_default2("Loader", styles_module_default32);
73980
73980
  var Loader2 = (_a3) => {
73981
73981
  var _b = _a3, {
73982
73982
  color,
@@ -73988,7 +73988,7 @@ var require_dist = __commonJS({
73988
73988
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
73989
73989
  "span",
73990
73990
  __spreadValues2({
73991
- className: getClassName5(),
73991
+ className: getClassName6(),
73992
73992
  style: {
73993
73993
  width: size,
73994
73994
  height: size,
@@ -74284,7 +74284,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
74284
74284
  };
74285
74285
  var import_jsx_runtime82 = require("react/jsx-runtime");
74286
74286
  var getClassName42 = get_class_name_factory_default2("ArrayField", styles_module_default22);
74287
- var getClassNameItem2 = get_class_name_factory_default2("ArrayFieldItem", styles_module_default22);
74287
+ var getClassNameItem3 = get_class_name_factory_default2("ArrayFieldItem", styles_module_default22);
74288
74288
  var ArrayField = ({
74289
74289
  field,
74290
74290
  onChange,
@@ -74417,7 +74417,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
74417
74417
  {
74418
74418
  id: _arrayId,
74419
74419
  index: i2,
74420
- className: (_, snapshot2) => getClassNameItem2({
74420
+ className: (_, snapshot2) => getClassNameItem3({
74421
74421
  isExpanded: arrayState.openId === _arrayId,
74422
74422
  isDragging: snapshot2 == null ? void 0 : snapshot2.isDragging,
74423
74423
  readOnly
@@ -74442,11 +74442,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
74442
74442
  );
74443
74443
  }
74444
74444
  },
74445
- className: getClassNameItem2("summary"),
74445
+ className: getClassNameItem3("summary"),
74446
74446
  children: [
74447
74447
  field.getItemSummary ? field.getItemSummary(data, i2) : `Item #${_originalIndex}`,
74448
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: getClassNameItem2("rhs"), children: [
74449
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: getClassNameItem2("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: getClassNameItem2("action"), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
74448
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: getClassNameItem3("rhs"), children: [
74449
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: getClassNameItem3("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: getClassNameItem3("action"), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
74450
74450
  IconButton,
74451
74451
  {
74452
74452
  type: "button",
@@ -74477,7 +74477,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
74477
74477
  ]
74478
74478
  }
74479
74479
  ),
74480
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: getClassNameItem2("body"), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("fieldset", { className: getClassNameItem2("fieldset"), children: Object.keys(field.arrayFields).map(
74480
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: getClassNameItem3("body"), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("fieldset", { className: getClassNameItem3("fieldset"), children: Object.keys(field.arrayFields).map(
74481
74481
  (fieldName) => {
74482
74482
  const subField = field.arrayFields[fieldName];
74483
74483
  const subFieldName = `${name}[${i2}].${fieldName}`;
@@ -74595,7 +74595,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
74595
74595
  var styles_module_default6 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Modal--isOpen_ikbaj_15", "Modal-inner": "_Modal-inner_ikbaj_19" };
74596
74596
  var import_react_dom3 = __toESM2(require_react_dom2());
74597
74597
  var import_jsx_runtime10 = require("react/jsx-runtime");
74598
- var getClassName6 = get_class_name_factory_default2("Modal", styles_module_default6);
74598
+ var getClassName62 = get_class_name_factory_default2("Modal", styles_module_default6);
74599
74599
  var Modal = ({
74600
74600
  children,
74601
74601
  onClose,
@@ -74609,10 +74609,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
74609
74609
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {});
74610
74610
  }
74611
74611
  return (0, import_react_dom3.createPortal)(
74612
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName6({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
74612
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName62({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
74613
74613
  "div",
74614
74614
  {
74615
- className: getClassName6("inner"),
74615
+ className: getClassName62("inner"),
74616
74616
  onClick: (e2) => e2.stopPropagation(),
74617
74617
  children
74618
74618
  }
@@ -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
  ) })
@@ -78555,6 +78567,12 @@ init_react_import();
78555
78567
  // src/HeadingAnalyzer.tsx
78556
78568
  init_react_import();
78557
78569
  var import_react12 = require("react");
78570
+
78571
+ // css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
78572
+ init_react_import();
78573
+ var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_116v6_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_116v6_5", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_116v6_9", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_116v6_13" };
78574
+
78575
+ // src/HeadingAnalyzer.tsx
78558
78576
  var import_puck = __toESM(require_dist());
78559
78577
 
78560
78578
  // ../core/components/SidebarSection/index.tsx
@@ -79002,6 +79020,8 @@ var getFrame2 = () => {
79002
79020
  // src/HeadingAnalyzer.tsx
79003
79021
  var import_react_from_json = __toESM(require("react-from-json"));
79004
79022
  var import_jsx_runtime8 = require("react/jsx-runtime");
79023
+ var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
79024
+ var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
79005
79025
  var dataAttr = "data-puck-heading-analyzer-id";
79006
79026
  var getOutline = ({
79007
79027
  addDataAttr = false,
@@ -79072,7 +79092,24 @@ var HeadingAnalyzer = () => {
79072
79092
  setHierarchy(buildHierarchy(frame));
79073
79093
  }
79074
79094
  }, [appState.data]);
79075
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
79095
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName5(), children: [
79096
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
79097
+ "small",
79098
+ {
79099
+ className: getClassName5("cssWarning"),
79100
+ style: {
79101
+ color: "var(--puck-color-red-04)",
79102
+ display: "block",
79103
+ marginBottom: 16
79104
+ },
79105
+ children: [
79106
+ "Heading analyzer styles not loaded. Please review the",
79107
+ " ",
79108
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
79109
+ "."
79110
+ ]
79111
+ }
79112
+ ),
79076
79113
  hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: "No headings." }),
79077
79114
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
79078
79115
  import_react_from_json.default,
@@ -79083,6 +79120,7 @@ var HeadingAnalyzer = () => {
79083
79120
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
79084
79121
  "small",
79085
79122
  {
79123
+ className: getClassNameItem2({ missing: props.missing }),
79086
79124
  onClick: typeof props.analyzeId == "undefined" ? void 0 : (e2) => {
79087
79125
  e2.stopPropagation();
79088
79126
  const frame = getFrame2();
@@ -79100,13 +79138,13 @@ var HeadingAnalyzer = () => {
79100
79138
  }, 2e3);
79101
79139
  }
79102
79140
  },
79103
- children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { style: { color: "var(--puck-color-red-04)" }, children: [
79141
+ children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
79104
79142
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("b", { children: [
79105
79143
  "H",
79106
79144
  props.rank
79107
79145
  ] }),
79108
79146
  ": Missing"
79109
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { children: [
79147
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
79110
79148
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("b", { children: [
79111
79149
  "H",
79112
79150
  props.rank
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck-plugin-heading-analyzer",
3
- "version": "0.15.1-canary.9b20506",
3
+ "version": "0.16.0-canary.345374c",
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.9b20506",
21
+ "@measured/puck": "^0.16.0-canary.345374c",
22
22
  "@types/react": "^18.2.0",
23
23
  "@types/react-dom": "^18.2.0",
24
24
  "eslint": "^7.32.0",