@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.
@@ -1 +1 @@
1
- {"version":3,"file":"RichRenderer.d.ts","sourceRoot":"","sources":["../src/RichRenderer.tsx"],"names":[],"mappings":"AAkBA,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,2CAiCnB"}
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 { jsx, jsxs, Fragment } from "react/jsx-runtime";
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 { createElement, useMemo, isValidElement, cloneElement } from "react";
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
- return text.toLowerCase().trim().replaceAll(/[^\s\w\u3000-\u9FFF\uAC00-\uD7AF\uFF00-\uFFEF-]/g, "").replaceAll(/[\s_]+/g, "-").replaceAll(/^-+|-+$/g, "");
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
- if (node.text) return node.text;
17
- if (node.children) return node.children.map(extractText).join("");
18
- return "";
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
- switch (node.type) {
22
- case "root": {
23
- return /* @__PURE__ */ jsx(Fragment, { children });
24
- }
25
- case "paragraph": {
26
- const align = node.format ? { textAlign: node.format } : void 0;
27
- return /* @__PURE__ */ jsx("p", { className: "rich-paragraph", style: align, children }, key);
28
- }
29
- case "heading": {
30
- const Tag = node.tag;
31
- const text = textContent || extractText(node);
32
- const baseSlug = textToSlug(text);
33
- let slug = baseSlug;
34
- if (baseSlug) {
35
- const count = headingSlugs.get(baseSlug);
36
- if (count !== void 0) {
37
- slug = `${baseSlug}-${count}`;
38
- headingSlugs.set(baseSlug, count + 1);
39
- } else {
40
- headingSlugs.set(baseSlug, 1);
41
- }
42
- }
43
- return /* @__PURE__ */ jsxs(Tag, { className: `rich-heading-${Tag}`, id: slug || void 0, children: [
44
- slug && /* @__PURE__ */ jsx("a", { className: "rich-heading-anchor", href: `#${slug}`, tabIndex: 0, children: /* @__PURE__ */ jsx(Link, { "aria-hidden": true, size: 14, strokeWidth: 2 }) }),
45
- children
46
- ] }, key);
47
- }
48
- case "quote": {
49
- return /* @__PURE__ */ jsx("blockquote", { className: "rich-quote", children }, key);
50
- }
51
- case "list": {
52
- const Tag = node.listType === "number" ? "ol" : "ul";
53
- const cls = node.listType === "number" ? "rich-list-ol" : node.listType === "check" ? "rich-checklist rich-list-ul" : "rich-list-ul";
54
- return /* @__PURE__ */ jsx(Tag, { className: cls, start: node.start !== 1 ? node.start : void 0, children }, key);
55
- }
56
- case "listitem": {
57
- const isChecklist = node.checked !== void 0;
58
- const hasNestedList = node.children?.some((c) => c.type === "list");
59
- let cls;
60
- if (hasNestedList) {
61
- cls = "rich-list-nested-item";
62
- } else if (isChecklist) {
63
- cls = node.checked ? "rich-list-item rich-list-item-checked" : "rich-list-item rich-list-item-unchecked";
64
- } else {
65
- cls = "rich-list-item";
66
- }
67
- return /* @__PURE__ */ jsx("li", { className: cls, value: node.value, children }, key);
68
- }
69
- case "link": {
70
- return /* @__PURE__ */ jsxs(
71
- "a",
72
- {
73
- className: "rich-link",
74
- href: node.url,
75
- rel: node.rel || "noopener",
76
- target: node.target || "_blank",
77
- children: [
78
- /* @__PURE__ */ jsx(LinkFavicon, { href: node.url }),
79
- children
80
- ]
81
- },
82
- key
83
- );
84
- }
85
- case "autolink": {
86
- return /* @__PURE__ */ jsxs("a", { className: "rich-link", href: node.url, rel: "noopener", target: "_blank", children: [
87
- /* @__PURE__ */ jsx(LinkFavicon, { href: node.url }),
88
- children
89
- ] }, key);
90
- }
91
- case "horizontalrule": {
92
- return /* @__PURE__ */ jsx("hr", { className: "rich-hr" }, key);
93
- }
94
- case "table": {
95
- return /* @__PURE__ */ jsx("div", { className: tableWrapper, children: /* @__PURE__ */ jsx("table", { className: table, children }) }, key);
96
- }
97
- case "tablerow": {
98
- return /* @__PURE__ */ jsx("tr", { children }, key);
99
- }
100
- case "tablecell": {
101
- const CellTag = node.headerState ? "th" : "td";
102
- const cls = node.headerState ? tableHead : tableCell;
103
- return /* @__PURE__ */ jsx(CellTag, { className: cls, colSpan: node.colSpan > 1 ? node.colSpan : void 0, children }, key);
104
- }
105
- case "details": {
106
- const summary = node.summary || "";
107
- return /* @__PURE__ */ jsxs("details", { className: "rich-details", open: node.open || void 0, children: [
108
- /* @__PURE__ */ jsxs("summary", { className: "rich-details-summary", children: [
109
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "rich-details-chevron", children: /* @__PURE__ */ jsx(
110
- "svg",
111
- {
112
- fill: "none",
113
- height: "20",
114
- stroke: "currentColor",
115
- strokeLinecap: "round",
116
- strokeLinejoin: "round",
117
- strokeWidth: "1.5",
118
- viewBox: "0 0 20 20",
119
- width: "20",
120
- children: /* @__PURE__ */ jsx("path", { d: "M8 6L12 10L8 14" })
121
- }
122
- ) }),
123
- /* @__PURE__ */ jsx("span", { className: "rich-details-summary-text", children: summary })
124
- ] }),
125
- /* @__PURE__ */ jsx("div", { className: "rich-details-content", children })
126
- ] }, key);
127
- }
128
- case "spoiler": {
129
- return /* @__PURE__ */ jsx("span", { className: "rich-spoiler", role: "button", tabIndex: 0, children }, key);
130
- }
131
- case "tag": {
132
- return /* @__PURE__ */ jsx("span", { className: "rich-tag", style: { backgroundColor: getTagBgColor(node.text) }, children: node.text }, key);
133
- }
134
- case "ruby": {
135
- return createElement(RendererWrapper, {
136
- key,
137
- rendererKey: "Ruby",
138
- defaultRenderer: RubyRenderer,
139
- props: {
140
- reading: node.reading ?? "",
141
- children
142
- }
143
- });
144
- }
145
- case "code": {
146
- return /* @__PURE__ */ jsx("pre", { className: "rich-code-block", children: /* @__PURE__ */ jsx("code", { children }) }, key);
147
- }
148
- case "code-highlight": {
149
- return /* @__PURE__ */ jsx("span", { children: node.text }, key);
150
- }
151
- case "linebreak": {
152
- return /* @__PURE__ */ jsx("br", {}, key);
153
- }
154
- case "tab": {
155
- return /* @__PURE__ */ jsx("span", { children: " " }, key);
156
- }
157
- default: {
158
- return null;
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
- const FORMAT_FLAGS = [
163
- [1, "rich-text-bold"],
164
- [2, "rich-text-italic"],
165
- [4, "rich-text-strikethrough"],
166
- [8, "rich-text-underline"],
167
- [16, "rich-text-code"],
168
- [32, "rich-text-subscript"],
169
- [64, "rich-text-superscript"],
170
- [128, "rich-text-highlight"]
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
- const style = {};
174
- for (const part of cssText.split(";")) {
175
- const colonIndex = part.indexOf(":");
176
- if (colonIndex === -1) continue;
177
- const prop = part.slice(0, colonIndex).trim();
178
- const value = part.slice(colonIndex + 1).trim();
179
- if (!prop || !value) continue;
180
- const camelProp = prop.replaceAll(/-([a-z])/g, (_, c) => c.toUpperCase());
181
- style[camelProp] = value;
182
- }
183
- return style;
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
- let element = node.text;
187
- const format = node.format || 0;
188
- for (const [flag, className] of FORMAT_FLAGS) {
189
- if (format & flag) {
190
- element = /* @__PURE__ */ jsx("span", { className, children: element }, `${key}-${flag}`);
191
- }
192
- }
193
- if (node.style) {
194
- element = /* @__PURE__ */ jsx("span", { style: parseCSSText(node.style), children: element }, key);
195
- }
196
- return element;
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
- const definitions = {};
200
- const seen = /* @__PURE__ */ new Set();
201
- const displayNumberMap = {};
202
- let counter = 1;
203
- function walk(node) {
204
- if (node.type === "footnote" && node.identifier) {
205
- const id = node.identifier;
206
- if (!seen.has(id)) {
207
- seen.add(id);
208
- displayNumberMap[id] = counter++;
209
- }
210
- }
211
- if (node.type === "footnote-section" && node.definitions) {
212
- Object.assign(definitions, node.definitions);
213
- }
214
- if (node.children) {
215
- for (const child of node.children) walk(child);
216
- }
217
- if (node.root) walk(node.root);
218
- if (node.content && typeof node.content === "object" && node.content.root) {
219
- walk(node.content);
220
- }
221
- if (node.cells && Array.isArray(node.cells)) {
222
- for (const cell of node.cells) {
223
- if (cell && cell.root) walk(cell);
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
- switch (serialized.type) {
237
- case "alert-quote": {
238
- return createElement(
239
- "div",
240
- { key, className: `rich-alert rich-alert-${serialized.alertType}` },
241
- decoration
242
- );
243
- }
244
- case "banner": {
245
- return createElement(
246
- "div",
247
- { key, className: `rich-banner rich-banner-${serialized.bannerType}` },
248
- decoration
249
- );
250
- }
251
- case "grid-container": {
252
- return createElement("div", { key, className: "rich-grid-container" }, decoration);
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
- if (!blockId) return element;
264
- if (isValidElement(element) && typeof element.type === "string") {
265
- return cloneElement(element, { "data-block-id": blockId });
266
- }
267
- return /* @__PURE__ */ jsx("div", { className: "rich-block-anchor", "data-block-id": blockId, children: element }, `${nodeKey}-block-anchor`);
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
- const nodeKey = node.getKey ? node.getKey() : key;
271
- if (typeof node.decorate === "function") {
272
- try {
273
- const decoration = node.decorate(editor, editorConfig);
274
- if (decoration != null) {
275
- const serialized2 = node.exportJSON ? node.exportJSON() : {};
276
- return applyBlockId(wrapDecoration(serialized2, nodeKey, decoration), blockId, nodeKey);
277
- }
278
- } catch {
279
- }
280
- }
281
- const serialized = node.exportJSON ? node.exportJSON() : {};
282
- if (serialized.type === "text") {
283
- return renderTextNode(serialized, nodeKey);
284
- }
285
- let children = null;
286
- if (node.getChildren) {
287
- const childNodes = node.getChildren();
288
- if (childNodes.length > 0) {
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
- const editor = createHeadlessEditor({
316
- nodes,
317
- theme: editorTheme,
318
- editable: false,
319
- onError: (error) => {
320
- console.error("[RichRenderer]", error);
321
- }
322
- });
323
- const editorConfig = { namespace: "ssr", theme: editorTheme };
324
- const editorState = editor.parseEditorState(value);
325
- editor.setEditorState(editorState);
326
- const footnoteData = preprocessFootnotes(value);
327
- const rawRootChildren = value.root?.children;
328
- let content = null;
329
- editorState.read(() => {
330
- const root = $getRoot();
331
- const headingSlugs = /* @__PURE__ */ new Map();
332
- const children = root.getChildren().map(
333
- (child, i) => renderTree(
334
- child,
335
- editor,
336
- editorConfig,
337
- headingSlugs,
338
- `ssr-${i}`,
339
- rawRootChildren?.[i]?.$?.blockId,
340
- builtinNodeOverrides
341
- )
342
- );
343
- content = /* @__PURE__ */ jsx(Fragment, { children });
344
- });
345
- const renderNestedContent = (state) => {
346
- const nestedEditor = createHeadlessEditor({
347
- nodes,
348
- theme: editorTheme,
349
- editable: false,
350
- onError: (error) => {
351
- console.error("[RichRenderer:nested]", error);
352
- }
353
- });
354
- const nestedEditorConfig = {
355
- namespace: "ssr-nested",
356
- theme: editorTheme
357
- };
358
- const nestedState = nestedEditor.parseEditorState(state);
359
- nestedEditor.setEditorState(nestedState);
360
- let nested = null;
361
- const nestedRawChildren = state.root?.children;
362
- nestedState.read(() => {
363
- const root = $getRoot();
364
- const headingSlugs = /* @__PURE__ */ new Map();
365
- const ch = root.getChildren().map(
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
- value,
384
- variant = "article",
385
- theme = "light",
386
- className,
387
- style,
388
- as: Component = "div",
389
- rendererConfig,
390
- extraNodes,
391
- builtinNodeOverrides
392
- }) {
393
- const variantClass = getVariantClass(variant);
394
- const { content, footnoteData, renderNestedContent } = useMemo(() => {
395
- const nodes = extraNodes ? [...allNodes, ...extraNodes] : allNodes;
396
- return renderEditorToReact(value, nodes, builtinNodeOverrides);
397
- }, [builtinNodeOverrides, extraNodes, value]);
398
- const classes = ["rich-content", variantClass, className].filter(Boolean).join(" ");
399
- return /* @__PURE__ */ jsx(PortalThemeProvider, { className: variantClass, theme, children: /* @__PURE__ */ jsx(ColorSchemeProvider, { colorScheme: theme, children: /* @__PURE__ */ jsx(RendererConfigProvider, { config: rendererConfig, mode: "renderer", variant, children: /* @__PURE__ */ jsx(
400
- FootnoteDefinitionsProvider,
401
- {
402
- definitions: footnoteData.definitions,
403
- displayNumberMap: footnoteData.displayNumberMap,
404
- children: /* @__PURE__ */ jsx(NestedContentRendererProvider, { value: renderNestedContent, children: /* @__PURE__ */ jsx(
405
- Component,
406
- {
407
- suppressHydrationWarning: true,
408
- className: classes,
409
- "data-theme": theme,
410
- style,
411
- children: content
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
- export {
418
- RichRenderer
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.80",
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.80",
27
- "@haklex/rich-style-token": "0.0.80"
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",