@reacteditor/core 0.0.16 → 0.0.18

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 (34) hide show
  1. package/dist/{Editor-4LPVLYSU.css → Editor-IRCQF4VT.css} +10 -16
  2. package/dist/{Editor-J7XDD77B.mjs → Editor-ULH2S4LO.mjs} +7 -7
  3. package/dist/{Render-STFB5CNO.mjs → Render-IDDFFANP.mjs} +1 -1
  4. package/dist/{chunk-4L7H4JV4.mjs → chunk-AD67LVXW.mjs} +2 -2
  5. package/dist/{chunk-RGC274VM.mjs → chunk-DGIVBKSJ.mjs} +1 -1
  6. package/dist/{chunk-Y2EFNT5P.mjs → chunk-DQU3HIP4.mjs} +16 -6
  7. package/dist/{chunk-RQZQMS6E.mjs → chunk-HR67L662.mjs} +1 -1
  8. package/dist/{chunk-TG2KTWSB.mjs → chunk-IOAYKTDH.mjs} +1 -1
  9. package/dist/{chunk-JHURG5NN.mjs → chunk-LFJGTSUB.mjs} +14 -2
  10. package/dist/{chunk-5QKQ3LQJ.mjs → chunk-NABX5FH7.mjs} +4 -4
  11. package/dist/{chunk-Q667J2EG.mjs → chunk-UQHR5LFK.mjs} +130 -29
  12. package/dist/{chunk-3NSI5XES.mjs → chunk-WUEYD7ZN.mjs} +60 -47
  13. package/dist/{full-7ABPY2WA.css → full-B5V3G4IY.css} +10 -16
  14. package/dist/{full-T5SGODJ2.mjs → full-LIVYWOAF.mjs} +6 -6
  15. package/dist/{index-BZRpxcwy.d.mts → index-CUe2XTb6.d.mts} +28 -1
  16. package/dist/{index-B_21fGrq.d.ts → index-CYzc1n29.d.ts} +28 -1
  17. package/dist/index.css +10 -16
  18. package/dist/index.d.mts +35 -20
  19. package/dist/index.d.ts +35 -20
  20. package/dist/index.js +194 -59
  21. package/dist/index.mjs +9 -9
  22. package/dist/internal.d.mts +1 -1
  23. package/dist/internal.d.ts +1 -1
  24. package/dist/{loaded-ZQCRSG65.mjs → loaded-FZVSXAM7.mjs} +3 -3
  25. package/dist/{loaded-DUBT6SP5.mjs → loaded-MSWM6QEM.mjs} +3 -3
  26. package/dist/{loaded-6YKSFCCD.mjs → loaded-PYHJ6TB5.mjs} +3 -3
  27. package/dist/no-external.css +10 -16
  28. package/dist/no-external.d.mts +2 -2
  29. package/dist/no-external.d.ts +2 -2
  30. package/dist/no-external.js +194 -59
  31. package/dist/no-external.mjs +9 -9
  32. package/dist/rsc.js +16 -6
  33. package/dist/rsc.mjs +2 -2
  34. package/package.json +1 -1
@@ -88,25 +88,19 @@
88
88
  }
89
89
 
90
90
  /* css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Loader/styles.module.css/#css-module-data */
91
- @keyframes _loader-animation_nacdm_1 {
92
- 0% {
93
- transform: rotate(0deg) scale(1);
91
+ @keyframes _loader-spin_6933g_1 {
92
+ from {
93
+ transform: rotate(0deg);
94
94
  }
95
- 50% {
96
- transform: rotate(180deg) scale(0.8);
97
- }
98
- 100% {
99
- transform: rotate(360deg) scale(1);
95
+ to {
96
+ transform: rotate(360deg);
100
97
  }
101
98
  }
102
- ._Loader_nacdm_13 {
103
- background: transparent;
104
- border-radius: 100%;
105
- border: 2px solid currentColor;
106
- border-bottom-color: transparent;
107
- display: inline-block;
108
- animation: _loader-animation_nacdm_1 1s 0s infinite linear;
109
- animation-fill-mode: both;
99
+ ._Loader_6933g_10 {
100
+ display: inline-flex;
101
+ align-items: center;
102
+ justify-content: center;
103
+ animation: _loader-spin_6933g_1 1s linear infinite;
110
104
  }
111
105
 
112
106
  /* css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ActionBar/styles.module.css/#css-module-data */
@@ -4,19 +4,19 @@ import {
4
4
  import {
5
5
  EditorInner,
6
6
  LoadedRichTextMenu
7
- } from "./chunk-5QKQ3LQJ.mjs";
8
- import "./chunk-Q667J2EG.mjs";
9
- import "./chunk-RQZQMS6E.mjs";
7
+ } from "./chunk-NABX5FH7.mjs";
8
+ import "./chunk-UQHR5LFK.mjs";
9
+ import "./chunk-HR67L662.mjs";
10
10
  import "./chunk-6QJ2HF4O.mjs";
11
- import "./chunk-RGC274VM.mjs";
12
- import "./chunk-TG2KTWSB.mjs";
11
+ import "./chunk-DGIVBKSJ.mjs";
12
+ import "./chunk-IOAYKTDH.mjs";
13
13
  import {
14
14
  useAppStore,
15
15
  useAppStoreApi
16
- } from "./chunk-JHURG5NN.mjs";
16
+ } from "./chunk-LFJGTSUB.mjs";
17
17
  import "./chunk-M4JDRFYB.mjs";
18
18
  import "./chunk-FTVOCMGV.mjs";
19
- import "./chunk-Y2EFNT5P.mjs";
19
+ import "./chunk-DQU3HIP4.mjs";
20
20
  import "./chunk-JIXMPJZA.mjs";
21
21
  import {
22
22
  __spreadProps,
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-6QJ2HF4O.mjs";
7
7
  import {
8
8
  get_class_name_factory_default
9
- } from "./chunk-Y2EFNT5P.mjs";
9
+ } from "./chunk-DQU3HIP4.mjs";
10
10
  import {
11
11
  init_react_import
12
12
  } from "./chunk-M6W7YEVX.mjs";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-FTVOCMGV.mjs";
8
8
  import {
9
9
  get_class_name_factory_default
10
- } from "./chunk-Y2EFNT5P.mjs";
10
+ } from "./chunk-DQU3HIP4.mjs";
11
11
  import {
12
12
  generateId,
13
13
  getZoneId,
@@ -444,7 +444,7 @@ function useRichtextProps(fields, props) {
444
444
  const richtextProps = useMemo2(() => {
445
445
  if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
446
446
  const RichTextRender = lazy(
447
- () => import("./Render-STFB5CNO.mjs").then((m) => ({
447
+ () => import("./Render-IDDFFANP.mjs").then((m) => ({
448
448
  default: m.RichTextRender
449
449
  }))
450
450
  );
@@ -3,7 +3,7 @@ import {
3
3
  AlignJustify,
4
4
  AlignLeft,
5
5
  AlignRight
6
- } from "./chunk-JHURG5NN.mjs";
6
+ } from "./chunk-LFJGTSUB.mjs";
7
7
  import {
8
8
  init_react_import
9
9
  } from "./chunk-M6W7YEVX.mjs";
@@ -70,19 +70,29 @@ var require_classnames = __commonJS({
70
70
  // lib/get-class-name-factory.ts
71
71
  init_react_import();
72
72
  var import_classnames = __toESM(require_classnames());
73
- var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (options = {}) => {
73
+ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (options = {}, modifiers) => {
74
74
  if (typeof options === "string") {
75
75
  const descendant = options;
76
- const style = styles[`${rootClass}-${descendant}`];
76
+ const baseKey = `${rootClass}-${descendant}`;
77
+ const style = styles[baseKey];
78
+ if (modifiers) {
79
+ const prefixedModifiers = {};
80
+ for (let modifier in modifiers) {
81
+ prefixedModifiers[styles[`${baseKey}--${modifier}`]] = modifiers[modifier];
82
+ }
83
+ return config.baseClass + (0, import_classnames.default)(__spreadValues({
84
+ [style]: !!style
85
+ }, prefixedModifiers));
86
+ }
77
87
  if (style) {
78
- return config.baseClass + styles[`${rootClass}-${descendant}`] || "";
88
+ return config.baseClass + style;
79
89
  }
80
90
  return "";
81
91
  } else if (typeof options === "object") {
82
- const modifiers = options;
92
+ const modifiers2 = options;
83
93
  const prefixedModifiers = {};
84
- for (let modifier in modifiers) {
85
- prefixedModifiers[styles[`${rootClass}--${modifier}`]] = modifiers[modifier];
94
+ for (let modifier in modifiers2) {
95
+ prefixedModifiers[styles[`${rootClass}--${modifier}`]] = modifiers2[modifier];
86
96
  }
87
97
  const c = styles[rootClass];
88
98
  return config.baseClass + (0, import_classnames.default)(__spreadValues({
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  List,
3
3
  ListOrdered
4
- } from "./chunk-JHURG5NN.mjs";
4
+ } from "./chunk-LFJGTSUB.mjs";
5
5
  import {
6
6
  init_react_import
7
7
  } from "./chunk-M6W7YEVX.mjs";
@@ -5,7 +5,7 @@ import {
5
5
  Heading4,
6
6
  Heading5,
7
7
  Heading6
8
- } from "./chunk-JHURG5NN.mjs";
8
+ } from "./chunk-LFJGTSUB.mjs";
9
9
  import {
10
10
  init_react_import
11
11
  } from "./chunk-M6W7YEVX.mjs";
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-FTVOCMGV.mjs";
12
12
  import {
13
13
  get_class_name_factory_default
14
- } from "./chunk-Y2EFNT5P.mjs";
14
+ } from "./chunk-DQU3HIP4.mjs";
15
15
  import {
16
16
  generateId,
17
17
  walkAppState
@@ -1143,7 +1143,19 @@ var createAppStore = (initialAppStore) => create2()(
1143
1143
  metadata: {},
1144
1144
  fieldTransforms: {},
1145
1145
  scrollToComponent: () => {
1146
- }
1146
+ },
1147
+ route: null,
1148
+ isPublishing: false,
1149
+ publish: () => __async(null, null, function* () {
1150
+ const { onPublish, state, route } = get();
1151
+ if (!onPublish) return;
1152
+ set({ isPublishing: true });
1153
+ try {
1154
+ yield onPublish({ data: state.data, route });
1155
+ } finally {
1156
+ set({ isPublishing: false });
1157
+ }
1158
+ })
1147
1159
  }, initialAppStore), {
1148
1160
  fields: createFieldsSlice(set, get),
1149
1161
  history: createHistorySlice(set, get),
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  LoadedRichTextMenuInner
3
- } from "./chunk-Q667J2EG.mjs";
3
+ } from "./chunk-UQHR5LFK.mjs";
4
4
  import {
5
5
  styles_module_default
6
6
  } from "./chunk-6QJ2HF4O.mjs";
7
7
  import {
8
8
  useAppStore,
9
9
  useAppStoreApi
10
- } from "./chunk-JHURG5NN.mjs";
10
+ } from "./chunk-LFJGTSUB.mjs";
11
11
  import {
12
12
  get_class_name_factory_default
13
- } from "./chunk-Y2EFNT5P.mjs";
13
+ } from "./chunk-DQU3HIP4.mjs";
14
14
  import {
15
15
  __spreadValues,
16
16
  init_react_import
@@ -100,7 +100,7 @@ init_react_import();
100
100
  import { lazy, Suspense } from "react";
101
101
  import { jsx as jsx2 } from "react/jsx-runtime";
102
102
  var LoadedRichTextMenuFull = lazy(
103
- () => import("./full-T5SGODJ2.mjs").then((m) => ({
103
+ () => import("./full-LIVYWOAF.mjs").then((m) => ({
104
104
  default: m.LoadedRichTextMenuFull
105
105
  }))
106
106
  );
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  useListOptions
3
- } from "./chunk-RQZQMS6E.mjs";
3
+ } from "./chunk-HR67L662.mjs";
4
4
  import {
5
5
  useAlignOptions
6
- } from "./chunk-RGC274VM.mjs";
6
+ } from "./chunk-DGIVBKSJ.mjs";
7
7
  import {
8
8
  useHeadingOptions
9
- } from "./chunk-TG2KTWSB.mjs";
9
+ } from "./chunk-IOAYKTDH.mjs";
10
10
  import {
11
11
  AlignCenter,
12
12
  AlignJustify,
@@ -26,12 +26,13 @@ import {
26
26
  Strikethrough,
27
27
  Underline,
28
28
  useControlContext
29
- } from "./chunk-JHURG5NN.mjs";
29
+ } from "./chunk-LFJGTSUB.mjs";
30
30
  import {
31
31
  get_class_name_factory_default
32
- } from "./chunk-Y2EFNT5P.mjs";
32
+ } from "./chunk-DQU3HIP4.mjs";
33
33
  import {
34
34
  __objRest,
35
+ __spreadProps,
35
36
  __spreadValues,
36
37
  init_react_import
37
38
  } from "./chunk-M6W7YEVX.mjs";
@@ -102,35 +103,135 @@ init_react_import();
102
103
 
103
104
  // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Loader/styles.module.css#css-module
104
105
  init_react_import();
105
- var styles_module_default2 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
106
+ var styles_module_default2 = { "Loader": "_Loader_6933g_10", "loader-spin": "_loader-spin_6933g_1" };
106
107
 
107
108
  // components/Loader/index.tsx
108
- import { jsx as jsx2 } from "react/jsx-runtime";
109
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
109
110
  var getClassName2 = get_class_name_factory_default("Loader", styles_module_default2);
111
+ var LoaderIcon = ({ size = 16 }) => /* @__PURE__ */ jsxs2(
112
+ "svg",
113
+ {
114
+ height: size,
115
+ strokeLinejoin: "round",
116
+ style: { color: "currentcolor" },
117
+ viewBox: "0 0 16 16",
118
+ width: size,
119
+ "aria-hidden": "true",
120
+ children: [
121
+ /* @__PURE__ */ jsxs2("g", { clipPath: "url(#editor-loader-clip)", children: [
122
+ /* @__PURE__ */ jsx2("path", { d: "M8 0V4", stroke: "currentColor", strokeWidth: "1.5" }),
123
+ /* @__PURE__ */ jsx2(
124
+ "path",
125
+ {
126
+ d: "M8 16V12",
127
+ opacity: "0.5",
128
+ stroke: "currentColor",
129
+ strokeWidth: "1.5"
130
+ }
131
+ ),
132
+ /* @__PURE__ */ jsx2(
133
+ "path",
134
+ {
135
+ d: "M3.29773 1.52783L5.64887 4.7639",
136
+ opacity: "0.9",
137
+ stroke: "currentColor",
138
+ strokeWidth: "1.5"
139
+ }
140
+ ),
141
+ /* @__PURE__ */ jsx2(
142
+ "path",
143
+ {
144
+ d: "M12.7023 1.52783L10.3511 4.7639",
145
+ opacity: "0.1",
146
+ stroke: "currentColor",
147
+ strokeWidth: "1.5"
148
+ }
149
+ ),
150
+ /* @__PURE__ */ jsx2(
151
+ "path",
152
+ {
153
+ d: "M12.7023 14.472L10.3511 11.236",
154
+ opacity: "0.4",
155
+ stroke: "currentColor",
156
+ strokeWidth: "1.5"
157
+ }
158
+ ),
159
+ /* @__PURE__ */ jsx2(
160
+ "path",
161
+ {
162
+ d: "M3.29773 14.472L5.64887 11.236",
163
+ opacity: "0.6",
164
+ stroke: "currentColor",
165
+ strokeWidth: "1.5"
166
+ }
167
+ ),
168
+ /* @__PURE__ */ jsx2(
169
+ "path",
170
+ {
171
+ d: "M15.6085 5.52783L11.8043 6.7639",
172
+ opacity: "0.2",
173
+ stroke: "currentColor",
174
+ strokeWidth: "1.5"
175
+ }
176
+ ),
177
+ /* @__PURE__ */ jsx2(
178
+ "path",
179
+ {
180
+ d: "M0.391602 10.472L4.19583 9.23598",
181
+ opacity: "0.7",
182
+ stroke: "currentColor",
183
+ strokeWidth: "1.5"
184
+ }
185
+ ),
186
+ /* @__PURE__ */ jsx2(
187
+ "path",
188
+ {
189
+ d: "M15.6085 10.4722L11.8043 9.2361",
190
+ opacity: "0.3",
191
+ stroke: "currentColor",
192
+ strokeWidth: "1.5"
193
+ }
194
+ ),
195
+ /* @__PURE__ */ jsx2(
196
+ "path",
197
+ {
198
+ d: "M0.391602 5.52783L4.19583 6.7639",
199
+ opacity: "0.8",
200
+ stroke: "currentColor",
201
+ strokeWidth: "1.5"
202
+ }
203
+ )
204
+ ] }),
205
+ /* @__PURE__ */ jsx2("defs", { children: /* @__PURE__ */ jsx2("clipPath", { id: "editor-loader-clip", children: /* @__PURE__ */ jsx2("rect", { fill: "white", height: "16", width: "16" }) }) })
206
+ ]
207
+ }
208
+ );
110
209
  var Loader = (_a) => {
111
210
  var _b = _a, {
112
211
  color,
113
- size = 16
212
+ size = 16,
213
+ className,
214
+ style
114
215
  } = _b, props = __objRest(_b, [
115
216
  "color",
116
- "size"
217
+ "size",
218
+ "className",
219
+ "style"
117
220
  ]);
118
221
  return /* @__PURE__ */ jsx2(
119
- "span",
120
- __spreadValues({
121
- className: getClassName2(),
122
- style: {
123
- width: size,
124
- height: size,
125
- color
126
- },
222
+ "div",
223
+ __spreadProps(__spreadValues({
224
+ className: [getClassName2(), className].filter(Boolean).join(" "),
225
+ style: __spreadValues({ color }, style),
127
226
  "aria-label": "loading"
128
- }, props)
227
+ }, props), {
228
+ children: /* @__PURE__ */ jsx2(LoaderIcon, { size })
229
+ })
129
230
  );
130
231
  };
131
232
 
132
233
  // components/IconButton/IconButton.tsx
133
- import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
234
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
134
235
  var getClassName3 = get_class_name_factory_default("IconButton", IconButton_module_default);
135
236
  var IconButton = ({
136
237
  active = false,
@@ -147,7 +248,7 @@ var IconButton = ({
147
248
  }) => {
148
249
  const [loading, setLoading] = useState(false);
149
250
  const ElementType = href ? "a" : "button";
150
- const el = /* @__PURE__ */ jsxs2(
251
+ const el = /* @__PURE__ */ jsxs3(
151
252
  ElementType,
152
253
  {
153
254
  className: getClassName3({
@@ -173,7 +274,7 @@ var IconButton = ({
173
274
  children: [
174
275
  /* @__PURE__ */ jsx3("span", { className: getClassName3("title"), children: title }),
175
276
  children,
176
- loading && /* @__PURE__ */ jsxs2(Fragment, { children: [
277
+ loading && /* @__PURE__ */ jsxs3(Fragment, { children: [
177
278
  "\xA0\xA0",
178
279
  /* @__PURE__ */ jsx3(Loader, { size: 14 })
179
280
  ] })
@@ -349,7 +450,7 @@ function AlignSelectFallback() {
349
450
  // components/RichTextMenu/controls/AlignSelect/index.tsx
350
451
  import { jsx as jsx10 } from "react/jsx-runtime";
351
452
  var AlignSelectLoaded = lazy(
352
- () => import("./loaded-ZQCRSG65.mjs").then((m) => ({
453
+ () => import("./loaded-FZVSXAM7.mjs").then((m) => ({
353
454
  default: m.AlignSelectLoaded
354
455
  }))
355
456
  );
@@ -580,7 +681,7 @@ function HeadingSelectFallback() {
580
681
  // components/RichTextMenu/controls/HeadingSelect/index.tsx
581
682
  import { jsx as jsx22 } from "react/jsx-runtime";
582
683
  var HeadingSelectLoaded = lazy2(
583
- () => import("./loaded-6YKSFCCD.mjs").then((m) => ({
684
+ () => import("./loaded-PYHJ6TB5.mjs").then((m) => ({
584
685
  default: m.HeadingSelectLoaded
585
686
  }))
586
687
  );
@@ -612,14 +713,14 @@ function ListSelectFallback() {
612
713
  // components/RichTextMenu/controls/ListSelect/index.tsx
613
714
  import { jsx as jsx24 } from "react/jsx-runtime";
614
715
  var ListSelectLoaded = lazy3(
615
- () => import("./loaded-DUBT6SP5.mjs").then((m) => ({
716
+ () => import("./loaded-MSWM6QEM.mjs").then((m) => ({
616
717
  default: m.ListSelectLoaded
617
718
  }))
618
719
  );
619
720
  var ListSelect = () => /* @__PURE__ */ jsx24(Suspense3, { fallback: /* @__PURE__ */ jsx24(ListSelectFallback, {}), children: /* @__PURE__ */ jsx24(ListSelectLoaded, {}) });
620
721
 
621
722
  // components/RichTextMenu/inner.tsx
622
- import { jsx as jsx25, jsxs as jsxs3 } from "react/jsx-runtime";
723
+ import { jsx as jsx25, jsxs as jsxs4 } from "react/jsx-runtime";
623
724
  var getClassName5 = get_class_name_factory_default("RichTextMenu", styles_module_default3);
624
725
  var DefaultMenu = ({ children }) => {
625
726
  return /* @__PURE__ */ jsx25(RichTextMenu, { children });
@@ -673,18 +774,18 @@ var LoadedRichTextMenuInner = ({
673
774
  editor,
674
775
  editorState,
675
776
  readOnly,
676
- children: /* @__PURE__ */ jsxs3(Group2, { children: [
777
+ children: /* @__PURE__ */ jsxs4(Group2, { children: [
677
778
  /* @__PURE__ */ jsx25(Bold2, {}),
678
779
  /* @__PURE__ */ jsx25(Italic2, {}),
679
780
  /* @__PURE__ */ jsx25(Underline2, {})
680
781
  ] })
681
782
  }
682
- ) : /* @__PURE__ */ jsxs3(Menu, { editor, editorState, readOnly, children: [
683
- /* @__PURE__ */ jsxs3(Group2, { children: [
783
+ ) : /* @__PURE__ */ jsxs4(Menu, { editor, editorState, readOnly, children: [
784
+ /* @__PURE__ */ jsxs4(Group2, { children: [
684
785
  /* @__PURE__ */ jsx25(HeadingSelect, {}),
685
786
  /* @__PURE__ */ jsx25(ListSelect, {})
686
787
  ] }),
687
- /* @__PURE__ */ jsxs3(Group2, { children: [
788
+ /* @__PURE__ */ jsxs4(Group2, { children: [
688
789
  /* @__PURE__ */ jsx25(Bold2, {}),
689
790
  /* @__PURE__ */ jsx25(Italic2, {}),
690
791
  /* @__PURE__ */ jsx25(Underline2, {})