@reacteditor/core 0.0.6 → 0.0.7

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 (38) hide show
  1. package/dist/{Editor-YNFB7B6Z.mjs → Editor-OSAG52QF.mjs} +9 -9
  2. package/dist/{actions-CQmL3wwa.d.mts → actions-BDMhAtxP.d.mts} +2 -1
  3. package/dist/{actions-CQmL3wwa.d.ts → actions-BDMhAtxP.d.ts} +2 -1
  4. package/dist/{chunk-CRF2GWQA.mjs → chunk-AAK2555H.mjs} +3 -3
  5. package/dist/{chunk-6LG4Q4HO.mjs → chunk-EEQGJ6FH.mjs} +1 -1
  6. package/dist/{chunk-VOLQMQPK.mjs → chunk-IIRJMJFU.mjs} +1 -1
  7. package/dist/{chunk-BRDUM7MJ.mjs → chunk-JUC25FB7.mjs} +7 -7
  8. package/dist/{chunk-UB2DES2O.mjs → chunk-M4JDRFYB.mjs} +8 -6
  9. package/dist/{chunk-DB4R5IWG.mjs → chunk-RNRHREWH.mjs} +3 -3
  10. package/dist/{chunk-275EJPEB.mjs → chunk-TI3KC54Y.mjs} +18 -18
  11. package/dist/{chunk-HCFEY5Y7.mjs → chunk-W5I2Z7QS.mjs} +249 -24
  12. package/dist/{chunk-Z6IIVDFY.mjs → chunk-XI7YTBCP.mjs} +1 -1
  13. package/dist/{chunk-WGPCLAZR.mjs → chunk-ZLSPSBV3.mjs} +1 -1
  14. package/dist/{full-24FOTNTB.mjs → full-IHV5BO2L.mjs} +8 -8
  15. package/dist/{index-BOP2qNVA.d.mts → index-BwLKseT7.d.mts} +1 -1
  16. package/dist/{index-_G46lHpL.d.ts → index-DkYXZRPz.d.ts} +1 -1
  17. package/dist/index.d.mts +35 -8
  18. package/dist/index.d.ts +35 -8
  19. package/dist/index.js +284 -52
  20. package/dist/index.mjs +14 -14
  21. package/dist/internal.d.mts +2 -2
  22. package/dist/internal.d.ts +2 -2
  23. package/dist/internal.js +7 -5
  24. package/dist/internal.mjs +2 -2
  25. package/dist/{loaded-6NPDD7SF.mjs → loaded-3NPQWYKN.mjs} +5 -5
  26. package/dist/{loaded-BQVZGQG2.mjs → loaded-FTSXIONQ.mjs} +5 -5
  27. package/dist/{loaded-6IBSSOXD.mjs → loaded-YTQOQIUU.mjs} +5 -5
  28. package/dist/no-external.d.mts +4 -4
  29. package/dist/no-external.d.ts +4 -4
  30. package/dist/no-external.js +284 -52
  31. package/dist/no-external.mjs +14 -14
  32. package/dist/rsc.d.mts +2 -2
  33. package/dist/rsc.d.ts +2 -2
  34. package/dist/rsc.mjs +3 -3
  35. package/dist/{walk-tree-DxSkPLnl.d.ts → walk-tree-BweEZ37Y.d.ts} +1 -1
  36. package/dist/{walk-tree-Dwv3c_9M.d.mts → walk-tree-LcQXXDqe.d.mts} +1 -1
  37. package/package.json +1 -1
  38. package/dist/{chunk-GAUBBDIR.mjs → chunk-JIXMPJZA.mjs} +37 -37
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EditorInner,
3
3
  LoadedRichTextMenu
4
- } from "./chunk-DB4R5IWG.mjs";
4
+ } from "./chunk-RNRHREWH.mjs";
5
5
  import {
6
6
  RichTextRenderFallback,
7
7
  SlotRender,
@@ -10,13 +10,13 @@ import {
10
10
  getSlotTransform,
11
11
  useRichtextProps,
12
12
  useSlots
13
- } from "./chunk-275EJPEB.mjs";
13
+ } from "./chunk-TI3KC54Y.mjs";
14
14
  import {
15
15
  ActionBar,
16
16
  IconButton,
17
17
  LoadedRichTextMenuInner,
18
18
  Loader
19
- } from "./chunk-BRDUM7MJ.mjs";
19
+ } from "./chunk-JUC25FB7.mjs";
20
20
  import {
21
21
  Check,
22
22
  ChevronDown,
@@ -60,18 +60,18 @@ import {
60
60
  useRegisterFieldsSlice,
61
61
  useRegisterHistorySlice,
62
62
  useRegisterPermissionsSlice
63
- } from "./chunk-CRF2GWQA.mjs";
63
+ } from "./chunk-AAK2555H.mjs";
64
64
  import {
65
65
  getItem,
66
66
  insert,
67
67
  insertAction,
68
68
  makeStatePublic,
69
69
  populateIds
70
- } from "./chunk-UB2DES2O.mjs";
70
+ } from "./chunk-M4JDRFYB.mjs";
71
71
  import {
72
72
  defaultAppState,
73
73
  defaultViewports
74
- } from "./chunk-VOLQMQPK.mjs";
74
+ } from "./chunk-IIRJMJFU.mjs";
75
75
  import {
76
76
  get_class_name_factory_default
77
77
  } from "./chunk-Y2EFNT5P.mjs";
@@ -87,7 +87,7 @@ import {
87
87
  toComponent,
88
88
  walkAppState,
89
89
  walkField
90
- } from "./chunk-GAUBBDIR.mjs";
90
+ } from "./chunk-JIXMPJZA.mjs";
91
91
  import {
92
92
  __async,
93
93
  __objRest,
@@ -2047,7 +2047,7 @@ EditorFallback.displayName = "EditorFallback";
2047
2047
  // components/AutoField/fields/RichtextField/index.tsx
2048
2048
  import { Fragment as Fragment3, jsx as jsx19 } from "react/jsx-runtime";
2049
2049
  var Editor = lazy(
2050
- () => import("./Editor-YNFB7B6Z.mjs").then((m) => ({
2050
+ () => import("./Editor-OSAG52QF.mjs").then((m) => ({
2051
2051
  default: m.Editor
2052
2052
  }))
2053
2053
  );
@@ -4586,7 +4586,7 @@ import {
4586
4586
  } from "react";
4587
4587
  import { jsx as jsx29 } from "react/jsx-runtime";
4588
4588
  var Editor2 = lazy2(
4589
- () => import("./Editor-YNFB7B6Z.mjs").then((m) => ({
4589
+ () => import("./Editor-OSAG52QF.mjs").then((m) => ({
4590
4590
  default: m.Editor
4591
4591
  }))
4592
4592
  );
@@ -5679,8 +5679,131 @@ function resolveDataBySelector(selector, getState, trigger) {
5679
5679
  });
5680
5680
  }
5681
5681
 
5682
+ // lib/editor-commands.ts
5683
+ init_react_import();
5684
+ var parentToZone = (parent) => parent ? `${parent.id}:${parent.slot}` : rootDroppableId;
5685
+ var createEditorCommands = (appStore) => {
5686
+ const { getState } = appStore;
5687
+ const getZoneLength = (zone) => {
5688
+ var _a, _b;
5689
+ return (_b = (_a = getState().state.indexes.zones[zone]) == null ? void 0 : _a.contentIds.length) != null ? _b : 0;
5690
+ };
5691
+ const insertComponent2 = ({
5692
+ type,
5693
+ parent,
5694
+ index,
5695
+ data,
5696
+ select = true
5697
+ }) => {
5698
+ var _a;
5699
+ const id = (_a = data == null ? void 0 : data.props.id) != null ? _a : generateId(type);
5700
+ const zone = parentToZone(parent);
5701
+ const destIndex = index != null ? index : getZoneLength(zone);
5702
+ const dispatch = getState().dispatch;
5703
+ dispatch(__spreadValues({
5704
+ type: "insert",
5705
+ componentType: type,
5706
+ destinationIndex: destIndex,
5707
+ destinationZone: zone,
5708
+ id
5709
+ }, data ? { data: __spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { id }) }) } : {}));
5710
+ if (select) {
5711
+ dispatch({
5712
+ type: "setUi",
5713
+ ui: { itemSelector: { index: destIndex, zone } }
5714
+ });
5715
+ }
5716
+ return { id };
5717
+ };
5718
+ const removeComponent = (id) => {
5719
+ const sel = getSelectorForId(getState().state, id);
5720
+ if (!(sel == null ? void 0 : sel.zone)) return;
5721
+ getState().dispatch({ type: "remove", index: sel.index, zone: sel.zone });
5722
+ };
5723
+ const duplicateComponent = (id) => {
5724
+ const sel = getSelectorForId(getState().state, id);
5725
+ if (!(sel == null ? void 0 : sel.zone)) return;
5726
+ getState().dispatch({
5727
+ type: "duplicate",
5728
+ sourceIndex: sel.index,
5729
+ sourceZone: sel.zone
5730
+ });
5731
+ };
5732
+ const moveComponent2 = (id, to) => {
5733
+ const sel = getSelectorForId(getState().state, id);
5734
+ if (!(sel == null ? void 0 : sel.zone)) return;
5735
+ getState().dispatch({
5736
+ type: "move",
5737
+ sourceIndex: sel.index,
5738
+ sourceZone: sel.zone,
5739
+ destinationIndex: to.index,
5740
+ destinationZone: parentToZone(to.parent)
5741
+ });
5742
+ };
5743
+ const replaceComponent = (id, data) => {
5744
+ const sel = getSelectorForId(getState().state, id);
5745
+ if (!(sel == null ? void 0 : sel.zone)) return;
5746
+ const existing = getItem(sel, getState().state);
5747
+ if (!existing) return;
5748
+ getState().dispatch({
5749
+ type: "replace",
5750
+ destinationIndex: sel.index,
5751
+ destinationZone: sel.zone,
5752
+ data: __spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { id: existing.props.id }) })
5753
+ });
5754
+ };
5755
+ const updateProps = (id, updater) => {
5756
+ const sel = getSelectorForId(getState().state, id);
5757
+ if (!sel) return;
5758
+ const existing = getItem(sel, getState().state);
5759
+ if (!existing) return;
5760
+ const patch = typeof updater === "function" ? updater(existing.props) : updater;
5761
+ getState().dispatch({
5762
+ type: "replace",
5763
+ destinationIndex: sel.index,
5764
+ destinationZone: sel.zone,
5765
+ data: __spreadProps(__spreadValues({}, existing), {
5766
+ props: __spreadProps(__spreadValues(__spreadValues({}, existing.props), patch), { id: existing.props.id })
5767
+ })
5768
+ });
5769
+ };
5770
+ const updateRoot = (updater) => {
5771
+ var _a, _b;
5772
+ const root = (_a = getState().state.data.root) != null ? _a : { props: {} };
5773
+ const prevProps = (_b = root.props) != null ? _b : {};
5774
+ const patch = typeof updater === "function" ? updater(prevProps) : updater;
5775
+ getState().dispatch({
5776
+ type: "replaceRoot",
5777
+ root: __spreadProps(__spreadValues({}, root), { props: __spreadValues(__spreadValues({}, prevProps), patch) })
5778
+ });
5779
+ };
5780
+ const selectComponent = (id) => {
5781
+ const dispatch = getState().dispatch;
5782
+ if (id === null) {
5783
+ dispatch({ type: "setUi", ui: { itemSelector: null } });
5784
+ return;
5785
+ }
5786
+ const sel = getSelectorForId(getState().state, id);
5787
+ if (!(sel == null ? void 0 : sel.zone)) return;
5788
+ dispatch({
5789
+ type: "setUi",
5790
+ ui: { itemSelector: { index: sel.index, zone: sel.zone } }
5791
+ });
5792
+ };
5793
+ return {
5794
+ insertComponent: insertComponent2,
5795
+ removeComponent,
5796
+ duplicateComponent,
5797
+ moveComponent: moveComponent2,
5798
+ replaceComponent,
5799
+ updateProps,
5800
+ updateRoot,
5801
+ selectComponent
5802
+ };
5803
+ };
5804
+
5682
5805
  // lib/use-editor.ts
5683
- var generateUseEditor = (store, getState) => {
5806
+ var generateUseEditor = (store, getState, commands) => {
5684
5807
  const history = {
5685
5808
  back: store.history.back,
5686
5809
  forward: store.history.forward,
@@ -5691,7 +5814,7 @@ var generateUseEditor = (store, getState) => {
5691
5814
  histories: store.history.histories,
5692
5815
  index: store.history.index
5693
5816
  };
5694
- const storeData = {
5817
+ const storeData = __spreadProps(__spreadValues({}, commands), {
5695
5818
  appState: makeStatePublic(store.state),
5696
5819
  config: store.config,
5697
5820
  dispatch: store.dispatch,
@@ -5712,7 +5835,7 @@ var generateUseEditor = (store, getState) => {
5712
5835
  if (!parentNode) return;
5713
5836
  return parentNode.data;
5714
5837
  }
5715
- };
5838
+ });
5716
5839
  storeData.__private = {
5717
5840
  appState: store.state
5718
5841
  };
@@ -5732,11 +5855,13 @@ var convertToPickedStore = (store) => {
5732
5855
  };
5733
5856
  };
5734
5857
  var useRegisterUseEditorStore = (appStore) => {
5858
+ const [commands] = useState16(() => createEditorCommands(appStore));
5735
5859
  const [useEditorStore] = useState16(
5736
5860
  () => createStore5(
5737
5861
  () => generateUseEditor(
5738
5862
  convertToPickedStore(appStore.getState()),
5739
- appStore.getState
5863
+ appStore.getState,
5864
+ commands
5740
5865
  )
5741
5866
  )
5742
5867
  );
@@ -5744,10 +5869,12 @@ var useRegisterUseEditorStore = (appStore) => {
5744
5869
  return appStore.subscribe(
5745
5870
  (store) => convertToPickedStore(store),
5746
5871
  (pickedStore) => {
5747
- useEditorStore.setState(generateUseEditor(pickedStore, appStore.getState));
5872
+ useEditorStore.setState(
5873
+ generateUseEditor(pickedStore, appStore.getState, commands)
5874
+ );
5748
5875
  }
5749
5876
  );
5750
- }, []);
5877
+ }, [commands]);
5751
5878
  return useEditorStore;
5752
5879
  };
5753
5880
  function createUseEditor() {
@@ -6666,7 +6793,7 @@ var fieldsPlugin = ({ desktopSideBar = "right" } = {}) => ({
6666
6793
  init_react_import();
6667
6794
  import {
6668
6795
  createContext as createContext8,
6669
- useCallback as useCallback23,
6796
+ useCallback as useCallback24,
6670
6797
  useContext as useContext15,
6671
6798
  useEffect as useEffect26,
6672
6799
  useMemo as useMemo24,
@@ -7177,7 +7304,7 @@ function splitGlobals(data, config) {
7177
7304
  // components/Editor/components/Layout/index.tsx
7178
7305
  init_react_import();
7179
7306
  import {
7180
- useCallback as useCallback22,
7307
+ useCallback as useCallback23,
7181
7308
  useEffect as useEffect25,
7182
7309
  useMemo as useMemo23,
7183
7310
  useRef as useRef17,
@@ -8007,6 +8134,9 @@ var Sidebar = ({
8007
8134
  // lib/use-delete-hotkeys.ts
8008
8135
  init_react_import();
8009
8136
  import { useCallback as useCallback21 } from "react";
8137
+
8138
+ // lib/should-block-editing-hotkey.ts
8139
+ init_react_import();
8010
8140
  var isElementVisible = (element) => {
8011
8141
  let current = element;
8012
8142
  while (current && current !== document.body) {
@@ -8018,7 +8148,7 @@ var isElementVisible = (element) => {
8018
8148
  }
8019
8149
  return true;
8020
8150
  };
8021
- var shouldBlockDeleteHotkey = (e) => {
8151
+ var shouldBlockEditingHotkey = (e) => {
8022
8152
  var _a;
8023
8153
  if (e == null ? void 0 : e.defaultPrevented) return true;
8024
8154
  const origin = ((_a = e == null ? void 0 : e.composedPath) == null ? void 0 : _a.call(e)[0]) || (e == null ? void 0 : e.target) || document.activeElement;
@@ -8039,12 +8169,14 @@ var shouldBlockDeleteHotkey = (e) => {
8039
8169
  }
8040
8170
  return false;
8041
8171
  };
8172
+
8173
+ // lib/use-delete-hotkeys.ts
8042
8174
  var useDeleteHotkeys = () => {
8043
8175
  const appStore = useAppStoreApi();
8044
8176
  const deleteSelectedComponent = useCallback21(
8045
8177
  (e) => {
8046
8178
  var _a;
8047
- if (shouldBlockDeleteHotkey(e)) {
8179
+ if (shouldBlockEditingHotkey(e)) {
8048
8180
  return false;
8049
8181
  }
8050
8182
  const { state, dispatch, permissions, selectedItem } = appStore.getState();
@@ -8065,6 +8197,98 @@ var useDeleteHotkeys = () => {
8065
8197
  useHotkey({ backspace: true }, deleteSelectedComponent);
8066
8198
  };
8067
8199
 
8200
+ // lib/use-clipboard-hotkeys.ts
8201
+ init_react_import();
8202
+ import { useCallback as useCallback22 } from "react";
8203
+ var CLIPBOARD_MARKER = "reacteditor/component";
8204
+ var isComponentData = (value) => {
8205
+ var _a;
8206
+ if (!value || typeof value !== "object") return false;
8207
+ const v = value;
8208
+ return typeof v.type === "string" && typeof ((_a = v.props) == null ? void 0 : _a.id) === "string";
8209
+ };
8210
+ var parsePayload = (text) => {
8211
+ try {
8212
+ const parsed = JSON.parse(text);
8213
+ if (parsed && typeof parsed === "object" && parsed.__reactEditor === CLIPBOARD_MARKER && isComponentData(parsed.data)) {
8214
+ return parsed.data;
8215
+ }
8216
+ } catch (e) {
8217
+ }
8218
+ return null;
8219
+ };
8220
+ var useClipboardHotkeys = () => {
8221
+ const appStore = useAppStoreApi();
8222
+ const writeSelectionToClipboard = useCallback22(() => {
8223
+ var _a;
8224
+ const { selectedItem } = appStore.getState();
8225
+ if (!selectedItem) return false;
8226
+ const payload = {
8227
+ __reactEditor: CLIPBOARD_MARKER,
8228
+ data: selectedItem
8229
+ };
8230
+ (_a = navigator.clipboard) == null ? void 0 : _a.writeText(JSON.stringify(payload)).catch(() => {
8231
+ });
8232
+ return true;
8233
+ }, [appStore]);
8234
+ const copySelectedComponent = useCallback22(
8235
+ (e) => {
8236
+ if (shouldBlockEditingHotkey(e)) return false;
8237
+ return writeSelectionToClipboard();
8238
+ },
8239
+ [writeSelectionToClipboard]
8240
+ );
8241
+ const cutSelectedComponent = useCallback22(
8242
+ (e) => {
8243
+ var _a;
8244
+ if (shouldBlockEditingHotkey(e)) return false;
8245
+ const { state, dispatch, permissions, selectedItem } = appStore.getState();
8246
+ const sel = (_a = state.ui) == null ? void 0 : _a.itemSelector;
8247
+ if (!(sel == null ? void 0 : sel.zone) || !selectedItem) return false;
8248
+ if (!permissions.getPermissions({ item: selectedItem }).delete)
8249
+ return true;
8250
+ if (!writeSelectionToClipboard()) return false;
8251
+ dispatch({
8252
+ type: "remove",
8253
+ index: sel.index,
8254
+ zone: sel.zone
8255
+ });
8256
+ return true;
8257
+ },
8258
+ [appStore, writeSelectionToClipboard]
8259
+ );
8260
+ const pasteComponent = useCallback22(
8261
+ (e) => {
8262
+ var _a, _b;
8263
+ if (shouldBlockEditingHotkey(e)) return false;
8264
+ const { state, dispatch, config } = appStore.getState();
8265
+ const sel = (_a = state.ui) == null ? void 0 : _a.itemSelector;
8266
+ if (!(sel == null ? void 0 : sel.zone)) return false;
8267
+ (_b = navigator.clipboard) == null ? void 0 : _b.readText().then((text) => {
8268
+ const data = parsePayload(text);
8269
+ if (!data) return;
8270
+ if (!config.components[data.type]) return;
8271
+ dispatch({
8272
+ type: "insert",
8273
+ componentType: data.type,
8274
+ destinationIndex: sel.index + 1,
8275
+ destinationZone: sel.zone,
8276
+ data
8277
+ });
8278
+ }).catch(() => {
8279
+ });
8280
+ return true;
8281
+ },
8282
+ [appStore]
8283
+ );
8284
+ useHotkey({ meta: true, c: true }, copySelectedComponent);
8285
+ useHotkey({ ctrl: true, c: true }, copySelectedComponent);
8286
+ useHotkey({ meta: true, v: true }, pasteComponent);
8287
+ useHotkey({ ctrl: true, v: true }, pasteComponent);
8288
+ useHotkey({ meta: true, x: true }, cutSelectedComponent);
8289
+ useHotkey({ ctrl: true, x: true }, cutSelectedComponent);
8290
+ };
8291
+
8068
8292
  // components/Editor/components/Nav/index.tsx
8069
8293
  init_react_import();
8070
8294
 
@@ -8256,6 +8480,7 @@ var Layout = ({ children }) => {
8256
8480
  }, [ready, iframe.enabled]);
8257
8481
  usePreviewModeHotkeys();
8258
8482
  useDeleteHotkeys();
8483
+ useClipboardHotkeys();
8259
8484
  const layoutOptions = {};
8260
8485
  if (leftWidth) {
8261
8486
  layoutOptions["--editor-user-left-side-bar-width"] = `${leftWidth}px`;
@@ -8277,7 +8502,7 @@ var Layout = ({ children }) => {
8277
8502
  const isDraggingMobile = useRef17(false);
8278
8503
  const dragStartY = useRef17(0);
8279
8504
  const dragStartHeight = useRef17(0);
8280
- const handleMobileDragStart = useCallback22(
8505
+ const handleMobileDragStart = useCallback23(
8281
8506
  (clientY) => {
8282
8507
  isDraggingMobile.current = true;
8283
8508
  dragStartY.current = clientY;
@@ -8288,7 +8513,7 @@ var Layout = ({ children }) => {
8288
8513
  },
8289
8514
  []
8290
8515
  );
8291
- const handleMobileDragMove = useCallback22((clientY) => {
8516
+ const handleMobileDragMove = useCallback23((clientY) => {
8292
8517
  if (!isDraggingMobile.current) return;
8293
8518
  const delta = dragStartY.current - clientY;
8294
8519
  const viewportHeight = window.innerHeight;
@@ -8297,7 +8522,7 @@ var Layout = ({ children }) => {
8297
8522
  const newH = Math.min(maxH, Math.max(minH, dragStartHeight.current + delta));
8298
8523
  setMobilePanelHeight(newH);
8299
8524
  }, []);
8300
- const handleMobileDragEnd = useCallback22(() => {
8525
+ const handleMobileDragEnd = useCallback23(() => {
8301
8526
  if (!isDraggingMobile.current) return;
8302
8527
  isDraggingMobile.current = false;
8303
8528
  document.body.style.userSelect = "";
@@ -8651,7 +8876,7 @@ function EditorProvider({ children }) {
8651
8876
  return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
8652
8877
  }, [fieldTransforms, plugins]);
8653
8878
  const instanceId = useSafeId();
8654
- const generateAppStore = useCallback23(
8879
+ const generateAppStore = useCallback24(
8655
8880
  (state) => {
8656
8881
  return {
8657
8882
  instanceId,
@@ -8817,7 +9042,6 @@ export {
8817
9042
  renderContext,
8818
9043
  Render,
8819
9044
  registerOverlayPortal,
8820
- DropZone,
8821
9045
  Drawer,
8822
9046
  ComponentList,
8823
9047
  createUseEditor,
@@ -8826,6 +9050,7 @@ export {
8826
9050
  blocksPlugin,
8827
9051
  outlinePlugin,
8828
9052
  fieldsPlugin,
9053
+ usePropsContext,
8829
9054
  Editor3 as Editor,
8830
9055
  pageMetadata,
8831
9056
  legacySideBarPlugin
@@ -3,7 +3,7 @@ import {
3
3
  AlignJustify,
4
4
  AlignLeft,
5
5
  AlignRight
6
- } from "./chunk-CRF2GWQA.mjs";
6
+ } from "./chunk-AAK2555H.mjs";
7
7
  import {
8
8
  init_react_import
9
9
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  List,
3
3
  ListOrdered
4
- } from "./chunk-CRF2GWQA.mjs";
4
+ } from "./chunk-AAK2555H.mjs";
5
5
  import {
6
6
  init_react_import
7
7
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  LoadedRichTextMenuInner
3
- } from "./chunk-BRDUM7MJ.mjs";
4
- import "./chunk-Z6IIVDFY.mjs";
5
- import "./chunk-6LG4Q4HO.mjs";
6
- import "./chunk-WGPCLAZR.mjs";
7
- import "./chunk-CRF2GWQA.mjs";
8
- import "./chunk-UB2DES2O.mjs";
9
- import "./chunk-VOLQMQPK.mjs";
3
+ } from "./chunk-JUC25FB7.mjs";
4
+ import "./chunk-XI7YTBCP.mjs";
5
+ import "./chunk-EEQGJ6FH.mjs";
6
+ import "./chunk-ZLSPSBV3.mjs";
7
+ import "./chunk-AAK2555H.mjs";
8
+ import "./chunk-M4JDRFYB.mjs";
9
+ import "./chunk-IIRJMJFU.mjs";
10
10
  import "./chunk-Y2EFNT5P.mjs";
11
- import "./chunk-GAUBBDIR.mjs";
11
+ import "./chunk-JIXMPJZA.mjs";
12
12
  import {
13
13
  __spreadValues,
14
14
  init_react_import
@@ -1,4 +1,4 @@
1
- import { H as History, f as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, g as RootDataWithProps, h as ResolveDataTrigger, i as Plugin, j as Overrides, V as Viewports, I as IframeConfig, k as UiState, l as ComponentConfig, A as AppState, M as Metadata, m as FieldTransforms, n as RichtextField } from './actions-CQmL3wwa.mjs';
1
+ import { H as History, f as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, g as RootDataWithProps, h as ResolveDataTrigger, i as Plugin, j as Overrides, V as Viewports, I as IframeConfig, k as UiState, l as ComponentConfig, A as AppState, M as Metadata, m as FieldTransforms, n as RichtextField } from './actions-BDMhAtxP.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, f as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, g as RootDataWithProps, h as ResolveDataTrigger, i as Plugin, j as Overrides, V as Viewports, I as IframeConfig, k as UiState, l as ComponentConfig, A as AppState, M as Metadata, m as FieldTransforms, n as RichtextField } from './actions-CQmL3wwa.js';
1
+ import { H as History, f as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, g as RootDataWithProps, h as ResolveDataTrigger, i as Plugin, j as Overrides, V as Viewports, I as IframeConfig, k as UiState, l as ComponentConfig, A as AppState, M as Metadata, m as FieldTransforms, n as RichtextField } from './actions-BDMhAtxP.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 { D as Data, o as Field, p as FieldProps, q as DropZoneProps, C as Config, U as UserGenerics, k as UiState, O as OnAction, f as Permissions, i as Plugin, j as Overrides, m as FieldTransforms, E as EditorAction, V as Viewports, I as IframeConfig, r as InitialHistory, M as Metadata, h as ResolveDataTrigger, s as ItemSelector, b as ComponentData, t as PluginInternal } from './actions-CQmL3wwa.mjs';
2
- export { u as Adaptor, A as AppState, v as ArrayField, w as ArrayState, x as AsFieldProps, B as BaseData, y as BaseField, z as CacheOpts, l as ComponentConfig, G as ComponentConfigExtensions, J as ComponentConfigParams, K as ComponentDataMap, L as ComponentDataOptionalId, N as ComponentMetadata, Q as ConfigParams, a as Content, S as CustomField, T as CustomFieldRender, d as DefaultComponentProps, c as DefaultComponents, e as DefaultRootFieldProps, X as DefaultRootProps, Y as DefaultRootRenderProps, Z as Direction, _ as DragAxis, $ as EditorComponent, a0 as EditorContext, a1 as EditorMetadata, a2 as ExternalField, a3 as ExternalFieldWithAdaptor, a4 as ExtractConfigParams, a5 as ExtractField, a6 as FieldMetadata, a7 as FieldRenderFunctions, a8 as FieldTransformFn, a9 as FieldTransformFnParams, F as Fields, H as History, aa as ItemWithId, ab as MappedItem, ac as NumberField, ad as ObjectField, ae as OverrideKey, af as RadioField, ag as RichText, n as RichtextField, ah as RootConfig, R as RootData, g 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, ar as WithEditorProps, W as WithId, as as WithSlotProps, at as overrideKeys } from './actions-CQmL3wwa.mjs';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-Dwv3c_9M.mjs';
1
+ import { D as Data, o as Field, p as FieldProps, C as Config, U as UserGenerics, k as UiState, O as OnAction, f as Permissions, i as Plugin, j as Overrides, m as FieldTransforms, E as EditorAction, V as Viewports, I as IframeConfig, q as InitialHistory, M as Metadata, b as ComponentData, d as DefaultComponentProps, e as DefaultRootFieldProps, h as ResolveDataTrigger, r as ItemSelector, s as PluginInternal } from './actions-BDMhAtxP.mjs';
2
+ export { t as Adaptor, A as AppState, u as ArrayField, v as ArrayState, w as AsFieldProps, B as BaseData, x as BaseField, y as CacheOpts, l as ComponentConfig, z as ComponentConfigExtensions, G as ComponentConfigParams, J as ComponentDataMap, K as ComponentDataOptionalId, L as ComponentMetadata, N as ConfigParams, a as Content, Q as CustomField, S as CustomFieldRender, c as DefaultComponents, T as DefaultRootProps, X as DefaultRootRenderProps, Y as Direction, Z as DragAxis, _ as EditorComponent, $ as EditorContext, a0 as EditorMetadata, a1 as ExternalField, a2 as ExternalFieldWithAdaptor, a3 as ExtractConfigParams, a4 as ExtractField, a5 as FieldMetadata, a6 as FieldRenderFunctions, a7 as FieldTransformFn, a8 as FieldTransformFnParams, F as Fields, H as History, a9 as ItemWithId, aa as MappedItem, ab as NumberField, ac as ObjectField, ad as OverrideKey, ae as RadioField, af as RichText, n as RichtextField, ag as RootConfig, R as RootData, g as RootDataWithProps, ah as RootDataWithoutProps, ai as SelectField, aj as Slot, ak as SlotComponent, al as SlotField, am as TextField, an as TextareaField, ao as Viewport, ap as WithChildren, aq as WithEditorProps, W as WithId, ar as WithSlotProps, as as overrideKeys } from './actions-BDMhAtxP.mjs';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-LcQXXDqe.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-BOP2qNVA.mjs';
7
+ import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-BwLKseT7.mjs';
8
8
  import '@tiptap/react';
9
9
  import '@tiptap/extension-blockquote';
10
10
  import '@tiptap/extension-bold';
@@ -141,8 +141,6 @@ declare const Drawer: {
141
141
  }) => react_jsx_runtime.JSX.Element;
142
142
  };
143
143
 
144
- declare const DropZone: react.ForwardRefExoticComponent<Omit<DropZoneProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
145
-
146
144
  declare const IconButton: ({ active, children, href, onClick, type, disabled, tabIndex, newTab, fullWidth, title, suppressHydrationWarning, }: {
147
145
  active?: boolean;
148
146
  children: ReactNode;
@@ -196,6 +194,7 @@ type EditorProps<UserConfig extends Config = Config, G extends UserGenerics<User
196
194
  disableZoomControls?: boolean;
197
195
  _experimentalVirtualization?: boolean;
198
196
  };
197
+ declare const usePropsContext: () => EditorProps<Config, UserGenerics<Config>>;
199
198
  declare function Editor<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(props: EditorProps<UserConfig>): react_jsx_runtime.JSX.Element;
200
199
  declare namespace Editor {
201
200
  var Components: () => react_jsx_runtime.JSX.Element;
@@ -331,7 +330,35 @@ declare const registerOverlayPortal: (el: HTMLElement | null | undefined, opts?:
331
330
  */
332
331
  declare function setDeep<T extends Record<string, any>>(node: T, path: string, newVal: any): T;
333
332
 
334
- type UseEditorData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
333
+ type Parent = {
334
+ id: string;
335
+ slot: string;
336
+ };
337
+ type InsertComponentArgs = {
338
+ type: string;
339
+ parent?: Parent;
340
+ index?: number;
341
+ data?: ComponentData;
342
+ select?: boolean;
343
+ };
344
+ type MoveDestination = {
345
+ parent?: Parent;
346
+ index: number;
347
+ };
348
+ type EditorCommands = {
349
+ insertComponent: (args: InsertComponentArgs) => {
350
+ id: string;
351
+ };
352
+ removeComponent: (id: string) => void;
353
+ duplicateComponent: (id: string) => void;
354
+ moveComponent: (id: string, to: MoveDestination) => void;
355
+ replaceComponent: (id: string, data: ComponentData) => void;
356
+ updateProps: (id: string, updater: Partial<DefaultComponentProps> | ((prev: DefaultComponentProps) => Partial<DefaultComponentProps>)) => void;
357
+ updateRoot: (updater: Partial<DefaultRootFieldProps> | ((prev: DefaultRootFieldProps) => Partial<DefaultRootFieldProps>)) => void;
358
+ selectComponent: (id: string | null) => void;
359
+ };
360
+
361
+ type UseEditorData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = EditorCommands & {
335
362
  appState: G["UserPublicAppState"];
336
363
  config: UserConfig;
337
364
  dispatch: AppStore["dispatch"];
@@ -385,4 +412,4 @@ declare const outlinePlugin: () => Plugin;
385
412
 
386
413
  declare const legacySideBarPlugin: () => Plugin;
387
414
 
388
- export { Action, ActionBar, AutoField, Button, ComponentData, ComponentList, Config, Data, Drawer, DropZone, Editor, EditorAction, type EditorApi, Field, FieldLabel, FieldProps, FieldTransforms, type GlobalsMap, Group, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, type PageMetadata, Permissions, Plugin, Render, ResolveDataTrigger, RichTextMenu, type Route, Separator, UiState, type UseEditorData, UserGenerics, Viewports, blocksPlugin, createUseEditor, fieldsPlugin, legacySideBarPlugin, outlinePlugin, pageMetadata, registerOverlayPortal, renderContext, setDeep, useEditor, useGetEditor };
415
+ export { Action, ActionBar, AutoField, Button, ComponentData, ComponentList, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, Editor, EditorAction, type EditorApi, type EditorCommands, Field, FieldLabel, FieldProps, FieldTransforms, type GlobalsMap, Group, IconButton, IframeConfig, InitialHistory, type InsertComponentArgs, Label, Metadata, type MoveDestination, OnAction, Overrides, type PageMetadata, type Parent, Permissions, Plugin, Render, ResolveDataTrigger, RichTextMenu, type Route, Separator, UiState, type UseEditorData, UserGenerics, Viewports, blocksPlugin, createUseEditor, fieldsPlugin, legacySideBarPlugin, outlinePlugin, pageMetadata, registerOverlayPortal, renderContext, setDeep, useEditor, useGetEditor, usePropsContext };