@haklex/rich-static-renderer 0.0.80 → 0.0.82
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/RichRenderer.d.ts.map +1 -1
- package/dist/index.mjs +353 -389
- package/dist/rich-static-renderer.css +2 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichRenderer.d.ts","sourceRoot":"","sources":["../src/RichRenderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RichRenderer.d.ts","sourceRoot":"","sources":["../src/RichRenderer.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAuB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAwMtE,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,OAAmB,EACnB,KAAe,EACf,SAAS,EACT,KAAK,EACL,EAAE,EAAE,SAAiB,EACrB,cAAc,EACd,UAAU,EACV,oBAAoB,GACrB,EAAE,iBAAiB,2CAmCnB"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,419 +1,383 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RendererWrapper, RubyRenderer, getTagBgColor, LinkFavicon, getVariantClass, allNodes, ColorSchemeProvider, RendererConfigProvider, FootnoteDefinitionsProvider, NestedContentRendererProvider, editorTheme } from "@haklex/rich-editor/static";
|
|
1
|
+
import { ColorSchemeProvider, FootnoteDefinitionsProvider, LinkFavicon, NestedContentRendererProvider, RendererConfigProvider, RendererWrapper, RubyRenderer, allNodes, editorTheme, getTagBgColor, getVariantClass, useOptionalNestedContentRenderer } from "@haklex/rich-editor/static";
|
|
3
2
|
import { PortalThemeProvider } from "@haklex/rich-style-token";
|
|
4
3
|
import { createHeadlessEditor } from "@lexical/headless";
|
|
5
4
|
import { $getRoot } from "lexical";
|
|
6
|
-
import {
|
|
5
|
+
import { cloneElement, createElement, isValidElement, useMemo } from "react";
|
|
7
6
|
import { Link } from "lucide-react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/table.css.ts
|
|
8
9
|
var tableWrapper = "_1v9yxw30";
|
|
9
10
|
var table = "_1v9yxw31";
|
|
10
11
|
var tableHead = "_1v9yxw32";
|
|
11
12
|
var tableCell = "_1v9yxw33";
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/engine/renderBuiltinNode.tsx
|
|
12
15
|
function textToSlug(text) {
|
|
13
|
-
|
|
16
|
+
return text.toLowerCase().trim().replaceAll(/[^\s\w\u3000-\u9FFF\uAC00-\uD7AF\uFF00-\uFFEF-]/g, "").replaceAll(/[\s_]+/g, "-").replaceAll(/^-+|-+$/g, "");
|
|
14
17
|
}
|
|
15
18
|
function extractText(node) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
if (node.text) return node.text;
|
|
20
|
+
if (node.children) return node.children.map(extractText).join("");
|
|
21
|
+
return "";
|
|
19
22
|
}
|
|
20
23
|
function renderBuiltinNode(node, key, children, headingSlugs, textContent) {
|
|
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
|
-
|
|
24
|
+
switch (node.type) {
|
|
25
|
+
case "root": return /* @__PURE__ */ jsx(Fragment, { children });
|
|
26
|
+
case "paragraph": return /* @__PURE__ */ jsx("p", {
|
|
27
|
+
className: "rich-paragraph",
|
|
28
|
+
style: node.format ? { textAlign: node.format } : void 0,
|
|
29
|
+
children
|
|
30
|
+
}, key);
|
|
31
|
+
case "heading": {
|
|
32
|
+
const Tag = node.tag;
|
|
33
|
+
const baseSlug = textToSlug(textContent || extractText(node));
|
|
34
|
+
let slug = baseSlug;
|
|
35
|
+
if (baseSlug) {
|
|
36
|
+
const count = headingSlugs.get(baseSlug);
|
|
37
|
+
if (count !== void 0) {
|
|
38
|
+
slug = `${baseSlug}-${count}`;
|
|
39
|
+
headingSlugs.set(baseSlug, count + 1);
|
|
40
|
+
} else headingSlugs.set(baseSlug, 1);
|
|
41
|
+
}
|
|
42
|
+
return /* @__PURE__ */ jsxs(Tag, {
|
|
43
|
+
className: `rich-heading-${Tag}`,
|
|
44
|
+
id: slug || void 0,
|
|
45
|
+
children: [slug && /* @__PURE__ */ jsx("a", {
|
|
46
|
+
className: "rich-heading-anchor",
|
|
47
|
+
href: `#${slug}`,
|
|
48
|
+
tabIndex: 0,
|
|
49
|
+
children: /* @__PURE__ */ jsx(Link, {
|
|
50
|
+
"aria-hidden": true,
|
|
51
|
+
size: 14,
|
|
52
|
+
strokeWidth: 2
|
|
53
|
+
})
|
|
54
|
+
}), children]
|
|
55
|
+
}, key);
|
|
56
|
+
}
|
|
57
|
+
case "quote": return /* @__PURE__ */ jsx("blockquote", {
|
|
58
|
+
className: "rich-quote",
|
|
59
|
+
children
|
|
60
|
+
}, key);
|
|
61
|
+
case "list": return /* @__PURE__ */ jsx(node.listType === "number" ? "ol" : "ul", {
|
|
62
|
+
className: node.listType === "number" ? "rich-list-ol" : node.listType === "check" ? "rich-checklist rich-list-ul" : "rich-list-ul",
|
|
63
|
+
start: node.start !== 1 ? node.start : void 0,
|
|
64
|
+
children
|
|
65
|
+
}, key);
|
|
66
|
+
case "listitem": {
|
|
67
|
+
const isChecklist = node.checked !== void 0;
|
|
68
|
+
const hasNestedList = node.children?.some((c) => c.type === "list");
|
|
69
|
+
let cls;
|
|
70
|
+
if (hasNestedList) cls = "rich-list-nested-item";
|
|
71
|
+
else if (isChecklist) cls = node.checked ? "rich-list-item rich-list-item-checked" : "rich-list-item rich-list-item-unchecked";
|
|
72
|
+
else cls = "rich-list-item";
|
|
73
|
+
return /* @__PURE__ */ jsx("li", {
|
|
74
|
+
className: cls,
|
|
75
|
+
value: node.value,
|
|
76
|
+
children
|
|
77
|
+
}, key);
|
|
78
|
+
}
|
|
79
|
+
case "link": return /* @__PURE__ */ jsxs("a", {
|
|
80
|
+
className: "rich-link",
|
|
81
|
+
href: node.url,
|
|
82
|
+
rel: node.rel || "noopener",
|
|
83
|
+
target: node.target || "_blank",
|
|
84
|
+
children: [/* @__PURE__ */ jsx(LinkFavicon, { href: node.url }), children]
|
|
85
|
+
}, key);
|
|
86
|
+
case "autolink": return /* @__PURE__ */ jsxs("a", {
|
|
87
|
+
className: "rich-link",
|
|
88
|
+
href: node.url,
|
|
89
|
+
rel: "noopener",
|
|
90
|
+
target: "_blank",
|
|
91
|
+
children: [/* @__PURE__ */ jsx(LinkFavicon, { href: node.url }), children]
|
|
92
|
+
}, key);
|
|
93
|
+
case "horizontalrule": return /* @__PURE__ */ jsx("hr", { className: "rich-hr" }, key);
|
|
94
|
+
case "table": return /* @__PURE__ */ jsx("div", {
|
|
95
|
+
className: tableWrapper,
|
|
96
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
97
|
+
className: table,
|
|
98
|
+
children
|
|
99
|
+
})
|
|
100
|
+
}, key);
|
|
101
|
+
case "tablerow": return /* @__PURE__ */ jsx("tr", { children }, key);
|
|
102
|
+
case "tablecell": return /* @__PURE__ */ jsx(node.headerState ? "th" : "td", {
|
|
103
|
+
className: node.headerState ? tableHead : tableCell,
|
|
104
|
+
colSpan: node.colSpan > 1 ? node.colSpan : void 0,
|
|
105
|
+
children
|
|
106
|
+
}, key);
|
|
107
|
+
case "details": {
|
|
108
|
+
const summary = node.summary || "";
|
|
109
|
+
return /* @__PURE__ */ jsxs("details", {
|
|
110
|
+
className: "rich-details",
|
|
111
|
+
open: node.open || void 0,
|
|
112
|
+
children: [/* @__PURE__ */ jsxs("summary", {
|
|
113
|
+
className: "rich-details-summary",
|
|
114
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
115
|
+
"aria-hidden": "true",
|
|
116
|
+
className: "rich-details-chevron",
|
|
117
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
118
|
+
fill: "none",
|
|
119
|
+
height: "20",
|
|
120
|
+
stroke: "currentColor",
|
|
121
|
+
strokeLinecap: "round",
|
|
122
|
+
strokeLinejoin: "round",
|
|
123
|
+
strokeWidth: "1.5",
|
|
124
|
+
viewBox: "0 0 20 20",
|
|
125
|
+
width: "20",
|
|
126
|
+
children: /* @__PURE__ */ jsx("path", { d: "M8 6L12 10L8 14" })
|
|
127
|
+
})
|
|
128
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
129
|
+
className: "rich-details-summary-text",
|
|
130
|
+
children: summary
|
|
131
|
+
})]
|
|
132
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
133
|
+
className: "rich-details-content",
|
|
134
|
+
children
|
|
135
|
+
})]
|
|
136
|
+
}, key);
|
|
137
|
+
}
|
|
138
|
+
case "spoiler": return /* @__PURE__ */ jsx("span", {
|
|
139
|
+
className: "rich-spoiler",
|
|
140
|
+
role: "button",
|
|
141
|
+
tabIndex: 0,
|
|
142
|
+
children
|
|
143
|
+
}, key);
|
|
144
|
+
case "tag": return /* @__PURE__ */ jsx("span", {
|
|
145
|
+
className: "rich-tag",
|
|
146
|
+
style: { backgroundColor: getTagBgColor(node.text) },
|
|
147
|
+
children: node.text
|
|
148
|
+
}, key);
|
|
149
|
+
case "ruby": return createElement(RendererWrapper, {
|
|
150
|
+
key,
|
|
151
|
+
rendererKey: "Ruby",
|
|
152
|
+
defaultRenderer: RubyRenderer,
|
|
153
|
+
props: {
|
|
154
|
+
reading: node.reading ?? "",
|
|
155
|
+
children
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
case "code": return /* @__PURE__ */ jsx("pre", {
|
|
159
|
+
className: "rich-code-block",
|
|
160
|
+
children: /* @__PURE__ */ jsx("code", { children })
|
|
161
|
+
}, key);
|
|
162
|
+
case "code-highlight": return /* @__PURE__ */ jsx("span", { children: node.text }, key);
|
|
163
|
+
case "linebreak": return /* @__PURE__ */ jsx("br", {}, key);
|
|
164
|
+
case "tab": return /* @__PURE__ */ jsx("span", { children: " " }, key);
|
|
165
|
+
default: return null;
|
|
166
|
+
}
|
|
161
167
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/engine/renderTextNode.tsx
|
|
170
|
+
var FORMAT_FLAGS = [
|
|
171
|
+
[1, "rich-text-bold"],
|
|
172
|
+
[2, "rich-text-italic"],
|
|
173
|
+
[4, "rich-text-strikethrough"],
|
|
174
|
+
[8, "rich-text-underline"],
|
|
175
|
+
[16, "rich-text-code"],
|
|
176
|
+
[32, "rich-text-subscript"],
|
|
177
|
+
[64, "rich-text-superscript"],
|
|
178
|
+
[128, "rich-text-highlight"]
|
|
171
179
|
];
|
|
172
180
|
function parseCSSText(cssText) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
const style = {};
|
|
182
|
+
for (const part of cssText.split(";")) {
|
|
183
|
+
const colonIndex = part.indexOf(":");
|
|
184
|
+
if (colonIndex === -1) continue;
|
|
185
|
+
const prop = part.slice(0, colonIndex).trim();
|
|
186
|
+
const value = part.slice(colonIndex + 1).trim();
|
|
187
|
+
if (!prop || !value) continue;
|
|
188
|
+
const camelProp = prop.replaceAll(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
189
|
+
style[camelProp] = value;
|
|
190
|
+
}
|
|
191
|
+
return style;
|
|
184
192
|
}
|
|
185
193
|
function renderTextNode(node, key) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
let element = node.text;
|
|
195
|
+
const format = node.format || 0;
|
|
196
|
+
for (const [flag, className] of FORMAT_FLAGS) if (format & flag) element = /* @__PURE__ */ jsx("span", {
|
|
197
|
+
className,
|
|
198
|
+
children: element
|
|
199
|
+
}, `${key}-${flag}`);
|
|
200
|
+
if (node.style) element = /* @__PURE__ */ jsx("span", {
|
|
201
|
+
style: parseCSSText(node.style),
|
|
202
|
+
children: element
|
|
203
|
+
}, key);
|
|
204
|
+
return element;
|
|
197
205
|
}
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/preprocess/footnote.ts
|
|
198
208
|
function preprocessFootnotes(state) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
walk(state);
|
|
228
|
-
for (const id of seen) {
|
|
229
|
-
if (!(id in definitions)) {
|
|
230
|
-
definitions[id] = "";
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return { definitions, displayNumberMap };
|
|
209
|
+
const definitions = {};
|
|
210
|
+
const seen = /* @__PURE__ */ new Set();
|
|
211
|
+
const displayNumberMap = {};
|
|
212
|
+
let counter = 1;
|
|
213
|
+
function walk(node) {
|
|
214
|
+
if (node.type === "footnote" && node.identifier) {
|
|
215
|
+
const id = node.identifier;
|
|
216
|
+
if (!seen.has(id)) {
|
|
217
|
+
seen.add(id);
|
|
218
|
+
displayNumberMap[id] = counter++;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (node.type === "footnote-section" && node.definitions) Object.assign(definitions, node.definitions);
|
|
222
|
+
if (node.children) for (const child of node.children) walk(child);
|
|
223
|
+
if (node.root) walk(node.root);
|
|
224
|
+
if (node.content && typeof node.content === "object" && node.content.root) walk(node.content);
|
|
225
|
+
if (node.cells && Array.isArray(node.cells)) {
|
|
226
|
+
for (const cell of node.cells) if (cell && cell.root) walk(cell);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
walk(state);
|
|
230
|
+
for (const id of seen) if (!(id in definitions)) definitions[id] = "";
|
|
231
|
+
return {
|
|
232
|
+
definitions,
|
|
233
|
+
displayNumberMap
|
|
234
|
+
};
|
|
234
235
|
}
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/RichRenderer.tsx
|
|
235
238
|
function wrapDecoration(serialized, key, decoration) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
default: {
|
|
255
|
-
if (isValidElement(decoration)) {
|
|
256
|
-
return cloneElement(decoration, { key });
|
|
257
|
-
}
|
|
258
|
-
return decoration;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
239
|
+
switch (serialized.type) {
|
|
240
|
+
case "alert-quote": return createElement("div", {
|
|
241
|
+
key,
|
|
242
|
+
className: `rich-alert rich-alert-${serialized.alertType}`
|
|
243
|
+
}, decoration);
|
|
244
|
+
case "banner": return createElement("div", {
|
|
245
|
+
key,
|
|
246
|
+
className: `rich-banner rich-banner-${serialized.bannerType}`
|
|
247
|
+
}, decoration);
|
|
248
|
+
case "grid-container": return createElement("div", {
|
|
249
|
+
key,
|
|
250
|
+
className: "rich-grid-container"
|
|
251
|
+
}, decoration);
|
|
252
|
+
default:
|
|
253
|
+
if (isValidElement(decoration)) return cloneElement(decoration, { key });
|
|
254
|
+
return decoration;
|
|
255
|
+
}
|
|
261
256
|
}
|
|
262
257
|
function applyBlockId(element, blockId, nodeKey) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
258
|
+
if (!blockId) return element;
|
|
259
|
+
if (isValidElement(element) && typeof element.type === "string") return cloneElement(element, { "data-block-id": blockId });
|
|
260
|
+
return /* @__PURE__ */ jsx("div", {
|
|
261
|
+
className: "rich-block-anchor",
|
|
262
|
+
"data-block-id": blockId,
|
|
263
|
+
children: element
|
|
264
|
+
}, `${nodeKey}-block-anchor`);
|
|
268
265
|
}
|
|
269
266
|
function renderTree(node, editor, editorConfig, headingSlugs, key, blockId, builtinNodeOverrides) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
children = childNodes.map(
|
|
290
|
-
(child, i) => renderTree(
|
|
291
|
-
child,
|
|
292
|
-
editor,
|
|
293
|
-
editorConfig,
|
|
294
|
-
headingSlugs,
|
|
295
|
-
`${nodeKey}-${i}`,
|
|
296
|
-
void 0,
|
|
297
|
-
builtinNodeOverrides
|
|
298
|
-
)
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
const textContent = node.getTextContent ? node.getTextContent() : void 0;
|
|
303
|
-
const override = builtinNodeOverrides?.[serialized.type];
|
|
304
|
-
if (override) {
|
|
305
|
-
const defaultRenderer = () => renderBuiltinNode(serialized, nodeKey, children, headingSlugs, textContent);
|
|
306
|
-
return applyBlockId(override(serialized, nodeKey, children, defaultRenderer), blockId, nodeKey);
|
|
307
|
-
}
|
|
308
|
-
return applyBlockId(
|
|
309
|
-
renderBuiltinNode(serialized, nodeKey, children, headingSlugs, textContent),
|
|
310
|
-
blockId,
|
|
311
|
-
nodeKey
|
|
312
|
-
);
|
|
267
|
+
const nodeKey = node.getKey ? node.getKey() : key;
|
|
268
|
+
if (typeof node.decorate === "function") try {
|
|
269
|
+
const decoration = node.decorate(editor, editorConfig);
|
|
270
|
+
if (decoration != null) return applyBlockId(wrapDecoration(node.exportJSON ? node.exportJSON() : {}, nodeKey, decoration), blockId, nodeKey);
|
|
271
|
+
} catch {}
|
|
272
|
+
const serialized = node.exportJSON ? node.exportJSON() : {};
|
|
273
|
+
if (serialized.type === "text") return renderTextNode(serialized, nodeKey);
|
|
274
|
+
let children = null;
|
|
275
|
+
if (node.getChildren) {
|
|
276
|
+
const childNodes = node.getChildren();
|
|
277
|
+
if (childNodes.length > 0) children = childNodes.map((child, i) => renderTree(child, editor, editorConfig, headingSlugs, `${nodeKey}-${i}`, void 0, builtinNodeOverrides));
|
|
278
|
+
}
|
|
279
|
+
const textContent = node.getTextContent ? node.getTextContent() : void 0;
|
|
280
|
+
const override = builtinNodeOverrides?.[serialized.type];
|
|
281
|
+
if (override) {
|
|
282
|
+
const defaultRenderer = () => renderBuiltinNode(serialized, nodeKey, children, headingSlugs, textContent);
|
|
283
|
+
return applyBlockId(override(serialized, nodeKey, children, defaultRenderer), blockId, nodeKey);
|
|
284
|
+
}
|
|
285
|
+
return applyBlockId(renderBuiltinNode(serialized, nodeKey, children, headingSlugs, textContent), blockId, nodeKey);
|
|
313
286
|
}
|
|
314
287
|
function renderEditorToReact(value, nodes, builtinNodeOverrides) {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
(child, i) => renderTree(
|
|
367
|
-
child,
|
|
368
|
-
nestedEditor,
|
|
369
|
-
nestedEditorConfig,
|
|
370
|
-
headingSlugs,
|
|
371
|
-
`nested-${i}`,
|
|
372
|
-
nestedRawChildren?.[i]?.$?.blockId,
|
|
373
|
-
builtinNodeOverrides
|
|
374
|
-
)
|
|
375
|
-
);
|
|
376
|
-
nested = /* @__PURE__ */ jsx(Fragment, { children: ch });
|
|
377
|
-
});
|
|
378
|
-
return nested;
|
|
379
|
-
};
|
|
380
|
-
return { content, footnoteData, renderNestedContent };
|
|
288
|
+
const editor = createHeadlessEditor({
|
|
289
|
+
nodes,
|
|
290
|
+
theme: editorTheme,
|
|
291
|
+
editable: false,
|
|
292
|
+
onError: (error) => {
|
|
293
|
+
console.error("[RichRenderer]", error);
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
const editorConfig = {
|
|
297
|
+
namespace: "ssr",
|
|
298
|
+
theme: editorTheme
|
|
299
|
+
};
|
|
300
|
+
const editorState = editor.parseEditorState(value);
|
|
301
|
+
editor.setEditorState(editorState);
|
|
302
|
+
const footnoteData = preprocessFootnotes(value);
|
|
303
|
+
const rawRootChildren = value.root?.children;
|
|
304
|
+
let content = null;
|
|
305
|
+
editorState.read(() => {
|
|
306
|
+
const root = $getRoot();
|
|
307
|
+
const headingSlugs = /* @__PURE__ */ new Map();
|
|
308
|
+
content = /* @__PURE__ */ jsx(Fragment, { children: root.getChildren().map((child, i) => renderTree(child, editor, editorConfig, headingSlugs, `ssr-${i}`, rawRootChildren?.[i]?.$?.blockId, builtinNodeOverrides)) });
|
|
309
|
+
});
|
|
310
|
+
const renderNestedContent = (state) => {
|
|
311
|
+
const nestedEditor = createHeadlessEditor({
|
|
312
|
+
nodes,
|
|
313
|
+
theme: editorTheme,
|
|
314
|
+
editable: false,
|
|
315
|
+
onError: (error) => {
|
|
316
|
+
console.error("[RichRenderer:nested]", error);
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
const nestedEditorConfig = {
|
|
320
|
+
namespace: "ssr-nested",
|
|
321
|
+
theme: editorTheme
|
|
322
|
+
};
|
|
323
|
+
const nestedState = nestedEditor.parseEditorState(state);
|
|
324
|
+
nestedEditor.setEditorState(nestedState);
|
|
325
|
+
let nested = null;
|
|
326
|
+
const nestedRawChildren = state.root?.children;
|
|
327
|
+
nestedState.read(() => {
|
|
328
|
+
const root = $getRoot();
|
|
329
|
+
const headingSlugs = /* @__PURE__ */ new Map();
|
|
330
|
+
nested = /* @__PURE__ */ jsx(Fragment, { children: root.getChildren().map((child, i) => renderTree(child, nestedEditor, nestedEditorConfig, headingSlugs, `nested-${i}`, nestedRawChildren?.[i]?.$?.blockId, builtinNodeOverrides)) });
|
|
331
|
+
});
|
|
332
|
+
return nested;
|
|
333
|
+
};
|
|
334
|
+
return {
|
|
335
|
+
content,
|
|
336
|
+
footnoteData,
|
|
337
|
+
renderNestedContent
|
|
338
|
+
};
|
|
381
339
|
}
|
|
382
|
-
function RichRenderer({
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
340
|
+
function RichRenderer({ value, variant = "article", theme = "light", className, style, as: Component = "div", rendererConfig, extraNodes, builtinNodeOverrides }) {
|
|
341
|
+
const variantClass = getVariantClass(variant);
|
|
342
|
+
const outerRenderNestedContent = useOptionalNestedContentRenderer();
|
|
343
|
+
const { content, footnoteData, renderNestedContent } = useMemo(() => {
|
|
344
|
+
return renderEditorToReact(value, extraNodes ? [...allNodes, ...extraNodes] : allNodes, builtinNodeOverrides);
|
|
345
|
+
}, [
|
|
346
|
+
builtinNodeOverrides,
|
|
347
|
+
extraNodes,
|
|
348
|
+
value
|
|
349
|
+
]);
|
|
350
|
+
const classes = [
|
|
351
|
+
"rich-content",
|
|
352
|
+
variantClass,
|
|
353
|
+
className
|
|
354
|
+
].filter(Boolean).join(" ");
|
|
355
|
+
return /* @__PURE__ */ jsx(PortalThemeProvider, {
|
|
356
|
+
className: variantClass,
|
|
357
|
+
theme,
|
|
358
|
+
children: /* @__PURE__ */ jsx(ColorSchemeProvider, {
|
|
359
|
+
colorScheme: theme,
|
|
360
|
+
children: /* @__PURE__ */ jsx(RendererConfigProvider, {
|
|
361
|
+
config: rendererConfig,
|
|
362
|
+
mode: "renderer",
|
|
363
|
+
variant,
|
|
364
|
+
children: /* @__PURE__ */ jsx(FootnoteDefinitionsProvider, {
|
|
365
|
+
definitions: footnoteData.definitions,
|
|
366
|
+
displayNumberMap: footnoteData.displayNumberMap,
|
|
367
|
+
children: /* @__PURE__ */ jsx(NestedContentRendererProvider, {
|
|
368
|
+
value: outerRenderNestedContent ?? renderNestedContent,
|
|
369
|
+
children: /* @__PURE__ */ jsx(Component, {
|
|
370
|
+
suppressHydrationWarning: true,
|
|
371
|
+
className: classes,
|
|
372
|
+
"data-theme": theme,
|
|
373
|
+
style,
|
|
374
|
+
children: content
|
|
375
|
+
})
|
|
376
|
+
})
|
|
377
|
+
})
|
|
378
|
+
})
|
|
379
|
+
})
|
|
380
|
+
});
|
|
416
381
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
};
|
|
382
|
+
//#endregion
|
|
383
|
+
export { RichRenderer };
|
|
@@ -1 +1,2 @@
|
|
|
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}.km6fx0{--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}.km6fx1{--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}.km6fx2{--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 .km6fx0,[data-theme=dark] .km6fx0,.dark.km6fx0,[data-theme=dark].km6fx0,.dark .km6fx1,[data-theme=dark] .km6fx1,.dark.km6fx1,[data-theme=dark].km6fx1,.dark .km6fx2,[data-theme=dark] .km6fx2,.dark.km6fx2,[data-theme=dark].km6fx2{--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)}._1v9yxw30{overflow-x:auto}._1v9yxw31{width:100%;caption-side:bottom;border-collapse:collapse;font-size:var(--rc-font-size-small)}._1v9yxw32{height:2.5rem;padding:0 var(--rc-space-lg);vertical-align:middle;font-weight:500;white-space:nowrap;color:var(--rc-text-secondary);line-height:1.5}._1v9yxw33{padding:var(--rc-space-lg);vertical-align:middle;line-height:1.5}._1v9yxw31 tr:has(._1v9yxw32){border-bottom:1px solid var(--rc-border)}._1v9yxw31 tr:has(._1v9yxw33):nth-child(2n){background-color:var(--rc-bg-secondary)}._1v9yxw31:has(tr:hover) tr:has(._1v9yxw33):nth-child(2n):not(:hover){background-color:transparent}._1v9yxw31 tr:has(._1v9yxw33){transition:background-color .15s}._1v9yxw31 tr:has(._1v9yxw33):hover{background-color:var(--rc-fill-tertiary)}._1v9yxw31 .rich-paragraph{margin:0;padding:0;line-height:inherit}
|
|
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}.km6fx0{--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}.km6fx1{--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}.km6fx2{--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 .km6fx0,[data-theme=dark] .km6fx0,.dark.km6fx0,[data-theme=dark].km6fx0,.dark .km6fx1,[data-theme=dark] .km6fx1,.dark.km6fx1,[data-theme=dark].km6fx1,.dark .km6fx2,[data-theme=dark] .km6fx2,.dark.km6fx2,[data-theme=dark].km6fx2{--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}._1v9yxw30{overflow-x:auto}._1v9yxw31{caption-side:bottom;border-collapse:collapse;width:100%;font-size:var(--rc-font-size-small)}._1v9yxw32{height:2.5rem;padding:0 var(--rc-space-lg);vertical-align:middle;white-space:nowrap;color:var(--rc-text-secondary);font-weight:500;line-height:1.5}._1v9yxw33{padding:var(--rc-space-lg);vertical-align:middle;line-height:1.5}._1v9yxw31 tr:has(._1v9yxw32){border-bottom:1px solid var(--rc-border)}._1v9yxw31 tr:has(._1v9yxw33):nth-child(2n){background-color:var(--rc-bg-secondary)}._1v9yxw31:has(tr:hover) tr:has(._1v9yxw33):nth-child(2n):not(:hover){background-color:#0000}._1v9yxw31 tr:has(._1v9yxw33){transition:background-color .15s}._1v9yxw31 tr:has(._1v9yxw33):hover{background-color:var(--rc-fill-tertiary)}._1v9yxw31 .rich-paragraph{line-height:inherit;margin:0;padding:0}
|
|
2
|
+
/*$vite$:1*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-static-renderer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.82",
|
|
4
4
|
"description": "Headless SSR engine for Lexical rich content",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"@lexical/code": "npm:lexical-code-no-prism@0.41.0",
|
|
24
24
|
"@lexical/headless": "^0.41.0",
|
|
25
25
|
"lucide-react": "^0.577.0",
|
|
26
|
-
"@haklex/rich-editor": "0.0.
|
|
27
|
-
"@haklex/rich-style-token": "0.0.
|
|
26
|
+
"@haklex/rich-editor": "0.0.82",
|
|
27
|
+
"@haklex/rich-style-token": "0.0.82"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@lexical/extension": "^0.41.0",
|