@clevertask/scribe 0.1.4 → 0.1.6

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-CXaFlpRJ.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 -1023
  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.map +1 -1
  15. package/dist/components/Menu/Mobile/ListOptionBar.js +38 -44
  16. package/dist/components/Menu/linkBubbleMenuPlugin.d.ts +5 -0
  17. package/dist/components/Menu/linkBubbleMenuPlugin.d.ts.map +1 -0
  18. package/dist/components/Menu/linkBubbleMenuPlugin.js +7 -0
  19. package/dist/components/Menu/linkUrl.d.ts +2 -0
  20. package/dist/components/Menu/linkUrl.d.ts.map +1 -0
  21. package/dist/components/Menu/linkUrl.js +21 -0
  22. package/dist/components/Scribe/extension/emoji/EmojiList.js +58 -45
  23. package/dist/components/Scribe/extension/emoji/suggest.d.ts +2 -2
  24. package/dist/components/Scribe/extension/emoji/suggest.d.ts.map +1 -1
  25. package/dist/components/Scribe/extension/emoji/suggest.js +39 -43
  26. package/dist/components/Scribe/extension/extension-link.d.ts.map +1 -1
  27. package/dist/components/Scribe/extension/extension-link.js +2 -4
  28. package/dist/components/Scribe/extension/extension-markdown-paste.d.ts.map +1 -1
  29. package/dist/components/Scribe/extension/extension-markdown-paste.js +50 -45
  30. package/dist/components/Scribe/extension/extension-selectedText.d.ts.map +1 -1
  31. package/dist/components/Scribe/extension/extension-selectedText.js +10 -12
  32. package/dist/components/Scribe/extension/getPopupMountTarget.d.ts.map +1 -1
  33. package/dist/components/Scribe/extension/getPopupMountTarget.js +12 -15
  34. package/dist/components/Scribe/extension/index.d.ts +4 -4
  35. package/dist/components/Scribe/extension/index.d.ts.map +1 -1
  36. package/dist/components/Scribe/extension/index.js +2 -39521
  37. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +3369 -3731
  38. package/dist/components/Scribe/extension/slashCommand/index.js +2 -6
  39. package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
  40. package/dist/components/Scribe/extension/slashCommand/items.js +177 -176
  41. package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts.map +1 -1
  42. package/dist/components/Scribe/extension/slashCommand/renderItems.js +35 -41
  43. package/dist/components/Scribe/extension/tableOfContents.js +153 -180
  44. package/dist/components/Scribe/index.d.ts.map +1 -1
  45. package/dist/components/Scribe/index.js +113 -153
  46. package/dist/dist-BQjH-i-q.js +7016 -0
  47. package/dist/dist-CnXCIcnl.js +3506 -0
  48. package/dist/dist-Cp938P7P.js +689 -0
  49. package/dist/extension-CZOsheCI.js +56236 -0
  50. package/dist/extension-link-DZID_SYl.js +908 -0
  51. package/dist/floating-ui.dom-rih69525.js +928 -0
  52. package/dist/html-to-markdown-CrNOkSye.js +497 -0
  53. package/dist/icons/ToolbarIcons.d.ts.map +1 -1
  54. package/dist/icons/ToolbarIcons.js +76 -135
  55. package/dist/main.css +10 -0
  56. package/dist/main.js +7 -15
  57. package/dist/markdown-to-html-DEczPfuq.js +1458 -0
  58. package/dist/menus-CakIdDdY.js +633 -0
  59. package/dist/purify.es-DF9CW1cl.js +767 -0
  60. package/dist/rolldown-runtime-CtkjhSXr.js +4 -0
  61. package/dist/slashCommand-B7CRIaKG.js +429 -0
  62. package/dist/tables-CjOC70rm.js +1345 -0
  63. package/dist/tippy.esm-D9LL2xiE.js +1713 -0
  64. package/dist/utils/convert-legacy-math-delimiters.d.ts.map +1 -1
  65. package/dist/utils/convert-legacy-math-delimiters.js +7 -13
  66. package/dist/utils/create-scribe-editor.js +2 -31
  67. package/dist/utils/html-to-markdown.d.ts.map +1 -1
  68. package/dist/utils/html-to-markdown.js +2 -600
  69. package/dist/utils/index.js +24 -12
  70. package/dist/utils/is-in-viewport.d.ts.map +1 -1
  71. package/dist/utils/is-in-viewport.js +6 -6
  72. package/dist/utils/markdown-to-html.d.ts.map +1 -1
  73. package/dist/utils/markdown-to-html.js +2 -5
  74. package/dist/vite-env.d.js +0 -1
  75. package/package.json +38 -36
  76. package/dist/BarMenu-BNk2I0zi.js +0 -327
  77. package/dist/extension-link-P1rro4zO.js +0 -1059
  78. package/dist/floating-ui.dom-ZRy7FSVk.js +0 -1246
  79. package/dist/index-BMISMQrG.js +0 -855
  80. package/dist/index-ByyiiYsp.js +0 -1410
  81. package/dist/index-CnKS-BY2.js +0 -13834
  82. package/dist/index-CnQHDObA.js +0 -539
  83. package/dist/markdown-to-html-Bw9L43K6.js +0 -1135
  84. package/dist/purify.es-DC1iJOxX.js +0 -864
  85. package/dist/tippy.esm-DLHdsnfG.js +0 -1711
@@ -0,0 +1,8 @@
1
+ import { Editor } from "@tiptap/react";
2
+ import { FC } from "react";
3
+ export interface LinkBubbleMenuProps {
4
+ editor: Editor;
5
+ }
6
+ declare const LinkBubbleMenu: FC<LinkBubbleMenuProps>;
7
+ export default LinkBubbleMenu;
8
+ //# sourceMappingURL=LinkBubbleMenu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkBubbleMenu.d.ts","sourceRoot":"","sources":["../../../lib/components/Menu/LinkBubbleMenu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAkB,MAAM,eAAe,CAAC;AAKvD,OAAO,EAAE,EAAE,EAAqD,MAAM,OAAO,CAAC;AAK9E,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAID,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAyG3C,CAAC;eAEa,cAAc"}
@@ -0,0 +1,78 @@
1
+ import { i as e } from "../../dist-Cp938P7P.js";
2
+ import { getPopupMountTarget as t } from "../Scribe/extension/getPopupMountTarget.js";
3
+ import n from "./LinkEditor.js";
4
+ import { hideLinkBubbleMenu as r, linkBubbleMenuPluginKey as i } from "./linkBubbleMenuPlugin.js";
5
+ import { t as a } from "../../menus-CakIdDdY.js";
6
+ import { Box as o } from "@radix-ui/themes";
7
+ import { useCallback as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
8
+ import { jsx as f } from "react/jsx-runtime";
9
+ //#region lib/components/Menu/LinkBubbleMenu.tsx
10
+ var p = ({ editor: p }) => {
11
+ let [m, h] = d(""), g = u(null), _ = u(null), v = e({
12
+ editor: p,
13
+ selector: ({ editor: e }) => {
14
+ let { from: t, to: n } = e.state.selection;
15
+ return {
16
+ from: t,
17
+ href: e.getAttributes("link").href ?? "",
18
+ to: n
19
+ };
20
+ }
21
+ });
22
+ c(() => {
23
+ h(v.href);
24
+ }, [
25
+ v.from,
26
+ v.href,
27
+ v.to
28
+ ]), c(() => () => {
29
+ _.current !== null && window.cancelAnimationFrame(_.current);
30
+ }, []);
31
+ let y = s(() => {
32
+ if (p.isDestroyed) return;
33
+ let e = p.state.selection.to;
34
+ r(p), p.chain().setTextSelection(e).focus().run();
35
+ }, [p]), b = s(() => {
36
+ _.current !== null && window.cancelAnimationFrame(_.current), _.current = window.requestAnimationFrame(() => {
37
+ g.current?.focus(), g.current?.select(), _.current = null;
38
+ });
39
+ }, []), x = s(({ editor: e, element: t, from: n, to: r, view: i }) => {
40
+ let a = t.contains(t.ownerDocument.activeElement);
41
+ return e.isEditable && n !== r && e.isActive("link") && (i.hasFocus() || a);
42
+ }, []);
43
+ return /* @__PURE__ */ f(a, {
44
+ editor: p,
45
+ pluginKey: i,
46
+ updateDelay: 0,
47
+ appendTo: s(() => t(p), [p]),
48
+ shouldShow: x,
49
+ options: l(() => ({
50
+ strategy: "fixed",
51
+ placement: "bottom",
52
+ offset: 8,
53
+ flip: {},
54
+ shift: { padding: 8 },
55
+ inline: !0,
56
+ onShow: b
57
+ }), [b]),
58
+ children: /* @__PURE__ */ f(o, {
59
+ className: "scribe-link-popover",
60
+ role: "dialog",
61
+ "aria-label": "Edit link",
62
+ style: {
63
+ maxWidth: "calc(100vw - 32px)",
64
+ width: 320
65
+ },
66
+ children: /* @__PURE__ */ f(n, {
67
+ editor: p,
68
+ existingHref: v.href,
69
+ inputRef: g,
70
+ onClose: y,
71
+ onValueChange: h,
72
+ value: m
73
+ })
74
+ })
75
+ });
76
+ };
77
+ //#endregion
78
+ export { p as default };
@@ -0,0 +1,14 @@
1
+ import { Editor } from "@tiptap/react";
2
+ import { FC, RefObject } from "react";
3
+ export interface LinkEditorProps {
4
+ editor: Editor;
5
+ existingHref: string;
6
+ inputRef?: RefObject<HTMLInputElement | null>;
7
+ onClose: () => void;
8
+ onValueChange: (value: string) => void;
9
+ selectTextblockEndAfterSave?: boolean;
10
+ value: string;
11
+ }
12
+ declare const LinkEditor: FC<LinkEditorProps>;
13
+ export default LinkEditor;
14
+ //# sourceMappingURL=LinkEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkEditor.d.ts","sourceRoot":"","sources":["../../../lib/components/Menu/LinkEditor.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EACL,EAAE,EAGF,SAAS,EAKV,MAAM,OAAO,CAAC;AAGf,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAC9C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAkJnC,CAAC;eAEa,UAAU"}
@@ -0,0 +1,140 @@
1
+ import { normalizeLinkUrl as e } from "./linkUrl.js";
2
+ import { Box as t, Button as n, Flex as r, Text as i, TextField as a } from "@radix-ui/themes";
3
+ import { useCallback as o, useEffect as s, useId as c, useState as l } from "react";
4
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
5
+ //#region lib/components/Menu/LinkEditor.tsx
6
+ var f = ({ editor: f, existingHref: p, inputRef: m, onClose: h, onValueChange: g, selectTextblockEndAfterSave: _ = !1, value: v }) => {
7
+ let [y, b] = l(null), x = c(), S = e(v), C = o(() => {
8
+ b(null), h();
9
+ }, [h]);
10
+ s(() => {
11
+ b(null);
12
+ }, [p]);
13
+ let w = o((e) => {
14
+ b(null), g(e);
15
+ }, [g]), T = o((t) => {
16
+ t.preventDefault();
17
+ let n = e(v);
18
+ if (!n) {
19
+ b("Enter a valid web address or root-relative path.");
20
+ return;
21
+ }
22
+ let r = f.chain().focus().extendMarkRange("link").setLink({ href: n });
23
+ if (_ && r.selectTextblockEnd(), !r.run()) {
24
+ b("Scribe could not save this link.");
25
+ return;
26
+ }
27
+ C();
28
+ }, [
29
+ f,
30
+ C,
31
+ _,
32
+ v
33
+ ]), E = o(() => {
34
+ if (!f.chain().focus().extendMarkRange("link").unsetLink().run()) {
35
+ b("Scribe could not remove this link.");
36
+ return;
37
+ }
38
+ C();
39
+ }, [f, C]);
40
+ return /* @__PURE__ */ u("form", {
41
+ onKeyDown: o((e) => {
42
+ e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), C());
43
+ }, [C]),
44
+ onSubmit: T,
45
+ children: /* @__PURE__ */ d(r, {
46
+ direction: "column",
47
+ gap: "4",
48
+ children: [
49
+ /* @__PURE__ */ d(t, { children: [/* @__PURE__ */ u(i, {
50
+ as: "p",
51
+ size: "3",
52
+ weight: "medium",
53
+ children: "Link"
54
+ }), /* @__PURE__ */ u(i, {
55
+ as: "p",
56
+ size: "2",
57
+ color: "gray",
58
+ children: "Add or update a link for the current selection."
59
+ })] }),
60
+ /* @__PURE__ */ u("label", { children: /* @__PURE__ */ d(r, {
61
+ direction: "column",
62
+ gap: "2",
63
+ children: [/* @__PURE__ */ u(i, {
64
+ as: "span",
65
+ size: "2",
66
+ weight: "medium",
67
+ children: "URL"
68
+ }), /* @__PURE__ */ u(a.Root, {
69
+ ref: m,
70
+ "aria-describedby": y ? x : void 0,
71
+ "aria-invalid": !!y,
72
+ autoFocus: !m,
73
+ placeholder: "https://example.com",
74
+ value: v,
75
+ onChange: (e) => w(e.target.value)
76
+ })]
77
+ }) }),
78
+ y ? /* @__PURE__ */ u(i, {
79
+ id: x,
80
+ as: "p",
81
+ role: "alert",
82
+ size: "2",
83
+ color: "red",
84
+ children: y
85
+ }) : null,
86
+ /* @__PURE__ */ d(r, {
87
+ justify: "between",
88
+ gap: "3",
89
+ wrap: "wrap",
90
+ children: [/* @__PURE__ */ u(n, {
91
+ type: "button",
92
+ color: "red",
93
+ variant: "soft",
94
+ disabled: !p,
95
+ onClick: E,
96
+ children: "Remove link"
97
+ }), /* @__PURE__ */ d(r, {
98
+ gap: "2",
99
+ justify: "end",
100
+ style: { marginLeft: "auto" },
101
+ wrap: "wrap",
102
+ children: [
103
+ S ? /* @__PURE__ */ u(n, {
104
+ asChild: !0,
105
+ variant: "soft",
106
+ color: "gray",
107
+ children: /* @__PURE__ */ u("a", {
108
+ href: S,
109
+ target: "_blank",
110
+ rel: "noopener noreferrer",
111
+ children: "Open link"
112
+ })
113
+ }) : /* @__PURE__ */ u(n, {
114
+ type: "button",
115
+ variant: "soft",
116
+ color: "gray",
117
+ disabled: !0,
118
+ children: "Open link"
119
+ }),
120
+ /* @__PURE__ */ u(n, {
121
+ type: "button",
122
+ variant: "soft",
123
+ color: "gray",
124
+ onClick: C,
125
+ children: "Cancel"
126
+ }),
127
+ /* @__PURE__ */ u(n, {
128
+ type: "submit",
129
+ disabled: v.trim().length === 0,
130
+ children: "Save"
131
+ })
132
+ ]
133
+ })]
134
+ })
135
+ ]
136
+ })
137
+ });
138
+ };
139
+ //#endregion
140
+ export { f as default };
@@ -1 +1 @@
1
- {"version":3,"file":"ListOptionBar.d.ts","sourceRoot":"","sources":["../../../../lib/components/Menu/Mobile/ListOptionBar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAItC,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,YAAY,kBAAkB,uCAiD3D,CAAC"}
1
+ {"version":3,"file":"ListOptionBar.d.ts","sourceRoot":"","sources":["../../../../lib/components/Menu/Mobile/ListOptionBar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAItC,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,aAAa,eAAgB,kBAAkB,uCAiD3D,CAAC"}
@@ -1,45 +1,39 @@
1
- import { jsxs as l, jsx as n } from "react/jsx-runtime";
2
- import { Flex as a, Button as r } from "@radix-ui/themes";
3
- import { u } from "../../../index-BMISMQrG.js";
4
- import { useCallback as c } from "react";
5
- const p = ({ editor: e }) => {
6
- const i = u({
7
- editor: e,
8
- selector: ({ editor: t }) => t ? {
9
- isInsideList: t.isActive("bulletList") || t.isActive("orderedList"),
10
- isEditable: t.isEditable
11
- } : null
12
- }), s = c(
13
- (t, o) => {
14
- t.preventDefault(), o();
15
- },
16
- []
17
- );
18
- return !i?.isInsideList || !i.isEditable ? null : /* @__PURE__ */ l(a, { align: "center", justify: "between", className: "scribe-list-toolbar", gap: "3", children: [
19
- /* @__PURE__ */ n(
20
- r,
21
- {
22
- type: "button",
23
- size: "1",
24
- variant: "soft",
25
- color: "gray",
26
- onMouseDown: (t) => s(t, () => e.chain().focus().liftListItem("listItem").run()),
27
- children: "← Outdent"
28
- }
29
- ),
30
- /* @__PURE__ */ n(
31
- r,
32
- {
33
- type: "button",
34
- size: "1",
35
- variant: "soft",
36
- color: "gray",
37
- onMouseDown: (t) => s(t, () => e.chain().focus().sinkListItem("listItem").run()),
38
- children: "Indent →"
39
- }
40
- )
41
- ] });
42
- };
43
- export {
44
- p as ListOptionBar
1
+ import { i as e } from "../../../dist-Cp938P7P.js";
2
+ import { Button as t, Flex as n } from "@radix-ui/themes";
3
+ import { useCallback as r } from "react";
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ //#region lib/components/Menu/Mobile/ListOptionBar.tsx
6
+ var o = ({ editor: o }) => {
7
+ let s = e({
8
+ editor: o,
9
+ selector: ({ editor: e }) => e ? {
10
+ isInsideList: e.isActive("bulletList") || e.isActive("orderedList"),
11
+ isEditable: e.isEditable
12
+ } : null
13
+ }), c = r((e, t) => {
14
+ e.preventDefault(), t();
15
+ }, []);
16
+ return !s?.isInsideList || !s.isEditable ? null : /* @__PURE__ */ a(n, {
17
+ align: "center",
18
+ justify: "between",
19
+ className: "scribe-list-toolbar",
20
+ gap: "3",
21
+ children: [/* @__PURE__ */ i(t, {
22
+ type: "button",
23
+ size: "1",
24
+ variant: "soft",
25
+ color: "gray",
26
+ onMouseDown: (e) => c(e, () => o.chain().focus().liftListItem("listItem").run()),
27
+ children: "← Outdent"
28
+ }), /* @__PURE__ */ i(t, {
29
+ type: "button",
30
+ size: "1",
31
+ variant: "soft",
32
+ color: "gray",
33
+ onMouseDown: (e) => c(e, () => o.chain().focus().sinkListItem("listItem").run()),
34
+ children: "Indent →"
35
+ })]
36
+ });
45
37
  };
38
+ //#endregion
39
+ export { o as ListOptionBar };
@@ -0,0 +1,5 @@
1
+ import { PluginKey } from "@tiptap/pm/state";
2
+ import { Editor } from "@tiptap/react";
3
+ export declare const linkBubbleMenuPluginKey: PluginKey<any>;
4
+ export declare const hideLinkBubbleMenu: (editor: Editor) => void;
5
+ //# sourceMappingURL=linkBubbleMenuPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linkBubbleMenuPlugin.d.ts","sourceRoot":"","sources":["../../../lib/components/Menu/linkBubbleMenuPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,eAAO,MAAM,uBAAuB,gBAAwC,CAAC;AAE7E,eAAO,MAAM,kBAAkB,WAAY,MAAM,SAMhD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { a as e } from "../../dist-CnXCIcnl.js";
2
+ //#region lib/components/Menu/linkBubbleMenuPlugin.ts
3
+ var t = new e("scribeLinkBubbleMenu"), n = (e) => {
4
+ e.isDestroyed || e.view.dispatch(e.state.tr.setMeta(t, "hide"));
5
+ };
6
+ //#endregion
7
+ export { n as hideLinkBubbleMenu, t as linkBubbleMenuPluginKey };
@@ -0,0 +1,2 @@
1
+ export declare const normalizeLinkUrl: (value: string) => string | null;
2
+ //# sourceMappingURL=linkUrl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linkUrl.d.ts","sourceRoot":"","sources":["../../../lib/components/Menu/linkUrl.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,gBAAgB,UAAW,MAAM,KAAG,MAAM,GAAG,IA6BzD,CAAC"}
@@ -0,0 +1,21 @@
1
+ //#region lib/components/Menu/linkUrl.ts
2
+ var e = /* @__PURE__ */ new Set(["http:", "https:"]), t = /^[a-z][a-z\d+.-]*:/i, n = /^\/(?![\\/])/, r = /^(?:localhost|(?:[a-z\d-]+\.)+[a-z\d-]+|\d{1,3}(?:\.\d{1,3}){3}|\[[\da-f:]+\]):\d+(?:[/?#]|$)/i, i = /^[\\/]/, a = (e) => {
3
+ for (let t of e) {
4
+ let e = t.charCodeAt(0);
5
+ if (e <= 31 || e === 127) return !0;
6
+ }
7
+ return !1;
8
+ }, o = (o) => {
9
+ let s = o.trim();
10
+ if (!s || a(s)) return null;
11
+ if (n.test(s) && !s.includes("\\")) return s;
12
+ if (i.test(s)) return null;
13
+ try {
14
+ let n = t.test(s) && !r.test(s) ? s : `https://${s}`, i = new URL(n);
15
+ return e.has(i.protocol) ? i.href : null;
16
+ } catch {
17
+ return null;
18
+ }
19
+ };
20
+ //#endregion
21
+ export { o as normalizeLinkUrl };
@@ -1,46 +1,59 @@
1
- import { jsx as n, jsxs as i } from "react/jsx-runtime";
2
- import { Box as d, ScrollArea as u, Text as h } from "@radix-ui/themes";
3
- import { forwardRef as p, useState as f, useImperativeHandle as g } from "react";
4
- const w = p((o, c) => {
5
- const { command: l, items: e } = o, [m, s] = f(0), a = e.length === 0 ? 0 : Math.min(m, e.length - 1);
6
- return g(c, () => ({
7
- onKeyDown: (t) => {
8
- if (t.event.key === "ArrowUp")
9
- return e.length === 0 ? !1 : (s((r) => (r + e.length - 1) % e.length), !0);
10
- if (t.event.key === "ArrowDown")
11
- return e.length === 0 ? !1 : (s((r) => (r + 1) % e.length), !0);
12
- if (t.event.key === "Enter") {
13
- const r = e[a];
14
- return r && l({ name: r.name }), !0;
15
- }
16
- return !1;
17
- }
18
- }), [l, e, a]), e.length === 0 ? null : /* @__PURE__ */ n(d, { className: "scribe-popup", style: { width: 240 }, children: /* @__PURE__ */ n(u, { type: "auto", scrollbars: "vertical", style: { maxHeight: 240 }, children: /* @__PURE__ */ n("div", { className: "scribe-popup-list", children: e.map((t, r) => /* @__PURE__ */ i(
19
- "button",
20
- {
21
- type: "button",
22
- className: "scribe-popup-item",
23
- "data-selected": r === a,
24
- onClick: () => l({ name: t.name }),
25
- children: [
26
- /* @__PURE__ */ n("span", { className: "scribe-emoji-preview", "aria-hidden": "true", children: t.fallbackImage ? /* @__PURE__ */ n(
27
- "img",
28
- {
29
- alt: "",
30
- src: t.fallbackImage,
31
- style: { display: "block", height: 18, width: 18 }
32
- }
33
- ) : t.emoji }),
34
- /* @__PURE__ */ i(h, { size: "2", children: [
35
- ":",
36
- t.name,
37
- ":"
38
- ] })
39
- ]
40
- },
41
- t.name
42
- )) }) }) });
1
+ import { Box as e, ScrollArea as t, Text as n } from "@radix-ui/themes";
2
+ import { forwardRef as r, useImperativeHandle as i, useState as a } from "react";
3
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
4
+ //#region lib/components/Scribe/extension/emoji/EmojiList.tsx
5
+ var c = r((r, c) => {
6
+ let { command: l, items: u } = r, [d, f] = a(0), p = u.length === 0 ? 0 : Math.min(d, u.length - 1);
7
+ return i(c, () => ({ onKeyDown: (e) => {
8
+ if (e.event.key === "ArrowUp") return u.length === 0 ? !1 : (f((e) => (e + u.length - 1) % u.length), !0);
9
+ if (e.event.key === "ArrowDown") return u.length === 0 ? !1 : (f((e) => (e + 1) % u.length), !0);
10
+ if (e.event.key === "Enter") {
11
+ let e = u[p];
12
+ return e && l({ name: e.name }), !0;
13
+ }
14
+ return !1;
15
+ } }), [
16
+ l,
17
+ u,
18
+ p
19
+ ]), u.length === 0 ? null : /* @__PURE__ */ o(e, {
20
+ className: "scribe-popup",
21
+ style: { width: 240 },
22
+ children: /* @__PURE__ */ o(t, {
23
+ type: "auto",
24
+ scrollbars: "vertical",
25
+ style: { maxHeight: 240 },
26
+ children: /* @__PURE__ */ o("div", {
27
+ className: "scribe-popup-list",
28
+ children: u.map((e, t) => /* @__PURE__ */ s("button", {
29
+ type: "button",
30
+ className: "scribe-popup-item",
31
+ "data-selected": t === p,
32
+ onClick: () => l({ name: e.name }),
33
+ children: [/* @__PURE__ */ o("span", {
34
+ className: "scribe-emoji-preview",
35
+ "aria-hidden": "true",
36
+ children: e.fallbackImage ? /* @__PURE__ */ o("img", {
37
+ alt: "",
38
+ src: e.fallbackImage,
39
+ style: {
40
+ display: "block",
41
+ height: 18,
42
+ width: 18
43
+ }
44
+ }) : e.emoji
45
+ }), /* @__PURE__ */ s(n, {
46
+ size: "2",
47
+ children: [
48
+ ":",
49
+ e.name,
50
+ ":"
51
+ ]
52
+ })]
53
+ }, e.name))
54
+ })
55
+ })
56
+ });
43
57
  });
44
- export {
45
- w as EmojiList
46
- };
58
+ //#endregion
59
+ export { c as EmojiList };
@@ -1,4 +1,5 @@
1
- declare const _default: () => {
1
+ export default _default;
2
+ declare function _default(): {
2
3
  items: ({ editor, query }: {
3
4
  editor: any;
4
5
  query: any;
@@ -11,5 +12,4 @@ declare const _default: () => {
11
12
  onExit(): void;
12
13
  };
13
14
  };
14
- export default _default;
15
15
  //# sourceMappingURL=suggest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../../../../lib/components/Scribe/extension/emoji/suggest.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAMA,wBAuEG"}
1
+ {"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../../../../lib/components/Scribe/extension/emoji/suggest.ts"],"names":[],"mappings":""}
@@ -1,44 +1,40 @@
1
- import { t as i } from "../../../../tippy.esm-DLHdsnfG.js";
2
- import { R as a } from "../../../../index-BMISMQrG.js";
3
- import { getPopupMountTarget as s } from "../getPopupMountTarget.js";
4
- import { EmojiList as c } from "./EmojiList.js";
5
- const u = () => ({
6
- items: ({ editor: r, query: t }) => r.storage.emoji.emojis.filter(({ shortcodes: e, tags: o }) => e.find((n) => n.startsWith(t.toLowerCase())) || o.find((n) => n.startsWith(t.toLowerCase()))).slice(0, 5),
7
- allowSpaces: !1,
8
- render: () => {
9
- let r, t = null;
10
- return {
11
- onStart: (e) => {
12
- e.clientRect && (r = new a(c, {
13
- props: e,
14
- editor: e.editor
15
- }), t = i(e.editor.view.dom, {
16
- getReferenceClientRect: e.clientRect,
17
- appendTo: s(e.editor),
18
- content: r.element,
19
- popperOptions: {
20
- strategy: "fixed"
21
- },
22
- showOnCreate: !0,
23
- interactive: !0,
24
- trigger: "manual",
25
- placement: "bottom-start"
26
- }));
27
- },
28
- onUpdate(e) {
29
- !r || !t || !e.clientRect || (r.updateProps(e), t.setProps({
30
- getReferenceClientRect: e.clientRect
31
- }));
32
- },
33
- onKeyDown(e) {
34
- return e.event.key === "Escape" && t ? (t.hide(), !0) : r?.ref?.onKeyDown(e) ?? !1;
35
- },
36
- onExit() {
37
- t?.destroy(), r?.destroy();
38
- }
39
- };
40
- }
1
+ import { n as e } from "../../../../dist-Cp938P7P.js";
2
+ import { getPopupMountTarget as t } from "../getPopupMountTarget.js";
3
+ import { t as n } from "../../../../tippy.esm-D9LL2xiE.js";
4
+ import { EmojiList as r } from "./EmojiList.js";
5
+ //#region lib/components/Scribe/extension/emoji/suggest.ts
6
+ var i = () => ({
7
+ items: ({ editor: e, query: t }) => e.storage.emoji.emojis.filter(({ shortcodes: e, tags: n }) => e.find((e) => e.startsWith(t.toLowerCase())) || n.find((e) => e.startsWith(t.toLowerCase()))).slice(0, 5),
8
+ allowSpaces: !1,
9
+ render: () => {
10
+ let i, a = null;
11
+ return {
12
+ onStart: (o) => {
13
+ o.clientRect && (i = new e(r, {
14
+ props: o,
15
+ editor: o.editor
16
+ }), a = n(o.editor.view.dom, {
17
+ getReferenceClientRect: o.clientRect,
18
+ appendTo: t(o.editor),
19
+ content: i.element,
20
+ popperOptions: { strategy: "fixed" },
21
+ showOnCreate: !0,
22
+ interactive: !0,
23
+ trigger: "manual",
24
+ placement: "bottom-start"
25
+ }));
26
+ },
27
+ onUpdate(e) {
28
+ !i || !a || !e.clientRect || (i.updateProps(e), a.setProps({ getReferenceClientRect: e.clientRect }));
29
+ },
30
+ onKeyDown(e) {
31
+ return e.event.key === "Escape" && a ? (a.hide(), !0) : i?.ref?.onKeyDown(e) ?? !1;
32
+ },
33
+ onExit() {
34
+ a?.destroy(), i?.destroy();
35
+ }
36
+ };
37
+ }
41
38
  });
42
- export {
43
- u as default
44
- };
39
+ //#endregion
40
+ export { i as default };
@@ -1 +1 @@
1
- {"version":3,"file":"extension-link.d.ts","sourceRoot":"","sources":["../../../../lib/components/Scribe/extension/extension-link.ts"],"names":[],"mappings":";AAEA,wBAyCG"}
1
+ {"version":3,"file":"extension-link.d.ts","sourceRoot":"","sources":["../../../../lib/components/Scribe/extension/extension-link.ts"],"names":[],"mappings":""}
@@ -1,4 +1,2 @@
1
- import { a as f } from "../../../extension-link-P1rro4zO.js";
2
- export {
3
- f as default
4
- };
1
+ import { t as e } from "../../../extension-link-DZID_SYl.js";
2
+ export { e as default };
@@ -1 +1 @@
1
- {"version":3,"file":"extension-markdown-paste.d.ts","sourceRoot":"","sources":["../../../../lib/components/Scribe/extension/extension-markdown-paste.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;;AA+GzC,wBA6BG"}
1
+ {"version":3,"file":"extension-markdown-paste.d.ts","sourceRoot":"","sources":["../../../../lib/components/Scribe/extension/extension-markdown-paste.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}