@clevertask/scribe 0.1.3 → 0.1.5

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 (85) hide show
  1. package/README.md +3 -0
  2. package/dist/BarMenu-V1uRL3bt.js +272 -0
  3. package/dist/assets/index.css +1 -1
  4. package/dist/components/Menu/BarMenu.d.ts.map +1 -1
  5. package/dist/components/Menu/BarMenu.js +2 -10
  6. package/dist/components/Menu/BubbleMenu.d.ts.map +1 -1
  7. package/dist/components/Menu/BubbleMenu.js +165 -2090
  8. package/dist/components/Menu/LinkBubbleMenu.d.ts +8 -0
  9. package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -0
  10. package/dist/components/Menu/LinkBubbleMenu.js +78 -0
  11. package/dist/components/Menu/LinkEditor.d.ts +14 -0
  12. package/dist/components/Menu/LinkEditor.d.ts.map +1 -0
  13. package/dist/components/Menu/LinkEditor.js +140 -0
  14. package/dist/components/Menu/Mobile/ListOptionBar.d.ts +1 -1
  15. package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -1
  16. package/dist/components/Menu/Mobile/ListOptionBar.js +38 -44
  17. package/dist/components/Menu/linkBubbleMenuPlugin.d.ts +5 -0
  18. package/dist/components/Menu/linkBubbleMenuPlugin.d.ts.map +1 -0
  19. package/dist/components/Menu/linkBubbleMenuPlugin.js +7 -0
  20. package/dist/components/Menu/linkUrl.d.ts +2 -0
  21. package/dist/components/Menu/linkUrl.d.ts.map +1 -0
  22. package/dist/components/Menu/linkUrl.js +21 -0
  23. package/dist/components/Scribe/extension/emoji/EmojiList.js +58 -45
  24. package/dist/components/Scribe/extension/emoji/suggest.d.ts +2 -2
  25. package/dist/components/Scribe/extension/emoji/suggest.d.ts.map +1 -1
  26. package/dist/components/Scribe/extension/emoji/suggest.js +39 -43
  27. package/dist/components/Scribe/extension/extension-link.d.ts.map +1 -1
  28. package/dist/components/Scribe/extension/extension-link.js +2 -4
  29. package/dist/components/Scribe/extension/extension-markdown-paste.d.ts.map +1 -1
  30. package/dist/components/Scribe/extension/extension-markdown-paste.js +50 -45
  31. package/dist/components/Scribe/extension/extension-selectedText.d.ts.map +1 -1
  32. package/dist/components/Scribe/extension/extension-selectedText.js +10 -12
  33. package/dist/components/Scribe/extension/getPopupMountTarget.d.ts.map +1 -1
  34. package/dist/components/Scribe/extension/getPopupMountTarget.js +12 -15
  35. package/dist/components/Scribe/extension/index.d.ts +4 -4
  36. package/dist/components/Scribe/extension/index.d.ts.map +1 -1
  37. package/dist/components/Scribe/extension/index.js +2 -37169
  38. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +3369 -3731
  39. package/dist/components/Scribe/extension/slashCommand/index.js +2 -6
  40. package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
  41. package/dist/components/Scribe/extension/slashCommand/items.js +177 -176
  42. package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts.map +1 -1
  43. package/dist/components/Scribe/extension/slashCommand/renderItems.js +35 -41
  44. package/dist/components/Scribe/extension/tableOfContents.js +153 -180
  45. package/dist/components/Scribe/index.d.ts.map +1 -1
  46. package/dist/components/Scribe/index.js +113 -153
  47. package/dist/dist-BQjH-i-q.js +7016 -0
  48. package/dist/dist-CnXCIcnl.js +3506 -0
  49. package/dist/dist-RuuEA1GJ.js +686 -0
  50. package/dist/extension-CZOsheCI.js +56236 -0
  51. package/dist/extension-link-DZID_SYl.js +908 -0
  52. package/dist/floating-ui.dom-rih69525.js +928 -0
  53. package/dist/html-to-markdown-CrNOkSye.js +497 -0
  54. package/dist/icons/ToolbarIcons.d.ts.map +1 -1
  55. package/dist/icons/ToolbarIcons.js +76 -135
  56. package/dist/main.css +10 -0
  57. package/dist/main.js +7 -15
  58. package/dist/markdown-to-html-DEczPfuq.js +1458 -0
  59. package/dist/menus-CzX7kyXn.js +633 -0
  60. package/dist/purify.es-DF9CW1cl.js +767 -0
  61. package/dist/rolldown-runtime-B8UxIWdF.js +7 -0
  62. package/dist/slashCommand-B7CRIaKG.js +429 -0
  63. package/dist/tables-CjOC70rm.js +1345 -0
  64. package/dist/tippy.esm-D9LL2xiE.js +1713 -0
  65. package/dist/utils/convert-legacy-math-delimiters.d.ts.map +1 -1
  66. package/dist/utils/convert-legacy-math-delimiters.js +7 -13
  67. package/dist/utils/create-scribe-editor.js +2 -31
  68. package/dist/utils/html-to-markdown.d.ts.map +1 -1
  69. package/dist/utils/html-to-markdown.js +2 -600
  70. package/dist/utils/index.js +24 -12
  71. package/dist/utils/is-in-viewport.d.ts.map +1 -1
  72. package/dist/utils/is-in-viewport.js +6 -6
  73. package/dist/utils/markdown-to-html.d.ts.map +1 -1
  74. package/dist/utils/markdown-to-html.js +2 -5
  75. package/dist/vite-env.d.js +0 -1
  76. package/package.json +40 -38
  77. package/dist/BarMenu-DaKIz3zZ.js +0 -327
  78. package/dist/extension-link-Ch_T7WWG.js +0 -1030
  79. package/dist/index-BiBV5TQx.js +0 -13513
  80. package/dist/index-CqzMmrnw.js +0 -1410
  81. package/dist/index-DxF-1P4n.js +0 -834
  82. package/dist/index-V-gN11Y9.js +0 -249
  83. package/dist/markdown-to-html-pL7ckd-m.js +0 -1135
  84. package/dist/purify.es-exIQuqhb.js +0 -595
  85. package/dist/tippy.esm-DLHdsnfG.js +0 -1711
@@ -1,249 +0,0 @@
1
- import { P as z, b as J, D as Q, e as V, g as X, a as Y } from "./index-BiBV5TQx.js";
2
- function Z(u) {
3
- var s;
4
- const { char: g, allowSpaces: y, allowToIncludeChar: $, allowedPrefixes: E, startOfLine: k, $position: h } = u, P = y && !$, S = X(g), N = new RegExp(`\\s${S}$`), _ = k ? "^" : "", M = $ ? "" : S, C = P ? new RegExp(`${_}${S}.*?(?=\\s${M}|$)`, "gm") : new RegExp(`${_}(?:^)?${S}[^\\s${M}]*`, "gm"), R = ((s = h.nodeBefore) == null ? void 0 : s.isText) && h.nodeBefore.text;
5
- if (!R)
6
- return null;
7
- const O = h.pos - R.length, c = Array.from(R.matchAll(C)).pop();
8
- if (!c || c.input === void 0 || c.index === void 0)
9
- return null;
10
- const D = c.input.slice(Math.max(0, c.index - 1), c.index), f = new RegExp(`^[${E?.join("")}\0]?$`).test(D);
11
- if (E !== null && !f)
12
- return null;
13
- const n = O + c.index;
14
- let v = n + c[0].length;
15
- return P && N.test(R.slice(v - 1, v + 1)) && (c[0] += " ", v += 1), n < h.pos && v >= h.pos ? {
16
- range: {
17
- from: n,
18
- to: v
19
- },
20
- query: c[0].slice(g.length),
21
- text: c[0]
22
- } : null;
23
- }
24
- function ee(u) {
25
- return u.docChanged ? u.steps.some((s) => {
26
- const g = s.slice;
27
- if (!g?.content)
28
- return !1;
29
- const y = g.content.textBetween(0, g.content.size, `
30
- `);
31
- return /\s/.test(y);
32
- }) : !1;
33
- }
34
- var te = new z("suggestion");
35
- function ne({
36
- pluginKey: u = te,
37
- editor: s,
38
- char: g = "@",
39
- allowSpaces: y = !1,
40
- allowToIncludeChar: $ = !1,
41
- allowedPrefixes: E = [" "],
42
- startOfLine: k = !1,
43
- decorationTag: h = "span",
44
- decorationClass: P = "suggestion",
45
- decorationContent: S = "",
46
- decorationEmptyClass: N = "is-empty",
47
- command: _ = () => null,
48
- items: M = () => [],
49
- render: C = () => ({}),
50
- allow: R = () => !0,
51
- findSuggestionMatch: O = Z,
52
- shouldShow: c,
53
- shouldResetDismissed: D
54
- }) {
55
- let f;
56
- const n = C?.(), v = y && !$, T = () => {
57
- const t = s.state.selection.$anchor.pos, o = s.view.coordsAtPos(t), { top: l, right: i, bottom: a, left: r } = o;
58
- try {
59
- return new DOMRect(r, l, i - r, a - l);
60
- } catch {
61
- return null;
62
- }
63
- }, j = (t, o) => o ? () => {
64
- const l = u.getState(s.state), i = l?.decorationId, a = t.dom.querySelector(`[data-decoration-id="${i}"]`);
65
- return a?.getBoundingClientRect() || null;
66
- } : T, W = ({
67
- match: t,
68
- dismissedRange: o,
69
- state: l,
70
- transaction: i
71
- }) => D?.({
72
- editor: s,
73
- state: l,
74
- range: o,
75
- match: t,
76
- transaction: i,
77
- allowSpaces: v
78
- }) ? !1 : v ? t.range.from === o.from : t.range.from === o.from && !ee(i);
79
- function G(t, o) {
80
- var l;
81
- try {
82
- const a = u.getState(t.state), r = a?.decorationId ? t.dom.querySelector(`[data-decoration-id="${a.decorationId}"]`) : null, m = {
83
- // @ts-ignore editor is available in closure
84
- editor: s,
85
- range: a?.range || { from: 0, to: 0 },
86
- query: a?.query || null,
87
- text: a?.text || null,
88
- items: [],
89
- command: (x) => _({ editor: s, range: a?.range || { from: 0, to: 0 }, props: x }),
90
- decorationNode: r,
91
- clientRect: j(t, r)
92
- };
93
- (l = n?.onExit) == null || l.call(n, m);
94
- } catch {
95
- }
96
- const i = t.state.tr.setMeta(o, { exit: !0 });
97
- t.dispatch(i);
98
- }
99
- const A = new J({
100
- key: u,
101
- view() {
102
- return {
103
- update: async (t, o) => {
104
- var l, i, a, r, m, x, I;
105
- const e = (l = this.key) == null ? void 0 : l.getState(o), p = (i = this.key) == null ? void 0 : i.getState(t.state), d = e.active && p.active && e.range.from !== p.range.from, B = !e.active && p.active, L = e.active && !p.active, K = !B && !L && e.query !== p.query, w = B || d && K, b = K || d, F = L || d && K;
106
- if (!w && !b && !F)
107
- return;
108
- const q = F && !w ? e : p, U = t.dom.querySelector(`[data-decoration-id="${q.decorationId}"]`);
109
- f = {
110
- editor: s,
111
- range: q.range,
112
- query: q.query,
113
- text: q.text,
114
- items: [],
115
- command: (H) => _({
116
- editor: s,
117
- range: q.range,
118
- props: H
119
- }),
120
- decorationNode: U,
121
- clientRect: j(t, U)
122
- }, w && ((a = n?.onBeforeStart) == null || a.call(n, f)), b && ((r = n?.onBeforeUpdate) == null || r.call(n, f)), (b || w) && (f.items = await M({
123
- editor: s,
124
- query: q.query
125
- })), F && ((m = n?.onExit) == null || m.call(n, f)), b && ((x = n?.onUpdate) == null || x.call(n, f)), w && ((I = n?.onStart) == null || I.call(n, f));
126
- },
127
- destroy: () => {
128
- var t;
129
- f && ((t = n?.onExit) == null || t.call(n, f));
130
- }
131
- };
132
- },
133
- state: {
134
- // Initialize the plugin's internal state.
135
- init() {
136
- return {
137
- active: !1,
138
- range: {
139
- from: 0,
140
- to: 0
141
- },
142
- query: null,
143
- text: null,
144
- composing: !1,
145
- dismissedRange: null
146
- };
147
- },
148
- // Apply changes to the plugin state from a view transaction.
149
- apply(t, o, l, i) {
150
- const { isEditable: a } = s, { composing: r } = s.view, { selection: m } = t, { empty: x, from: I } = m, e = { ...o }, p = t.getMeta(u);
151
- if (p && p.exit)
152
- return e.active = !1, e.decorationId = null, e.range = { from: 0, to: 0 }, e.query = null, e.text = null, e.dismissedRange = o.active ? { ...o.range } : o.dismissedRange, e;
153
- if (e.composing = r, t.docChanged && e.dismissedRange !== null && (e.dismissedRange = {
154
- from: t.mapping.map(e.dismissedRange.from),
155
- to: t.mapping.map(e.dismissedRange.to)
156
- }), a && (x || s.view.composing)) {
157
- (I < o.range.from || I > o.range.to) && !r && !o.composing && (e.active = !1);
158
- const d = O({
159
- char: g,
160
- allowSpaces: y,
161
- allowToIncludeChar: $,
162
- allowedPrefixes: E,
163
- startOfLine: k,
164
- $position: m.$from
165
- }), B = `id_${Math.floor(Math.random() * 4294967295)}`;
166
- d && R({
167
- editor: s,
168
- state: i,
169
- range: d.range,
170
- isActive: o.active
171
- }) && (!c || c({
172
- editor: s,
173
- range: d.range,
174
- query: d.query,
175
- text: d.text,
176
- transaction: t
177
- })) ? (e.dismissedRange !== null && !W({
178
- match: d,
179
- dismissedRange: e.dismissedRange,
180
- state: i,
181
- transaction: t
182
- }) && (e.dismissedRange = null), e.dismissedRange === null ? (e.active = !0, e.decorationId = o.decorationId ? o.decorationId : B, e.range = d.range, e.query = d.query, e.text = d.text) : e.active = !1) : (d || (e.dismissedRange = null), e.active = !1);
183
- } else
184
- e.active = !1;
185
- return e.active || (e.decorationId = null, e.range = { from: 0, to: 0 }, e.query = null, e.text = null), e;
186
- }
187
- },
188
- props: {
189
- // Call the keydown hook if suggestion is active.
190
- handleKeyDown(t, o) {
191
- var l, i;
192
- const { active: a, range: r } = A.getState(t.state);
193
- if (!a)
194
- return !1;
195
- if (o.key === "Escape" || o.key === "Esc") {
196
- const x = A.getState(t.state);
197
- return (l = n?.onKeyDown) == null || l.call(n, { view: t, event: o, range: x.range }), G(t, u), !0;
198
- }
199
- return ((i = n?.onKeyDown) == null ? void 0 : i.call(n, { view: t, event: o, range: r })) || !1;
200
- },
201
- // Setup decorator on the currently active suggestion.
202
- decorations(t) {
203
- const { active: o, range: l, decorationId: i, query: a } = A.getState(t);
204
- if (!o)
205
- return null;
206
- const r = !a?.length, m = [P];
207
- return r && m.push(N), Q.create(t.doc, [
208
- V.inline(l.from, l.to, {
209
- nodeName: h,
210
- class: m.join(" "),
211
- "data-decoration-id": i,
212
- "data-decoration-content": S
213
- })
214
- ]);
215
- }
216
- }
217
- });
218
- return A;
219
- }
220
- var oe = ne;
221
- const ae = new z("slashSuggestion"), le = Y.create({
222
- name: "slashCommand",
223
- addOptions() {
224
- return {
225
- ...this.parent?.(),
226
- slashSuggestion: {
227
- char: "/",
228
- startOfLine: !0,
229
- command: ({ editor: u, range: s, props: g }) => {
230
- g.command({ editor: u, range: s, props: g });
231
- }
232
- }
233
- };
234
- },
235
- addProseMirrorPlugins() {
236
- return [
237
- oe({
238
- pluginKey: ae,
239
- ...this.options.slashSuggestion,
240
- editor: this.editor
241
- })
242
- ];
243
- }
244
- });
245
- export {
246
- ne as S,
247
- le as a,
248
- ae as s
249
- };