@haklex/rich-renderer-mention 0.0.81 → 0.0.83
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/MentionRenderer-BGEFZlMr.js +109 -0
- package/dist/index.mjs +189 -164
- package/dist/rich-renderer-mention.css +1 -2
- package/dist/static.mjs +7 -2
- package/package.json +4 -4
- package/dist/MentionRenderer-BT5RvB1g.js +0 -104
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SiZhihu, SiTelegram, SiX, SiGithub } from "@icons-pack/react-simple-icons";
|
|
3
|
+
import { createContext, use } from "react";
|
|
4
|
+
var semanticClassNames = { mention: "rich-mention", mentionIcon: "rich-mention-icon", mentionIconGitHub: "rich-mention-icon-gh", mentionHandle: "rich-mention-handle", mentionPlain: "rich-mention-plain", editPanel: "rich-mention-edit-panel", editField: "rich-mention-edit-field", editTrigger: "rich-mention-edit-trigger", editFieldIcon: "rich-mention-edit-field-icon", editInput: "rich-mention-edit-input", editSelect: "rich-mention-edit-select" };
|
|
5
|
+
var mention = "b6sgtu0";
|
|
6
|
+
var mentionPlain = "b6sgtu1";
|
|
7
|
+
var mentionIcon = "b6sgtu2";
|
|
8
|
+
var mentionIconGitHub = "b6sgtu3";
|
|
9
|
+
var mentionHandle = "b6sgtu4";
|
|
10
|
+
var editPanel = "b6sgtu5";
|
|
11
|
+
var editField = "b6sgtu6";
|
|
12
|
+
var editTrigger = "b6sgtu7";
|
|
13
|
+
var editFieldIcon = "b6sgtu8";
|
|
14
|
+
var editInput = "b6sgtu9";
|
|
15
|
+
var editSelect = "b6sgtua";
|
|
16
|
+
const ExtraPlatformContext = createContext({});
|
|
17
|
+
function MentionPlatformProvider({
|
|
18
|
+
platforms,
|
|
19
|
+
children
|
|
20
|
+
}) {
|
|
21
|
+
return /* @__PURE__ */ jsx(ExtraPlatformContext, { value: platforms, children });
|
|
22
|
+
}
|
|
23
|
+
function useExtraPlatforms() {
|
|
24
|
+
return use(ExtraPlatformContext);
|
|
25
|
+
}
|
|
26
|
+
const GitHubIcon = /* @__PURE__ */ jsx(
|
|
27
|
+
SiGithub,
|
|
28
|
+
{
|
|
29
|
+
className: `${mentionIconGitHub} ${semanticClassNames.mentionIconGitHub}`,
|
|
30
|
+
size: "1em"
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
const TwitterIcon = /* @__PURE__ */ jsx(SiX, { color: "#1DA1F2", size: "1em" });
|
|
34
|
+
const TelegramIcon = /* @__PURE__ */ jsx(SiTelegram, { color: "#2AABEE", size: "1em" });
|
|
35
|
+
const ZhihuIcon = /* @__PURE__ */ jsx(SiZhihu, { color: "#0084FF", size: "1em" });
|
|
36
|
+
const platformMetaMap = {
|
|
37
|
+
GH: {
|
|
38
|
+
label: "GitHub",
|
|
39
|
+
icon: GitHubIcon,
|
|
40
|
+
getUrl: (handle) => `https://github.com/${encodeURIComponent(handle)}`
|
|
41
|
+
},
|
|
42
|
+
TW: {
|
|
43
|
+
label: "Twitter",
|
|
44
|
+
icon: TwitterIcon,
|
|
45
|
+
getUrl: (handle) => `https://twitter.com/${encodeURIComponent(handle)}`
|
|
46
|
+
},
|
|
47
|
+
TG: {
|
|
48
|
+
label: "Telegram",
|
|
49
|
+
icon: TelegramIcon,
|
|
50
|
+
getUrl: (handle) => `https://t.me/${encodeURIComponent(handle)}`
|
|
51
|
+
},
|
|
52
|
+
ZH: {
|
|
53
|
+
label: "Zhihu",
|
|
54
|
+
icon: ZhihuIcon,
|
|
55
|
+
getUrl: (handle) => `https://www.zhihu.com/people/${encodeURIComponent(handle)}`
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const platformKeys = Object.keys(platformMetaMap);
|
|
59
|
+
function MentionRenderer({ platform, handle, displayName }) {
|
|
60
|
+
const extraPlatforms = useExtraPlatforms();
|
|
61
|
+
const normalizedHandle = handle.replace(/^@+/, "");
|
|
62
|
+
const meta = platformMetaMap[platform] ?? extraPlatforms[platform];
|
|
63
|
+
const label = displayName || normalizedHandle;
|
|
64
|
+
if (meta) {
|
|
65
|
+
return /* @__PURE__ */ jsxs("span", { className: `${mention} ${semanticClassNames.mention}`, children: [
|
|
66
|
+
/* @__PURE__ */ jsx(
|
|
67
|
+
"span",
|
|
68
|
+
{
|
|
69
|
+
"aria-hidden": true,
|
|
70
|
+
className: `${mentionIcon} ${semanticClassNames.mentionIcon}`,
|
|
71
|
+
children: meta.icon
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
"a",
|
|
76
|
+
{
|
|
77
|
+
className: `${mentionHandle} ${semanticClassNames.mentionHandle}`,
|
|
78
|
+
href: meta.getUrl(normalizedHandle),
|
|
79
|
+
rel: "noopener noreferrer",
|
|
80
|
+
target: "_blank",
|
|
81
|
+
children: label
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
] });
|
|
85
|
+
}
|
|
86
|
+
return /* @__PURE__ */ jsx(
|
|
87
|
+
"span",
|
|
88
|
+
{
|
|
89
|
+
className: `${mention} ${semanticClassNames.mention} ${mentionPlain} ${semanticClassNames.mentionPlain}`,
|
|
90
|
+
children: /* @__PURE__ */ jsxs("span", { className: `${mentionHandle} ${semanticClassNames.mentionHandle}`, children: [
|
|
91
|
+
"@",
|
|
92
|
+
label
|
|
93
|
+
] })
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
MentionPlatformProvider as M,
|
|
99
|
+
MentionRenderer as a,
|
|
100
|
+
platformMetaMap as b,
|
|
101
|
+
editPanel as c,
|
|
102
|
+
editField as d,
|
|
103
|
+
editTrigger as e,
|
|
104
|
+
editFieldIcon as f,
|
|
105
|
+
editSelect as g,
|
|
106
|
+
editInput as h,
|
|
107
|
+
platformKeys as p,
|
|
108
|
+
semanticClassNames as s
|
|
109
|
+
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,172 +1,197 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRendererMode } from "@haklex/rich-editor";
|
|
3
|
-
import {
|
|
3
|
+
import { Popover, PopoverTrigger, PopoverPanel, ActionBar, ActionButton } from "@haklex/rich-editor-ui";
|
|
4
4
|
import { vars } from "@haklex/rich-style-token";
|
|
5
5
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
6
6
|
import { $getNearestNodeFromDOMNode } from "lexical";
|
|
7
|
-
import { AtSign, ExternalLink, Trash2
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
import { AtSign, User, ExternalLink, Trash2 } from "lucide-react";
|
|
8
|
+
import { useRef, useState, useEffect, useCallback } from "react";
|
|
9
|
+
import { a as MentionRenderer, b as platformMetaMap, e as editTrigger, s as semanticClassNames, c as editPanel, d as editField, f as editFieldIcon, g as editSelect, p as platformKeys, h as editInput } from "./MentionRenderer-BGEFZlMr.js";
|
|
10
|
+
import { M } from "./MentionRenderer-BGEFZlMr.js";
|
|
11
|
+
const LEADING_AT_RE = /^@+/;
|
|
12
12
|
function MentionEditRenderer(props) {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const mode = useRendererMode();
|
|
14
|
+
if (mode !== "editor") {
|
|
15
|
+
return /* @__PURE__ */ jsx(MentionRenderer, { ...props });
|
|
16
|
+
}
|
|
17
|
+
return /* @__PURE__ */ jsx(MentionEditRendererInner, { ...props });
|
|
15
18
|
}
|
|
16
19
|
function MentionEditRendererInner({ platform, handle, displayName }) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
20
|
+
const [editor] = useLexicalComposerContext();
|
|
21
|
+
const editable = editor.isEditable();
|
|
22
|
+
const wrapperRef = useRef(null);
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
24
|
+
const [editPlatform, setEditPlatform] = useState(platform);
|
|
25
|
+
const [editHandle, setEditHandle] = useState(handle);
|
|
26
|
+
const [editDisplayName, setEditDisplayName] = useState(displayName || "");
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
setEditPlatform(platform);
|
|
29
|
+
setEditHandle(handle);
|
|
30
|
+
setEditDisplayName(displayName || "");
|
|
31
|
+
}, [platform, handle, displayName]);
|
|
32
|
+
const commitChanges = useCallback(() => {
|
|
33
|
+
const trimmedHandle = editHandle.trim();
|
|
34
|
+
if (!trimmedHandle) return;
|
|
35
|
+
if (!wrapperRef.current) return;
|
|
36
|
+
editor.update(() => {
|
|
37
|
+
const node = $getNearestNodeFromDOMNode(wrapperRef.current);
|
|
38
|
+
if (!node) return;
|
|
39
|
+
const writable = node.getWritable();
|
|
40
|
+
writable.__platform = editPlatform;
|
|
41
|
+
writable.__handle = trimmedHandle;
|
|
42
|
+
writable.__displayName = editDisplayName.trim() || void 0;
|
|
43
|
+
});
|
|
44
|
+
setOpen(false);
|
|
45
|
+
}, [editor, editPlatform, editHandle, editDisplayName]);
|
|
46
|
+
const handleDelete = useCallback(() => {
|
|
47
|
+
if (!wrapperRef.current) return;
|
|
48
|
+
editor.update(() => {
|
|
49
|
+
const node = $getNearestNodeFromDOMNode(wrapperRef.current);
|
|
50
|
+
if (node) node.remove();
|
|
51
|
+
});
|
|
52
|
+
setOpen(false);
|
|
53
|
+
}, [editor]);
|
|
54
|
+
const handleOpen = useCallback(() => {
|
|
55
|
+
const normalizedHandle = handle.replace(LEADING_AT_RE, "");
|
|
56
|
+
const meta = platformMetaMap[platform];
|
|
57
|
+
if (meta) {
|
|
58
|
+
window.open(meta.getUrl(normalizedHandle), "_blank", "noopener,noreferrer");
|
|
59
|
+
}
|
|
60
|
+
}, [platform, handle]);
|
|
61
|
+
const handleKeyDown = useCallback(
|
|
62
|
+
(e) => {
|
|
63
|
+
if (e.key === "Enter") {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
commitChanges();
|
|
66
|
+
} else if (e.key === "Escape") {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
setEditPlatform(platform);
|
|
69
|
+
setEditHandle(handle);
|
|
70
|
+
setEditDisplayName(displayName || "");
|
|
71
|
+
setOpen(false);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
[commitChanges, platform, handle, displayName]
|
|
75
|
+
);
|
|
76
|
+
if (!editable) {
|
|
77
|
+
return /* @__PURE__ */ jsx(MentionRenderer, { displayName, handle, platform });
|
|
78
|
+
}
|
|
79
|
+
return /* @__PURE__ */ jsxs(
|
|
80
|
+
Popover,
|
|
81
|
+
{
|
|
82
|
+
open,
|
|
83
|
+
onOpenChange: (nextOpen) => {
|
|
84
|
+
setOpen(nextOpen);
|
|
85
|
+
if (!nextOpen) {
|
|
86
|
+
setEditPlatform(platform);
|
|
87
|
+
setEditHandle(handle);
|
|
88
|
+
setEditDisplayName(displayName || "");
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ jsx(
|
|
93
|
+
PopoverTrigger,
|
|
94
|
+
{
|
|
95
|
+
nativeButton: false,
|
|
96
|
+
render: /* @__PURE__ */ jsx(
|
|
97
|
+
"span",
|
|
98
|
+
{
|
|
99
|
+
className: `${editTrigger} ${semanticClassNames.editTrigger}`,
|
|
100
|
+
ref: wrapperRef
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
children: /* @__PURE__ */ jsx(MentionRenderer, { displayName, handle, platform })
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
/* @__PURE__ */ jsxs(
|
|
107
|
+
PopoverPanel,
|
|
108
|
+
{
|
|
109
|
+
className: `${editPanel} ${semanticClassNames.editPanel}`,
|
|
110
|
+
side: "bottom",
|
|
111
|
+
sideOffset: 8,
|
|
112
|
+
children: [
|
|
113
|
+
/* @__PURE__ */ jsxs("div", { className: `${editField} ${semanticClassNames.editField}`, children: [
|
|
114
|
+
/* @__PURE__ */ jsx(
|
|
115
|
+
"span",
|
|
116
|
+
{
|
|
117
|
+
"aria-hidden": true,
|
|
118
|
+
className: `${editFieldIcon} ${semanticClassNames.editFieldIcon}`,
|
|
119
|
+
style: { fontSize: vars.typography.fontSizeMd },
|
|
120
|
+
children: platformMetaMap[editPlatform]?.icon ?? /* @__PURE__ */ jsx(AtSign, { size: 14 })
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
/* @__PURE__ */ jsx(
|
|
124
|
+
"select",
|
|
125
|
+
{
|
|
126
|
+
className: `${editSelect} ${semanticClassNames.editSelect}`,
|
|
127
|
+
value: editPlatform,
|
|
128
|
+
onChange: (e) => setEditPlatform(e.target.value),
|
|
129
|
+
children: platformKeys.map((key) => /* @__PURE__ */ jsx("option", { value: key, children: platformMetaMap[key].label }, key))
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
] }),
|
|
133
|
+
/* @__PURE__ */ jsxs("div", { className: `${editField} ${semanticClassNames.editField}`, children: [
|
|
134
|
+
/* @__PURE__ */ jsx(
|
|
135
|
+
AtSign,
|
|
136
|
+
{
|
|
137
|
+
className: `${editFieldIcon} ${semanticClassNames.editFieldIcon}`,
|
|
138
|
+
size: 14
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
/* @__PURE__ */ jsx(
|
|
142
|
+
"input",
|
|
143
|
+
{
|
|
144
|
+
className: `${editInput} ${semanticClassNames.editInput}`,
|
|
145
|
+
placeholder: "handle",
|
|
146
|
+
type: "text",
|
|
147
|
+
value: editHandle,
|
|
148
|
+
onChange: (e) => setEditHandle(e.target.value),
|
|
149
|
+
onKeyDown: handleKeyDown
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
] }),
|
|
153
|
+
/* @__PURE__ */ jsxs("div", { className: `${editField} ${semanticClassNames.editField}`, children: [
|
|
154
|
+
/* @__PURE__ */ jsx(
|
|
155
|
+
User,
|
|
156
|
+
{
|
|
157
|
+
className: `${editFieldIcon} ${semanticClassNames.editFieldIcon}`,
|
|
158
|
+
size: 14
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
/* @__PURE__ */ jsx(
|
|
162
|
+
"input",
|
|
163
|
+
{
|
|
164
|
+
className: `${editInput} ${semanticClassNames.editInput}`,
|
|
165
|
+
placeholder: "Display name (optional)",
|
|
166
|
+
type: "text",
|
|
167
|
+
value: editDisplayName,
|
|
168
|
+
onBlur: commitChanges,
|
|
169
|
+
onChange: (e) => setEditDisplayName(e.target.value),
|
|
170
|
+
onKeyDown: handleKeyDown
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
] }),
|
|
174
|
+
/* @__PURE__ */ jsxs(ActionBar, { children: [
|
|
175
|
+
/* @__PURE__ */ jsxs(ActionButton, { onClick: handleOpen, children: [
|
|
176
|
+
/* @__PURE__ */ jsx(ExternalLink, { size: 14 }),
|
|
177
|
+
"Open"
|
|
178
|
+
] }),
|
|
179
|
+
/* @__PURE__ */ jsxs(ActionButton, { danger: true, onClick: handleDelete, children: [
|
|
180
|
+
/* @__PURE__ */ jsx(Trash2, { size: 14 }),
|
|
181
|
+
"Remove"
|
|
182
|
+
] })
|
|
183
|
+
] })
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
);
|
|
170
190
|
}
|
|
171
|
-
|
|
172
|
-
|
|
191
|
+
export {
|
|
192
|
+
MentionEditRenderer,
|
|
193
|
+
M as MentionPlatformProvider,
|
|
194
|
+
MentionRenderer,
|
|
195
|
+
platformKeys,
|
|
196
|
+
platformMetaMap
|
|
197
|
+
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
:root{--rc-text:#000;--rc-text-secondary:#27272a;--rc-text-tertiary:#71717a;--rc-text-quaternary:#a1a1aa;--rc-bg:#fff;--rc-bg-secondary:#fafafa;--rc-bg-tertiary:#f4f4f5;--rc-fill:#e8e8ec;--rc-fill-secondary:#eeeeef;--rc-fill-tertiary:#f4f4f6;--rc-fill-quaternary:#f9f9fa;--rc-border:#f4f4f5;--rc-accent:#2563eb;--rc-accent-light:#2563eb20;--rc-link:#2563eb;--rc-code-text:#3f3f46;--rc-code-bg:#f4f4f5;--rc-hr-border:#e4e4e7;--rc-quote-border:#2563eb;--rc-quote-bg:#eff6ff;--rc-alert-info:#006bb7;--rc-alert-warning:#c50;--rc-alert-tip:#1c0;--rc-alert-caution:#c01;--rc-alert-important:#50c;--rc-max-width:700px;--rc-shadow-top-bar:0 8px 30px #0000001f, 0 2px 8px #0000000f;--rc-shadow-modal:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--rc-shadow-menu:0 1px 4px #0000000a, 0 4px 16px #00000014;--rc-space-xs:4px;--rc-space-sm:8px;--rc-space-md:16px;--rc-space-lg:24px;--rc-space-xl:32px;--rc-font-family-sans:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif:"Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono:"SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs:.625em;--rc-font-size-xs:.75em;--rc-font-size-sm:.8125em;--rc-font-size-md:.875em;--rc-font-size-lg:1.25em;--rc-font-size-base:16px;--rc-font-size-small:14px;--rc-line-height:1.7;--rc-line-height-tight:1.4;--rc-font-family:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm:4px;--rc-radius-md:8px;--rc-radius-lg:12px}:root.dark{--rc-text:#fafafa;--rc-text-secondary:#a1a1aa;--rc-text-tertiary:#71717a;--rc-text-quaternary:#52525b;--rc-bg:#09090b;--rc-bg-secondary:#18181b;--rc-bg-tertiary:#27272a;--rc-fill:#2a2a2f;--rc-fill-secondary:#222226;--rc-fill-tertiary:#1b1b1f;--rc-fill-quaternary:#131316;--rc-border:#27272a;--rc-accent:#60a5fa;--rc-accent-light:#60a5fa20;--rc-link:#60a5fa;--rc-code-text:#e4e4e7;--rc-code-bg:#27272a;--rc-hr-border:#27272a;--rc-quote-border:#60a5fa;--rc-quote-bg:#1e3a5f;--rc-alert-info:#7db9e5;--rc-alert-warning:#da864a;--rc-alert-tip:#54da48;--rc-alert-caution:#e16973;--rc-alert-important:#9966e0;--rc-max-width:700px;--rc-shadow-top-bar:0 8px 30px #00000073, 0 2px 8px #0000004d;--rc-shadow-modal:0 10px 15px -3px #0006, 0 4px 6px -4px #00000059;--rc-shadow-menu:0 1px 4px #00000040, 0 4px 16px #0006;--rc-space-xs:4px;--rc-space-sm:8px;--rc-space-md:16px;--rc-space-lg:24px;--rc-space-xl:32px;--rc-font-family-sans:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif:"Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono:"SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs:.625em;--rc-font-size-xs:.75em;--rc-font-size-sm:.8125em;--rc-font-size-md:.875em;--rc-font-size-lg:1.25em;--rc-font-size-base:16px;--rc-font-size-small:14px;--rc-line-height:1.7;--rc-line-height-tight:1.4;--rc-font-family:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm:4px;--rc-radius-md:8px;--rc-radius-lg:12px}._1f8km6h0{--rc-text:#000;--rc-text-secondary:#27272a;--rc-text-tertiary:#71717a;--rc-text-quaternary:#a1a1aa;--rc-bg:#fff;--rc-bg-secondary:#fafafa;--rc-bg-tertiary:#f4f4f5;--rc-fill:#e8e8ec;--rc-fill-secondary:#eeeeef;--rc-fill-tertiary:#f4f4f6;--rc-fill-quaternary:#f9f9fa;--rc-border:#f4f4f5;--rc-accent:#2563eb;--rc-accent-light:#2563eb20;--rc-link:#2563eb;--rc-code-text:#3f3f46;--rc-code-bg:#f4f4f5;--rc-hr-border:#e4e4e7;--rc-quote-border:#2563eb;--rc-quote-bg:#eff6ff;--rc-alert-info:#006bb7;--rc-alert-warning:#c50;--rc-alert-tip:#1c0;--rc-alert-caution:#c01;--rc-alert-important:#50c;--rc-max-width:700px;--rc-shadow-top-bar:0 8px 30px #0000001f, 0 2px 8px #0000000f;--rc-shadow-modal:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--rc-shadow-menu:0 1px 4px #0000000a, 0 4px 16px #00000014;--rc-space-xs:4px;--rc-space-sm:8px;--rc-space-md:16px;--rc-space-lg:24px;--rc-space-xl:32px;--rc-font-family-sans:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif:"Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono:"SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs:.625em;--rc-font-size-xs:.75em;--rc-font-size-sm:.8125em;--rc-font-size-md:.875em;--rc-font-size-lg:1.25em;--rc-font-size-base:16px;--rc-font-size-small:14px;--rc-line-height:1.7;--rc-line-height-tight:1.4;--rc-font-family:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm:4px;--rc-radius-md:8px;--rc-radius-lg:12px}._1f8km6h1{--rc-text:#000;--rc-text-secondary:#27272a;--rc-text-tertiary:#71717a;--rc-text-quaternary:#a1a1aa;--rc-bg:#fff;--rc-bg-secondary:#fafafa;--rc-bg-tertiary:#f4f4f5;--rc-fill:#e8e8ec;--rc-fill-secondary:#eeeeef;--rc-fill-tertiary:#f4f4f6;--rc-fill-quaternary:#f9f9fa;--rc-border:#f4f4f5;--rc-accent:#2563eb;--rc-accent-light:#2563eb20;--rc-link:#2563eb;--rc-code-text:#3f3f46;--rc-code-bg:#f4f4f5;--rc-hr-border:#e4e4e7;--rc-quote-border:#2563eb;--rc-quote-bg:#eff6ff;--rc-alert-info:#006bb7;--rc-alert-warning:#c50;--rc-alert-tip:#1c0;--rc-alert-caution:#c01;--rc-alert-important:#50c;--rc-max-width:700px;--rc-shadow-top-bar:0 8px 30px #0000001f, 0 2px 8px #0000000f;--rc-shadow-modal:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--rc-shadow-menu:0 1px 4px #0000000a, 0 4px 16px #00000014;--rc-space-xs:4px;--rc-space-sm:8px;--rc-space-md:16px;--rc-space-lg:24px;--rc-space-xl:32px;--rc-font-family-sans:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif:"Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono:"SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs:.625em;--rc-font-size-xs:.75em;--rc-font-size-sm:.8125em;--rc-font-size-md:.875em;--rc-font-size-lg:1.25em;--rc-font-size-base:16px;--rc-font-size-small:14px;--rc-line-height:1.8;--rc-line-height-tight:1.4;--rc-font-family:"Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-radius-sm:4px;--rc-radius-md:8px;--rc-radius-lg:12px}._1f8km6h2{--rc-text:#000;--rc-text-secondary:#27272a;--rc-text-tertiary:#71717a;--rc-text-quaternary:#a1a1aa;--rc-bg:#fff;--rc-bg-secondary:#fafafa;--rc-bg-tertiary:#f4f4f5;--rc-fill:#e8e8ec;--rc-fill-secondary:#eeeeef;--rc-fill-tertiary:#f4f4f6;--rc-fill-quaternary:#f9f9fa;--rc-border:#f4f4f5;--rc-accent:#2563eb;--rc-accent-light:#2563eb20;--rc-link:#2563eb;--rc-code-text:#3f3f46;--rc-code-bg:#f4f4f5;--rc-hr-border:#e4e4e7;--rc-quote-border:#a1a1aa;--rc-quote-bg:#fafafa;--rc-alert-info:#006bb7;--rc-alert-warning:#c50;--rc-alert-tip:#1c0;--rc-alert-caution:#c01;--rc-alert-important:#50c;--rc-max-width:none;--rc-shadow-top-bar:0 8px 30px #0000001f, 0 2px 8px #0000000f;--rc-shadow-modal:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--rc-shadow-menu:0 1px 4px #0000000a, 0 4px 16px #00000014;--rc-space-xs:2px;--rc-space-sm:4px;--rc-space-md:10px;--rc-space-lg:16px;--rc-space-xl:20px;--rc-font-family-sans:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif:"Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono:"SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs:.625em;--rc-font-size-xs:.75em;--rc-font-size-sm:.8125em;--rc-font-size-md:.875em;--rc-font-size-lg:1.25em;--rc-font-size-base:14px;--rc-font-size-small:12px;--rc-line-height:1.5;--rc-line-height-tight:1.3;--rc-font-family:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm:3px;--rc-radius-md:6px;--rc-radius-lg:12px}.dark ._1f8km6h0,[data-theme=dark] ._1f8km6h0,.dark._1f8km6h0,[data-theme=dark]._1f8km6h0,.dark ._1f8km6h1,[data-theme=dark] ._1f8km6h1,.dark._1f8km6h1,[data-theme=dark]._1f8km6h1,.dark ._1f8km6h2,[data-theme=dark] ._1f8km6h2,.dark._1f8km6h2,[data-theme=dark]._1f8km6h2{--rc-text:#fafafa;--rc-text-secondary:#a1a1aa;--rc-text-tertiary:#71717a;--rc-text-quaternary:#52525b;--rc-bg:#09090b;--rc-bg-secondary:#18181b;--rc-bg-tertiary:#27272a;--rc-fill:#2a2a2f;--rc-fill-secondary:#222226;--rc-fill-tertiary:#1b1b1f;--rc-fill-quaternary:#131316;--rc-border:#27272a;--rc-accent:#60a5fa;--rc-accent-light:#60a5fa20;--rc-link:#60a5fa;--rc-code-text:#e4e4e7;--rc-code-bg:#27272a;--rc-hr-border:#27272a;--rc-quote-border:#60a5fa;--rc-quote-bg:#1e3a5f;--rc-alert-info:#7db9e5;--rc-alert-warning:#da864a;--rc-alert-tip:#54da48;--rc-alert-caution:#e16973;--rc-alert-important:#9966e0;--rc-shadow-top-bar:0 8px 30px #00000073, 0 2px 8px #0000004d;--rc-shadow-modal:0 10px 15px -3px #0006, 0 4px 6px -4px #00000059;--rc-shadow-menu:0 1px 4px #00000040, 0 4px 16px #0006}.b6sgtu0{background:var(--rc-bg-secondary);border:1px solid var(--rc-border);vertical-align:text-bottom;white-space:nowrap;font-family:var(--rc-font-family);font-size:var(--rc-font-size-sm);color:var(--rc-text);border-radius:999px;align-items:center;gap:.3em;margin-inline-start:.25em;margin-inline-end:.25em;padding:.05em .55em;line-height:1.5;transition:border-color .15s;display:inline-flex}.b6sgtu0:hover{border-color:var(--rc-accent)}.b6sgtu1{color:var(--rc-text-secondary)}.b6sgtu2{flex-shrink:0;align-items:center;display:inline-flex}.b6sgtu2 svg{width:.85em;height:.85em;display:inline}.b6sgtu3{fill:currentColor}.b6sgtu4{color:inherit;font-weight:500;font-family:var(--rc-font-family-sans);text-decoration:none}.b6sgtu5{width:300px;font-size:var(--rc-font-size-sm);font-family:var(--rc-font-family);flex-direction:column;gap:8px;padding:12px;display:flex}.b6sgtu6{background-color:var(--rc-bg-secondary);border-radius:6px;align-items:center;gap:8px;min-width:0;padding:6px 10px;display:flex}.b6sgtu7{cursor:pointer;justify-content:center;align-items:center;margin-inline-start:.15em;margin-inline-end:.15em;display:inline-flex}.b6sgtu7 a{pointer-events:none}.b6sgtu8{justify-content:center;align-items:center;display:inline-flex}.b6sgtu9{-webkit-appearance:none;appearance:none;color:inherit;font-size:var(--rc-font-size-sm);background-color:#0000;border:none;outline:none;flex:1;min-width:0;padding:0}.b6sgtu9::placeholder{color:var(--rc-text-secondary)}.b6sgtua{-webkit-appearance:none;appearance:none;color:inherit;font-size:var(--rc-font-size-sm);cursor:pointer;background-color:#0000;border:none;outline:none;flex:1;min-width:0;padding:0}
|
|
2
|
-
/*$vite$:1*/
|
|
1
|
+
:root{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #2563eb;--rc-quote-bg: #eff6ff;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}:root.dark{--rc-text: #fafafa;--rc-text-secondary: #a1a1aa;--rc-text-tertiary: #71717a;--rc-text-quaternary: #52525b;--rc-bg: #09090b;--rc-bg-secondary: #18181b;--rc-bg-tertiary: #27272a;--rc-fill: #2a2a2f;--rc-fill-secondary: #222226;--rc-fill-tertiary: #1b1b1f;--rc-fill-quaternary: #131316;--rc-border: #27272a;--rc-accent: #60a5fa;--rc-accent-light: #60a5fa20;--rc-link: #60a5fa;--rc-code-text: #e4e4e7;--rc-code-bg: #27272a;--rc-hr-border: #27272a;--rc-quote-border: #60a5fa;--rc-quote-bg: #1e3a5f;--rc-alert-info: #7db9e5;--rc-alert-warning: #da864a;--rc-alert-tip: #54da48;--rc-alert-caution: #e16973;--rc-alert-important: #9966e0;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -4px rgba(0,0,0,.35);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.4);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}._1f8km6h0{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #2563eb;--rc-quote-bg: #eff6ff;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}._1f8km6h1{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #2563eb;--rc-quote-bg: #eff6ff;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.8;--rc-line-height-tight: 1.4;--rc-font-family: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}._1f8km6h2{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #a1a1aa;--rc-quote-bg: #fafafa;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: none;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 2px;--rc-space-sm: 4px;--rc-space-md: 10px;--rc-space-lg: 16px;--rc-space-xl: 20px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 14px;--rc-font-size-small: 12px;--rc-line-height: 1.5;--rc-line-height-tight: 1.3;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 3px;--rc-radius-md: 6px;--rc-radius-lg: 12px}.dark ._1f8km6h0,[data-theme=dark] ._1f8km6h0,.dark._1f8km6h0,[data-theme=dark]._1f8km6h0,.dark ._1f8km6h1,[data-theme=dark] ._1f8km6h1,.dark._1f8km6h1,[data-theme=dark]._1f8km6h1,.dark ._1f8km6h2,[data-theme=dark] ._1f8km6h2,.dark._1f8km6h2,[data-theme=dark]._1f8km6h2{--rc-text: #fafafa;--rc-text-secondary: #a1a1aa;--rc-text-tertiary: #71717a;--rc-text-quaternary: #52525b;--rc-bg: #09090b;--rc-bg-secondary: #18181b;--rc-bg-tertiary: #27272a;--rc-fill: #2a2a2f;--rc-fill-secondary: #222226;--rc-fill-tertiary: #1b1b1f;--rc-fill-quaternary: #131316;--rc-border: #27272a;--rc-accent: #60a5fa;--rc-accent-light: #60a5fa20;--rc-link: #60a5fa;--rc-code-text: #e4e4e7;--rc-code-bg: #27272a;--rc-hr-border: #27272a;--rc-quote-border: #60a5fa;--rc-quote-bg: #1e3a5f;--rc-alert-info: #7db9e5;--rc-alert-warning: #da864a;--rc-alert-tip: #54da48;--rc-alert-caution: #e16973;--rc-alert-important: #9966e0;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -4px rgba(0,0,0,.35);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.4)}.b6sgtu0{display:inline-flex;align-items:center;gap:.3em;padding:.05em .55em;margin-inline:.25em;border-radius:999px;background:var(--rc-bg-secondary);border:1px solid var(--rc-border);vertical-align:text-bottom;white-space:nowrap;font-family:var(--rc-font-family);font-size:var(--rc-font-size-sm);line-height:1.5;color:var(--rc-text);transition:border-color .15s ease}.b6sgtu0:hover{border-color:var(--rc-accent)}.b6sgtu1{color:var(--rc-text-secondary)}.b6sgtu2{display:inline-flex;align-items:center;flex-shrink:0}.b6sgtu2 svg{display:inline;height:.85em;width:.85em}.b6sgtu3{fill:currentColor}.b6sgtu4{text-decoration:none;color:inherit;font-weight:500;font-family:var(--rc-font-family-sans)}.b6sgtu5{display:flex;flex-direction:column;gap:8px;width:300px;padding:12px;font-size:var(--rc-font-size-sm);font-family:var(--rc-font-family)}.b6sgtu6{display:flex;align-items:center;gap:8px;padding:6px 10px;background-color:var(--rc-bg-secondary);border-radius:6px;min-width:0}.b6sgtu7{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;margin-inline:.15em}.b6sgtu7 a{pointer-events:none}.b6sgtu8{display:inline-flex;align-items:center;justify-content:center}.b6sgtu9{flex:1;appearance:none;border:none;background-color:transparent;color:inherit;font-size:var(--rc-font-size-sm);padding:0;outline:none;min-width:0}.b6sgtu9::placeholder{color:var(--rc-text-secondary)}.b6sgtua{flex:1;appearance:none;border:none;background-color:transparent;color:inherit;font-size:var(--rc-font-size-sm);padding:0;outline:none;cursor:pointer;min-width:0}
|
package/dist/static.mjs
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { M, a, p, b } from "./MentionRenderer-BGEFZlMr.js";
|
|
2
|
+
export {
|
|
3
|
+
M as MentionPlatformProvider,
|
|
4
|
+
a as MentionRenderer,
|
|
5
|
+
p as platformKeys,
|
|
6
|
+
b as platformMetaMap
|
|
7
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-renderer-mention",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.83",
|
|
4
4
|
"description": "Social mention renderer with platform badges",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@icons-pack/react-simple-icons": "^13.12.0",
|
|
29
29
|
"lucide-react": "^0.577.0",
|
|
30
|
-
"@haklex/rich-editor": "0.0.
|
|
31
|
-
"@haklex/rich-
|
|
32
|
-
"@haklex/rich-
|
|
30
|
+
"@haklex/rich-editor": "0.0.83",
|
|
31
|
+
"@haklex/rich-style-token": "0.0.83",
|
|
32
|
+
"@haklex/rich-editor-ui": "0.0.83"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@lexical/react": "^0.41.0",
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { createContext, use } from "react";
|
|
2
|
-
import { SiGithub, SiTelegram, SiX, SiZhihu } from "@icons-pack/react-simple-icons";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
//#region src/styles.css.ts
|
|
5
|
-
var semanticClassNames = {
|
|
6
|
-
mention: "rich-mention",
|
|
7
|
-
mentionIcon: "rich-mention-icon",
|
|
8
|
-
mentionIconGitHub: "rich-mention-icon-gh",
|
|
9
|
-
mentionHandle: "rich-mention-handle",
|
|
10
|
-
mentionPlain: "rich-mention-plain",
|
|
11
|
-
editPanel: "rich-mention-edit-panel",
|
|
12
|
-
editField: "rich-mention-edit-field",
|
|
13
|
-
editTrigger: "rich-mention-edit-trigger",
|
|
14
|
-
editFieldIcon: "rich-mention-edit-field-icon",
|
|
15
|
-
editInput: "rich-mention-edit-input",
|
|
16
|
-
editSelect: "rich-mention-edit-select"
|
|
17
|
-
};
|
|
18
|
-
var mention = "b6sgtu0";
|
|
19
|
-
var mentionPlain = "b6sgtu1";
|
|
20
|
-
var mentionIcon = "b6sgtu2";
|
|
21
|
-
var mentionIconGitHub = "b6sgtu3";
|
|
22
|
-
var mentionHandle = "b6sgtu4";
|
|
23
|
-
var editPanel = "b6sgtu5";
|
|
24
|
-
var editField = "b6sgtu6";
|
|
25
|
-
var editTrigger = "b6sgtu7";
|
|
26
|
-
var editFieldIcon = "b6sgtu8";
|
|
27
|
-
var editInput = "b6sgtu9";
|
|
28
|
-
var editSelect = "b6sgtua";
|
|
29
|
-
//#endregion
|
|
30
|
-
//#region src/MentionRenderer.tsx
|
|
31
|
-
var ExtraPlatformContext = createContext({});
|
|
32
|
-
function MentionPlatformProvider({ platforms, children }) {
|
|
33
|
-
return /* @__PURE__ */ jsx(ExtraPlatformContext, {
|
|
34
|
-
value: platforms,
|
|
35
|
-
children
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function useExtraPlatforms() {
|
|
39
|
-
return use(ExtraPlatformContext);
|
|
40
|
-
}
|
|
41
|
-
var platformMetaMap = {
|
|
42
|
-
GH: {
|
|
43
|
-
label: "GitHub",
|
|
44
|
-
icon: /* @__PURE__ */ jsx(SiGithub, {
|
|
45
|
-
className: `${mentionIconGitHub} ${semanticClassNames.mentionIconGitHub}`,
|
|
46
|
-
size: "1em"
|
|
47
|
-
}),
|
|
48
|
-
getUrl: (handle) => `https://github.com/${encodeURIComponent(handle)}`
|
|
49
|
-
},
|
|
50
|
-
TW: {
|
|
51
|
-
label: "Twitter",
|
|
52
|
-
icon: /* @__PURE__ */ jsx(SiX, {
|
|
53
|
-
color: "#1DA1F2",
|
|
54
|
-
size: "1em"
|
|
55
|
-
}),
|
|
56
|
-
getUrl: (handle) => `https://twitter.com/${encodeURIComponent(handle)}`
|
|
57
|
-
},
|
|
58
|
-
TG: {
|
|
59
|
-
label: "Telegram",
|
|
60
|
-
icon: /* @__PURE__ */ jsx(SiTelegram, {
|
|
61
|
-
color: "#2AABEE",
|
|
62
|
-
size: "1em"
|
|
63
|
-
}),
|
|
64
|
-
getUrl: (handle) => `https://t.me/${encodeURIComponent(handle)}`
|
|
65
|
-
},
|
|
66
|
-
ZH: {
|
|
67
|
-
label: "Zhihu",
|
|
68
|
-
icon: /* @__PURE__ */ jsx(SiZhihu, {
|
|
69
|
-
color: "#0084FF",
|
|
70
|
-
size: "1em"
|
|
71
|
-
}),
|
|
72
|
-
getUrl: (handle) => `https://www.zhihu.com/people/${encodeURIComponent(handle)}`
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
var platformKeys = Object.keys(platformMetaMap);
|
|
76
|
-
function MentionRenderer({ platform, handle, displayName }) {
|
|
77
|
-
const extraPlatforms = useExtraPlatforms();
|
|
78
|
-
const normalizedHandle = handle.replace(/^@+/, "");
|
|
79
|
-
const meta = platformMetaMap[platform] ?? extraPlatforms[platform];
|
|
80
|
-
const label = displayName || normalizedHandle;
|
|
81
|
-
if (meta) return /* @__PURE__ */ jsxs("span", {
|
|
82
|
-
className: `${mention} ${semanticClassNames.mention}`,
|
|
83
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
84
|
-
"aria-hidden": true,
|
|
85
|
-
className: `${mentionIcon} ${semanticClassNames.mentionIcon}`,
|
|
86
|
-
children: meta.icon
|
|
87
|
-
}), /* @__PURE__ */ jsx("a", {
|
|
88
|
-
className: `${mentionHandle} ${semanticClassNames.mentionHandle}`,
|
|
89
|
-
href: meta.getUrl(normalizedHandle),
|
|
90
|
-
rel: "noopener noreferrer",
|
|
91
|
-
target: "_blank",
|
|
92
|
-
children: label
|
|
93
|
-
})]
|
|
94
|
-
});
|
|
95
|
-
return /* @__PURE__ */ jsx("span", {
|
|
96
|
-
className: `${mention} ${semanticClassNames.mention} ${mentionPlain} ${semanticClassNames.mentionPlain}`,
|
|
97
|
-
children: /* @__PURE__ */ jsxs("span", {
|
|
98
|
-
className: `${mentionHandle} ${semanticClassNames.mentionHandle}`,
|
|
99
|
-
children: ["@", label]
|
|
100
|
-
})
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
//#endregion
|
|
104
|
-
export { editField as a, editPanel as c, semanticClassNames as d, platformMetaMap as i, editSelect as l, MentionRenderer as n, editFieldIcon as o, platformKeys as r, editInput as s, MentionPlatformProvider as t, editTrigger as u };
|