@devalok/shilp-sutra 0.43.0 → 0.44.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/MIGRATION.md +46 -0
- package/dist/_chunks/chat.js +163 -162
- package/dist/_chunks/chat.js.map +1 -1
- package/dist/_chunks/mention-suggestion.js +34 -32
- package/dist/_chunks/mention-suggestion.js.map +1 -1
- package/dist/_chunks/oauth-button.js +102 -97
- package/dist/_chunks/oauth-button.js.map +1 -1
- package/dist/_chunks/tree-view.js +1 -1
- package/dist/_chunks/tree-view.js.map +1 -1
- package/dist/ai/command-bar.js.map +1 -1
- package/dist/composed/command-palette.js +3 -3
- package/dist/composed/command-palette.js.map +1 -1
- package/dist/composed/content-card.d.ts +6 -0
- package/dist/composed/content-card.d.ts.map +1 -1
- package/dist/composed/content-card.js.map +1 -1
- package/dist/composed/extensions/file-attachment.d.ts.map +1 -1
- package/dist/composed/file-preview/audio-preview.d.ts.map +1 -1
- package/dist/composed/file-preview.d.ts.map +1 -1
- package/dist/composed/file-preview.js +146 -142
- package/dist/composed/file-preview.js.map +1 -1
- package/dist/composed/filter-bar.js +5 -2
- package/dist/composed/filter-bar.js.map +1 -1
- package/dist/composed/master-detail.js +1 -1
- package/dist/composed/master-detail.js.map +1 -1
- package/dist/composed/page-header.js +1 -1
- package/dist/composed/page-header.js.map +1 -1
- package/dist/composed/rich-chat-input/attachment-strip.d.ts.map +1 -1
- package/dist/composed/rich-chat-input/audio-player.d.ts.map +1 -1
- package/dist/composed/rich-chat-input/schedule-send.d.ts.map +1 -1
- package/dist/composed/rich-chat-input.js +595 -586
- package/dist/composed/rich-chat-input.js.map +1 -1
- package/dist/composed/rich-text-editor.d.ts.map +1 -1
- package/dist/composed/rich-text-editor.js +164 -162
- package/dist/composed/rich-text-editor.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/shell/notification-center.d.ts.map +1 -1
- package/dist/shell/notification-center.js +101 -97
- package/dist/shell/notification-center.js.map +1 -1
- package/dist/shell/sidebar.d.ts.map +1 -1
- package/dist/shell/sidebar.js +137 -122
- package/dist/shell/sidebar.js.map +1 -1
- package/dist/shell/top-bar.d.ts.map +1 -1
- package/dist/shell/top-bar.js +86 -83
- package/dist/shell/top-bar.js.map +1 -1
- package/dist/tokens/semantic.css +1 -0
- package/dist/ui/avatar.js +1 -1
- package/dist/ui/avatar.js.map +1 -1
- package/dist/ui/breadcrumb.js +2 -2
- package/dist/ui/breadcrumb.js.map +1 -1
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/card.d.ts +82 -7
- package/dist/ui/card.d.ts.map +1 -1
- package/dist/ui/card.js +74 -108
- package/dist/ui/card.js.map +1 -1
- package/dist/ui/chat/message.d.ts.map +1 -1
- package/dist/ui/combobox.js +2 -2
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/dropdown-menu.js +9 -3
- package/dist/ui/dropdown-menu.js.map +1 -1
- package/dist/ui/index.d.ts +2 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +58 -57
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/menubar.js +9 -3
- package/dist/ui/menubar.js.map +1 -1
- package/dist/ui/oauth-button/oauth-button.d.ts.map +1 -1
- package/dist/ui/select.js +5 -2
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/sidebar.js +73 -73
- package/dist/ui/sidebar.js.map +1 -1
- package/dist/ui/stat-card.d.ts +8 -5
- package/dist/ui/stat-card.d.ts.map +1 -1
- package/dist/ui/stat-card.js +168 -150
- package/dist/ui/stat-card.js.map +1 -1
- package/dist/ui/tabs.d.ts.map +1 -1
- package/dist/ui/tabs.js +5 -2
- package/dist/ui/tabs.js.map +1 -1
- package/dist/ui/truncated-text.d.ts +37 -0
- package/dist/ui/truncated-text.d.ts.map +1 -0
- package/dist/ui/truncated-text.js +53 -0
- package/dist/ui/truncated-text.js.map +1 -0
- package/docs/components/ui/card.md +13 -4
- package/docs/components/ui/stat-card.md +7 -2
- package/docs/components/ui/truncated-text.md +49 -0
- package/llms-full.txt +70 -7
- package/make-kit/components/card.md +14 -4
- package/package.json +1 -1
- package/skill/SKILL.md +1 -1
- package/skill/references/components-full.md +70 -7
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../ui/lib/utils.js";
|
|
3
3
|
import { Icon as t } from "../ui/icon.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
4
|
+
import { Button as n } from "../ui/button.js";
|
|
5
|
+
import { a as r, c as i, d as a, f as o, h as s, l as c, m as l, n as u, r as d, t as f } from "../_chunks/tiptap.js";
|
|
6
|
+
import { useColorMode as p } from "../hooks/use-color-mode.js";
|
|
7
|
+
import { n as m, r as h } from "../_chunks/emoji-data.js";
|
|
8
|
+
import { EmojiNode as g } from "./extensions/emoji-node.js";
|
|
9
|
+
import { createEmojiSuggestion as _ } from "./extensions/emoji-suggestion.js";
|
|
10
|
+
import { n as v, t as y } from "../_chunks/mention-suggestion.js";
|
|
11
|
+
import * as b from "react";
|
|
12
|
+
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
13
|
+
import { IconAlignCenter as C, IconAlignLeft as w, IconAlignRight as T, IconArrowBackUp as E, IconArrowForwardUp as D, IconBlockquote as O, IconBold as k, IconCode as A, IconH2 as j, IconH3 as M, IconHighlight as N, IconItalic as P, IconLineDashed as F, IconLink as I, IconList as L, IconListCheck as R, IconListNumbers as z, IconMoodSmile as B, IconPaperclip as V, IconPhoto as H, IconStrikethrough as U, IconUnderline as W } from "@tabler/icons-react";
|
|
13
14
|
//#region src/composed/rich-text-editor.tsx
|
|
14
|
-
var
|
|
15
|
+
var G = [
|
|
15
16
|
"prose prose-sm max-w-none",
|
|
16
17
|
"font-body text-ds-md leading-relaxed text-surface-fg",
|
|
17
18
|
"[&_h2]:text-ds-xl [&_h2]:mb-ds-03 [&_h2]:mt-ds-05 [&_h2]:text-surface-fg",
|
|
@@ -30,8 +31,8 @@ var W = [
|
|
|
30
31
|
"[&_img]:max-w-full [&_img]:rounded-control [&_img]:my-ds-03",
|
|
31
32
|
"[&_.mention]:rounded-control-inner [&_.mention]:bg-accent-2 [&_.mention]:px-ds-02 [&_.mention]:py-[1px] [&_.mention]:font-medium [&_.mention]:text-accent-11"
|
|
32
33
|
];
|
|
33
|
-
function
|
|
34
|
-
return /* @__PURE__ */
|
|
34
|
+
function K({ onClick: t, isActive: n = !1, disabled: r = !1, title: i, children: a }) {
|
|
35
|
+
return /* @__PURE__ */ x("button", {
|
|
35
36
|
type: "button",
|
|
36
37
|
onClick: t,
|
|
37
38
|
disabled: r,
|
|
@@ -42,56 +43,57 @@ function G({ onClick: t, isActive: n = !1, disabled: r = !1, title: i, children:
|
|
|
42
43
|
children: a
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
-
let [
|
|
46
|
+
function q({ editor: e }) {
|
|
47
|
+
let [r, i] = b.useState(!1), [a, o] = b.useState(""), s = b.useRef(null), { isLink: l } = c({
|
|
47
48
|
editor: e,
|
|
48
49
|
selector: ({ editor: e }) => ({ isLink: e.isActive("link") })
|
|
49
50
|
});
|
|
50
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ S("div", {
|
|
51
52
|
className: "relative",
|
|
52
|
-
children: [/* @__PURE__ */
|
|
53
|
+
children: [/* @__PURE__ */ x(K, {
|
|
53
54
|
onClick: () => {
|
|
54
|
-
if (
|
|
55
|
+
if (l) {
|
|
55
56
|
e.chain().focus().unsetLink().run();
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
+
o(e.getAttributes("link").href || ""), i(!0), setTimeout(() => s.current?.focus(), 0);
|
|
59
60
|
},
|
|
60
|
-
isActive:
|
|
61
|
+
isActive: l,
|
|
61
62
|
title: "Link",
|
|
62
|
-
children: /* @__PURE__ */
|
|
63
|
-
icon:
|
|
63
|
+
children: /* @__PURE__ */ x(t, {
|
|
64
|
+
icon: I,
|
|
64
65
|
size: "sm"
|
|
65
66
|
})
|
|
66
|
-
}),
|
|
67
|
+
}), r && /* @__PURE__ */ S("form", {
|
|
67
68
|
onSubmit: (t) => {
|
|
68
|
-
t.preventDefault(),
|
|
69
|
+
t.preventDefault(), a.trim() && e.chain().focus().setLink({ href: a.trim() }).run(), i(!1), o("");
|
|
69
70
|
},
|
|
70
71
|
"aria-label": "Edit link URL",
|
|
71
72
|
className: "absolute left-0 top-full z-popover mt-ds-01 flex items-center gap-ds-02 rounded-control bg-surface-overlay p-ds-02 shadow-raised-hover",
|
|
72
|
-
children: [/* @__PURE__ */
|
|
73
|
-
ref:
|
|
73
|
+
children: [/* @__PURE__ */ x("input", {
|
|
74
|
+
ref: s,
|
|
74
75
|
type: "url",
|
|
75
|
-
value:
|
|
76
|
-
onChange: (e) =>
|
|
76
|
+
value: a,
|
|
77
|
+
onChange: (e) => o(e.target.value),
|
|
77
78
|
onKeyDown: (t) => {
|
|
78
|
-
t.key === "Escape" && (
|
|
79
|
+
t.key === "Escape" && (i(!1), o(""), e.commands.focus());
|
|
79
80
|
},
|
|
80
81
|
placeholder: "https://...",
|
|
81
82
|
className: "h-ds-sm w-[240px] rounded-control-inner border border-surface-border-strong bg-surface-overlay px-ds-03 text-ds-sm text-surface-fg focus:border-accent-7 focus:outline-hidden"
|
|
82
|
-
}), /* @__PURE__ */
|
|
83
|
+
}), /* @__PURE__ */ x(n, {
|
|
83
84
|
type: "submit",
|
|
84
|
-
|
|
85
|
+
variant: "solid",
|
|
86
|
+
size: "sm",
|
|
85
87
|
children: "Apply"
|
|
86
88
|
})]
|
|
87
89
|
})]
|
|
88
90
|
});
|
|
89
91
|
}
|
|
90
|
-
function
|
|
91
|
-
return /* @__PURE__ */
|
|
92
|
+
function J() {
|
|
93
|
+
return /* @__PURE__ */ x("div", { className: "mx-ds-02 h-[16px] w-px bg-surface-border" });
|
|
92
94
|
}
|
|
93
|
-
function
|
|
94
|
-
let o =
|
|
95
|
+
function Y({ editor: e, toolbar: n, onImageClick: r, onFileClick: i, onEmojiClick: a }) {
|
|
96
|
+
let o = c({
|
|
95
97
|
editor: e,
|
|
96
98
|
selector: ({ editor: e }) => ({
|
|
97
99
|
isBold: e.isActive("bold"),
|
|
@@ -113,234 +115,234 @@ function J({ editor: e, toolbar: n, onImageClick: r, onFileClick: i, onEmojiClic
|
|
|
113
115
|
canUndo: e.can().undo(),
|
|
114
116
|
canRedo: e.can().redo()
|
|
115
117
|
})
|
|
116
|
-
}),
|
|
117
|
-
return /* @__PURE__ */
|
|
118
|
+
}), s = (e) => !n || n.includes(e), l = s("bold") || s("italic") || s("underline") || s("strike") || s("highlight"), u = s("h2") || s("h3") || s("blockquote"), d = s("bulletList") || s("orderedList") || s("taskList") || s("codeBlock"), f = s("link") || !!r && s("image") || !!i && s("file") || s("hr"), p = s("alignLeft") || s("alignCenter") || s("alignRight"), m = !!a && s("emoji"), h = s("undo") || s("redo");
|
|
119
|
+
return /* @__PURE__ */ S("div", {
|
|
118
120
|
role: "toolbar",
|
|
119
121
|
"aria-label": "Text formatting",
|
|
120
122
|
className: "flex flex-wrap items-center gap-ds-01 border-b border-surface-border-strong px-ds-04 py-ds-02b",
|
|
121
123
|
children: [
|
|
122
|
-
|
|
124
|
+
s("bold") && /* @__PURE__ */ x(K, {
|
|
123
125
|
onClick: () => e.chain().focus().toggleBold().run(),
|
|
124
126
|
isActive: o.isBold,
|
|
125
127
|
title: "Bold",
|
|
126
|
-
children: /* @__PURE__ */
|
|
127
|
-
icon:
|
|
128
|
+
children: /* @__PURE__ */ x(t, {
|
|
129
|
+
icon: k,
|
|
128
130
|
size: "sm",
|
|
129
131
|
stroke: "bold"
|
|
130
132
|
})
|
|
131
133
|
}),
|
|
132
|
-
|
|
134
|
+
s("italic") && /* @__PURE__ */ x(K, {
|
|
133
135
|
onClick: () => e.chain().focus().toggleItalic().run(),
|
|
134
136
|
isActive: o.isItalic,
|
|
135
137
|
title: "Italic",
|
|
136
|
-
children: /* @__PURE__ */
|
|
137
|
-
icon:
|
|
138
|
+
children: /* @__PURE__ */ x(t, {
|
|
139
|
+
icon: P,
|
|
138
140
|
size: "sm",
|
|
139
141
|
stroke: "bold"
|
|
140
142
|
})
|
|
141
143
|
}),
|
|
142
|
-
|
|
144
|
+
s("underline") && /* @__PURE__ */ x(K, {
|
|
143
145
|
onClick: () => e.chain().focus().toggleUnderline().run(),
|
|
144
146
|
isActive: o.isUnderline,
|
|
145
147
|
title: "Underline",
|
|
146
|
-
children: /* @__PURE__ */
|
|
147
|
-
icon:
|
|
148
|
+
children: /* @__PURE__ */ x(t, {
|
|
149
|
+
icon: W,
|
|
148
150
|
size: "sm",
|
|
149
151
|
stroke: "bold"
|
|
150
152
|
})
|
|
151
153
|
}),
|
|
152
|
-
|
|
154
|
+
s("strike") && /* @__PURE__ */ x(K, {
|
|
153
155
|
onClick: () => e.chain().focus().toggleStrike().run(),
|
|
154
156
|
isActive: o.isStrike,
|
|
155
157
|
title: "Strikethrough",
|
|
156
|
-
children: /* @__PURE__ */
|
|
157
|
-
icon:
|
|
158
|
+
children: /* @__PURE__ */ x(t, {
|
|
159
|
+
icon: U,
|
|
158
160
|
size: "sm",
|
|
159
161
|
stroke: "bold"
|
|
160
162
|
})
|
|
161
163
|
}),
|
|
162
|
-
|
|
164
|
+
s("highlight") && /* @__PURE__ */ x(K, {
|
|
163
165
|
onClick: () => e.chain().focus().toggleHighlight().run(),
|
|
164
166
|
isActive: o.isHighlight,
|
|
165
167
|
title: "Highlight",
|
|
166
|
-
children: /* @__PURE__ */
|
|
167
|
-
icon:
|
|
168
|
+
children: /* @__PURE__ */ x(t, {
|
|
169
|
+
icon: N,
|
|
168
170
|
size: "sm",
|
|
169
171
|
stroke: "bold"
|
|
170
172
|
})
|
|
171
173
|
}),
|
|
172
|
-
l && u && /* @__PURE__ */
|
|
173
|
-
|
|
174
|
+
l && u && /* @__PURE__ */ x(J, {}),
|
|
175
|
+
s("h2") && /* @__PURE__ */ x(K, {
|
|
174
176
|
onClick: () => e.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
175
177
|
isActive: o.isH2,
|
|
176
178
|
title: "Heading 2",
|
|
177
|
-
children: /* @__PURE__ */
|
|
178
|
-
icon:
|
|
179
|
+
children: /* @__PURE__ */ x(t, {
|
|
180
|
+
icon: j,
|
|
179
181
|
size: "sm",
|
|
180
182
|
stroke: "bold"
|
|
181
183
|
})
|
|
182
184
|
}),
|
|
183
|
-
|
|
185
|
+
s("h3") && /* @__PURE__ */ x(K, {
|
|
184
186
|
onClick: () => e.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
185
187
|
isActive: o.isH3,
|
|
186
188
|
title: "Heading 3",
|
|
187
|
-
children: /* @__PURE__ */
|
|
188
|
-
icon:
|
|
189
|
+
children: /* @__PURE__ */ x(t, {
|
|
190
|
+
icon: M,
|
|
189
191
|
size: "sm",
|
|
190
192
|
stroke: "bold"
|
|
191
193
|
})
|
|
192
194
|
}),
|
|
193
|
-
|
|
195
|
+
s("blockquote") && /* @__PURE__ */ x(K, {
|
|
194
196
|
onClick: () => e.chain().focus().toggleBlockquote().run(),
|
|
195
197
|
isActive: o.isBlockquote,
|
|
196
198
|
title: "Blockquote",
|
|
197
|
-
children: /* @__PURE__ */
|
|
198
|
-
icon:
|
|
199
|
+
children: /* @__PURE__ */ x(t, {
|
|
200
|
+
icon: O,
|
|
199
201
|
size: "sm",
|
|
200
202
|
stroke: "bold"
|
|
201
203
|
})
|
|
202
204
|
}),
|
|
203
|
-
u && d && /* @__PURE__ */
|
|
204
|
-
|
|
205
|
+
u && d && /* @__PURE__ */ x(J, {}),
|
|
206
|
+
s("bulletList") && /* @__PURE__ */ x(K, {
|
|
205
207
|
onClick: () => e.chain().focus().toggleBulletList().run(),
|
|
206
208
|
isActive: o.isBulletList,
|
|
207
209
|
title: "Bullet list",
|
|
208
|
-
children: /* @__PURE__ */
|
|
209
|
-
icon:
|
|
210
|
+
children: /* @__PURE__ */ x(t, {
|
|
211
|
+
icon: L,
|
|
210
212
|
size: "sm",
|
|
211
213
|
stroke: "bold"
|
|
212
214
|
})
|
|
213
215
|
}),
|
|
214
|
-
|
|
216
|
+
s("orderedList") && /* @__PURE__ */ x(K, {
|
|
215
217
|
onClick: () => e.chain().focus().toggleOrderedList().run(),
|
|
216
218
|
isActive: o.isOrderedList,
|
|
217
219
|
title: "Ordered list",
|
|
218
|
-
children: /* @__PURE__ */
|
|
219
|
-
icon:
|
|
220
|
+
children: /* @__PURE__ */ x(t, {
|
|
221
|
+
icon: z,
|
|
220
222
|
size: "sm",
|
|
221
223
|
stroke: "bold"
|
|
222
224
|
})
|
|
223
225
|
}),
|
|
224
|
-
|
|
226
|
+
s("taskList") && /* @__PURE__ */ x(K, {
|
|
225
227
|
onClick: () => e.chain().focus().toggleTaskList().run(),
|
|
226
228
|
isActive: o.isTaskList,
|
|
227
229
|
title: "Task list",
|
|
228
|
-
children: /* @__PURE__ */
|
|
229
|
-
icon:
|
|
230
|
+
children: /* @__PURE__ */ x(t, {
|
|
231
|
+
icon: R,
|
|
230
232
|
size: "sm",
|
|
231
233
|
stroke: "bold"
|
|
232
234
|
})
|
|
233
235
|
}),
|
|
234
|
-
|
|
236
|
+
s("codeBlock") && /* @__PURE__ */ x(K, {
|
|
235
237
|
onClick: () => e.chain().focus().toggleCodeBlock().run(),
|
|
236
238
|
isActive: o.isCodeBlock,
|
|
237
239
|
title: "Code block",
|
|
238
|
-
children: /* @__PURE__ */
|
|
239
|
-
icon:
|
|
240
|
+
children: /* @__PURE__ */ x(t, {
|
|
241
|
+
icon: A,
|
|
240
242
|
size: "sm",
|
|
241
243
|
stroke: "bold"
|
|
242
244
|
})
|
|
243
245
|
}),
|
|
244
|
-
d && f && /* @__PURE__ */
|
|
245
|
-
|
|
246
|
-
r &&
|
|
246
|
+
d && f && /* @__PURE__ */ x(J, {}),
|
|
247
|
+
s("link") && /* @__PURE__ */ x(q, { editor: e }),
|
|
248
|
+
r && s("image") && /* @__PURE__ */ x(K, {
|
|
247
249
|
onClick: r,
|
|
248
250
|
title: "Insert image",
|
|
249
|
-
children: /* @__PURE__ */
|
|
250
|
-
icon:
|
|
251
|
+
children: /* @__PURE__ */ x(t, {
|
|
252
|
+
icon: H,
|
|
251
253
|
size: "sm"
|
|
252
254
|
})
|
|
253
255
|
}),
|
|
254
|
-
i &&
|
|
256
|
+
i && s("file") && /* @__PURE__ */ x(K, {
|
|
255
257
|
onClick: i,
|
|
256
258
|
title: "Attach file",
|
|
257
|
-
children: /* @__PURE__ */
|
|
258
|
-
icon:
|
|
259
|
+
children: /* @__PURE__ */ x(t, {
|
|
260
|
+
icon: V,
|
|
259
261
|
size: "sm"
|
|
260
262
|
})
|
|
261
263
|
}),
|
|
262
|
-
|
|
264
|
+
s("hr") && /* @__PURE__ */ x(K, {
|
|
263
265
|
onClick: () => e.chain().focus().setHorizontalRule().run(),
|
|
264
266
|
title: "Horizontal rule",
|
|
265
|
-
children: /* @__PURE__ */
|
|
266
|
-
icon:
|
|
267
|
+
children: /* @__PURE__ */ x(t, {
|
|
268
|
+
icon: F,
|
|
267
269
|
size: "sm"
|
|
268
270
|
})
|
|
269
271
|
}),
|
|
270
|
-
f && p && /* @__PURE__ */
|
|
271
|
-
|
|
272
|
+
f && p && /* @__PURE__ */ x(J, {}),
|
|
273
|
+
s("alignLeft") && /* @__PURE__ */ x(K, {
|
|
272
274
|
onClick: () => e.chain().focus().setTextAlign("left").run(),
|
|
273
275
|
isActive: o.isAlignLeft,
|
|
274
276
|
title: "Align left",
|
|
275
|
-
children: /* @__PURE__ */
|
|
276
|
-
icon:
|
|
277
|
+
children: /* @__PURE__ */ x(t, {
|
|
278
|
+
icon: w,
|
|
277
279
|
size: "sm"
|
|
278
280
|
})
|
|
279
281
|
}),
|
|
280
|
-
|
|
282
|
+
s("alignCenter") && /* @__PURE__ */ x(K, {
|
|
281
283
|
onClick: () => e.chain().focus().setTextAlign("center").run(),
|
|
282
284
|
isActive: o.isAlignCenter,
|
|
283
285
|
title: "Align center",
|
|
284
|
-
children: /* @__PURE__ */
|
|
285
|
-
icon:
|
|
286
|
+
children: /* @__PURE__ */ x(t, {
|
|
287
|
+
icon: C,
|
|
286
288
|
size: "sm"
|
|
287
289
|
})
|
|
288
290
|
}),
|
|
289
|
-
|
|
291
|
+
s("alignRight") && /* @__PURE__ */ x(K, {
|
|
290
292
|
onClick: () => e.chain().focus().setTextAlign("right").run(),
|
|
291
293
|
isActive: o.isAlignRight,
|
|
292
294
|
title: "Align right",
|
|
293
|
-
children: /* @__PURE__ */
|
|
294
|
-
icon:
|
|
295
|
+
children: /* @__PURE__ */ x(t, {
|
|
296
|
+
icon: T,
|
|
295
297
|
size: "sm"
|
|
296
298
|
})
|
|
297
299
|
}),
|
|
298
|
-
p && (m || h) && /* @__PURE__ */
|
|
299
|
-
a &&
|
|
300
|
+
p && (m || h) && /* @__PURE__ */ x(J, {}),
|
|
301
|
+
a && s("emoji") && /* @__PURE__ */ x(K, {
|
|
300
302
|
onClick: a,
|
|
301
303
|
title: "Emoji",
|
|
302
|
-
children: /* @__PURE__ */
|
|
303
|
-
icon:
|
|
304
|
+
children: /* @__PURE__ */ x(t, {
|
|
305
|
+
icon: B,
|
|
304
306
|
size: "sm"
|
|
305
307
|
})
|
|
306
308
|
}),
|
|
307
|
-
|
|
309
|
+
s("undo") && /* @__PURE__ */ x(K, {
|
|
308
310
|
onClick: () => e.chain().focus().undo().run(),
|
|
309
311
|
disabled: !o.canUndo,
|
|
310
312
|
title: "Undo",
|
|
311
|
-
children: /* @__PURE__ */
|
|
312
|
-
icon:
|
|
313
|
+
children: /* @__PURE__ */ x(t, {
|
|
314
|
+
icon: E,
|
|
313
315
|
size: "sm"
|
|
314
316
|
})
|
|
315
317
|
}),
|
|
316
|
-
|
|
318
|
+
s("redo") && /* @__PURE__ */ x(K, {
|
|
317
319
|
onClick: () => e.chain().focus().redo().run(),
|
|
318
320
|
disabled: !o.canRedo,
|
|
319
321
|
title: "Redo",
|
|
320
|
-
children: /* @__PURE__ */
|
|
321
|
-
icon:
|
|
322
|
+
children: /* @__PURE__ */ x(t, {
|
|
323
|
+
icon: D,
|
|
322
324
|
size: "sm"
|
|
323
325
|
})
|
|
324
326
|
})
|
|
325
327
|
]
|
|
326
328
|
});
|
|
327
329
|
}
|
|
328
|
-
var
|
|
329
|
-
function
|
|
330
|
-
let [n, r] =
|
|
331
|
-
|
|
332
|
-
|
|
330
|
+
var X = b.lazy(() => import("@emoji-mart/react"));
|
|
331
|
+
function Z({ set: e = "native", onSelect: t }) {
|
|
332
|
+
let [n, r] = b.useState(null), { colorMode: i } = p();
|
|
333
|
+
b.useEffect(() => {
|
|
334
|
+
m(e).then((e) => r(e));
|
|
333
335
|
}, [e]);
|
|
334
|
-
let a = /* @__PURE__ */
|
|
336
|
+
let a = /* @__PURE__ */ x("div", {
|
|
335
337
|
className: "flex h-[350px] w-[352px] items-center justify-center rounded-surface bg-surface-overlay shadow-raised-hover",
|
|
336
|
-
children: /* @__PURE__ */
|
|
338
|
+
children: /* @__PURE__ */ x("span", {
|
|
337
339
|
className: "text-ds-sm text-surface-fg-subtle",
|
|
338
340
|
children: "Loading..."
|
|
339
341
|
})
|
|
340
342
|
});
|
|
341
|
-
return n ? /* @__PURE__ */ b
|
|
343
|
+
return n ? /* @__PURE__ */ x(b.Suspense, {
|
|
342
344
|
fallback: a,
|
|
343
|
-
children: /* @__PURE__ */
|
|
345
|
+
children: /* @__PURE__ */ x(X, {
|
|
344
346
|
data: n,
|
|
345
347
|
set: e,
|
|
346
348
|
onEmojiSelect: (e) => t({
|
|
@@ -353,8 +355,8 @@ function X({ set: e = "native", onSelect: t }) {
|
|
|
353
355
|
})
|
|
354
356
|
}) : a;
|
|
355
357
|
}
|
|
356
|
-
var
|
|
357
|
-
let N =
|
|
358
|
+
var Q = b.forwardRef(function({ content: t = "", placeholder: n = "Start writing...", onChange: c, className: p, editable: C = !0, toolbar: w, onImageUpload: T, onFileUpload: E, mentions: D, onMentionSearch: O, onMentionSelect: k, emojiSet: A = "native", ...j }, M) {
|
|
359
|
+
let N = b.useRef(null), P = b.useRef(!1), [F, I] = b.useState(!1), L = b.useRef(null), R = b.useRef(null), z = b.useRef(null), B = async (e) => {
|
|
358
360
|
let t = N.current;
|
|
359
361
|
if (t) if (T) {
|
|
360
362
|
let n = await T(e);
|
|
@@ -377,10 +379,10 @@ var Z = y.forwardRef(function({ content: t = "", placeholder: s = "Start writing
|
|
|
377
379
|
size: n.size
|
|
378
380
|
}
|
|
379
381
|
}).run();
|
|
380
|
-
}, H =
|
|
382
|
+
}, H = i({
|
|
381
383
|
immediatelyRender: !1,
|
|
382
384
|
extensions: [
|
|
383
|
-
|
|
385
|
+
u.configure({
|
|
384
386
|
heading: { levels: [2, 3] },
|
|
385
387
|
link: {
|
|
386
388
|
openOnClick: !1,
|
|
@@ -396,12 +398,12 @@ var Z = y.forwardRef(function({ content: t = "", placeholder: s = "Start writing
|
|
|
396
398
|
}
|
|
397
399
|
}
|
|
398
400
|
}),
|
|
399
|
-
|
|
400
|
-
placeholder:
|
|
401
|
+
a.configure({
|
|
402
|
+
placeholder: n,
|
|
401
403
|
emptyEditorClass: "before:content-[attr(data-placeholder)] before:text-surface-fg-subtle before:float-left before:h-0 before:pointer-events-none"
|
|
402
404
|
}),
|
|
403
|
-
|
|
404
|
-
|
|
405
|
+
s.configure({ multicolor: !1 }),
|
|
406
|
+
d.configure({
|
|
405
407
|
bulletList: !1,
|
|
406
408
|
orderedList: !1,
|
|
407
409
|
listItem: !1,
|
|
@@ -409,21 +411,21 @@ var Z = y.forwardRef(function({ content: t = "", placeholder: s = "Start writing
|
|
|
409
411
|
taskList: {},
|
|
410
412
|
taskItem: { nested: !0 }
|
|
411
413
|
}),
|
|
412
|
-
|
|
413
|
-
|
|
414
|
+
f.configure({ types: ["heading", "paragraph"] }),
|
|
415
|
+
l.configure({
|
|
414
416
|
allowBase64: !0,
|
|
415
417
|
HTMLAttributes: { class: "max-w-full rounded-control" }
|
|
416
418
|
}),
|
|
417
|
-
|
|
418
|
-
...D || O ? [
|
|
419
|
+
v,
|
|
420
|
+
...D || O ? [o.configure({
|
|
419
421
|
HTMLAttributes: { class: "mention" },
|
|
420
422
|
suggestion: {
|
|
421
423
|
items: async ({ query: e }) => O ? await O(e) : D ? D.filter((t) => t.label.toLowerCase().includes(e.toLowerCase())).slice(0, 8) : [],
|
|
422
|
-
render:
|
|
424
|
+
render: y(k)
|
|
423
425
|
}
|
|
424
426
|
})] : [],
|
|
425
|
-
|
|
426
|
-
|
|
427
|
+
g,
|
|
428
|
+
_(A)
|
|
427
429
|
],
|
|
428
430
|
content: t,
|
|
429
431
|
editable: C,
|
|
@@ -437,38 +439,38 @@ var Z = y.forwardRef(function({ content: t = "", placeholder: s = "Start writing
|
|
|
437
439
|
let n = t.clipboardData?.files[0];
|
|
438
440
|
return n ? n.type.startsWith("image/") ? (B(n), !0) : E ? (V(n), !0) : !1 : !1;
|
|
439
441
|
},
|
|
440
|
-
attributes: { class: e(...
|
|
442
|
+
attributes: { class: e(...G, "focus:outline-hidden", "min-h-[120px] px-ds-04 py-ds-04") }
|
|
441
443
|
},
|
|
442
444
|
onUpdate: ({ editor: e }) => {
|
|
443
|
-
P.current = !0,
|
|
445
|
+
P.current = !0, c?.(e.getHTML()), queueMicrotask(() => {
|
|
444
446
|
P.current = !1;
|
|
445
447
|
});
|
|
446
448
|
}
|
|
447
449
|
});
|
|
448
|
-
return
|
|
450
|
+
return b.useEffect(() => {
|
|
449
451
|
N.current = H;
|
|
450
|
-
}, [H]),
|
|
452
|
+
}, [H]), b.useEffect(() => {
|
|
451
453
|
if (!F) return;
|
|
452
454
|
let e = (e) => {
|
|
453
455
|
L.current && !L.current.contains(e.target) && I(!1);
|
|
454
456
|
};
|
|
455
457
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
456
|
-
}, [F]),
|
|
458
|
+
}, [F]), b.useEffect(() => {
|
|
457
459
|
P.current || H && t !== H.getHTML() && H.commands.setContent(t, { emitUpdate: !1 });
|
|
458
|
-
}, [H, t]), H ? /* @__PURE__ */
|
|
460
|
+
}, [H, t]), H ? /* @__PURE__ */ S("div", {
|
|
459
461
|
ref: M,
|
|
460
462
|
...j,
|
|
461
|
-
className: e("relative",
|
|
462
|
-
children: [F && /* @__PURE__ */
|
|
463
|
+
className: e("relative", p),
|
|
464
|
+
children: [F && /* @__PURE__ */ x("div", {
|
|
463
465
|
ref: L,
|
|
464
466
|
className: "absolute bottom-full right-0 z-popover mb-ds-02",
|
|
465
467
|
onKeyDown: (e) => {
|
|
466
468
|
e.key === "Escape" && (e.stopPropagation(), I(!1));
|
|
467
469
|
},
|
|
468
|
-
children: /* @__PURE__ */
|
|
470
|
+
children: /* @__PURE__ */ x(Z, {
|
|
469
471
|
set: A,
|
|
470
472
|
onSelect: async ({ id: e, native: t }) => {
|
|
471
|
-
let n =
|
|
473
|
+
let n = h(await m(A), e);
|
|
472
474
|
n ? H.chain().focus().insertContent({
|
|
473
475
|
type: "emojiNode",
|
|
474
476
|
attrs: {
|
|
@@ -481,10 +483,10 @@ var Z = y.forwardRef(function({ content: t = "", placeholder: s = "Start writing
|
|
|
481
483
|
}).run() : H.chain().focus().insertContent(t).run(), I(!1);
|
|
482
484
|
}
|
|
483
485
|
})
|
|
484
|
-
}), /* @__PURE__ */
|
|
486
|
+
}), /* @__PURE__ */ S("div", {
|
|
485
487
|
className: e("overflow-hidden rounded-surface border border-surface-border-strong bg-surface-raised", "transition-colors ease-productive-standard focus-within:border-surface-border-strong"),
|
|
486
488
|
children: [
|
|
487
|
-
/* @__PURE__ */
|
|
489
|
+
/* @__PURE__ */ x("input", {
|
|
488
490
|
ref: R,
|
|
489
491
|
type: "file",
|
|
490
492
|
accept: "image/*",
|
|
@@ -495,7 +497,7 @@ var Z = y.forwardRef(function({ content: t = "", placeholder: s = "Start writing
|
|
|
495
497
|
t && B(t), e.target.value = "";
|
|
496
498
|
}
|
|
497
499
|
}),
|
|
498
|
-
E && /* @__PURE__ */
|
|
500
|
+
E && /* @__PURE__ */ x("input", {
|
|
499
501
|
ref: z,
|
|
500
502
|
type: "file",
|
|
501
503
|
"aria-label": "Upload file",
|
|
@@ -505,24 +507,24 @@ var Z = y.forwardRef(function({ content: t = "", placeholder: s = "Start writing
|
|
|
505
507
|
t && V(t), e.target.value = "";
|
|
506
508
|
}
|
|
507
509
|
}),
|
|
508
|
-
C && /* @__PURE__ */
|
|
510
|
+
C && /* @__PURE__ */ x(Y, {
|
|
509
511
|
editor: H,
|
|
510
512
|
toolbar: w,
|
|
511
513
|
onImageClick: () => R.current?.click(),
|
|
512
514
|
onFileClick: E ? () => z.current?.click() : void 0,
|
|
513
515
|
onEmojiClick: () => I((e) => !e)
|
|
514
516
|
}),
|
|
515
|
-
/* @__PURE__ */
|
|
517
|
+
/* @__PURE__ */ x(r, { editor: H })
|
|
516
518
|
]
|
|
517
519
|
})]
|
|
518
520
|
}) : null;
|
|
519
521
|
});
|
|
520
|
-
|
|
521
|
-
var
|
|
522
|
-
let p =
|
|
522
|
+
Q.displayName = "RichTextEditor";
|
|
523
|
+
var $ = b.forwardRef(function({ content: t, className: n, ...a }, c) {
|
|
524
|
+
let p = i({
|
|
523
525
|
immediatelyRender: !1,
|
|
524
526
|
extensions: [
|
|
525
|
-
|
|
527
|
+
u.configure({
|
|
526
528
|
heading: { levels: [2, 3] },
|
|
527
529
|
link: {
|
|
528
530
|
openOnClick: !0,
|
|
@@ -538,8 +540,8 @@ var Q = y.forwardRef(function({ content: t, className: i, ...s }, f) {
|
|
|
538
540
|
}
|
|
539
541
|
}
|
|
540
542
|
}),
|
|
541
|
-
|
|
542
|
-
|
|
543
|
+
s.configure({ multicolor: !1 }),
|
|
544
|
+
d.configure({
|
|
543
545
|
bulletList: !1,
|
|
544
546
|
orderedList: !1,
|
|
545
547
|
listItem: !1,
|
|
@@ -547,25 +549,25 @@ var Q = y.forwardRef(function({ content: t, className: i, ...s }, f) {
|
|
|
547
549
|
taskList: {},
|
|
548
550
|
taskItem: { nested: !0 }
|
|
549
551
|
}),
|
|
550
|
-
|
|
551
|
-
|
|
552
|
+
f.configure({ types: ["heading", "paragraph"] }),
|
|
553
|
+
l.configure({
|
|
552
554
|
allowBase64: !0,
|
|
553
555
|
HTMLAttributes: { class: "max-w-full rounded-control" }
|
|
554
556
|
}),
|
|
555
|
-
|
|
556
|
-
|
|
557
|
+
v,
|
|
558
|
+
o.configure({ HTMLAttributes: { class: "mention" } })
|
|
557
559
|
],
|
|
558
560
|
content: t,
|
|
559
561
|
editable: !1,
|
|
560
|
-
editorProps: { attributes: { class: e(...
|
|
562
|
+
editorProps: { attributes: { class: e(...G) } }
|
|
561
563
|
});
|
|
562
|
-
return p ? /* @__PURE__ */
|
|
563
|
-
ref:
|
|
564
|
-
...
|
|
565
|
-
className:
|
|
566
|
-
children: /* @__PURE__ */
|
|
564
|
+
return p ? /* @__PURE__ */ x("div", {
|
|
565
|
+
ref: c,
|
|
566
|
+
...a,
|
|
567
|
+
className: n,
|
|
568
|
+
children: /* @__PURE__ */ x(r, { editor: p })
|
|
567
569
|
}) : null;
|
|
568
570
|
});
|
|
569
|
-
|
|
571
|
+
$.displayName = "RichTextViewer";
|
|
570
572
|
//#endregion
|
|
571
|
-
export {
|
|
573
|
+
export { Q as RichTextEditor, $ as RichTextViewer };
|