@puckeditor/core 0.21.1 → 0.21.2-canary.2fa198e1

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-JHS34JLP.mjs} +9 -9
  3. package/dist/{actions-BkBoKAc5.d.mts → actions-BRYM0ifH.d.mts} +1 -1
  4. package/dist/{actions-BkBoKAc5.d.ts → actions-BRYM0ifH.d.ts} +1 -1
  5. package/dist/{chunk-5V242HXR.mjs → chunk-46RDHJGL.mjs} +7 -7
  6. package/dist/{chunk-PMXRXC2B.mjs → chunk-754HNMU2.mjs} +18 -11
  7. package/dist/{chunk-UMTU6EA7.mjs → chunk-AFOEZCNE.mjs} +19 -10
  8. package/dist/{chunk-MDUBGHWF.mjs → chunk-BOKX3EBR.mjs} +3 -12
  9. package/dist/{chunk-KOUWDQ4Q.mjs → chunk-BSAENBPL.mjs} +1 -1
  10. package/dist/{chunk-TNORMHZU.mjs → chunk-FOGDNETJ.mjs} +4 -4
  11. package/dist/{chunk-RHVK562Z.mjs → chunk-GYDP2UKB.mjs} +3 -3
  12. package/dist/{chunk-MSZPUXZP.mjs → chunk-JGZBBNEW.mjs} +1 -1
  13. package/dist/{chunk-EBISZQTK.mjs → chunk-LBGOSTI5.mjs} +3642 -3627
  14. package/dist/{chunk-SKJTJUWU.mjs → chunk-TVE6QYBR.mjs} +1 -1
  15. package/dist/{chunk-37HTE4KO.mjs → chunk-YLLE6KXH.mjs} +1 -1
  16. package/dist/{full-KLPRWVS4.mjs → full-ATSD2DNB.mjs} +8 -8
  17. package/dist/{index-bqD1SEOb.d.mts → index-BVLGipsj.d.mts} +1 -1
  18. package/dist/{index-lt1zf5WR.d.ts → index-D_Idfrfb.d.ts} +1 -1
  19. package/dist/index.d.mts +4 -4
  20. package/dist/index.d.ts +4 -4
  21. package/dist/index.js +99 -74
  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-2765LE3N.mjs} +5 -5
  28. package/dist/{loaded-362ACKSQ.mjs → loaded-ANEJLSYJ.mjs} +5 -5
  29. package/dist/{loaded-DIHUQBWF.mjs → loaded-BKAMJ2FS.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 +97 -75
  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 +8 -11
  38. package/dist/rsc.mjs +3 -3
  39. package/dist/{walk-tree-CRRDqx6_.d.mts → walk-tree-C1Zdgx7d.d.mts} +1 -1
  40. package/dist/{walk-tree-CS7sEpfG.d.ts → walk-tree-DQyC1GA7.d.ts} +1 -1
  41. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  List,
3
3
  ListOrdered
4
- } from "./chunk-UMTU6EA7.mjs";
4
+ } from "./chunk-AFOEZCNE.mjs";
5
5
  import {
6
6
  init_react_import
7
7
  } from "./chunk-M6W7YEVX.mjs";
@@ -4,7 +4,7 @@ import {
4
4
  setupZone,
5
5
  walkAppState,
6
6
  walkTree
7
- } from "./chunk-PMXRXC2B.mjs";
7
+ } from "./chunk-754HNMU2.mjs";
8
8
  import {
9
9
  __spreadProps,
10
10
  __spreadValues,
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  LoadedRichTextMenuInner
3
- } from "./chunk-5V242HXR.mjs";
4
- import "./chunk-MSZPUXZP.mjs";
5
- import "./chunk-KOUWDQ4Q.mjs";
6
- import "./chunk-SKJTJUWU.mjs";
7
- import "./chunk-UMTU6EA7.mjs";
8
- import "./chunk-37HTE4KO.mjs";
9
- import "./chunk-MDUBGHWF.mjs";
3
+ } from "./chunk-46RDHJGL.mjs";
4
+ import "./chunk-JGZBBNEW.mjs";
5
+ import "./chunk-BSAENBPL.mjs";
6
+ import "./chunk-TVE6QYBR.mjs";
7
+ import "./chunk-AFOEZCNE.mjs";
8
+ import "./chunk-YLLE6KXH.mjs";
9
+ import "./chunk-BOKX3EBR.mjs";
10
10
  import "./chunk-Y2EFNT5P.mjs";
11
- import "./chunk-PMXRXC2B.mjs";
11
+ import "./chunk-754HNMU2.mjs";
12
12
  import {
13
13
  __spreadValues,
14
14
  init_react_import
@@ -1,4 +1,4 @@
1
- import { H as History, g as Permissions, c as ComponentData, C as Config, U as UserGenerics, F as Fields, a as PuckAction, h as RootDataWithProps, i as ResolveDataTrigger, j as Plugin, k as Overrides, V as Viewports, I as IframeConfig, l as UiState, m as ComponentConfig, A as AppState, M as Metadata, n as FieldTransforms, o as RichtextField } from './actions-BkBoKAc5.mjs';
1
+ import { H as History, g as Permissions, c as ComponentData, C as Config, U as UserGenerics, F as Fields, a as PuckAction, h as RootDataWithProps, i as ResolveDataTrigger, j as Plugin, k as Overrides, V as Viewports, I as IframeConfig, l as UiState, m as ComponentConfig, A as AppState, M as Metadata, n as FieldTransforms, o as RichtextField } from './actions-BRYM0ifH.mjs';
2
2
  import { Editor } from '@tiptap/react';
3
3
 
4
4
  type HistorySlice<D = any> = {
@@ -1,4 +1,4 @@
1
- import { H as History, g as Permissions, c as ComponentData, C as Config, U as UserGenerics, F as Fields, a as PuckAction, h as RootDataWithProps, i as ResolveDataTrigger, j as Plugin, k as Overrides, V as Viewports, I as IframeConfig, l as UiState, m as ComponentConfig, A as AppState, M as Metadata, n as FieldTransforms, o as RichtextField } from './actions-BkBoKAc5.js';
1
+ import { H as History, g as Permissions, c as ComponentData, C as Config, U as UserGenerics, F as Fields, a as PuckAction, h as RootDataWithProps, i as ResolveDataTrigger, j as Plugin, k as Overrides, V as Viewports, I as IframeConfig, l as UiState, m as ComponentConfig, A as AppState, M as Metadata, n as FieldTransforms, o as RichtextField } from './actions-BRYM0ifH.js';
2
2
  import { Editor } from '@tiptap/react';
3
3
 
4
4
  type HistorySlice<D = any> = {
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import { p as Field, q as FieldProps, r as DropZoneProps, C as Config, U as UserGenerics, D as Data, l as UiState, O as OnAction, g as Permissions, j as Plugin, k as Overrides, n as FieldTransforms, a as PuckAction, V as Viewports, I as IframeConfig, s as InitialHistory, M as Metadata, i as ResolveDataTrigger, t as ItemSelector, c as ComponentData, u as PluginInternal } from './actions-BkBoKAc5.mjs';
2
- export { ag as Adaptor, A as AppState, ae as ArrayField, N as ArrayState, ar as AsFieldProps, a0 as BaseData, a8 as BaseField, ai as CacheOpts, m as ComponentConfig, X as ComponentConfigExtensions, $ as ComponentConfigParams, a4 as ComponentDataMap, a2 as ComponentDataOptionalId, a6 as ComponentMetadata, _ as ConfigParams, b as Content, al as CustomField, ak as CustomFieldRender, e as DefaultComponentProps, d as DefaultComponents, f as DefaultRootFieldProps, ap as DefaultRootProps, ao as DefaultRootRenderProps, x as Direction, y as DragAxis, aj as ExternalField, ah as ExternalFieldWithAdaptor, Z as ExtractConfigParams, at as ExtractField, a7 as FieldMetadata, K as FieldRenderFunctions, E as FieldTransformFn, B as FieldTransformFnParams, F as Fields, H as History, L as ItemWithId, a3 as MappedItem, aa as NumberField, af as ObjectField, J as OverrideKey, T as PuckComponent, an as PuckContext, a5 as PuckMetadata, ad as RadioField, w as RichText, o as RichtextField, Y as RootConfig, R as RootData, h as RootDataWithProps, a1 as RootDataWithoutProps, ac as SelectField, S as Slot, Q as SlotComponent, am as SlotField, a9 as TextField, ab as TextareaField, z as Viewport, as as WithChildren, W as WithId, aq as WithPuckProps, v as WithSlotProps, G as overrideKeys } from './actions-BkBoKAc5.mjs';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CRRDqx6_.mjs';
1
+ import { p as Field, q as FieldProps, r as DropZoneProps, C as Config, U as UserGenerics, D as Data, l as UiState, O as OnAction, g as Permissions, j as Plugin, k as Overrides, n as FieldTransforms, a as PuckAction, V as Viewports, I as IframeConfig, s as InitialHistory, M as Metadata, i as ResolveDataTrigger, t as ItemSelector, c as ComponentData, u as PluginInternal } from './actions-BRYM0ifH.mjs';
2
+ export { v as Adaptor, A as AppState, w as ArrayField, x as ArrayState, y as AsFieldProps, B as BaseData, z as BaseField, E as CacheOpts, m as ComponentConfig, G as ComponentConfigExtensions, J as ComponentConfigParams, K as ComponentDataMap, L as ComponentDataOptionalId, N as ComponentMetadata, Q as ConfigParams, b as Content, S as CustomField, T as CustomFieldRender, e as DefaultComponentProps, d as DefaultComponents, f as DefaultRootFieldProps, X as DefaultRootProps, Y as DefaultRootRenderProps, Z as Direction, _ as DragAxis, $ as ExternalField, a0 as ExternalFieldWithAdaptor, a1 as ExtractConfigParams, a2 as ExtractField, a3 as FieldMetadata, a4 as FieldRenderFunctions, a5 as FieldTransformFn, a6 as FieldTransformFnParams, F as Fields, H as History, a7 as ItemWithId, a8 as MappedItem, a9 as NumberField, aa as ObjectField, ab as OverrideKey, ac as PuckComponent, ad as PuckContext, ae as PuckMetadata, af as RadioField, ag as RichText, o as RichtextField, ah as RootConfig, R as RootData, h as RootDataWithProps, ai as RootDataWithoutProps, aj as SelectField, ak as Slot, al as SlotComponent, am as SlotField, an as TextField, ao as TextareaField, ap as Viewport, aq as WithChildren, W as WithId, ar as WithPuckProps, as as WithSlotProps, at as overrideKeys } from './actions-BRYM0ifH.mjs';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-C1Zdgx7d.mjs';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import * as react from 'react';
6
6
  import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
7
- import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-bqD1SEOb.mjs';
7
+ import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-BVLGipsj.mjs';
8
8
  import '@tiptap/react';
9
9
  import '@tiptap/extension-blockquote';
10
10
  import '@tiptap/extension-bold';
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { p as Field, q as FieldProps, r as DropZoneProps, C as Config, U as UserGenerics, D as Data, l as UiState, O as OnAction, g as Permissions, j as Plugin, k as Overrides, n as FieldTransforms, a as PuckAction, V as Viewports, I as IframeConfig, s as InitialHistory, M as Metadata, i as ResolveDataTrigger, t as ItemSelector, c as ComponentData, u as PluginInternal } from './actions-BkBoKAc5.js';
2
- export { ag as Adaptor, A as AppState, ae as ArrayField, N as ArrayState, ar as AsFieldProps, a0 as BaseData, a8 as BaseField, ai as CacheOpts, m as ComponentConfig, X as ComponentConfigExtensions, $ as ComponentConfigParams, a4 as ComponentDataMap, a2 as ComponentDataOptionalId, a6 as ComponentMetadata, _ as ConfigParams, b as Content, al as CustomField, ak as CustomFieldRender, e as DefaultComponentProps, d as DefaultComponents, f as DefaultRootFieldProps, ap as DefaultRootProps, ao as DefaultRootRenderProps, x as Direction, y as DragAxis, aj as ExternalField, ah as ExternalFieldWithAdaptor, Z as ExtractConfigParams, at as ExtractField, a7 as FieldMetadata, K as FieldRenderFunctions, E as FieldTransformFn, B as FieldTransformFnParams, F as Fields, H as History, L as ItemWithId, a3 as MappedItem, aa as NumberField, af as ObjectField, J as OverrideKey, T as PuckComponent, an as PuckContext, a5 as PuckMetadata, ad as RadioField, w as RichText, o as RichtextField, Y as RootConfig, R as RootData, h as RootDataWithProps, a1 as RootDataWithoutProps, ac as SelectField, S as Slot, Q as SlotComponent, am as SlotField, a9 as TextField, ab as TextareaField, z as Viewport, as as WithChildren, W as WithId, aq as WithPuckProps, v as WithSlotProps, G as overrideKeys } from './actions-BkBoKAc5.js';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CS7sEpfG.js';
1
+ import { p as Field, q as FieldProps, r as DropZoneProps, C as Config, U as UserGenerics, D as Data, l as UiState, O as OnAction, g as Permissions, j as Plugin, k as Overrides, n as FieldTransforms, a as PuckAction, V as Viewports, I as IframeConfig, s as InitialHistory, M as Metadata, i as ResolveDataTrigger, t as ItemSelector, c as ComponentData, u as PluginInternal } from './actions-BRYM0ifH.js';
2
+ export { v as Adaptor, A as AppState, w as ArrayField, x as ArrayState, y as AsFieldProps, B as BaseData, z as BaseField, E as CacheOpts, m as ComponentConfig, G as ComponentConfigExtensions, J as ComponentConfigParams, K as ComponentDataMap, L as ComponentDataOptionalId, N as ComponentMetadata, Q as ConfigParams, b as Content, S as CustomField, T as CustomFieldRender, e as DefaultComponentProps, d as DefaultComponents, f as DefaultRootFieldProps, X as DefaultRootProps, Y as DefaultRootRenderProps, Z as Direction, _ as DragAxis, $ as ExternalField, a0 as ExternalFieldWithAdaptor, a1 as ExtractConfigParams, a2 as ExtractField, a3 as FieldMetadata, a4 as FieldRenderFunctions, a5 as FieldTransformFn, a6 as FieldTransformFnParams, F as Fields, H as History, a7 as ItemWithId, a8 as MappedItem, a9 as NumberField, aa as ObjectField, ab as OverrideKey, ac as PuckComponent, ad as PuckContext, ae as PuckMetadata, af as RadioField, ag as RichText, o as RichtextField, ah as RootConfig, R as RootData, h as RootDataWithProps, ai as RootDataWithoutProps, aj as SelectField, ak as Slot, al as SlotComponent, am as SlotField, an as TextField, ao as TextareaField, ap as Viewport, aq as WithChildren, W as WithId, ar as WithPuckProps, as as WithSlotProps, at as overrideKeys } from './actions-BRYM0ifH.js';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DQyC1GA7.js';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import * as react from 'react';
6
6
  import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
7
- import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-lt1zf5WR.js';
7
+ import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-D_Idfrfb.js';
8
8
  import '@tiptap/react';
9
9
  import '@tiptap/extension-blockquote';
10
10
  import '@tiptap/extension-bold';
package/dist/index.js CHANGED
@@ -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({
@@ -6298,6 +6305,40 @@ var SubFieldInternal = ({
6298
6305
  };
6299
6306
  var SubField = (0, import_react16.memo)(SubFieldInternal);
6300
6307
 
6308
+ // lib/data/set-deep.ts
6309
+ init_react_import();
6310
+ function setDeep(node, path, newVal) {
6311
+ const parts = path.split(".");
6312
+ const newNode = __spreadValues({}, node);
6313
+ let cur = newNode;
6314
+ for (let i = 0; i < parts.length; i++) {
6315
+ const [prop, idxStr] = parts[i].replace("]", "").split("[");
6316
+ const isLast = i === parts.length - 1;
6317
+ if (idxStr !== void 0) {
6318
+ if (!Array.isArray(cur[prop])) {
6319
+ cur[prop] = [];
6320
+ }
6321
+ const idx = Number(idxStr);
6322
+ if (isLast) {
6323
+ cur[prop][idx] = newVal;
6324
+ continue;
6325
+ }
6326
+ if (cur[prop][idx] === void 0) cur[prop][idx] = {};
6327
+ cur = cur[prop][idx];
6328
+ continue;
6329
+ }
6330
+ if (isLast) {
6331
+ cur[prop] = newVal;
6332
+ continue;
6333
+ }
6334
+ if (cur[prop] === void 0) {
6335
+ cur[prop] = {};
6336
+ }
6337
+ cur = cur[prop];
6338
+ }
6339
+ return __spreadValues(__spreadValues({}, node), newNode);
6340
+ }
6341
+
6301
6342
  // components/AutoField/fields/ArrayField/index.tsx
6302
6343
  var import_jsx_runtime9 = require("react/jsx-runtime");
6303
6344
  var getClassName5 = get_class_name_factory_default("ArrayField", styles_module_default3);
@@ -6365,9 +6406,10 @@ var ArrayFieldItemInternal = ({
6365
6406
  {
6366
6407
  ref: handleRef,
6367
6408
  onClick: (e) => {
6368
- if (isDragging || !hasVisibleFields) return;
6409
+ if (isDragging) return;
6369
6410
  e.preventDefault();
6370
6411
  e.stopPropagation();
6412
+ if (!hasVisibleFields) return;
6371
6413
  onToggleExpand(id, isExpanded);
6372
6414
  },
6373
6415
  className: getClassNameItem("summary"),
@@ -9115,40 +9157,6 @@ var styles_module_default17 = { "InlineTextField": "_InlineTextField_104qp_1" };
9115
9157
  // components/InlineTextField/index.tsx
9116
9158
  init_lib();
9117
9159
 
9118
- // lib/data/set-deep.ts
9119
- init_react_import();
9120
- function setDeep(node, path, newVal) {
9121
- const parts = path.split(".");
9122
- const newNode = __spreadValues({}, node);
9123
- let cur = newNode;
9124
- for (let i = 0; i < parts.length; i++) {
9125
- const [prop, idxStr] = parts[i].replace("]", "").split("[");
9126
- const isLast = i === parts.length - 1;
9127
- if (idxStr !== void 0) {
9128
- if (!Array.isArray(cur[prop])) {
9129
- cur[prop] = [];
9130
- }
9131
- const idx = Number(idxStr);
9132
- if (isLast) {
9133
- cur[prop][idx] = newVal;
9134
- continue;
9135
- }
9136
- if (cur[prop][idx] === void 0) cur[prop][idx] = {};
9137
- cur = cur[prop][idx];
9138
- continue;
9139
- }
9140
- if (isLast) {
9141
- cur[prop] = newVal;
9142
- continue;
9143
- }
9144
- if (cur[prop] === void 0) {
9145
- cur[prop] = {};
9146
- }
9147
- cur = cur[prop];
9148
- }
9149
- return __spreadValues(__spreadValues({}, node), newNode);
9150
- }
9151
-
9152
9160
  // lib/get-selector-for-id.ts
9153
9161
  init_react_import();
9154
9162
  var getSelectorForId = (state, id) => {
@@ -11403,20 +11411,28 @@ var CopyHostStyles = ({
11403
11411
  filtered.forEach((mirror) => {
11404
11412
  mirror.onload = () => {
11405
11413
  stylesLoaded = stylesLoaded + 1;
11406
- if (stylesLoaded >= elements.length) {
11414
+ if (stylesLoaded >= filtered.length) {
11407
11415
  onStylesLoaded();
11408
11416
  }
11409
11417
  };
11410
11418
  mirror.onerror = () => {
11411
11419
  console.warn(`AutoFrame couldn't load a stylesheet`);
11412
11420
  stylesLoaded = stylesLoaded + 1;
11413
- if (stylesLoaded >= elements.length) {
11421
+ if (stylesLoaded >= filtered.length) {
11414
11422
  onStylesLoaded();
11415
11423
  }
11416
11424
  };
11417
11425
  });
11418
11426
  doc.head.innerHTML = "";
11419
11427
  doc.head.append(...filtered);
11428
+ filtered.forEach((mirror) => {
11429
+ if (mirror.nodeName === "STYLE") {
11430
+ stylesLoaded = stylesLoaded + 1;
11431
+ }
11432
+ });
11433
+ if (stylesLoaded >= filtered.length) {
11434
+ onStylesLoaded();
11435
+ }
11420
11436
  observer.observe(parentDocument.head, { childList: true, subtree: true });
11421
11437
  filtered.forEach((el) => {
11422
11438
  const elHash = (0, import_object_hash.default)(el.outerHTML);
@@ -12773,11 +12789,13 @@ var getClassName36 = get_class_name_factory_default("PuckCanvas", styles_module_
12773
12789
  var ZOOM_ON_CHANGE = true;
12774
12790
  var TRANSITION_DURATION = 150;
12775
12791
  var Canvas = () => {
12792
+ var _a;
12776
12793
  const { frameRef } = useCanvasFrame();
12777
12794
  const resetAutoZoom = useResetAutoZoom(frameRef);
12778
12795
  const {
12779
12796
  _experimentalFullScreenCanvas,
12780
- viewports: viewportOptions = defaultViewports
12797
+ viewports: viewportOptions = defaultViewports,
12798
+ ui: uiProp
12781
12799
  } = usePropsContext();
12782
12800
  const {
12783
12801
  dispatch,
@@ -12874,10 +12892,11 @@ var Canvas = () => {
12874
12892
  }, []);
12875
12893
  const appStoreApi = useAppStoreApi();
12876
12894
  (0, import_react88.useEffect)(() => {
12877
- var _a;
12895
+ var _a2, _b;
12878
12896
  if (typeof window === "undefined") return;
12897
+ if ((_a2 = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _a2.current) return;
12879
12898
  const viewportWidth = window.innerWidth;
12880
- const frameWidth = (_a = frameRef.current) == null ? void 0 : _a.getBoundingClientRect().width;
12899
+ const frameWidth = (_b = frameRef.current) == null ? void 0 : _b.getBoundingClientRect().width;
12881
12900
  if (!viewportWidth) return;
12882
12901
  if (!frameWidth) return;
12883
12902
  if (viewportOptions.length === 0) return;
@@ -12916,7 +12935,13 @@ var Canvas = () => {
12916
12935
  }
12917
12936
  appStoreApi.setState(__spreadProps(__spreadValues({}, appState), { history }));
12918
12937
  }
12919
- }, [viewportOptions, frameRef.current, iframe, appStoreApi]);
12938
+ }, [
12939
+ viewportOptions,
12940
+ frameRef.current,
12941
+ iframe,
12942
+ appStoreApi,
12943
+ (_a = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _a.current
12944
+ ]);
12920
12945
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
12921
12946
  "div",
12922
12947
  {
package/dist/index.mjs CHANGED
@@ -17,13 +17,13 @@ import {
17
17
  setDeep,
18
18
  useGetPuck,
19
19
  usePuck
20
- } from "./chunk-EBISZQTK.mjs";
21
- import "./chunk-RHVK562Z.mjs";
20
+ } from "./chunk-LBGOSTI5.mjs";
21
+ import "./chunk-GYDP2UKB.mjs";
22
22
  import {
23
23
  migrate,
24
24
  resolveAllData,
25
25
  transformProps
26
- } from "./chunk-TNORMHZU.mjs";
26
+ } from "./chunk-FOGDNETJ.mjs";
27
27
  import "./chunk-AOEDIUVK.mjs";
28
28
  import {
29
29
  Action,
@@ -33,18 +33,23 @@ import {
33
33
  Label,
34
34
  RichTextMenu,
35
35
  Separator
36
- } from "./chunk-5V242HXR.mjs";
37
- import "./chunk-MSZPUXZP.mjs";
38
- import "./chunk-KOUWDQ4Q.mjs";
39
- import "./chunk-SKJTJUWU.mjs";
40
- import "./chunk-UMTU6EA7.mjs";
41
- import "./chunk-37HTE4KO.mjs";
42
- import "./chunk-MDUBGHWF.mjs";
36
+ } from "./chunk-46RDHJGL.mjs";
37
+ import "./chunk-JGZBBNEW.mjs";
38
+ import "./chunk-BSAENBPL.mjs";
39
+ import "./chunk-TVE6QYBR.mjs";
40
+ import "./chunk-AFOEZCNE.mjs";
41
+ import "./chunk-YLLE6KXH.mjs";
42
+ import "./chunk-BOKX3EBR.mjs";
43
43
  import "./chunk-Y2EFNT5P.mjs";
44
44
  import {
45
45
  walkTree
46
- } from "./chunk-PMXRXC2B.mjs";
47
- import "./chunk-M6W7YEVX.mjs";
46
+ } from "./chunk-754HNMU2.mjs";
47
+ import {
48
+ init_react_import
49
+ } from "./chunk-M6W7YEVX.mjs";
50
+
51
+ // bundle/index.ts
52
+ init_react_import();
48
53
  export {
49
54
  Action,
50
55
  ActionBar,
@@ -1,6 +1,6 @@
1
1
  import { Reducer } from 'react';
2
- import { D as Data, A as AppState, O as OnAction, P as PrivateAppState, a as PuckAction } from './actions-BkBoKAc5.mjs';
3
- import { A as AppStore } from './index-bqD1SEOb.mjs';
2
+ import { D as Data, A as AppState, O as OnAction, P as PrivateAppState, a as PuckAction } from './actions-BRYM0ifH.mjs';
3
+ import { A as AppStore } from './index-BVLGipsj.mjs';
4
4
  import '@tiptap/react';
5
5
  import '@tiptap/extension-blockquote';
6
6
  import '@tiptap/extension-bold';
@@ -1,6 +1,6 @@
1
1
  import { Reducer } from 'react';
2
- import { D as Data, A as AppState, O as OnAction, P as PrivateAppState, a as PuckAction } from './actions-BkBoKAc5.js';
3
- import { A as AppStore } from './index-lt1zf5WR.js';
2
+ import { D as Data, A as AppState, O as OnAction, P as PrivateAppState, a as PuckAction } from './actions-BRYM0ifH.js';
3
+ import { A as AppStore } from './index-D_Idfrfb.js';
4
4
  import '@tiptap/react';
5
5
  import '@tiptap/extension-blockquote';
6
6
  import '@tiptap/extension-bold';
package/dist/internal.js CHANGED
@@ -269,6 +269,14 @@ var flattenNode = (node, config) => {
269
269
  });
270
270
  };
271
271
 
272
+ // lib/data/to-component.ts
273
+ var toComponent = (item) => {
274
+ return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
275
+ props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
276
+ type: "root"
277
+ });
278
+ };
279
+
272
280
  // lib/data/walk-app-state.ts
273
281
  function walkAppState(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
274
282
  var _a;
@@ -332,7 +340,7 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
332
340
  id
333
341
  });
334
342
  processRelatedZones(item, id, path);
335
- const newItem = __spreadProps(__spreadValues({}, item), { props: newProps });
343
+ const newItem = __spreadProps(__spreadValues({}, mappedItem), { props: newProps });
336
344
  const thisZoneCompound = path[path.length - 1];
337
345
  const [parentId, zone] = thisZoneCompound ? thisZoneCompound.split(":") : [null, ""];
338
346
  newNodeIndex[id] = {
@@ -372,17 +380,14 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
372
380
  );
373
381
  newZones[zoneCompound] = newContent2;
374
382
  }, newZones);
375
- const processedRoot = processItem(
376
- {
377
- type: "root",
378
- props: __spreadProps(__spreadValues({}, (_a = state.data.root.props) != null ? _a : state.data.root), { id: "root" })
379
- },
380
- [],
381
- -1
382
- );
383
- const root = __spreadProps(__spreadValues({}, state.data.root), {
384
- props: processedRoot.props
383
+ let rootAsComponent = toComponent({
384
+ props: __spreadValues({}, (_a = state.data.root.props) != null ? _a : state.data.root)
385
385
  });
386
+ if (state.data.root.readOnly) {
387
+ rootAsComponent.readOnly = state.data.root.readOnly;
388
+ }
389
+ const processedRoot = processItem(rootAsComponent, [], -1);
390
+ const root = __spreadValues(__spreadValues({}, state.data.root), processedRoot);
386
391
  return __spreadProps(__spreadValues({}, state), {
387
392
  data: {
388
393
  root,
package/dist/internal.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createReducer
3
- } from "./chunk-37HTE4KO.mjs";
4
- import "./chunk-PMXRXC2B.mjs";
3
+ } from "./chunk-YLLE6KXH.mjs";
4
+ import "./chunk-754HNMU2.mjs";
5
5
  import {
6
6
  init_react_import
7
7
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  useListOptions
3
- } from "./chunk-SKJTJUWU.mjs";
3
+ } from "./chunk-TVE6QYBR.mjs";
4
4
  import {
5
5
  List,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-UMTU6EA7.mjs";
9
- import "./chunk-37HTE4KO.mjs";
10
- import "./chunk-MDUBGHWF.mjs";
8
+ } from "./chunk-AFOEZCNE.mjs";
9
+ import "./chunk-YLLE6KXH.mjs";
10
+ import "./chunk-BOKX3EBR.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
- import "./chunk-PMXRXC2B.mjs";
12
+ import "./chunk-754HNMU2.mjs";
13
13
  import {
14
14
  init_react_import
15
15
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  useAlignOptions
3
- } from "./chunk-MSZPUXZP.mjs";
3
+ } from "./chunk-JGZBBNEW.mjs";
4
4
  import {
5
5
  AlignLeft,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-UMTU6EA7.mjs";
9
- import "./chunk-37HTE4KO.mjs";
10
- import "./chunk-MDUBGHWF.mjs";
8
+ } from "./chunk-AFOEZCNE.mjs";
9
+ import "./chunk-YLLE6KXH.mjs";
10
+ import "./chunk-BOKX3EBR.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
- import "./chunk-PMXRXC2B.mjs";
12
+ import "./chunk-754HNMU2.mjs";
13
13
  import {
14
14
  init_react_import
15
15
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  useHeadingOptions
3
- } from "./chunk-KOUWDQ4Q.mjs";
3
+ } from "./chunk-BSAENBPL.mjs";
4
4
  import {
5
5
  Heading,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-UMTU6EA7.mjs";
9
- import "./chunk-37HTE4KO.mjs";
10
- import "./chunk-MDUBGHWF.mjs";
8
+ } from "./chunk-AFOEZCNE.mjs";
9
+ import "./chunk-YLLE6KXH.mjs";
10
+ import "./chunk-BOKX3EBR.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
- import "./chunk-PMXRXC2B.mjs";
12
+ import "./chunk-754HNMU2.mjs";
13
13
  import {
14
14
  init_react_import
15
15
  } from "./chunk-M6W7YEVX.mjs";