@clevertask/scribe 0.1.0 → 0.1.2

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 (37) hide show
  1. package/README.md +60 -16
  2. package/dist/{BarMenu-BDtEfu-R.js → BarMenu-DaKIz3zZ.js} +1 -1
  3. package/dist/assets/index.css +1 -1
  4. package/dist/components/Menu/BarMenu.js +2 -2
  5. package/dist/components/Menu/BubbleMenu.js +78 -74
  6. package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
  7. package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
  8. package/dist/components/Scribe/extension/extension-link.js +1 -1
  9. package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
  10. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  11. package/dist/components/Scribe/extension/index.d.ts +17 -2
  12. package/dist/components/Scribe/extension/index.d.ts.map +1 -1
  13. package/dist/components/Scribe/extension/index.js +2655 -2580
  14. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +1616 -1618
  15. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  16. package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
  17. package/dist/components/Scribe/extension/tableOfContents.d.ts +49 -0
  18. package/dist/components/Scribe/extension/tableOfContents.d.ts.map +1 -0
  19. package/dist/components/Scribe/extension/tableOfContents.js +181 -0
  20. package/dist/components/Scribe/index.d.ts +12 -0
  21. package/dist/components/Scribe/index.d.ts.map +1 -1
  22. package/dist/components/Scribe/index.js +108 -65
  23. package/dist/{extension-link-D3eyOFkn.js → extension-link-Ch_T7WWG.js} +1 -1
  24. package/dist/{index-hHvpW2H6.js → index-BiBV5TQx.js} +1287 -1250
  25. package/dist/{index-FY_iYS6i.js → index-CqzMmrnw.js} +1 -1
  26. package/dist/{index-PJNQPLn5.js → index-DxF-1P4n.js} +196 -203
  27. package/dist/index-V-gN11Y9.js +249 -0
  28. package/dist/main.js +1 -1
  29. package/dist/{markdown-to-html-BwS08CTi.js → markdown-to-html-pL7ckd-m.js} +14 -14
  30. package/dist/purify.es-exIQuqhb.js +595 -0
  31. package/dist/utils/create-scribe-editor.js +3 -3
  32. package/dist/utils/html-to-markdown.js +226 -306
  33. package/dist/utils/index.js +1 -1
  34. package/dist/utils/markdown-to-html.js +2 -2
  35. package/package.json +30 -30
  36. package/dist/index-DZylq4Bc.js +0 -232
  37. package/dist/purify.es-BPDBzHtc.js +0 -552
@@ -1,5 +1,5 @@
1
1
  import { html2md as o } from "./html-to-markdown.js";
2
- import { m } from "../markdown-to-html-BwS08CTi.js";
2
+ import { m } from "../markdown-to-html-pL7ckd-m.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-BwS08CTi.js";
2
- import "../purify.es-BPDBzHtc.js";
1
+ import { m as t } from "../markdown-to-html-pL7ckd-m.js";
2
+ import "../purify.es-exIQuqhb.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.0",
3
+ "version": "0.1.2",
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.21.0",
40
- "@tiptap/extension-emoji": "^3.21.0",
41
- "@tiptap/extension-focus": "^3.21.0",
42
- "@tiptap/extension-highlight": "^3.21.0",
43
- "@tiptap/extension-image": "^3.21.0",
44
- "@tiptap/extension-link": "^3.21.0",
45
- "@tiptap/extension-mathematics": "^3.21.0",
46
- "@tiptap/extension-placeholder": "^3.21.0",
47
- "@tiptap/extension-table": "^3.21.0",
48
- "@tiptap/extension-table-cell": "^3.21.0",
49
- "@tiptap/extension-table-header": "^3.21.0",
50
- "@tiptap/extension-table-row": "^3.21.0",
51
- "@tiptap/extension-task-item": "^3.21.0",
52
- "@tiptap/extension-task-list": "^3.21.0",
53
- "@tiptap/extension-typography": "^3.21.0",
54
- "@tiptap/pm": "^3.21.0",
55
- "@tiptap/react": "^3.21.0",
56
- "@tiptap/starter-kit": "^3.21.0",
57
- "@tiptap/suggestion": "^3.21.0",
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",
58
58
  "clsx": "^2.1.1",
59
- "dompurify": "^3.3.3",
60
- "katex": "^0.16.44",
61
- "marked": "^17.0.5",
59
+ "dompurify": "^3.4.1",
60
+ "katex": "^0.16.45",
61
+ "marked": "^17.0.6",
62
62
  "tippy.js": "^6.3.7",
63
- "turndown": "^7.2.2"
63
+ "turndown": "^7.2.4"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@eslint/js": "^9.39.4",
67
67
  "@radix-ui/themes": "^3.3.0",
68
68
  "@types/lodash": "^4.17.24",
69
- "@types/node": "^24.12.0",
69
+ "@types/node": "^24.12.2",
70
70
  "@types/react": "^19.2.14",
71
71
  "@types/react-dom": "^19.2.3",
72
72
  "@types/turndown": "^5.0.6",
73
73
  "@vitejs/plugin-react": "^5.2.0",
74
74
  "eslint": "^9.39.4",
75
- "eslint-plugin-react-hooks": "^7.0.1",
75
+ "eslint-plugin-react-hooks": "^7.1.1",
76
76
  "eslint-plugin-react-refresh": "^0.5.2",
77
77
  "glob": "^13.0.6",
78
- "globals": "^17.4.0",
79
- "lodash": "^4.17.23",
78
+ "globals": "^17.5.0",
79
+ "lodash": "^4.18.1",
80
80
  "oxfmt": "^0.37.0",
81
81
  "typescript": "~5.9.3",
82
- "typescript-eslint": "^8.57.2",
83
- "vite": "^7.3.1",
82
+ "typescript-eslint": "^8.59.1",
83
+ "vite": "^7.3.2",
84
84
  "vite-plugin-lib-inject-css": "^2.2.2"
85
85
  },
86
86
  "peerDependencies": {
@@ -1,232 +0,0 @@
1
- import { P as T, b as G, D as H, e as J, g as Q, a as V } from "./index-hHvpW2H6.js";
2
- function W(m) {
3
- var l;
4
- const { char: h, allowSpaces: k, allowToIncludeChar: D, allowedPrefixes: _, startOfLine: K, $position: v } = m, M = k && !D, y = Q(h), O = new RegExp(`\\s${y}$`), S = K ? "^" : "", C = D ? "" : y, B = M ? new RegExp(`${S}${y}.*?(?=\\s${C}|$)`, "gm") : new RegExp(`${S}(?:^)?${y}[^\\s${C}]*`, "gm"), q = ((l = v.nodeBefore) == null ? void 0 : l.isText) && v.nodeBefore.text;
5
- if (!q)
6
- return null;
7
- const F = v.pos - q.length, u = Array.from(q.matchAll(B)).pop();
8
- if (!u || u.input === void 0 || u.index === void 0)
9
- return null;
10
- const d = u.input.slice(Math.max(0, u.index - 1), u.index), e = new RegExp(`^[${_?.join("")}\0]?$`).test(d);
11
- if (_ !== null && !e)
12
- return null;
13
- const I = F + u.index;
14
- let p = I + u[0].length;
15
- return M && O.test(q.slice(p - 1, p + 1)) && (u[0] += " ", p += 1), I < v.pos && p >= v.pos ? {
16
- range: {
17
- from: I,
18
- to: p
19
- },
20
- query: u[0].slice(h.length),
21
- text: u[0]
22
- } : null;
23
- }
24
- var X = new T("suggestion");
25
- function Y({
26
- pluginKey: m = X,
27
- editor: l,
28
- char: h = "@",
29
- allowSpaces: k = !1,
30
- allowToIncludeChar: D = !1,
31
- allowedPrefixes: _ = [" "],
32
- startOfLine: K = !1,
33
- decorationTag: v = "span",
34
- decorationClass: M = "suggestion",
35
- decorationContent: y = "",
36
- decorationEmptyClass: O = "is-empty",
37
- command: S = () => null,
38
- items: C = () => [],
39
- render: B = () => ({}),
40
- allow: q = () => !0,
41
- findSuggestionMatch: F = W,
42
- shouldShow: u
43
- }) {
44
- let d;
45
- const e = B?.(), I = () => {
46
- const n = l.state.selection.$anchor.pos, a = l.view.coordsAtPos(n), { top: r, right: c, bottom: o, left: s } = a;
47
- try {
48
- return new DOMRect(s, r, c - s, o - r);
49
- } catch {
50
- return null;
51
- }
52
- }, p = (n, a) => a ? () => {
53
- const r = m.getState(l.state), c = r?.decorationId, o = n.dom.querySelector(`[data-decoration-id="${c}"]`);
54
- return o?.getBoundingClientRect() || null;
55
- } : I;
56
- function U(n, a) {
57
- var r;
58
- try {
59
- const o = m.getState(n.state), s = o?.decorationId ? n.dom.querySelector(`[data-decoration-id="${o.decorationId}"]`) : null, g = {
60
- // @ts-ignore editor is available in closure
61
- editor: l,
62
- range: o?.range || { from: 0, to: 0 },
63
- query: o?.query || null,
64
- text: o?.text || null,
65
- items: [],
66
- command: (x) => S({ editor: l, range: o?.range || { from: 0, to: 0 }, props: x }),
67
- decorationNode: s,
68
- clientRect: p(n, s)
69
- };
70
- (r = e?.onExit) == null || r.call(e, g);
71
- } catch {
72
- }
73
- const c = n.state.tr.setMeta(a, { exit: !0 });
74
- n.dispatch(c);
75
- }
76
- const N = new G({
77
- key: m,
78
- view() {
79
- return {
80
- update: async (n, a) => {
81
- var r, c, o, s, g, x, $;
82
- const t = (r = this.key) == null ? void 0 : r.getState(a), f = (c = this.key) == null ? void 0 : c.getState(n.state), i = t.active && f.active && t.range.from !== f.range.from, P = !t.active && f.active, A = t.active && !f.active, R = !P && !A && t.query !== f.query, w = P || i && R, b = R || i, j = A || i && R;
83
- if (!w && !b && !j)
84
- return;
85
- const E = j && !w ? t : f, L = n.dom.querySelector(`[data-decoration-id="${E.decorationId}"]`);
86
- d = {
87
- editor: l,
88
- range: E.range,
89
- query: E.query,
90
- text: E.text,
91
- items: [],
92
- command: (z) => S({
93
- editor: l,
94
- range: E.range,
95
- props: z
96
- }),
97
- decorationNode: L,
98
- clientRect: p(n, L)
99
- }, w && ((o = e?.onBeforeStart) == null || o.call(e, d)), b && ((s = e?.onBeforeUpdate) == null || s.call(e, d)), (b || w) && (d.items = await C({
100
- editor: l,
101
- query: E.query
102
- })), j && ((g = e?.onExit) == null || g.call(e, d)), b && ((x = e?.onUpdate) == null || x.call(e, d)), w && (($ = e?.onStart) == null || $.call(e, d));
103
- },
104
- destroy: () => {
105
- var n;
106
- d && ((n = e?.onExit) == null || n.call(e, d));
107
- }
108
- };
109
- },
110
- state: {
111
- // Initialize the plugin's internal state.
112
- init() {
113
- return {
114
- active: !1,
115
- range: {
116
- from: 0,
117
- to: 0
118
- },
119
- query: null,
120
- text: null,
121
- composing: !1
122
- };
123
- },
124
- // Apply changes to the plugin state from a view transaction.
125
- apply(n, a, r, c) {
126
- const { isEditable: o } = l, { composing: s } = l.view, { selection: g } = n, { empty: x, from: $ } = g, t = { ...a }, f = n.getMeta(m);
127
- if (f && f.exit)
128
- return t.active = !1, t.decorationId = null, t.range = { from: 0, to: 0 }, t.query = null, t.text = null, t;
129
- if (t.composing = s, o && (x || l.view.composing)) {
130
- ($ < a.range.from || $ > a.range.to) && !s && !a.composing && (t.active = !1);
131
- const i = F({
132
- char: h,
133
- allowSpaces: k,
134
- allowToIncludeChar: D,
135
- allowedPrefixes: _,
136
- startOfLine: K,
137
- $position: g.$from
138
- }), P = `id_${Math.floor(Math.random() * 4294967295)}`;
139
- i && q({
140
- editor: l,
141
- state: c,
142
- range: i.range,
143
- isActive: a.active
144
- }) && (!u || u({
145
- editor: l,
146
- range: i.range,
147
- query: i.query,
148
- text: i.text,
149
- transaction: n
150
- })) ? (t.active = !0, t.decorationId = a.decorationId ? a.decorationId : P, t.range = i.range, t.query = i.query, t.text = i.text) : t.active = !1;
151
- } else
152
- t.active = !1;
153
- return t.active || (t.decorationId = null, t.range = { from: 0, to: 0 }, t.query = null, t.text = null), t;
154
- }
155
- },
156
- props: {
157
- // Call the keydown hook if suggestion is active.
158
- handleKeyDown(n, a) {
159
- var r, c, o, s;
160
- const { active: g, range: x } = N.getState(n.state);
161
- if (!g)
162
- return !1;
163
- if (a.key === "Escape" || a.key === "Esc") {
164
- const t = N.getState(n.state), f = (r = d?.decorationNode) != null ? r : null, i = f ?? (t?.decorationId ? n.dom.querySelector(`[data-decoration-id="${t.decorationId}"]`) : null);
165
- if (((c = e?.onKeyDown) == null ? void 0 : c.call(e, { view: n, event: a, range: t.range })) || !1)
166
- return !0;
167
- const A = {
168
- editor: l,
169
- range: t.range,
170
- query: t.query,
171
- text: t.text,
172
- items: [],
173
- command: (R) => S({ editor: l, range: t.range, props: R }),
174
- decorationNode: i,
175
- // If we have a cached decoration node, use it for the clientRect
176
- // to avoid another DOM lookup. If not, leave clientRect null and
177
- // let consumer decide if they want to query.
178
- clientRect: i ? () => i.getBoundingClientRect() || null : null
179
- };
180
- return (o = e?.onExit) == null || o.call(e, A), U(n, m), !0;
181
- }
182
- return ((s = e?.onKeyDown) == null ? void 0 : s.call(e, { view: n, event: a, range: x })) || !1;
183
- },
184
- // Setup decorator on the currently active suggestion.
185
- decorations(n) {
186
- const { active: a, range: r, decorationId: c, query: o } = N.getState(n);
187
- if (!a)
188
- return null;
189
- const s = !o?.length, g = [M];
190
- return s && g.push(O), H.create(n.doc, [
191
- J.inline(r.from, r.to, {
192
- nodeName: v,
193
- class: g.join(" "),
194
- "data-decoration-id": c,
195
- "data-decoration-content": y
196
- })
197
- ]);
198
- }
199
- }
200
- });
201
- return N;
202
- }
203
- var Z = Y;
204
- const tt = new T("slashSuggestion"), nt = V.create({
205
- name: "slashCommand",
206
- addOptions() {
207
- return {
208
- ...this.parent?.(),
209
- slashSuggestion: {
210
- char: "/",
211
- startOfLine: !0,
212
- command: ({ editor: m, range: l, props: h }) => {
213
- h.command({ editor: m, range: l, props: h });
214
- }
215
- }
216
- };
217
- },
218
- addProseMirrorPlugins() {
219
- return [
220
- Z({
221
- pluginKey: tt,
222
- ...this.options.slashSuggestion,
223
- editor: this.editor
224
- })
225
- ];
226
- }
227
- });
228
- export {
229
- nt as S,
230
- Z as i,
231
- tt as s
232
- };