@clevertask/scribe 0.0.10 → 0.0.12

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 (39) hide show
  1. package/dist/assets/index.css +1 -1
  2. package/dist/clsx-OuTLNxxd.js +16 -0
  3. package/dist/components/Menu/BarMenu.js +119 -4
  4. package/dist/components/Menu/BubbleMenu.js +1 -1
  5. package/dist/components/Menu/Mobile/ListOptionBar.d.ts +6 -0
  6. package/dist/components/Menu/Mobile/ListOptionBar.js +40 -0
  7. package/dist/components/Scribe/extension/emoji/EmojiList.d.ts +1 -0
  8. package/dist/components/Scribe/extension/emoji/EmojiList.js +35 -0
  9. package/dist/components/Scribe/extension/emoji/suggest.d.ts +16 -0
  10. package/dist/components/Scribe/extension/emoji/suggest.js +40 -0
  11. package/dist/components/Scribe/extension/extension-link.js +221 -217
  12. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  13. package/dist/components/Scribe/extension/index.d.ts +1 -1
  14. package/dist/components/Scribe/extension/index.js +33 -28
  15. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +8 -6
  16. package/dist/components/Scribe/extension/slashCommand/index.js +4 -153
  17. package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts +1 -1
  18. package/dist/components/Scribe/extension/slashCommand/renderItems.js +14 -14
  19. package/dist/components/Scribe/index.d.ts +1 -0
  20. package/dist/components/Scribe/index.js +85 -61
  21. package/dist/index-B0pieAxt.js +160 -0
  22. package/dist/index-CCS9HOYd.js +51031 -0
  23. package/dist/{index-Gm-3o3nq.js → index-DoNRu1rY.js} +1654 -1553
  24. package/dist/index-VneQGVTd.js +2385 -0
  25. package/dist/main.css +64 -6
  26. package/dist/marked.esm-BS_MmRZC.js +1566 -0
  27. package/dist/purify.es-BGaRrCfO.js +553 -0
  28. package/dist/turndown.browser.es-RmA_HBaI.js +649 -0
  29. package/dist/utils/create-scribe-editor.js +7 -6
  30. package/dist/utils/html-to-markdown.js +7 -6
  31. package/dist/utils/markdown-to-html.js +4 -3
  32. package/package.json +44 -41
  33. package/dist/BarMenu-SiPgB2ow.js +0 -134
  34. package/dist/browser-DEobZXxB.js +0 -2099
  35. package/dist/components/Scribe/extension/math-extension.d.ts +0 -2
  36. package/dist/components/Scribe/extension/math-extension.js +0 -11770
  37. package/dist/index-C3_lI_rP.js +0 -2269
  38. package/dist/index-NRgJVTH-.js +0 -7576
  39. package/dist/turndown.browser.es-BSoGafvq.js +0 -1164
@@ -0,0 +1,160 @@
1
+ import { P as L, b as U, D as z, c as G, e as H, a as J } from "./index-DoNRu1rY.js";
2
+ function Q(g) {
3
+ var i;
4
+ const { char: v, allowSpaces: m, allowToIncludeChar: P, allowedPrefixes: p, startOfLine: K, $position: f } = g, C = m && !P, h = H(v), B = new RegExp(`\\s${h}$`), M = K ? "^" : "", R = P ? "" : h, $ = C ? new RegExp(`${M}${h}.*?(?=\\s${R}|$)`, "gm") : new RegExp(`${M}(?:^)?${h}[^\\s${R}]*`, "gm"), x = ((i = f.nodeBefore) === null || i === void 0 ? void 0 : i.isText) && f.nodeBefore.text;
5
+ if (!x)
6
+ return null;
7
+ const k = f.pos - x.length, n = Array.from(x.matchAll($)).pop();
8
+ if (!n || n.input === void 0 || n.index === void 0)
9
+ return null;
10
+ const e = n.input.slice(Math.max(0, n.index - 1), n.index), w = new RegExp(`^[${p == null ? void 0 : p.join("")}\0]?$`).test(e);
11
+ if (p !== null && !w)
12
+ return null;
13
+ const o = k + n.index;
14
+ let a = o + n[0].length;
15
+ return C && B.test(x.slice(a - 1, a + 1)) && (n[0] += " ", a += 1), o < f.pos && a >= f.pos ? {
16
+ range: {
17
+ from: o,
18
+ to: a
19
+ },
20
+ query: n[0].slice(v.length),
21
+ text: n[0]
22
+ } : null;
23
+ }
24
+ const V = new L("suggestion");
25
+ function W({ pluginKey: g = V, editor: i, char: v = "@", allowSpaces: m = !1, allowToIncludeChar: P = !1, allowedPrefixes: p = [" "], startOfLine: K = !1, decorationTag: f = "span", decorationClass: C = "suggestion", decorationContent: h = "", decorationEmptyClass: B = "is-empty", command: M = () => null, items: R = () => [], render: $ = () => ({}), allow: x = () => !0, findSuggestionMatch: k = Q }) {
26
+ let n;
27
+ const e = $ == null ? void 0 : $(), w = new U({
28
+ key: g,
29
+ view() {
30
+ return {
31
+ update: async (o, a) => {
32
+ var l, c, r, u, d, q, y;
33
+ const t = (l = this.key) === null || l === void 0 ? void 0 : l.getState(a), s = (c = this.key) === null || c === void 0 ? void 0 : c.getState(o.state), _ = t.active && s.active && t.range.from !== s.range.from, b = !t.active && s.active, j = t.active && !s.active, A = !b && !j && t.query !== s.query, E = b || _ && A, D = A || _, N = j || _ && A;
34
+ if (!E && !D && !N)
35
+ return;
36
+ const S = N && !E ? t : s, F = o.dom.querySelector(`[data-decoration-id="${S.decorationId}"]`);
37
+ n = {
38
+ editor: i,
39
+ range: S.range,
40
+ query: S.query,
41
+ text: S.text,
42
+ items: [],
43
+ command: (I) => M({
44
+ editor: i,
45
+ range: S.range,
46
+ props: I
47
+ }),
48
+ decorationNode: F,
49
+ // virtual node for popper.js or tippy.js
50
+ // this can be used for building popups without a DOM node
51
+ clientRect: F ? () => {
52
+ var I;
53
+ const { decorationId: T } = (I = this.key) === null || I === void 0 ? void 0 : I.getState(i.state), O = o.dom.querySelector(`[data-decoration-id="${T}"]`);
54
+ return (O == null ? void 0 : O.getBoundingClientRect()) || null;
55
+ } : null
56
+ }, E && ((r = e == null ? void 0 : e.onBeforeStart) === null || r === void 0 || r.call(e, n)), D && ((u = e == null ? void 0 : e.onBeforeUpdate) === null || u === void 0 || u.call(e, n)), (D || E) && (n.items = await R({
57
+ editor: i,
58
+ query: S.query
59
+ })), N && ((d = e == null ? void 0 : e.onExit) === null || d === void 0 || d.call(e, n)), D && ((q = e == null ? void 0 : e.onUpdate) === null || q === void 0 || q.call(e, n)), E && ((y = e == null ? void 0 : e.onStart) === null || y === void 0 || y.call(e, n));
60
+ },
61
+ destroy: () => {
62
+ var o;
63
+ n && ((o = e == null ? void 0 : e.onExit) === null || o === void 0 || o.call(e, n));
64
+ }
65
+ };
66
+ },
67
+ state: {
68
+ // Initialize the plugin's internal state.
69
+ init() {
70
+ return {
71
+ active: !1,
72
+ range: {
73
+ from: 0,
74
+ to: 0
75
+ },
76
+ query: null,
77
+ text: null,
78
+ composing: !1
79
+ };
80
+ },
81
+ // Apply changes to the plugin state from a view transaction.
82
+ apply(o, a, l, c) {
83
+ const { isEditable: r } = i, { composing: u } = i.view, { selection: d } = o, { empty: q, from: y } = d, t = { ...a };
84
+ if (t.composing = u, r && (q || i.view.composing)) {
85
+ (y < a.range.from || y > a.range.to) && !u && !a.composing && (t.active = !1);
86
+ const s = k({
87
+ char: v,
88
+ allowSpaces: m,
89
+ allowToIncludeChar: P,
90
+ allowedPrefixes: p,
91
+ startOfLine: K,
92
+ $position: d.$from
93
+ }), _ = `id_${Math.floor(Math.random() * 4294967295)}`;
94
+ s && x({
95
+ editor: i,
96
+ state: c,
97
+ range: s.range,
98
+ isActive: a.active
99
+ }) ? (t.active = !0, t.decorationId = a.decorationId ? a.decorationId : _, t.range = s.range, t.query = s.query, t.text = s.text) : t.active = !1;
100
+ } else
101
+ t.active = !1;
102
+ return t.active || (t.decorationId = null, t.range = { from: 0, to: 0 }, t.query = null, t.text = null), t;
103
+ }
104
+ },
105
+ props: {
106
+ // Call the keydown hook if suggestion is active.
107
+ handleKeyDown(o, a) {
108
+ var l;
109
+ const { active: c, range: r } = w.getState(o.state);
110
+ return c && ((l = e == null ? void 0 : e.onKeyDown) === null || l === void 0 ? void 0 : l.call(e, { view: o, event: a, range: r })) || !1;
111
+ },
112
+ // Setup decorator on the currently active suggestion.
113
+ decorations(o) {
114
+ const { active: a, range: l, decorationId: c, query: r } = w.getState(o);
115
+ if (!a)
116
+ return null;
117
+ const u = !(r != null && r.length), d = [C];
118
+ return u && d.push(B), z.create(o.doc, [
119
+ G.inline(l.from, l.to, {
120
+ nodeName: f,
121
+ class: d.join(" "),
122
+ "data-decoration-id": c,
123
+ "data-decoration-content": h
124
+ })
125
+ ]);
126
+ }
127
+ }
128
+ });
129
+ return w;
130
+ }
131
+ const X = new L("slashSuggestion"), Z = J.create({
132
+ name: "slashCommand",
133
+ addOptions() {
134
+ var g;
135
+ return {
136
+ ...(g = this.parent) == null ? void 0 : g.call(this),
137
+ slashSuggestion: {
138
+ char: "/",
139
+ startOfLine: !0,
140
+ command: ({ editor: i, range: v, props: m }) => {
141
+ m.command({ editor: i, range: v, props: m });
142
+ }
143
+ }
144
+ };
145
+ },
146
+ addProseMirrorPlugins() {
147
+ return [
148
+ W({
149
+ pluginKey: X,
150
+ ...this.options.slashSuggestion,
151
+ editor: this.editor
152
+ })
153
+ ];
154
+ }
155
+ });
156
+ export {
157
+ Z as S,
158
+ W as a,
159
+ X as s
160
+ };