@measured/puck-plugin-heading-analyzer 0.14.0-canary.68f97ae → 0.14.0-canary.6cadfdb

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/dist/index.js +114 -132
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -31294,7 +31294,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
31294
31294
  return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
31295
31295
  }
31296
31296
  var objectIs = typeof Object.is === "function" ? Object.is : is2;
31297
- var useState8 = React30.useState, useEffect8 = React30.useEffect, useLayoutEffect4 = React30.useLayoutEffect, useDebugValue2 = React30.useDebugValue;
31297
+ var useState7 = React30.useState, useEffect7 = React30.useEffect, useLayoutEffect4 = React30.useLayoutEffect, useDebugValue2 = React30.useDebugValue;
31298
31298
  var didWarnOld18Alpha = false;
31299
31299
  var didWarnUncachedGetSnapshot = false;
31300
31300
  function useSyncExternalStore3(subscribe, getSnapshot, getServerSnapshot) {
@@ -31316,7 +31316,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
31316
31316
  }
31317
31317
  }
31318
31318
  }
31319
- var _useState = useState8({
31319
+ var _useState = useState7({
31320
31320
  inst: {
31321
31321
  value,
31322
31322
  getSnapshot
@@ -31331,7 +31331,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
31331
31331
  });
31332
31332
  }
31333
31333
  }, [subscribe, value, getSnapshot]);
31334
- useEffect8(function() {
31334
+ useEffect7(function() {
31335
31335
  if (checkIfSnapshotChanged(inst)) {
31336
31336
  forceUpdate({
31337
31337
  inst
@@ -31469,7 +31469,7 @@ var require_with_selector_development = __commonJS({
31469
31469
  }
31470
31470
  var objectIs = typeof Object.is === "function" ? Object.is : is2;
31471
31471
  var useSyncExternalStore3 = shim.useSyncExternalStore;
31472
- var useRef6 = React30.useRef, useEffect8 = React30.useEffect, useMemo5 = React30.useMemo, useDebugValue2 = React30.useDebugValue;
31472
+ var useRef6 = React30.useRef, useEffect7 = React30.useEffect, useMemo5 = React30.useMemo, useDebugValue2 = React30.useDebugValue;
31473
31473
  function useSyncExternalStoreWithSelector3(subscribe, getSnapshot, getServerSnapshot, selector, isEqual3) {
31474
31474
  var instRef = useRef6(null);
31475
31475
  var inst;
@@ -31526,7 +31526,7 @@ var require_with_selector_development = __commonJS({
31526
31526
  return [getSnapshotWithSelector, getServerSnapshotWithSelector];
31527
31527
  }, [getSnapshot, getServerSnapshot, selector, isEqual3]), getSelection = _useMemo[0], getServerSelection = _useMemo[1];
31528
31528
  var value = useSyncExternalStore3(subscribe, getSelection, getServerSelection);
31529
- useEffect8(function() {
31529
+ useEffect7(function() {
31530
31530
  inst.hasValue = true;
31531
31531
  inst.value = value;
31532
31532
  }, [value]);
@@ -42381,7 +42381,7 @@ var require_Context = __commonJS({
42381
42381
  win = window;
42382
42382
  }
42383
42383
  var FrameContext = exports2.FrameContext = _react2.default.createContext({ document: doc, window: win });
42384
- var useFrame2 = exports2.useFrame = function useFrame3() {
42384
+ var useFrame = exports2.useFrame = function useFrame2() {
42385
42385
  return _react2.default.useContext(FrameContext);
42386
42386
  };
42387
42387
  var FrameContextProvider = FrameContext.Provider;
@@ -43175,7 +43175,7 @@ var require_dist = __commonJS({
43175
43175
  default: () => AutoFrameComponent_default
43176
43176
  });
43177
43177
  module2.exports = __toCommonJS2(auto_frame_component_exports);
43178
- var import_react14 = __toESM2(require("react"));
43178
+ var import_react13 = __toESM2(require("react"));
43179
43179
  var import_react22 = __toESM2(require("react"));
43180
43180
  var import_react_frame_component = __toESM2(require_lib());
43181
43181
  var import_object_hash = __toESM2(require_object_hash());
@@ -43848,11 +43848,11 @@ var require_dist2 = __commonJS({
43848
43848
  step((generator = generator.apply(__this, __arguments)).next());
43849
43849
  });
43850
43850
  };
43851
- var import_react14;
43851
+ var import_react13;
43852
43852
  var init_react_import2 = __esm2({
43853
43853
  "../tsup-config/react-import.js"() {
43854
43854
  "use strict";
43855
- import_react14 = __toESM2(require("react"));
43855
+ import_react13 = __toESM2(require("react"));
43856
43856
  }
43857
43857
  });
43858
43858
  var require_classnames2 = __commonJS2({
@@ -74123,41 +74123,32 @@ var require_dist2 = __commonJS({
74123
74123
  return el;
74124
74124
  };
74125
74125
  init_react_import2();
74126
- var import_react29 = require("react");
74127
- init_react_import2();
74128
- var import_react122 = require("react");
74126
+ var import_react28 = require("react");
74129
74127
  init_react_import2();
74130
74128
  var import_react112 = require("react");
74131
74129
  init_react_import2();
74132
74130
  var getFrame3 = () => {
74133
74131
  let frame = document.querySelector("#preview-frame");
74134
74132
  if ((frame == null ? void 0 : frame.tagName) === "IFRAME") {
74135
- frame = frame.contentDocument.body;
74133
+ frame = frame.contentDocument;
74136
74134
  }
74137
74135
  return frame;
74138
74136
  };
74139
- var useFrame2 = () => {
74140
- const [el, setEl] = (0, import_react112.useState)();
74141
- (0, import_react112.useEffect)(() => {
74142
- setEl(getFrame3());
74143
- }, []);
74144
- return el;
74145
- };
74146
74137
  var usePlaceholderStyle = () => {
74147
74138
  const queryAttr = "data-rfd-drag-handle-draggable-id";
74148
- const [placeholderStyle, setPlaceholderStyle] = (0, import_react122.useState)();
74149
- const frame = useFrame2();
74139
+ const [placeholderStyle, setPlaceholderStyle] = (0, import_react112.useState)();
74150
74140
  const onDragStartOrUpdate = (draggedItem) => {
74151
74141
  var _a;
74152
74142
  const draggableId = draggedItem.draggableId;
74153
74143
  const destinationIndex = (draggedItem.destination || draggedItem.source).index;
74154
74144
  const droppableId = (draggedItem.destination || draggedItem.source).droppableId;
74155
74145
  const domQuery = `[${queryAttr}='${draggableId}']`;
74156
- const draggedDOM = frame == null ? void 0 : frame.ownerDocument.querySelector(domQuery);
74146
+ const frame = getFrame3();
74147
+ const draggedDOM = frame == null ? void 0 : frame.querySelector(domQuery);
74157
74148
  if (!draggedDOM) {
74158
74149
  return;
74159
74150
  }
74160
- const targetListElement = frame == null ? void 0 : frame.ownerDocument.querySelector(
74151
+ const targetListElement = frame == null ? void 0 : frame.querySelector(
74161
74152
  `[data-rfd-droppable-id='${droppableId}']`
74162
74153
  );
74163
74154
  const { clientHeight } = draggedDOM;
@@ -74228,7 +74219,7 @@ var require_dist2 = __commonJS({
74228
74219
  );
74229
74220
  };
74230
74221
  init_react_import2();
74231
- var import_react132 = require("react");
74222
+ var import_react122 = require("react");
74232
74223
  var convertPathDataToBreadcrumbs2 = (selectedItem, pathData, data) => {
74233
74224
  const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
74234
74225
  const currentPathData = pathData && id && pathData[id] ? __spreadValues2({}, pathData[id]) : { label: "Page", path: [] };
@@ -74278,8 +74269,8 @@ var require_dist2 = __commonJS({
74278
74269
  state: { data },
74279
74270
  selectedItem
74280
74271
  } = useAppContext2();
74281
- const dzContext = (0, import_react132.useContext)(dropZoneContext2);
74282
- return (0, import_react132.useMemo)(() => {
74272
+ const dzContext = (0, import_react122.useContext)(dropZoneContext2);
74273
+ return (0, import_react122.useMemo)(() => {
74283
74274
  const breadcrumbs = convertPathDataToBreadcrumbs2(
74284
74275
  selectedItem,
74285
74276
  dzContext == null ? void 0 : dzContext.pathData,
@@ -74668,7 +74659,7 @@ var require_dist2 = __commonJS({
74668
74659
  return appState;
74669
74660
  };
74670
74661
  init_react_import2();
74671
- var import_react142 = require("react");
74662
+ var import_react132 = require("react");
74672
74663
  init_react_import2();
74673
74664
  var cache = { lastChange: {} };
74674
74665
  var resolveAllComponentData = (content, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
@@ -74775,13 +74766,13 @@ var require_dist2 = __commonJS({
74775
74766
  return data.root;
74776
74767
  });
74777
74768
  var useResolvedData = (appState, config, dispatch) => {
74778
- const [{ resolverKey, newAppState }, setResolverState] = (0, import_react142.useState)({
74769
+ const [{ resolverKey, newAppState }, setResolverState] = (0, import_react132.useState)({
74779
74770
  resolverKey: 0,
74780
74771
  newAppState: appState
74781
74772
  });
74782
- const [componentState, setComponentState] = (0, import_react142.useState)({});
74773
+ const [componentState, setComponentState] = (0, import_react132.useState)({});
74783
74774
  const deferredSetStates = {};
74784
- const setComponentLoading = (0, import_react142.useCallback)(
74775
+ const setComponentLoading = (0, import_react132.useCallback)(
74785
74776
  (id, loading, defer = 0) => {
74786
74777
  if (deferredSetStates[id]) {
74787
74778
  clearTimeout(deferredSetStates[id]);
@@ -74851,10 +74842,10 @@ var require_dist2 = __commonJS({
74851
74842
  });
74852
74843
  yield Promise.all(promises);
74853
74844
  });
74854
- (0, import_react142.useEffect)(() => {
74845
+ (0, import_react132.useEffect)(() => {
74855
74846
  runResolvers();
74856
74847
  }, [resolverKey]);
74857
- const resolveData = (0, import_react142.useCallback)((newAppState2 = appState) => {
74848
+ const resolveData = (0, import_react132.useCallback)((newAppState2 = appState) => {
74858
74849
  setResolverState((curr) => ({
74859
74850
  resolverKey: curr.resolverKey + 1,
74860
74851
  newAppState: newAppState2
@@ -74968,7 +74959,7 @@ var require_dist2 = __commonJS({
74968
74959
  "Input-radioInner": "styles_Input-radioInner",
74969
74960
  "Input-radioInput": "styles_Input-radioInput"
74970
74961
  };
74971
- var import_react19 = require("react");
74962
+ var import_react18 = require("react");
74972
74963
  init_react_import2();
74973
74964
  init_react_import2();
74974
74965
  var styles_default10 = {
@@ -74986,7 +74977,7 @@ var require_dist2 = __commonJS({
74986
74977
  "ArrayFieldItem-rhs": "styles_ArrayFieldItem-rhs",
74987
74978
  "ArrayFieldItem-actions": "styles_ArrayFieldItem-actions"
74988
74979
  };
74989
- var import_react15 = require("react");
74980
+ var import_react14 = require("react");
74990
74981
  init_react_import2();
74991
74982
  var import_dnd4 = (init_dnd_esm(), __toCommonJS(dnd_esm_exports));
74992
74983
  var import_jsx_runtime14 = require("react/jsx-runtime");
@@ -75020,11 +75011,11 @@ var require_dist2 = __commonJS({
75020
75011
  }),
75021
75012
  openId: ""
75022
75013
  };
75023
- const [localState, setLocalState] = (0, import_react15.useState)({ arrayState, value });
75024
- (0, import_react15.useEffect)(() => {
75014
+ const [localState, setLocalState] = (0, import_react14.useState)({ arrayState, value });
75015
+ (0, import_react14.useEffect)(() => {
75025
75016
  setLocalState({ arrayState, value });
75026
75017
  }, [value, state.ui.arrayState[id]]);
75027
- const mapArrayStateToUi = (0, import_react15.useCallback)(
75018
+ const mapArrayStateToUi = (0, import_react14.useCallback)(
75028
75019
  (partialArrayState) => {
75029
75020
  return {
75030
75021
  arrayState: __spreadProps2(__spreadValues2({}, state.ui.arrayState), {
@@ -75034,13 +75025,13 @@ var require_dist2 = __commonJS({
75034
75025
  },
75035
75026
  [arrayState]
75036
75027
  );
75037
- const getHighestIndex = (0, import_react15.useCallback)(() => {
75028
+ const getHighestIndex = (0, import_react14.useCallback)(() => {
75038
75029
  return arrayState.items.reduce(
75039
75030
  (acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
75040
75031
  -1
75041
75032
  );
75042
75033
  }, [arrayState]);
75043
- const regenerateArrayState = (0, import_react15.useCallback)(
75034
+ const regenerateArrayState = (0, import_react14.useCallback)(
75044
75035
  (value2) => {
75045
75036
  let highestIndex = getHighestIndex();
75046
75037
  const newItems = Array.from(value2 || []).map((item, idx) => {
@@ -75059,10 +75050,10 @@ var require_dist2 = __commonJS({
75059
75050
  },
75060
75051
  [arrayState]
75061
75052
  );
75062
- (0, import_react15.useEffect)(() => {
75053
+ (0, import_react14.useEffect)(() => {
75063
75054
  setUi(mapArrayStateToUi(arrayState));
75064
75055
  }, []);
75065
- const [hovering, setHovering] = (0, import_react15.useState)(false);
75056
+ const [hovering, setHovering] = (0, import_react14.useState)(false);
75066
75057
  if (field.type !== "array" || !field.arrayFields) {
75067
75058
  return null;
75068
75059
  }
@@ -75158,6 +75149,7 @@ var require_dist2 = __commonJS({
75158
75149
  !readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem22("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem22("action"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
75159
75150
  IconButton,
75160
75151
  {
75152
+ type: "button",
75161
75153
  disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
75162
75154
  onClick: (e2) => {
75163
75155
  e2.stopPropagation();
@@ -75222,6 +75214,7 @@ var require_dist2 = __commonJS({
75222
75214
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
75223
75215
  "button",
75224
75216
  {
75217
+ type: "button",
75225
75218
  className: getClassName10("addButton"),
75226
75219
  disabled: field.max !== void 0 && localState.arrayState.items.length >= field.max,
75227
75220
  onClick: () => {
@@ -75292,9 +75285,9 @@ var require_dist2 = __commonJS({
75292
75285
  );
75293
75286
  };
75294
75287
  init_react_import2();
75295
- var import_react18 = require("react");
75296
- init_react_import2();
75297
75288
  var import_react17 = require("react");
75289
+ init_react_import2();
75290
+ var import_react16 = require("react");
75298
75291
  var styles_default11 = {
75299
75292
  "ExternalInput-actions": "styles_ExternalInput-actions",
75300
75293
  "ExternalInput-button": "styles_ExternalInput-button",
@@ -75325,7 +75318,7 @@ var require_dist2 = __commonJS({
75325
75318
  "ExternalInputModal-footer": "styles_ExternalInputModal-footer"
75326
75319
  };
75327
75320
  init_react_import2();
75328
- var import_react16 = require("react");
75321
+ var import_react15 = require("react");
75329
75322
  var styles_default12 = {
75330
75323
  Modal: "styles_Modal",
75331
75324
  "Modal--isOpen": "styles_Modal--isOpen",
@@ -75339,8 +75332,8 @@ var require_dist2 = __commonJS({
75339
75332
  onClose,
75340
75333
  isOpen
75341
75334
  }) => {
75342
- const [rootEl, setRootEl] = (0, import_react16.useState)(null);
75343
- (0, import_react16.useEffect)(() => {
75335
+ const [rootEl, setRootEl] = (0, import_react15.useState)(null);
75336
+ (0, import_react15.useEffect)(() => {
75344
75337
  setRootEl(document.getElementById("puck-portal-root"));
75345
75338
  }, []);
75346
75339
  if (!rootEl) {
@@ -75375,16 +75368,16 @@ var require_dist2 = __commonJS({
75375
75368
  mapRow = (val) => val,
75376
75369
  filterFields
75377
75370
  } = field || {};
75378
- const [data, setData] = (0, import_react17.useState)([]);
75379
- const [isOpen, setOpen] = (0, import_react17.useState)(false);
75380
- const [isLoading, setIsLoading] = (0, import_react17.useState)(true);
75371
+ const [data, setData] = (0, import_react16.useState)([]);
75372
+ const [isOpen, setOpen] = (0, import_react16.useState)(false);
75373
+ const [isLoading, setIsLoading] = (0, import_react16.useState)(true);
75381
75374
  const hasFilterFields = !!filterFields;
75382
- const [filters, setFilters] = (0, import_react17.useState)(field.initialFilters || {});
75383
- const [filtersToggled, setFiltersToggled] = (0, import_react17.useState)(hasFilterFields);
75384
- const mappedData = (0, import_react17.useMemo)(() => {
75375
+ const [filters, setFilters] = (0, import_react16.useState)(field.initialFilters || {});
75376
+ const [filtersToggled, setFiltersToggled] = (0, import_react16.useState)(hasFilterFields);
75377
+ const mappedData = (0, import_react16.useMemo)(() => {
75385
75378
  return data.map(mapRow);
75386
75379
  }, [data]);
75387
- const keys = (0, import_react17.useMemo)(() => {
75380
+ const keys = (0, import_react16.useMemo)(() => {
75388
75381
  const validKeys = /* @__PURE__ */ new Set();
75389
75382
  for (const item of mappedData) {
75390
75383
  for (const key of Object.keys(item)) {
@@ -75395,8 +75388,8 @@ var require_dist2 = __commonJS({
75395
75388
  }
75396
75389
  return Array.from(validKeys);
75397
75390
  }, [mappedData]);
75398
- const [searchQuery, setSearchQuery] = (0, import_react17.useState)(field.initialQuery || "");
75399
- const search = (0, import_react17.useCallback)(
75391
+ const [searchQuery, setSearchQuery] = (0, import_react16.useState)(field.initialQuery || "");
75392
+ const search = (0, import_react16.useCallback)(
75400
75393
  (query, filters2) => __async(void 0, null, function* () {
75401
75394
  setIsLoading(true);
75402
75395
  const cacheKey = `${id}-${name}-${query}-${JSON.stringify(filters2)}`;
@@ -75409,7 +75402,7 @@ var require_dist2 = __commonJS({
75409
75402
  }),
75410
75403
  [name, field]
75411
75404
  );
75412
- (0, import_react17.useEffect)(() => {
75405
+ (0, import_react16.useEffect)(() => {
75413
75406
  search(searchQuery, filters);
75414
75407
  }, []);
75415
75408
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
@@ -75425,6 +75418,7 @@ var require_dist2 = __commonJS({
75425
75418
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
75426
75419
  "button",
75427
75420
  {
75421
+ type: "button",
75428
75422
  onClick: () => setOpen(true),
75429
75423
  className: getClassName13("button"),
75430
75424
  children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
@@ -75567,7 +75561,7 @@ var require_dist2 = __commonJS({
75567
75561
  var _a, _b, _c;
75568
75562
  const validField = field;
75569
75563
  const deprecatedField = field;
75570
- (0, import_react18.useEffect)(() => {
75564
+ (0, import_react17.useEffect)(() => {
75571
75565
  if (deprecatedField.adaptor) {
75572
75566
  console.error(
75573
75567
  "Warning: The `adaptor` API is deprecated. Please use updated APIs on the `external` field instead. This will be a breaking change in a future release."
@@ -75828,7 +75822,7 @@ var require_dist2 = __commonJS({
75828
75822
  readOnly
75829
75823
  }) => {
75830
75824
  const { overrides } = useAppContext2();
75831
- const Wrapper = (0, import_react19.useMemo)(
75825
+ const Wrapper = (0, import_react18.useMemo)(
75832
75826
  () => overrides.fieldLabel || FieldLabel,
75833
75827
  [overrides]
75834
75828
  );
@@ -75849,7 +75843,7 @@ var require_dist2 = __commonJS({
75849
75843
  var _a2, _b2, _c, _d, _e, _f, _g, _h;
75850
75844
  const { overrides } = useAppContext2();
75851
75845
  const { name, field, value, readOnly } = props;
75852
- const [localValue, setLocalValue] = (0, import_react19.useState)(value);
75846
+ const [localValue, setLocalValue] = (0, import_react18.useState)(value);
75853
75847
  const onChangeDb = (0, import_use_debounce2.useDebouncedCallback)(
75854
75848
  (val, ui) => {
75855
75849
  onChange(val, ui);
@@ -75857,11 +75851,11 @@ var require_dist2 = __commonJS({
75857
75851
  50,
75858
75852
  { leading: true }
75859
75853
  );
75860
- const onChangeLocal = (0, import_react19.useCallback)((val, ui) => {
75854
+ const onChangeLocal = (0, import_react18.useCallback)((val, ui) => {
75861
75855
  setLocalValue(val);
75862
75856
  onChangeDb(val, ui);
75863
75857
  }, []);
75864
- (0, import_react19.useEffect)(() => {
75858
+ (0, import_react18.useEffect)(() => {
75865
75859
  setLocalValue(value);
75866
75860
  }, [value]);
75867
75861
  const localProps = {
@@ -75907,7 +75901,7 @@ var require_dist2 = __commonJS({
75907
75901
  PuckFields: "styles_PuckFields",
75908
75902
  "PuckFields-loadingOverlay": "styles_PuckFields-loadingOverlay"
75909
75903
  };
75910
- var import_react20 = require("react");
75904
+ var import_react19 = require("react");
75911
75905
  var import_jsx_runtime25 = require("react/jsx-runtime");
75912
75906
  var getClassName19 = get_class_name_factory_default2("PuckFields", styles_default14);
75913
75907
  var defaultPageFields = {
@@ -75939,7 +75933,7 @@ var require_dist2 = __commonJS({
75939
75933
  const fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
75940
75934
  const isLoading = selectedItem ? (_c = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _c.loading : (_d = componentState["puck-root"]) == null ? void 0 : _d.loading;
75941
75935
  const rootProps = data.root.props || data.root;
75942
- const Wrapper = (0, import_react20.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
75936
+ const Wrapper = (0, import_react19.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
75943
75937
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
75944
75938
  "form",
75945
75939
  {
@@ -76050,7 +76044,7 @@ var require_dist2 = __commonJS({
76050
76044
  };
76051
76045
  init_react_import2();
76052
76046
  init_react_import2();
76053
- var import_react21 = require("react");
76047
+ var import_react20 = require("react");
76054
76048
  init_react_import2();
76055
76049
  var styles_default15 = {
76056
76050
  ComponentList: "styles_ComponentList",
@@ -76112,8 +76106,8 @@ var require_dist2 = __commonJS({
76112
76106
  ComponentList.Item = ComponentListItem;
76113
76107
  var import_jsx_runtime27 = require("react/jsx-runtime");
76114
76108
  var useComponentList = (config, ui) => {
76115
- const [componentList, setComponentList] = (0, import_react21.useState)();
76116
- (0, import_react21.useEffect)(() => {
76109
+ const [componentList, setComponentList] = (0, import_react20.useState)();
76110
+ (0, import_react20.useEffect)(() => {
76117
76111
  var _a, _b, _c;
76118
76112
  if (Object.keys(ui.componentList).length > 0) {
76119
76113
  const matchedComponents = [];
@@ -76178,16 +76172,16 @@ var require_dist2 = __commonJS({
76178
76172
  }, [config.categories, config.components, ui.componentList]);
76179
76173
  return componentList;
76180
76174
  };
76181
- var import_react222 = require("react");
76175
+ var import_react21 = require("react");
76182
76176
  var import_jsx_runtime28 = require("react/jsx-runtime");
76183
76177
  var Components = () => {
76184
76178
  const { config, state, overrides } = useAppContext2();
76185
76179
  const componentList = useComponentList(config, state.ui);
76186
- const Wrapper = (0, import_react222.useMemo)(() => overrides.components || "div", [overrides]);
76180
+ const Wrapper = (0, import_react21.useMemo)(() => overrides.components || "div", [overrides]);
76187
76181
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComponentList, { id: "all" }) });
76188
76182
  };
76189
76183
  init_react_import2();
76190
- var import_react23 = require("react");
76184
+ var import_react222 = require("react");
76191
76185
  var import_auto_frame_component = __toESM2(require_dist());
76192
76186
  var styles_default16 = {
76193
76187
  PuckPreview: "styles_PuckPreview",
@@ -76197,7 +76191,7 @@ var require_dist2 = __commonJS({
76197
76191
  var getClassName21 = get_class_name_factory_default2("PuckPreview", styles_default16);
76198
76192
  var Preview = ({ id = "puck-preview" }) => {
76199
76193
  const { config, dispatch, state, setStatus, iframe } = useAppContext2();
76200
- const Page = (0, import_react23.useCallback)(
76194
+ const Page = (0, import_react222.useCallback)(
76201
76195
  (pageProps) => {
76202
76196
  var _a, _b;
76203
76197
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps2(__spreadValues2({}, pageProps), { editMode: true })) : pageProps.children;
@@ -76205,7 +76199,7 @@ var require_dist2 = __commonJS({
76205
76199
  [config.root]
76206
76200
  );
76207
76201
  const rootProps = state.data.root.props || state.data.root;
76208
- const ref2 = (0, import_react23.useRef)(null);
76202
+ const ref2 = (0, import_react222.useRef)(null);
76209
76203
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
76210
76204
  "div",
76211
76205
  {
@@ -76273,7 +76267,7 @@ var require_dist2 = __commonJS({
76273
76267
  el.style.scrollMargin = oldStyle.scrollMargin || "";
76274
76268
  }
76275
76269
  };
76276
- var import_react24 = require("react");
76270
+ var import_react23 = require("react");
76277
76271
  init_react_import2();
76278
76272
  var isChildOfZone = (item, maybeChild, ctx) => {
76279
76273
  var _a;
@@ -76296,8 +76290,7 @@ var require_dist2 = __commonJS({
76296
76290
  label
76297
76291
  }) => {
76298
76292
  const zones = data.zones || {};
76299
- const ctx = (0, import_react24.useContext)(dropZoneContext2);
76300
- const frame = useFrame2();
76293
+ const ctx = (0, import_react23.useContext)(dropZoneContext2);
76301
76294
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
76302
76295
  label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName222("zoneTitle"), children: [
76303
76296
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName222("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Layers, { size: "16" }) }),
@@ -76345,6 +76338,7 @@ var require_dist2 = __commonJS({
76345
76338
  zone
76346
76339
  });
76347
76340
  const id = zoneContent[i2].props.id;
76341
+ const frame = getFrame3();
76348
76342
  scrollIntoView2(
76349
76343
  frame == null ? void 0 : frame.querySelector(
76350
76344
  `[data-rfd-drag-handle-draggable-id="draggable-${id}"]`
@@ -76397,13 +76391,13 @@ var require_dist2 = __commonJS({
76397
76391
  ] })
76398
76392
  ] });
76399
76393
  };
76400
- var import_react25 = require("react");
76394
+ var import_react24 = require("react");
76401
76395
  var import_jsx_runtime31 = require("react/jsx-runtime");
76402
76396
  var Outline = () => {
76403
76397
  const { dispatch, state, overrides, config } = useAppContext2();
76404
76398
  const { data, ui } = state;
76405
76399
  const { itemSelector } = ui;
76406
- const setItemSelector = (0, import_react25.useCallback)(
76400
+ const setItemSelector = (0, import_react24.useCallback)(
76407
76401
  (newItemSelector) => {
76408
76402
  dispatch({
76409
76403
  type: "setUi",
@@ -76412,7 +76406,7 @@ var require_dist2 = __commonJS({
76412
76406
  },
76413
76407
  []
76414
76408
  );
76415
- const Wrapper = (0, import_react25.useMemo)(() => overrides.outline || "div", [overrides]);
76409
+ const Wrapper = (0, import_react24.useMemo)(() => overrides.outline || "div", [overrides]);
76416
76410
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(dropZoneContext2.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
76417
76411
  (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId2]) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
76418
76412
  LayerTree,
@@ -76506,12 +76500,12 @@ var require_dist2 = __commonJS({
76506
76500
  };
76507
76501
  }
76508
76502
  init_react_import2();
76509
- var import_react26 = require("react");
76503
+ var import_react25 = require("react");
76510
76504
  var import_use_debounce3 = (init_index_module(), __toCommonJS(index_module_exports));
76511
76505
  var EMPTY_HISTORY_INDEX = -1;
76512
76506
  function useHistoryStore() {
76513
- const [histories, setHistories] = (0, import_react26.useState)([]);
76514
- const [index, setIndex] = (0, import_react26.useState)(EMPTY_HISTORY_INDEX);
76507
+ const [histories, setHistories] = (0, import_react25.useState)([]);
76508
+ const [index, setIndex] = (0, import_react25.useState)(EMPTY_HISTORY_INDEX);
76515
76509
  const hasPast = index > EMPTY_HISTORY_INDEX;
76516
76510
  const hasFuture = index < histories.length - 1;
76517
76511
  const currentHistory = histories[index];
@@ -76661,9 +76655,9 @@ var require_dist2 = __commonJS({
76661
76655
  var styles = window.getComputedStyle(el);
76662
76656
  return calculateBox3(borderBox, styles);
76663
76657
  };
76664
- var import_react28 = require("react");
76665
- init_react_import2();
76666
76658
  var import_react27 = require("react");
76659
+ init_react_import2();
76660
+ var import_react26 = require("react");
76667
76661
  var styles_default18 = {
76668
76662
  ViewportControls: "styles_ViewportControls",
76669
76663
  "ViewportControls-divider": "styles_ViewportControls-divider",
@@ -76687,8 +76681,8 @@ var require_dist2 = __commonJS({
76687
76681
  onClick
76688
76682
  }) => {
76689
76683
  const { state } = useAppContext2();
76690
- const [isActive2, setIsActive] = (0, import_react27.useState)(false);
76691
- (0, import_react27.useEffect)(() => {
76684
+ const [isActive2, setIsActive] = (0, import_react26.useState)(false);
76685
+ (0, import_react26.useEffect)(() => {
76692
76686
  setIsActive(width === state.ui.viewports.current.width);
76693
76687
  }, [width, state.ui.viewports.current.width]);
76694
76688
  return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("span", { className: getClassNameButton({ isActive: isActive2 }), children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
@@ -76723,7 +76717,7 @@ var require_dist2 = __commonJS({
76723
76717
  const defaultsContainAutoZoom = defaultZoomOptions.find(
76724
76718
  (option) => option.value === autoZoom
76725
76719
  );
76726
- const zoomOptions = (0, import_react27.useMemo)(
76720
+ const zoomOptions = (0, import_react26.useMemo)(
76727
76721
  () => [
76728
76722
  ...defaultZoomOptions,
76729
76723
  ...defaultsContainAutoZoom ? [] : [
@@ -76845,17 +76839,17 @@ var require_dist2 = __commonJS({
76845
76839
  const { status, iframe } = useAppContext2();
76846
76840
  const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext2();
76847
76841
  const { ui } = state;
76848
- const frameRef = (0, import_react28.useRef)(null);
76849
- const [showTransition, setShowTransition] = (0, import_react28.useState)(false);
76850
- const defaultRender = (0, import_react28.useMemo)(() => {
76842
+ const frameRef = (0, import_react27.useRef)(null);
76843
+ const [showTransition, setShowTransition] = (0, import_react27.useState)(false);
76844
+ const defaultRender = (0, import_react27.useMemo)(() => {
76851
76845
  const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
76852
76846
  return PuckDefault;
76853
76847
  }, []);
76854
- const CustomPreview = (0, import_react28.useMemo)(
76848
+ const CustomPreview = (0, import_react27.useMemo)(
76855
76849
  () => overrides.preview || defaultRender,
76856
76850
  [overrides]
76857
76851
  );
76858
- const getFrameDimensions = (0, import_react28.useCallback)(() => {
76852
+ const getFrameDimensions = (0, import_react27.useCallback)(() => {
76859
76853
  if (frameRef.current) {
76860
76854
  const frame = frameRef.current;
76861
76855
  const box = getBox3(frame);
@@ -76863,7 +76857,7 @@ var require_dist2 = __commonJS({
76863
76857
  }
76864
76858
  return { width: 0, height: 0 };
76865
76859
  }, [frameRef]);
76866
- const resetAutoZoom = (0, import_react28.useCallback)(
76860
+ const resetAutoZoom = (0, import_react27.useCallback)(
76867
76861
  (ui2 = state.ui) => {
76868
76862
  if (frameRef.current) {
76869
76863
  setZoomConfig(
@@ -76873,11 +76867,11 @@ var require_dist2 = __commonJS({
76873
76867
  },
76874
76868
  [frameRef, zoomConfig, state.ui]
76875
76869
  );
76876
- (0, import_react28.useEffect)(() => {
76870
+ (0, import_react27.useEffect)(() => {
76877
76871
  setShowTransition(false);
76878
76872
  resetAutoZoom();
76879
76873
  }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
76880
- (0, import_react28.useEffect)(() => {
76874
+ (0, import_react27.useEffect)(() => {
76881
76875
  const { height: frameHeight } = getFrameDimensions();
76882
76876
  if (ui.viewports.current.height === "auto") {
76883
76877
  setZoomConfig(__spreadProps2(__spreadValues2({}, zoomConfig), {
@@ -76885,7 +76879,7 @@ var require_dist2 = __commonJS({
76885
76879
  }));
76886
76880
  }
76887
76881
  }, [zoomConfig.zoom]);
76888
- (0, import_react28.useEffect)(() => {
76882
+ (0, import_react27.useEffect)(() => {
76889
76883
  const observer = new ResizeObserver(() => {
76890
76884
  setShowTransition(false);
76891
76885
  resetAutoZoom();
@@ -76974,10 +76968,10 @@ var require_dist2 = __commonJS({
76974
76968
  }) {
76975
76969
  var _a;
76976
76970
  const historyStore = useHistoryStore();
76977
- const [reducer2] = (0, import_react29.useState)(
76971
+ const [reducer2] = (0, import_react28.useState)(
76978
76972
  () => createReducer({ config, record: historyStore.record })
76979
76973
  );
76980
- const [initialAppState] = (0, import_react29.useState)(() => {
76974
+ const [initialAppState] = (0, import_react28.useState)(() => {
76981
76975
  var _a2, _b, _c, _d;
76982
76976
  const initial = __spreadValues2(__spreadValues2({}, defaultAppState2.ui), initialUi);
76983
76977
  let clientUiState = {};
@@ -77022,7 +77016,7 @@ var require_dist2 = __commonJS({
77022
77016
  })
77023
77017
  });
77024
77018
  });
77025
- const [appState, dispatch] = (0, import_react29.useReducer)(
77019
+ const [appState, dispatch] = (0, import_react28.useReducer)(
77026
77020
  reducer2,
77027
77021
  flushZones(initialAppState)
77028
77022
  );
@@ -77033,9 +77027,9 @@ var require_dist2 = __commonJS({
77033
77027
  config,
77034
77028
  dispatch
77035
77029
  );
77036
- const [menuOpen, setMenuOpen] = (0, import_react29.useState)(false);
77030
+ const [menuOpen, setMenuOpen] = (0, import_react28.useState)(false);
77037
77031
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
77038
- const setItemSelector = (0, import_react29.useCallback)(
77032
+ const setItemSelector = (0, import_react28.useCallback)(
77039
77033
  (newItemSelector) => {
77040
77034
  if (newItemSelector === itemSelector)
77041
77035
  return;
@@ -77048,21 +77042,21 @@ var require_dist2 = __commonJS({
77048
77042
  [itemSelector]
77049
77043
  );
77050
77044
  const selectedItem = itemSelector ? getItem2(itemSelector, data) : null;
77051
- (0, import_react29.useEffect)(() => {
77045
+ (0, import_react28.useEffect)(() => {
77052
77046
  if (onChange)
77053
77047
  onChange(data);
77054
77048
  }, [data]);
77055
77049
  const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
77056
- const [draggedItem, setDraggedItem] = (0, import_react29.useState)();
77050
+ const [draggedItem, setDraggedItem] = (0, import_react28.useState)();
77057
77051
  const rootProps = data.root.props || data.root;
77058
- (0, import_react29.useEffect)(() => {
77052
+ (0, import_react28.useEffect)(() => {
77059
77053
  if (Object.keys(data.root).length > 0 && !data.root.props) {
77060
77054
  console.error(
77061
77055
  "Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
77062
77056
  );
77063
77057
  }
77064
77058
  }, []);
77065
- const toggleSidebars = (0, import_react29.useCallback)(
77059
+ const toggleSidebars = (0, import_react28.useCallback)(
77066
77060
  (sidebar) => {
77067
77061
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
77068
77062
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -77076,7 +77070,7 @@ var require_dist2 = __commonJS({
77076
77070
  },
77077
77071
  [dispatch, leftSideBarVisible, rightSideBarVisible]
77078
77072
  );
77079
- (0, import_react29.useEffect)(() => {
77073
+ (0, import_react28.useEffect)(() => {
77080
77074
  if (!window.matchMedia("(min-width: 638px)").matches) {
77081
77075
  dispatch({
77082
77076
  type: "setUi",
@@ -77099,11 +77093,11 @@ var require_dist2 = __commonJS({
77099
77093
  window.removeEventListener("resize", handleResize);
77100
77094
  };
77101
77095
  }, []);
77102
- const defaultRender = (0, import_react29.useMemo)(() => {
77096
+ const defaultRender = (0, import_react28.useMemo)(() => {
77103
77097
  const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: children2 });
77104
77098
  return PuckDefault;
77105
77099
  }, []);
77106
- const defaultHeaderRender = (0, import_react29.useMemo)(() => {
77100
+ const defaultHeaderRender = (0, import_react28.useMemo)(() => {
77107
77101
  if (renderHeader) {
77108
77102
  console.warn(
77109
77103
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
@@ -77117,7 +77111,7 @@ var require_dist2 = __commonJS({
77117
77111
  }
77118
77112
  return defaultRender;
77119
77113
  }, [renderHeader]);
77120
- const defaultHeaderActionsRender = (0, import_react29.useMemo)(() => {
77114
+ const defaultHeaderActionsRender = (0, import_react28.useMemo)(() => {
77121
77115
  if (renderHeaderActions) {
77122
77116
  console.warn(
77123
77117
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
@@ -77130,18 +77124,18 @@ var require_dist2 = __commonJS({
77130
77124
  }
77131
77125
  return defaultRender;
77132
77126
  }, [renderHeader]);
77133
- const loadedOverrides = (0, import_react29.useMemo)(() => {
77127
+ const loadedOverrides = (0, import_react28.useMemo)(() => {
77134
77128
  return loadOverrides({ overrides, plugins });
77135
77129
  }, [plugins]);
77136
- const CustomPuck = (0, import_react29.useMemo)(
77130
+ const CustomPuck = (0, import_react28.useMemo)(
77137
77131
  () => loadedOverrides.puck || defaultRender,
77138
77132
  [loadedOverrides]
77139
77133
  );
77140
- const CustomHeader = (0, import_react29.useMemo)(
77134
+ const CustomHeader = (0, import_react28.useMemo)(
77141
77135
  () => loadedOverrides.header || defaultHeaderRender,
77142
77136
  [loadedOverrides]
77143
77137
  );
77144
- const CustomHeaderActions = (0, import_react29.useMemo)(
77138
+ const CustomHeaderActions = (0, import_react28.useMemo)(
77145
77139
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
77146
77140
  [loadedOverrides]
77147
77141
  );
@@ -77514,7 +77508,7 @@ init_react_import();
77514
77508
 
77515
77509
  // src/HeadingAnalyzer.tsx
77516
77510
  init_react_import();
77517
- var import_react13 = require("react");
77511
+ var import_react12 = require("react");
77518
77512
  var import_core = __toESM(require_dist2());
77519
77513
 
77520
77514
  // ../core/components/SidebarSection/index.tsx
@@ -77926,29 +77920,16 @@ var scrollIntoView = (el) => {
77926
77920
  }
77927
77921
  };
77928
77922
 
77929
- // ../core/lib/use-frame.ts
77930
- init_react_import();
77931
- var import_react12 = require("react");
77932
-
77933
77923
  // ../core/lib/get-frame.ts
77934
77924
  init_react_import();
77935
77925
  var getFrame2 = () => {
77936
77926
  let frame = document.querySelector("#preview-frame");
77937
77927
  if ((frame == null ? void 0 : frame.tagName) === "IFRAME") {
77938
- frame = frame.contentDocument.body;
77928
+ frame = frame.contentDocument;
77939
77929
  }
77940
77930
  return frame;
77941
77931
  };
77942
77932
 
77943
- // ../core/lib/use-frame.ts
77944
- var useFrame = () => {
77945
- const [el, setEl] = (0, import_react12.useState)();
77946
- (0, import_react12.useEffect)(() => {
77947
- setEl(getFrame2());
77948
- }, []);
77949
- return el;
77950
- };
77951
-
77952
77933
  // src/HeadingAnalyzer.tsx
77953
77934
  var import_react_from_json = __toESM(require("react-from-json"));
77954
77935
  var import_jsx_runtime7 = require("react/jsx-runtime");
@@ -78007,10 +77988,10 @@ function buildHierarchy(frame) {
78007
77988
  }
78008
77989
  var HeadingAnalyzer = () => {
78009
77990
  const { appState } = (0, import_core.usePuck)();
78010
- const [hierarchy, setHierarchy] = (0, import_react13.useState)([]);
78011
- const [firstRender, setFirstRender] = (0, import_react13.useState)(true);
78012
- const frame = useFrame();
78013
- (0, import_react13.useEffect)(() => {
77991
+ const [hierarchy, setHierarchy] = (0, import_react12.useState)([]);
77992
+ const [firstRender, setFirstRender] = (0, import_react12.useState)(true);
77993
+ (0, import_react12.useEffect)(() => {
77994
+ const frame = getFrame2();
78014
77995
  if (!frame)
78015
77996
  return;
78016
77997
  if (firstRender) {
@@ -78021,7 +78002,7 @@ var HeadingAnalyzer = () => {
78021
78002
  } else {
78022
78003
  setHierarchy(buildHierarchy(frame));
78023
78004
  }
78024
- }, [appState.data.content, frame]);
78005
+ }, [appState.data.content]);
78025
78006
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
78026
78007
  hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: "No headings." }),
78027
78008
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
@@ -78035,6 +78016,7 @@ var HeadingAnalyzer = () => {
78035
78016
  {
78036
78017
  onClick: typeof props.analyzeId == "undefined" ? void 0 : (e2) => {
78037
78018
  e2.stopPropagation();
78019
+ const frame = getFrame2();
78038
78020
  const el = frame == null ? void 0 : frame.querySelector(
78039
78021
  `[${dataAttr}="${props.analyzeId}"]`
78040
78022
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck-plugin-heading-analyzer",
3
- "version": "0.14.0-canary.68f97ae",
3
+ "version": "0.14.0-canary.6cadfdb",
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.68f97ae",
21
+ "@measured/puck": "^0.14.0-canary.6cadfdb",
22
22
  "@types/react": "^18.2.0",
23
23
  "@types/react-dom": "^18.2.0",
24
24
  "eslint": "^7.32.0",