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