@measured/puck-plugin-heading-analyzer 0.14.0-canary.53b7937 → 0.14.0-canary.712fb8e

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -53,7 +53,7 @@ type ObjectField<Props extends {
53
53
  }> = BaseField & {
54
54
  type: "object";
55
55
  objectFields: {
56
- [SubPropName in keyof Props[0]]: Field<Props[0][SubPropName]>;
56
+ [SubPropName in keyof Props]: Field<Props[SubPropName]>;
57
57
  };
58
58
  };
59
59
  type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, PropShape = TableShape> = {
package/dist/index.js CHANGED
@@ -71218,6 +71218,7 @@ var require_dist = __commonJS({
71218
71218
  name,
71219
71219
  children,
71220
71220
  id,
71221
+ label,
71221
71222
  index
71222
71223
  }) => {
71223
71224
  const ctx = (0, import_react32.useContext)(drawerContext);
@@ -71227,7 +71228,7 @@ var require_dist = __commonJS({
71227
71228
  [children]
71228
71229
  );
71229
71230
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DrawerDraggable, { id: resolvedId, index, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
71230
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassNameItem2("name"), children: name }),
71231
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
71231
71232
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DragIcon, {}) })
71232
71233
  ] }) }) }) });
71233
71234
  };
@@ -71826,7 +71827,7 @@ var require_dist = __commonJS({
71826
71827
  },
71827
71828
  children: [
71828
71829
  content.map((item, i2) => {
71829
- var _a2, _b;
71830
+ var _a2, _b, _c;
71830
71831
  const componentId = item.props.id;
71831
71832
  const defaultedProps = __spreadProps2(__spreadValues2(__spreadValues2({}, (_a2 = config.components[item.type]) == null ? void 0 : _a2.defaultProps), item.props), {
71832
71833
  puck: { renderDropZone: DropZone },
@@ -71856,14 +71857,14 @@ var require_dist = __commonJS({
71856
71857
  children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
71857
71858
  DraggableComponent,
71858
71859
  {
71859
- label: item.type.toString(),
71860
+ label: (_b = config.components[item.type]["label"]) != null ? _b : item.type.toString(),
71860
71861
  id: `draggable-${componentId}`,
71861
71862
  index: i2,
71862
71863
  isSelected,
71863
71864
  isLocked: userIsDragging,
71864
71865
  forceHover: hoveringComponent === componentId && !userIsDragging,
71865
71866
  indicativeHover: userIsDragging && containsZone && hoveringArea === componentId,
71866
- isLoading: (_b = appContext22.componentState[componentId]) == null ? void 0 : _b.loading,
71867
+ isLoading: (_c = appContext22.componentState[componentId]) == null ? void 0 : _c.loading,
71867
71868
  onMount: () => {
71868
71869
  ctx.registerPath({
71869
71870
  index: i2,
@@ -73880,10 +73881,11 @@ var require_dist = __commonJS({
73880
73881
  var getClassName20 = get_class_name_factory_default2("ComponentList", styles_module_default15);
73881
73882
  var ComponentListItem = ({
73882
73883
  name,
73884
+ label,
73883
73885
  index
73884
73886
  }) => {
73885
73887
  const { overrides } = useAppContext2();
73886
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Drawer.Item, { name, index, children: overrides.componentItem });
73888
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Drawer.Item, { label, name, index, children: overrides.componentItem });
73887
73889
  };
73888
73890
  var ComponentList = ({
73889
73891
  children,
@@ -73912,9 +73914,11 @@ var require_dist = __commonJS({
73912
73914
  }
73913
73915
  ),
73914
73916
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName20("content"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Drawer, { droppableId: `component-list${title ? `:${title}` : ""}`, children: children || Object.keys(config.components).map((componentKey, i2) => {
73917
+ var _a;
73915
73918
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
73916
73919
  ComponentListItem,
73917
73920
  {
73921
+ label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
73918
73922
  name: componentKey,
73919
73923
  index: i2
73920
73924
  },
@@ -73943,10 +73947,12 @@ var require_dist = __commonJS({
73943
73947
  id: categoryKey,
73944
73948
  title: category.title || categoryKey,
73945
73949
  children: category.components.map((componentName, i2) => {
73950
+ var _a2;
73946
73951
  matchedComponents.push(componentName);
73947
73952
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
73948
73953
  ComponentList.Item,
73949
73954
  {
73955
+ label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
73950
73956
  name: componentName,
73951
73957
  index: i2
73952
73958
  },
@@ -73969,10 +73975,12 @@ var require_dist = __commonJS({
73969
73975
  id: "other",
73970
73976
  title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
73971
73977
  children: remainingComponents.map((componentName, i2) => {
73978
+ var _a2;
73972
73979
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
73973
73980
  ComponentList.Item,
73974
73981
  {
73975
73982
  name: componentName,
73983
+ label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
73976
73984
  index: i2
73977
73985
  },
73978
73986
  componentName
@@ -73985,7 +73993,7 @@ var require_dist = __commonJS({
73985
73993
  }
73986
73994
  setComponentList(_componentList);
73987
73995
  }
73988
- }, [config.categories, ui.componentList]);
73996
+ }, [config.categories, config.components, ui.componentList]);
73989
73997
  return componentList;
73990
73998
  };
73991
73999
  var import_react21 = require("react");
@@ -74065,6 +74073,7 @@ var require_dist = __commonJS({
74065
74073
  var getClassNameLayer = get_class_name_factory_default2("Layer", styles_module_default16);
74066
74074
  var LayerTree = ({
74067
74075
  data,
74076
+ config,
74068
74077
  zoneContent,
74069
74078
  itemSelector,
74070
74079
  setItemSelector,
@@ -74082,6 +74091,7 @@ var require_dist = __commonJS({
74082
74091
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("ul", { className: getClassName21(), children: [
74083
74092
  zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("helper"), children: "No items" }),
74084
74093
  zoneContent.map((item, i2) => {
74094
+ var _a;
74085
74095
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i2 && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId2 && !zone);
74086
74096
  const zonesForItem = findZonesForArea(data, item.props.id);
74087
74097
  const containsZone = Object.keys(zonesForItem).length > 0;
@@ -74146,7 +74156,7 @@ var require_dist = __commonJS({
74146
74156
  ),
74147
74157
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassNameLayer("title"), children: [
74148
74158
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LayoutGrid, { size: "16" }) }),
74149
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("name"), children: item.type })
74159
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("name"), children: (_a = config.components[item.type]["label"]) != null ? _a : item.type })
74150
74160
  ] })
74151
74161
  ]
74152
74162
  }
@@ -74154,6 +74164,7 @@ var require_dist = __commonJS({
74154
74164
  containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
74155
74165
  LayerTree,
74156
74166
  {
74167
+ config,
74157
74168
  data,
74158
74169
  zoneContent: zones[zoneKey],
74159
74170
  setItemSelector,
@@ -74173,7 +74184,7 @@ var require_dist = __commonJS({
74173
74184
  var import_react24 = require("react");
74174
74185
  var import_jsx_runtime28 = require("react/jsx-runtime");
74175
74186
  var Outline = () => {
74176
- const { dispatch, state, overrides } = useAppContext2();
74187
+ const { dispatch, state, overrides, config } = useAppContext2();
74177
74188
  const { data, ui } = state;
74178
74189
  const { itemSelector } = ui;
74179
74190
  const setItemSelector = (0, import_react24.useCallback)(
@@ -74190,6 +74201,7 @@ var require_dist = __commonJS({
74190
74201
  (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId2]) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
74191
74202
  LayerTree,
74192
74203
  {
74204
+ config,
74193
74205
  data,
74194
74206
  label: areaContainsZones(data, "root") ? rootDroppableId2 : "",
74195
74207
  zoneContent: data.content,
@@ -74202,6 +74214,7 @@ var require_dist = __commonJS({
74202
74214
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
74203
74215
  LayerTree,
74204
74216
  {
74217
+ config,
74205
74218
  data,
74206
74219
  label: zoneKey,
74207
74220
  zone: zoneKey,
@@ -74334,6 +74347,7 @@ var require_dist = __commonJS({
74334
74347
  headerTitle,
74335
74348
  headerPath
74336
74349
  }) {
74350
+ var _a;
74337
74351
  const historyStore = useHistoryStore();
74338
74352
  const [reducer2] = (0, import_react26.useState)(
74339
74353
  () => createReducer({ config, record: historyStore.record })
@@ -74443,8 +74457,8 @@ var require_dist = __commonJS({
74443
74457
  console.warn(
74444
74458
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
74445
74459
  );
74446
- const RenderHeader = (_a) => {
74447
- var _b = _a, { actions } = _b, props = __objRest2(_b, ["actions"]);
74460
+ const RenderHeader = (_a2) => {
74461
+ var _b = _a2, { actions } = _b, props = __objRest2(_b, ["actions"]);
74448
74462
  const Comp = renderHeader;
74449
74463
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState, children: actions }));
74450
74464
  };
@@ -74682,7 +74696,7 @@ var require_dist = __commonJS({
74682
74696
  noPadding: true,
74683
74697
  noBorderTop: true,
74684
74698
  showBreadcrumbs: true,
74685
- title: selectedItem ? selectedItem.type : "Page",
74699
+ title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
74686
74700
  children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Fields, {})
74687
74701
  }
74688
74702
  ) })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck-plugin-heading-analyzer",
3
- "version": "0.14.0-canary.53b7937",
3
+ "version": "0.14.0-canary.712fb8e",
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.14.0-canary.53b7937",
21
+ "@measured/puck": "^0.14.0-canary.712fb8e",
22
22
  "@types/react": "^18.2.0",
23
23
  "@types/react-dom": "^18.2.0",
24
24
  "eslint": "^7.32.0",