@haklex/rich-compose 0.2.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -51
- package/dist/core/compose.d.ts.map +1 -1
- package/dist/core/dedup.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/lazy.d.ts.map +1 -1
- package/dist/core/types.d.ts +22 -22
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +430 -5
- package/dist/modules/alert/index.d.ts +1 -1
- package/dist/modules/alert/index.d.ts.map +1 -1
- package/dist/modules/alert/module.d.ts.map +1 -1
- package/dist/modules/alert/renderer.d.ts.map +1 -1
- package/dist/modules/banner/index.d.ts +1 -1
- package/dist/modules/banner/index.d.ts.map +1 -1
- package/dist/modules/banner/module.d.ts.map +1 -1
- package/dist/modules/banner/renderer.d.ts.map +1 -1
- package/dist/modules/chat/index.d.ts +3 -3
- package/dist/modules/chat/index.d.ts.map +1 -1
- package/dist/modules/chat/index.mjs +9 -2
- package/dist/modules/chat/module.d.ts +7 -0
- package/dist/modules/chat/module.d.ts.map +1 -1
- package/dist/modules/chat/node.d.ts +2 -2
- package/dist/modules/chat/node.d.ts.map +1 -1
- package/dist/modules/chat/node.mjs +1 -1
- package/dist/modules/chat/renderer.d.ts +1 -1
- package/dist/modules/chat/renderer.d.ts.map +1 -1
- package/dist/modules/chat/renderer.mjs +1 -1
- package/dist/modules/code-block/index.d.ts +1 -1
- package/dist/modules/code-block/index.d.ts.map +1 -1
- package/dist/modules/code-block/module.d.ts.map +1 -1
- package/dist/modules/code-block/renderer.d.ts.map +1 -1
- package/dist/modules/code-snippet/index.d.ts +1 -1
- package/dist/modules/code-snippet/index.d.ts.map +1 -1
- package/dist/modules/code-snippet/index.mjs +7 -2
- package/dist/modules/code-snippet/module.d.ts +5 -0
- package/dist/modules/code-snippet/module.d.ts.map +1 -1
- package/dist/modules/code-snippet/node.d.ts +2 -2
- package/dist/modules/code-snippet/node.d.ts.map +1 -1
- package/dist/modules/code-snippet/node.mjs +1 -1
- package/dist/modules/code-snippet/renderer.d.ts +1 -1
- package/dist/modules/code-snippet/renderer.d.ts.map +1 -1
- package/dist/modules/code-snippet/renderer.mjs +1 -1
- package/dist/modules/embed/index.d.ts +1 -1
- package/dist/modules/embed/index.d.ts.map +1 -1
- package/dist/modules/embed/module.d.ts.map +1 -1
- package/dist/modules/embed/node.d.ts.map +1 -1
- package/dist/modules/excalidraw/index.d.ts +2 -2
- package/dist/modules/excalidraw/index.d.ts.map +1 -1
- package/dist/modules/excalidraw/module.d.ts.map +1 -1
- package/dist/modules/excalidraw/node.d.ts +2 -2
- package/dist/modules/excalidraw/node.d.ts.map +1 -1
- package/dist/modules/gallery/index.d.ts +2 -2
- package/dist/modules/gallery/index.d.ts.map +1 -1
- package/dist/modules/gallery/index.mjs +7 -2
- package/dist/modules/gallery/module.d.ts +5 -0
- package/dist/modules/gallery/module.d.ts.map +1 -1
- package/dist/modules/gallery/node.d.ts +2 -2
- package/dist/modules/gallery/node.d.ts.map +1 -1
- package/dist/modules/gallery/node.mjs +1 -1
- package/dist/modules/gallery/renderer.d.ts +1 -1
- package/dist/modules/gallery/renderer.d.ts.map +1 -1
- package/dist/modules/gallery/renderer.mjs +1 -1
- package/dist/modules/image/index.d.ts +1 -1
- package/dist/modules/image/index.d.ts.map +1 -1
- package/dist/modules/image/module.d.ts.map +1 -1
- package/dist/modules/image/renderer.d.ts.map +1 -1
- package/dist/modules/link-card/index.d.ts +1 -1
- package/dist/modules/link-card/index.d.ts.map +1 -1
- package/dist/modules/link-card/module.d.ts.map +1 -1
- package/dist/modules/link-card/renderer.d.ts.map +1 -1
- package/dist/modules/mention/index.d.ts +2 -2
- package/dist/modules/mention/index.d.ts.map +1 -1
- package/dist/modules/mention/module.d.ts.map +1 -1
- package/dist/modules/mention/renderer.d.ts.map +1 -1
- package/dist/modules/mermaid/index.d.ts +1 -1
- package/dist/modules/mermaid/index.d.ts.map +1 -1
- package/dist/modules/mermaid/module.d.ts.map +1 -1
- package/dist/modules/mermaid/renderer.d.ts.map +1 -1
- package/dist/modules/mermaid/ssr-fallback.d.ts.map +1 -1
- package/dist/modules/nested-doc/index.d.ts +1 -1
- package/dist/modules/nested-doc/index.d.ts.map +1 -1
- package/dist/modules/nested-doc/module.d.ts.map +1 -1
- package/dist/modules/nested-doc/node.d.ts.map +1 -1
- package/dist/modules/poll/index.d.ts +5 -0
- package/dist/modules/poll/index.d.ts.map +1 -0
- package/dist/modules/poll/index.mjs +20 -0
- package/dist/modules/poll/module.d.ts +12 -0
- package/dist/modules/poll/module.d.ts.map +1 -0
- package/dist/modules/poll/node.d.ts +3 -0
- package/dist/modules/poll/node.d.ts.map +1 -0
- package/dist/modules/poll/node.mjs +2 -0
- package/dist/modules/poll/renderer.d.ts +4 -0
- package/dist/modules/poll/renderer.d.ts.map +1 -0
- package/dist/modules/poll/renderer.mjs +5 -0
- package/dist/modules/ruby/index.d.ts +1 -1
- package/dist/modules/ruby/index.d.ts.map +1 -1
- package/dist/modules/ruby/module.d.ts.map +1 -1
- package/dist/modules/ruby/renderer.d.ts.map +1 -1
- package/dist/modules/video/index.d.ts +1 -1
- package/dist/modules/video/index.d.ts.map +1 -1
- package/dist/modules/video/module.d.ts.map +1 -1
- package/dist/modules/video/renderer.d.ts.map +1 -1
- package/dist/rich-compose.css +2 -0
- package/dist/static-renderer/RichRenderer.d.ts +3 -0
- package/dist/static-renderer/RichRenderer.d.ts.map +1 -0
- package/dist/static-renderer/components/HtmlComment.d.ts +6 -0
- package/dist/static-renderer/components/HtmlComment.d.ts.map +1 -0
- package/dist/static-renderer/engine/renderBuiltinNode.d.ts +3 -0
- package/dist/static-renderer/engine/renderBuiltinNode.d.ts.map +1 -0
- package/dist/static-renderer/engine/renderTextNode.d.ts +3 -0
- package/dist/static-renderer/engine/renderTextNode.d.ts.map +1 -0
- package/dist/static-renderer/index.d.ts +3 -0
- package/dist/static-renderer/index.d.ts.map +1 -0
- package/dist/static-renderer/preprocess/footnote.d.ts +7 -0
- package/dist/static-renderer/preprocess/footnote.d.ts.map +1 -0
- package/dist/static-renderer/table.css.d.ts +5 -0
- package/dist/static-renderer/table.css.d.ts.map +1 -0
- package/dist/static-renderer/types.d.ts +17 -0
- package/dist/static-renderer/types.d.ts.map +1 -0
- package/package.json +60 -36
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,432 @@
|
|
|
1
1
|
import { NestedContentRendererProvider } from "@haklex/rich-editor";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { Fragment, Suspense, cloneElement, createElement, isValidElement, lazy, memo, useCallback, useEffect, useMemo, useRef } from "react";
|
|
3
|
+
import { ColorSchemeProvider, FootnoteDefinitionsProvider, LinkFavicon, NestedContentRendererProvider as NestedContentRendererProvider$1, RendererConfigProvider, RendererWrapper, RubyRenderer, allNodes, detailsClassNames, detailsStyles, editorTheme, getTagBgColor, getVariantClass, gridClassNames, gridStyles, normalizeSerializedEditorState, semanticClassNames, sharedStyles, useOptionalNestedContentRenderer } from "@haklex/rich-editor/static";
|
|
4
|
+
import { PortalThemeProvider } from "@haklex/rich-style-token";
|
|
5
|
+
import { createHeadlessEditor } from "@lexical/headless";
|
|
6
|
+
import { $getRoot } from "lexical";
|
|
7
|
+
import { Link } from "lucide-react";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/static-renderer/components/HtmlComment.tsx
|
|
10
|
+
function HtmlComment({ text }) {
|
|
11
|
+
const anchorRef = useRef(null);
|
|
12
|
+
const commentRef = useRef(null);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const anchor = anchorRef.current;
|
|
15
|
+
if (!anchor) return;
|
|
16
|
+
const parent = anchor.parentNode;
|
|
17
|
+
if (!parent) return;
|
|
18
|
+
let comment = commentRef.current;
|
|
19
|
+
if (!comment || comment.parentNode !== parent) {
|
|
20
|
+
comment = document.createComment(text);
|
|
21
|
+
parent.insertBefore(comment, anchor);
|
|
22
|
+
commentRef.current = comment;
|
|
23
|
+
} else if (comment.data !== text) comment.data = text;
|
|
24
|
+
return () => {
|
|
25
|
+
if (commentRef.current?.parentNode) commentRef.current.parentNode.removeChild(commentRef.current);
|
|
26
|
+
commentRef.current = null;
|
|
27
|
+
};
|
|
28
|
+
}, [text]);
|
|
29
|
+
return /* @__PURE__ */ jsx("template", {
|
|
30
|
+
suppressHydrationWarning: true,
|
|
31
|
+
"data-rich-comment-anchor": "",
|
|
32
|
+
ref: anchorRef
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/static-renderer/table.css.ts
|
|
37
|
+
var tableWrapper = "icqzyn0";
|
|
38
|
+
var table = "icqzyn1";
|
|
39
|
+
var tableHead = "icqzyn2";
|
|
40
|
+
var tableCell = "icqzyn3";
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/static-renderer/engine/renderBuiltinNode.tsx
|
|
43
|
+
var shared$1 = (key) => `${semanticClassNames[key]} ${sharedStyles[key]}`;
|
|
44
|
+
var headingClassNames = {
|
|
45
|
+
h1: shared$1("headingH1"),
|
|
46
|
+
h2: shared$1("headingH2"),
|
|
47
|
+
h3: shared$1("headingH3"),
|
|
48
|
+
h4: shared$1("headingH4"),
|
|
49
|
+
h5: shared$1("headingH5"),
|
|
50
|
+
h6: shared$1("headingH6")
|
|
51
|
+
};
|
|
52
|
+
function textToSlug(text) {
|
|
53
|
+
return text.toLowerCase().trim().replaceAll(/[^\s\w\u3000-\u9FFF\uAC00-\uD7AF\uFF00-\uFFEF-]/g, "").replaceAll(/[\s_]+/g, "-").replaceAll(/^-+|-+$/g, "");
|
|
54
|
+
}
|
|
55
|
+
function extractText(node) {
|
|
56
|
+
if (node.type === "comment") return "";
|
|
57
|
+
if (node.text) return node.text;
|
|
58
|
+
if (node.children) return node.children.map(extractText).join("");
|
|
59
|
+
return "";
|
|
60
|
+
}
|
|
61
|
+
function renderBuiltinNode(node, key, children, headingSlugs, textContent) {
|
|
62
|
+
switch (node.type) {
|
|
63
|
+
case "root": return /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
64
|
+
case "paragraph": {
|
|
65
|
+
const align = node.format ? { textAlign: node.format } : void 0;
|
|
66
|
+
return /* @__PURE__ */ jsx("p", {
|
|
67
|
+
className: shared$1("paragraph"),
|
|
68
|
+
style: align,
|
|
69
|
+
children
|
|
70
|
+
}, key);
|
|
71
|
+
}
|
|
72
|
+
case "heading": {
|
|
73
|
+
const Tag = node.tag;
|
|
74
|
+
const baseSlug = textToSlug(textContent || extractText(node));
|
|
75
|
+
let slug = baseSlug;
|
|
76
|
+
if (baseSlug) {
|
|
77
|
+
const count = headingSlugs.get(baseSlug);
|
|
78
|
+
if (count !== void 0) {
|
|
79
|
+
slug = `${baseSlug}-${count}`;
|
|
80
|
+
headingSlugs.set(baseSlug, count + 1);
|
|
81
|
+
} else headingSlugs.set(baseSlug, 1);
|
|
82
|
+
}
|
|
83
|
+
return /* @__PURE__ */ jsxs(Tag, {
|
|
84
|
+
className: headingClassNames[Tag],
|
|
85
|
+
id: slug || void 0,
|
|
86
|
+
children: [slug && /* @__PURE__ */ jsx("a", {
|
|
87
|
+
className: shared$1("headingAnchor"),
|
|
88
|
+
href: `#${slug}`,
|
|
89
|
+
tabIndex: 0,
|
|
90
|
+
children: /* @__PURE__ */ jsx(Link, {
|
|
91
|
+
"aria-hidden": true,
|
|
92
|
+
size: 14,
|
|
93
|
+
strokeWidth: 2
|
|
94
|
+
})
|
|
95
|
+
}), children]
|
|
96
|
+
}, key);
|
|
97
|
+
}
|
|
98
|
+
case "quote": return /* @__PURE__ */ jsx("blockquote", {
|
|
99
|
+
className: shared$1("quote"),
|
|
100
|
+
children
|
|
101
|
+
}, key);
|
|
102
|
+
case "list": return /* @__PURE__ */ jsx(node.listType === "number" ? "ol" : "ul", {
|
|
103
|
+
className: node.listType === "number" ? shared$1("listOl") : node.listType === "check" ? `${shared$1("checklist")} ${shared$1("listUl")}` : shared$1("listUl"),
|
|
104
|
+
start: node.start !== 1 ? node.start : void 0,
|
|
105
|
+
children
|
|
106
|
+
}, key);
|
|
107
|
+
case "listitem": {
|
|
108
|
+
const isChecklist = node.checked !== void 0;
|
|
109
|
+
const hasNestedList = node.children?.some((c) => c.type === "list");
|
|
110
|
+
const value = typeof node.value === "number" && node.value > 1 ? node.value : void 0;
|
|
111
|
+
let cls;
|
|
112
|
+
if (hasNestedList) cls = shared$1("listNestedItem");
|
|
113
|
+
else if (isChecklist) cls = node.checked ? `${shared$1("listItem")} ${shared$1("listItemChecked")}` : `${shared$1("listItem")} ${shared$1("listItemUnchecked")}`;
|
|
114
|
+
else cls = shared$1("listItem");
|
|
115
|
+
return /* @__PURE__ */ jsx("li", {
|
|
116
|
+
className: cls,
|
|
117
|
+
value,
|
|
118
|
+
children
|
|
119
|
+
}, key);
|
|
120
|
+
}
|
|
121
|
+
case "link": return /* @__PURE__ */ jsxs("a", {
|
|
122
|
+
className: shared$1("link"),
|
|
123
|
+
href: node.url,
|
|
124
|
+
rel: node.rel || "noopener",
|
|
125
|
+
target: node.target || "_blank",
|
|
126
|
+
children: [/* @__PURE__ */ jsx(LinkFavicon, { href: node.url }), children]
|
|
127
|
+
}, key);
|
|
128
|
+
case "autolink": return /* @__PURE__ */ jsxs("a", {
|
|
129
|
+
className: shared$1("link"),
|
|
130
|
+
href: node.url,
|
|
131
|
+
rel: "noopener",
|
|
132
|
+
target: "_blank",
|
|
133
|
+
children: [/* @__PURE__ */ jsx(LinkFavicon, { href: node.url }), children]
|
|
134
|
+
}, key);
|
|
135
|
+
case "horizontalrule": return /* @__PURE__ */ jsx("hr", { className: shared$1("hr") }, key);
|
|
136
|
+
case "table": return /* @__PURE__ */ jsx("div", {
|
|
137
|
+
className: tableWrapper,
|
|
138
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
139
|
+
className: table,
|
|
140
|
+
children
|
|
141
|
+
})
|
|
142
|
+
}, key);
|
|
143
|
+
case "tablerow": return /* @__PURE__ */ jsx("tr", { children }, key);
|
|
144
|
+
case "tablecell": return /* @__PURE__ */ jsx(node.headerState ? "th" : "td", {
|
|
145
|
+
className: node.headerState ? tableHead : tableCell,
|
|
146
|
+
colSpan: node.colSpan > 1 ? node.colSpan : void 0,
|
|
147
|
+
children
|
|
148
|
+
}, key);
|
|
149
|
+
case "details": {
|
|
150
|
+
const summary = node.summary || "";
|
|
151
|
+
return /* @__PURE__ */ jsxs("details", {
|
|
152
|
+
className: `${detailsClassNames.details} ${detailsStyles.details}`,
|
|
153
|
+
open: node.open || void 0,
|
|
154
|
+
children: [/* @__PURE__ */ jsxs("summary", {
|
|
155
|
+
className: `${detailsClassNames.summary} ${detailsStyles.summary}`,
|
|
156
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
157
|
+
"aria-hidden": "true",
|
|
158
|
+
className: `${detailsClassNames.chevron} ${detailsStyles.chevron}`,
|
|
159
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
160
|
+
fill: "none",
|
|
161
|
+
height: "20",
|
|
162
|
+
stroke: "currentColor",
|
|
163
|
+
strokeLinecap: "round",
|
|
164
|
+
strokeLinejoin: "round",
|
|
165
|
+
strokeWidth: "1.5",
|
|
166
|
+
viewBox: "0 0 20 20",
|
|
167
|
+
width: "20",
|
|
168
|
+
children: /* @__PURE__ */ jsx("path", { d: "M8 6L12 10L8 14" })
|
|
169
|
+
})
|
|
170
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
171
|
+
className: `${detailsClassNames.summaryText} ${detailsStyles.summaryText}`,
|
|
172
|
+
children: summary
|
|
173
|
+
})]
|
|
174
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
175
|
+
className: `${detailsClassNames.content} ${detailsStyles.content}`,
|
|
176
|
+
children
|
|
177
|
+
})]
|
|
178
|
+
}, key);
|
|
179
|
+
}
|
|
180
|
+
case "spoiler": return /* @__PURE__ */ jsx("span", {
|
|
181
|
+
className: shared$1("spoiler"),
|
|
182
|
+
role: "button",
|
|
183
|
+
tabIndex: 0,
|
|
184
|
+
children
|
|
185
|
+
}, key);
|
|
186
|
+
case "tag": return /* @__PURE__ */ jsx("span", {
|
|
187
|
+
className: shared$1("tag"),
|
|
188
|
+
style: { backgroundColor: getTagBgColor(node.text) },
|
|
189
|
+
children: node.text
|
|
190
|
+
}, key);
|
|
191
|
+
case "comment": return /* @__PURE__ */ jsx(HtmlComment, { text: node.text ?? "" }, key);
|
|
192
|
+
case "ruby": return createElement(RendererWrapper, {
|
|
193
|
+
key,
|
|
194
|
+
rendererKey: "Ruby",
|
|
195
|
+
defaultRenderer: RubyRenderer,
|
|
196
|
+
props: {
|
|
197
|
+
reading: node.reading ?? "",
|
|
198
|
+
children
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
case "code": return /* @__PURE__ */ jsx("pre", {
|
|
202
|
+
className: "rich-code-block",
|
|
203
|
+
children: /* @__PURE__ */ jsx("code", { children })
|
|
204
|
+
}, key);
|
|
205
|
+
case "code-highlight": return /* @__PURE__ */ jsx("span", { children: node.text }, key);
|
|
206
|
+
case "linebreak": return /* @__PURE__ */ jsx("br", {}, key);
|
|
207
|
+
case "tab": return /* @__PURE__ */ jsx("span", { children: " " }, key);
|
|
208
|
+
default: return null;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/static-renderer/engine/renderTextNode.tsx
|
|
213
|
+
var shared = (key) => `${semanticClassNames[key]} ${sharedStyles[key]}`;
|
|
214
|
+
var FORMAT_FLAGS = [
|
|
215
|
+
[1, "textBold"],
|
|
216
|
+
[2, "textItalic"],
|
|
217
|
+
[4, "textStrikethrough"],
|
|
218
|
+
[8, "textUnderline"],
|
|
219
|
+
[16, "textCode"],
|
|
220
|
+
[32, "textSubscript"],
|
|
221
|
+
[64, "textSuperscript"],
|
|
222
|
+
[128, "textHighlight"]
|
|
223
|
+
];
|
|
224
|
+
function parseCSSText(cssText) {
|
|
225
|
+
const style = {};
|
|
226
|
+
for (const part of cssText.split(";")) {
|
|
227
|
+
const colonIndex = part.indexOf(":");
|
|
228
|
+
if (colonIndex === -1) continue;
|
|
229
|
+
const prop = part.slice(0, colonIndex).trim();
|
|
230
|
+
const value = part.slice(colonIndex + 1).trim();
|
|
231
|
+
if (!prop || !value) continue;
|
|
232
|
+
const camelProp = prop.replaceAll(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
233
|
+
style[camelProp] = value;
|
|
234
|
+
}
|
|
235
|
+
return style;
|
|
236
|
+
}
|
|
237
|
+
function renderTextNode(node, key) {
|
|
238
|
+
let element = node.text;
|
|
239
|
+
const format = node.format || 0;
|
|
240
|
+
for (const [flag, styleKey] of FORMAT_FLAGS) if (format & flag) element = /* @__PURE__ */ jsx("span", {
|
|
241
|
+
className: shared(styleKey),
|
|
242
|
+
children: element
|
|
243
|
+
}, `${key}-${flag}`);
|
|
244
|
+
if (node.style) element = /* @__PURE__ */ jsx("span", {
|
|
245
|
+
style: parseCSSText(node.style),
|
|
246
|
+
children: element
|
|
247
|
+
}, key);
|
|
248
|
+
return element;
|
|
249
|
+
}
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region src/static-renderer/preprocess/footnote.ts
|
|
252
|
+
function preprocessFootnotes(state) {
|
|
253
|
+
const definitions = {};
|
|
254
|
+
const seen = /* @__PURE__ */ new Set();
|
|
255
|
+
const displayNumberMap = {};
|
|
256
|
+
let counter = 1;
|
|
257
|
+
function walk(node) {
|
|
258
|
+
if (node.type === "footnote" && node.identifier) {
|
|
259
|
+
const id = node.identifier;
|
|
260
|
+
if (!seen.has(id)) {
|
|
261
|
+
seen.add(id);
|
|
262
|
+
displayNumberMap[id] = counter++;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (node.type === "footnote-section" && node.definitions) Object.assign(definitions, node.definitions);
|
|
266
|
+
if (node.children) for (const child of node.children) walk(child);
|
|
267
|
+
if (node.root) walk(node.root);
|
|
268
|
+
if (node.content && typeof node.content === "object" && node.content.root) walk(node.content);
|
|
269
|
+
if (node.cells && Array.isArray(node.cells)) {
|
|
270
|
+
for (const cell of node.cells) if (cell && cell.root) walk(cell);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
walk(state);
|
|
274
|
+
for (const id of seen) if (!(id in definitions)) definitions[id] = "";
|
|
275
|
+
return {
|
|
276
|
+
definitions,
|
|
277
|
+
displayNumberMap
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region src/static-renderer/RichRenderer.tsx
|
|
282
|
+
var alertClassName = (type) => `${semanticClassNames.alert} ${sharedStyles.alert} rich-alert-${type}`;
|
|
283
|
+
function wrapDecoration(serialized, key, decoration) {
|
|
284
|
+
switch (serialized.type) {
|
|
285
|
+
case "alert-quote": return createElement("div", {
|
|
286
|
+
key,
|
|
287
|
+
className: alertClassName(serialized.alertType)
|
|
288
|
+
}, decoration);
|
|
289
|
+
case "banner": return createElement("div", {
|
|
290
|
+
key,
|
|
291
|
+
className: `rich-banner rich-banner-${serialized.bannerType}`
|
|
292
|
+
}, decoration);
|
|
293
|
+
case "grid-container": return createElement("div", {
|
|
294
|
+
key,
|
|
295
|
+
className: `${gridClassNames.container} ${gridStyles.container}`
|
|
296
|
+
}, decoration);
|
|
297
|
+
default:
|
|
298
|
+
if (isValidElement(decoration)) return cloneElement(decoration, { key });
|
|
299
|
+
return decoration;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
function applyBlockId(element, blockId, nodeKey) {
|
|
303
|
+
if (!blockId) return element;
|
|
304
|
+
if (isValidElement(element) && typeof element.type === "string") return cloneElement(element, { "data-block-id": blockId });
|
|
305
|
+
return /* @__PURE__ */ jsx("div", {
|
|
306
|
+
className: "rich-block-anchor",
|
|
307
|
+
"data-block-id": blockId,
|
|
308
|
+
children: element
|
|
309
|
+
}, `${nodeKey}-block-anchor`);
|
|
310
|
+
}
|
|
311
|
+
function renderTree(node, editor, editorConfig, headingSlugs, key, blockId, builtinNodeOverrides) {
|
|
312
|
+
const nodeKey = node.getKey ? node.getKey() : key;
|
|
313
|
+
if (typeof node.decorate === "function") try {
|
|
314
|
+
const decoration = node.decorate(editor, editorConfig);
|
|
315
|
+
if (decoration != null) return applyBlockId(wrapDecoration(node.exportJSON ? node.exportJSON() : {}, nodeKey, decoration), blockId, nodeKey);
|
|
316
|
+
} catch {}
|
|
317
|
+
const serialized = node.exportJSON ? node.exportJSON() : {};
|
|
318
|
+
if (serialized.type === "text") return renderTextNode(serialized, nodeKey);
|
|
319
|
+
const childNodes = typeof node.getChildren === "function" ? node.getChildren() : [];
|
|
320
|
+
if (Array.isArray(serialized.children) && serialized.children.length === 0 && childNodes.length > 0) serialized.children = childNodes.map((c) => ({ type: typeof c.getType === "function" ? c.getType() : c.__type }));
|
|
321
|
+
let children = null;
|
|
322
|
+
if (childNodes.length > 0) children = childNodes.map((child, i) => renderTree(child, editor, editorConfig, headingSlugs, `${nodeKey}-${i}`, void 0, builtinNodeOverrides));
|
|
323
|
+
const textContent = node.getTextContent ? node.getTextContent() : void 0;
|
|
324
|
+
const override = builtinNodeOverrides?.[serialized.type];
|
|
325
|
+
if (override) {
|
|
326
|
+
const defaultRenderer = () => renderBuiltinNode(serialized, nodeKey, children, headingSlugs, textContent);
|
|
327
|
+
return applyBlockId(override(serialized, nodeKey, children, defaultRenderer), blockId, nodeKey);
|
|
328
|
+
}
|
|
329
|
+
return applyBlockId(renderBuiltinNode(serialized, nodeKey, children, headingSlugs, textContent), blockId, nodeKey);
|
|
330
|
+
}
|
|
331
|
+
function renderEditorToReact(value, nodes, builtinNodeOverrides) {
|
|
332
|
+
const editor = createHeadlessEditor({
|
|
333
|
+
nodes,
|
|
334
|
+
theme: editorTheme,
|
|
335
|
+
editable: false,
|
|
336
|
+
onError: (error) => {
|
|
337
|
+
console.error("[RichRenderer]", error);
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
const editorConfig = {
|
|
341
|
+
namespace: "ssr",
|
|
342
|
+
theme: editorTheme
|
|
343
|
+
};
|
|
344
|
+
const normalizedValue = normalizeSerializedEditorState(value);
|
|
345
|
+
const editorState = editor.parseEditorState(normalizedValue);
|
|
346
|
+
editor.setEditorState(editorState);
|
|
347
|
+
const footnoteData = preprocessFootnotes(normalizedValue);
|
|
348
|
+
const rawRootChildren = normalizedValue.root?.children;
|
|
349
|
+
let content = null;
|
|
350
|
+
editorState.read(() => {
|
|
351
|
+
const root = $getRoot();
|
|
352
|
+
const headingSlugs = /* @__PURE__ */ new Map();
|
|
353
|
+
content = /* @__PURE__ */ jsx(Fragment$1, { children: root.getChildren().map((child, i) => renderTree(child, editor, editorConfig, headingSlugs, `ssr-${i}`, rawRootChildren?.[i]?.$?.blockId, builtinNodeOverrides)) });
|
|
354
|
+
});
|
|
355
|
+
const renderNestedContent = (state) => {
|
|
356
|
+
const nestedEditor = createHeadlessEditor({
|
|
357
|
+
nodes,
|
|
358
|
+
theme: editorTheme,
|
|
359
|
+
editable: false,
|
|
360
|
+
onError: (error) => {
|
|
361
|
+
console.error("[RichRenderer:nested]", error);
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
const nestedEditorConfig = {
|
|
365
|
+
namespace: "ssr-nested",
|
|
366
|
+
theme: editorTheme
|
|
367
|
+
};
|
|
368
|
+
const normalizedState = normalizeSerializedEditorState(state);
|
|
369
|
+
const nestedState = nestedEditor.parseEditorState(normalizedState);
|
|
370
|
+
nestedEditor.setEditorState(nestedState);
|
|
371
|
+
let nested = null;
|
|
372
|
+
const nestedRawChildren = normalizedState.root?.children;
|
|
373
|
+
nestedState.read(() => {
|
|
374
|
+
const root = $getRoot();
|
|
375
|
+
const headingSlugs = /* @__PURE__ */ new Map();
|
|
376
|
+
nested = /* @__PURE__ */ jsx(Fragment$1, { children: root.getChildren().map((child, i) => renderTree(child, nestedEditor, nestedEditorConfig, headingSlugs, `nested-${i}`, nestedRawChildren?.[i]?.$?.blockId, builtinNodeOverrides)) });
|
|
377
|
+
});
|
|
378
|
+
return nested;
|
|
379
|
+
};
|
|
380
|
+
return {
|
|
381
|
+
content,
|
|
382
|
+
footnoteData,
|
|
383
|
+
renderNestedContent
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
function RichRenderer({ value, variant = "article", theme = "light", className, style, as: Component = "div", nested = false, rendererConfig, extraNodes, builtinNodeOverrides }) {
|
|
387
|
+
const variantClass = getVariantClass(variant);
|
|
388
|
+
const outerRenderNestedContent = useOptionalNestedContentRenderer();
|
|
389
|
+
const { content, footnoteData, renderNestedContent } = useMemo(() => {
|
|
390
|
+
return renderEditorToReact(value, extraNodes ? [...allNodes, ...extraNodes] : allNodes, builtinNodeOverrides);
|
|
391
|
+
}, [
|
|
392
|
+
builtinNodeOverrides,
|
|
393
|
+
extraNodes,
|
|
394
|
+
value
|
|
395
|
+
]);
|
|
396
|
+
const classes = [
|
|
397
|
+
"rich-content",
|
|
398
|
+
variantClass,
|
|
399
|
+
className
|
|
400
|
+
].filter(Boolean).join(" ");
|
|
401
|
+
return /* @__PURE__ */ jsx(PortalThemeProvider, {
|
|
402
|
+
className: variantClass,
|
|
403
|
+
theme,
|
|
404
|
+
children: /* @__PURE__ */ jsx(ColorSchemeProvider, {
|
|
405
|
+
colorScheme: theme,
|
|
406
|
+
children: /* @__PURE__ */ jsx(RendererConfigProvider, {
|
|
407
|
+
config: rendererConfig,
|
|
408
|
+
mode: "renderer",
|
|
409
|
+
variant,
|
|
410
|
+
children: /* @__PURE__ */ jsx(FootnoteDefinitionsProvider, {
|
|
411
|
+
definitions: footnoteData.definitions,
|
|
412
|
+
displayNumberMap: footnoteData.displayNumberMap,
|
|
413
|
+
children: /* @__PURE__ */ jsx(NestedContentRendererProvider$1, {
|
|
414
|
+
value: outerRenderNestedContent ?? renderNestedContent,
|
|
415
|
+
children: /* @__PURE__ */ jsx(Component, {
|
|
416
|
+
suppressHydrationWarning: true,
|
|
417
|
+
className: classes,
|
|
418
|
+
"data-rich-nested": nested ? "true" : void 0,
|
|
419
|
+
"data-theme": theme,
|
|
420
|
+
style,
|
|
421
|
+
children: content
|
|
422
|
+
})
|
|
423
|
+
})
|
|
424
|
+
})
|
|
425
|
+
})
|
|
426
|
+
})
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
//#endregion
|
|
5
430
|
//#region src/core/dedup.ts
|
|
6
431
|
/**
|
|
7
432
|
* Merge preset and modules, deduplicating by:
|
|
@@ -113,7 +538,7 @@ function composeRenderer(opts) {
|
|
|
113
538
|
const finalConfig = {
|
|
114
539
|
...syncMap,
|
|
115
540
|
...lazyMap,
|
|
116
|
-
...opts.overrides
|
|
541
|
+
...opts.overrides
|
|
117
542
|
};
|
|
118
543
|
const ComposedProviders = composeProviders(merged);
|
|
119
544
|
const builtinNodeOverrides = opts.builtinNodeOverrides;
|
|
@@ -143,4 +568,4 @@ function composeRenderer(opts) {
|
|
|
143
568
|
return memo(ComposedRenderer);
|
|
144
569
|
}
|
|
145
570
|
//#endregion
|
|
146
|
-
export { composeRenderer, dedupNodes, mergeModules, wrapLazy };
|
|
571
|
+
export { RichRenderer, composeRenderer, dedupNodes, mergeModules, wrapLazy };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/alert/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/alert/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/modules/alert/module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/modules/alert/module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,eAAO,MAAM,WAAW,EAAE,kBAGzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../src/modules/alert/renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../src/modules/alert/renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/banner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/banner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/modules/banner/module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/modules/banner/module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,eAAO,MAAM,YAAY,EAAE,kBAG1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../src/modules/banner/renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../src/modules/banner/renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,eAAe,cAAc,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { ChatMessage, ChatParticipant, ChatParticipantKind, ChatRendererProps, ChatVariant, SerializedChatNode, } from '@haklex/rich-ext-chat/static';
|
|
2
|
-
export { $createChatNode, $isChatNode, ChatNode, chatNodes, } from './node';
|
|
3
|
-
export { ChatRenderer } from './renderer';
|
|
4
1
|
export { chatModule } from './module';
|
|
2
|
+
export { $createChatNode, $isChatNode, ChatNode, chatNodes } from './node';
|
|
3
|
+
export { ChatRenderer } from './renderer';
|
|
4
|
+
export type { ChatMessage, ChatParticipant, ChatParticipantKind, ChatRendererProps, ChatVariant, SerializedChatNode, } from '@haklex/rich-ext-chat/static';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/chat/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/chat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,YAAY,EACV,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,kBAAkB,GACnB,MAAM,8BAA8B,CAAC"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { $createChatNode, $isChatNode, ChatNode, chatNodes } from "./node.mjs";
|
|
2
2
|
import { ChatRenderer } from "./renderer.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { chatNodes as chatNodes$1 } from "@haklex/rich-ext-chat/node";
|
|
4
4
|
//#region src/modules/chat/module.ts
|
|
5
|
+
/**
|
|
6
|
+
* Chat module — registers ChatNode (light) and lazy-loads ChatRenderer.
|
|
7
|
+
*
|
|
8
|
+
* Consumers can write a thin override module using `chatNodes` from
|
|
9
|
+
* `@haklex/rich-ext-chat/node` plus a custom `renderers: { Chat: ... }` to
|
|
10
|
+
* keep the default ChatRenderer chunk out of their bundle.
|
|
11
|
+
*/
|
|
5
12
|
var chatModule = {
|
|
6
13
|
name: "chat",
|
|
7
14
|
nodes: chatNodes$1,
|
|
8
|
-
|
|
15
|
+
lazyRenderers: { Chat: () => import("@haklex/rich-ext-chat/renderer") }
|
|
9
16
|
};
|
|
10
17
|
//#endregion
|
|
11
18
|
export { $createChatNode, $isChatNode, ChatNode, ChatRenderer, chatModule, chatNodes };
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { RichRendererModule } from '../../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* Chat module — registers ChatNode (light) and lazy-loads ChatRenderer.
|
|
4
|
+
*
|
|
5
|
+
* Consumers can write a thin override module using `chatNodes` from
|
|
6
|
+
* `@haklex/rich-ext-chat/node` plus a custom `renderers: { Chat: ... }` to
|
|
7
|
+
* keep the default ChatRenderer chunk out of their bundle.
|
|
8
|
+
*/
|
|
2
9
|
export declare const chatModule: RichRendererModule;
|
|
3
10
|
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/modules/chat/module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/modules/chat/module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,kBAMxB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { SerializedChatNode } from '@haklex/rich-ext-chat/
|
|
2
|
-
export { $createChatNode, $isChatNode, ChatNode, chatNodes
|
|
1
|
+
export type { SerializedChatNode } from '@haklex/rich-ext-chat/node';
|
|
2
|
+
export { $createChatNode, $isChatNode, ChatNode, chatNodes } from '@haklex/rich-ext-chat/node';
|
|
3
3
|
//# sourceMappingURL=node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/modules/chat/node.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/modules/chat/node.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $createChatNode, $isChatNode, ChatNode, chatNodes } from "@haklex/rich-ext-chat/
|
|
1
|
+
import { $createChatNode, $isChatNode, ChatNode, chatNodes } from "@haklex/rich-ext-chat/node";
|
|
2
2
|
export { $createChatNode, $isChatNode, ChatNode, chatNodes };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../src/modules/chat/renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../src/modules/chat/renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/code-block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/code-block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/modules/code-block/module.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/modules/code-block/module.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG3D;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,EAAE,kBAQ7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../src/modules/code-block/renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../src/modules/code-block/renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
export { codeSnippetModule } from './module';
|
|
1
2
|
export type { SerializedCodeSnippetNode } from './node';
|
|
2
3
|
export { $createCodeSnippetNode, $isCodeSnippetNode, CodeSnippetNode, codeSnippetNodes, } from './node';
|
|
3
4
|
export { CodeSnippetRenderer } from './renderer';
|
|
4
|
-
export { codeSnippetModule } from './module';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/code-snippet/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,yBAAyB,EAAE,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/code-snippet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,YAAY,EAAE,yBAAyB,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACjB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { $createCodeSnippetNode, $isCodeSnippetNode, CodeSnippetNode, codeSnippetNodes } from "./node.mjs";
|
|
2
2
|
import { CodeSnippetRenderer } from "./renderer.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { codeSnippetNodes as codeSnippetNodes$1 } from "@haklex/rich-ext-code-snippet/node";
|
|
4
4
|
//#region src/modules/code-snippet/module.ts
|
|
5
|
+
/**
|
|
6
|
+
* Code-snippet module — registers CodeSnippetNode (light) and lazy-loads
|
|
7
|
+
* CodeSnippetRenderer (shiki). Consumers can supply a thin override module
|
|
8
|
+
* to keep the heavy shiki-based default out of the bundle.
|
|
9
|
+
*/
|
|
5
10
|
var codeSnippetModule = {
|
|
6
11
|
name: "code-snippet",
|
|
7
12
|
nodes: codeSnippetNodes$1,
|
|
8
|
-
|
|
13
|
+
lazyRenderers: { CodeSnippet: () => import("@haklex/rich-ext-code-snippet/renderer") }
|
|
9
14
|
};
|
|
10
15
|
//#endregion
|
|
11
16
|
export { $createCodeSnippetNode, $isCodeSnippetNode, CodeSnippetNode, CodeSnippetRenderer, codeSnippetModule, codeSnippetNodes };
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { RichRendererModule } from '../../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* Code-snippet module — registers CodeSnippetNode (light) and lazy-loads
|
|
4
|
+
* CodeSnippetRenderer (shiki). Consumers can supply a thin override module
|
|
5
|
+
* to keep the heavy shiki-based default out of the bundle.
|
|
6
|
+
*/
|
|
2
7
|
export declare const codeSnippetModule: RichRendererModule;
|
|
3
8
|
//# sourceMappingURL=module.d.ts.map
|