@puckeditor/core 0.21.1 → 0.21.2-canary.0bbe7fec

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 (41) hide show
  1. package/README.md +1 -1
  2. package/dist/{Editor-NK3TZSR6.mjs → Editor-G7Y32A5X.mjs} +9 -9
  3. package/dist/{actions-BkBoKAc5.d.mts → actions-C3e2nJ9v.d.mts} +2 -2
  4. package/dist/{actions-BkBoKAc5.d.ts → actions-C3e2nJ9v.d.ts} +2 -2
  5. package/dist/{chunk-PMXRXC2B.mjs → chunk-754HNMU2.mjs} +18 -11
  6. package/dist/{chunk-MSZPUXZP.mjs → chunk-7TULKVSG.mjs} +1 -1
  7. package/dist/{chunk-MDUBGHWF.mjs → chunk-BOKX3EBR.mjs} +3 -12
  8. package/dist/{chunk-EBISZQTK.mjs → chunk-DVS6IJRQ.mjs} +3794 -3733
  9. package/dist/{chunk-TNORMHZU.mjs → chunk-FOGDNETJ.mjs} +4 -4
  10. package/dist/{chunk-5V242HXR.mjs → chunk-MFEVRMA4.mjs} +7 -7
  11. package/dist/{chunk-SKJTJUWU.mjs → chunk-NBH4DF6Y.mjs} +1 -1
  12. package/dist/{chunk-RHVK562Z.mjs → chunk-OLGXKSQT.mjs} +3 -3
  13. package/dist/{chunk-KOUWDQ4Q.mjs → chunk-OYCFPEDG.mjs} +1 -1
  14. package/dist/{chunk-UMTU6EA7.mjs → chunk-RSOD4APZ.mjs} +20 -10
  15. package/dist/{chunk-37HTE4KO.mjs → chunk-YLLE6KXH.mjs} +1 -1
  16. package/dist/{full-KLPRWVS4.mjs → full-AG4GMB6M.mjs} +8 -8
  17. package/dist/{index-lt1zf5WR.d.ts → index-DAXMlG_V.d.mts} +2 -1
  18. package/dist/{index-bqD1SEOb.d.mts → index-s4HBwSMe.d.ts} +2 -1
  19. package/dist/index.d.mts +4 -4
  20. package/dist/index.d.ts +4 -4
  21. package/dist/index.js +228 -156
  22. package/dist/index.mjs +17 -12
  23. package/dist/internal.d.mts +2 -2
  24. package/dist/internal.d.ts +2 -2
  25. package/dist/internal.js +16 -11
  26. package/dist/internal.mjs +2 -2
  27. package/dist/{loaded-SJJ63OY2.mjs → loaded-JCBZ5OYD.mjs} +5 -5
  28. package/dist/{loaded-DIHUQBWF.mjs → loaded-VT5I2E7C.mjs} +5 -5
  29. package/dist/{loaded-362ACKSQ.mjs → loaded-YDSVEZZY.mjs} +5 -5
  30. package/dist/no-external.css +143 -147
  31. package/dist/no-external.d.mts +3 -3
  32. package/dist/no-external.d.ts +3 -3
  33. package/dist/no-external.js +226 -157
  34. package/dist/no-external.mjs +11 -11
  35. package/dist/rsc.d.mts +2 -2
  36. package/dist/rsc.d.ts +2 -2
  37. package/dist/rsc.js +50 -35
  38. package/dist/rsc.mjs +45 -27
  39. package/dist/{walk-tree-CRRDqx6_.d.mts → walk-tree-BJoNgZ0l.d.mts} +1 -1
  40. package/dist/{walk-tree-CS7sEpfG.d.ts → walk-tree-f8Yzs5o3.d.ts} +1 -1
  41. package/package.json +1 -1
@@ -1651,6 +1651,21 @@ var init_flatten_node = __esm({
1651
1651
  }
1652
1652
  });
1653
1653
 
1654
+ // lib/data/to-component.ts
1655
+ var toComponent;
1656
+ var init_to_component = __esm({
1657
+ "lib/data/to-component.ts"() {
1658
+ "use strict";
1659
+ init_react_import();
1660
+ toComponent = (item) => {
1661
+ return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
1662
+ props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
1663
+ type: "root"
1664
+ });
1665
+ };
1666
+ }
1667
+ });
1668
+
1654
1669
  // lib/data/walk-app-state.ts
1655
1670
  function walkAppState(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
1656
1671
  var _a;
@@ -1714,7 +1729,7 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
1714
1729
  id
1715
1730
  });
1716
1731
  processRelatedZones(item, id, path);
1717
- const newItem = __spreadProps(__spreadValues({}, item), { props: newProps });
1732
+ const newItem = __spreadProps(__spreadValues({}, mappedItem), { props: newProps });
1718
1733
  const thisZoneCompound = path[path.length - 1];
1719
1734
  const [parentId, zone] = thisZoneCompound ? thisZoneCompound.split(":") : [null, ""];
1720
1735
  newNodeIndex[id] = {
@@ -1754,17 +1769,14 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
1754
1769
  );
1755
1770
  newZones[zoneCompound] = newContent2;
1756
1771
  }, newZones);
1757
- const processedRoot = processItem(
1758
- {
1759
- type: "root",
1760
- props: __spreadProps(__spreadValues({}, (_a = state.data.root.props) != null ? _a : state.data.root), { id: "root" })
1761
- },
1762
- [],
1763
- -1
1764
- );
1765
- const root = __spreadProps(__spreadValues({}, state.data.root), {
1766
- props: processedRoot.props
1772
+ let rootAsComponent = toComponent({
1773
+ props: __spreadValues({}, (_a = state.data.root.props) != null ? _a : state.data.root)
1767
1774
  });
1775
+ if (state.data.root.readOnly) {
1776
+ rootAsComponent.readOnly = state.data.root.readOnly;
1777
+ }
1778
+ const processedRoot = processItem(rootAsComponent, [], -1);
1779
+ const root = __spreadValues(__spreadValues({}, state.data.root), processedRoot);
1768
1780
  return __spreadProps(__spreadValues({}, state), {
1769
1781
  data: {
1770
1782
  root,
@@ -1785,6 +1797,7 @@ var init_walk_app_state = __esm({
1785
1797
  init_root_droppable_id();
1786
1798
  init_map_fields();
1787
1799
  init_flatten_node();
1800
+ init_to_component();
1788
1801
  }
1789
1802
  });
1790
1803
 
@@ -2566,7 +2579,8 @@ var init_use_hotkey = __esm({
2566
2579
  KeyY: "y",
2567
2580
  KeyZ: "z",
2568
2581
  Delete: "delete",
2569
- Backspace: "backspace"
2582
+ Backspace: "backspace",
2583
+ AltRight: "altRight"
2570
2584
  };
2571
2585
  useHotkeyStore = (0, import_zustand3.create)()(
2572
2586
  (0, import_middleware2.subscribeWithSelector)((set) => ({
@@ -2579,6 +2593,10 @@ var init_use_hotkey = __esm({
2579
2593
  );
2580
2594
  monitorHotkeys = (doc) => {
2581
2595
  const onKeyDown = (e) => {
2596
+ if (e.getModifierState("AltGraph")) {
2597
+ useHotkeyStore.getState().hold("altRight");
2598
+ return;
2599
+ }
2582
2600
  const key = keyCodeMap[e.code];
2583
2601
  if (key) {
2584
2602
  useHotkeyStore.getState().hold(key);
@@ -2602,6 +2620,10 @@ var init_use_hotkey = __esm({
2602
2620
  }
2603
2621
  };
2604
2622
  const onKeyUp = (e) => {
2623
+ if (!e.getModifierState("AltGraph") && e.code === "ControlRight") {
2624
+ useHotkeyStore.getState().release("altRight");
2625
+ return;
2626
+ }
2605
2627
  const key = keyCodeMap[e.code];
2606
2628
  if (key) {
2607
2629
  if (key === "meta") {
@@ -2677,12 +2699,12 @@ function useRegisterHistorySlice(appStore, {
2677
2699
  const forward = () => {
2678
2700
  appStore.getState().history.forward();
2679
2701
  };
2680
- useHotkey({ meta: true, z: true }, back);
2681
- useHotkey({ meta: true, shift: true, z: true }, forward);
2682
- useHotkey({ meta: true, y: true }, forward);
2683
- useHotkey({ ctrl: true, z: true }, back);
2684
- useHotkey({ ctrl: true, shift: true, z: true }, forward);
2685
- useHotkey({ ctrl: true, y: true }, forward);
2702
+ useHotkey({ altRight: false, meta: true, z: true }, back);
2703
+ useHotkey({ altRight: false, meta: true, shift: true, z: true }, forward);
2704
+ useHotkey({ altRight: false, meta: true, y: true }, forward);
2705
+ useHotkey({ altRight: false, ctrl: true, z: true }, back);
2706
+ useHotkey({ altRight: false, ctrl: true, shift: true, z: true }, forward);
2707
+ useHotkey({ altRight: false, ctrl: true, y: true }, forward);
2686
2708
  }
2687
2709
  var import_react7, EMPTY_HISTORY_INDEX, tidyState, createHistorySlice;
2688
2710
  var init_history = __esm({
@@ -3110,21 +3132,6 @@ var init_fields = __esm({
3110
3132
  }
3111
3133
  });
3112
3134
 
3113
- // lib/data/to-component.ts
3114
- var toComponent;
3115
- var init_to_component = __esm({
3116
- "lib/data/to-component.ts"() {
3117
- "use strict";
3118
- init_react_import();
3119
- toComponent = (item) => {
3120
- return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
3121
- props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
3122
- type: "root"
3123
- });
3124
- };
3125
- }
3126
- });
3127
-
3128
3135
  // lib/resolve-component-data.ts
3129
3136
  var import_fast_equals2, cache, resolveComponentData;
3130
3137
  var init_resolve_component_data = __esm({
@@ -3320,6 +3327,7 @@ var init_store = __esm({
3320
3327
  },
3321
3328
  status: "LOADING",
3322
3329
  iframe: {},
3330
+ _experimentalFullScreenCanvas: false,
3323
3331
  metadata: {},
3324
3332
  fieldTransforms: {}
3325
3333
  }, initialAppStore), {
@@ -6298,8 +6306,39 @@ var SubFieldInternal = ({
6298
6306
  };
6299
6307
  var SubField = (0, import_react16.memo)(SubFieldInternal);
6300
6308
 
6301
- // bundle/index.ts
6309
+ // lib/data/set-deep.ts
6302
6310
  init_react_import();
6311
+ function setDeep(node, path, newVal) {
6312
+ const parts = path.split(".");
6313
+ const newNode = __spreadValues({}, node);
6314
+ let cur = newNode;
6315
+ for (let i = 0; i < parts.length; i++) {
6316
+ const [prop, idxStr] = parts[i].replace("]", "").split("[");
6317
+ const isLast = i === parts.length - 1;
6318
+ if (idxStr !== void 0) {
6319
+ if (!Array.isArray(cur[prop])) {
6320
+ cur[prop] = [];
6321
+ }
6322
+ const idx = Number(idxStr);
6323
+ if (isLast) {
6324
+ cur[prop][idx] = newVal;
6325
+ continue;
6326
+ }
6327
+ if (cur[prop][idx] === void 0) cur[prop][idx] = {};
6328
+ cur = cur[prop][idx];
6329
+ continue;
6330
+ }
6331
+ if (isLast) {
6332
+ cur[prop] = newVal;
6333
+ continue;
6334
+ }
6335
+ if (cur[prop] === void 0) {
6336
+ cur[prop] = {};
6337
+ }
6338
+ cur = cur[prop];
6339
+ }
6340
+ return __spreadValues(__spreadValues({}, node), newNode);
6341
+ }
6303
6342
 
6304
6343
  // components/AutoField/fields/ArrayField/index.tsx
6305
6344
  var import_jsx_runtime9 = require("react/jsx-runtime");
@@ -6368,9 +6407,10 @@ var ArrayFieldItemInternal = ({
6368
6407
  {
6369
6408
  ref: handleRef,
6370
6409
  onClick: (e) => {
6371
- if (isDragging || !hasVisibleFields) return;
6410
+ if (isDragging) return;
6372
6411
  e.preventDefault();
6373
6412
  e.stopPropagation();
6413
+ if (!hasVisibleFields) return;
6374
6414
  onToggleExpand(id, isExpanded);
6375
6415
  },
6376
6416
  className: getClassNameItem("summary"),
@@ -6734,10 +6774,13 @@ var useLocalValue = (path, onChange) => {
6734
6774
  const value = useDeepField(path);
6735
6775
  const isFocused = useIsFocused(path);
6736
6776
  const [localValue, setLocalValue] = (0, import_react18.useState)(value == null ? void 0 : value.toString());
6737
- const onChangeLocal = (0, import_react18.useCallback)((val) => {
6738
- setLocalValue(val);
6739
- onChange(val);
6740
- }, []);
6777
+ const onChangeLocal = (0, import_react18.useCallback)(
6778
+ (val) => {
6779
+ setLocalValue(val);
6780
+ onChange(val);
6781
+ },
6782
+ [onChange]
6783
+ );
6741
6784
  (0, import_react18.useEffect)(() => {
6742
6785
  if (!isFocused) {
6743
6786
  setLocalValue(value);
@@ -7930,21 +7973,6 @@ var import_shallow4 = require("zustand/react/shallow");
7930
7973
  init_get_item();
7931
7974
  var import_sortable2 = require("@dnd-kit/react/sortable");
7932
7975
 
7933
- // lib/accumulate-transform.ts
7934
- init_react_import();
7935
- function accumulateTransform(el) {
7936
- let matrix = new DOMMatrixReadOnly();
7937
- let n = el.parentElement;
7938
- while (n && n !== document.documentElement) {
7939
- const t = getComputedStyle(n).transform;
7940
- if (t && t !== "none") {
7941
- matrix = new DOMMatrixReadOnly(t).multiply(matrix);
7942
- }
7943
- n = n.parentElement;
7944
- }
7945
- return { scaleX: matrix.a, scaleY: matrix.d };
7946
- }
7947
-
7948
7976
  // lib/dnd/use-on-drag-finished.ts
7949
7977
  init_react_import();
7950
7978
  var import_react50 = require("react");
@@ -7983,6 +8011,7 @@ init_RichTextMenu();
7983
8011
  var import_jsx_runtime56 = require("react/jsx-runtime");
7984
8012
  var getClassName21 = get_class_name_factory_default("DraggableComponent", styles_module_default15);
7985
8013
  var DEBUG2 = false;
8014
+ var MEASURE_EVERY_MS = 100;
7986
8015
  var space = 8;
7987
8016
  var actionsOverlayTop = space * 6.5;
7988
8017
  var actionsTop = -(actionsOverlayTop - 8);
@@ -8022,9 +8051,13 @@ var DraggableComponent = ({
8022
8051
  return ((_a = s.selectedItem) == null ? void 0 : _a.props.id) === id ? s.zoomConfig.zoom : 1;
8023
8052
  }
8024
8053
  );
8054
+ const _experimentalFullScreenCanvas = useAppStore(
8055
+ (s) => s._experimentalFullScreenCanvas
8056
+ );
8025
8057
  const overrides = useAppStore((s) => s.overrides);
8026
8058
  const dispatch = useAppStore((s) => s.dispatch);
8027
8059
  const iframe = useAppStore((s) => s.iframe);
8060
+ const lastMeasureRef = (0, import_react51.useRef)(0);
8028
8061
  const ctx = (0, import_react51.useContext)(dropZoneContext);
8029
8062
  const [localZones, setLocalZones] = (0, import_react51.useState)({});
8030
8063
  const registerLocalZone = (0, import_react51.useCallback)(
@@ -8129,45 +8162,71 @@ var DraggableComponent = ({
8129
8162
  setPortalEl(
8130
8163
  iframe.enabled ? (_a = ref.current) == null ? void 0 : _a.ownerDocument.body : (_c = (_b = ref.current) == null ? void 0 : _b.closest("[data-puck-preview]")) != null ? _c : document.body
8131
8164
  );
8132
- }, [iframe.enabled, ref.current]);
8165
+ }, [iframe.enabled]);
8133
8166
  const getStyle = (0, import_react51.useCallback)(() => {
8134
- var _a, _b, _c;
8167
+ var _a, _b;
8135
8168
  if (!ref.current) return;
8136
- const rect = ref.current.getBoundingClientRect();
8137
- const deepScrollPosition = getDeepScrollPosition(ref.current);
8138
- const portalContainerEl = iframe.enabled ? null : (_a = ref.current) == null ? void 0 : _a.closest("[data-puck-preview]");
8169
+ const el = ref.current;
8170
+ const rect = el.getBoundingClientRect();
8171
+ const portalContainerEl = iframe.enabled ? null : el.closest("[data-puck-preview]");
8172
+ const targetIsFixed = (() => {
8173
+ let node = el;
8174
+ while (node && node !== document.documentElement) {
8175
+ if (getComputedStyle(node).position === "fixed") {
8176
+ return true;
8177
+ }
8178
+ node = node.parentElement;
8179
+ }
8180
+ return false;
8181
+ })();
8139
8182
  const portalContainerRect = portalContainerEl == null ? void 0 : portalContainerEl.getBoundingClientRect();
8140
8183
  const portalScroll = portalContainerEl ? getDeepScrollPosition(portalContainerEl) : { x: 0, y: 0 };
8141
- const scroll = {
8142
- x: deepScrollPosition.x - portalScroll.x - ((_b = portalContainerRect == null ? void 0 : portalContainerRect.left) != null ? _b : 0),
8143
- y: deepScrollPosition.y - portalScroll.y - ((_c = portalContainerRect == null ? void 0 : portalContainerRect.top) != null ? _c : 0)
8184
+ const deepScrollPosition = targetIsFixed ? { x: 0, y: 0 } : getDeepScrollPosition(el);
8185
+ const scroll = targetIsFixed ? { x: 0, y: 0 } : {
8186
+ x: deepScrollPosition.x - portalScroll.x - ((_a = portalContainerRect == null ? void 0 : portalContainerRect.left) != null ? _a : 0),
8187
+ y: deepScrollPosition.y - portalScroll.y - ((_b = portalContainerRect == null ? void 0 : portalContainerRect.top) != null ? _b : 0)
8144
8188
  };
8145
- const untransformed = {
8146
- height: ref.current.offsetHeight,
8147
- width: ref.current.offsetWidth
8148
- };
8149
- const transform = accumulateTransform(ref.current);
8150
8189
  const style2 = {
8151
- left: `${(rect.left + scroll.x) / transform.scaleX}px`,
8152
- top: `${(rect.top + scroll.y) / transform.scaleY}px`,
8153
- height: `${untransformed.height}px`,
8154
- width: `${untransformed.width}px`
8190
+ left: `${rect.left + scroll.x}px`,
8191
+ top: `${rect.top + scroll.y}px`,
8192
+ height: `${rect.height}px`,
8193
+ width: `${rect.width}px`,
8194
+ position: targetIsFixed ? "fixed" : void 0
8155
8195
  };
8156
8196
  return style2;
8157
- }, [ref.current]);
8197
+ }, [iframe.enabled]);
8158
8198
  const [style, setStyle] = (0, import_react51.useState)();
8199
+ const lastRectRef = (0, import_react51.useRef)(null);
8200
+ const syncRafRef = (0, import_react51.useRef)(null);
8159
8201
  const sync = (0, import_react51.useCallback)(() => {
8160
8202
  setStyle(getStyle());
8161
- }, [ref.current, iframe]);
8203
+ }, [getStyle]);
8204
+ const scheduleSync = (0, import_react51.useCallback)(() => {
8205
+ if (syncRafRef.current != null) return;
8206
+ syncRafRef.current = requestAnimationFrame(() => {
8207
+ syncRafRef.current = null;
8208
+ sync();
8209
+ });
8210
+ }, [sync]);
8211
+ (0, import_react51.useEffect)(() => {
8212
+ return () => {
8213
+ if (syncRafRef.current != null) {
8214
+ cancelAnimationFrame(syncRafRef.current);
8215
+ syncRafRef.current = null;
8216
+ }
8217
+ };
8218
+ }, []);
8162
8219
  (0, import_react51.useEffect)(() => {
8163
8220
  if (ref.current) {
8164
- const observer = new ResizeObserver(sync);
8221
+ const observer = new ResizeObserver(() => {
8222
+ scheduleSync();
8223
+ });
8165
8224
  observer.observe(ref.current);
8166
8225
  return () => {
8167
8226
  observer.disconnect();
8168
8227
  };
8169
8228
  }
8170
- }, [ref.current]);
8229
+ }, [scheduleSync]);
8171
8230
  const registerNode = useAppStore((s) => s.nodes.registerNode);
8172
8231
  const hideOverlay = (0, import_react51.useCallback)(() => {
8173
8232
  setIsVisible(false);
@@ -8206,11 +8265,11 @@ var DraggableComponent = ({
8206
8265
  if (!el.closest("[data-puck-overlay-portal]")) {
8207
8266
  e.stopPropagation();
8208
8267
  }
8209
- if (isSelected) {
8268
+ if (_experimentalFullScreenCanvas) {
8210
8269
  dispatch({
8211
8270
  type: "setUi",
8212
8271
  ui: {
8213
- itemSelector: null
8272
+ itemSelector: isSelected ? null : { index, zone: zoneCompound }
8214
8273
  }
8215
8274
  });
8216
8275
  } else {
@@ -8222,7 +8281,7 @@ var DraggableComponent = ({
8222
8281
  });
8223
8282
  }
8224
8283
  },
8225
- [index, zoneCompound, id, isSelected]
8284
+ [index, zoneCompound, id, isSelected, _experimentalFullScreenCanvas]
8226
8285
  );
8227
8286
  const appStore = useAppStoreApi();
8228
8287
  const onSelectParent = (0, import_react51.useCallback)(() => {
@@ -8316,7 +8375,7 @@ var DraggableComponent = ({
8316
8375
  (0, import_react51.useEffect)(() => {
8317
8376
  startTransition(() => {
8318
8377
  if (hover || indicativeHover || isSelected) {
8319
- sync();
8378
+ scheduleSync();
8320
8379
  setIsVisible(true);
8321
8380
  setThisWasDragging(false);
8322
8381
  } else {
@@ -8343,6 +8402,43 @@ var DraggableComponent = ({
8343
8402
  (0, import_react51.useEffect)(() => {
8344
8403
  if (thisWasDragging) return onDragFinished();
8345
8404
  }, [thisWasDragging, onDragFinished]);
8405
+ (0, import_react51.useEffect)(() => {
8406
+ if (!dragFinished || !(isSelected || thisIsDragging)) return;
8407
+ const el = ref.current;
8408
+ if (!el) return;
8409
+ const doc = el.ownerDocument;
8410
+ const view = doc.defaultView;
8411
+ if (!view) return;
8412
+ lastMeasureRef.current = 0;
8413
+ scheduleSync();
8414
+ const onScroll = () => scheduleSync();
8415
+ const onResize = () => scheduleSync();
8416
+ doc.addEventListener("scroll", onScroll, true);
8417
+ view.addEventListener("resize", onResize);
8418
+ let frame = 0;
8419
+ const tick = (t) => {
8420
+ if (t - lastMeasureRef.current >= MEASURE_EVERY_MS) {
8421
+ lastMeasureRef.current = t;
8422
+ const node = ref.current;
8423
+ if (node) {
8424
+ const rect = node.getBoundingClientRect();
8425
+ const prev = lastRectRef.current;
8426
+ const changed = !prev || Math.abs(rect.x - prev.x) > 0.5 || Math.abs(rect.y - prev.y) > 0.5 || Math.abs(rect.width - prev.width) > 0.5 || Math.abs(rect.height - prev.height) > 0.5;
8427
+ if (changed) {
8428
+ lastRectRef.current = rect;
8429
+ scheduleSync();
8430
+ }
8431
+ }
8432
+ }
8433
+ frame = requestAnimationFrame(tick);
8434
+ };
8435
+ frame = requestAnimationFrame(tick);
8436
+ return () => {
8437
+ doc.removeEventListener("scroll", onScroll, true);
8438
+ view.removeEventListener("resize", onResize);
8439
+ cancelAnimationFrame(frame);
8440
+ };
8441
+ }, [dragFinished, isSelected, thisIsDragging, scheduleSync]);
8346
8442
  const syncActionsPosition = (0, import_react51.useCallback)(
8347
8443
  (el) => {
8348
8444
  if (el) {
@@ -9118,40 +9214,6 @@ var styles_module_default17 = { "InlineTextField": "_InlineTextField_104qp_1" };
9118
9214
  // components/InlineTextField/index.tsx
9119
9215
  init_lib();
9120
9216
 
9121
- // lib/data/set-deep.ts
9122
- init_react_import();
9123
- function setDeep(node, path, newVal) {
9124
- const parts = path.split(".");
9125
- const newNode = __spreadValues({}, node);
9126
- let cur = newNode;
9127
- for (let i = 0; i < parts.length; i++) {
9128
- const [prop, idxStr] = parts[i].replace("]", "").split("[");
9129
- const isLast = i === parts.length - 1;
9130
- if (idxStr !== void 0) {
9131
- if (!Array.isArray(cur[prop])) {
9132
- cur[prop] = [];
9133
- }
9134
- const idx = Number(idxStr);
9135
- if (isLast) {
9136
- cur[prop][idx] = newVal;
9137
- continue;
9138
- }
9139
- if (cur[prop][idx] === void 0) cur[prop][idx] = {};
9140
- cur = cur[prop][idx];
9141
- continue;
9142
- }
9143
- if (isLast) {
9144
- cur[prop] = newVal;
9145
- continue;
9146
- }
9147
- if (cur[prop] === void 0) {
9148
- cur[prop] = {};
9149
- }
9150
- cur = cur[prop];
9151
- }
9152
- return __spreadValues(__spreadValues({}, node), newNode);
9153
- }
9154
-
9155
9217
  // lib/get-selector-for-id.ts
9156
9218
  init_react_import();
9157
9219
  var getSelectorForId = (state, id) => {
@@ -10503,24 +10565,9 @@ var DragDropContextClient = ({
10503
10565
  zoneStore.setState({ draggedItem: null });
10504
10566
  if (event.canceled || (target == null ? void 0 : target.type) === "void") {
10505
10567
  zoneStore.setState({ previewIndex: {} });
10506
- if (thisPreview) {
10507
- zoneStore.setState({ previewIndex: {} });
10508
- if (thisPreview.type === "insert") {
10509
- insertComponent(
10510
- thisPreview.componentType,
10511
- thisPreview.zone,
10512
- thisPreview.index,
10513
- appStore
10514
- );
10515
- } else if (initialSelector.current) {
10516
- moveComponent(
10517
- thisPreview.props.id,
10518
- initialSelector.current,
10519
- thisPreview,
10520
- appStore
10521
- );
10522
- }
10523
- }
10568
+ (_a2 = dragListeners.dragend) == null ? void 0 : _a2.forEach((fn) => {
10569
+ fn(event, manager);
10570
+ });
10524
10571
  dispatch({
10525
10572
  type: "setUi",
10526
10573
  ui: {
@@ -10528,9 +10575,6 @@ var DragDropContextClient = ({
10528
10575
  isDragging: false
10529
10576
  }
10530
10577
  });
10531
- (_a2 = dragListeners.dragend) == null ? void 0 : _a2.forEach((fn) => {
10532
- fn(event, manager);
10533
- });
10534
10578
  return;
10535
10579
  }
10536
10580
  if (thisPreview) {
@@ -10543,14 +10587,12 @@ var DragDropContextClient = ({
10543
10587
  appStore
10544
10588
  );
10545
10589
  } else if (initialSelector.current) {
10546
- dispatch({
10547
- type: "move",
10548
- sourceIndex: initialSelector.current.index,
10549
- sourceZone: initialSelector.current.zone,
10550
- destinationIndex: thisPreview.index,
10551
- destinationZone: thisPreview.zone,
10552
- recordHistory: false
10553
- });
10590
+ moveComponent(
10591
+ thisPreview.props.id,
10592
+ initialSelector.current,
10593
+ thisPreview,
10594
+ appStore
10595
+ );
10554
10596
  }
10555
10597
  }
10556
10598
  dispatch({
@@ -10559,7 +10601,7 @@ var DragDropContextClient = ({
10559
10601
  itemSelector: { index, zone },
10560
10602
  isDragging: false
10561
10603
  },
10562
- recordHistory: true
10604
+ recordHistory: false
10563
10605
  });
10564
10606
  (_b2 = dragListeners.dragend) == null ? void 0 : _b2.forEach((fn) => {
10565
10607
  fn(event, manager);
@@ -11406,20 +11448,28 @@ var CopyHostStyles = ({
11406
11448
  filtered.forEach((mirror) => {
11407
11449
  mirror.onload = () => {
11408
11450
  stylesLoaded = stylesLoaded + 1;
11409
- if (stylesLoaded >= elements.length) {
11451
+ if (stylesLoaded >= filtered.length) {
11410
11452
  onStylesLoaded();
11411
11453
  }
11412
11454
  };
11413
11455
  mirror.onerror = () => {
11414
11456
  console.warn(`AutoFrame couldn't load a stylesheet`);
11415
11457
  stylesLoaded = stylesLoaded + 1;
11416
- if (stylesLoaded >= elements.length) {
11458
+ if (stylesLoaded >= filtered.length) {
11417
11459
  onStylesLoaded();
11418
11460
  }
11419
11461
  };
11420
11462
  });
11421
11463
  doc.head.innerHTML = "";
11422
11464
  doc.head.append(...filtered);
11465
+ filtered.forEach((mirror) => {
11466
+ if (mirror.nodeName === "STYLE") {
11467
+ stylesLoaded = stylesLoaded + 1;
11468
+ }
11469
+ });
11470
+ if (stylesLoaded >= filtered.length) {
11471
+ onStylesLoaded();
11472
+ }
11423
11473
  observer.observe(parentDocument.head, { childList: true, subtree: true });
11424
11474
  filtered.forEach((el) => {
11425
11475
  const elHash = (0, import_object_hash.default)(el.outerHTML);
@@ -12776,12 +12826,10 @@ var getClassName36 = get_class_name_factory_default("PuckCanvas", styles_module_
12776
12826
  var ZOOM_ON_CHANGE = true;
12777
12827
  var TRANSITION_DURATION = 150;
12778
12828
  var Canvas = () => {
12829
+ var _a;
12779
12830
  const { frameRef } = useCanvasFrame();
12780
12831
  const resetAutoZoom = useResetAutoZoom(frameRef);
12781
- const {
12782
- _experimentalFullScreenCanvas,
12783
- viewports: viewportOptions = defaultViewports
12784
- } = usePropsContext();
12832
+ const { viewports: viewportOptions = defaultViewports, ui: uiProp } = usePropsContext();
12785
12833
  const {
12786
12834
  dispatch,
12787
12835
  overrides,
@@ -12789,7 +12837,8 @@ var Canvas = () => {
12789
12837
  zoomConfig,
12790
12838
  setZoomConfig,
12791
12839
  status,
12792
- iframe
12840
+ iframe,
12841
+ _experimentalFullScreenCanvas
12793
12842
  } = useAppStore(
12794
12843
  (0, import_shallow10.useShallow)((s) => ({
12795
12844
  dispatch: s.dispatch,
@@ -12798,7 +12847,8 @@ var Canvas = () => {
12798
12847
  zoomConfig: s.zoomConfig,
12799
12848
  setZoomConfig: s.setZoomConfig,
12800
12849
  status: s.status,
12801
- iframe: s.iframe
12850
+ iframe: s.iframe,
12851
+ _experimentalFullScreenCanvas: s._experimentalFullScreenCanvas
12802
12852
  }))
12803
12853
  );
12804
12854
  const {
@@ -12877,10 +12927,11 @@ var Canvas = () => {
12877
12927
  }, []);
12878
12928
  const appStoreApi = useAppStoreApi();
12879
12929
  (0, import_react88.useEffect)(() => {
12880
- var _a;
12930
+ var _a2, _b;
12881
12931
  if (typeof window === "undefined") return;
12932
+ if ((_a2 = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _a2.current) return;
12882
12933
  const viewportWidth = window.innerWidth;
12883
- const frameWidth = (_a = frameRef.current) == null ? void 0 : _a.getBoundingClientRect().width;
12934
+ const frameWidth = (_b = frameRef.current) == null ? void 0 : _b.getBoundingClientRect().width;
12884
12935
  if (!viewportWidth) return;
12885
12936
  if (!frameWidth) return;
12886
12937
  if (viewportOptions.length === 0) return;
@@ -12919,7 +12970,13 @@ var Canvas = () => {
12919
12970
  }
12920
12971
  appStoreApi.setState(__spreadProps(__spreadValues({}, appState), { history }));
12921
12972
  }
12922
- }, [viewportOptions, frameRef.current, iframe, appStoreApi]);
12973
+ }, [
12974
+ viewportOptions,
12975
+ frameRef.current,
12976
+ iframe,
12977
+ appStoreApi,
12978
+ (_a = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _a.current
12979
+ ]);
12923
12980
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
12924
12981
  "div",
12925
12982
  {
@@ -12934,7 +12991,7 @@ var Canvas = () => {
12934
12991
  dispatch({
12935
12992
  type: "setUi",
12936
12993
  ui: { itemSelector: null },
12937
- recordHistory: true
12994
+ recordHistory: false
12938
12995
  });
12939
12996
  }
12940
12997
  },
@@ -13672,7 +13729,8 @@ function PuckProvider({ children }) {
13672
13729
  initialHistory: _initialHistory,
13673
13730
  metadata,
13674
13731
  onAction,
13675
- fieldTransforms
13732
+ fieldTransforms,
13733
+ _experimentalFullScreenCanvas
13676
13734
  } = usePropsContext();
13677
13735
  const iframe = (0, import_react93.useMemo)(
13678
13736
  () => __spreadValues({
@@ -13765,6 +13823,7 @@ function PuckProvider({ children }) {
13765
13823
  overrides: loadedOverrides,
13766
13824
  viewports,
13767
13825
  iframe,
13826
+ _experimentalFullScreenCanvas: !!_experimentalFullScreenCanvas,
13768
13827
  onAction,
13769
13828
  metadata,
13770
13829
  fieldTransforms: loadedFieldTransforms
@@ -13778,6 +13837,7 @@ function PuckProvider({ children }) {
13778
13837
  loadedOverrides,
13779
13838
  viewports,
13780
13839
  iframe,
13840
+ _experimentalFullScreenCanvas,
13781
13841
  onAction,
13782
13842
  metadata,
13783
13843
  loadedFieldTransforms
@@ -13794,7 +13854,16 @@ function PuckProvider({ children }) {
13794
13854
  (0, import_react93.useEffect)(() => {
13795
13855
  const state = appStore.getState().state;
13796
13856
  appStore.setState(__spreadValues({}, generateAppStore(state)));
13797
- }, [config, plugins, loadedOverrides, viewports, iframe, onAction, metadata]);
13857
+ }, [
13858
+ config,
13859
+ plugins,
13860
+ loadedOverrides,
13861
+ viewports,
13862
+ iframe,
13863
+ _experimentalFullScreenCanvas,
13864
+ onAction,
13865
+ metadata
13866
+ ]);
13798
13867
  useRegisterHistorySlice(appStore, {
13799
13868
  histories: blendedHistories,
13800
13869
  index: initialHistoryIndex,