@clevertask/scribe 0.1.2 → 0.1.4

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 (41) hide show
  1. package/dist/{BarMenu-DaKIz3zZ.js → BarMenu-BNk2I0zi.js} +1 -1
  2. package/dist/assets/index.css +1 -1
  3. package/dist/components/Menu/BarMenu.js +2 -2
  4. package/dist/components/Menu/BubbleMenu.js +378 -1445
  5. package/dist/components/Menu/Mobile/ListOptionBar.d.ts +1 -1
  6. package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -1
  7. package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
  8. package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
  9. package/dist/components/Scribe/extension/extension-link.js +1 -1
  10. package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
  11. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  12. package/dist/components/Scribe/extension/index.d.ts +2 -0
  13. package/dist/components/Scribe/extension/index.d.ts.map +1 -1
  14. package/dist/components/Scribe/extension/index.js +5786 -3419
  15. package/dist/components/Scribe/extension/slashCommand/index.d.ts +10 -1
  16. package/dist/components/Scribe/extension/slashCommand/index.d.ts.map +1 -1
  17. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  18. package/dist/components/Scribe/extension/slashCommand/items.d.ts +20 -0
  19. package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
  20. package/dist/components/Scribe/extension/slashCommand/items.js +37 -18
  21. package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
  22. package/dist/components/Scribe/extension/tableOfContents.js +1 -1
  23. package/dist/components/Scribe/index.d.ts +8 -0
  24. package/dist/components/Scribe/index.d.ts.map +1 -1
  25. package/dist/components/Scribe/index.js +36 -34
  26. package/dist/{extension-link-Ch_T7WWG.js → extension-link-P1rro4zO.js} +247 -218
  27. package/dist/floating-ui.dom-ZRy7FSVk.js +1246 -0
  28. package/dist/{index-DxF-1P4n.js → index-BMISMQrG.js} +168 -147
  29. package/dist/{index-CqzMmrnw.js → index-ByyiiYsp.js} +1 -1
  30. package/dist/{index-BiBV5TQx.js → index-CnKS-BY2.js} +2644 -2323
  31. package/dist/index-CnQHDObA.js +539 -0
  32. package/dist/main.js +6 -4
  33. package/dist/{markdown-to-html-pL7ckd-m.js → markdown-to-html-Bw9L43K6.js} +1 -1
  34. package/dist/purify.es-DC1iJOxX.js +864 -0
  35. package/dist/utils/create-scribe-editor.js +3 -3
  36. package/dist/utils/html-to-markdown.js +1 -1
  37. package/dist/utils/index.js +1 -1
  38. package/dist/utils/markdown-to-html.js +2 -2
  39. package/package.json +31 -31
  40. package/dist/index-V-gN11Y9.js +0 -249
  41. package/dist/purify.es-exIQuqhb.js +0 -595
@@ -1,8 +1,8 @@
1
- import { E as i } from "../index-BiBV5TQx.js";
1
+ import { E as i } from "../index-CnKS-BY2.js";
2
2
  import { initExtensions as n } from "../components/Scribe/extension/index.js";
3
3
  import { html2md as m } from "./html-to-markdown.js";
4
- import "../markdown-to-html-pL7ckd-m.js";
5
- import "../purify.es-exIQuqhb.js";
4
+ import "../markdown-to-html-Bw9L43K6.js";
5
+ import "../purify.es-DC1iJOxX.js";
6
6
  function d({
7
7
  content: r = "",
8
8
  editable: e = !1,
@@ -1,4 +1,4 @@
1
- import { p as $ } from "../purify.es-exIQuqhb.js";
1
+ import { p as $ } from "../purify.es-DC1iJOxX.js";
2
2
  function H(e) {
3
3
  for (var t = 1; t < arguments.length; t++) {
4
4
  var r = arguments[t];
@@ -1,5 +1,5 @@
1
1
  import { html2md as o } from "./html-to-markdown.js";
2
- import { m } from "../markdown-to-html-pL7ckd-m.js";
2
+ import { m } from "../markdown-to-html-Bw9L43K6.js";
3
3
  import { isInViewport as p } from "./is-in-viewport.js";
4
4
  import { convertLegacyMathDelimiters as x } from "./convert-legacy-math-delimiters.js";
5
5
  import { createScribeEditor as c } from "./create-scribe-editor.js";
@@ -1,5 +1,5 @@
1
- import { m as t } from "../markdown-to-html-pL7ckd-m.js";
2
- import "../purify.es-exIQuqhb.js";
1
+ import { m as t } from "../markdown-to-html-Bw9L43K6.js";
2
+ import "../purify.es-DC1iJOxX.js";
3
3
  export {
4
4
  t as md2html
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clevertask/scribe",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "description": "A Radix-based Tiptap rich text editor with a Notion-style block interface for viewing and creating content. Perfect for diverse needs like notes, documents, AI chat, Markdown parsing, and comments.",
6
6
  "keywords": [
@@ -36,51 +36,51 @@
36
36
  "registry": "https://registry.npmjs.org/"
37
37
  },
38
38
  "dependencies": {
39
- "@tiptap/core": "^3.22.5",
40
- "@tiptap/extension-emoji": "^3.22.5",
41
- "@tiptap/extension-focus": "^3.22.5",
42
- "@tiptap/extension-highlight": "^3.22.5",
43
- "@tiptap/extension-image": "^3.22.5",
44
- "@tiptap/extension-link": "^3.22.5",
45
- "@tiptap/extension-mathematics": "^3.22.5",
46
- "@tiptap/extension-placeholder": "^3.22.5",
47
- "@tiptap/extension-table": "^3.22.5",
48
- "@tiptap/extension-table-cell": "^3.22.5",
49
- "@tiptap/extension-table-header": "^3.22.5",
50
- "@tiptap/extension-table-row": "^3.22.5",
51
- "@tiptap/extension-task-item": "^3.22.5",
52
- "@tiptap/extension-task-list": "^3.22.5",
53
- "@tiptap/extension-typography": "^3.22.5",
54
- "@tiptap/pm": "^3.22.5",
55
- "@tiptap/react": "^3.22.5",
56
- "@tiptap/starter-kit": "^3.22.5",
57
- "@tiptap/suggestion": "^3.22.5",
39
+ "@tiptap/core": "^3.28.0",
40
+ "@tiptap/extension-emoji": "^3.28.0",
41
+ "@tiptap/extension-focus": "^3.28.0",
42
+ "@tiptap/extension-highlight": "^3.28.0",
43
+ "@tiptap/extension-image": "^3.28.0",
44
+ "@tiptap/extension-link": "^3.28.0",
45
+ "@tiptap/extension-mathematics": "^3.28.0",
46
+ "@tiptap/extension-placeholder": "^3.28.0",
47
+ "@tiptap/extension-table": "^3.28.0",
48
+ "@tiptap/extension-table-cell": "^3.28.0",
49
+ "@tiptap/extension-table-header": "^3.28.0",
50
+ "@tiptap/extension-table-row": "^3.28.0",
51
+ "@tiptap/extension-task-item": "^3.28.0",
52
+ "@tiptap/extension-task-list": "^3.28.0",
53
+ "@tiptap/extension-typography": "^3.28.0",
54
+ "@tiptap/pm": "^3.28.0",
55
+ "@tiptap/react": "^3.28.0",
56
+ "@tiptap/starter-kit": "^3.28.0",
57
+ "@tiptap/suggestion": "^3.28.0",
58
58
  "clsx": "^2.1.1",
59
- "dompurify": "^3.4.1",
60
- "katex": "^0.16.45",
59
+ "dompurify": "^3.4.12",
60
+ "katex": "^0.16.47",
61
61
  "marked": "^17.0.6",
62
62
  "tippy.js": "^6.3.7",
63
63
  "turndown": "^7.2.4"
64
64
  },
65
65
  "devDependencies": {
66
- "@eslint/js": "^9.39.4",
66
+ "@eslint/js": "^9.39.5",
67
67
  "@radix-ui/themes": "^3.3.0",
68
68
  "@types/lodash": "^4.17.24",
69
- "@types/node": "^24.12.2",
70
- "@types/react": "^19.2.14",
69
+ "@types/node": "^24.13.3",
70
+ "@types/react": "^19.2.17",
71
71
  "@types/react-dom": "^19.2.3",
72
72
  "@types/turndown": "^5.0.6",
73
73
  "@vitejs/plugin-react": "^5.2.0",
74
- "eslint": "^9.39.4",
74
+ "eslint": "^9.39.5",
75
75
  "eslint-plugin-react-hooks": "^7.1.1",
76
- "eslint-plugin-react-refresh": "^0.5.2",
76
+ "eslint-plugin-react-refresh": "^0.5.3",
77
77
  "glob": "^13.0.6",
78
- "globals": "^17.5.0",
78
+ "globals": "^17.7.0",
79
79
  "lodash": "^4.18.1",
80
- "oxfmt": "^0.37.0",
80
+ "oxfmt": "^0.60.0",
81
81
  "typescript": "~5.9.3",
82
- "typescript-eslint": "^8.59.1",
83
- "vite": "^7.3.2",
82
+ "typescript-eslint": "^8.65.0",
83
+ "vite": "^7.3.6",
84
84
  "vite-plugin-lib-inject-css": "^2.2.2"
85
85
  },
86
86
  "peerDependencies": {
@@ -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
- };