@lunejs/admin-ui 0.1.4 → 0.2.0

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 (91) hide show
  1. package/dist/_virtual/index10.js +5 -2
  2. package/dist/_virtual/index11.js +4 -0
  3. package/dist/_virtual/index6.js +3 -3
  4. package/dist/_virtual/index8.js +3 -5
  5. package/dist/lib/api/fetchers/gql-fetcher.js +6 -6
  6. package/dist/lib/collections/components/collection-details/cards/general-card.js +20 -14
  7. package/dist/lib/custom-fields/components/fields/color.js +3 -3
  8. package/dist/lib/dashboard/pages/dashboard-page.js +5 -5
  9. package/dist/lib/product/components/product-details/cards/general-product-card.js +18 -12
  10. package/dist/node_modules/@tiptap/core/dist/index.js +3562 -0
  11. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +17 -0
  12. package/dist/node_modules/@tiptap/extension-bold/dist/index.js +80 -0
  13. package/dist/node_modules/@tiptap/extension-document/dist/index.js +13 -0
  14. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +64 -0
  15. package/dist/node_modules/@tiptap/extension-italic/dist/index.js +78 -0
  16. package/dist/node_modules/@tiptap/extension-link/dist/index.js +305 -0
  17. package/dist/node_modules/@tiptap/extension-list/dist/index.js +713 -0
  18. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +42 -0
  19. package/dist/node_modules/@tiptap/extension-table/dist/index.js +380 -0
  20. package/dist/node_modules/@tiptap/extension-text/dist/index.js +14 -0
  21. package/dist/node_modules/@tiptap/extension-text-style/dist/index.js +240 -0
  22. package/dist/node_modules/@tiptap/extension-underline/dist/index.js +66 -0
  23. package/dist/node_modules/@tiptap/react/dist/index.js +481 -0
  24. package/dist/node_modules/eventemitter3/index.js +1 -1
  25. package/dist/node_modules/eventemitter3/index2.js +1 -1
  26. package/dist/node_modules/fast-equals/dist/es/index.js +324 -0
  27. package/dist/node_modules/linkifyjs/dist/linkify.js +707 -0
  28. package/dist/node_modules/lucide-react/dist/esm/icons/baseline.js +10 -0
  29. package/dist/node_modules/lucide-react/dist/esm/icons/between-horizontal-end.js +10 -0
  30. package/dist/node_modules/lucide-react/dist/esm/icons/between-vertical-end.js +10 -0
  31. package/dist/node_modules/lucide-react/dist/esm/icons/bold.js +11 -0
  32. package/dist/node_modules/lucide-react/dist/esm/icons/grid-2x2-plus.js +16 -0
  33. package/dist/node_modules/lucide-react/dist/esm/icons/grid-2x2-x.js +16 -0
  34. package/dist/node_modules/lucide-react/dist/esm/icons/italic.js +10 -0
  35. package/dist/node_modules/lucide-react/dist/esm/icons/link.js +9 -0
  36. package/dist/node_modules/lucide-react/dist/esm/icons/list-ordered.js +13 -0
  37. package/dist/node_modules/lucide-react/dist/esm/icons/table-columns-split.js +18 -0
  38. package/dist/node_modules/lucide-react/dist/esm/icons/table-rows-split.js +18 -0
  39. package/dist/node_modules/lucide-react/dist/esm/icons/table.js +11 -0
  40. package/dist/node_modules/lucide-react/dist/esm/icons/underline.js +9 -0
  41. package/dist/node_modules/orderedmap/dist/index.js +103 -0
  42. package/dist/node_modules/prosemirror-commands/dist/index.js +388 -0
  43. package/dist/node_modules/prosemirror-keymap/dist/index.js +62 -0
  44. package/dist/node_modules/prosemirror-model/dist/index.js +2733 -0
  45. package/dist/node_modules/prosemirror-schema-list/dist/index.js +88 -0
  46. package/dist/node_modules/prosemirror-state/dist/index.js +822 -0
  47. package/dist/node_modules/prosemirror-tables/dist/index.js +1446 -0
  48. package/dist/node_modules/prosemirror-transform/dist/index.js +1520 -0
  49. package/dist/node_modules/prosemirror-view/dist/index.js +3772 -0
  50. package/dist/node_modules/react-is/index.js +1 -1
  51. package/dist/node_modules/recharts/es6/util/Events.js +1 -1
  52. package/dist/node_modules/recharts/es6/util/ReactUtils.js +1 -1
  53. package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
  54. package/dist/node_modules/w3c-keyname/index.js +93 -0
  55. package/dist/packages/lune-ui/dist/_virtual/index3.js +2 -5
  56. package/dist/packages/lune-ui/dist/_virtual/index6.js +5 -2
  57. package/dist/packages/lune-ui/dist/components/popover.js +15 -11
  58. package/dist/packages/lune-ui/dist/components/select.js +6 -6
  59. package/dist/packages/lune-ui/dist/form/form-date-picker.js +2 -2
  60. package/dist/packages/lune-ui/dist/form/form.js +4 -4
  61. package/dist/packages/lune-ui/dist/node_modules/@radix-ui/react-popover/dist/index.js +39 -38
  62. package/dist/packages/lune-ui/dist/node_modules/prop-types/index.js +1 -1
  63. package/dist/packages/lune-ui/dist/packages/lune-ui/node_modules/recharts/es6/util/Events.js +1 -1
  64. package/dist/shared/components/color-picker/color-picker.d.ts +2 -1
  65. package/dist/shared/components/color-picker/color-picker.js +11 -11
  66. package/dist/shared/components/data-table/data-table-filter.js +4 -4
  67. package/dist/shared/components/rich-editor/rich-editor.d.ts +6 -0
  68. package/dist/shared/components/rich-editor/rich-editor.js +93 -0
  69. package/dist/shared/components/rich-editor/toolbar/bold/rich-editor-toolbar-bold.d.ts +1 -0
  70. package/dist/shared/components/rich-editor/toolbar/bold/rich-editor-toolbar-bold.js +65 -0
  71. package/dist/shared/components/rich-editor/toolbar/color/rich-editor-toolbar-color.d.ts +1 -0
  72. package/dist/shared/components/rich-editor/toolbar/color/rich-editor-toolbar-color.js +65 -0
  73. package/dist/shared/components/rich-editor/toolbar/heading/rich-editor-toolbar-heading.d.ts +1 -0
  74. package/dist/shared/components/rich-editor/toolbar/heading/rich-editor-toolbar-heading.js +114 -0
  75. package/dist/shared/components/rich-editor/toolbar/italic/rich-editor-toolbar-italic.d.ts +1 -0
  76. package/dist/shared/components/rich-editor/toolbar/italic/rich-editor-toolbar-italic.js +65 -0
  77. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link-form.d.ts +2 -0
  78. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link-form.js +103 -0
  79. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link.d.ts +1 -0
  80. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link.js +63 -0
  81. package/dist/shared/components/rich-editor/toolbar/ol-list/rich-editor-toolbar-ul-list.d.ts +1 -0
  82. package/dist/shared/components/rich-editor/toolbar/ol-list/rich-editor-toolbar-ul-list.js +65 -0
  83. package/dist/shared/components/rich-editor/toolbar/table/rich-editor-toolbar-table.d.ts +1 -0
  84. package/dist/shared/components/rich-editor/toolbar/table/rich-editor-toolbar-table.js +107 -0
  85. package/dist/shared/components/rich-editor/toolbar/toolbar.d.ts +1 -0
  86. package/dist/shared/components/rich-editor/toolbar/toolbar.js +64 -0
  87. package/dist/shared/components/rich-editor/toolbar/ul-list/rich-editor-toolbar-ul-list.d.ts +1 -0
  88. package/dist/shared/components/rich-editor/toolbar/ul-list/rich-editor-toolbar-ul-list.js +65 -0
  89. package/dist/shared/components/rich-editor/toolbar/underline/rich-editor-toolbar-underline.d.ts +1 -0
  90. package/dist/shared/components/rich-editor/toolbar/underline/rich-editor-toolbar-underline.js +65 -0
  91. package/package.json +6 -1
@@ -0,0 +1,42 @@
1
+ import { Node as a, mergeAttributes as n } from "../../core/dist/index.js";
2
+ var o = a.create({
3
+ name: "paragraph",
4
+ priority: 1e3,
5
+ addOptions() {
6
+ return {
7
+ HTMLAttributes: {}
8
+ };
9
+ },
10
+ group: "block",
11
+ content: "inline*",
12
+ parseHTML() {
13
+ return [{ tag: "p" }];
14
+ },
15
+ renderHTML({ HTMLAttributes: r }) {
16
+ return ["p", n(this.options.HTMLAttributes, r), 0];
17
+ },
18
+ parseMarkdown: (r, e) => {
19
+ const t = r.tokens || [];
20
+ return t.length === 1 && t[0].type === "image" ? e.parseChildren([t[0]]) : e.createNode(
21
+ "paragraph",
22
+ void 0,
23
+ // no attributes for paragraph
24
+ e.parseInline(t)
25
+ );
26
+ },
27
+ renderMarkdown: (r, e) => !r || !Array.isArray(r.content) ? "" : e.renderChildren(r.content),
28
+ addCommands() {
29
+ return {
30
+ setParagraph: () => ({ commands: r }) => r.setNode(this.name)
31
+ };
32
+ },
33
+ addKeyboardShortcuts() {
34
+ return {
35
+ "Mod-Alt-0": () => this.editor.commands.setParagraph()
36
+ };
37
+ }
38
+ }), i = o;
39
+ export {
40
+ o as Paragraph,
41
+ i as default
42
+ };
@@ -0,0 +1,380 @@
1
+ import { Node as x, mergeAttributes as M, callOrReturn as $, getExtensionField as _, Extension as O, findParentNodeClosestToPos as k } from "../../core/dist/index.js";
2
+ import { TextSelection as I } from "../../../prosemirror-state/dist/index.js";
3
+ import { columnResizing as P, tableEditing as z, CellSelection as N, fixTables as D, goToNextCell as H, setCellAttr as j, mergeCells as W, splitCell as v, toggleHeaderCell as V, toggleHeader as S, deleteTable as B, deleteRow as K, addRowAfter as F, addRowBefore as U, deleteColumn as q, addColumnAfter as G, addColumnBefore as J } from "../../../prosemirror-tables/dist/index.js";
4
+ var Q = x.create({
5
+ name: "tableCell",
6
+ addOptions() {
7
+ return {
8
+ HTMLAttributes: {}
9
+ };
10
+ },
11
+ content: "block+",
12
+ addAttributes() {
13
+ return {
14
+ colspan: {
15
+ default: 1
16
+ },
17
+ rowspan: {
18
+ default: 1
19
+ },
20
+ colwidth: {
21
+ default: null,
22
+ parseHTML: (e) => {
23
+ var t, n;
24
+ const l = e.getAttribute("colwidth"), u = l ? l.split(",").map((r) => parseInt(r, 10)) : null;
25
+ if (!u) {
26
+ const r = (t = e.closest("table")) == null ? void 0 : t.querySelectorAll("colgroup > col"), i = Array.from(((n = e.parentElement) == null ? void 0 : n.children) || []).indexOf(e);
27
+ if (i && i > -1 && r && r[i]) {
28
+ const a = r[i].getAttribute("width");
29
+ return a ? [parseInt(a, 10)] : null;
30
+ }
31
+ }
32
+ return u;
33
+ }
34
+ }
35
+ };
36
+ },
37
+ tableRole: "cell",
38
+ isolating: !0,
39
+ parseHTML() {
40
+ return [{ tag: "td" }];
41
+ },
42
+ renderHTML({ HTMLAttributes: e }) {
43
+ return ["td", M(this.options.HTMLAttributes, e), 0];
44
+ }
45
+ }), X = x.create({
46
+ name: "tableHeader",
47
+ addOptions() {
48
+ return {
49
+ HTMLAttributes: {}
50
+ };
51
+ },
52
+ content: "block+",
53
+ addAttributes() {
54
+ return {
55
+ colspan: {
56
+ default: 1
57
+ },
58
+ rowspan: {
59
+ default: 1
60
+ },
61
+ colwidth: {
62
+ default: null,
63
+ parseHTML: (e) => {
64
+ const t = e.getAttribute("colwidth");
65
+ return t ? t.split(",").map((l) => parseInt(l, 10)) : null;
66
+ }
67
+ }
68
+ };
69
+ },
70
+ tableRole: "header_cell",
71
+ isolating: !0,
72
+ parseHTML() {
73
+ return [{ tag: "th" }];
74
+ },
75
+ renderHTML({ HTMLAttributes: e }) {
76
+ return ["th", M(this.options.HTMLAttributes, e), 0];
77
+ }
78
+ }), Y = x.create({
79
+ name: "tableRow",
80
+ addOptions() {
81
+ return {
82
+ HTMLAttributes: {}
83
+ };
84
+ },
85
+ content: "(tableCell | tableHeader)*",
86
+ tableRole: "row",
87
+ parseHTML() {
88
+ return [{ tag: "tr" }];
89
+ },
90
+ renderHTML({ HTMLAttributes: e }) {
91
+ return ["tr", M(this.options.HTMLAttributes, e), 0];
92
+ }
93
+ });
94
+ function R(e, t) {
95
+ return t ? ["width", `${Math.max(t, e)}px`] : ["min-width", `${e}px`];
96
+ }
97
+ function E(e, t, n, l, u, r) {
98
+ var i;
99
+ let a = 0, f = !0, c = t.firstChild;
100
+ const b = e.firstChild;
101
+ if (b !== null)
102
+ for (let m = 0, y = 0; m < b.childCount; m += 1) {
103
+ const { colspan: s, colwidth: d } = b.child(m).attrs;
104
+ for (let o = 0; o < s; o += 1, y += 1) {
105
+ const h = u === y ? r : d && d[o], C = h ? `${h}px` : "";
106
+ if (a += h || l, h || (f = !1), c) {
107
+ if (c.style.width !== C) {
108
+ const [g, w] = R(l, h);
109
+ c.style.setProperty(g, w);
110
+ }
111
+ c = c.nextSibling;
112
+ } else {
113
+ const g = document.createElement("col"), [w, A] = R(l, h);
114
+ g.style.setProperty(w, A), t.appendChild(g);
115
+ }
116
+ }
117
+ }
118
+ for (; c; ) {
119
+ const m = c.nextSibling;
120
+ (i = c.parentNode) == null || i.removeChild(c), c = m;
121
+ }
122
+ const p = e.attrs.style && typeof e.attrs.style == "string" && /\bwidth\s*:/i.test(e.attrs.style);
123
+ f && !p ? (n.style.width = `${a}px`, n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = `${a}px`);
124
+ }
125
+ var Z = class {
126
+ constructor(e, t) {
127
+ this.node = e, this.cellMinWidth = t, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), e.attrs.style && (this.table.style.cssText = e.attrs.style), this.colgroup = this.table.appendChild(document.createElement("colgroup")), E(e, this.colgroup, this.table, t), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
128
+ }
129
+ update(e) {
130
+ return e.type !== this.node.type ? !1 : (this.node = e, E(e, this.colgroup, this.table, this.cellMinWidth), !0);
131
+ }
132
+ ignoreMutation(e) {
133
+ const t = e.target, n = this.dom.contains(t), l = this.contentDOM.contains(t);
134
+ return !!(n && !l && (e.type === "attributes" || e.type === "childList" || e.type === "characterData"));
135
+ }
136
+ };
137
+ function ee(e, t, n, l) {
138
+ let u = 0, r = !0;
139
+ const i = [], a = e.firstChild;
140
+ if (!a)
141
+ return {};
142
+ for (let p = 0, m = 0; p < a.childCount; p += 1) {
143
+ const { colspan: y, colwidth: s } = a.child(p).attrs;
144
+ for (let d = 0; d < y; d += 1, m += 1) {
145
+ const o = n === m ? l : s && s[d];
146
+ u += o || t, o || (r = !1);
147
+ const [h, C] = R(t, o);
148
+ i.push(["col", { style: `${h}: ${C}` }]);
149
+ }
150
+ }
151
+ const f = r ? `${u}px` : "", c = r ? "" : `${u}px`;
152
+ return { colgroup: ["colgroup", {}, ...i], tableWidth: f, tableMinWidth: c };
153
+ }
154
+ function L(e, t) {
155
+ return e.createAndFill();
156
+ }
157
+ function te(e) {
158
+ if (e.cached.tableNodeTypes)
159
+ return e.cached.tableNodeTypes;
160
+ const t = {};
161
+ return Object.keys(e.nodes).forEach((n) => {
162
+ const l = e.nodes[n];
163
+ l.spec.tableRole && (t[l.spec.tableRole] = l);
164
+ }), e.cached.tableNodeTypes = t, t;
165
+ }
166
+ function le(e, t, n, l, u) {
167
+ const r = te(e), i = [], a = [];
168
+ for (let c = 0; c < n; c += 1) {
169
+ const b = L(r.cell);
170
+ if (b && a.push(b), l) {
171
+ const p = L(r.header_cell);
172
+ p && i.push(p);
173
+ }
174
+ }
175
+ const f = [];
176
+ for (let c = 0; c < t; c += 1)
177
+ f.push(r.row.createChecked(null, l && c === 0 ? i : a));
178
+ return r.table.createChecked(null, f);
179
+ }
180
+ function re(e) {
181
+ return e instanceof N;
182
+ }
183
+ var T = ({ editor: e }) => {
184
+ const { selection: t } = e.state;
185
+ if (!re(t))
186
+ return !1;
187
+ let n = 0;
188
+ const l = k(t.ranges[0].$from, (r) => r.type.name === "table");
189
+ return l?.node.descendants((r) => {
190
+ if (r.type.name === "table")
191
+ return !1;
192
+ ["tableCell", "tableHeader"].includes(r.type.name) && (n += 1);
193
+ }), n === t.ranges.length ? (e.commands.deleteTable(), !0) : !1;
194
+ }, ne = "";
195
+ function oe(e) {
196
+ return (e || "").replace(/\s+/g, " ").trim();
197
+ }
198
+ function ae(e, t, n = {}) {
199
+ var l;
200
+ const u = (l = n.cellLineSeparator) != null ? l : ne;
201
+ if (!e || !e.content || e.content.length === 0)
202
+ return "";
203
+ const r = [];
204
+ e.content.forEach((s) => {
205
+ const d = [];
206
+ s.content && s.content.forEach((o) => {
207
+ let h = "";
208
+ o.content && Array.isArray(o.content) && o.content.length > 1 ? h = o.content.map((A) => t.renderChildren(A)).join(u) : h = o.content ? t.renderChildren(o.content) : "";
209
+ const C = oe(h), g = o.type === "tableHeader";
210
+ d.push({ text: C, isHeader: g });
211
+ }), r.push(d);
212
+ });
213
+ const i = r.reduce((s, d) => Math.max(s, d.length), 0);
214
+ if (i === 0)
215
+ return "";
216
+ const a = new Array(i).fill(0);
217
+ r.forEach((s) => {
218
+ var d;
219
+ for (let o = 0; o < i; o += 1) {
220
+ const C = (((d = s[o]) == null ? void 0 : d.text) || "").length;
221
+ C > a[o] && (a[o] = C), a[o] < 3 && (a[o] = 3);
222
+ }
223
+ });
224
+ const f = (s, d) => s + " ".repeat(Math.max(0, d - s.length)), c = r[0], b = c.some((s) => s.isHeader);
225
+ let p = `
226
+ `;
227
+ const m = new Array(i).fill(0).map((s, d) => b && c[d] && c[d].text || "");
228
+ return p += `| ${m.map((s, d) => f(s, a[d])).join(" | ")} |
229
+ `, p += `| ${a.map((s) => "-".repeat(Math.max(3, s))).join(" | ")} |
230
+ `, (b ? r.slice(1) : r).forEach((s) => {
231
+ p += `| ${new Array(i).fill(0).map((d, o) => f(s[o] && s[o].text || "", a[o])).join(" | ")} |
232
+ `;
233
+ }), p;
234
+ }
235
+ var se = ae, ie = x.create({
236
+ name: "table",
237
+ // @ts-ignore
238
+ addOptions() {
239
+ return {
240
+ HTMLAttributes: {},
241
+ resizable: !1,
242
+ renderWrapper: !1,
243
+ handleWidth: 5,
244
+ cellMinWidth: 25,
245
+ // TODO: fix
246
+ View: Z,
247
+ lastColumnResizable: !0,
248
+ allowTableNodeSelection: !1
249
+ };
250
+ },
251
+ content: "tableRow+",
252
+ tableRole: "table",
253
+ isolating: !0,
254
+ group: "block",
255
+ parseHTML() {
256
+ return [{ tag: "table" }];
257
+ },
258
+ renderHTML({ node: e, HTMLAttributes: t }) {
259
+ const { colgroup: n, tableWidth: l, tableMinWidth: u } = ee(e, this.options.cellMinWidth), r = t.style;
260
+ function i() {
261
+ return r || (l ? `width: ${l}` : `min-width: ${u}`);
262
+ }
263
+ const a = [
264
+ "table",
265
+ M(this.options.HTMLAttributes, t, {
266
+ style: i()
267
+ }),
268
+ n,
269
+ ["tbody", 0]
270
+ ];
271
+ return this.options.renderWrapper ? ["div", { class: "tableWrapper" }, a] : a;
272
+ },
273
+ parseMarkdown: (e, t) => {
274
+ const n = [];
275
+ if (e.header) {
276
+ const l = [];
277
+ e.header.forEach((u) => {
278
+ l.push(t.createNode("tableHeader", {}, [{ type: "paragraph", content: t.parseInline(u.tokens) }]));
279
+ }), n.push(t.createNode("tableRow", {}, l));
280
+ }
281
+ return e.rows && e.rows.forEach((l) => {
282
+ const u = [];
283
+ l.forEach((r) => {
284
+ u.push(t.createNode("tableCell", {}, [{ type: "paragraph", content: t.parseInline(r.tokens) }]));
285
+ }), n.push(t.createNode("tableRow", {}, u));
286
+ }), t.createNode("table", void 0, n);
287
+ },
288
+ renderMarkdown: (e, t) => se(e, t),
289
+ addCommands() {
290
+ return {
291
+ insertTable: ({ rows: e = 3, cols: t = 3, withHeaderRow: n = !0 } = {}) => ({ tr: l, dispatch: u, editor: r }) => {
292
+ const i = le(r.schema, e, t, n);
293
+ if (u) {
294
+ const a = l.selection.from + 1;
295
+ l.replaceSelectionWith(i).scrollIntoView().setSelection(I.near(l.doc.resolve(a)));
296
+ }
297
+ return !0;
298
+ },
299
+ addColumnBefore: () => ({ state: e, dispatch: t }) => J(e, t),
300
+ addColumnAfter: () => ({ state: e, dispatch: t }) => G(e, t),
301
+ deleteColumn: () => ({ state: e, dispatch: t }) => q(e, t),
302
+ addRowBefore: () => ({ state: e, dispatch: t }) => U(e, t),
303
+ addRowAfter: () => ({ state: e, dispatch: t }) => F(e, t),
304
+ deleteRow: () => ({ state: e, dispatch: t }) => K(e, t),
305
+ deleteTable: () => ({ state: e, dispatch: t }) => B(e, t),
306
+ mergeCells: () => ({ state: e, dispatch: t }) => W(e, t),
307
+ splitCell: () => ({ state: e, dispatch: t }) => v(e, t),
308
+ toggleHeaderColumn: () => ({ state: e, dispatch: t }) => S("column")(e, t),
309
+ toggleHeaderRow: () => ({ state: e, dispatch: t }) => S("row")(e, t),
310
+ toggleHeaderCell: () => ({ state: e, dispatch: t }) => V(e, t),
311
+ mergeOrSplit: () => ({ state: e, dispatch: t }) => W(e, t) ? !0 : v(e, t),
312
+ setCellAttribute: (e, t) => ({ state: n, dispatch: l }) => j(e, t)(n, l),
313
+ goToNextCell: () => ({ state: e, dispatch: t }) => H(1)(e, t),
314
+ goToPreviousCell: () => ({ state: e, dispatch: t }) => H(-1)(e, t),
315
+ fixTables: () => ({ state: e, dispatch: t }) => (t && D(e), !0),
316
+ setCellSelection: (e) => ({ tr: t, dispatch: n }) => {
317
+ if (n) {
318
+ const l = N.create(t.doc, e.anchorCell, e.headCell);
319
+ t.setSelection(l);
320
+ }
321
+ return !0;
322
+ }
323
+ };
324
+ },
325
+ addKeyboardShortcuts() {
326
+ return {
327
+ Tab: () => this.editor.commands.goToNextCell() ? !0 : this.editor.can().addRowAfter() ? this.editor.chain().addRowAfter().goToNextCell().run() : !1,
328
+ "Shift-Tab": () => this.editor.commands.goToPreviousCell(),
329
+ Backspace: T,
330
+ "Mod-Backspace": T,
331
+ Delete: T,
332
+ "Mod-Delete": T
333
+ };
334
+ },
335
+ addProseMirrorPlugins() {
336
+ return [
337
+ ...this.options.resizable && this.editor.isEditable ? [
338
+ P({
339
+ handleWidth: this.options.handleWidth,
340
+ cellMinWidth: this.options.cellMinWidth,
341
+ defaultCellMinWidth: this.options.cellMinWidth,
342
+ View: this.options.View,
343
+ lastColumnResizable: this.options.lastColumnResizable
344
+ })
345
+ ] : [],
346
+ z({
347
+ allowTableNodeSelection: this.options.allowTableNodeSelection
348
+ })
349
+ ];
350
+ },
351
+ extendNodeSchema(e) {
352
+ const t = {
353
+ name: e.name,
354
+ options: e.options,
355
+ storage: e.storage
356
+ };
357
+ return {
358
+ tableRole: $(_(e, "tableRole", t))
359
+ };
360
+ }
361
+ }), pe = O.create({
362
+ name: "tableKit",
363
+ addExtensions() {
364
+ const e = [];
365
+ return this.options.table !== !1 && e.push(ie.configure(this.options.table)), this.options.tableCell !== !1 && e.push(Q.configure(this.options.tableCell)), this.options.tableHeader !== !1 && e.push(X.configure(this.options.tableHeader)), this.options.tableRow !== !1 && e.push(Y.configure(this.options.tableRow)), e;
366
+ }
367
+ });
368
+ export {
369
+ ne as DEFAULT_CELL_LINE_SEPARATOR,
370
+ ie as Table,
371
+ Q as TableCell,
372
+ X as TableHeader,
373
+ pe as TableKit,
374
+ Y as TableRow,
375
+ Z as TableView,
376
+ ee as createColGroup,
377
+ le as createTable,
378
+ ae as renderTableToMarkdown,
379
+ E as updateColumns
380
+ };
@@ -0,0 +1,14 @@
1
+ import { Node as t } from "../../core/dist/index.js";
2
+ var r = t.create({
3
+ name: "text",
4
+ group: "inline",
5
+ parseMarkdown: (e) => ({
6
+ type: "text",
7
+ text: e.text || ""
8
+ }),
9
+ renderMarkdown: (e) => e.text || ""
10
+ }), d = r;
11
+ export {
12
+ r as Text,
13
+ d as default
14
+ };
@@ -0,0 +1,240 @@
1
+ import { Mark as y, mergeAttributes as p, Extension as l } from "../../core/dist/index.js";
2
+ var d = 20, u = (t, e = 0) => {
3
+ const r = [];
4
+ return !t.children.length || e > d || Array.from(t.children).forEach((o) => {
5
+ o.tagName === "SPAN" ? r.push(o) : o.children.length && r.push(...u(o, e + 1));
6
+ }), r;
7
+ }, f = (t) => {
8
+ if (!t.children.length)
9
+ return;
10
+ const e = u(t);
11
+ e && e.forEach((r) => {
12
+ var o, n;
13
+ const s = r.getAttribute("style"), i = (n = (o = r.parentElement) == null ? void 0 : o.closest("span")) == null ? void 0 : n.getAttribute("style");
14
+ r.setAttribute("style", `${i};${s}`);
15
+ });
16
+ }, c = y.create({
17
+ name: "textStyle",
18
+ priority: 101,
19
+ addOptions() {
20
+ return {
21
+ HTMLAttributes: {},
22
+ mergeNestedSpanStyles: !0
23
+ };
24
+ },
25
+ parseHTML() {
26
+ return [
27
+ {
28
+ tag: "span",
29
+ consuming: !1,
30
+ getAttrs: (t) => t.hasAttribute("style") ? (this.options.mergeNestedSpanStyles && f(t), {}) : !1
31
+ }
32
+ ];
33
+ },
34
+ renderHTML({ HTMLAttributes: t }) {
35
+ return ["span", p(this.options.HTMLAttributes, t), 0];
36
+ },
37
+ addCommands() {
38
+ return {
39
+ toggleTextStyle: (t) => ({ commands: e }) => e.toggleMark(this.name, t),
40
+ removeEmptyTextStyle: () => ({ tr: t }) => {
41
+ const { selection: e } = t;
42
+ return t.doc.nodesBetween(e.from, e.to, (r, o) => {
43
+ if (r.isTextblock)
44
+ return !0;
45
+ r.marks.filter((n) => n.type === this.type).some((n) => Object.values(n.attrs).some((s) => !!s)) || t.removeMark(o, o + r.nodeSize, this.type);
46
+ }), !0;
47
+ }
48
+ };
49
+ }
50
+ }), m = l.create({
51
+ name: "backgroundColor",
52
+ addOptions() {
53
+ return {
54
+ types: ["textStyle"]
55
+ };
56
+ },
57
+ addGlobalAttributes() {
58
+ return [
59
+ {
60
+ types: this.options.types,
61
+ attributes: {
62
+ backgroundColor: {
63
+ default: null,
64
+ parseHTML: (t) => {
65
+ var e;
66
+ const r = t.getAttribute("style");
67
+ if (r) {
68
+ const o = r.split(";").map((n) => n.trim()).filter(Boolean);
69
+ for (let n = o.length - 1; n >= 0; n -= 1) {
70
+ const s = o[n].split(":");
71
+ if (s.length >= 2) {
72
+ const i = s[0].trim().toLowerCase(), a = s.slice(1).join(":").trim();
73
+ if (i === "background-color")
74
+ return a.replace(/['"]+/g, "");
75
+ }
76
+ }
77
+ }
78
+ return (e = t.style.backgroundColor) == null ? void 0 : e.replace(/['"]+/g, "");
79
+ },
80
+ renderHTML: (t) => t.backgroundColor ? {
81
+ style: `background-color: ${t.backgroundColor}`
82
+ } : {}
83
+ }
84
+ }
85
+ }
86
+ ];
87
+ },
88
+ addCommands() {
89
+ return {
90
+ setBackgroundColor: (t) => ({ chain: e }) => e().setMark("textStyle", { backgroundColor: t }).run(),
91
+ unsetBackgroundColor: () => ({ chain: t }) => t().setMark("textStyle", { backgroundColor: null }).removeEmptyTextStyle().run()
92
+ };
93
+ }
94
+ }), g = l.create({
95
+ name: "color",
96
+ addOptions() {
97
+ return {
98
+ types: ["textStyle"]
99
+ };
100
+ },
101
+ addGlobalAttributes() {
102
+ return [
103
+ {
104
+ types: this.options.types,
105
+ attributes: {
106
+ color: {
107
+ default: null,
108
+ parseHTML: (t) => {
109
+ var e;
110
+ const r = t.getAttribute("style");
111
+ if (r) {
112
+ const o = r.split(";").map((n) => n.trim()).filter(Boolean);
113
+ for (let n = o.length - 1; n >= 0; n -= 1) {
114
+ const s = o[n].split(":");
115
+ if (s.length >= 2) {
116
+ const i = s[0].trim().toLowerCase(), a = s.slice(1).join(":").trim();
117
+ if (i === "color")
118
+ return a.replace(/['"]+/g, "");
119
+ }
120
+ }
121
+ }
122
+ return (e = t.style.color) == null ? void 0 : e.replace(/['"]+/g, "");
123
+ },
124
+ renderHTML: (t) => t.color ? {
125
+ style: `color: ${t.color}`
126
+ } : {}
127
+ }
128
+ }
129
+ }
130
+ ];
131
+ },
132
+ addCommands() {
133
+ return {
134
+ setColor: (t) => ({ chain: e }) => e().setMark("textStyle", { color: t }).run(),
135
+ unsetColor: () => ({ chain: t }) => t().setMark("textStyle", { color: null }).removeEmptyTextStyle().run()
136
+ };
137
+ }
138
+ }), h = l.create({
139
+ name: "fontFamily",
140
+ addOptions() {
141
+ return {
142
+ types: ["textStyle"]
143
+ };
144
+ },
145
+ addGlobalAttributes() {
146
+ return [
147
+ {
148
+ types: this.options.types,
149
+ attributes: {
150
+ fontFamily: {
151
+ default: null,
152
+ parseHTML: (t) => t.style.fontFamily,
153
+ renderHTML: (t) => t.fontFamily ? {
154
+ style: `font-family: ${t.fontFamily}`
155
+ } : {}
156
+ }
157
+ }
158
+ }
159
+ ];
160
+ },
161
+ addCommands() {
162
+ return {
163
+ setFontFamily: (t) => ({ chain: e }) => e().setMark("textStyle", { fontFamily: t }).run(),
164
+ unsetFontFamily: () => ({ chain: t }) => t().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run()
165
+ };
166
+ }
167
+ }), S = l.create({
168
+ name: "fontSize",
169
+ addOptions() {
170
+ return {
171
+ types: ["textStyle"]
172
+ };
173
+ },
174
+ addGlobalAttributes() {
175
+ return [
176
+ {
177
+ types: this.options.types,
178
+ attributes: {
179
+ fontSize: {
180
+ default: null,
181
+ parseHTML: (t) => t.style.fontSize,
182
+ renderHTML: (t) => t.fontSize ? {
183
+ style: `font-size: ${t.fontSize}`
184
+ } : {}
185
+ }
186
+ }
187
+ }
188
+ ];
189
+ },
190
+ addCommands() {
191
+ return {
192
+ setFontSize: (t) => ({ chain: e }) => e().setMark("textStyle", { fontSize: t }).run(),
193
+ unsetFontSize: () => ({ chain: t }) => t().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
194
+ };
195
+ }
196
+ }), b = l.create({
197
+ name: "lineHeight",
198
+ addOptions() {
199
+ return {
200
+ types: ["textStyle"]
201
+ };
202
+ },
203
+ addGlobalAttributes() {
204
+ return [
205
+ {
206
+ types: this.options.types,
207
+ attributes: {
208
+ lineHeight: {
209
+ default: null,
210
+ parseHTML: (t) => t.style.lineHeight,
211
+ renderHTML: (t) => t.lineHeight ? {
212
+ style: `line-height: ${t.lineHeight}`
213
+ } : {}
214
+ }
215
+ }
216
+ }
217
+ ];
218
+ },
219
+ addCommands() {
220
+ return {
221
+ setLineHeight: (t) => ({ chain: e }) => e().setMark("textStyle", { lineHeight: t }).run(),
222
+ unsetLineHeight: () => ({ chain: t }) => t().setMark("textStyle", { lineHeight: null }).removeEmptyTextStyle().run()
223
+ };
224
+ }
225
+ });
226
+ l.create({
227
+ name: "textStyleKit",
228
+ addExtensions() {
229
+ const t = [];
230
+ return this.options.backgroundColor !== !1 && t.push(m.configure(this.options.backgroundColor)), this.options.color !== !1 && t.push(g.configure(this.options.color)), this.options.fontFamily !== !1 && t.push(h.configure(this.options.fontFamily)), this.options.fontSize !== !1 && t.push(S.configure(this.options.fontSize)), this.options.lineHeight !== !1 && t.push(b.configure(this.options.lineHeight)), this.options.textStyle !== !1 && t.push(c.configure(this.options.textStyle)), t;
231
+ }
232
+ });
233
+ export {
234
+ m as BackgroundColor,
235
+ g as Color,
236
+ h as FontFamily,
237
+ S as FontSize,
238
+ b as LineHeight,
239
+ c as TextStyle
240
+ };