@devalok/shilp-sutra 0.27.2 → 0.29.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/_chunks/badge-group.js +299 -0
- package/dist/_chunks/framer.js +1915 -1980
- package/dist/_chunks/keybinding.js +4 -5
- package/dist/_chunks/primitives.js +3198 -3272
- package/dist/_chunks/sonner.js +29 -31
- package/dist/_chunks/stat-row.js +110 -131
- package/dist/_chunks/tiptap.js +42 -78
- package/dist/_chunks/tree-view.js +138 -149
- package/dist/_chunks/typing-indicator.js +565 -0
- package/dist/_chunks/use-calendar.js +416 -439
- package/dist/_chunks/vendor-client.js +977 -814
- package/dist/_chunks/vendor-utils.js +5 -5
- package/dist/ai/block-renderer.js +22 -22
- package/dist/ai/blocks/loading.d.ts.map +1 -1
- package/dist/ai/command-bar.d.ts.map +1 -1
- package/dist/ai/command-bar.js +241 -263
- package/dist/ai/conversation.d.ts.map +1 -1
- package/dist/ai/conversation.js +87 -107
- package/dist/composed/activity-feed.d.ts +2 -0
- package/dist/composed/activity-feed.d.ts.map +1 -1
- package/dist/composed/activity-feed.js +118 -90
- package/dist/composed/avatar-group.d.ts +1 -0
- package/dist/composed/avatar-group.d.ts.map +1 -1
- package/dist/composed/avatar-group.js +91 -67
- package/dist/composed/bulk-action-bar.d.ts.map +1 -1
- package/dist/composed/bulk-action-bar.js +29 -28
- package/dist/composed/command-palette.d.ts.map +1 -1
- package/dist/composed/command-palette.js +99 -113
- package/dist/composed/content-card.js +1 -1
- package/dist/composed/date-picker/calendar-grid.d.ts.map +1 -1
- package/dist/composed/date-picker/date-picker.d.ts.map +1 -1
- package/dist/composed/date-picker/date-range-picker.d.ts.map +1 -1
- package/dist/composed/date-picker/date-time-picker.d.ts.map +1 -1
- package/dist/composed/date-picker/time-picker.d.ts.map +1 -1
- package/dist/composed/deadline-indicator.d.ts.map +1 -1
- package/dist/composed/deadline-indicator.js +29 -28
- package/dist/composed/error-boundary.d.ts.map +1 -1
- package/dist/composed/error-boundary.js +30 -27
- package/dist/composed/extensions/file-attachment.d.ts.map +1 -1
- package/dist/composed/file-preview.d.ts.map +1 -1
- package/dist/composed/file-preview.js +261 -271
- package/dist/composed/filter-bar.d.ts.map +1 -1
- package/dist/composed/filter-bar.js +49 -48
- package/dist/composed/form-section.d.ts.map +1 -1
- package/dist/composed/form-section.js +12 -11
- package/dist/composed/global-loading.js +1 -1
- package/dist/composed/index.js +63 -63
- package/dist/composed/inline-edit.d.ts.map +1 -1
- package/dist/composed/inline-edit.js +55 -54
- package/dist/composed/markdown-viewer.d.ts.map +1 -1
- package/dist/composed/markdown-viewer.js +44 -43
- package/dist/composed/master-detail.d.ts.map +1 -1
- package/dist/composed/master-detail.js +35 -34
- package/dist/composed/multi-select-popover.d.ts.map +1 -1
- package/dist/composed/multi-select-popover.js +64 -64
- package/dist/composed/page-header.d.ts.map +1 -1
- package/dist/composed/page-header.js +31 -37
- package/dist/composed/priority-indicator.d.ts.map +1 -1
- package/dist/composed/priority-indicator.js +37 -36
- package/dist/composed/rich-text-editor.d.ts.map +1 -1
- package/dist/composed/rich-text-editor.js +287 -306
- package/dist/composed/schedule-view.js +62 -62
- package/dist/composed/status-badge.d.ts +4 -2
- package/dist/composed/status-badge.d.ts.map +1 -1
- package/dist/composed/status-badge.js +58 -45
- package/dist/shell/app-command-palette.d.ts.map +1 -1
- package/dist/shell/app-command-palette.js +93 -93
- package/dist/shell/bottom-navbar.d.ts.map +1 -1
- package/dist/shell/bottom-navbar.js +21 -20
- package/dist/shell/index.js +18 -18
- package/dist/shell/notification-center.d.ts.map +1 -1
- package/dist/shell/notification-center.js +96 -95
- package/dist/shell/notification-preferences.d.ts.map +1 -1
- package/dist/shell/notification-preferences.js +82 -85
- package/dist/shell/sidebar.js +59 -60
- package/dist/shell/top-bar.d.ts.map +1 -1
- package/dist/shell/top-bar.js +103 -103
- package/dist/tailwind/index.cjs +37 -4
- package/dist/tailwind/preset.d.ts.map +1 -1
- package/dist/tailwind/preset.js +38 -5
- package/dist/tokens/primitives.css +10 -0
- package/dist/tokens/semantic.css +70 -7
- package/dist/ui/accordion.d.ts +5 -2
- package/dist/ui/accordion.d.ts.map +1 -1
- package/dist/ui/accordion.js +44 -39
- package/dist/ui/alert-dialog.js +57 -57
- package/dist/ui/alert.d.ts +1 -1
- package/dist/ui/alert.d.ts.map +1 -1
- package/dist/ui/alert.js +30 -29
- package/dist/ui/aspect-ratio.js +4 -4
- package/dist/ui/autocomplete.js +56 -56
- package/dist/ui/avatar.js +2 -2
- package/dist/ui/badge-group.d.ts +22 -0
- package/dist/ui/badge-group.d.ts.map +1 -0
- package/dist/ui/badge-group.js +8 -0
- package/dist/ui/badge-indicator.d.ts +32 -0
- package/dist/ui/badge-indicator.d.ts.map +1 -0
- package/dist/ui/badge-indicator.js +54 -0
- package/dist/ui/badge.d.ts +27 -24
- package/dist/ui/badge.d.ts.map +1 -1
- package/dist/ui/badge.js +13 -129
- package/dist/ui/banner.d.ts +1 -1
- package/dist/ui/banner.d.ts.map +1 -1
- package/dist/ui/banner.js +27 -26
- package/dist/ui/breadcrumb.d.ts.map +1 -1
- package/dist/ui/breadcrumb.js +37 -36
- package/dist/ui/button-group.d.ts +12 -6
- package/dist/ui/button-group.d.ts.map +1 -1
- package/dist/ui/button-group.js +18 -18
- package/dist/ui/button-processing.d.ts +15 -0
- package/dist/ui/button-processing.d.ts.map +1 -0
- package/dist/ui/button-processing.js +77 -0
- package/dist/ui/button.d.ts +50 -25
- package/dist/ui/button.d.ts.map +1 -1
- package/dist/ui/button.js +243 -127
- package/dist/ui/card.js +20 -21
- package/dist/ui/charts/index.js +499 -508
- package/dist/ui/chat/date-separator.d.ts +12 -0
- package/dist/ui/chat/date-separator.d.ts.map +1 -0
- package/dist/ui/chat/index.d.ts +9 -0
- package/dist/ui/chat/index.d.ts.map +1 -0
- package/dist/ui/chat/index.js +12 -0
- package/dist/ui/chat/message-input.d.ts +16 -0
- package/dist/ui/chat/message-input.d.ts.map +1 -0
- package/dist/ui/chat/message-list.d.ts +24 -0
- package/dist/ui/chat/message-list.d.ts.map +1 -0
- package/dist/ui/chat/message.d.ts +108 -0
- package/dist/ui/chat/message.d.ts.map +1 -0
- package/dist/ui/chat/system-message.d.ts +11 -0
- package/dist/ui/chat/system-message.d.ts.map +1 -0
- package/dist/ui/chat/typing-indicator.d.ts +14 -0
- package/dist/ui/chat/typing-indicator.d.ts.map +1 -0
- package/dist/ui/chat/unread-separator.d.ts +12 -0
- package/dist/ui/chat/unread-separator.d.ts.map +1 -0
- package/dist/ui/checkbox.js +18 -18
- package/dist/ui/chip.d.ts +13 -62
- package/dist/ui/chip.d.ts.map +1 -1
- package/dist/ui/chip.js +10 -109
- package/dist/ui/collapsible.js +4 -4
- package/dist/ui/color-input.d.ts +19 -5
- package/dist/ui/color-input.d.ts.map +1 -1
- package/dist/ui/color-input.js +371 -79
- package/dist/ui/color-swatch.js +11 -11
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/combobox.js +74 -80
- package/dist/ui/context-menu.d.ts.map +1 -1
- package/dist/ui/context-menu.js +86 -85
- package/dist/ui/data-table-toolbar.d.ts.map +1 -1
- package/dist/ui/data-table-toolbar.js +51 -57
- package/dist/ui/data-table.d.ts.map +1 -1
- package/dist/ui/data-table.js +268 -296
- package/dist/ui/devalok-grain.d.ts +81 -0
- package/dist/ui/devalok-grain.d.ts.map +1 -0
- package/dist/ui/devalok-grain.js +69 -0
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +73 -72
- package/dist/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/ui/dropdown-menu.js +93 -92
- package/dist/ui/file-upload.d.ts.map +1 -1
- package/dist/ui/file-upload.js +82 -82
- package/dist/ui/hover-card.js +29 -29
- package/dist/ui/icon-button.d.ts +7 -7
- package/dist/ui/icon-button.d.ts.map +1 -1
- package/dist/ui/icon-context.d.ts +15 -0
- package/dist/ui/icon-context.d.ts.map +1 -0
- package/dist/ui/icon-context.js +20 -0
- package/dist/ui/icon-group.d.ts +22 -0
- package/dist/ui/icon-group.d.ts.map +1 -0
- package/dist/ui/icon-group.js +32 -0
- package/dist/ui/icon.d.ts +57 -0
- package/dist/ui/icon.d.ts.map +1 -0
- package/dist/ui/icon.js +122 -0
- package/dist/ui/index.d.ts +8 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +351 -329
- package/dist/ui/input-otp.d.ts.map +1 -1
- package/dist/ui/input-otp.js +21 -20
- package/dist/ui/input.d.ts +32 -11
- package/dist/ui/input.d.ts.map +1 -1
- package/dist/ui/input.js +149 -44
- package/dist/ui/label.js +1 -1
- package/dist/ui/lib/motion.d.ts +2 -0
- package/dist/ui/lib/motion.d.ts.map +1 -1
- package/dist/ui/lib/motion.js +13 -11
- package/dist/ui/lib/utils.js +1 -1
- package/dist/ui/menubar.d.ts.map +1 -1
- package/dist/ui/menubar.js +87 -86
- package/dist/ui/navigation-menu.d.ts.map +1 -1
- package/dist/ui/navigation-menu.js +23 -28
- package/dist/ui/number-input.d.ts.map +1 -1
- package/dist/ui/number-input.js +54 -53
- package/dist/ui/pagination.d.ts.map +1 -1
- package/dist/ui/pagination.js +45 -44
- package/dist/ui/popover.js +30 -30
- package/dist/ui/progress.d.ts +3 -1
- package/dist/ui/progress.d.ts.map +1 -1
- package/dist/ui/progress.js +43 -39
- package/dist/ui/radio.js +1 -1
- package/dist/ui/search-input.d.ts.map +1 -1
- package/dist/ui/search-input.js +47 -60
- package/dist/ui/segmented-control.js +1 -1
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +54 -53
- package/dist/ui/separator.js +5 -5
- package/dist/ui/sheet.d.ts.map +1 -1
- package/dist/ui/sheet.js +46 -45
- package/dist/ui/sidebar.d.ts.map +1 -1
- package/dist/ui/sidebar.js +196 -193
- package/dist/ui/skeleton.js +1 -1
- package/dist/ui/slider.js +1 -1
- package/dist/ui/spinner.js +74 -74
- package/dist/ui/stat-card.d.ts.map +1 -1
- package/dist/ui/stat-card.js +85 -86
- package/dist/ui/switch.d.ts +3 -0
- package/dist/ui/switch.d.ts.map +1 -1
- package/dist/ui/switch.js +40 -26
- package/dist/ui/tabs.js +43 -43
- package/dist/ui/text.js +1 -1
- package/dist/ui/textarea.js +10 -10
- package/dist/ui/toast.d.ts.map +1 -1
- package/dist/ui/toast.js +169 -169
- package/dist/ui/toggle-group.js +1 -1
- package/dist/ui/toggle.js +5 -5
- package/dist/ui/tooltip.js +41 -41
- package/dist/ui/tree-view/tree-item.d.ts.map +1 -1
- package/docs/components/_header.md +4 -4
- package/docs/components/composed/activity-feed.md +7 -0
- package/docs/components/composed/avatar-group.md +8 -5
- package/docs/components/composed/status-badge.md +14 -1
- package/docs/components/ui/accordion.md +5 -2
- package/docs/components/ui/badge-group.md +38 -0
- package/docs/components/ui/badge-indicator.md +40 -0
- package/docs/components/ui/badge.md +36 -5
- package/docs/components/ui/button-processing.md +15 -0
- package/docs/components/ui/button.md +40 -11
- package/docs/components/ui/chat.md +214 -0
- package/docs/components/ui/color-input.md +58 -4
- package/docs/components/ui/data-table.md +3 -0
- package/docs/components/ui/devalok-grain.md +55 -0
- package/docs/components/ui/icon-button.md +12 -5
- package/docs/components/ui/icon-context.md +38 -0
- package/docs/components/ui/icon-group.md +36 -0
- package/docs/components/ui/icon.md +47 -0
- package/docs/components/ui/input.md +32 -6
- package/docs/components/ui/progress.md +5 -0
- package/docs/components/ui/spinner.md +3 -0
- package/docs/components/ui/switch.md +13 -0
- package/llms-full.txt +724 -44
- package/llms.txt +38 -19
- package/package.json +8 -2
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as t, jsxs as
|
|
3
|
-
import * as
|
|
4
|
-
import { N as Y, R as Z, m as ee, a as te, E as
|
|
5
|
-
import { IconFile as ie, IconDownload as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { jsx as t, jsxs as p } from "react/jsx-runtime";
|
|
3
|
+
import * as c from "react";
|
|
4
|
+
import { N as Y, R as Z, m as ee, a as te, E as ne, S as re, u as H, U as j, T as D, b as B, P as se, H as M, c as P, d as U, L as K, I as $, M as q, e as O } from "../_chunks/tiptap.js";
|
|
5
|
+
import { IconFile as ie, IconDownload as oe, IconBold as le, IconItalic as ae, IconUnderline as ce, IconStrikethrough as ue, IconHighlight as de, IconH2 as fe, IconH3 as me, IconBlockquote as ge, IconList as he, IconListNumbers as pe, IconListCheck as be, IconCode as xe, IconPhoto as ve, IconPaperclip as ke, IconLineDashed as ye, IconAlignLeft as we, IconAlignCenter as Ae, IconAlignRight as _e, IconMoodSmile as Ce, IconArrowBackUp as Ie, IconArrowForwardUp as Le, IconLink as Re } from "@tabler/icons-react";
|
|
6
|
+
import { Icon as u } from "../ui/icon.js";
|
|
7
|
+
import { createRoot as V } from "react-dom/client";
|
|
8
|
+
import { cn as x } from "../ui/lib/utils.js";
|
|
8
9
|
import { useColorMode as Ee } from "../hooks/use-color-mode.js";
|
|
9
|
-
function
|
|
10
|
+
function ze(e) {
|
|
10
11
|
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
return /* @__PURE__ */ t(te, { className: "my-ds-02", children: /* @__PURE__ */
|
|
13
|
+
function Ne({ node: e }) {
|
|
14
|
+
const n = /^https?:\/\//.test(e.attrs.url) ? e.attrs.url : "#";
|
|
15
|
+
return /* @__PURE__ */ t(te, { className: "my-ds-02", children: /* @__PURE__ */ p(
|
|
15
16
|
"a",
|
|
16
17
|
{
|
|
17
|
-
href:
|
|
18
|
+
href: n,
|
|
18
19
|
target: "_blank",
|
|
19
20
|
rel: "noopener noreferrer",
|
|
20
21
|
className: "inline-flex items-center gap-ds-03 rounded-ds-md border border-surface-border-strong bg-surface-raised px-ds-04 py-ds-03 text-ds-sm text-surface-fg transition-colors hover:border-surface-border-strong hover:bg-surface-raised-hover",
|
|
21
22
|
contentEditable: !1,
|
|
22
23
|
children: [
|
|
23
|
-
/* @__PURE__ */ t(
|
|
24
|
+
/* @__PURE__ */ t(u, { icon: ie, size: "sm", className: "shrink-0 text-surface-fg-subtle" }),
|
|
24
25
|
/* @__PURE__ */ t("span", { className: "truncate", children: e.attrs.name }),
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ p("span", { className: "shrink-0 text-surface-fg-subtle", children: [
|
|
26
27
|
"(",
|
|
27
|
-
|
|
28
|
+
ze(e.attrs.size),
|
|
28
29
|
")"
|
|
29
30
|
] }),
|
|
30
|
-
/* @__PURE__ */ t(
|
|
31
|
+
/* @__PURE__ */ t(u, { icon: oe, size: "sm", className: "shrink-0 text-surface-fg-subtle" })
|
|
31
32
|
]
|
|
32
33
|
}
|
|
33
34
|
) });
|
|
34
35
|
}
|
|
35
|
-
const
|
|
36
|
+
const F = Y.create({
|
|
36
37
|
name: "fileAttachment",
|
|
37
38
|
group: "block",
|
|
38
39
|
atom: !0,
|
|
@@ -50,172 +51,165 @@ const G = Y.create({
|
|
|
50
51
|
return ["div", ee({ "data-file-attachment": "" }, e)];
|
|
51
52
|
},
|
|
52
53
|
addNodeView() {
|
|
53
|
-
return Z(
|
|
54
|
+
return Z(Ne);
|
|
54
55
|
}
|
|
55
|
-
}),
|
|
56
|
-
({ items: e, command:
|
|
57
|
-
const [
|
|
58
|
-
return
|
|
59
|
-
onKeyDown: ({ event:
|
|
60
|
-
})), e.length ? /* @__PURE__ */ t("div", { role: "listbox", "aria-label": "Mention suggestions", className: "z-popover overflow-hidden rounded-ds-md border border-surface-border-strong bg-surface-overlay shadow-raised-hover", children: e.map((
|
|
56
|
+
}), z = c.forwardRef(
|
|
57
|
+
({ items: e, command: n }, r) => {
|
|
58
|
+
const [o, i] = c.useState(0);
|
|
59
|
+
return c.useEffect(() => i(0), [e]), c.useImperativeHandle(r, () => ({
|
|
60
|
+
onKeyDown: ({ event: s }) => s.key === "ArrowUp" ? (i((l) => (l + e.length - 1) % e.length), !0) : s.key === "ArrowDown" ? (i((l) => (l + 1) % e.length), !0) : s.key === "Enter" ? (e[o] && n(e[o]), !0) : !1
|
|
61
|
+
})), e.length ? /* @__PURE__ */ t("div", { role: "listbox", "aria-label": "Mention suggestions", className: "z-popover overflow-hidden rounded-ds-md border border-surface-border-strong bg-surface-overlay shadow-raised-hover", children: e.map((s, l) => /* @__PURE__ */ p(
|
|
61
62
|
"button",
|
|
62
63
|
{
|
|
63
64
|
type: "button",
|
|
64
65
|
role: "option",
|
|
65
|
-
"aria-selected":
|
|
66
|
-
onClick: () => s
|
|
67
|
-
className:
|
|
66
|
+
"aria-selected": l === o,
|
|
67
|
+
onClick: () => n(s),
|
|
68
|
+
className: x(
|
|
68
69
|
"flex w-full items-center gap-ds-03 px-ds-04 py-ds-02b text-left text-ds-sm",
|
|
69
|
-
|
|
70
|
+
l === o ? "bg-surface-raised text-surface-fg" : "text-surface-fg-muted hover:bg-surface-raised"
|
|
70
71
|
),
|
|
71
72
|
children: [
|
|
72
|
-
|
|
73
|
-
/* @__PURE__ */ t("span", { children:
|
|
73
|
+
s.avatar ? /* @__PURE__ */ t("img", { src: s.avatar, alt: "", className: "h-ico-md w-ico-md rounded-ds-full object-cover" }) : /* @__PURE__ */ t("span", { className: "flex h-ico-md w-ico-md items-center justify-center rounded-ds-full bg-accent-2 text-[10px] font-semibold text-accent-11", children: s.label.charAt(0).toUpperCase() }),
|
|
74
|
+
/* @__PURE__ */ t("span", { children: s.label })
|
|
74
75
|
]
|
|
75
76
|
},
|
|
76
|
-
|
|
77
|
+
s.id
|
|
77
78
|
)) }) : null;
|
|
78
79
|
}
|
|
79
80
|
);
|
|
80
|
-
|
|
81
|
-
function
|
|
81
|
+
z.displayName = "MentionList";
|
|
82
|
+
function Te(e) {
|
|
82
83
|
return () => {
|
|
83
|
-
let
|
|
84
|
+
let n = null, r = null, o = null;
|
|
84
85
|
return {
|
|
85
|
-
onStart: (
|
|
86
|
-
var c;
|
|
86
|
+
onStart: (i) => {
|
|
87
87
|
r = document.createElement("div"), r.style.position = "absolute", r.style.zIndex = "1400";
|
|
88
|
-
const
|
|
89
|
-
|
|
88
|
+
const s = i.clientRect?.();
|
|
89
|
+
s && (r.style.left = `${s.left}px`, r.style.top = `${s.bottom + 4}px`), document.body.appendChild(r), n = V(r), n.render(
|
|
90
90
|
/* @__PURE__ */ t(
|
|
91
|
-
|
|
91
|
+
z,
|
|
92
92
|
{
|
|
93
|
-
ref: (
|
|
94
|
-
|
|
93
|
+
ref: (l) => {
|
|
94
|
+
o = l;
|
|
95
95
|
},
|
|
96
|
-
items:
|
|
97
|
-
command: (
|
|
98
|
-
|
|
96
|
+
items: i.items,
|
|
97
|
+
command: (l) => {
|
|
98
|
+
i.command({ id: l.id, label: l.label }), e?.(l);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
)
|
|
102
102
|
);
|
|
103
103
|
},
|
|
104
|
-
onUpdate: (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
i && (r.style.left = `${i.left}px`, r.style.top = `${i.bottom + 4}px`), s.render(
|
|
104
|
+
onUpdate: (i) => {
|
|
105
|
+
if (!n || !r) return;
|
|
106
|
+
const s = i.clientRect?.();
|
|
107
|
+
s && (r.style.left = `${s.left}px`, r.style.top = `${s.bottom + 4}px`), n.render(
|
|
109
108
|
/* @__PURE__ */ t(
|
|
110
|
-
|
|
109
|
+
z,
|
|
111
110
|
{
|
|
112
|
-
ref: (
|
|
113
|
-
|
|
111
|
+
ref: (l) => {
|
|
112
|
+
o = l;
|
|
114
113
|
},
|
|
115
|
-
items:
|
|
116
|
-
command: (
|
|
117
|
-
|
|
114
|
+
items: i.items,
|
|
115
|
+
command: (l) => {
|
|
116
|
+
i.command({ id: l.id, label: l.label }), e?.(l);
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
)
|
|
121
120
|
);
|
|
122
121
|
},
|
|
123
|
-
onKeyDown: (
|
|
122
|
+
onKeyDown: (i) => i.event.key === "Escape" ? (r && (n?.unmount(), r.remove(), r = null, n = null), !0) : o?.onKeyDown(i) ?? !1,
|
|
124
123
|
onExit: () => {
|
|
125
|
-
r && (
|
|
124
|
+
r && (n?.unmount(), r.remove(), r = null, n = null);
|
|
126
125
|
}
|
|
127
126
|
};
|
|
128
127
|
};
|
|
129
128
|
}
|
|
130
|
-
let
|
|
129
|
+
let A = null;
|
|
131
130
|
async function Se() {
|
|
132
|
-
if (
|
|
133
|
-
const e = await import("@emoji-mart/data"),
|
|
134
|
-
return
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
native: ((n = r.skins[0]) == null ? void 0 : n.native) ?? ""
|
|
140
|
-
};
|
|
141
|
-
}), _;
|
|
131
|
+
if (A) return A;
|
|
132
|
+
const e = await import("@emoji-mart/data"), n = e.default ?? e;
|
|
133
|
+
return A = Object.values(n.emojis).map((r) => ({
|
|
134
|
+
id: r.id,
|
|
135
|
+
name: r.name,
|
|
136
|
+
native: r.skins[0]?.native ?? ""
|
|
137
|
+
})), A;
|
|
142
138
|
}
|
|
143
|
-
const
|
|
144
|
-
({ items: e, command:
|
|
145
|
-
const [
|
|
146
|
-
return
|
|
147
|
-
onKeyDown: ({ event:
|
|
148
|
-
})), e.length ? /* @__PURE__ */ t("div", { role: "listbox", "aria-label": "Emoji suggestions", className: "z-popover max-h-[200px] overflow-x-hidden overflow-y-auto rounded-ds-md border border-surface-border-strong bg-surface-overlay shadow-raised-hover", children: e.map((
|
|
139
|
+
const N = c.forwardRef(
|
|
140
|
+
({ items: e, command: n }, r) => {
|
|
141
|
+
const [o, i] = c.useState(0);
|
|
142
|
+
return c.useEffect(() => i(0), [e]), c.useImperativeHandle(r, () => ({
|
|
143
|
+
onKeyDown: ({ event: s }) => s.key === "ArrowUp" ? (i((l) => (l + e.length - 1) % e.length), !0) : s.key === "ArrowDown" ? (i((l) => (l + 1) % e.length), !0) : s.key === "Enter" ? (e[o] && n(e[o]), !0) : !1
|
|
144
|
+
})), e.length ? /* @__PURE__ */ t("div", { role: "listbox", "aria-label": "Emoji suggestions", className: "z-popover max-h-[200px] overflow-x-hidden overflow-y-auto rounded-ds-md border border-surface-border-strong bg-surface-overlay shadow-raised-hover", children: e.map((s, l) => /* @__PURE__ */ p(
|
|
149
145
|
"button",
|
|
150
146
|
{
|
|
151
147
|
type: "button",
|
|
152
148
|
role: "option",
|
|
153
|
-
"aria-selected":
|
|
154
|
-
onClick: () => s
|
|
155
|
-
className:
|
|
149
|
+
"aria-selected": l === o,
|
|
150
|
+
onClick: () => n(s),
|
|
151
|
+
className: x(
|
|
156
152
|
"flex w-full items-center gap-ds-03 px-ds-04 py-ds-02b text-left text-ds-sm",
|
|
157
|
-
|
|
153
|
+
l === o ? "bg-surface-raised text-surface-fg" : "text-surface-fg-muted hover:bg-surface-raised"
|
|
158
154
|
),
|
|
159
155
|
children: [
|
|
160
|
-
/* @__PURE__ */ t("span", { className: "text-ds-base", children:
|
|
161
|
-
/* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ t("span", { className: "text-ds-base", children: s.native }),
|
|
157
|
+
/* @__PURE__ */ p("span", { className: "truncate", children: [
|
|
162
158
|
":",
|
|
163
|
-
|
|
159
|
+
s.id,
|
|
164
160
|
":"
|
|
165
161
|
] })
|
|
166
162
|
]
|
|
167
163
|
},
|
|
168
|
-
|
|
164
|
+
s.id
|
|
169
165
|
)) }) : null;
|
|
170
166
|
}
|
|
171
167
|
);
|
|
172
|
-
|
|
173
|
-
function
|
|
168
|
+
N.displayName = "EmojiList";
|
|
169
|
+
function He() {
|
|
174
170
|
return () => {
|
|
175
|
-
let e = null,
|
|
171
|
+
let e = null, n = null, r = null;
|
|
176
172
|
return {
|
|
177
|
-
onStart: (
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
a && (s.style.left = `${a.left}px`, s.style.top = `${a.bottom + 4}px`), document.body.appendChild(s), e = W(s), e.render(
|
|
173
|
+
onStart: (o) => {
|
|
174
|
+
n = document.createElement("div"), n.style.position = "absolute", n.style.zIndex = "1400";
|
|
175
|
+
const i = o.clientRect?.();
|
|
176
|
+
i && (n.style.left = `${i.left}px`, n.style.top = `${i.bottom + 4}px`), document.body.appendChild(n), e = V(n), e.render(
|
|
182
177
|
/* @__PURE__ */ t(
|
|
183
|
-
|
|
178
|
+
N,
|
|
184
179
|
{
|
|
185
|
-
ref: (
|
|
186
|
-
r =
|
|
180
|
+
ref: (s) => {
|
|
181
|
+
r = s;
|
|
187
182
|
},
|
|
188
|
-
items:
|
|
189
|
-
command: (
|
|
183
|
+
items: o.items,
|
|
184
|
+
command: (s) => o.command(s)
|
|
190
185
|
}
|
|
191
186
|
)
|
|
192
187
|
);
|
|
193
188
|
},
|
|
194
|
-
onUpdate: (
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
a && (s.style.left = `${a.left}px`, s.style.top = `${a.bottom + 4}px`), e.render(
|
|
189
|
+
onUpdate: (o) => {
|
|
190
|
+
if (!e || !n) return;
|
|
191
|
+
const i = o.clientRect?.();
|
|
192
|
+
i && (n.style.left = `${i.left}px`, n.style.top = `${i.bottom + 4}px`), e.render(
|
|
199
193
|
/* @__PURE__ */ t(
|
|
200
|
-
|
|
194
|
+
N,
|
|
201
195
|
{
|
|
202
|
-
ref: (
|
|
203
|
-
r =
|
|
196
|
+
ref: (s) => {
|
|
197
|
+
r = s;
|
|
204
198
|
},
|
|
205
|
-
items:
|
|
206
|
-
command: (
|
|
199
|
+
items: o.items,
|
|
200
|
+
command: (s) => o.command(s)
|
|
207
201
|
}
|
|
208
202
|
)
|
|
209
203
|
);
|
|
210
204
|
},
|
|
211
|
-
onKeyDown: (
|
|
205
|
+
onKeyDown: (o) => o.event.key === "Escape" ? (n && (e?.unmount(), n.remove(), n = null, e = null), !0) : r?.onKeyDown(o) ?? !1,
|
|
212
206
|
onExit: () => {
|
|
213
|
-
|
|
207
|
+
n && (e?.unmount(), n.remove(), n = null, e = null);
|
|
214
208
|
}
|
|
215
209
|
};
|
|
216
210
|
};
|
|
217
211
|
}
|
|
218
|
-
const
|
|
212
|
+
const je = ne.create({
|
|
219
213
|
name: "emojiSuggestion",
|
|
220
214
|
addProseMirrorPlugins() {
|
|
221
215
|
return [
|
|
@@ -223,19 +217,19 @@ const De = se.create({
|
|
|
223
217
|
editor: this.editor,
|
|
224
218
|
char: ":",
|
|
225
219
|
items: async ({ query: e }) => {
|
|
226
|
-
const
|
|
227
|
-
return e ?
|
|
220
|
+
const n = await Se();
|
|
221
|
+
return e ? n.filter(
|
|
228
222
|
(r) => r.id.includes(e.toLowerCase()) || r.name.toLowerCase().includes(e.toLowerCase())
|
|
229
|
-
).slice(0, 8) :
|
|
223
|
+
).slice(0, 8) : n.slice(0, 8);
|
|
230
224
|
},
|
|
231
|
-
command: ({ editor: e, range:
|
|
232
|
-
e.chain().focus().deleteRange(
|
|
225
|
+
command: ({ editor: e, range: n, props: r }) => {
|
|
226
|
+
e.chain().focus().deleteRange(n).insertContent(r.native).run();
|
|
233
227
|
},
|
|
234
|
-
render:
|
|
228
|
+
render: He()
|
|
235
229
|
})
|
|
236
230
|
];
|
|
237
231
|
}
|
|
238
|
-
}),
|
|
232
|
+
}), W = [
|
|
239
233
|
"prose prose-sm max-w-none",
|
|
240
234
|
"font-body text-ds-md leading-relaxed text-surface-fg",
|
|
241
235
|
"[&_h2]:text-ds-xl [&_h2]:mb-ds-03 [&_h2]:mt-ds-05 [&_h2]:text-surface-fg",
|
|
@@ -256,10 +250,10 @@ const De = se.create({
|
|
|
256
250
|
];
|
|
257
251
|
function d({
|
|
258
252
|
onClick: e,
|
|
259
|
-
isActive:
|
|
253
|
+
isActive: n = !1,
|
|
260
254
|
disabled: r = !1,
|
|
261
|
-
title:
|
|
262
|
-
children:
|
|
255
|
+
title: o,
|
|
256
|
+
children: i
|
|
263
257
|
}) {
|
|
264
258
|
return /* @__PURE__ */ t(
|
|
265
259
|
"button",
|
|
@@ -267,51 +261,48 @@ function d({
|
|
|
267
261
|
type: "button",
|
|
268
262
|
onClick: e,
|
|
269
263
|
disabled: r,
|
|
270
|
-
title:
|
|
271
|
-
"aria-pressed":
|
|
272
|
-
className:
|
|
264
|
+
title: o,
|
|
265
|
+
"aria-pressed": n,
|
|
266
|
+
className: x(
|
|
273
267
|
"inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md transition-colors duration-fast-01 ease-productive-standard",
|
|
274
268
|
"hover:bg-surface-raised-hover",
|
|
275
269
|
"disabled:pointer-events-none disabled:opacity-action-disabled",
|
|
276
|
-
|
|
270
|
+
n ? "bg-surface-raised-hover text-accent-11" : "text-surface-fg-subtle"
|
|
277
271
|
),
|
|
278
|
-
children:
|
|
272
|
+
children: i
|
|
279
273
|
}
|
|
280
274
|
);
|
|
281
275
|
}
|
|
282
|
-
function
|
|
283
|
-
const [
|
|
276
|
+
function De({ editor: e }) {
|
|
277
|
+
const [n, r] = c.useState(!1), [o, i] = c.useState(""), s = c.useRef(null), l = () => {
|
|
284
278
|
if (e.isActive("link")) {
|
|
285
279
|
e.chain().focus().unsetLink().run();
|
|
286
280
|
return;
|
|
287
281
|
}
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
h.preventDefault(), n.trim() && e.chain().focus().setLink({ href: n.trim() }).run(), r(!1), a("");
|
|
295
|
-
}, k = (h) => {
|
|
296
|
-
h.key === "Escape" && (r(!1), a(""), e.commands.focus());
|
|
282
|
+
const g = e.getAttributes("link").href || "";
|
|
283
|
+
i(g), r(!0), setTimeout(() => s.current?.focus(), 0);
|
|
284
|
+
}, b = (g) => {
|
|
285
|
+
g.preventDefault(), o.trim() && e.chain().focus().setLink({ href: o.trim() }).run(), r(!1), i("");
|
|
286
|
+
}, v = (g) => {
|
|
287
|
+
g.key === "Escape" && (r(!1), i(""), e.commands.focus());
|
|
297
288
|
};
|
|
298
|
-
return /* @__PURE__ */
|
|
299
|
-
/* @__PURE__ */ t(d, { onClick:
|
|
300
|
-
|
|
289
|
+
return /* @__PURE__ */ p("div", { className: "relative", children: [
|
|
290
|
+
/* @__PURE__ */ t(d, { onClick: l, isActive: e.isActive("link"), title: "Link", children: /* @__PURE__ */ t(u, { icon: Re, size: "sm" }) }),
|
|
291
|
+
n && /* @__PURE__ */ p(
|
|
301
292
|
"form",
|
|
302
293
|
{
|
|
303
|
-
onSubmit:
|
|
294
|
+
onSubmit: b,
|
|
304
295
|
"aria-label": "Edit link URL",
|
|
305
296
|
className: "absolute left-0 top-full z-popover mt-ds-01 flex items-center gap-ds-02 rounded-ds-md border border-surface-border-strong bg-surface-overlay p-ds-02 shadow-raised-hover",
|
|
306
297
|
children: [
|
|
307
298
|
/* @__PURE__ */ t(
|
|
308
299
|
"input",
|
|
309
300
|
{
|
|
310
|
-
ref:
|
|
301
|
+
ref: s,
|
|
311
302
|
type: "url",
|
|
312
|
-
value:
|
|
313
|
-
onChange: (
|
|
314
|
-
onKeyDown:
|
|
303
|
+
value: o,
|
|
304
|
+
onChange: (g) => i(g.target.value),
|
|
305
|
+
onKeyDown: v,
|
|
315
306
|
placeholder: "https://...",
|
|
316
307
|
className: "h-ds-sm w-[240px] rounded-ds-sm border border-surface-border-strong bg-surface-overlay px-ds-03 text-ds-sm text-surface-fg focus:border-accent-7 focus:outline-none"
|
|
317
308
|
}
|
|
@@ -322,194 +313,192 @@ function Be({ editor: e }) {
|
|
|
322
313
|
)
|
|
323
314
|
] });
|
|
324
315
|
}
|
|
325
|
-
function
|
|
316
|
+
function k() {
|
|
326
317
|
return /* @__PURE__ */ t("div", { className: "mx-ds-02 h-[16px] w-px bg-surface-border" });
|
|
327
318
|
}
|
|
328
|
-
function
|
|
329
|
-
return /* @__PURE__ */
|
|
330
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleBold().run(), isActive: e.isActive("bold"), title: "Bold", children: /* @__PURE__ */ t(
|
|
331
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleItalic().run(), isActive: e.isActive("italic"), title: "Italic", children: /* @__PURE__ */ t(
|
|
332
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleUnderline().run(), isActive: e.isActive("underline"), title: "Underline", children: /* @__PURE__ */ t(
|
|
333
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleStrike().run(), isActive: e.isActive("strike"), title: "Strikethrough", children: /* @__PURE__ */ t(
|
|
334
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleHighlight().run(), isActive: e.isActive("highlight"), title: "Highlight", children: /* @__PURE__ */ t(
|
|
335
|
-
/* @__PURE__ */ t(
|
|
336
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleHeading({ level: 2 }).run(), isActive: e.isActive("heading", { level: 2 }), title: "Heading 2", children: /* @__PURE__ */ t(
|
|
337
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleHeading({ level: 3 }).run(), isActive: e.isActive("heading", { level: 3 }), title: "Heading 3", children: /* @__PURE__ */ t(
|
|
338
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleBlockquote().run(), isActive: e.isActive("blockquote"), title: "Blockquote", children: /* @__PURE__ */ t(
|
|
339
|
-
/* @__PURE__ */ t(
|
|
340
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleBulletList().run(), isActive: e.isActive("bulletList"), title: "Bullet list", children: /* @__PURE__ */ t(
|
|
341
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleOrderedList().run(), isActive: e.isActive("orderedList"), title: "Ordered list", children: /* @__PURE__ */ t(
|
|
342
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleTaskList().run(), isActive: e.isActive("taskList"), title: "Task list", children: /* @__PURE__ */ t(
|
|
343
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleCodeBlock().run(), isActive: e.isActive("codeBlock"), title: "Code block", children: /* @__PURE__ */ t(
|
|
344
|
-
/* @__PURE__ */ t(
|
|
345
|
-
/* @__PURE__ */ t(
|
|
346
|
-
|
|
347
|
-
r && /* @__PURE__ */ t(d, { onClick: r, title: "Attach file", children: /* @__PURE__ */ t(
|
|
348
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().setHorizontalRule().run(), title: "Horizontal rule", children: /* @__PURE__ */ t(
|
|
349
|
-
/* @__PURE__ */ t(
|
|
350
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().setTextAlign("left").run(), isActive: e.isActive({ textAlign: "left" }), title: "Align left", children: /* @__PURE__ */ t(
|
|
351
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().setTextAlign("center").run(), isActive: e.isActive({ textAlign: "center" }), title: "Align center", children: /* @__PURE__ */ t(
|
|
352
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().setTextAlign("right").run(), isActive: e.isActive({ textAlign: "right" }), title: "Align right", children: /* @__PURE__ */ t(
|
|
353
|
-
/* @__PURE__ */ t(
|
|
354
|
-
|
|
355
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().undo().run(), disabled: !e.can().undo(), title: "Undo", children: /* @__PURE__ */ t(
|
|
356
|
-
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().redo().run(), disabled: !e.can().redo(), title: "Redo", children: /* @__PURE__ */ t(
|
|
319
|
+
function Be({ editor: e, onImageClick: n, onFileClick: r, onEmojiClick: o }) {
|
|
320
|
+
return /* @__PURE__ */ p("div", { className: "flex flex-wrap items-center gap-ds-01 border-b border-surface-border-strong px-ds-04 py-ds-02b", children: [
|
|
321
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleBold().run(), isActive: e.isActive("bold"), title: "Bold", children: /* @__PURE__ */ t(u, { icon: le, size: "sm", stroke: "bold" }) }),
|
|
322
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleItalic().run(), isActive: e.isActive("italic"), title: "Italic", children: /* @__PURE__ */ t(u, { icon: ae, size: "sm", stroke: "bold" }) }),
|
|
323
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleUnderline().run(), isActive: e.isActive("underline"), title: "Underline", children: /* @__PURE__ */ t(u, { icon: ce, size: "sm", stroke: "bold" }) }),
|
|
324
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleStrike().run(), isActive: e.isActive("strike"), title: "Strikethrough", children: /* @__PURE__ */ t(u, { icon: ue, size: "sm", stroke: "bold" }) }),
|
|
325
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleHighlight().run(), isActive: e.isActive("highlight"), title: "Highlight", children: /* @__PURE__ */ t(u, { icon: de, size: "sm", stroke: "bold" }) }),
|
|
326
|
+
/* @__PURE__ */ t(k, {}),
|
|
327
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleHeading({ level: 2 }).run(), isActive: e.isActive("heading", { level: 2 }), title: "Heading 2", children: /* @__PURE__ */ t(u, { icon: fe, size: "sm", stroke: "bold" }) }),
|
|
328
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleHeading({ level: 3 }).run(), isActive: e.isActive("heading", { level: 3 }), title: "Heading 3", children: /* @__PURE__ */ t(u, { icon: me, size: "sm", stroke: "bold" }) }),
|
|
329
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleBlockquote().run(), isActive: e.isActive("blockquote"), title: "Blockquote", children: /* @__PURE__ */ t(u, { icon: ge, size: "sm", stroke: "bold" }) }),
|
|
330
|
+
/* @__PURE__ */ t(k, {}),
|
|
331
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleBulletList().run(), isActive: e.isActive("bulletList"), title: "Bullet list", children: /* @__PURE__ */ t(u, { icon: he, size: "sm", stroke: "bold" }) }),
|
|
332
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleOrderedList().run(), isActive: e.isActive("orderedList"), title: "Ordered list", children: /* @__PURE__ */ t(u, { icon: pe, size: "sm", stroke: "bold" }) }),
|
|
333
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleTaskList().run(), isActive: e.isActive("taskList"), title: "Task list", children: /* @__PURE__ */ t(u, { icon: be, size: "sm", stroke: "bold" }) }),
|
|
334
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().toggleCodeBlock().run(), isActive: e.isActive("codeBlock"), title: "Code block", children: /* @__PURE__ */ t(u, { icon: xe, size: "sm", stroke: "bold" }) }),
|
|
335
|
+
/* @__PURE__ */ t(k, {}),
|
|
336
|
+
/* @__PURE__ */ t(De, { editor: e }),
|
|
337
|
+
n && /* @__PURE__ */ t(d, { onClick: n, title: "Insert image", children: /* @__PURE__ */ t(u, { icon: ve, size: "sm" }) }),
|
|
338
|
+
r && /* @__PURE__ */ t(d, { onClick: r, title: "Attach file", children: /* @__PURE__ */ t(u, { icon: ke, size: "sm" }) }),
|
|
339
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().setHorizontalRule().run(), title: "Horizontal rule", children: /* @__PURE__ */ t(u, { icon: ye, size: "sm" }) }),
|
|
340
|
+
/* @__PURE__ */ t(k, {}),
|
|
341
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().setTextAlign("left").run(), isActive: e.isActive({ textAlign: "left" }), title: "Align left", children: /* @__PURE__ */ t(u, { icon: we, size: "sm" }) }),
|
|
342
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().setTextAlign("center").run(), isActive: e.isActive({ textAlign: "center" }), title: "Align center", children: /* @__PURE__ */ t(u, { icon: Ae, size: "sm" }) }),
|
|
343
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().setTextAlign("right").run(), isActive: e.isActive({ textAlign: "right" }), title: "Align right", children: /* @__PURE__ */ t(u, { icon: _e, size: "sm" }) }),
|
|
344
|
+
/* @__PURE__ */ t(k, {}),
|
|
345
|
+
o && /* @__PURE__ */ t(d, { onClick: o, title: "Emoji", children: /* @__PURE__ */ t(u, { icon: Ce, size: "sm" }) }),
|
|
346
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().undo().run(), disabled: !e.can().undo(), title: "Undo", children: /* @__PURE__ */ t(u, { icon: Ie, size: "sm" }) }),
|
|
347
|
+
/* @__PURE__ */ t(d, { onClick: () => e.chain().focus().redo().run(), disabled: !e.can().redo(), title: "Redo", children: /* @__PURE__ */ t(u, { icon: Le, size: "sm" }) })
|
|
357
348
|
] });
|
|
358
349
|
}
|
|
359
|
-
const
|
|
360
|
-
function
|
|
361
|
-
const [
|
|
362
|
-
|
|
363
|
-
import("@emoji-mart/data").then((
|
|
350
|
+
const Me = c.lazy(() => import("@emoji-mart/react"));
|
|
351
|
+
function Pe({ onSelect: e }) {
|
|
352
|
+
const [n, r] = c.useState(null), { colorMode: o } = Ee();
|
|
353
|
+
c.useEffect(() => {
|
|
354
|
+
import("@emoji-mart/data").then((s) => r(s.default));
|
|
364
355
|
}, []);
|
|
365
|
-
const
|
|
366
|
-
return
|
|
367
|
-
|
|
356
|
+
const i = /* @__PURE__ */ t("div", { className: "flex h-[350px] w-[352px] items-center justify-center rounded-ds-lg border border-surface-border-strong bg-surface-overlay shadow-raised-hover", children: /* @__PURE__ */ t("span", { className: "text-ds-sm text-surface-fg-subtle", children: "Loading..." }) });
|
|
357
|
+
return n ? /* @__PURE__ */ t(c.Suspense, { fallback: i, children: /* @__PURE__ */ t(
|
|
358
|
+
Me,
|
|
368
359
|
{
|
|
369
|
-
data:
|
|
370
|
-
onEmojiSelect: (
|
|
371
|
-
theme:
|
|
360
|
+
data: n,
|
|
361
|
+
onEmojiSelect: (s) => e(s.native),
|
|
362
|
+
theme: o === "dark" ? "dark" : "light",
|
|
372
363
|
previewPosition: "none",
|
|
373
364
|
skinTonePosition: "none"
|
|
374
365
|
}
|
|
375
|
-
) }) :
|
|
366
|
+
) }) : i;
|
|
376
367
|
}
|
|
377
|
-
const
|
|
368
|
+
const Ue = c.forwardRef(
|
|
378
369
|
function({
|
|
379
|
-
content:
|
|
370
|
+
content: n = "",
|
|
380
371
|
placeholder: r = "Start writing...",
|
|
381
|
-
onChange:
|
|
382
|
-
className:
|
|
383
|
-
editable:
|
|
384
|
-
onImageUpload:
|
|
385
|
-
onFileUpload:
|
|
386
|
-
mentions:
|
|
387
|
-
onMentionSearch:
|
|
388
|
-
onMentionSelect:
|
|
389
|
-
...
|
|
390
|
-
},
|
|
391
|
-
const
|
|
392
|
-
const f =
|
|
372
|
+
onChange: o,
|
|
373
|
+
className: i,
|
|
374
|
+
editable: s = !0,
|
|
375
|
+
onImageUpload: l,
|
|
376
|
+
onFileUpload: b,
|
|
377
|
+
mentions: v,
|
|
378
|
+
onMentionSearch: g,
|
|
379
|
+
onMentionSelect: G,
|
|
380
|
+
...J
|
|
381
|
+
}, Q) {
|
|
382
|
+
const _ = c.useRef(null), C = c.useRef(!1), [I, y] = c.useState(!1), L = c.useRef(null), T = c.useRef(null), S = c.useRef(null), R = async (a) => {
|
|
383
|
+
const f = _.current;
|
|
393
384
|
if (f)
|
|
394
|
-
if (
|
|
395
|
-
const
|
|
396
|
-
|
|
385
|
+
if (l) {
|
|
386
|
+
const m = await l(a);
|
|
387
|
+
m && /^https?:\/\//i.test(m) && f.chain().focus().setImage({ src: m }).run();
|
|
397
388
|
} else {
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
f.chain().focus().setImage({ src:
|
|
401
|
-
},
|
|
389
|
+
const m = new FileReader();
|
|
390
|
+
m.onload = () => {
|
|
391
|
+
f.chain().focus().setImage({ src: m.result }).run();
|
|
392
|
+
}, m.readAsDataURL(a);
|
|
402
393
|
}
|
|
403
|
-
},
|
|
404
|
-
const f =
|
|
405
|
-
if (!f || !
|
|
406
|
-
const
|
|
394
|
+
}, E = async (a) => {
|
|
395
|
+
const f = _.current;
|
|
396
|
+
if (!f || !b) return;
|
|
397
|
+
const m = await b(a);
|
|
407
398
|
f.chain().focus().insertContent({
|
|
408
399
|
type: "fileAttachment",
|
|
409
|
-
attrs: { url:
|
|
400
|
+
attrs: { url: m.url, name: m.name, size: m.size }
|
|
410
401
|
}).run();
|
|
411
|
-
},
|
|
402
|
+
}, h = H({
|
|
412
403
|
extensions: [
|
|
413
|
-
|
|
404
|
+
B.configure({
|
|
414
405
|
heading: { levels: [2, 3] }
|
|
415
406
|
}),
|
|
416
|
-
|
|
407
|
+
se.configure({
|
|
417
408
|
placeholder: r,
|
|
418
409
|
emptyEditorClass: "before:content-[attr(data-placeholder)] before:text-surface-fg-subtle before:float-left before:h-0 before:pointer-events-none"
|
|
419
410
|
}),
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
411
|
+
j,
|
|
412
|
+
M.configure({ multicolor: !1 }),
|
|
413
|
+
D,
|
|
414
|
+
P.configure({ nested: !0 }),
|
|
415
|
+
U.configure({ types: ["heading", "paragraph"] }),
|
|
416
|
+
K.configure({
|
|
426
417
|
openOnClick: !1,
|
|
427
418
|
protocols: ["http", "https", "mailto"],
|
|
428
|
-
validate: (
|
|
419
|
+
validate: (a) => /^(https?:\/\/|mailto:)/i.test(a),
|
|
429
420
|
HTMLAttributes: {
|
|
430
421
|
rel: "noopener noreferrer",
|
|
431
422
|
target: "_blank"
|
|
432
423
|
}
|
|
433
424
|
}),
|
|
434
|
-
|
|
425
|
+
$.configure({
|
|
435
426
|
allowBase64: !0,
|
|
436
427
|
HTMLAttributes: {
|
|
437
428
|
class: "max-w-full rounded-ds-md"
|
|
438
429
|
}
|
|
439
430
|
}),
|
|
440
|
-
|
|
441
|
-
...
|
|
442
|
-
|
|
431
|
+
F,
|
|
432
|
+
...v || g ? [
|
|
433
|
+
q.configure({
|
|
443
434
|
HTMLAttributes: { class: "mention" },
|
|
444
435
|
suggestion: {
|
|
445
|
-
items: async ({ query:
|
|
446
|
-
render:
|
|
436
|
+
items: async ({ query: a }) => g ? await g(a) : v ? v.filter((f) => f.label.toLowerCase().includes(a.toLowerCase())).slice(0, 8) : [],
|
|
437
|
+
render: Te(G)
|
|
447
438
|
}
|
|
448
439
|
})
|
|
449
440
|
] : [],
|
|
450
|
-
|
|
441
|
+
je
|
|
451
442
|
],
|
|
452
|
-
content:
|
|
453
|
-
editable:
|
|
443
|
+
content: n,
|
|
444
|
+
editable: s,
|
|
454
445
|
editorProps: {
|
|
455
|
-
handleDrop: (
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
return A ? A.type.startsWith("image/") ? (E(A), !0) : m ? (R(A), !0) : !1 : !1;
|
|
446
|
+
handleDrop: (a, f, m, X) => {
|
|
447
|
+
if (X || !f.dataTransfer?.files.length) return !1;
|
|
448
|
+
const w = f.dataTransfer.files[0];
|
|
449
|
+
return w ? w.type.startsWith("image/") ? (R(w), !0) : b ? (E(w), !0) : !1 : !1;
|
|
460
450
|
},
|
|
461
|
-
handlePaste: (
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
return u ? u.type.startsWith("image/") ? (E(u), !0) : m ? (R(u), !0) : !1 : !1;
|
|
451
|
+
handlePaste: (a, f) => {
|
|
452
|
+
const m = f.clipboardData?.files[0];
|
|
453
|
+
return m ? m.type.startsWith("image/") ? (R(m), !0) : b ? (E(m), !0) : !1 : !1;
|
|
465
454
|
},
|
|
466
455
|
attributes: {
|
|
467
|
-
class:
|
|
468
|
-
...
|
|
456
|
+
class: x(
|
|
457
|
+
...W,
|
|
469
458
|
"focus:outline-none",
|
|
470
459
|
"min-h-[120px] px-ds-04 py-ds-04"
|
|
471
460
|
)
|
|
472
461
|
}
|
|
473
462
|
},
|
|
474
|
-
onUpdate: ({ editor:
|
|
475
|
-
|
|
476
|
-
|
|
463
|
+
onUpdate: ({ editor: a }) => {
|
|
464
|
+
C.current = !0, o?.(a.getHTML()), queueMicrotask(() => {
|
|
465
|
+
C.current = !1;
|
|
477
466
|
});
|
|
478
467
|
}
|
|
479
468
|
});
|
|
480
|
-
return
|
|
481
|
-
|
|
482
|
-
}, [
|
|
483
|
-
if (!
|
|
484
|
-
const
|
|
485
|
-
|
|
469
|
+
return c.useEffect(() => {
|
|
470
|
+
_.current = h;
|
|
471
|
+
}, [h]), c.useEffect(() => {
|
|
472
|
+
if (!I) return;
|
|
473
|
+
const a = (f) => {
|
|
474
|
+
L.current && !L.current.contains(f.target) && y(!1);
|
|
486
475
|
};
|
|
487
|
-
return document.addEventListener("mousedown",
|
|
488
|
-
}, [
|
|
489
|
-
|
|
490
|
-
}, [
|
|
491
|
-
|
|
476
|
+
return document.addEventListener("mousedown", a), () => document.removeEventListener("mousedown", a);
|
|
477
|
+
}, [I]), c.useEffect(() => {
|
|
478
|
+
C.current || h && n !== h.getHTML() && h.commands.setContent(n, !1);
|
|
479
|
+
}, [h, n]), h ? /* @__PURE__ */ p("div", { ref: Q, ...J, className: x("relative", i), children: [
|
|
480
|
+
I && /* @__PURE__ */ t(
|
|
492
481
|
"div",
|
|
493
482
|
{
|
|
494
|
-
ref:
|
|
483
|
+
ref: L,
|
|
495
484
|
className: "absolute bottom-full right-0 z-popover mb-ds-02",
|
|
496
|
-
onKeyDown: (
|
|
497
|
-
|
|
485
|
+
onKeyDown: (a) => {
|
|
486
|
+
a.key === "Escape" && (a.stopPropagation(), y(!1));
|
|
498
487
|
},
|
|
499
488
|
children: /* @__PURE__ */ t(
|
|
500
|
-
|
|
489
|
+
Pe,
|
|
501
490
|
{
|
|
502
|
-
onSelect: (
|
|
503
|
-
|
|
491
|
+
onSelect: (a) => {
|
|
492
|
+
h.chain().focus().insertContent(a).run(), y(!1);
|
|
504
493
|
}
|
|
505
494
|
}
|
|
506
495
|
)
|
|
507
496
|
}
|
|
508
497
|
),
|
|
509
|
-
/* @__PURE__ */
|
|
498
|
+
/* @__PURE__ */ p(
|
|
510
499
|
"div",
|
|
511
500
|
{
|
|
512
|
-
className:
|
|
501
|
+
className: x(
|
|
513
502
|
"overflow-hidden rounded-ds-lg border border-surface-border-strong bg-surface-raised",
|
|
514
503
|
"transition-colors ease-productive-standard focus-within:border-surface-border-strong"
|
|
515
504
|
),
|
|
@@ -517,100 +506,92 @@ const Ke = l.forwardRef(
|
|
|
517
506
|
/* @__PURE__ */ t(
|
|
518
507
|
"input",
|
|
519
508
|
{
|
|
520
|
-
ref:
|
|
509
|
+
ref: T,
|
|
521
510
|
type: "file",
|
|
522
511
|
accept: "image/*",
|
|
523
512
|
"aria-label": "Upload image",
|
|
524
513
|
className: "hidden",
|
|
525
|
-
onChange: (
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
f && E(f), o.target.value = "";
|
|
514
|
+
onChange: (a) => {
|
|
515
|
+
const f = a.target.files?.[0];
|
|
516
|
+
f && R(f), a.target.value = "";
|
|
529
517
|
}
|
|
530
518
|
}
|
|
531
519
|
),
|
|
532
|
-
|
|
520
|
+
b && /* @__PURE__ */ t(
|
|
533
521
|
"input",
|
|
534
522
|
{
|
|
535
|
-
ref:
|
|
523
|
+
ref: S,
|
|
536
524
|
type: "file",
|
|
537
525
|
"aria-label": "Upload file",
|
|
538
526
|
className: "hidden",
|
|
539
|
-
onChange: (
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
f && R(f), o.target.value = "";
|
|
527
|
+
onChange: (a) => {
|
|
528
|
+
const f = a.target.files?.[0];
|
|
529
|
+
f && E(f), a.target.value = "";
|
|
543
530
|
}
|
|
544
531
|
}
|
|
545
532
|
),
|
|
546
|
-
|
|
547
|
-
|
|
533
|
+
s && /* @__PURE__ */ t(
|
|
534
|
+
Be,
|
|
548
535
|
{
|
|
549
|
-
editor:
|
|
550
|
-
onImageClick: () =>
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
},
|
|
554
|
-
onFileClick: m ? () => {
|
|
555
|
-
var o;
|
|
556
|
-
return (o = j.current) == null ? void 0 : o.click();
|
|
557
|
-
} : void 0,
|
|
558
|
-
onEmojiClick: () => w((o) => !o)
|
|
536
|
+
editor: h,
|
|
537
|
+
onImageClick: () => T.current?.click(),
|
|
538
|
+
onFileClick: b ? () => S.current?.click() : void 0,
|
|
539
|
+
onEmojiClick: () => y((a) => !a)
|
|
559
540
|
}
|
|
560
541
|
),
|
|
561
|
-
/* @__PURE__ */ t(
|
|
542
|
+
/* @__PURE__ */ t(O, { editor: h })
|
|
562
543
|
]
|
|
563
544
|
}
|
|
564
545
|
)
|
|
565
546
|
] }) : null;
|
|
566
547
|
}
|
|
567
548
|
);
|
|
568
|
-
|
|
569
|
-
const
|
|
570
|
-
function({ content:
|
|
571
|
-
const
|
|
549
|
+
Ue.displayName = "RichTextEditor";
|
|
550
|
+
const Ke = c.forwardRef(
|
|
551
|
+
function({ content: n, className: r, ...o }, i) {
|
|
552
|
+
const s = H({
|
|
572
553
|
extensions: [
|
|
573
|
-
|
|
554
|
+
B.configure({
|
|
574
555
|
heading: { levels: [2, 3] }
|
|
575
556
|
}),
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
557
|
+
j,
|
|
558
|
+
M.configure({ multicolor: !1 }),
|
|
559
|
+
D,
|
|
560
|
+
P.configure({ nested: !0 }),
|
|
561
|
+
U.configure({ types: ["heading", "paragraph"] }),
|
|
562
|
+
K.configure({
|
|
582
563
|
openOnClick: !0,
|
|
583
564
|
protocols: ["http", "https", "mailto"],
|
|
584
|
-
validate: (
|
|
565
|
+
validate: (l) => /^(https?:\/\/|mailto:)/i.test(l),
|
|
585
566
|
HTMLAttributes: {
|
|
586
567
|
rel: "noopener noreferrer",
|
|
587
568
|
target: "_blank"
|
|
588
569
|
}
|
|
589
570
|
}),
|
|
590
|
-
|
|
571
|
+
$.configure({
|
|
591
572
|
allowBase64: !0,
|
|
592
573
|
HTMLAttributes: {
|
|
593
574
|
class: "max-w-full rounded-ds-md"
|
|
594
575
|
}
|
|
595
576
|
}),
|
|
596
|
-
|
|
597
|
-
|
|
577
|
+
F,
|
|
578
|
+
q.configure({
|
|
598
579
|
HTMLAttributes: { class: "mention" }
|
|
599
580
|
})
|
|
600
581
|
],
|
|
601
|
-
content:
|
|
582
|
+
content: n,
|
|
602
583
|
editable: !1,
|
|
603
584
|
editorProps: {
|
|
604
585
|
attributes: {
|
|
605
|
-
class:
|
|
586
|
+
class: x(...W)
|
|
606
587
|
}
|
|
607
588
|
}
|
|
608
589
|
});
|
|
609
|
-
return
|
|
590
|
+
return s ? /* @__PURE__ */ t("div", { ref: i, ...o, className: r, children: /* @__PURE__ */ t(O, { editor: s }) }) : null;
|
|
610
591
|
}
|
|
611
592
|
);
|
|
612
|
-
|
|
593
|
+
Ke.displayName = "RichTextViewer";
|
|
613
594
|
export {
|
|
614
|
-
|
|
615
|
-
|
|
595
|
+
Ue as RichTextEditor,
|
|
596
|
+
Ke as RichTextViewer
|
|
616
597
|
};
|