@devalok/shilp-sutra 0.6.1 → 0.7.0
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.
- package/dist/_virtual/client.js +5 -0
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/react-dom-client.development.js +5 -0
- package/dist/_virtual/react-dom-client.production.js +5 -0
- package/dist/_virtual/scheduler.development.js +5 -0
- package/dist/_virtual/scheduler.production.js +5 -0
- package/dist/_virtual/shilp-sutra.js +5 -0
- package/dist/_virtual/shilp-sutra2.js +5 -0
- package/dist/composed/confirm-dialog.d.ts +27 -0
- package/dist/composed/confirm-dialog.d.ts.map +1 -0
- package/dist/composed/confirm-dialog.js +45 -0
- package/dist/composed/extensions/emoji-suggestion.d.ts +8 -0
- package/dist/composed/extensions/emoji-suggestion.d.ts.map +1 -0
- package/dist/composed/extensions/emoji-suggestion.js +119 -0
- package/dist/composed/extensions/file-attachment.d.ts +3 -0
- package/dist/composed/extensions/file-attachment.d.ts.map +1 -0
- package/dist/composed/extensions/file-attachment.js +55 -0
- package/dist/composed/extensions/mention-suggestion.d.ts +10 -0
- package/dist/composed/extensions/mention-suggestion.d.ts.map +1 -0
- package/dist/composed/extensions/mention-suggestion.js +79 -0
- package/dist/composed/index.d.ts +3 -1
- package/dist/composed/index.d.ts.map +1 -1
- package/dist/composed/index.js +28 -26
- package/dist/composed/rich-text-editor.d.ts +19 -0
- package/dist/composed/rich-text-editor.d.ts.map +1 -1
- package/dist/composed/rich-text-editor.js +320 -161
- package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/cjs/react-dom-client.development.js +17062 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/cjs/react-dom-client.production.js +9790 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/client.js +20 -0
- package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler.development.js +237 -0
- package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler.production.js +234 -0
- package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/index.js +11 -0
- package/dist/primitives/_internal/react-arrow.js +8 -19
- package/dist/primitives/_internal/react-compose-refs.js +14 -14
- package/dist/primitives/_internal/react-context.js +41 -39
- package/dist/primitives/_internal/react-dismissable-layer.js +62 -90
- package/dist/primitives/_internal/react-popper.js +107 -169
- package/dist/primitives/_internal/react-portal.js +1 -1
- package/dist/primitives/_internal/react-primitive.js +1 -1
- package/dist/primitives/_internal/react-use-size.js +8 -8
- package/dist/primitives/react-slot.js +12 -12
- package/dist/shell/app-command-palette.d.ts +3 -1
- package/dist/shell/app-command-palette.d.ts.map +1 -1
- package/dist/shell/app-command-palette.js +35 -34
- package/dist/shell/bottom-navbar.d.ts.map +1 -1
- package/dist/shell/bottom-navbar.js +31 -31
- package/dist/shell/index.d.ts +1 -1
- package/dist/shell/index.d.ts.map +1 -1
- package/dist/shell/notification-center.d.ts +10 -0
- package/dist/shell/notification-center.d.ts.map +1 -1
- package/dist/shell/notification-center.js +129 -117
- package/dist/shell/top-bar.d.ts +20 -0
- package/dist/shell/top-bar.d.ts.map +1 -1
- package/dist/shell/top-bar.js +100 -70
- package/dist/tailwind/index.cjs +1 -0
- package/dist/tailwind/preset.d.ts.map +1 -1
- package/dist/tailwind/preset.js +1 -0
- package/dist/tokens/semantic.css +7 -0
- package/dist/ui/alert.js +42 -63
- package/dist/ui/avatar.js +20 -62
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/badge.d.ts.map +1 -1
- package/dist/ui/badge.js +88 -112
- package/dist/ui/button-group.js +14 -29
- package/dist/ui/button.js +64 -108
- package/dist/ui/card.js +18 -62
- package/dist/ui/checkbox.js +1 -21
- package/dist/ui/color-input.d.ts +17 -0
- package/dist/ui/color-input.d.ts.map +1 -0
- package/dist/ui/color-input.js +87 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +314 -312
- package/dist/ui/input.js +25 -51
- package/dist/ui/label.js +1 -15
- package/dist/ui/popover.js +6 -6
- package/dist/ui/separator.js +4 -19
- package/dist/ui/spinner.js +1 -36
- package/dist/ui/switch.js +1 -20
- package/dist/ui/tabs.js +20 -47
- package/dist/ui/tooltip.js +6 -17
- package/llms-full.txt +1861 -0
- package/llms.txt +183 -0
- package/package.json +71 -5
|
@@ -1,225 +1,384 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import * as
|
|
4
|
-
import { useEditor as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
2
|
+
import { jsxs as k, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import * as c from "react";
|
|
4
|
+
import { useEditor as E, EditorContent as H } from "@tiptap/react";
|
|
5
|
+
import B from "@tiptap/starter-kit";
|
|
6
|
+
import G from "@tiptap/extension-placeholder";
|
|
7
|
+
import P from "@tiptap/extension-underline";
|
|
8
|
+
import M from "@tiptap/extension-highlight";
|
|
9
|
+
import j from "@tiptap/extension-task-list";
|
|
10
|
+
import z from "@tiptap/extension-task-item";
|
|
11
|
+
import D from "@tiptap/extension-text-align";
|
|
12
|
+
import q from "@tiptap/extension-link";
|
|
13
|
+
import U from "@tiptap/extension-image";
|
|
14
|
+
import O from "@tiptap/extension-mention";
|
|
15
|
+
import { FileAttachment as K } from "./extensions/file-attachment.js";
|
|
16
|
+
import { createSuggestionRenderer as J } from "./extensions/mention-suggestion.js";
|
|
17
|
+
import { EmojiSuggestion as Q } from "./extensions/emoji-suggestion.js";
|
|
18
|
+
import { useColorMode as X } from "../hooks/use-color-mode.js";
|
|
19
|
+
import { cn as w } from "../ui/lib/utils.js";
|
|
20
|
+
import { IconBold as Y, IconItalic as Z, IconUnderline as $, IconStrikethrough as F, IconHighlight as ee, IconH2 as te, IconH3 as ie, IconBlockquote as se, IconList as re, IconListNumbers as ne, IconListCheck as oe, IconCode as ce, IconPhoto as le, IconPaperclip as ae, IconLineDashed as ue, IconAlignLeft as de, IconAlignCenter as me, IconAlignRight as fe, IconMoodSmile as he, IconArrowBackUp as ge, IconArrowForwardUp as pe, IconLink as ke } from "@tabler/icons-react";
|
|
21
|
+
const V = [
|
|
22
|
+
"prose prose-sm max-w-none",
|
|
23
|
+
"font-body text-ds-md leading-relaxed text-text-primary",
|
|
24
|
+
"[&_h2]:text-ds-xl [&_h2]:mb-ds-03 [&_h2]:mt-ds-05 [&_h2]:text-text-primary",
|
|
25
|
+
"[&_h3]:text-ds-base [&_h3]:font-semibold [&_h3]:mb-ds-02b [&_h3]:mt-ds-04 [&_h3]:text-text-primary",
|
|
26
|
+
"[&_p]:mb-ds-02b [&_p]:text-text-secondary",
|
|
27
|
+
"[&_ul]:ml-ds-05 [&_ul]:list-disc [&_ol]:ml-ds-05 [&_ol]:list-decimal",
|
|
28
|
+
"[&_li]:text-text-secondary",
|
|
29
|
+
"[&_code]:rounded [&_code]:bg-layer-02 [&_code]:px-ds-02b [&_code]:py-ds-01 [&_code]:text-ds-md [&_code]:text-interactive",
|
|
30
|
+
"[&_pre]:rounded-ds-lg [&_pre]:bg-layer-02 [&_pre]:p-ds-04",
|
|
31
|
+
"[&_strong]:font-semibold [&_strong]:text-text-primary",
|
|
32
|
+
"[&_blockquote]:border-l-[3px] [&_blockquote]:border-interactive/30 [&_blockquote]:pl-ds-04 [&_blockquote]:italic [&_blockquote]:text-text-placeholder",
|
|
33
|
+
"[&_mark]:rounded-sm [&_mark]:bg-warning/20 [&_mark]:px-[2px]",
|
|
34
|
+
'[&_ul[data-type="taskList"]]:ml-0 [&_ul[data-type="taskList"]]:list-none [&_li[data-type="taskItem"]]:flex [&_li[data-type="taskItem"]]:items-start [&_li[data-type="taskItem"]]:gap-ds-02',
|
|
35
|
+
"[&_hr]:my-ds-04 [&_hr]:border-border",
|
|
36
|
+
"[&_a]:text-interactive [&_a]:underline [&_a]:decoration-interactive/40 hover:[&_a]:decoration-interactive",
|
|
37
|
+
"[&_img]:max-w-full [&_img]:rounded-ds-md [&_img]:my-ds-03",
|
|
38
|
+
"[&_.mention]:rounded-ds-sm [&_.mention]:bg-interactive/10 [&_.mention]:px-ds-02 [&_.mention]:py-[1px] [&_.mention]:font-medium [&_.mention]:text-interactive"
|
|
39
|
+
];
|
|
9
40
|
function s({
|
|
10
41
|
onClick: t,
|
|
11
42
|
isActive: o = !1,
|
|
12
|
-
disabled:
|
|
13
|
-
title:
|
|
14
|
-
children:
|
|
43
|
+
disabled: a = !1,
|
|
44
|
+
title: l,
|
|
45
|
+
children: u
|
|
15
46
|
}) {
|
|
16
47
|
return /* @__PURE__ */ e(
|
|
17
48
|
"button",
|
|
18
49
|
{
|
|
19
50
|
type: "button",
|
|
20
51
|
onClick: t,
|
|
21
|
-
disabled:
|
|
22
|
-
title:
|
|
23
|
-
|
|
52
|
+
disabled: a,
|
|
53
|
+
title: l,
|
|
54
|
+
"aria-pressed": o,
|
|
55
|
+
className: w(
|
|
24
56
|
"inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md transition-colors",
|
|
25
57
|
"hover:bg-field",
|
|
26
58
|
"disabled:pointer-events-none disabled:opacity-[0.38]",
|
|
27
59
|
o ? "bg-field text-interactive" : "text-text-placeholder"
|
|
28
60
|
),
|
|
29
|
-
children:
|
|
61
|
+
children: u
|
|
30
62
|
}
|
|
31
63
|
);
|
|
32
64
|
}
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
/* @__PURE__ */ e(
|
|
54
|
-
s,
|
|
55
|
-
{
|
|
56
|
-
onClick: () => t.chain().focus().toggleStrike().run(),
|
|
57
|
-
isActive: t.isActive("strike"),
|
|
58
|
-
title: "Strikethrough",
|
|
59
|
-
children: /* @__PURE__ */ e(v, { className: "h-ico-sm w-ico-sm", stroke: 2.5 })
|
|
60
|
-
}
|
|
61
|
-
),
|
|
62
|
-
/* @__PURE__ */ e("div", { className: "mx-ds-02 h-[16px] w-px bg-border" }),
|
|
63
|
-
/* @__PURE__ */ e(
|
|
64
|
-
s,
|
|
65
|
-
{
|
|
66
|
-
onClick: () => t.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
67
|
-
isActive: t.isActive("heading", { level: 2 }),
|
|
68
|
-
title: "Heading 2",
|
|
69
|
-
children: /* @__PURE__ */ e(y, { className: "h-ico-sm w-ico-sm", stroke: 2.5 })
|
|
70
|
-
}
|
|
71
|
-
),
|
|
72
|
-
/* @__PURE__ */ e(
|
|
73
|
-
s,
|
|
74
|
-
{
|
|
75
|
-
onClick: () => t.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
76
|
-
isActive: t.isActive("heading", { level: 3 }),
|
|
77
|
-
title: "Heading 3",
|
|
78
|
-
children: /* @__PURE__ */ e(k, { className: "h-ico-sm w-ico-sm", stroke: 2.5 })
|
|
79
|
-
}
|
|
80
|
-
),
|
|
81
|
-
/* @__PURE__ */ e("div", { className: "mx-ds-02 h-[16px] w-px bg-border" }),
|
|
82
|
-
/* @__PURE__ */ e(
|
|
83
|
-
s,
|
|
84
|
-
{
|
|
85
|
-
onClick: () => t.chain().focus().toggleBulletList().run(),
|
|
86
|
-
isActive: t.isActive("bulletList"),
|
|
87
|
-
title: "Bullet list",
|
|
88
|
-
children: /* @__PURE__ */ e(w, { className: "h-ico-sm w-ico-sm", stroke: 2.5 })
|
|
89
|
-
}
|
|
90
|
-
),
|
|
91
|
-
/* @__PURE__ */ e(
|
|
92
|
-
s,
|
|
93
|
-
{
|
|
94
|
-
onClick: () => t.chain().focus().toggleOrderedList().run(),
|
|
95
|
-
isActive: t.isActive("orderedList"),
|
|
96
|
-
title: "Ordered list",
|
|
97
|
-
children: /* @__PURE__ */ e(N, { className: "h-ico-sm w-ico-sm", stroke: 2.5 })
|
|
98
|
-
}
|
|
99
|
-
),
|
|
100
|
-
/* @__PURE__ */ e(
|
|
101
|
-
s,
|
|
102
|
-
{
|
|
103
|
-
onClick: () => t.chain().focus().toggleCodeBlock().run(),
|
|
104
|
-
isActive: t.isActive("codeBlock"),
|
|
105
|
-
title: "Code block",
|
|
106
|
-
children: /* @__PURE__ */ e(A, { className: "h-ico-sm w-ico-sm", stroke: 2.5 })
|
|
107
|
-
}
|
|
108
|
-
),
|
|
109
|
-
/* @__PURE__ */ e("div", { className: "mx-ds-02 h-[16px] w-px bg-border" }),
|
|
110
|
-
/* @__PURE__ */ e(
|
|
111
|
-
s,
|
|
112
|
-
{
|
|
113
|
-
onClick: () => t.chain().focus().undo().run(),
|
|
114
|
-
disabled: !t.can().undo(),
|
|
115
|
-
title: "Undo",
|
|
116
|
-
children: /* @__PURE__ */ e(I, { className: "h-ico-sm w-ico-sm", stroke: 2 })
|
|
117
|
-
}
|
|
118
|
-
),
|
|
119
|
-
/* @__PURE__ */ e(
|
|
120
|
-
s,
|
|
65
|
+
function be({ editor: t }) {
|
|
66
|
+
const [o, a] = c.useState(!1), [l, u] = c.useState(""), f = c.useRef(null), b = () => {
|
|
67
|
+
if (t.isActive("link")) {
|
|
68
|
+
t.chain().focus().unsetLink().run();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const d = t.getAttributes("link").href || "";
|
|
72
|
+
u(d), a(!0), setTimeout(() => {
|
|
73
|
+
var _;
|
|
74
|
+
return (_ = f.current) == null ? void 0 : _.focus();
|
|
75
|
+
}, 0);
|
|
76
|
+
}, h = (d) => {
|
|
77
|
+
d.preventDefault(), l.trim() && t.chain().focus().setLink({ href: l.trim() }).run(), a(!1), u("");
|
|
78
|
+
}, g = (d) => {
|
|
79
|
+
d.key === "Escape" && (a(!1), u(""), t.commands.focus());
|
|
80
|
+
};
|
|
81
|
+
return /* @__PURE__ */ k("div", { className: "relative", children: [
|
|
82
|
+
/* @__PURE__ */ e(s, { onClick: b, isActive: t.isActive("link"), title: "Link", children: /* @__PURE__ */ e(ke, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
|
|
83
|
+
o && /* @__PURE__ */ k(
|
|
84
|
+
"form",
|
|
121
85
|
{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
children:
|
|
86
|
+
onSubmit: h,
|
|
87
|
+
"aria-label": "Edit link URL",
|
|
88
|
+
className: "absolute left-0 top-full z-popover mt-ds-01 flex items-center gap-ds-02 rounded-ds-md border border-border bg-layer-01 p-ds-02 shadow-02",
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ e(
|
|
91
|
+
"input",
|
|
92
|
+
{
|
|
93
|
+
ref: f,
|
|
94
|
+
type: "url",
|
|
95
|
+
value: l,
|
|
96
|
+
onChange: (d) => u(d.target.value),
|
|
97
|
+
onKeyDown: g,
|
|
98
|
+
placeholder: "https://...",
|
|
99
|
+
className: "h-ds-sm w-[240px] rounded-ds-sm border border-border bg-layer-01 px-ds-03 text-ds-sm text-text-primary focus:border-interactive focus:outline-none"
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ e("button", { type: "submit", className: "h-ds-sm rounded-ds-sm bg-interactive px-ds-03 text-ds-sm text-text-on-color hover:bg-interactive/90", children: "Apply" })
|
|
103
|
+
]
|
|
126
104
|
}
|
|
127
105
|
)
|
|
128
106
|
] });
|
|
129
107
|
}
|
|
130
|
-
|
|
108
|
+
function p() {
|
|
109
|
+
return /* @__PURE__ */ e("div", { className: "mx-ds-02 h-[16px] w-px bg-border" });
|
|
110
|
+
}
|
|
111
|
+
function xe({ editor: t, onImageClick: o, onFileClick: a, onEmojiClick: l }) {
|
|
112
|
+
return /* @__PURE__ */ k("div", { className: "flex flex-wrap items-center gap-ds-01 border-b border-border px-ds-04 py-ds-02b", children: [
|
|
113
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleBold().run(), isActive: t.isActive("bold"), title: "Bold", children: /* @__PURE__ */ e(Y, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
|
|
114
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleItalic().run(), isActive: t.isActive("italic"), title: "Italic", children: /* @__PURE__ */ e(Z, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
|
|
115
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleUnderline().run(), isActive: t.isActive("underline"), title: "Underline", children: /* @__PURE__ */ e($, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
|
|
116
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleStrike().run(), isActive: t.isActive("strike"), title: "Strikethrough", children: /* @__PURE__ */ e(F, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
|
|
117
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleHighlight().run(), isActive: t.isActive("highlight"), title: "Highlight", children: /* @__PURE__ */ e(ee, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
|
|
118
|
+
/* @__PURE__ */ e(p, {}),
|
|
119
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleHeading({ level: 2 }).run(), isActive: t.isActive("heading", { level: 2 }), title: "Heading 2", children: /* @__PURE__ */ e(te, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
|
|
120
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleHeading({ level: 3 }).run(), isActive: t.isActive("heading", { level: 3 }), title: "Heading 3", children: /* @__PURE__ */ e(ie, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
|
|
121
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleBlockquote().run(), isActive: t.isActive("blockquote"), title: "Blockquote", children: /* @__PURE__ */ e(se, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
|
|
122
|
+
/* @__PURE__ */ e(p, {}),
|
|
123
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleBulletList().run(), isActive: t.isActive("bulletList"), title: "Bullet list", children: /* @__PURE__ */ e(re, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
|
|
124
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleOrderedList().run(), isActive: t.isActive("orderedList"), title: "Ordered list", children: /* @__PURE__ */ e(ne, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
|
|
125
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleTaskList().run(), isActive: t.isActive("taskList"), title: "Task list", children: /* @__PURE__ */ e(oe, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
|
|
126
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleCodeBlock().run(), isActive: t.isActive("codeBlock"), title: "Code block", children: /* @__PURE__ */ e(ce, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
|
|
127
|
+
/* @__PURE__ */ e(p, {}),
|
|
128
|
+
/* @__PURE__ */ e(be, { editor: t }),
|
|
129
|
+
o && /* @__PURE__ */ e(s, { onClick: o, title: "Insert image", children: /* @__PURE__ */ e(le, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
|
|
130
|
+
a && /* @__PURE__ */ e(s, { onClick: a, title: "Attach file", children: /* @__PURE__ */ e(ae, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
|
|
131
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().setHorizontalRule().run(), title: "Horizontal rule", children: /* @__PURE__ */ e(ue, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
|
|
132
|
+
/* @__PURE__ */ e(p, {}),
|
|
133
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().setTextAlign("left").run(), isActive: t.isActive({ textAlign: "left" }), title: "Align left", children: /* @__PURE__ */ e(de, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
|
|
134
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().setTextAlign("center").run(), isActive: t.isActive({ textAlign: "center" }), title: "Align center", children: /* @__PURE__ */ e(me, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
|
|
135
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().setTextAlign("right").run(), isActive: t.isActive({ textAlign: "right" }), title: "Align right", children: /* @__PURE__ */ e(fe, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
|
|
136
|
+
/* @__PURE__ */ e(p, {}),
|
|
137
|
+
l && /* @__PURE__ */ e(s, { onClick: l, title: "Emoji", children: /* @__PURE__ */ e(he, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
|
|
138
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().undo().run(), disabled: !t.can().undo(), title: "Undo", children: /* @__PURE__ */ e(ge, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
|
|
139
|
+
/* @__PURE__ */ e(s, { onClick: () => t.chain().focus().redo().run(), disabled: !t.can().redo(), title: "Redo", children: /* @__PURE__ */ e(pe, { className: "h-ico-sm w-ico-sm", stroke: 2 }) })
|
|
140
|
+
] });
|
|
141
|
+
}
|
|
142
|
+
const ve = c.lazy(() => import("../_virtual/shilp-sutra.js"));
|
|
143
|
+
function we({ onSelect: t }) {
|
|
144
|
+
const [o, a] = c.useState(null), { colorMode: l } = X();
|
|
145
|
+
c.useEffect(() => {
|
|
146
|
+
import("../_virtual/shilp-sutra2.js").then((f) => a(f.default));
|
|
147
|
+
}, []);
|
|
148
|
+
const u = /* @__PURE__ */ e("div", { className: "flex h-[350px] w-[352px] items-center justify-center rounded-ds-lg border border-border bg-layer-01 shadow-02", children: /* @__PURE__ */ e("span", { className: "text-ds-sm text-text-placeholder", children: "Loading..." }) });
|
|
149
|
+
return o ? /* @__PURE__ */ e(c.Suspense, { fallback: u, children: /* @__PURE__ */ e(
|
|
150
|
+
ve,
|
|
151
|
+
{
|
|
152
|
+
data: o,
|
|
153
|
+
onEmojiSelect: (f) => t(f.native),
|
|
154
|
+
theme: l === "dark" ? "dark" : "light",
|
|
155
|
+
previewPosition: "none",
|
|
156
|
+
skinTonePosition: "none"
|
|
157
|
+
}
|
|
158
|
+
) }) : u;
|
|
159
|
+
}
|
|
160
|
+
const _e = c.forwardRef(
|
|
131
161
|
function({
|
|
132
162
|
content: o = "",
|
|
133
|
-
placeholder:
|
|
134
|
-
onChange:
|
|
135
|
-
className:
|
|
136
|
-
editable:
|
|
137
|
-
|
|
138
|
-
|
|
163
|
+
placeholder: a = "Start writing...",
|
|
164
|
+
onChange: l,
|
|
165
|
+
className: u,
|
|
166
|
+
editable: f = !0,
|
|
167
|
+
onImageUpload: b,
|
|
168
|
+
onFileUpload: h,
|
|
169
|
+
mentions: g,
|
|
170
|
+
onMentionSearch: d,
|
|
171
|
+
onMentionSelect: _
|
|
172
|
+
}, W) {
|
|
173
|
+
const A = c.useRef(null), [y, I] = c.useState(!1), N = c.useRef(null), T = c.useRef(null), R = c.useRef(null), C = async (i) => {
|
|
174
|
+
const r = A.current;
|
|
175
|
+
if (r)
|
|
176
|
+
if (b) {
|
|
177
|
+
const n = await b(i);
|
|
178
|
+
r.chain().focus().setImage({ src: n }).run();
|
|
179
|
+
} else {
|
|
180
|
+
const n = new FileReader();
|
|
181
|
+
n.onload = () => {
|
|
182
|
+
r.chain().focus().setImage({ src: n.result }).run();
|
|
183
|
+
}, n.readAsDataURL(i);
|
|
184
|
+
}
|
|
185
|
+
}, L = async (i) => {
|
|
186
|
+
const r = A.current;
|
|
187
|
+
if (!r || !h) return;
|
|
188
|
+
const n = await h(i);
|
|
189
|
+
r.chain().focus().insertContent({
|
|
190
|
+
type: "fileAttachment",
|
|
191
|
+
attrs: { url: n.url, name: n.name, size: n.size }
|
|
192
|
+
}).run();
|
|
193
|
+
}, m = E({
|
|
139
194
|
extensions: [
|
|
140
|
-
|
|
195
|
+
B.configure({
|
|
141
196
|
heading: { levels: [2, 3] }
|
|
142
197
|
}),
|
|
143
|
-
|
|
144
|
-
placeholder:
|
|
198
|
+
G.configure({
|
|
199
|
+
placeholder: a,
|
|
145
200
|
emptyEditorClass: "before:content-[attr(data-placeholder)] before:text-text-placeholder before:float-left before:h-0 before:pointer-events-none"
|
|
146
|
-
})
|
|
201
|
+
}),
|
|
202
|
+
P,
|
|
203
|
+
M.configure({ multicolor: !1 }),
|
|
204
|
+
j,
|
|
205
|
+
z.configure({ nested: !0 }),
|
|
206
|
+
D.configure({ types: ["heading", "paragraph"] }),
|
|
207
|
+
q.configure({
|
|
208
|
+
openOnClick: !1,
|
|
209
|
+
HTMLAttributes: {
|
|
210
|
+
rel: "noopener noreferrer",
|
|
211
|
+
target: "_blank"
|
|
212
|
+
}
|
|
213
|
+
}),
|
|
214
|
+
U.configure({
|
|
215
|
+
allowBase64: !0,
|
|
216
|
+
HTMLAttributes: {
|
|
217
|
+
class: "max-w-full rounded-ds-md"
|
|
218
|
+
}
|
|
219
|
+
}),
|
|
220
|
+
K,
|
|
221
|
+
...g || d ? [
|
|
222
|
+
O.configure({
|
|
223
|
+
HTMLAttributes: { class: "mention" },
|
|
224
|
+
suggestion: {
|
|
225
|
+
items: async ({ query: i }) => d ? await d(i) : g ? g.filter((r) => r.label.toLowerCase().includes(i.toLowerCase())).slice(0, 8) : [],
|
|
226
|
+
render: J()
|
|
227
|
+
}
|
|
228
|
+
})
|
|
229
|
+
] : [],
|
|
230
|
+
Q
|
|
147
231
|
],
|
|
148
232
|
content: o,
|
|
149
|
-
editable:
|
|
233
|
+
editable: f,
|
|
150
234
|
editorProps: {
|
|
235
|
+
handleDrop: (i, r, n, x) => {
|
|
236
|
+
var S;
|
|
237
|
+
if (x || !((S = r.dataTransfer) != null && S.files.length)) return !1;
|
|
238
|
+
const v = r.dataTransfer.files[0];
|
|
239
|
+
return v ? v.type.startsWith("image/") ? (C(v), !0) : h ? (L(v), !0) : !1 : !1;
|
|
240
|
+
},
|
|
241
|
+
handlePaste: (i, r) => {
|
|
242
|
+
var x;
|
|
243
|
+
const n = (x = r.clipboardData) == null ? void 0 : x.files[0];
|
|
244
|
+
return n ? n.type.startsWith("image/") ? (C(n), !0) : h ? (L(n), !0) : !1 : !1;
|
|
245
|
+
},
|
|
151
246
|
attributes: {
|
|
152
|
-
class:
|
|
153
|
-
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
"[&_h2]:text-ds-xl [&_h2]:mb-ds-03 [&_h2]:mt-ds-05 [&_h2]:text-text-primary",
|
|
157
|
-
"[&_h3]:text-ds-base [&_h3]:font-semibold [&_h3]:mb-ds-02b [&_h3]:mt-ds-04 [&_h3]:text-text-primary",
|
|
158
|
-
"[&_p]:mb-ds-02b [&_p]:text-text-secondary",
|
|
159
|
-
"[&_ul]:ml-ds-05 [&_ul]:list-disc [&_ol]:ml-ds-05 [&_ol]:list-decimal",
|
|
160
|
-
"[&_li]:text-text-secondary",
|
|
161
|
-
"[&_code]:rounded [&_code]:bg-layer-02 [&_code]:px-ds-02b [&_code]:py-ds-01 [&_code]:text-ds-md [&_code]:text-interactive",
|
|
162
|
-
"[&_pre]:rounded-ds-lg [&_pre]:bg-layer-02 [&_pre]:p-ds-04",
|
|
163
|
-
"[&_strong]:font-semibold [&_strong]:text-text-primary"
|
|
247
|
+
class: w(
|
|
248
|
+
...V,
|
|
249
|
+
"focus:outline-none",
|
|
250
|
+
"min-h-[120px] px-ds-04 py-ds-04"
|
|
164
251
|
)
|
|
165
252
|
}
|
|
166
253
|
},
|
|
167
|
-
onUpdate: ({ editor:
|
|
168
|
-
|
|
254
|
+
onUpdate: ({ editor: i }) => {
|
|
255
|
+
l == null || l(i.getHTML());
|
|
169
256
|
}
|
|
170
257
|
});
|
|
171
|
-
return
|
|
172
|
-
|
|
173
|
-
}, [
|
|
258
|
+
return c.useEffect(() => {
|
|
259
|
+
A.current = m;
|
|
260
|
+
}, [m]), c.useEffect(() => {
|
|
261
|
+
if (!y) return;
|
|
262
|
+
const i = (r) => {
|
|
263
|
+
N.current && !N.current.contains(r.target) && I(!1);
|
|
264
|
+
};
|
|
265
|
+
return document.addEventListener("mousedown", i), () => document.removeEventListener("mousedown", i);
|
|
266
|
+
}, [y]), c.useEffect(() => {
|
|
267
|
+
m && o !== m.getHTML() && m.commands.setContent(o, !1);
|
|
268
|
+
}, [m, o]), m ? /* @__PURE__ */ k(
|
|
174
269
|
"div",
|
|
175
270
|
{
|
|
176
|
-
ref:
|
|
177
|
-
className:
|
|
271
|
+
ref: W,
|
|
272
|
+
className: w(
|
|
178
273
|
"overflow-hidden rounded-ds-lg border border-border bg-layer-01",
|
|
179
274
|
"transition-colors focus-within:border-border-strong",
|
|
180
|
-
|
|
275
|
+
u
|
|
181
276
|
),
|
|
182
277
|
children: [
|
|
183
|
-
|
|
184
|
-
|
|
278
|
+
/* @__PURE__ */ e(
|
|
279
|
+
"input",
|
|
280
|
+
{
|
|
281
|
+
ref: T,
|
|
282
|
+
type: "file",
|
|
283
|
+
accept: "image/*",
|
|
284
|
+
"aria-label": "Upload image",
|
|
285
|
+
className: "hidden",
|
|
286
|
+
onChange: (i) => {
|
|
287
|
+
var n;
|
|
288
|
+
const r = (n = i.target.files) == null ? void 0 : n[0];
|
|
289
|
+
r && C(r), i.target.value = "";
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
),
|
|
293
|
+
h && /* @__PURE__ */ e(
|
|
294
|
+
"input",
|
|
295
|
+
{
|
|
296
|
+
ref: R,
|
|
297
|
+
type: "file",
|
|
298
|
+
"aria-label": "Upload file",
|
|
299
|
+
className: "hidden",
|
|
300
|
+
onChange: (i) => {
|
|
301
|
+
var n;
|
|
302
|
+
const r = (n = i.target.files) == null ? void 0 : n[0];
|
|
303
|
+
r && L(r), i.target.value = "";
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
),
|
|
307
|
+
f && /* @__PURE__ */ k("div", { className: "relative", children: [
|
|
308
|
+
/* @__PURE__ */ e(
|
|
309
|
+
xe,
|
|
310
|
+
{
|
|
311
|
+
editor: m,
|
|
312
|
+
onImageClick: () => {
|
|
313
|
+
var i;
|
|
314
|
+
return (i = T.current) == null ? void 0 : i.click();
|
|
315
|
+
},
|
|
316
|
+
onFileClick: h ? () => {
|
|
317
|
+
var i;
|
|
318
|
+
return (i = R.current) == null ? void 0 : i.click();
|
|
319
|
+
} : void 0,
|
|
320
|
+
onEmojiClick: () => I((i) => !i)
|
|
321
|
+
}
|
|
322
|
+
),
|
|
323
|
+
y && /* @__PURE__ */ e("div", { ref: N, className: "absolute right-0 top-full z-popover", children: /* @__PURE__ */ e(
|
|
324
|
+
we,
|
|
325
|
+
{
|
|
326
|
+
onSelect: (i) => {
|
|
327
|
+
m.chain().focus().insertContent(i).run(), I(!1);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
) })
|
|
331
|
+
] }),
|
|
332
|
+
/* @__PURE__ */ e(H, { editor: m })
|
|
185
333
|
]
|
|
186
334
|
}
|
|
187
335
|
) : null;
|
|
188
336
|
}
|
|
189
337
|
);
|
|
190
|
-
|
|
191
|
-
const
|
|
192
|
-
function({ content: o, className:
|
|
193
|
-
const
|
|
338
|
+
_e.displayName = "RichTextEditor";
|
|
339
|
+
const Ae = c.forwardRef(
|
|
340
|
+
function({ content: o, className: a }, l) {
|
|
341
|
+
const u = E({
|
|
194
342
|
extensions: [
|
|
195
|
-
|
|
343
|
+
B.configure({
|
|
196
344
|
heading: { levels: [2, 3] }
|
|
345
|
+
}),
|
|
346
|
+
P,
|
|
347
|
+
M.configure({ multicolor: !1 }),
|
|
348
|
+
j,
|
|
349
|
+
z.configure({ nested: !0 }),
|
|
350
|
+
D.configure({ types: ["heading", "paragraph"] }),
|
|
351
|
+
q.configure({
|
|
352
|
+
openOnClick: !0,
|
|
353
|
+
HTMLAttributes: {
|
|
354
|
+
rel: "noopener noreferrer",
|
|
355
|
+
target: "_blank"
|
|
356
|
+
}
|
|
357
|
+
}),
|
|
358
|
+
U.configure({
|
|
359
|
+
allowBase64: !0,
|
|
360
|
+
HTMLAttributes: {
|
|
361
|
+
class: "max-w-full rounded-ds-md"
|
|
362
|
+
}
|
|
363
|
+
}),
|
|
364
|
+
K,
|
|
365
|
+
O.configure({
|
|
366
|
+
HTMLAttributes: { class: "mention" }
|
|
197
367
|
})
|
|
198
368
|
],
|
|
199
369
|
content: o,
|
|
200
370
|
editable: !1,
|
|
201
371
|
editorProps: {
|
|
202
372
|
attributes: {
|
|
203
|
-
class:
|
|
204
|
-
"prose prose-sm max-w-none",
|
|
205
|
-
"font-body text-ds-md leading-relaxed text-text-primary",
|
|
206
|
-
"[&_h2]:text-ds-xl [&_h2]:mb-ds-03 [&_h2]:mt-ds-05 [&_h2]:text-text-primary",
|
|
207
|
-
"[&_h3]:text-ds-base [&_h3]:font-semibold [&_h3]:mb-ds-02b [&_h3]:mt-ds-04 [&_h3]:text-text-primary",
|
|
208
|
-
"[&_p]:mb-ds-02b [&_p]:text-text-secondary",
|
|
209
|
-
"[&_ul]:ml-ds-05 [&_ul]:list-disc [&_ol]:ml-ds-05 [&_ol]:list-decimal",
|
|
210
|
-
"[&_li]:text-text-secondary",
|
|
211
|
-
"[&_code]:rounded [&_code]:bg-layer-02 [&_code]:px-ds-02b [&_code]:py-ds-01 [&_code]:text-ds-md [&_code]:text-interactive",
|
|
212
|
-
"[&_pre]:rounded-ds-lg [&_pre]:bg-layer-02 [&_pre]:p-ds-04",
|
|
213
|
-
"[&_strong]:font-semibold [&_strong]:text-text-primary"
|
|
214
|
-
)
|
|
373
|
+
class: w(...V)
|
|
215
374
|
}
|
|
216
375
|
}
|
|
217
376
|
});
|
|
218
|
-
return
|
|
377
|
+
return u ? /* @__PURE__ */ e("div", { ref: l, className: a, children: /* @__PURE__ */ e(H, { editor: u }) }) : null;
|
|
219
378
|
}
|
|
220
379
|
);
|
|
221
|
-
|
|
380
|
+
Ae.displayName = "RichTextViewer";
|
|
222
381
|
export {
|
|
223
|
-
|
|
224
|
-
|
|
382
|
+
_e as RichTextEditor,
|
|
383
|
+
Ae as RichTextViewer
|
|
225
384
|
};
|