@clevertask/scribe 0.1.10 → 0.1.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 (66) hide show
  1. package/README.md +11 -1
  2. package/dist/{BarMenu-5S2vKAtc.js → BarMenu-5M9g9Y1j.js} +7 -5
  3. package/dist/components/Menu/BarMenu.js +1 -1
  4. package/dist/components/Menu/BubbleMenu.js +2 -2
  5. package/dist/components/Menu/CalloutBubbleMenu.d.ts +7 -0
  6. package/dist/components/Menu/CalloutBubbleMenu.d.ts.map +1 -0
  7. package/dist/components/Menu/CalloutBubbleMenu.js +156 -0
  8. package/dist/components/Menu/LinkBubbleMenu.js +2 -2
  9. package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
  10. package/dist/components/Menu/TableBubbleMenu.d.ts +8 -0
  11. package/dist/components/Menu/TableBubbleMenu.d.ts.map +1 -0
  12. package/dist/components/Menu/TableBubbleMenu.js +306 -0
  13. package/dist/components/Menu/calloutBubbleMenuPlugin.d.ts +10 -0
  14. package/dist/components/Menu/calloutBubbleMenuPlugin.d.ts.map +1 -0
  15. package/dist/components/Menu/calloutBubbleMenuPlugin.js +22 -0
  16. package/dist/components/Menu/contextualMenuOwner.d.ts +4 -0
  17. package/dist/components/Menu/contextualMenuOwner.d.ts.map +1 -0
  18. package/dist/components/Menu/contextualMenuOwner.js +9 -0
  19. package/dist/components/Menu/tableBubbleMenuPlugin.d.ts +11 -0
  20. package/dist/components/Menu/tableBubbleMenuPlugin.d.ts.map +1 -0
  21. package/dist/components/Menu/tableBubbleMenuPlugin.js +22 -0
  22. package/dist/components/Scribe/extension/callout.d.ts +32 -0
  23. package/dist/components/Scribe/extension/callout.d.ts.map +1 -0
  24. package/dist/components/Scribe/extension/callout.js +118 -0
  25. package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
  26. package/dist/components/Scribe/extension/extension-link.js +1 -1
  27. package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
  28. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  29. package/dist/components/Scribe/extension/index.d.ts +1 -1
  30. package/dist/components/Scribe/extension/index.d.ts.map +1 -1
  31. package/dist/components/Scribe/extension/index.js +1 -1
  32. package/dist/components/Scribe/extension/resizable-table.d.ts +8 -0
  33. package/dist/components/Scribe/extension/resizable-table.d.ts.map +1 -0
  34. package/dist/components/Scribe/extension/resizable-table.js +2 -0
  35. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +1390 -1390
  36. package/dist/components/Scribe/extension/slashCommand/index.js +1 -1
  37. package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
  38. package/dist/components/Scribe/extension/slashCommand/items.js +73 -26
  39. package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
  40. package/dist/components/Scribe/extension/tableOfContents.js +1 -1
  41. package/dist/components/Scribe/index.d.ts +2 -1
  42. package/dist/components/Scribe/index.d.ts.map +1 -1
  43. package/dist/components/Scribe/index.js +140 -133
  44. package/dist/{dist-DErUltkU.js → dist-DFua_Xbu.js} +37 -31
  45. package/dist/{dist-wYqYXEOz.js → dist-Dw4STOPE.js} +1 -1
  46. package/dist/{extension-6I5t1ZxQ.js → extension-_8uh0Ik9.js} +1323 -1780
  47. package/dist/{extension-link-DJy7XDoj.js → extension-link-CjfUZ90W.js} +1 -1
  48. package/dist/{html-to-markdown-Cta7-ssO.js → html-to-markdown-C920nQtn.js} +155 -56
  49. package/dist/icons/CalloutIcon.d.ts +9 -0
  50. package/dist/icons/CalloutIcon.d.ts.map +1 -0
  51. package/dist/icons/CalloutIcon.js +72 -0
  52. package/dist/main.css +170 -1
  53. package/dist/main.d.ts +1 -0
  54. package/dist/main.d.ts.map +1 -1
  55. package/dist/main.js +9 -8
  56. package/dist/{markdown-to-html-DwSNqq2i.js → markdown-to-html-CW0Nb9Ye.js} +103 -60
  57. package/dist/{menus-m_EkiaUN.js → menus-_EXlLMjz.js} +2 -2
  58. package/dist/{purify.es-CFiLaBu1.js → purify.es-BES4pJF7.js} +267 -260
  59. package/dist/resizable-table-Ddw3l6DJ.js +489 -0
  60. package/dist/{slashCommand-DuSH9sXJ.js → slashCommand-CxX07Nbk.js} +24 -22
  61. package/dist/utils/html-to-markdown.d.ts.map +1 -1
  62. package/dist/utils/html-to-markdown.js +1 -1
  63. package/dist/utils/index.js +4 -4
  64. package/dist/utils/markdown-to-html.d.ts.map +1 -1
  65. package/dist/utils/markdown-to-html.js +1 -1
  66. package/package.json +47 -24
@@ -0,0 +1,22 @@
1
+ import { NodeSelection as e, PluginKey as t } from "@tiptap/pm/state";
2
+ //#region lib/components/Menu/tableBubbleMenuPlugin.ts
3
+ var n = new t("scribeTableBubbleMenu"), r = (e) => {
4
+ for (let t = e.depth; t > 0; --t) {
5
+ let n = e.node(t);
6
+ if (n.type.name === "table") return {
7
+ node: n,
8
+ position: e.before(t)
9
+ };
10
+ }
11
+ return null;
12
+ }, i = (t) => {
13
+ let { selection: n } = t;
14
+ if (n instanceof e && n.node.type.name === "table") return {
15
+ node: n.node,
16
+ position: n.from
17
+ };
18
+ let i = r(n.$from), a = r(n.$to);
19
+ return !i || !a || i.position !== a.position ? null : i;
20
+ };
21
+ //#endregion
22
+ export { i as getSelectionTableContext, n as tableBubbleMenuPluginKey };
@@ -0,0 +1,32 @@
1
+ import { Node } from "@tiptap/core";
2
+ export declare const CALLOUT_VARIANTS: readonly ["info", "tip", "warning", "caution"];
3
+ export type CalloutVariant = (typeof CALLOUT_VARIANTS)[number];
4
+ export declare const DEFAULT_CALLOUT_VARIANT: CalloutVariant;
5
+ export declare const CALLOUT_VARIANT_LABELS: {
6
+ readonly info: "Info";
7
+ readonly tip: "Tip";
8
+ readonly warning: "Warning";
9
+ readonly caution: "Caution";
10
+ };
11
+ export interface CalloutOptions {
12
+ HTMLAttributes: Record<string, unknown>;
13
+ }
14
+ declare module "@tiptap/core" {
15
+ interface Commands<ReturnType> {
16
+ callout: {
17
+ /** Wrap the selected block or blocks in a callout. */
18
+ insertCallout: (variant?: CalloutVariant) => ReturnType;
19
+ /** Change the semantic variant of the selected callout. */
20
+ setCalloutVariant: (variant: CalloutVariant) => ReturnType;
21
+ /** Wrap the selection in a callout, or unwrap an active callout. */
22
+ toggleCallout: (variant?: CalloutVariant) => ReturnType;
23
+ /** Lift the selected block or blocks out of their callout. */
24
+ unsetCallout: () => ReturnType;
25
+ };
26
+ }
27
+ }
28
+ export declare const isCalloutVariant: (value: unknown) => value is CalloutVariant;
29
+ /** A persistent, semantic heads-up block for document content. */
30
+ export declare const Callout: Node<CalloutOptions, any>;
31
+ export default Callout;
32
+ //# sourceMappingURL=callout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callout.d.ts","sourceRoot":"","sources":["../../../../lib/components/Scribe/extension/callout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,IAAI,EAAE,MAAM,cAAc,CAAC;AAKnE,eAAO,MAAM,gBAAgB,YAAI,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,CAAU,CAAC;AAE/E,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,eAAO,MAAM,uBAAuB,EAAE,cAAuB,CAAC;AAE9D,eAAO,MAAM,sBAAsB;mBAC3B,MAAM;kBACP,KAAK;sBACD,SAAS;sBACT,SAAS;CAC+B,CAAC;AAEpD,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAED,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,OAAO,EAAE;YACP,sDAAsD;YACtD,aAAa,EAAE,CAAC,OAAO,CAAC,EAAE,cAAc,KAAK,UAAU,CAAC;YACxD,2DAA2D;YAC3D,iBAAiB,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,UAAU,CAAC;YAC3D,oEAAoE;YACpE,aAAa,EAAE,CAAC,OAAO,CAAC,EAAE,cAAc,KAAK,UAAU,CAAC;YACxD,8DAA8D;YAC9D,YAAY,EAAE,MAAM,UAAU,CAAC;SAChC,CAAC;KACH;CACF;AAED,eAAO,MAAM,gBAAgB,UAAW,OAAO,KAAG,KAAK,IAAI,cACyB,CAAC;AAkHrF,kEAAkE;AAClE,eAAO,MAAM,OAAO,2BA0GlB,CAAC;eAEY,OAAO"}
@@ -0,0 +1,118 @@
1
+ import { D as e, N as t, a as n } from "../../../dist-DFua_Xbu.js";
2
+ import { TextSelection as r } from "@tiptap/pm/state";
3
+ //#region lib/components/Scribe/extension/callout.ts
4
+ var i = [
5
+ "info",
6
+ "tip",
7
+ "warning",
8
+ "caution"
9
+ ], a = "info", o = {
10
+ info: "Info",
11
+ tip: "Tip",
12
+ warning: "Warning",
13
+ caution: "Caution"
14
+ }, s = (e) => typeof e == "string" && i.some((t) => t === e), c = (e) => s(e) ? e : a, l = (e) => {
15
+ if (!s(e)) throw RangeError(`Invalid callout variant: ${String(e)}`);
16
+ }, u = (e, t) => {
17
+ let { selection: n } = e.state;
18
+ if (!n.empty || n.$from.parentOffset !== 0) return !1;
19
+ let { $from: i } = n, a = i.depth - 1;
20
+ if (a < 0) return !1;
21
+ let o = i.node(a), s = i.index(a);
22
+ if (s === 0) return !1;
23
+ if (o.type === t) return e.commands.lift(t.name);
24
+ let c = o.child(s - 1);
25
+ if (c.type !== t || !c.lastChild?.isTextblock) return !1;
26
+ let l = i.before(), u = l - 2, { tr: d } = e.state;
27
+ return d.delete(l, i.after()).insert(u, i.parent.content), d.setSelection(r.create(d.doc, u)), e.view.dispatch(d.scrollIntoView()), !0;
28
+ }, d = (e, t) => {
29
+ let { selection: n, tr: i } = e.state;
30
+ if (!n.empty) return !1;
31
+ let { $from: a } = n, o = e.schema.nodes.paragraph;
32
+ if (!o || a.parent.type !== o || a.parent.content.size) return !1;
33
+ let s;
34
+ for (let e = a.depth - 1; e > 0; --e) if (a.node(e).type === t) {
35
+ s = e;
36
+ break;
37
+ }
38
+ if (s === void 0) return !1;
39
+ let c = a.node(s), l = a.index(s);
40
+ if (c.childCount < 2 || l !== c.childCount - 1) return !1;
41
+ let u = s - 1, d = a.node(u), f = a.index(u), p = d.maybeChild(f + 1);
42
+ if (p?.type !== o || p.content.size) return !1;
43
+ let m = a.after(s) + 1;
44
+ return i.delete(a.before(), a.after()), i.setSelection(r.create(i.doc, i.mapping.map(m))), e.view.dispatch(i.scrollIntoView()), !0;
45
+ }, f = n.create({
46
+ name: "callout",
47
+ group: "block",
48
+ content: "block+",
49
+ defining: !0,
50
+ addOptions() {
51
+ return { HTMLAttributes: {} };
52
+ },
53
+ addAttributes() {
54
+ return { variant: {
55
+ default: a,
56
+ validate: l,
57
+ parseHTML: (e) => c(e.getAttribute("data-variant")),
58
+ renderHTML: ({ variant: e }) => ({ "data-variant": c(e) })
59
+ } };
60
+ },
61
+ parseHTML() {
62
+ return [{
63
+ tag: "aside[data-type=\"callout\"]",
64
+ contentElement: (e) => {
65
+ let t = Array.from(e.children).find((e) => e.hasAttribute("data-callout-content"));
66
+ return t instanceof HTMLElement ? t : e;
67
+ }
68
+ }];
69
+ },
70
+ renderHTML({ HTMLAttributes: e }) {
71
+ let n = c(e["data-variant"]);
72
+ return [
73
+ "aside",
74
+ t(this.options.HTMLAttributes, e, {
75
+ "data-type": this.name,
76
+ "data-variant": n,
77
+ role: "note"
78
+ }),
79
+ [
80
+ "div",
81
+ {
82
+ "data-callout-header": "",
83
+ contenteditable: "false"
84
+ },
85
+ ["span", {
86
+ "aria-hidden": "true",
87
+ "data-callout-icon": ""
88
+ }],
89
+ [
90
+ "span",
91
+ { "data-callout-label": "" },
92
+ o[n]
93
+ ]
94
+ ],
95
+ [
96
+ "div",
97
+ { "data-callout-content": "" },
98
+ 0
99
+ ]
100
+ ];
101
+ },
102
+ addCommands() {
103
+ return {
104
+ insertCallout: (e = a) => ({ commands: t }) => s(e) && t.wrapIn(this.name, { variant: e }),
105
+ setCalloutVariant: (e) => ({ commands: t }) => s(e) && t.updateAttributes(this.name, { variant: e }),
106
+ toggleCallout: (t = a) => ({ commands: n, state: r }) => s(t) ? e(r, this.type) ? n.lift(this.name) : n.wrapIn(this.name, { variant: t }) : !1,
107
+ unsetCallout: () => ({ commands: e }) => e.lift(this.name)
108
+ };
109
+ },
110
+ addKeyboardShortcuts() {
111
+ return {
112
+ Backspace: () => u(this.editor, this.type),
113
+ Enter: () => d(this.editor, this.type)
114
+ };
115
+ }
116
+ });
117
+ //#endregion
118
+ export { i as CALLOUT_VARIANTS, o as CALLOUT_VARIANT_LABELS, f as Callout, f as default, a as DEFAULT_CALLOUT_VARIANT, s as isCalloutVariant };
@@ -1,4 +1,4 @@
1
- import { n as e } from "../../../../dist-wYqYXEOz.js";
1
+ import { n as e } from "../../../../dist-Dw4STOPE.js";
2
2
  import { getPopupMountTarget as t } from "../getPopupMountTarget.js";
3
3
  import { t as n } from "../../../../tippy.esm-DOXqN1Qm.js";
4
4
  import { EmojiList as r } from "./EmojiList.js";
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../../extension-link-DJy7XDoj.js";
1
+ import { t as e } from "../../../extension-link-CjfUZ90W.js";
2
2
  export { e as default };
@@ -1,5 +1,5 @@
1
- import { n as e } from "../../../dist-DErUltkU.js";
2
- import { n as t, t as n } from "../../../markdown-to-html-DwSNqq2i.js";
1
+ import { n as e } from "../../../dist-DFua_Xbu.js";
2
+ import { n as t, t as n } from "../../../markdown-to-html-CW0Nb9Ye.js";
3
3
  import { Plugin as r, PluginKey as i } from "@tiptap/pm/state";
4
4
  //#region lib/components/Scribe/extension/extension-markdown-paste.ts
5
5
  var a = new i("markdownPaste"), o = /* @__PURE__ */ new Set([
@@ -1,4 +1,4 @@
1
- import { n as e } from "../../../dist-DErUltkU.js";
1
+ import { n as e } from "../../../dist-DFua_Xbu.js";
2
2
  //#region lib/components/Scribe/extension/extension-selectedText.ts
3
3
  var t = e.create({
4
4
  name: "SelectedText",
@@ -16,5 +16,5 @@ export declare const initExtensions: (props: ScribeProps) => (import("@tiptap/co
16
16
  updateScrollParent: () => void;
17
17
  }> | import("@tiptap/core").Extension<{
18
18
  slashSuggestion: Partial<import("@tiptap/suggestion").SuggestionOptions<import("./slashCommand").SuggestionItem, import("./slashCommand").SuggestionItem>>;
19
- }, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-typography").TypographyOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-emoji").EmojiOptions, import("@tiptap/extension-emoji").EmojiStorage> | import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-task-item").TaskItemOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-task-list").TaskListOptions, any>)[];
19
+ }, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-typography").TypographyOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any> | import("@tiptap/core").Node<import("./callout").CalloutOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-emoji").EmojiOptions, import("@tiptap/extension-emoji").EmojiStorage> | import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-table").TableOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-task-item").TaskItemOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-task-list").TaskListOptions, any>)[];
20
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/components/Scribe/extension/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAqBtC,eAAO,MAAM,cAAc,UAAW,WAAW;;;;;;;;;;;;;;;;;i1BAyFhD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/components/Scribe/extension/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAuBtC,eAAO,MAAM,cAAc,UAAW,WAAW;;;;;;;;;;;;;;;;;2+BAyFhD,CAAC"}
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../../extension-6I5t1ZxQ.js";
1
+ import { t as e } from "../../../extension-_8uh0Ik9.js";
2
2
  export { e as initExtensions };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Tiptap only registers its column-resizing plugin when the editor is editable
3
+ * during extension initialization. Scribe can become editable after mount, so
4
+ * register the plugin for the editor lifetime and let its event handlers honor
5
+ * the current `view.editable` value.
6
+ */
7
+ export declare const ScribeTable: import("@tiptap/core").Node<import("@tiptap/extension-table").TableOptions, any>;
8
+ //# sourceMappingURL=resizable-table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resizable-table.d.ts","sourceRoot":"","sources":["../../../../lib/components/Scribe/extension/resizable-table.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,WAAW,kFAoCtB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../../resizable-table-Ddw3l6DJ.js";
2
+ export { e as ScribeTable };