@puckeditor/core 0.22.4 → 0.23.0-canary.026f0300

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 (45) hide show
  1. package/dist/{Editor-ZZW3KF2T.css → Editor-T7TKW6NT.css} +7 -7
  2. package/dist/{Editor-MLHOIEVM.mjs → Editor-Z6P5UAVB.mjs} +8 -8
  3. package/dist/{actions-Csn3gOP8.d.mts → actions-3w-1VzY_.d.mts} +7 -1
  4. package/dist/{actions-Csn3gOP8.d.ts → actions-3w-1VzY_.d.ts} +7 -1
  5. package/dist/{chunk-25O24MZR.mjs → chunk-3OLRWMRO.mjs} +37 -22
  6. package/dist/{chunk-JNJJ2M57.mjs → chunk-3TERNOIP.mjs} +1 -1
  7. package/dist/{chunk-KJQTOPIV.mjs → chunk-DIYX54ZO.mjs} +136 -7
  8. package/dist/{chunk-4I2WN43X.mjs → chunk-L73ATZ55.mjs} +15 -8
  9. package/dist/{chunk-WUO7D6OQ.mjs → chunk-NPAYGEG5.mjs} +1 -0
  10. package/dist/{chunk-C2H4WQP2.mjs → chunk-OCFR2FFG.mjs} +27 -12
  11. package/dist/{chunk-NKDMBWQC.mjs → chunk-OSPG5CWL.mjs} +21 -10
  12. package/dist/{chunk-PRZEIT36.mjs → chunk-PJYHZPJK.mjs} +3 -3
  13. package/dist/{chunk-WH6PO5ND.mjs → chunk-S3CSGIQ3.mjs} +2047 -797
  14. package/dist/{chunk-25QAPMLH.mjs → chunk-UAWUZ45G.mjs} +41 -18
  15. package/dist/{full-YXSOFDYM.mjs → full-67VCA5MX.mjs} +7 -7
  16. package/dist/{full-S3QQ2IBQ.css → full-AAZK6KLI.css} +7 -7
  17. package/dist/index-KWLAZybR.d.ts +206 -0
  18. package/dist/index-l1l-a8tj.d.mts +206 -0
  19. package/dist/index.css +308 -111
  20. package/dist/index.d.mts +24 -11
  21. package/dist/index.d.ts +24 -11
  22. package/dist/index.js +2352 -809
  23. package/dist/index.mjs +10 -10
  24. package/dist/internal.d.mts +2 -2
  25. package/dist/internal.d.ts +2 -2
  26. package/dist/internal.js +40 -18
  27. package/dist/internal.mjs +1 -1
  28. package/dist/{loaded-LMF4JLYG.mjs → loaded-4XVG2RKQ.mjs} +4 -4
  29. package/dist/{loaded-FVWRAJR3.css → loaded-CA3Q7UHH.css} +7 -7
  30. package/dist/{loaded-IFFZACEG.mjs → loaded-LM723CWI.mjs} +4 -4
  31. package/dist/{loaded-SJJPEREQ.mjs → loaded-VBJBTUSI.mjs} +4 -4
  32. package/dist/no-external.css +308 -111
  33. package/dist/no-external.d.mts +4 -4
  34. package/dist/no-external.d.ts +4 -4
  35. package/dist/no-external.js +2352 -809
  36. package/dist/no-external.mjs +10 -10
  37. package/dist/rsc.d.mts +2 -2
  38. package/dist/rsc.d.ts +2 -2
  39. package/dist/rsc.js +1 -0
  40. package/dist/rsc.mjs +2 -2
  41. package/dist/{walk-tree-CWrsBHHe.d.ts → walk-tree-ConR82Y6.d.ts} +1 -1
  42. package/dist/{walk-tree-BrW9VQ_t.d.mts → walk-tree-DJMo6GTF.d.mts} +1 -1
  43. package/package.json +1 -1
  44. package/dist/index-B1b1cFug.d.ts +0 -117
  45. package/dist/index-ClzBCbx_.d.mts +0 -117
package/dist/index.mjs CHANGED
@@ -17,20 +17,20 @@ import {
17
17
  setDeep,
18
18
  useGetPuck,
19
19
  usePuck
20
- } from "./chunk-WH6PO5ND.mjs";
21
- import "./chunk-PRZEIT36.mjs";
20
+ } from "./chunk-S3CSGIQ3.mjs";
21
+ import "./chunk-PJYHZPJK.mjs";
22
22
  import {
23
23
  migrate,
24
24
  resolveAllData,
25
25
  transformProps
26
- } from "./chunk-JNJJ2M57.mjs";
26
+ } from "./chunk-3TERNOIP.mjs";
27
27
  import "./chunk-H635BA2V.mjs";
28
28
  import {
29
29
  RichTextMenu
30
- } from "./chunk-25O24MZR.mjs";
31
- import "./chunk-NKDMBWQC.mjs";
32
- import "./chunk-C2H4WQP2.mjs";
33
- import "./chunk-4I2WN43X.mjs";
30
+ } from "./chunk-3OLRWMRO.mjs";
31
+ import "./chunk-OSPG5CWL.mjs";
32
+ import "./chunk-OCFR2FFG.mjs";
33
+ import "./chunk-L73ATZ55.mjs";
34
34
  import {
35
35
  Action,
36
36
  ActionBar,
@@ -38,9 +38,9 @@ import {
38
38
  IconButton,
39
39
  Label,
40
40
  Separator
41
- } from "./chunk-KJQTOPIV.mjs";
42
- import "./chunk-25QAPMLH.mjs";
43
- import "./chunk-WUO7D6OQ.mjs";
41
+ } from "./chunk-DIYX54ZO.mjs";
42
+ import "./chunk-UAWUZ45G.mjs";
43
+ import "./chunk-NPAYGEG5.mjs";
44
44
  import "./chunk-Y2EFNT5P.mjs";
45
45
  import {
46
46
  walkTree
@@ -1,6 +1,6 @@
1
1
  import { Reducer } from 'react';
2
- import { D as Data, a as AppState, Y as OnAction, a2 as PrivateAppState, a3 as PuckAction } from './actions-Csn3gOP8.mjs';
3
- import { A as AppStore } from './index-ClzBCbx_.mjs';
2
+ import { D as Data, a as AppState, Z as OnAction, a3 as PrivateAppState, a4 as PuckAction } from './actions-3w-1VzY_.mjs';
3
+ import { A as AppStore } from './index-l1l-a8tj.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, Y as OnAction, a2 as PrivateAppState, a3 as PuckAction } from './actions-Csn3gOP8.js';
3
- import { A as AppStore } from './index-B1b1cFug.js';
2
+ import { D as Data, a as AppState, Z as OnAction, a3 as PrivateAppState, a4 as PuckAction } from './actions-3w-1VzY_.js';
3
+ import { A as AppStore } from './index-KWLAZybR.js';
4
4
  import '@tiptap/react';
5
5
  import '@tiptap/extension-blockquote';
6
6
  import '@tiptap/extension-bold';
package/dist/internal.js CHANGED
@@ -780,16 +780,13 @@ var reorderAction = (state, action, appStore) => {
780
780
  // reducer/actions/remove.ts
781
781
  var removeAction = (state, action, appStore) => {
782
782
  const item = getItem({ index: action.index, zone: action.zone }, state);
783
- const nodesToDelete = Object.entries(state.indexes.nodes).reduce(
784
- (acc, [nodeId, nodeData]) => {
785
- const pathIds = nodeData.path.map((p) => p.split(":")[0]);
786
- if (pathIds.includes(item.props.id)) {
787
- return [...acc, nodeId];
788
- }
789
- return acc;
790
- },
791
- [item.props.id]
792
- );
783
+ const nodesToDelete = /* @__PURE__ */ new Set([item.props.id]);
784
+ Object.entries(state.indexes.nodes).forEach(([nodeId, nodeData]) => {
785
+ const pathIds = nodeData.path.map((p) => p.split(":")[0]);
786
+ if (pathIds.includes(item.props.id)) {
787
+ nodesToDelete.add(nodeId);
788
+ }
789
+ });
793
790
  const newState = walkAppState(
794
791
  state,
795
792
  appStore.config,
@@ -802,19 +799,22 @@ var removeAction = (state, action, appStore) => {
802
799
  );
803
800
  Object.keys(newState.data.zones || {}).forEach((zoneCompound) => {
804
801
  const parentId = zoneCompound.split(":")[0];
805
- if (nodesToDelete.includes(parentId) && newState.data.zones) {
802
+ if (nodesToDelete.has(parentId) && newState.data.zones) {
806
803
  delete newState.data.zones[zoneCompound];
807
804
  }
808
805
  });
809
806
  Object.keys(newState.indexes.zones).forEach((zoneCompound) => {
810
807
  const parentId = zoneCompound.split(":")[0];
811
- if (nodesToDelete.includes(parentId)) {
808
+ if (nodesToDelete.has(parentId)) {
812
809
  delete newState.indexes.zones[zoneCompound];
813
810
  }
814
811
  });
812
+ const newItemExpanded = __spreadValues({}, newState.ui.itemExpanded);
815
813
  nodesToDelete.forEach((id) => {
816
814
  delete newState.indexes.nodes[id];
815
+ delete newItemExpanded[id];
817
816
  });
817
+ newState.ui = __spreadProps(__spreadValues({}, newState.ui), { itemExpanded: newItemExpanded });
818
818
  return newState;
819
819
  };
820
820
 
@@ -892,14 +892,36 @@ var setDataAction = (state, action, appStore) => {
892
892
  };
893
893
 
894
894
  // reducer/actions/set-ui.ts
895
- var setUiAction = (state, action) => {
896
- if (typeof action.ui === "object") {
897
- return __spreadProps(__spreadValues({}, state), {
898
- ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
899
- });
895
+ var revealSelectedItem = (state, partialUi) => {
896
+ var _a, _b;
897
+ const itemSelector = partialUi.itemSelector;
898
+ if (!itemSelector) {
899
+ return partialUi;
900
+ }
901
+ const item = getItem(itemSelector, state);
902
+ if (!item) {
903
+ return partialUi;
904
+ }
905
+ const path = (_b = (_a = state.indexes.nodes[item.props.id]) == null ? void 0 : _a.path) != null ? _b : [];
906
+ const collapsedAncestorIds = path.map((zoneCompound) => zoneCompound.split(":")[0]).filter(
907
+ (ancestorId) => {
908
+ var _a2, _b2;
909
+ return ancestorId && ancestorId !== rootAreaId && !((_a2 = state.ui.itemExpanded) == null ? void 0 : _a2[ancestorId]) && !((_b2 = partialUi.itemExpanded) == null ? void 0 : _b2[ancestorId]);
910
+ }
911
+ );
912
+ if (collapsedAncestorIds.length === 0) {
913
+ return partialUi;
900
914
  }
915
+ const itemExpanded = __spreadValues(__spreadValues({}, state.ui.itemExpanded), partialUi.itemExpanded);
916
+ collapsedAncestorIds.forEach((ancestorId) => {
917
+ itemExpanded[ancestorId] = true;
918
+ });
919
+ return __spreadProps(__spreadValues({}, partialUi), { itemExpanded });
920
+ };
921
+ var setUiAction = (state, action) => {
922
+ const partialUi = typeof action.ui === "object" ? action.ui : action.ui(state.ui);
901
923
  return __spreadProps(__spreadValues({}, state), {
902
- ui: __spreadValues(__spreadValues({}, state.ui), action.ui(state.ui))
924
+ ui: __spreadValues(__spreadValues({}, state.ui), revealSelectedItem(state, partialUi))
903
925
  });
904
926
  };
905
927
 
package/dist/internal.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createReducer
3
- } from "./chunk-25QAPMLH.mjs";
3
+ } from "./chunk-UAWUZ45G.mjs";
4
4
  import "./chunk-QHQD3BMI.mjs";
5
5
  import {
6
6
  init_react_import
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  useAlignOptions
3
- } from "./chunk-NKDMBWQC.mjs";
3
+ } from "./chunk-OSPG5CWL.mjs";
4
4
  import {
5
5
  AlignLeft,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-KJQTOPIV.mjs";
9
- import "./chunk-25QAPMLH.mjs";
10
- import "./chunk-WUO7D6OQ.mjs";
8
+ } from "./chunk-DIYX54ZO.mjs";
9
+ import "./chunk-UAWUZ45G.mjs";
10
+ import "./chunk-NPAYGEG5.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
12
  import "./chunk-QHQD3BMI.mjs";
13
13
  import {
@@ -58,7 +58,7 @@
58
58
  }
59
59
 
60
60
  /* css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css/#css-module-data */
61
- ._IconButton_yuha3_1 {
61
+ ._IconButton_1pxxt_1 {
62
62
  align-items: center;
63
63
  background: var(--puck-iconbutton-color-bg, transparent);
64
64
  border: none;
@@ -70,26 +70,26 @@
70
70
  padding: var(--puck-iconbutton-space, var(--puck-space-1));
71
71
  transition: background-color var(--puck-duration-fast) var(--puck-ease-exit), color var(--puck-duration-fast) var(--puck-ease-exit);
72
72
  }
73
- ._IconButton--active_yuha3_15 {
73
+ ._IconButton--active_1pxxt_15 {
74
74
  color: var( --puck-iconbutton-color-icon-active, var(--puck-color-interactive) );
75
75
  }
76
- ._IconButton_yuha3_1:focus-visible {
76
+ ._IconButton_1pxxt_1:focus-visible {
77
77
  outline: var(--puck-border-width-focus) solid var(--puck-color-focus-ring);
78
78
  outline-offset: calc(var(--puck-border-width-focus) * -1);
79
79
  }
80
80
  @media (hover: hover) and (pointer: fine) {
81
- ._IconButton_yuha3_1:hover:not(._IconButton--disabled_yuha3_28) {
82
- background: var( --puck-iconbutton-color-bg-hover, var(--puck-color-interactive-neutral-hover) );
81
+ ._IconButton_1pxxt_1:hover:not(._IconButton--disabled_1pxxt_28) {
82
+ background: var( --_puck-iconbutton-color-bg-hover, var( --puck-iconbutton-color-bg-hover, var(--puck-color-interactive-neutral-hover) ) );
83
83
  color: var( --puck-iconbutton-color-icon-hover, var(--puck-color-interactive) );
84
84
  cursor: pointer;
85
85
  transition: none;
86
86
  }
87
87
  }
88
- ._IconButton_yuha3_1:active {
88
+ ._IconButton_1pxxt_1:active {
89
89
  background: var( --puck-iconbutton-color-bg-active, var(--puck-color-interactive-soft) );
90
90
  transition: none;
91
91
  }
92
- ._IconButton--disabled_yuha3_28 {
92
+ ._IconButton--disabled_1pxxt_28 {
93
93
  color: var( --puck-iconbutton-color-icon-disabled, var(--puck-color-text-subtle) );
94
94
  }
95
95
 
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  useListOptions
3
- } from "./chunk-4I2WN43X.mjs";
3
+ } from "./chunk-L73ATZ55.mjs";
4
4
  import {
5
5
  List,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-KJQTOPIV.mjs";
9
- import "./chunk-25QAPMLH.mjs";
10
- import "./chunk-WUO7D6OQ.mjs";
8
+ } from "./chunk-DIYX54ZO.mjs";
9
+ import "./chunk-UAWUZ45G.mjs";
10
+ import "./chunk-NPAYGEG5.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
12
  import "./chunk-QHQD3BMI.mjs";
13
13
  import {
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  useHeadingOptions
3
- } from "./chunk-C2H4WQP2.mjs";
3
+ } from "./chunk-OCFR2FFG.mjs";
4
4
  import {
5
5
  Heading,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-KJQTOPIV.mjs";
9
- import "./chunk-25QAPMLH.mjs";
10
- import "./chunk-WUO7D6OQ.mjs";
8
+ } from "./chunk-DIYX54ZO.mjs";
9
+ import "./chunk-UAWUZ45G.mjs";
10
+ import "./chunk-NPAYGEG5.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
12
  import "./chunk-QHQD3BMI.mjs";
13
13
  import {