@haklex/rich-static-renderer 0.0.83 → 0.0.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/RichRenderer.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { RichRendererProps } from './types';
|
|
2
|
-
export declare function RichRenderer({ value, variant, theme, className, style, as: Component, rendererConfig, extraNodes, builtinNodeOverrides, }: RichRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function RichRenderer({ value, variant, theme, className, style, as: Component, nested, rendererConfig, extraNodes, builtinNodeOverrides, }: RichRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=RichRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichRenderer.d.ts","sourceRoot":"","sources":["../src/RichRenderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RichRenderer.d.ts","sourceRoot":"","sources":["../src/RichRenderer.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAuB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAkNtE,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,OAAmB,EACnB,KAAe,EACf,SAAS,EACT,KAAK,EACL,EAAE,EAAE,SAAiB,EACrB,MAAc,EACd,cAAc,EACd,UAAU,EACV,oBAAoB,GACrB,EAAE,iBAAiB,2CAoCnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderBuiltinNode.d.ts","sourceRoot":"","sources":["../../src/engine/renderBuiltinNode.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderBuiltinNode.d.ts","sourceRoot":"","sources":["../../src/engine/renderBuiltinNode.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAkCtD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,GAAG,EACT,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAC5B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,YAAY,CAAC,EAAE,MAAM,GACpB,SAAS,CAiNX"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { semanticClassNames, sharedStyles, RendererWrapper, RubyRenderer, getTagBgColor, LinkFavicon, getVariantClass, useOptionalNestedContentRenderer, allNodes, ColorSchemeProvider, RendererConfigProvider, FootnoteDefinitionsProvider, NestedContentRendererProvider, editorTheme } from "@haklex/rich-editor/static";
|
|
2
|
+
import { semanticClassNames, sharedStyles, RendererWrapper, RubyRenderer, getTagBgColor, detailsClassNames, detailsStyles, LinkFavicon, getVariantClass, useOptionalNestedContentRenderer, allNodes, ColorSchemeProvider, RendererConfigProvider, FootnoteDefinitionsProvider, NestedContentRendererProvider, editorTheme, gridClassNames, gridStyles } from "@haklex/rich-editor/static";
|
|
3
3
|
import { PortalThemeProvider } from "@haklex/rich-style-token";
|
|
4
4
|
import { createHeadlessEditor } from "@lexical/headless";
|
|
5
5
|
import { $getRoot } from "lexical";
|
|
@@ -91,6 +91,7 @@ function renderBuiltinNode(node, key, children, headingSlugs, _textContent) {
|
|
|
91
91
|
case "listitem": {
|
|
92
92
|
const isChecklist = node.checked !== void 0;
|
|
93
93
|
const hasNestedList = node.children?.some((c) => c.type === "list");
|
|
94
|
+
const value = typeof node.value === "number" && node.value > 1 ? node.value : void 0;
|
|
94
95
|
let cls;
|
|
95
96
|
if (hasNestedList) {
|
|
96
97
|
cls = shared$1("listNestedItem");
|
|
@@ -99,7 +100,7 @@ function renderBuiltinNode(node, key, children, headingSlugs, _textContent) {
|
|
|
99
100
|
} else {
|
|
100
101
|
cls = shared$1("listItem");
|
|
101
102
|
}
|
|
102
|
-
return /* @__PURE__ */ jsx("li", { className: cls, value
|
|
103
|
+
return /* @__PURE__ */ jsx("li", { className: cls, value, children }, key);
|
|
103
104
|
}
|
|
104
105
|
case "link": {
|
|
105
106
|
return /* @__PURE__ */ jsxs(
|
|
@@ -139,26 +140,41 @@ function renderBuiltinNode(node, key, children, headingSlugs, _textContent) {
|
|
|
139
140
|
}
|
|
140
141
|
case "details": {
|
|
141
142
|
const summary = node.summary || "";
|
|
142
|
-
return /* @__PURE__ */ jsxs(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
143
|
+
return /* @__PURE__ */ jsxs(
|
|
144
|
+
"details",
|
|
145
|
+
{
|
|
146
|
+
className: `${detailsClassNames.details} ${detailsStyles.details}`,
|
|
147
|
+
open: node.open || void 0,
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ jsxs("summary", { className: `${detailsClassNames.summary} ${detailsStyles.summary}`, children: [
|
|
150
|
+
/* @__PURE__ */ jsx(
|
|
151
|
+
"span",
|
|
152
|
+
{
|
|
153
|
+
"aria-hidden": "true",
|
|
154
|
+
className: `${detailsClassNames.chevron} ${detailsStyles.chevron}`,
|
|
155
|
+
children: /* @__PURE__ */ jsx(
|
|
156
|
+
"svg",
|
|
157
|
+
{
|
|
158
|
+
fill: "none",
|
|
159
|
+
height: "20",
|
|
160
|
+
stroke: "currentColor",
|
|
161
|
+
strokeLinecap: "round",
|
|
162
|
+
strokeLinejoin: "round",
|
|
163
|
+
strokeWidth: "1.5",
|
|
164
|
+
viewBox: "0 0 20 20",
|
|
165
|
+
width: "20",
|
|
166
|
+
children: /* @__PURE__ */ jsx("path", { d: "M8 6L12 10L8 14" })
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
/* @__PURE__ */ jsx("span", { className: `${detailsClassNames.summaryText} ${detailsStyles.summaryText}`, children: summary })
|
|
172
|
+
] }),
|
|
173
|
+
/* @__PURE__ */ jsx("div", { className: `${detailsClassNames.content} ${detailsStyles.content}`, children })
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
key
|
|
177
|
+
);
|
|
162
178
|
}
|
|
163
179
|
case "spoiler": {
|
|
164
180
|
return /* @__PURE__ */ jsx("span", { className: shared$1("spoiler"), role: "button", tabIndex: 0, children }, key);
|
|
@@ -297,7 +313,14 @@ function wrapDecoration(serialized, key, decoration) {
|
|
|
297
313
|
);
|
|
298
314
|
}
|
|
299
315
|
case "grid-container": {
|
|
300
|
-
return createElement(
|
|
316
|
+
return createElement(
|
|
317
|
+
"div",
|
|
318
|
+
{
|
|
319
|
+
key,
|
|
320
|
+
className: `${gridClassNames.container} ${gridStyles.container}`
|
|
321
|
+
},
|
|
322
|
+
decoration
|
|
323
|
+
);
|
|
301
324
|
}
|
|
302
325
|
default: {
|
|
303
326
|
if (isValidElement(decoration)) {
|
|
@@ -434,6 +457,7 @@ function RichRenderer({
|
|
|
434
457
|
className,
|
|
435
458
|
style,
|
|
436
459
|
as: Component = "div",
|
|
460
|
+
nested = false,
|
|
437
461
|
rendererConfig,
|
|
438
462
|
extraNodes,
|
|
439
463
|
builtinNodeOverrides
|
|
@@ -455,6 +479,7 @@ function RichRenderer({
|
|
|
455
479
|
{
|
|
456
480
|
suppressHydrationWarning: true,
|
|
457
481
|
className: classes,
|
|
482
|
+
"data-rich-nested": nested ? "true" : void 0,
|
|
458
483
|
"data-theme": theme,
|
|
459
484
|
style,
|
|
460
485
|
children: content
|
package/dist/types.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface RichRendererProps {
|
|
|
7
7
|
builtinNodeOverrides?: Record<string, BuiltinNodeRenderer>;
|
|
8
8
|
className?: string;
|
|
9
9
|
extraNodes?: Array<Klass<LexicalNode>>;
|
|
10
|
+
nested?: boolean;
|
|
10
11
|
rendererConfig?: RendererConfig;
|
|
11
12
|
style?: CSSProperties;
|
|
12
13
|
theme?: ColorScheme;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACjG,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,MAAM,mBAAmB,GAAG,CAChC,IAAI,EAAE,GAAG,EACT,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAC5B,eAAe,EAAE,MAAM,SAAS,KAC7B,SAAS,CAAC;AAEf,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC;IACvC,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IACvC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,qBAAqB,CAAC;IAC7B,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACjG,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,MAAM,mBAAmB,GAAG,CAChC,IAAI,EAAE,GAAG,EACT,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAC5B,eAAe,EAAE,MAAM,SAAS,KAC7B,SAAS,CAAC;AAEf,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC;IACvC,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,qBAAqB,CAAC;IAC7B,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-static-renderer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.84",
|
|
4
4
|
"description": "Headless SSR engine for Lexical rich content",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"@lexical/code": "npm:lexical-code-no-prism@0.41.0",
|
|
24
24
|
"@lexical/headless": "^0.41.0",
|
|
25
25
|
"lucide-react": "^0.577.0",
|
|
26
|
-
"@haklex/rich-editor": "0.0.
|
|
27
|
-
"@haklex/rich-style-token": "0.0.
|
|
26
|
+
"@haklex/rich-editor": "0.0.84",
|
|
27
|
+
"@haklex/rich-style-token": "0.0.84"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@lexical/extension": "^0.41.0",
|