@caspeco/casper-ui-library 9.8.0 → 9.10.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 (113) hide show
  1. package/dist/_virtual/index.js +5 -0
  2. package/dist/_virtual/index2.js +4 -0
  3. package/dist/_virtual/use-sync-external-store-shim.development.js +4 -0
  4. package/dist/_virtual/use-sync-external-store-shim.production.js +4 -0
  5. package/dist/_virtual/with-selector.development.js +4 -0
  6. package/dist/_virtual/with-selector.js +5 -0
  7. package/dist/_virtual/with-selector.production.js +4 -0
  8. package/dist/_virtual/with-selector2.js +4 -0
  9. package/dist/components/button/button-recipe.d.ts.map +1 -1
  10. package/dist/components/button/button-recipe.js +80 -39
  11. package/dist/components/input/input.d.ts +1 -0
  12. package/dist/components/input/input.d.ts.map +1 -1
  13. package/dist/components/input/types.d.ts +1 -1
  14. package/dist/components/input/types.d.ts.map +1 -1
  15. package/dist/components/rich-text-editor/boolean-control.d.ts +3 -0
  16. package/dist/components/rich-text-editor/boolean-control.d.ts.map +1 -0
  17. package/dist/components/rich-text-editor/boolean-control.js +35 -0
  18. package/dist/components/rich-text-editor/extensions.d.ts +4 -0
  19. package/dist/components/rich-text-editor/extensions.d.ts.map +1 -0
  20. package/dist/components/rich-text-editor/extensions.js +37 -0
  21. package/dist/components/rich-text-editor/index.d.ts +26 -0
  22. package/dist/components/rich-text-editor/index.d.ts.map +1 -0
  23. package/dist/components/rich-text-editor/index.js +23 -0
  24. package/dist/components/rich-text-editor/rich-text-editor-context.d.ts +10 -0
  25. package/dist/components/rich-text-editor/rich-text-editor-context.d.ts.map +1 -0
  26. package/dist/components/rich-text-editor/rich-text-editor-context.js +13 -0
  27. package/dist/components/rich-text-editor/rich-text-editor-control.d.ts +11 -0
  28. package/dist/components/rich-text-editor/rich-text-editor-control.d.ts.map +1 -0
  29. package/dist/components/rich-text-editor/rich-text-editor-control.js +202 -0
  30. package/dist/components/rich-text-editor/rich-text-editor-recipe.d.ts +4 -0
  31. package/dist/components/rich-text-editor/rich-text-editor-recipe.d.ts.map +1 -0
  32. package/dist/components/rich-text-editor/rich-text-editor-recipe.js +58 -0
  33. package/dist/components/rich-text-editor/rich-text-editor.composition.d.ts +6 -0
  34. package/dist/components/rich-text-editor/rich-text-editor.composition.d.ts.map +1 -0
  35. package/dist/components/rich-text-editor/rich-text-editor.d.ts +11 -0
  36. package/dist/components/rich-text-editor/rich-text-editor.d.ts.map +1 -0
  37. package/dist/components/rich-text-editor/rich-text-editor.js +60 -0
  38. package/dist/components/rich-text-editor/rich-text-editor.test.d.ts +2 -0
  39. package/dist/components/rich-text-editor/rich-text-editor.test.d.ts.map +1 -0
  40. package/dist/components/rich-text-editor/rich-text-editor.visual.test.d.ts +2 -0
  41. package/dist/components/rich-text-editor/rich-text-editor.visual.test.d.ts.map +1 -0
  42. package/dist/components/rich-text-editor/rich-text-renderer.d.ts +3 -0
  43. package/dist/components/rich-text-editor/rich-text-renderer.d.ts.map +1 -0
  44. package/dist/components/rich-text-editor/rich-text-renderer.js +21 -0
  45. package/dist/components/rich-text-editor/translations.d.ts +23 -0
  46. package/dist/components/rich-text-editor/translations.d.ts.map +1 -0
  47. package/dist/components/rich-text-editor/translations.js +120 -0
  48. package/dist/components/rich-text-editor/types.d.ts +30 -0
  49. package/dist/components/rich-text-editor/types.d.ts.map +1 -0
  50. package/dist/components/rich-text-editor/use-rich-text-editor.d.ts +3 -0
  51. package/dist/components/rich-text-editor/use-rich-text-editor.d.ts.map +1 -0
  52. package/dist/components/rich-text-editor/use-rich-text-editor.js +17 -0
  53. package/dist/components/table/helper.d.ts +1 -0
  54. package/dist/components/table/helper.d.ts.map +1 -1
  55. package/dist/components/table/helper.js +8 -4
  56. package/dist/components/table/table-toolbar-settings.d.ts.map +1 -1
  57. package/dist/components/table/table-toolbar-settings.js +172 -56
  58. package/dist/components/table/translations.d.ts +14 -0
  59. package/dist/components/table/translations.d.ts.map +1 -1
  60. package/dist/components/table/translations.js +21 -9
  61. package/dist/components/toggle-button/toggle-button.d.ts.map +1 -1
  62. package/dist/components/toggle-button/toggle-button.js +11 -11
  63. package/dist/components/toggle-button/types.d.ts +2 -0
  64. package/dist/components/toggle-button/types.d.ts.map +1 -1
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +774 -763
  68. package/dist/node_modules/@dnd-kit/dom/index.js +13 -13
  69. package/dist/node_modules/@dnd-kit/dom/sortable.js +36 -32
  70. package/dist/node_modules/@dnd-kit/react/sortable.js +11 -10
  71. package/dist/node_modules/@dnd-kit/state/dist/index.js +1 -1
  72. package/dist/node_modules/@tiptap/core/dist/index.js +3792 -0
  73. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +17 -0
  74. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +62 -0
  75. package/dist/node_modules/@tiptap/extension-bold/dist/index.js +85 -0
  76. package/dist/node_modules/@tiptap/extension-code/dist/index.js +54 -0
  77. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +217 -0
  78. package/dist/node_modules/@tiptap/extension-document/dist/index.js +12 -0
  79. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +59 -0
  80. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +63 -0
  81. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +56 -0
  82. package/dist/node_modules/@tiptap/extension-italic/dist/index.js +83 -0
  83. package/dist/node_modules/@tiptap/extension-link/dist/index.js +313 -0
  84. package/dist/node_modules/@tiptap/extension-list/dist/index.js +785 -0
  85. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +49 -0
  86. package/dist/node_modules/@tiptap/extension-strike/dist/index.js +66 -0
  87. package/dist/node_modules/@tiptap/extension-text/dist/index.js +13 -0
  88. package/dist/node_modules/@tiptap/extension-underline/dist/index.js +65 -0
  89. package/dist/node_modules/@tiptap/extensions/dist/index.js +439 -0
  90. package/dist/node_modules/@tiptap/react/dist/index.js +501 -0
  91. package/dist/node_modules/@tiptap/starter-kit/dist/index.js +28 -0
  92. package/dist/node_modules/fast-equals/dist/es/index.js +324 -0
  93. package/dist/node_modules/linkifyjs/dist/linkify.js +705 -0
  94. package/dist/node_modules/orderedmap/dist/index.js +103 -0
  95. package/dist/node_modules/prosemirror-commands/dist/index.js +388 -0
  96. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +86 -0
  97. package/dist/node_modules/prosemirror-gapcursor/dist/index.js +204 -0
  98. package/dist/node_modules/prosemirror-history/dist/index.js +248 -0
  99. package/dist/node_modules/prosemirror-keymap/dist/index.js +62 -0
  100. package/dist/node_modules/prosemirror-model/dist/index.js +2736 -0
  101. package/dist/node_modules/prosemirror-schema-list/dist/index.js +88 -0
  102. package/dist/node_modules/prosemirror-state/dist/index.js +822 -0
  103. package/dist/node_modules/prosemirror-transform/dist/index.js +1552 -0
  104. package/dist/node_modules/prosemirror-view/dist/index.js +3802 -0
  105. package/dist/node_modules/rope-sequence/dist/index.js +100 -0
  106. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +58 -0
  107. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +57 -0
  108. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +58 -0
  109. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +46 -0
  110. package/dist/node_modules/use-sync-external-store/shim/index.js +10 -0
  111. package/dist/node_modules/use-sync-external-store/shim/with-selector.js +10 -0
  112. package/dist/node_modules/w3c-keyname/index.js +93 -0
  113. package/package.json +9 -2
@@ -0,0 +1,785 @@
1
+ import { Node as g, wrappingInputRule as b, mergeAttributes as L, renderNestedMarkdownContent as $, Extension as S, isNodeActive as I, isAtStartOfNode as K, isAtEndOfNode as z, getNodeType as O, getNodeAtPosition as V, getRenderedAttributes as X, parseIndentedBlocks as x } from "../../core/dist/index.js";
2
+ var F = Object.defineProperty, G = (t, e) => {
3
+ for (var s in e)
4
+ F(t, s, { get: e[s], enumerable: !0 });
5
+ }, W = "listItem", w = "textStyle", C = /^\s*([-+*])\s$/, q = g.create({
6
+ name: "bulletList",
7
+ addOptions() {
8
+ return {
9
+ itemTypeName: "listItem",
10
+ HTMLAttributes: {},
11
+ keepMarks: !1,
12
+ keepAttributes: !1
13
+ };
14
+ },
15
+ group: "block list",
16
+ content() {
17
+ return `${this.options.itemTypeName}+`;
18
+ },
19
+ parseHTML() {
20
+ return [{ tag: "ul" }];
21
+ },
22
+ renderHTML({ HTMLAttributes: t }) {
23
+ return ["ul", L(this.options.HTMLAttributes, t), 0];
24
+ },
25
+ markdownTokenName: "list",
26
+ parseMarkdown: (t, e) => t.type !== "list" || t.ordered ? [] : {
27
+ type: "bulletList",
28
+ content: t.items ? e.parseChildren(t.items) : []
29
+ },
30
+ renderMarkdown: (t, e) => t.content ? e.renderChildren(t.content, `
31
+ `) : "",
32
+ markdownOptions: {
33
+ indentsContent: !0
34
+ },
35
+ addCommands() {
36
+ return {
37
+ toggleBulletList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(W, this.editor.getAttributes(w)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
38
+ };
39
+ },
40
+ addKeyboardShortcuts() {
41
+ return {
42
+ "Mod-Shift-8": () => this.editor.commands.toggleBulletList()
43
+ };
44
+ },
45
+ addInputRules() {
46
+ let t = b({
47
+ find: C,
48
+ type: this.type
49
+ });
50
+ return (this.options.keepMarks || this.options.keepAttributes) && (t = b({
51
+ find: C,
52
+ type: this.type,
53
+ keepMarks: this.options.keepMarks,
54
+ keepAttributes: this.options.keepAttributes,
55
+ getAttributes: () => this.editor.getAttributes(w),
56
+ editor: this.editor
57
+ })), [t];
58
+ }
59
+ });
60
+ function Y(t) {
61
+ var e, s;
62
+ const n = (e = t.tokens) == null ? void 0 : e[0];
63
+ return !!(t.text && ((s = t.tokens) == null ? void 0 : s.length) === 1 && n?.type === "list" && n.ordered && n.raw === t.text);
64
+ }
65
+ function J(t, e) {
66
+ return e.tokenizeInline ? e.parseInline(e.tokenizeInline(t)) : e.parseInline([
67
+ {
68
+ type: "text",
69
+ raw: t,
70
+ text: t
71
+ }
72
+ ]);
73
+ }
74
+ var Q = g.create({
75
+ name: "listItem",
76
+ addOptions() {
77
+ return {
78
+ HTMLAttributes: {},
79
+ bulletListTypeName: "bulletList",
80
+ orderedListTypeName: "orderedList"
81
+ };
82
+ },
83
+ content: "paragraph block*",
84
+ defining: !0,
85
+ parseHTML() {
86
+ return [
87
+ {
88
+ tag: "li"
89
+ }
90
+ ];
91
+ },
92
+ renderHTML({ HTMLAttributes: t }) {
93
+ return ["li", L(this.options.HTMLAttributes, t), 0];
94
+ },
95
+ markdownTokenName: "list_item",
96
+ parseMarkdown: (t, e) => {
97
+ var s;
98
+ if (t.type !== "list_item")
99
+ return [];
100
+ const n = (s = e.parseBlockChildren) != null ? s : e.parseChildren;
101
+ let r = [];
102
+ if (t.tokens && t.tokens.length > 0) {
103
+ if (Y(t))
104
+ return {
105
+ type: "listItem",
106
+ content: [
107
+ {
108
+ type: "paragraph",
109
+ content: J(t.text || "", e)
110
+ }
111
+ ]
112
+ };
113
+ if (t.tokens.some((u) => u.type === "paragraph"))
114
+ r = n(t.tokens);
115
+ else {
116
+ const u = t.tokens[0];
117
+ if (u && u.type === "text" && u.tokens && u.tokens.length > 0) {
118
+ if (r = [
119
+ {
120
+ type: "paragraph",
121
+ content: e.parseInline(u.tokens)
122
+ }
123
+ ], t.tokens.length > 1) {
124
+ const p = t.tokens.slice(1), h = n(p);
125
+ r.push(...h);
126
+ }
127
+ } else
128
+ r = n(t.tokens);
129
+ }
130
+ }
131
+ return r.length === 0 && (r = [
132
+ {
133
+ type: "paragraph",
134
+ content: []
135
+ }
136
+ ]), {
137
+ type: "listItem",
138
+ content: r
139
+ };
140
+ },
141
+ renderMarkdown: (t, e, s) => $(
142
+ t,
143
+ e,
144
+ (n) => {
145
+ var r, i;
146
+ return n.parentType === "bulletList" ? "- " : n.parentType === "orderedList" ? `${(((i = (r = n.meta) == null ? void 0 : r.parentAttrs) == null ? void 0 : i.start) || 1) + n.index}. ` : "- ";
147
+ },
148
+ s
149
+ ),
150
+ addKeyboardShortcuts() {
151
+ return {
152
+ Enter: () => this.editor.commands.splitListItem(this.name),
153
+ Tab: () => this.editor.commands.sinkListItem(this.name),
154
+ "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
155
+ };
156
+ }
157
+ }), U = {};
158
+ G(U, {
159
+ findListItemPos: () => y,
160
+ getNextListDepth: () => A,
161
+ handleBackspace: () => T,
162
+ handleDelete: () => M,
163
+ hasListBefore: () => _,
164
+ hasListItemAfter: () => Z,
165
+ hasListItemBefore: () => B,
166
+ listItemHasSubList: () => P,
167
+ nextListIsDeeper: () => D,
168
+ nextListIsHigher: () => j
169
+ });
170
+ var y = (t, e) => {
171
+ const { $from: s } = e.selection, n = O(t, e.schema);
172
+ let r = null, i = s.depth, u = s.pos, a = null;
173
+ for (; i > 0 && a === null; )
174
+ r = s.node(i), r.type === n ? a = i : (i -= 1, u -= 1);
175
+ return a === null ? null : { $pos: e.doc.resolve(u), depth: a };
176
+ }, A = (t, e) => {
177
+ const s = y(t, e);
178
+ if (!s)
179
+ return !1;
180
+ const [, n] = V(e, t, s.$pos.pos + 4);
181
+ return n;
182
+ }, _ = (t, e, s) => {
183
+ const { $anchor: n } = t.selection, r = Math.max(0, n.pos - 2), i = t.doc.resolve(r).node();
184
+ return !(!i || !s.includes(i.type.name));
185
+ }, B = (t, e) => {
186
+ var s;
187
+ const { $anchor: n } = e.selection, r = e.doc.resolve(n.pos - 2);
188
+ return !(r.index() === 0 || ((s = r.nodeBefore) == null ? void 0 : s.type.name) !== t);
189
+ }, P = (t, e, s) => {
190
+ if (!s)
191
+ return !1;
192
+ const n = O(t, e.schema);
193
+ let r = !1;
194
+ return s.descendants((i) => {
195
+ i.type === n && (r = !0);
196
+ }), r;
197
+ }, T = (t, e, s) => {
198
+ if (t.commands.undoInputRule())
199
+ return !0;
200
+ if (t.state.selection.from !== t.state.selection.to)
201
+ return !1;
202
+ if (!I(t.state, e) && _(t.state, e, s)) {
203
+ const { $anchor: a } = t.state.selection, p = t.state.doc.resolve(a.before() - 1), h = [];
204
+ p.node().descendants((c, l) => {
205
+ c.type.name === e && h.push({ node: c, pos: l });
206
+ });
207
+ const m = h.at(-1);
208
+ if (!m)
209
+ return !1;
210
+ const o = t.state.doc.resolve(p.start() + m.pos + 1);
211
+ return t.chain().cut({ from: a.start() - 1, to: a.end() + 1 }, o.end()).joinForward().run();
212
+ }
213
+ if (!I(t.state, e) || !K(t.state))
214
+ return !1;
215
+ const n = y(e, t.state);
216
+ if (!n)
217
+ return !1;
218
+ const i = t.state.doc.resolve(n.$pos.pos - 2).node(n.depth), u = P(e, t.state, i);
219
+ return B(e, t.state) && !u ? t.commands.joinItemBackward() : t.chain().liftListItem(e).run();
220
+ }, D = (t, e) => {
221
+ const s = A(t, e), n = y(t, e);
222
+ return !n || !s ? !1 : s > n.depth;
223
+ }, j = (t, e) => {
224
+ const s = A(t, e), n = y(t, e);
225
+ return !n || !s ? !1 : s < n.depth;
226
+ }, M = (t, e) => {
227
+ if (!I(t.state, e) || !z(t.state, e))
228
+ return !1;
229
+ const { selection: s } = t.state, { $from: n, $to: r } = s;
230
+ return !s.empty && n.sameParent(r) ? !1 : D(e, t.state) ? t.chain().focus(t.state.selection.from + 4).lift(e).joinBackward().run() : j(e, t.state) ? t.chain().joinForward().joinBackward().run() : t.commands.joinItemForward();
231
+ }, Z = (t, e) => {
232
+ var s;
233
+ const { $anchor: n } = e.selection, r = e.doc.resolve(n.pos - n.parentOffset - 2);
234
+ return !(r.index() === r.parent.childCount - 1 || ((s = r.nodeAfter) == null ? void 0 : s.type.name) !== t);
235
+ }, tt = S.create({
236
+ name: "listKeymap",
237
+ addOptions() {
238
+ return {
239
+ listTypes: [
240
+ {
241
+ itemName: "listItem",
242
+ wrapperNames: ["bulletList", "orderedList"]
243
+ },
244
+ {
245
+ itemName: "taskItem",
246
+ wrapperNames: ["taskList"]
247
+ }
248
+ ]
249
+ };
250
+ },
251
+ addKeyboardShortcuts() {
252
+ return {
253
+ Delete: ({ editor: t }) => {
254
+ let e = !1;
255
+ return this.options.listTypes.forEach(({ itemName: s }) => {
256
+ t.state.schema.nodes[s] !== void 0 && M(t, s) && (e = !0);
257
+ }), e;
258
+ },
259
+ "Mod-Delete": ({ editor: t }) => {
260
+ let e = !1;
261
+ return this.options.listTypes.forEach(({ itemName: s }) => {
262
+ t.state.schema.nodes[s] !== void 0 && M(t, s) && (e = !0);
263
+ }), e;
264
+ },
265
+ Backspace: ({ editor: t }) => {
266
+ let e = !1;
267
+ return this.options.listTypes.forEach(({ itemName: s, wrapperNames: n }) => {
268
+ t.state.schema.nodes[s] !== void 0 && T(t, s, n) && (e = !0);
269
+ }), e;
270
+ },
271
+ "Mod-Backspace": ({ editor: t }) => {
272
+ let e = !1;
273
+ return this.options.listTypes.forEach(({ itemName: s, wrapperNames: n }) => {
274
+ t.state.schema.nodes[s] !== void 0 && T(t, s, n) && (e = !0);
275
+ }), e;
276
+ }
277
+ };
278
+ }
279
+ }), N = /^(\s*)(\d+)\.\s+(.*)$/, et = /^\s/;
280
+ function st(t) {
281
+ const e = t.trimStart();
282
+ return /^[-+*]\s+/.test(e) || /^\d+\.\s+/.test(e) || /^>\s?/.test(e) || /^```/.test(e) || /^~~~/.test(e);
283
+ }
284
+ function nt(t) {
285
+ const e = [], s = [];
286
+ let n = !1;
287
+ return t.forEach((r) => {
288
+ if (n) {
289
+ s.push(r);
290
+ return;
291
+ }
292
+ if (r.trim() === "") {
293
+ n = !0, s.push(r);
294
+ return;
295
+ }
296
+ if (e.length > 0 && st(r)) {
297
+ n = !0, s.push(r);
298
+ return;
299
+ }
300
+ e.push(r);
301
+ }), {
302
+ paragraphLines: e,
303
+ blockLines: s
304
+ };
305
+ }
306
+ function rt(t) {
307
+ const e = [];
308
+ let s = 0, n = 0;
309
+ for (; s < t.length; ) {
310
+ const r = t[s], i = r.match(N);
311
+ if (!i)
312
+ break;
313
+ const [, u, a, p] = i, h = u.length, m = [p];
314
+ let o = s + 1;
315
+ const c = [r];
316
+ let l = !1;
317
+ for (; o < t.length; ) {
318
+ const d = t[o];
319
+ if (d.match(N))
320
+ break;
321
+ if (d.trim() === "")
322
+ c.push(d), m.push(""), l = !0, o += 1;
323
+ else if (d.match(et))
324
+ c.push(d), m.push(d.slice(h + 2)), o += 1;
325
+ else {
326
+ if (l)
327
+ break;
328
+ c.push(d), m.push(d), o += 1;
329
+ }
330
+ }
331
+ e.push({
332
+ indent: h,
333
+ number: parseInt(a, 10),
334
+ content: m.join(`
335
+ `).trim(),
336
+ contentLines: m,
337
+ raw: c.join(`
338
+ `)
339
+ }), n = o, s = o;
340
+ }
341
+ return [e, n];
342
+ }
343
+ function R(t, e, s) {
344
+ const n = [];
345
+ let r = 0;
346
+ for (; r < t.length; ) {
347
+ const i = t[r];
348
+ if (i.indent === e) {
349
+ const { paragraphLines: u, blockLines: a } = nt(i.contentLines), p = u.join(`
350
+ `).trim(), h = [];
351
+ p && h.push({
352
+ type: "paragraph",
353
+ raw: p,
354
+ tokens: s.inlineTokens(p)
355
+ });
356
+ const m = a.join(`
357
+ `).trim();
358
+ if (m) {
359
+ const l = s.blockTokens(m);
360
+ h.push(...l);
361
+ }
362
+ let o = r + 1;
363
+ const c = [];
364
+ for (; o < t.length && t[o].indent > e; )
365
+ c.push(t[o]), o += 1;
366
+ if (c.length > 0) {
367
+ const l = Math.min(...c.map((f) => f.indent)), d = R(c, l, s);
368
+ h.push({
369
+ type: "list",
370
+ ordered: !0,
371
+ start: c[0].number,
372
+ items: d,
373
+ raw: c.map((f) => f.raw).join(`
374
+ `)
375
+ });
376
+ }
377
+ n.push({
378
+ type: "list_item",
379
+ raw: i.raw,
380
+ tokens: h
381
+ }), r = o;
382
+ } else
383
+ r += 1;
384
+ }
385
+ return n;
386
+ }
387
+ function it(t, e) {
388
+ return t.map((s) => {
389
+ if (s.type !== "list_item")
390
+ return e.parseChildren([s])[0];
391
+ const n = [];
392
+ return s.tokens && s.tokens.length > 0 && s.tokens.forEach((r) => {
393
+ if (r.type === "paragraph" || r.type === "list" || r.type === "blockquote" || r.type === "code")
394
+ n.push(...e.parseChildren([r]));
395
+ else if (r.type === "text" && r.tokens) {
396
+ const i = e.parseChildren([r]);
397
+ n.push({
398
+ type: "paragraph",
399
+ content: i
400
+ });
401
+ } else {
402
+ const i = e.parseChildren([r]);
403
+ i.length > 0 && n.push(...i);
404
+ }
405
+ }), {
406
+ type: "listItem",
407
+ content: n
408
+ };
409
+ });
410
+ }
411
+ var at = "listItem", E = "textStyle", H = /^(\d+)\.\s$/, ot = g.create({
412
+ name: "orderedList",
413
+ addOptions() {
414
+ return {
415
+ itemTypeName: "listItem",
416
+ HTMLAttributes: {},
417
+ keepMarks: !1,
418
+ keepAttributes: !1
419
+ };
420
+ },
421
+ group: "block list",
422
+ content() {
423
+ return `${this.options.itemTypeName}+`;
424
+ },
425
+ addAttributes() {
426
+ return {
427
+ start: {
428
+ default: 1,
429
+ parseHTML: (t) => t.hasAttribute("start") ? parseInt(t.getAttribute("start") || "", 10) : 1
430
+ },
431
+ type: {
432
+ default: null,
433
+ parseHTML: (t) => t.getAttribute("type")
434
+ }
435
+ };
436
+ },
437
+ parseHTML() {
438
+ return [
439
+ {
440
+ tag: "ol"
441
+ }
442
+ ];
443
+ },
444
+ renderHTML({ HTMLAttributes: t }) {
445
+ const { start: e, ...s } = t;
446
+ return e === 1 ? ["ol", L(this.options.HTMLAttributes, s), 0] : ["ol", L(this.options.HTMLAttributes, t), 0];
447
+ },
448
+ markdownTokenName: "list",
449
+ parseMarkdown: (t, e) => {
450
+ if (t.type !== "list" || !t.ordered)
451
+ return [];
452
+ const s = t.start || 1, n = t.items ? it(t.items, e) : [];
453
+ return s !== 1 ? {
454
+ type: "orderedList",
455
+ attrs: { start: s },
456
+ content: n
457
+ } : {
458
+ type: "orderedList",
459
+ content: n
460
+ };
461
+ },
462
+ renderMarkdown: (t, e) => t.content ? e.renderChildren(t.content, `
463
+ `) : "",
464
+ markdownTokenizer: {
465
+ name: "orderedList",
466
+ level: "block",
467
+ start: (t) => {
468
+ const e = t.match(/^(\s*)(\d+)\.\s+/), s = e?.index;
469
+ return s !== void 0 ? s : -1;
470
+ },
471
+ tokenize: (t, e, s) => {
472
+ var n;
473
+ const r = t.split(`
474
+ `), [i, u] = rt(r);
475
+ if (i.length === 0)
476
+ return;
477
+ const a = R(i, 0, s);
478
+ return a.length === 0 ? void 0 : {
479
+ type: "list",
480
+ ordered: !0,
481
+ start: ((n = i[0]) == null ? void 0 : n.number) || 1,
482
+ items: a,
483
+ raw: r.slice(0, u).join(`
484
+ `)
485
+ };
486
+ }
487
+ },
488
+ markdownOptions: {
489
+ indentsContent: !0
490
+ },
491
+ addCommands() {
492
+ return {
493
+ toggleOrderedList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(at, this.editor.getAttributes(E)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
494
+ };
495
+ },
496
+ addKeyboardShortcuts() {
497
+ return {
498
+ "Mod-Shift-7": () => this.editor.commands.toggleOrderedList()
499
+ };
500
+ },
501
+ addInputRules() {
502
+ let t = b({
503
+ find: H,
504
+ type: this.type,
505
+ getAttributes: (e) => ({ start: +e[1] }),
506
+ joinPredicate: (e, s) => s.childCount + s.attrs.start === +e[1]
507
+ });
508
+ return (this.options.keepMarks || this.options.keepAttributes) && (t = b({
509
+ find: H,
510
+ type: this.type,
511
+ keepMarks: this.options.keepMarks,
512
+ keepAttributes: this.options.keepAttributes,
513
+ getAttributes: (e) => ({ start: +e[1], ...this.editor.getAttributes(E) }),
514
+ joinPredicate: (e, s) => s.childCount + s.attrs.start === +e[1],
515
+ editor: this.editor
516
+ })), [t];
517
+ }
518
+ }), ut = /^\s*(\[([( |x])?\])\s$/, ct = g.create({
519
+ name: "taskItem",
520
+ addOptions() {
521
+ return {
522
+ nested: !1,
523
+ HTMLAttributes: {},
524
+ taskListTypeName: "taskList",
525
+ a11y: void 0
526
+ };
527
+ },
528
+ content() {
529
+ return this.options.nested ? "paragraph block*" : "paragraph+";
530
+ },
531
+ defining: !0,
532
+ addAttributes() {
533
+ return {
534
+ checked: {
535
+ default: !1,
536
+ keepOnSplit: !1,
537
+ parseHTML: (t) => {
538
+ const e = t.getAttribute("data-checked");
539
+ return e === "" || e === "true";
540
+ },
541
+ renderHTML: (t) => ({
542
+ "data-checked": t.checked
543
+ })
544
+ }
545
+ };
546
+ },
547
+ parseHTML() {
548
+ return [
549
+ {
550
+ tag: `li[data-type="${this.name}"]`,
551
+ priority: 51
552
+ }
553
+ ];
554
+ },
555
+ renderHTML({ node: t, HTMLAttributes: e }) {
556
+ return [
557
+ "li",
558
+ L(this.options.HTMLAttributes, e, {
559
+ "data-type": this.name
560
+ }),
561
+ [
562
+ "label",
563
+ [
564
+ "input",
565
+ {
566
+ type: "checkbox",
567
+ checked: t.attrs.checked ? "checked" : null
568
+ }
569
+ ],
570
+ ["span"]
571
+ ],
572
+ ["div", 0]
573
+ ];
574
+ },
575
+ parseMarkdown: (t, e) => {
576
+ const s = [];
577
+ if (t.tokens && t.tokens.length > 0 ? s.push(e.createNode("paragraph", {}, e.parseInline(t.tokens))) : t.text ? s.push(e.createNode("paragraph", {}, [e.createNode("text", { text: t.text })])) : s.push(e.createNode("paragraph", {}, [])), t.nestedTokens && t.nestedTokens.length > 0) {
578
+ const n = e.parseChildren(t.nestedTokens);
579
+ s.push(...n);
580
+ }
581
+ return e.createNode("taskItem", { checked: t.checked || !1 }, s);
582
+ },
583
+ renderMarkdown: (t, e) => {
584
+ var s;
585
+ const r = `- [${(s = t.attrs) != null && s.checked ? "x" : " "}] `;
586
+ return $(t, e, r);
587
+ },
588
+ addKeyboardShortcuts() {
589
+ const t = {
590
+ Enter: () => this.editor.commands.splitListItem(this.name),
591
+ "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
592
+ };
593
+ return this.options.nested ? {
594
+ ...t,
595
+ Tab: () => this.editor.commands.sinkListItem(this.name)
596
+ } : t;
597
+ },
598
+ addNodeView() {
599
+ return ({ node: t, HTMLAttributes: e, getPos: s, editor: n }) => {
600
+ const r = document.createElement("li"), i = document.createElement("label"), u = document.createElement("span"), a = document.createElement("input"), p = document.createElement("div"), h = (o) => {
601
+ var c, l;
602
+ a.ariaLabel = ((l = (c = this.options.a11y) == null ? void 0 : c.checkboxLabel) == null ? void 0 : l.call(c, o, a.checked)) || `Task item checkbox for ${o.textContent || "empty task item"}`;
603
+ };
604
+ h(t), i.contentEditable = "false", a.type = "checkbox", a.addEventListener("mousedown", (o) => o.preventDefault()), a.addEventListener("change", (o) => {
605
+ if (!n.isEditable && !this.options.onReadOnlyChecked) {
606
+ a.checked = !a.checked;
607
+ return;
608
+ }
609
+ const { checked: c } = o.target;
610
+ n.isEditable && typeof s == "function" && n.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: l }) => {
611
+ const d = s();
612
+ if (typeof d != "number")
613
+ return !1;
614
+ const f = l.doc.nodeAt(d);
615
+ return l.setNodeMarkup(d, void 0, {
616
+ ...f?.attrs,
617
+ checked: c
618
+ }), !0;
619
+ }).run(), !n.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(t, c) || (a.checked = !a.checked));
620
+ }), Object.entries(this.options.HTMLAttributes).forEach(([o, c]) => {
621
+ r.setAttribute(o, c);
622
+ }), r.dataset.checked = t.attrs.checked, a.checked = t.attrs.checked, i.append(a, u), r.append(i, p), Object.entries(e).forEach(([o, c]) => {
623
+ r.setAttribute(o, c);
624
+ });
625
+ let m = new Set(Object.keys(e));
626
+ return {
627
+ dom: r,
628
+ contentDOM: p,
629
+ update: (o) => {
630
+ if (o.type !== this.type)
631
+ return !1;
632
+ r.dataset.checked = o.attrs.checked, a.checked = o.attrs.checked, h(o);
633
+ const c = n.extensionManager.attributes, l = X(o, c), d = new Set(Object.keys(l)), f = this.options.HTMLAttributes;
634
+ return m.forEach((k) => {
635
+ d.has(k) || (k in f ? r.setAttribute(k, f[k]) : r.removeAttribute(k));
636
+ }), Object.entries(l).forEach(([k, v]) => {
637
+ v == null ? k in f ? r.setAttribute(k, f[k]) : r.removeAttribute(k) : r.setAttribute(k, v);
638
+ }), m = d, !0;
639
+ }
640
+ };
641
+ };
642
+ },
643
+ addInputRules() {
644
+ return [
645
+ b({
646
+ find: ut,
647
+ type: this.type,
648
+ getAttributes: (t) => ({
649
+ checked: t[t.length - 1] === "x"
650
+ })
651
+ })
652
+ ];
653
+ }
654
+ }), lt = g.create({
655
+ name: "taskList",
656
+ addOptions() {
657
+ return {
658
+ itemTypeName: "taskItem",
659
+ HTMLAttributes: {}
660
+ };
661
+ },
662
+ group: "block list",
663
+ content() {
664
+ return `${this.options.itemTypeName}+`;
665
+ },
666
+ parseHTML() {
667
+ return [
668
+ {
669
+ tag: `ul[data-type="${this.name}"]`,
670
+ priority: 51
671
+ }
672
+ ];
673
+ },
674
+ renderHTML({ HTMLAttributes: t }) {
675
+ return ["ul", L(this.options.HTMLAttributes, t, { "data-type": this.name }), 0];
676
+ },
677
+ parseMarkdown: (t, e) => e.createNode("taskList", {}, e.parseChildren(t.items || [])),
678
+ renderMarkdown: (t, e) => t.content ? e.renderChildren(t.content, `
679
+ `) : "",
680
+ markdownTokenizer: {
681
+ name: "taskList",
682
+ level: "block",
683
+ start(t) {
684
+ var e;
685
+ const s = (e = t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)) == null ? void 0 : e.index;
686
+ return s !== void 0 ? s : -1;
687
+ },
688
+ tokenize(t, e, s) {
689
+ const n = (i) => {
690
+ const u = x(
691
+ i,
692
+ {
693
+ itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
694
+ extractItemData: (a) => ({
695
+ indentLevel: a[1].length,
696
+ mainContent: a[4],
697
+ checked: a[3].toLowerCase() === "x"
698
+ }),
699
+ createToken: (a, p) => ({
700
+ type: "taskItem",
701
+ raw: "",
702
+ mainContent: a.mainContent,
703
+ indentLevel: a.indentLevel,
704
+ checked: a.checked,
705
+ text: a.mainContent,
706
+ tokens: s.inlineTokens(a.mainContent),
707
+ nestedTokens: p
708
+ }),
709
+ // Allow recursive nesting
710
+ customNestedParser: n
711
+ },
712
+ s
713
+ );
714
+ return u ? [
715
+ {
716
+ type: "taskList",
717
+ raw: u.raw,
718
+ items: u.items
719
+ }
720
+ ] : s.blockTokens(i);
721
+ }, r = x(
722
+ t,
723
+ {
724
+ itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
725
+ extractItemData: (i) => ({
726
+ indentLevel: i[1].length,
727
+ mainContent: i[4],
728
+ checked: i[3].toLowerCase() === "x"
729
+ }),
730
+ createToken: (i, u) => ({
731
+ type: "taskItem",
732
+ raw: "",
733
+ mainContent: i.mainContent,
734
+ indentLevel: i.indentLevel,
735
+ checked: i.checked,
736
+ text: i.mainContent,
737
+ tokens: s.inlineTokens(i.mainContent),
738
+ nestedTokens: u
739
+ }),
740
+ // Use the recursive parser for nested content
741
+ customNestedParser: n
742
+ },
743
+ s
744
+ );
745
+ if (r)
746
+ return {
747
+ type: "taskList",
748
+ raw: r.raw,
749
+ items: r.items
750
+ };
751
+ }
752
+ },
753
+ markdownOptions: {
754
+ indentsContent: !0
755
+ },
756
+ addCommands() {
757
+ return {
758
+ toggleTaskList: () => ({ commands: t }) => t.toggleList(this.name, this.options.itemTypeName)
759
+ };
760
+ },
761
+ addKeyboardShortcuts() {
762
+ return {
763
+ "Mod-Shift-9": () => this.editor.commands.toggleTaskList()
764
+ };
765
+ }
766
+ });
767
+ S.create({
768
+ name: "listKit",
769
+ addExtensions() {
770
+ const t = [];
771
+ return this.options.bulletList !== !1 && t.push(q.configure(this.options.bulletList)), this.options.listItem !== !1 && t.push(Q.configure(this.options.listItem)), this.options.listKeymap !== !1 && t.push(tt.configure(this.options.listKeymap)), this.options.orderedList !== !1 && t.push(ot.configure(this.options.orderedList)), this.options.taskItem !== !1 && t.push(ct.configure(this.options.taskItem)), this.options.taskList !== !1 && t.push(lt.configure(this.options.taskList)), t;
772
+ }
773
+ });
774
+ export {
775
+ q as BulletList,
776
+ Q as ListItem,
777
+ tt as ListKeymap,
778
+ ot as OrderedList,
779
+ ct as TaskItem,
780
+ lt as TaskList,
781
+ C as bulletListInputRegex,
782
+ ut as inputRegex,
783
+ U as listHelpers,
784
+ H as orderedListInputRegex
785
+ };