@devalok/shilp-sutra 0.49.4 → 0.50.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/AGENTS.md +12 -4
- package/MIGRATION.md +6 -0
- package/dist/_chunks/badge-group.js +12 -11
- package/dist/_chunks/badge-group.js.map +1 -1
- package/dist/_chunks/block-shell.js +1 -1
- package/dist/_chunks/block-shell.js.map +1 -1
- package/dist/_chunks/chat.js +18 -18
- package/dist/_chunks/chat.js.map +1 -1
- package/dist/_chunks/document-preview.js +1 -1
- package/dist/_chunks/document-preview.js.map +1 -1
- package/dist/_chunks/emoji-suggestion.js +1 -1
- package/dist/_chunks/emoji-suggestion.js.map +1 -1
- package/dist/_chunks/grid-lines.js +2 -2
- package/dist/_chunks/grid-lines.js.map +1 -1
- package/dist/_chunks/image-preview.js +1 -1
- package/dist/_chunks/image-preview.js.map +1 -1
- package/dist/_chunks/mention-suggestion.js +2 -2
- package/dist/_chunks/mention-suggestion.js.map +1 -1
- package/dist/_chunks/oauth-button.js +8 -8
- package/dist/_chunks/oauth-button.js.map +1 -1
- package/dist/_chunks/shared.js +2 -2
- package/dist/_chunks/shared.js.map +1 -1
- package/dist/_chunks/success.js +5 -5
- package/dist/_chunks/success.js.map +1 -1
- package/dist/_chunks/tiptap.js +3956 -1796
- package/dist/_chunks/tiptap.js.map +1 -1
- package/dist/_chunks/tooltip.js +2 -2
- package/dist/_chunks/tooltip.js.map +1 -1
- package/dist/_chunks/tree-view.js +2 -2
- package/dist/_chunks/tree-view.js.map +1 -1
- package/dist/_chunks/use-calendar.js +3 -3
- package/dist/_chunks/use-calendar.js.map +1 -1
- package/dist/ai/block-renderer.js +1 -1
- package/dist/ai/block-renderer.js.map +1 -1
- package/dist/ai/blocks/error.js +1 -1
- package/dist/ai/blocks/error.js.map +1 -1
- package/dist/ai/command-bar.js +15 -15
- package/dist/ai/command-bar.js.map +1 -1
- package/dist/ai/conversation.js +6 -6
- package/dist/ai/conversation.js.map +1 -1
- package/dist/composed/activity-feed.js +4 -4
- package/dist/composed/activity-feed.js.map +1 -1
- package/dist/composed/avatar-group.js +6 -6
- package/dist/composed/avatar-group.js.map +1 -1
- package/dist/composed/bulk-action-bar.js +1 -1
- package/dist/composed/bulk-action-bar.js.map +1 -1
- package/dist/composed/command-palette.js +12 -12
- package/dist/composed/command-palette.js.map +1 -1
- package/dist/composed/content-card.js +1 -1
- package/dist/composed/content-card.js.map +1 -1
- package/dist/composed/date-picker/index.js +17 -17
- package/dist/composed/date-picker/index.js.map +1 -1
- package/dist/composed/deadline-indicator.js +2 -2
- package/dist/composed/deadline-indicator.js.map +1 -1
- package/dist/composed/diff.d.ts +108 -0
- package/dist/composed/diff.d.ts.map +1 -0
- package/dist/composed/diff.js +1004 -0
- package/dist/composed/diff.js.map +1 -0
- package/dist/composed/emoji-picker.js +6 -6
- package/dist/composed/emoji-picker.js.map +1 -1
- package/dist/composed/empty-state.js +2 -2
- package/dist/composed/empty-state.js.map +1 -1
- package/dist/composed/error-boundary.js +6 -6
- package/dist/composed/error-boundary.js.map +1 -1
- package/dist/composed/file-preview.js +5 -5
- package/dist/composed/file-preview.js.map +1 -1
- package/dist/composed/filter-bar.js +3 -3
- package/dist/composed/filter-bar.js.map +1 -1
- package/dist/composed/form-section.js +2 -2
- package/dist/composed/form-section.js.map +1 -1
- package/dist/composed/inline-edit.d.ts +1 -1
- package/dist/composed/inline-edit.d.ts.map +1 -1
- package/dist/composed/inline-edit.js.map +1 -1
- package/dist/composed/loading-skeleton.js +3 -3
- package/dist/composed/loading-skeleton.js.map +1 -1
- package/dist/composed/markdown-viewer.js +11 -11
- package/dist/composed/markdown-viewer.js.map +1 -1
- package/dist/composed/master-detail.js +1 -1
- package/dist/composed/master-detail.js.map +1 -1
- package/dist/composed/member-picker.js +2 -2
- package/dist/composed/member-picker.js.map +1 -1
- package/dist/composed/multi-select-popover.js +5 -5
- package/dist/composed/multi-select-popover.js.map +1 -1
- package/dist/composed/page-header.js +3 -3
- package/dist/composed/page-header.js.map +1 -1
- package/dist/composed/page-skeletons.js +4 -4
- package/dist/composed/page-skeletons.js.map +1 -1
- package/dist/composed/priority-indicator.js +1 -1
- package/dist/composed/priority-indicator.js.map +1 -1
- package/dist/composed/responsive-modal.js +2 -2
- package/dist/composed/responsive-modal.js.map +1 -1
- package/dist/composed/rich-chat-input.js +27 -27
- package/dist/composed/rich-chat-input.js.map +1 -1
- package/dist/composed/rich-text-editor.d.ts +81 -6
- package/dist/composed/rich-text-editor.d.ts.map +1 -1
- package/dist/composed/rich-text-editor.js +365 -210
- package/dist/composed/rich-text-editor.js.map +1 -1
- package/dist/composed/schedule-view.js +4 -4
- package/dist/composed/schedule-view.js.map +1 -1
- package/dist/shell/bottom-navbar.js +4 -4
- package/dist/shell/bottom-navbar.js.map +1 -1
- package/dist/shell/notification-center.js +13 -13
- package/dist/shell/notification-center.js.map +1 -1
- package/dist/shell/notification-preferences.js +10 -10
- package/dist/shell/notification-preferences.js.map +1 -1
- package/dist/shell/sidebar.js +9 -9
- package/dist/shell/sidebar.js.map +1 -1
- package/dist/shell/top-bar.js +8 -8
- package/dist/shell/top-bar.js.map +1 -1
- package/dist/tokens/semantic.css +6 -1
- package/dist/tokens/typography-semantic.css +6 -6
- package/dist/tokens/utilities.css +8 -0
- package/dist/ui/accordion.js +2 -2
- package/dist/ui/accordion.js.map +1 -1
- package/dist/ui/alert-dialog.js +4 -4
- package/dist/ui/alert-dialog.js.map +1 -1
- package/dist/ui/alert.js +1 -1
- package/dist/ui/alert.js.map +1 -1
- package/dist/ui/autocomplete.d.ts.map +1 -1
- package/dist/ui/autocomplete.js +11 -3
- package/dist/ui/autocomplete.js.map +1 -1
- package/dist/ui/avatar.js +5 -5
- package/dist/ui/avatar.js.map +1 -1
- package/dist/ui/badge-group.d.ts +2 -6
- package/dist/ui/badge-group.d.ts.map +1 -1
- package/dist/ui/badge-indicator.d.ts +2 -6
- package/dist/ui/badge-indicator.d.ts.map +1 -1
- package/dist/ui/badge-indicator.js +19 -18
- package/dist/ui/badge-indicator.js.map +1 -1
- package/dist/ui/badge.d.ts +2 -4
- package/dist/ui/badge.d.ts.map +1 -1
- package/dist/ui/banner.js +1 -1
- package/dist/ui/banner.js.map +1 -1
- package/dist/ui/breadcrumb.js +1 -1
- package/dist/ui/breadcrumb.js.map +1 -1
- package/dist/ui/button.js +7 -7
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/card.d.ts +1 -1
- package/dist/ui/card.js +1 -1
- package/dist/ui/card.js.map +1 -1
- package/dist/ui/charts/gauge-chart.js +2 -2
- package/dist/ui/charts/gauge-chart.js.map +1 -1
- package/dist/ui/charts/pie-chart.js +1 -1
- package/dist/ui/charts/pie-chart.js.map +1 -1
- package/dist/ui/charts/radar-chart.d.ts +19 -1
- package/dist/ui/charts/radar-chart.d.ts.map +1 -1
- package/dist/ui/charts/radar-chart.js +80 -42
- package/dist/ui/charts/radar-chart.js.map +1 -1
- package/dist/ui/code.js +2 -2
- package/dist/ui/code.js.map +1 -1
- package/dist/ui/color-input.d.ts.map +1 -1
- package/dist/ui/color-input.js +164 -157
- package/dist/ui/color-input.js.map +1 -1
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/combobox.js +143 -142
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/context-menu.js +6 -6
- package/dist/ui/context-menu.js.map +1 -1
- package/dist/ui/data-table-body.js +1 -1
- package/dist/ui/data-table-body.js.map +1 -1
- package/dist/ui/data-table-bulk-actions.js +1 -1
- package/dist/ui/data-table-bulk-actions.js.map +1 -1
- package/dist/ui/data-table-card.js +1 -1
- package/dist/ui/data-table-card.js.map +1 -1
- package/dist/ui/data-table-header.js +1 -1
- package/dist/ui/data-table-header.js.map +1 -1
- package/dist/ui/data-table-pagination.js +3 -3
- package/dist/ui/data-table-pagination.js.map +1 -1
- package/dist/ui/data-table-toolbar.js +1 -1
- package/dist/ui/data-table-toolbar.js.map +1 -1
- package/dist/ui/data-table.js +1 -1
- package/dist/ui/data-table.js.map +1 -1
- package/dist/ui/dialog.js +2 -2
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/dot.js +4 -4
- package/dist/ui/dot.js.map +1 -1
- package/dist/ui/dropdown-menu.js +6 -6
- package/dist/ui/dropdown-menu.js.map +1 -1
- package/dist/ui/file-upload.js +5 -5
- package/dist/ui/file-upload.js.map +1 -1
- package/dist/ui/form.js +1 -1
- package/dist/ui/form.js.map +1 -1
- package/dist/ui/input-otp.d.ts.map +1 -1
- package/dist/ui/input-otp.js +3 -3
- package/dist/ui/input-otp.js.map +1 -1
- package/dist/ui/input.js +8 -8
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/label.js +1 -1
- package/dist/ui/label.js.map +1 -1
- package/dist/ui/lib/utils.d.ts.map +1 -1
- package/dist/ui/lib/utils.js +42 -13
- package/dist/ui/lib/utils.js.map +1 -1
- package/dist/ui/menubar.js +7 -7
- package/dist/ui/menubar.js.map +1 -1
- package/dist/ui/navigation-menu.js +1 -1
- package/dist/ui/navigation-menu.js.map +1 -1
- package/dist/ui/number-input.d.ts.map +1 -1
- package/dist/ui/number-input.js +6 -5
- package/dist/ui/number-input.js.map +1 -1
- package/dist/ui/pagination.js +1 -1
- package/dist/ui/pagination.js.map +1 -1
- package/dist/ui/progress-ring.js +3 -3
- package/dist/ui/progress-ring.js.map +1 -1
- package/dist/ui/progress.js +2 -2
- package/dist/ui/progress.js.map +1 -1
- package/dist/ui/segmented-control.js +3 -3
- package/dist/ui/segmented-control.js.map +1 -1
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +7 -6
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/sheet.js +2 -2
- package/dist/ui/sheet.js.map +1 -1
- package/dist/ui/sidebar.js +7 -7
- package/dist/ui/sidebar.js.map +1 -1
- package/dist/ui/split-button.js +6 -6
- package/dist/ui/split-button.js.map +1 -1
- package/dist/ui/stat-card.d.ts +1 -1
- package/dist/ui/stat-card.js +7 -7
- package/dist/ui/stat-card.js.map +1 -1
- package/dist/ui/stepper.js +3 -3
- package/dist/ui/stepper.js.map +1 -1
- package/dist/ui/table.js +3 -3
- package/dist/ui/table.js.map +1 -1
- package/dist/ui/tabs.js +3 -3
- package/dist/ui/tabs.js.map +1 -1
- package/dist/ui/text.d.ts.map +1 -1
- package/dist/ui/text.js.map +1 -1
- package/dist/ui/textarea.d.ts.map +1 -1
- package/dist/ui/textarea.js +7 -6
- package/dist/ui/textarea.js.map +1 -1
- package/dist/ui/toast.js +11 -11
- package/dist/ui/toast.js.map +1 -1
- package/dist/ui/toggle.js +3 -3
- package/dist/ui/toggle.js.map +1 -1
- package/dist/ui/tooltip.js +1 -1
- package/dist/ui/tooltip.js.map +1 -1
- package/docs/components/composed/diff.md +50 -0
- package/docs/components/ui/data-table.md +2 -2
- package/llms.txt +2 -1
- package/mcp-manifest.json +147 -3
- package/package.json +8 -1
- package/skill/SKILL.md +1 -1
- package/skill/references/components.md +2 -1
|
@@ -3,23 +3,24 @@ import { cn as e } from "../ui/lib/utils.js";
|
|
|
3
3
|
import { Icon as t } from "../ui/icon.js";
|
|
4
4
|
import { Button as n } from "../ui/button.js";
|
|
5
5
|
import { MENTION_TOKEN_CLASS as r } from "../_chunks/mention.js";
|
|
6
|
-
import { EditorContent as i, ListKit as a,
|
|
7
|
-
import { EmojiNode as
|
|
8
|
-
import { createEmojiSuggestion as
|
|
9
|
-
import { FileAttachment as
|
|
6
|
+
import { EditorContent as i, ListKit as a, Markdown as o, Placeholder as s, index_default as c, index_default$1 as l, index_default$2 as u, index_default$4 as d, index_default$5 as f, useEditor as p, useEditorState as m } from "../_chunks/tiptap.js";
|
|
7
|
+
import { EmojiNode as h } from "./extensions/emoji-node.js";
|
|
8
|
+
import { createEmojiSuggestion as g } from "../_chunks/emoji-suggestion.js";
|
|
9
|
+
import { FileAttachment as _, createSuggestionRenderer as ee } from "../_chunks/mention-suggestion.js";
|
|
10
10
|
import * as v from "react";
|
|
11
|
-
import {
|
|
12
|
-
import { IconAlignCenter as
|
|
11
|
+
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
12
|
+
import { IconAlignCenter as S, IconAlignLeft as C, IconAlignRight as w, IconArrowBackUp as T, IconArrowForwardUp as E, IconBlockquote as D, IconBold as O, IconCode as k, IconEye as A, IconH2 as te, IconH3 as ne, IconHighlight as re, IconItalic as j, IconLineDashed as M, IconLink as N, IconList as P, IconListCheck as F, IconListNumbers as I, IconMoodSmile as L, IconPaperclip as ie, IconPhoto as ae, IconStrikethrough as R, IconUnderline as z } from "@tabler/icons-react";
|
|
13
|
+
import { AnimatePresence as oe, motion as B, useReducedMotion as V } from "framer-motion";
|
|
13
14
|
//#region src/composed/rich-text-editor.tsx
|
|
14
|
-
var
|
|
15
|
+
var H = [
|
|
15
16
|
"prose prose-sm max-w-none",
|
|
16
|
-
"font-body text-
|
|
17
|
-
"[&_h2]:text-
|
|
18
|
-
"[&_h3]:text-
|
|
17
|
+
"font-body text-body-md leading-relaxed text-surface-fg",
|
|
18
|
+
"[&_h2]:text-heading-sm [&_h2]:mb-ds-03 [&_h2]:mt-ds-05 [&_h2]:text-surface-fg",
|
|
19
|
+
"[&_h3]:text-body-lg [&_h3]:font-semibold [&_h3]:mb-ds-02b [&_h3]:mt-ds-04 [&_h3]:text-surface-fg",
|
|
19
20
|
"[&_p]:mb-ds-02b [&_p]:text-surface-fg-muted",
|
|
20
21
|
"[&_ul]:ml-ds-05 [&_ul]:list-disc [&_ol]:ml-ds-05 [&_ol]:list-decimal",
|
|
21
22
|
"[&_li]:text-surface-fg-muted",
|
|
22
|
-
"[&_code]:rounded [&_code]:bg-surface-raised [&_code]:px-ds-02b [&_code]:py-ds-01 [&_code]:text-
|
|
23
|
+
"[&_code]:rounded [&_code]:bg-surface-raised [&_code]:px-ds-02b [&_code]:py-ds-01 [&_code]:text-body-md [&_code]:text-accent-11",
|
|
23
24
|
"[&_pre]:rounded-surface [&_pre]:bg-surface-raised [&_pre]:p-ds-04",
|
|
24
25
|
"[&_strong]:font-semibold [&_strong]:text-surface-fg",
|
|
25
26
|
"[&_blockquote]:border-l-[3px] [&_blockquote]:border-accent-6 [&_blockquote]:pl-ds-04 [&_blockquote]:italic [&_blockquote]:text-surface-fg-subtle",
|
|
@@ -30,8 +31,8 @@ var U = [
|
|
|
30
31
|
"[&_img]:max-w-full [&_img]:rounded-control [&_img]:my-ds-03",
|
|
31
32
|
r
|
|
32
33
|
];
|
|
33
|
-
function
|
|
34
|
-
return /* @__PURE__ */
|
|
34
|
+
function U({ onClick: t, isActive: n = !1, disabled: r = !1, title: i, children: a }) {
|
|
35
|
+
return /* @__PURE__ */ b("button", {
|
|
35
36
|
type: "button",
|
|
36
37
|
onClick: t,
|
|
37
38
|
disabled: r,
|
|
@@ -42,14 +43,14 @@ function W({ onClick: t, isActive: n = !1, disabled: r = !1, title: i, children:
|
|
|
42
43
|
children: a
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
-
let [r, i] = v.useState(!1), [a, o] = v.useState(""), s = v.useRef(null), { isLink: c } =
|
|
46
|
+
function W({ editor: e }) {
|
|
47
|
+
let [r, i] = v.useState(!1), [a, o] = v.useState(""), s = v.useRef(null), { isLink: c } = m({
|
|
47
48
|
editor: e,
|
|
48
49
|
selector: ({ editor: e }) => ({ isLink: e.isActive("link") })
|
|
49
50
|
});
|
|
50
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ x("div", {
|
|
51
52
|
className: "relative",
|
|
52
|
-
children: [/* @__PURE__ */
|
|
53
|
+
children: [/* @__PURE__ */ b(U, {
|
|
53
54
|
onClick: () => {
|
|
54
55
|
if (c) {
|
|
55
56
|
e.chain().focus().unsetLink().run();
|
|
@@ -60,17 +61,17 @@ function G({ editor: e }) {
|
|
|
60
61
|
},
|
|
61
62
|
isActive: c,
|
|
62
63
|
title: "Link",
|
|
63
|
-
children: /* @__PURE__ */
|
|
64
|
-
icon:
|
|
64
|
+
children: /* @__PURE__ */ b(t, {
|
|
65
|
+
icon: N,
|
|
65
66
|
size: "sm"
|
|
66
67
|
})
|
|
67
|
-
}), r && /* @__PURE__ */
|
|
68
|
+
}), r && /* @__PURE__ */ x("form", {
|
|
68
69
|
onSubmit: (t) => {
|
|
69
70
|
t.preventDefault(), a.trim() && e.chain().focus().setLink({ href: a.trim() }).run(), i(!1), o("");
|
|
70
71
|
},
|
|
71
72
|
"aria-label": "Edit link URL",
|
|
72
73
|
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",
|
|
73
|
-
children: [/* @__PURE__ */
|
|
74
|
+
children: [/* @__PURE__ */ b("input", {
|
|
74
75
|
ref: s,
|
|
75
76
|
type: "url",
|
|
76
77
|
value: a,
|
|
@@ -79,8 +80,8 @@ function G({ editor: e }) {
|
|
|
79
80
|
t.key === "Escape" && (i(!1), o(""), e.commands.focus());
|
|
80
81
|
},
|
|
81
82
|
placeholder: "https://...",
|
|
82
|
-
className: "h-ds-sm w-[240px] rounded-control-inner border border-surface-border-strong bg-surface-overlay px-ds-03 text-
|
|
83
|
-
}), /* @__PURE__ */
|
|
83
|
+
className: "h-ds-sm w-[240px] rounded-control-inner border border-surface-border-strong bg-surface-overlay px-ds-03 text-body-sm text-surface-fg focus:border-accent-7 focus:outline-hidden"
|
|
84
|
+
}), /* @__PURE__ */ b(n, {
|
|
84
85
|
type: "submit",
|
|
85
86
|
variant: "solid",
|
|
86
87
|
size: "sm",
|
|
@@ -89,11 +90,11 @@ function G({ editor: e }) {
|
|
|
89
90
|
})]
|
|
90
91
|
});
|
|
91
92
|
}
|
|
92
|
-
function
|
|
93
|
-
return /* @__PURE__ */
|
|
93
|
+
function G() {
|
|
94
|
+
return /* @__PURE__ */ b("div", { className: "mx-ds-02 h-ds-05 w-px bg-surface-border" });
|
|
94
95
|
}
|
|
95
|
-
function
|
|
96
|
-
let
|
|
96
|
+
function K({ editor: e, toolbar: n, onImageClick: r, onFileClick: i, onEmojiClick: a, trailing: o, showControls: s = !0 }) {
|
|
97
|
+
let c = m({
|
|
97
98
|
editor: e,
|
|
98
99
|
selector: ({ editor: e }) => ({
|
|
99
100
|
isBold: e.isActive("bold"),
|
|
@@ -115,235 +116,246 @@ function q({ editor: e, toolbar: n, onImageClick: r, onFileClick: i, onEmojiClic
|
|
|
115
116
|
canUndo: e.can().undo(),
|
|
116
117
|
canRedo: e.can().redo()
|
|
117
118
|
})
|
|
118
|
-
}),
|
|
119
|
-
return /* @__PURE__ */
|
|
119
|
+
}), l = (e) => !n || n.includes(e), u = l("bold") || l("italic") || l("underline") || l("strike") || l("highlight"), d = l("h2") || l("h3") || l("blockquote"), f = l("bulletList") || l("orderedList") || l("taskList") || l("codeBlock"), p = l("link") || !!r && l("image") || !!i && l("file") || l("hr"), h = l("alignLeft") || l("alignCenter") || l("alignRight"), g = !!a && l("emoji"), _ = l("undo") || l("redo");
|
|
120
|
+
return /* @__PURE__ */ x("div", {
|
|
120
121
|
role: "toolbar",
|
|
121
122
|
"aria-label": "Text formatting",
|
|
122
|
-
className: "flex flex-wrap items-center gap-ds-01 border-b border-surface-border-strong px-ds-04 py-ds-02b",
|
|
123
|
-
children: [
|
|
124
|
-
|
|
123
|
+
className: "flex min-h-[2.75rem] flex-wrap items-center gap-ds-01 border-b border-surface-border-strong px-ds-04 py-ds-02b",
|
|
124
|
+
children: [s && /* @__PURE__ */ x(y, { children: [
|
|
125
|
+
l("bold") && /* @__PURE__ */ b(U, {
|
|
125
126
|
onClick: () => e.chain().focus().toggleBold().run(),
|
|
126
|
-
isActive:
|
|
127
|
+
isActive: c.isBold,
|
|
127
128
|
title: "Bold",
|
|
128
|
-
children: /* @__PURE__ */
|
|
129
|
-
icon:
|
|
129
|
+
children: /* @__PURE__ */ b(t, {
|
|
130
|
+
icon: O,
|
|
130
131
|
size: "sm",
|
|
131
132
|
stroke: "bold"
|
|
132
133
|
})
|
|
133
134
|
}),
|
|
134
|
-
|
|
135
|
+
l("italic") && /* @__PURE__ */ b(U, {
|
|
135
136
|
onClick: () => e.chain().focus().toggleItalic().run(),
|
|
136
|
-
isActive:
|
|
137
|
+
isActive: c.isItalic,
|
|
137
138
|
title: "Italic",
|
|
138
|
-
children: /* @__PURE__ */
|
|
139
|
-
icon:
|
|
139
|
+
children: /* @__PURE__ */ b(t, {
|
|
140
|
+
icon: j,
|
|
140
141
|
size: "sm",
|
|
141
142
|
stroke: "bold"
|
|
142
143
|
})
|
|
143
144
|
}),
|
|
144
|
-
|
|
145
|
+
l("underline") && /* @__PURE__ */ b(U, {
|
|
145
146
|
onClick: () => e.chain().focus().toggleUnderline().run(),
|
|
146
|
-
isActive:
|
|
147
|
+
isActive: c.isUnderline,
|
|
147
148
|
title: "Underline",
|
|
148
|
-
children: /* @__PURE__ */
|
|
149
|
-
icon:
|
|
149
|
+
children: /* @__PURE__ */ b(t, {
|
|
150
|
+
icon: z,
|
|
150
151
|
size: "sm",
|
|
151
152
|
stroke: "bold"
|
|
152
153
|
})
|
|
153
154
|
}),
|
|
154
|
-
|
|
155
|
+
l("strike") && /* @__PURE__ */ b(U, {
|
|
155
156
|
onClick: () => e.chain().focus().toggleStrike().run(),
|
|
156
|
-
isActive:
|
|
157
|
+
isActive: c.isStrike,
|
|
157
158
|
title: "Strikethrough",
|
|
158
|
-
children: /* @__PURE__ */
|
|
159
|
-
icon:
|
|
159
|
+
children: /* @__PURE__ */ b(t, {
|
|
160
|
+
icon: R,
|
|
160
161
|
size: "sm",
|
|
161
162
|
stroke: "bold"
|
|
162
163
|
})
|
|
163
164
|
}),
|
|
164
|
-
|
|
165
|
+
l("highlight") && /* @__PURE__ */ b(U, {
|
|
165
166
|
onClick: () => e.chain().focus().toggleHighlight().run(),
|
|
166
|
-
isActive:
|
|
167
|
+
isActive: c.isHighlight,
|
|
167
168
|
title: "Highlight",
|
|
168
|
-
children: /* @__PURE__ */
|
|
169
|
-
icon:
|
|
169
|
+
children: /* @__PURE__ */ b(t, {
|
|
170
|
+
icon: re,
|
|
170
171
|
size: "sm",
|
|
171
172
|
stroke: "bold"
|
|
172
173
|
})
|
|
173
174
|
}),
|
|
174
|
-
|
|
175
|
-
|
|
175
|
+
u && d && /* @__PURE__ */ b(G, {}),
|
|
176
|
+
l("h2") && /* @__PURE__ */ b(U, {
|
|
176
177
|
onClick: () => e.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
177
|
-
isActive:
|
|
178
|
+
isActive: c.isH2,
|
|
178
179
|
title: "Heading 2",
|
|
179
|
-
children: /* @__PURE__ */
|
|
180
|
-
icon:
|
|
180
|
+
children: /* @__PURE__ */ b(t, {
|
|
181
|
+
icon: te,
|
|
181
182
|
size: "sm",
|
|
182
183
|
stroke: "bold"
|
|
183
184
|
})
|
|
184
185
|
}),
|
|
185
|
-
|
|
186
|
+
l("h3") && /* @__PURE__ */ b(U, {
|
|
186
187
|
onClick: () => e.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
187
|
-
isActive:
|
|
188
|
+
isActive: c.isH3,
|
|
188
189
|
title: "Heading 3",
|
|
189
|
-
children: /* @__PURE__ */
|
|
190
|
-
icon:
|
|
190
|
+
children: /* @__PURE__ */ b(t, {
|
|
191
|
+
icon: ne,
|
|
191
192
|
size: "sm",
|
|
192
193
|
stroke: "bold"
|
|
193
194
|
})
|
|
194
195
|
}),
|
|
195
|
-
|
|
196
|
+
l("blockquote") && /* @__PURE__ */ b(U, {
|
|
196
197
|
onClick: () => e.chain().focus().toggleBlockquote().run(),
|
|
197
|
-
isActive:
|
|
198
|
+
isActive: c.isBlockquote,
|
|
198
199
|
title: "Blockquote",
|
|
199
|
-
children: /* @__PURE__ */
|
|
200
|
-
icon:
|
|
200
|
+
children: /* @__PURE__ */ b(t, {
|
|
201
|
+
icon: D,
|
|
201
202
|
size: "sm",
|
|
202
203
|
stroke: "bold"
|
|
203
204
|
})
|
|
204
205
|
}),
|
|
205
|
-
|
|
206
|
-
|
|
206
|
+
d && f && /* @__PURE__ */ b(G, {}),
|
|
207
|
+
l("bulletList") && /* @__PURE__ */ b(U, {
|
|
207
208
|
onClick: () => e.chain().focus().toggleBulletList().run(),
|
|
208
|
-
isActive:
|
|
209
|
+
isActive: c.isBulletList,
|
|
209
210
|
title: "Bullet list",
|
|
210
|
-
children: /* @__PURE__ */
|
|
211
|
-
icon:
|
|
211
|
+
children: /* @__PURE__ */ b(t, {
|
|
212
|
+
icon: P,
|
|
212
213
|
size: "sm",
|
|
213
214
|
stroke: "bold"
|
|
214
215
|
})
|
|
215
216
|
}),
|
|
216
|
-
|
|
217
|
+
l("orderedList") && /* @__PURE__ */ b(U, {
|
|
217
218
|
onClick: () => e.chain().focus().toggleOrderedList().run(),
|
|
218
|
-
isActive:
|
|
219
|
+
isActive: c.isOrderedList,
|
|
219
220
|
title: "Ordered list",
|
|
220
|
-
children: /* @__PURE__ */
|
|
221
|
-
icon:
|
|
221
|
+
children: /* @__PURE__ */ b(t, {
|
|
222
|
+
icon: I,
|
|
222
223
|
size: "sm",
|
|
223
224
|
stroke: "bold"
|
|
224
225
|
})
|
|
225
226
|
}),
|
|
226
|
-
|
|
227
|
+
l("taskList") && /* @__PURE__ */ b(U, {
|
|
227
228
|
onClick: () => e.chain().focus().toggleTaskList().run(),
|
|
228
|
-
isActive:
|
|
229
|
+
isActive: c.isTaskList,
|
|
229
230
|
title: "Task list",
|
|
230
|
-
children: /* @__PURE__ */
|
|
231
|
-
icon:
|
|
231
|
+
children: /* @__PURE__ */ b(t, {
|
|
232
|
+
icon: F,
|
|
232
233
|
size: "sm",
|
|
233
234
|
stroke: "bold"
|
|
234
235
|
})
|
|
235
236
|
}),
|
|
236
|
-
|
|
237
|
+
l("codeBlock") && /* @__PURE__ */ b(U, {
|
|
237
238
|
onClick: () => e.chain().focus().toggleCodeBlock().run(),
|
|
238
|
-
isActive:
|
|
239
|
+
isActive: c.isCodeBlock,
|
|
239
240
|
title: "Code block",
|
|
240
|
-
children: /* @__PURE__ */
|
|
241
|
-
icon:
|
|
241
|
+
children: /* @__PURE__ */ b(t, {
|
|
242
|
+
icon: k,
|
|
242
243
|
size: "sm",
|
|
243
244
|
stroke: "bold"
|
|
244
245
|
})
|
|
245
246
|
}),
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
r &&
|
|
247
|
+
f && p && /* @__PURE__ */ b(G, {}),
|
|
248
|
+
l("link") && /* @__PURE__ */ b(W, { editor: e }),
|
|
249
|
+
r && l("image") && /* @__PURE__ */ b(U, {
|
|
249
250
|
onClick: r,
|
|
250
251
|
title: "Insert image",
|
|
251
|
-
children: /* @__PURE__ */
|
|
252
|
-
icon:
|
|
252
|
+
children: /* @__PURE__ */ b(t, {
|
|
253
|
+
icon: ae,
|
|
253
254
|
size: "sm"
|
|
254
255
|
})
|
|
255
256
|
}),
|
|
256
|
-
i &&
|
|
257
|
+
i && l("file") && /* @__PURE__ */ b(U, {
|
|
257
258
|
onClick: i,
|
|
258
259
|
title: "Attach file",
|
|
259
|
-
children: /* @__PURE__ */
|
|
260
|
-
icon:
|
|
260
|
+
children: /* @__PURE__ */ b(t, {
|
|
261
|
+
icon: ie,
|
|
261
262
|
size: "sm"
|
|
262
263
|
})
|
|
263
264
|
}),
|
|
264
|
-
|
|
265
|
+
l("hr") && /* @__PURE__ */ b(U, {
|
|
265
266
|
onClick: () => e.chain().focus().setHorizontalRule().run(),
|
|
266
267
|
title: "Horizontal rule",
|
|
267
|
-
children: /* @__PURE__ */
|
|
268
|
-
icon:
|
|
268
|
+
children: /* @__PURE__ */ b(t, {
|
|
269
|
+
icon: M,
|
|
269
270
|
size: "sm"
|
|
270
271
|
})
|
|
271
272
|
}),
|
|
272
|
-
|
|
273
|
-
|
|
273
|
+
p && h && /* @__PURE__ */ b(G, {}),
|
|
274
|
+
l("alignLeft") && /* @__PURE__ */ b(U, {
|
|
274
275
|
onClick: () => e.chain().focus().setTextAlign("left").run(),
|
|
275
|
-
isActive:
|
|
276
|
+
isActive: c.isAlignLeft,
|
|
276
277
|
title: "Align left",
|
|
277
|
-
children: /* @__PURE__ */
|
|
278
|
-
icon:
|
|
278
|
+
children: /* @__PURE__ */ b(t, {
|
|
279
|
+
icon: C,
|
|
279
280
|
size: "sm"
|
|
280
281
|
})
|
|
281
282
|
}),
|
|
282
|
-
|
|
283
|
+
l("alignCenter") && /* @__PURE__ */ b(U, {
|
|
283
284
|
onClick: () => e.chain().focus().setTextAlign("center").run(),
|
|
284
|
-
isActive:
|
|
285
|
+
isActive: c.isAlignCenter,
|
|
285
286
|
title: "Align center",
|
|
286
|
-
children: /* @__PURE__ */
|
|
287
|
-
icon:
|
|
287
|
+
children: /* @__PURE__ */ b(t, {
|
|
288
|
+
icon: S,
|
|
288
289
|
size: "sm"
|
|
289
290
|
})
|
|
290
291
|
}),
|
|
291
|
-
|
|
292
|
+
l("alignRight") && /* @__PURE__ */ b(U, {
|
|
292
293
|
onClick: () => e.chain().focus().setTextAlign("right").run(),
|
|
293
|
-
isActive:
|
|
294
|
+
isActive: c.isAlignRight,
|
|
294
295
|
title: "Align right",
|
|
295
|
-
children: /* @__PURE__ */
|
|
296
|
-
icon:
|
|
296
|
+
children: /* @__PURE__ */ b(t, {
|
|
297
|
+
icon: w,
|
|
297
298
|
size: "sm"
|
|
298
299
|
})
|
|
299
300
|
}),
|
|
300
|
-
|
|
301
|
-
a &&
|
|
301
|
+
h && (g || _) && /* @__PURE__ */ b(G, {}),
|
|
302
|
+
a && l("emoji") && /* @__PURE__ */ b(U, {
|
|
302
303
|
onClick: a,
|
|
303
304
|
title: "Emoji",
|
|
304
|
-
children: /* @__PURE__ */
|
|
305
|
-
icon:
|
|
305
|
+
children: /* @__PURE__ */ b(t, {
|
|
306
|
+
icon: L,
|
|
306
307
|
size: "sm"
|
|
307
308
|
})
|
|
308
309
|
}),
|
|
309
|
-
|
|
310
|
+
l("undo") && /* @__PURE__ */ b(U, {
|
|
310
311
|
onClick: () => e.chain().focus().undo().run(),
|
|
311
|
-
disabled: !
|
|
312
|
+
disabled: !c.canUndo,
|
|
312
313
|
title: "Undo",
|
|
313
|
-
children: /* @__PURE__ */
|
|
314
|
-
icon:
|
|
314
|
+
children: /* @__PURE__ */ b(t, {
|
|
315
|
+
icon: T,
|
|
315
316
|
size: "sm"
|
|
316
317
|
})
|
|
317
318
|
}),
|
|
318
|
-
|
|
319
|
+
l("redo") && /* @__PURE__ */ b(U, {
|
|
319
320
|
onClick: () => e.chain().focus().redo().run(),
|
|
320
|
-
disabled: !
|
|
321
|
+
disabled: !c.canRedo,
|
|
321
322
|
title: "Redo",
|
|
322
|
-
children: /* @__PURE__ */
|
|
323
|
-
icon:
|
|
323
|
+
children: /* @__PURE__ */ b(t, {
|
|
324
|
+
icon: E,
|
|
324
325
|
size: "sm"
|
|
325
326
|
})
|
|
326
327
|
})
|
|
327
|
-
]
|
|
328
|
+
] }), o && /* @__PURE__ */ b("div", {
|
|
329
|
+
className: "ml-auto flex items-center pl-ds-02",
|
|
330
|
+
children: o
|
|
331
|
+
})]
|
|
328
332
|
});
|
|
329
333
|
}
|
|
330
|
-
var
|
|
331
|
-
function
|
|
332
|
-
let t = /* @__PURE__ */
|
|
334
|
+
var q = v.lazy(() => import("./emoji-picker.js").then((e) => ({ default: e.EmojiPicker })));
|
|
335
|
+
function se({ onSelect: e }) {
|
|
336
|
+
let t = /* @__PURE__ */ b("div", {
|
|
333
337
|
className: "flex h-[435px] w-[352px] items-center justify-center rounded-surface bg-surface-overlay shadow-raised-hover",
|
|
334
|
-
children: /* @__PURE__ */
|
|
335
|
-
className: "text-
|
|
338
|
+
children: /* @__PURE__ */ b("span", {
|
|
339
|
+
className: "text-body-sm text-surface-fg-subtle",
|
|
336
340
|
children: "Loading…"
|
|
337
341
|
})
|
|
338
342
|
});
|
|
339
|
-
return /* @__PURE__ */
|
|
343
|
+
return /* @__PURE__ */ b(v.Suspense, {
|
|
340
344
|
fallback: t,
|
|
341
|
-
children: /* @__PURE__ */
|
|
345
|
+
children: /* @__PURE__ */ b(q, { onSelect: e })
|
|
342
346
|
});
|
|
343
347
|
}
|
|
344
|
-
var
|
|
345
|
-
|
|
346
|
-
|
|
348
|
+
var J = v.createContext(null);
|
|
349
|
+
function Y() {
|
|
350
|
+
let e = v.useContext(J);
|
|
351
|
+
if (!e) throw Error("RichTextEditor.Toolbar / .Content must be used within <RichTextEditor.Provider>");
|
|
352
|
+
return e;
|
|
353
|
+
}
|
|
354
|
+
var X = v.forwardRef(function({ format: t = "html", content: n = "", placeholder: r = "Start writing...", onChange: i, className: m, editable: y = !0, toolbar: S, onImageUpload: C, onFileUpload: w, mentions: T, onMentionSearch: E, onMentionSelect: D, sourceMode: O, defaultSourceMode: k = !1, onSourceModeChange: A, emojiSet: te = "native", sourceToggle: ne, children: re, ...j }, M) {
|
|
355
|
+
let N = v.useRef(null), P = v.useRef(!1), F = V(), [I, L] = v.useState(!1), [ie, ae] = v.useState(k), R = O ?? ie, z = v.useCallback((e) => {
|
|
356
|
+
O === void 0 && ae(e), A?.(e);
|
|
357
|
+
}, [O, A]), [U, W] = v.useState(""), G = v.useRef(null), K = v.useRef(null), q = v.useRef(null), Y = async (e) => {
|
|
358
|
+
let t = N.current;
|
|
347
359
|
if (t) if (C) {
|
|
348
360
|
let n = await C(e);
|
|
349
361
|
n && /^https?:\/\//i.test(n) && t.chain().focus().setImage({ src: n }).run();
|
|
@@ -353,8 +365,8 @@ var X = v.forwardRef(function({ content: t = "", placeholder: n = "Start writing
|
|
|
353
365
|
t.chain().focus().setImage({ src: n.result }).run();
|
|
354
366
|
}, n.readAsDataURL(e);
|
|
355
367
|
}
|
|
356
|
-
},
|
|
357
|
-
let t =
|
|
368
|
+
}, X = async (e) => {
|
|
369
|
+
let t = N.current;
|
|
358
370
|
if (!t || !w) return;
|
|
359
371
|
let n = await w(e);
|
|
360
372
|
t.chain().focus().insertContent({
|
|
@@ -365,10 +377,10 @@ var X = v.forwardRef(function({ content: t = "", placeholder: n = "Start writing
|
|
|
365
377
|
size: n.size
|
|
366
378
|
}
|
|
367
379
|
}).run();
|
|
368
|
-
},
|
|
380
|
+
}, Z = p({
|
|
369
381
|
immediatelyRender: !1,
|
|
370
382
|
extensions: [
|
|
371
|
-
|
|
383
|
+
l.configure({
|
|
372
384
|
heading: { levels: [2, 3] },
|
|
373
385
|
link: {
|
|
374
386
|
openOnClick: !1,
|
|
@@ -384,11 +396,11 @@ var X = v.forwardRef(function({ content: t = "", placeholder: n = "Start writing
|
|
|
384
396
|
}
|
|
385
397
|
}
|
|
386
398
|
}),
|
|
387
|
-
|
|
388
|
-
placeholder:
|
|
399
|
+
s.configure({
|
|
400
|
+
placeholder: r,
|
|
389
401
|
emptyEditorClass: "before:content-[attr(data-placeholder)] before:text-surface-fg-subtle before:float-left before:h-0 before:pointer-events-none"
|
|
390
402
|
}),
|
|
391
|
-
|
|
403
|
+
f.configure({ multicolor: !1 }),
|
|
392
404
|
a.configure({
|
|
393
405
|
bulletList: !1,
|
|
394
406
|
orderedList: !1,
|
|
@@ -397,113 +409,254 @@ var X = v.forwardRef(function({ content: t = "", placeholder: n = "Start writing
|
|
|
397
409
|
taskList: {},
|
|
398
410
|
taskItem: { nested: !0 }
|
|
399
411
|
}),
|
|
400
|
-
|
|
401
|
-
|
|
412
|
+
c.configure({ types: ["heading", "paragraph"] }),
|
|
413
|
+
d.configure({
|
|
402
414
|
allowBase64: !0,
|
|
403
415
|
HTMLAttributes: { class: "max-w-full rounded-control" }
|
|
404
416
|
}),
|
|
405
|
-
|
|
406
|
-
...T || E ? [
|
|
417
|
+
_,
|
|
418
|
+
...T || E ? [u.configure({
|
|
407
419
|
HTMLAttributes: { class: "mention" },
|
|
408
420
|
suggestion: {
|
|
409
421
|
items: async ({ query: e }) => E ? await E(e) : T ? T.filter((t) => t.label.toLowerCase().includes(e.toLowerCase())).slice(0, 8) : [],
|
|
410
|
-
render:
|
|
422
|
+
render: ee(D)
|
|
411
423
|
}
|
|
412
424
|
})] : [],
|
|
413
|
-
|
|
414
|
-
|
|
425
|
+
h,
|
|
426
|
+
g(),
|
|
427
|
+
o
|
|
415
428
|
],
|
|
416
|
-
content:
|
|
417
|
-
|
|
429
|
+
content: n,
|
|
430
|
+
contentType: t === "markdown" ? "markdown" : void 0,
|
|
431
|
+
editable: y,
|
|
418
432
|
editorProps: {
|
|
419
433
|
handleDrop: (e, t, n, r) => {
|
|
420
434
|
if (r || !t.dataTransfer?.files.length) return !1;
|
|
421
435
|
let i = t.dataTransfer.files[0];
|
|
422
|
-
return i ? i.type.startsWith("image/") ? (
|
|
436
|
+
return i ? i.type.startsWith("image/") ? (Y(i), !0) : w ? (X(i), !0) : !1 : !1;
|
|
423
437
|
},
|
|
424
438
|
handlePaste: (e, t) => {
|
|
425
439
|
let n = t.clipboardData?.files[0];
|
|
426
|
-
return n ? n.type.startsWith("image/") ? (
|
|
440
|
+
return n ? n.type.startsWith("image/") ? (Y(n), !0) : w ? (X(n), !0) : !1 : !1;
|
|
427
441
|
},
|
|
428
|
-
attributes: { class: e(...
|
|
442
|
+
attributes: { class: e(...H, "focus:outline-hidden", "min-h-[120px] px-ds-04 py-ds-04") }
|
|
429
443
|
},
|
|
430
444
|
onUpdate: ({ editor: e }) => {
|
|
431
|
-
|
|
432
|
-
|
|
445
|
+
P.current = !0, i?.(t === "markdown" ? e.getMarkdown() : e.getHTML()), queueMicrotask(() => {
|
|
446
|
+
P.current = !1;
|
|
433
447
|
});
|
|
434
448
|
}
|
|
435
449
|
});
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}, [
|
|
439
|
-
if (!
|
|
450
|
+
if (v.useEffect(() => {
|
|
451
|
+
N.current = Z;
|
|
452
|
+
}, [Z]), v.useEffect(() => {
|
|
453
|
+
if (!I) return;
|
|
440
454
|
let e = (e) => {
|
|
441
|
-
|
|
455
|
+
G.current && !G.current.contains(e.target) && L(!1);
|
|
442
456
|
};
|
|
443
457
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
444
|
-
}, [
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
458
|
+
}, [I]), v.useEffect(() => {
|
|
459
|
+
P.current || Z && n !== (t === "markdown" ? Z.getMarkdown() : Z.getHTML()) && Z.commands.setContent(n, {
|
|
460
|
+
emitUpdate: !1,
|
|
461
|
+
contentType: t === "markdown" ? "markdown" : void 0
|
|
462
|
+
});
|
|
463
|
+
}, [
|
|
464
|
+
Z,
|
|
465
|
+
n,
|
|
466
|
+
t
|
|
467
|
+
]), v.useEffect(() => {
|
|
468
|
+
R && Z && W(Z.getMarkdown());
|
|
469
|
+
}, [R]), !Z) return null;
|
|
470
|
+
let Q = {
|
|
471
|
+
editor: Z,
|
|
472
|
+
toolbar: S,
|
|
473
|
+
editable: y,
|
|
474
|
+
onImageClick: () => K.current?.click(),
|
|
475
|
+
onFileClick: w ? () => q.current?.click() : void 0,
|
|
476
|
+
onEmojiClick: () => L((e) => !e),
|
|
477
|
+
sourceMode: R,
|
|
478
|
+
setSourceMode: z,
|
|
479
|
+
toggleSource: () => z(!R),
|
|
480
|
+
sourceText: U,
|
|
481
|
+
onSourceChange: (e) => {
|
|
482
|
+
W(e), Z.commands.setContent(e, { contentType: "markdown" });
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
return /* @__PURE__ */ b(J.Provider, {
|
|
486
|
+
value: Q,
|
|
487
|
+
children: /* @__PURE__ */ x("div", {
|
|
488
|
+
ref: M,
|
|
489
|
+
...j,
|
|
490
|
+
className: e("relative", m),
|
|
467
491
|
children: [
|
|
468
|
-
/* @__PURE__ */
|
|
469
|
-
ref:
|
|
492
|
+
/* @__PURE__ */ b(oe, { children: I && /* @__PURE__ */ b(B.div, {
|
|
493
|
+
ref: G,
|
|
494
|
+
initial: !F && {
|
|
495
|
+
opacity: 0,
|
|
496
|
+
scale: .96,
|
|
497
|
+
y: 4
|
|
498
|
+
},
|
|
499
|
+
animate: {
|
|
500
|
+
opacity: 1,
|
|
501
|
+
scale: 1,
|
|
502
|
+
y: 0
|
|
503
|
+
},
|
|
504
|
+
exit: F ? { opacity: 0 } : {
|
|
505
|
+
opacity: 0,
|
|
506
|
+
scale: .96,
|
|
507
|
+
y: 4
|
|
508
|
+
},
|
|
509
|
+
transition: {
|
|
510
|
+
duration: .14,
|
|
511
|
+
ease: "easeOut"
|
|
512
|
+
},
|
|
513
|
+
className: "absolute bottom-full right-0 z-popover mb-ds-02 origin-bottom-right",
|
|
514
|
+
onKeyDown: (e) => {
|
|
515
|
+
e.key === "Escape" && (e.stopPropagation(), L(!1));
|
|
516
|
+
},
|
|
517
|
+
children: /* @__PURE__ */ b(se, { onSelect: ({ id: e, native: t }) => {
|
|
518
|
+
Z.chain().focus().insertContent({
|
|
519
|
+
type: "emojiNode",
|
|
520
|
+
attrs: {
|
|
521
|
+
id: e,
|
|
522
|
+
native: t
|
|
523
|
+
}
|
|
524
|
+
}).run(), L(!1);
|
|
525
|
+
} })
|
|
526
|
+
}, "emoji-picker") }),
|
|
527
|
+
/* @__PURE__ */ b("input", {
|
|
528
|
+
ref: K,
|
|
470
529
|
type: "file",
|
|
471
530
|
accept: "image/*",
|
|
472
531
|
"aria-label": "Upload image",
|
|
473
532
|
className: "hidden",
|
|
474
533
|
onChange: (e) => {
|
|
475
534
|
let t = e.target.files?.[0];
|
|
476
|
-
t &&
|
|
535
|
+
t && Y(t), e.target.value = "";
|
|
477
536
|
}
|
|
478
537
|
}),
|
|
479
|
-
w && /* @__PURE__ */
|
|
480
|
-
ref:
|
|
538
|
+
w && /* @__PURE__ */ b("input", {
|
|
539
|
+
ref: q,
|
|
481
540
|
type: "file",
|
|
482
541
|
"aria-label": "Upload file",
|
|
483
542
|
className: "hidden",
|
|
484
543
|
onChange: (e) => {
|
|
485
544
|
let t = e.target.files?.[0];
|
|
486
|
-
t &&
|
|
545
|
+
t && X(t), e.target.value = "";
|
|
487
546
|
}
|
|
488
547
|
}),
|
|
489
|
-
|
|
490
|
-
editor: B,
|
|
491
|
-
toolbar: S,
|
|
492
|
-
onImageClick: () => I.current?.click(),
|
|
493
|
-
onFileClick: w ? () => L.current?.click() : void 0,
|
|
494
|
-
onEmojiClick: () => P((e) => !e)
|
|
495
|
-
}),
|
|
496
|
-
/* @__PURE__ */ y(i, { editor: B })
|
|
548
|
+
re
|
|
497
549
|
]
|
|
498
|
-
})
|
|
499
|
-
})
|
|
550
|
+
})
|
|
551
|
+
});
|
|
552
|
+
});
|
|
553
|
+
X.displayName = "RichTextEditor.Provider";
|
|
554
|
+
function Z({ trailing: e }) {
|
|
555
|
+
let { editor: t, toolbar: n, editable: r, sourceMode: i, onImageClick: a, onFileClick: o, onEmojiClick: s } = Y();
|
|
556
|
+
if (!r) return null;
|
|
557
|
+
let c = !i;
|
|
558
|
+
return !c && !e ? null : /* @__PURE__ */ b(K, {
|
|
559
|
+
editor: t,
|
|
560
|
+
toolbar: n,
|
|
561
|
+
showControls: c,
|
|
562
|
+
trailing: e,
|
|
563
|
+
onImageClick: a,
|
|
564
|
+
onFileClick: o,
|
|
565
|
+
onEmojiClick: s
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
Z.displayName = "RichTextEditor.Toolbar";
|
|
569
|
+
function Q() {
|
|
570
|
+
let { editor: e, sourceMode: t, sourceText: n, onSourceChange: r } = Y(), a = V() ? { opacity: 0 } : {
|
|
571
|
+
opacity: 0,
|
|
572
|
+
y: 4
|
|
573
|
+
};
|
|
574
|
+
return /* @__PURE__ */ b(oe, {
|
|
575
|
+
mode: "wait",
|
|
576
|
+
initial: !1,
|
|
577
|
+
children: t ? /* @__PURE__ */ b(B.div, {
|
|
578
|
+
initial: a,
|
|
579
|
+
animate: {
|
|
580
|
+
opacity: 1,
|
|
581
|
+
y: 0
|
|
582
|
+
},
|
|
583
|
+
exit: a,
|
|
584
|
+
transition: {
|
|
585
|
+
duration: .14,
|
|
586
|
+
ease: "easeOut"
|
|
587
|
+
},
|
|
588
|
+
children: /* @__PURE__ */ b("textarea", {
|
|
589
|
+
value: n,
|
|
590
|
+
onChange: (e) => r(e.target.value),
|
|
591
|
+
spellCheck: !1,
|
|
592
|
+
"aria-label": "Markdown source",
|
|
593
|
+
className: "block min-h-[120px] w-full resize-y bg-surface-raised px-ds-04 py-ds-04 font-mono text-body-sm leading-ds-relaxed text-surface-fg focus:outline-hidden"
|
|
594
|
+
})
|
|
595
|
+
}, "source") : /* @__PURE__ */ b(B.div, {
|
|
596
|
+
initial: a,
|
|
597
|
+
animate: {
|
|
598
|
+
opacity: 1,
|
|
599
|
+
y: 0
|
|
600
|
+
},
|
|
601
|
+
exit: a,
|
|
602
|
+
transition: {
|
|
603
|
+
duration: .14,
|
|
604
|
+
ease: "easeOut"
|
|
605
|
+
},
|
|
606
|
+
children: /* @__PURE__ */ b(i, { editor: e })
|
|
607
|
+
}, "visual")
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
Q.displayName = "RichTextEditor.Content";
|
|
611
|
+
function $({ className: e, iconOnly: r = !1 }) {
|
|
612
|
+
let { sourceMode: i, toggleSource: a } = Y(), o = i ? "Switch to visual editor" : "Switch to Markdown source", s = i ? A : k;
|
|
613
|
+
return r ? /* @__PURE__ */ b(n, {
|
|
614
|
+
type: "button",
|
|
615
|
+
variant: "ghost",
|
|
616
|
+
size: "icon-sm",
|
|
617
|
+
"aria-pressed": i,
|
|
618
|
+
"aria-label": o,
|
|
619
|
+
title: o,
|
|
620
|
+
className: e,
|
|
621
|
+
onClick: a,
|
|
622
|
+
children: /* @__PURE__ */ b(t, {
|
|
623
|
+
icon: s,
|
|
624
|
+
size: "sm"
|
|
625
|
+
})
|
|
626
|
+
}) : /* @__PURE__ */ b(n, {
|
|
627
|
+
type: "button",
|
|
628
|
+
variant: "ghost",
|
|
629
|
+
size: "sm",
|
|
630
|
+
"aria-pressed": i,
|
|
631
|
+
"aria-label": o,
|
|
632
|
+
startIcon: s,
|
|
633
|
+
className: e,
|
|
634
|
+
onClick: a,
|
|
635
|
+
children: i ? "Editor" : "Markdown"
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
$.displayName = "RichTextEditor.SourceToggle";
|
|
639
|
+
var ce = v.forwardRef(function(t, n) {
|
|
640
|
+
return /* @__PURE__ */ b(X, {
|
|
641
|
+
ref: n,
|
|
642
|
+
...t,
|
|
643
|
+
children: /* @__PURE__ */ x("div", {
|
|
644
|
+
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"),
|
|
645
|
+
children: [/* @__PURE__ */ b(Z, { trailing: t.sourceToggle ? /* @__PURE__ */ b($, {}) : void 0 }), /* @__PURE__ */ b(Q, {})]
|
|
646
|
+
})
|
|
647
|
+
});
|
|
500
648
|
});
|
|
501
|
-
|
|
502
|
-
var
|
|
503
|
-
|
|
649
|
+
ce.displayName = "RichTextEditor";
|
|
650
|
+
var le = Object.assign(ce, {
|
|
651
|
+
Provider: X,
|
|
652
|
+
Toolbar: Z,
|
|
653
|
+
Content: Q,
|
|
654
|
+
SourceToggle: $
|
|
655
|
+
}), ue = v.forwardRef(function({ content: t, format: n = "html", className: r, ...s }, m) {
|
|
656
|
+
let h = p({
|
|
504
657
|
immediatelyRender: !1,
|
|
505
658
|
extensions: [
|
|
506
|
-
|
|
659
|
+
l.configure({
|
|
507
660
|
heading: { levels: [2, 3] },
|
|
508
661
|
link: {
|
|
509
662
|
openOnClick: !0,
|
|
@@ -519,7 +672,7 @@ var Z = v.forwardRef(function({ content: t, className: n, ...r }, o) {
|
|
|
519
672
|
}
|
|
520
673
|
}
|
|
521
674
|
}),
|
|
522
|
-
|
|
675
|
+
f.configure({ multicolor: !1 }),
|
|
523
676
|
a.configure({
|
|
524
677
|
bulletList: !1,
|
|
525
678
|
orderedList: !1,
|
|
@@ -528,25 +681,27 @@ var Z = v.forwardRef(function({ content: t, className: n, ...r }, o) {
|
|
|
528
681
|
taskList: {},
|
|
529
682
|
taskItem: { nested: !0 }
|
|
530
683
|
}),
|
|
531
|
-
|
|
532
|
-
|
|
684
|
+
c.configure({ types: ["heading", "paragraph"] }),
|
|
685
|
+
d.configure({
|
|
533
686
|
allowBase64: !0,
|
|
534
687
|
HTMLAttributes: { class: "max-w-full rounded-control" }
|
|
535
688
|
}),
|
|
536
|
-
|
|
537
|
-
|
|
689
|
+
_,
|
|
690
|
+
u.configure({ HTMLAttributes: { class: "mention" } }),
|
|
691
|
+
o
|
|
538
692
|
],
|
|
539
693
|
content: t,
|
|
694
|
+
contentType: n === "markdown" ? "markdown" : void 0,
|
|
540
695
|
editable: !1,
|
|
541
|
-
editorProps: { attributes: { class: e(...
|
|
696
|
+
editorProps: { attributes: { class: e(...H) } }
|
|
542
697
|
});
|
|
543
|
-
return
|
|
544
|
-
ref:
|
|
545
|
-
...
|
|
546
|
-
className:
|
|
547
|
-
children: /* @__PURE__ */
|
|
698
|
+
return h ? /* @__PURE__ */ b("div", {
|
|
699
|
+
ref: m,
|
|
700
|
+
...s,
|
|
701
|
+
className: r,
|
|
702
|
+
children: /* @__PURE__ */ b(i, { editor: h })
|
|
548
703
|
}) : null;
|
|
549
704
|
});
|
|
550
|
-
|
|
705
|
+
ue.displayName = "RichTextViewer";
|
|
551
706
|
//#endregion
|
|
552
|
-
export {
|
|
707
|
+
export { le as RichTextEditor, Q as RichTextEditorContent, X as RichTextEditorProvider, $ as RichTextEditorSourceToggle, Z as RichTextEditorToolbar, ue as RichTextViewer, Y as useRichTextEditor };
|