@haklex/rich-kit-shiro 0.1.0 → 0.2.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/dist/ShiroEditor-BwTYpmpQ.js +61 -0
- package/dist/ShiroRenderer-C8bB0OW4.js +43 -0
- package/dist/editor.mjs +18 -11
- package/dist/exports/editor-core.mjs +1 -15
- package/dist/exports/excalidraw.mjs +1 -9
- package/dist/exports/markdown.mjs +2 -6
- package/dist/exports/nodes.mjs +4 -39
- package/dist/exports/plugins.mjs +1 -14
- package/dist/exports/renderers-edit.mjs +1 -14
- package/dist/exports/renderers.mjs +2 -51
- package/dist/exports/style.mjs +1 -3
- package/dist/index.mjs +11 -151
- package/dist/markdown-BO2eqHxN.js +11 -0
- package/dist/renderer.mjs +19 -24
- package/dist/style-DFwSoIYR.js +4 -0
- package/package.json +28 -29
- package/dist/ShiroEditor-CehZVqb3.js +0 -76
- package/dist/ShiroRenderer-lHgA6aH9.js +0 -41
- package/dist/markdown-6NDL-9Bg.js +0 -19
- package/dist/style-BdEDjsBT.js +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-kit-shiro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Production bundle for Shiroi blog",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -64,43 +64,42 @@
|
|
|
64
64
|
"src/style-renderer.css"
|
|
65
65
|
],
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"katex": "^0.16.
|
|
67
|
+
"katex": "^0.16.45",
|
|
68
68
|
"react-shadow": "^20.6.0",
|
|
69
|
-
"@haklex/rich-editor": "0.
|
|
70
|
-
"@haklex/rich-
|
|
71
|
-
"@haklex/rich-ext-code-snippet": "0.
|
|
72
|
-
"@haklex/rich-
|
|
73
|
-
"@haklex/rich-ext-excalidraw": "0.
|
|
74
|
-
"@haklex/rich-ext-nested-doc": "0.
|
|
75
|
-
"@haklex/rich-plugin-
|
|
76
|
-
"@haklex/rich-plugin-
|
|
77
|
-
"@haklex/rich-plugin-
|
|
78
|
-
"@haklex/rich-plugin-
|
|
79
|
-
"@haklex/rich-plugin-
|
|
80
|
-
"@haklex/rich-
|
|
81
|
-
"@haklex/rich-plugin-
|
|
82
|
-
"@haklex/rich-renderers": "0.
|
|
83
|
-
"@haklex/rich-
|
|
84
|
-
"@haklex/rich-
|
|
85
|
-
"@haklex/rich-
|
|
86
|
-
"@haklex/rich-style-token": "0.
|
|
69
|
+
"@haklex/rich-editor": "0.2.0",
|
|
70
|
+
"@haklex/rich-ext-embed": "0.2.0",
|
|
71
|
+
"@haklex/rich-ext-code-snippet": "0.2.0",
|
|
72
|
+
"@haklex/rich-editor-ui": "0.2.0",
|
|
73
|
+
"@haklex/rich-ext-excalidraw": "0.2.0",
|
|
74
|
+
"@haklex/rich-ext-nested-doc": "0.2.0",
|
|
75
|
+
"@haklex/rich-plugin-link-edit": "0.2.0",
|
|
76
|
+
"@haklex/rich-plugin-floating-toolbar": "0.2.0",
|
|
77
|
+
"@haklex/rich-plugin-block-handle": "0.2.0",
|
|
78
|
+
"@haklex/rich-plugin-mention": "0.2.0",
|
|
79
|
+
"@haklex/rich-plugin-toolbar": "0.2.0",
|
|
80
|
+
"@haklex/rich-renderer-katex": "0.2.0",
|
|
81
|
+
"@haklex/rich-plugin-slash-menu": "0.2.0",
|
|
82
|
+
"@haklex/rich-renderers": "0.2.0",
|
|
83
|
+
"@haklex/rich-plugin-table": "0.2.0",
|
|
84
|
+
"@haklex/rich-static-renderer": "0.2.0",
|
|
85
|
+
"@haklex/rich-renderers-edit": "0.2.0",
|
|
86
|
+
"@haklex/rich-style-token": "0.2.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@lexical/react": "^0.
|
|
89
|
+
"@lexical/react": "^0.44.0",
|
|
90
90
|
"@types/react": "^19.2.14",
|
|
91
91
|
"@types/react-dom": "^19.2.3",
|
|
92
|
-
"@vanilla-extract/vite-plugin": "^5.
|
|
93
|
-
"lexical": "^0.
|
|
94
|
-
"react": "19.2.
|
|
95
|
-
"react-dom": "19.2.
|
|
96
|
-
"rollup-plugin-visualizer": "^7.0.1",
|
|
92
|
+
"@vanilla-extract/vite-plugin": "^5.2.2",
|
|
93
|
+
"lexical": "^0.44.0",
|
|
94
|
+
"react": "19.2.5",
|
|
95
|
+
"react-dom": "19.2.5",
|
|
97
96
|
"typescript": "^5.9.3",
|
|
98
|
-
"vite": "^
|
|
97
|
+
"vite": "^8.0.10",
|
|
99
98
|
"vite-plugin-dts": "^4.5.4"
|
|
100
99
|
},
|
|
101
100
|
"peerDependencies": {
|
|
102
|
-
"@lexical/react": "^0.
|
|
103
|
-
"lexical": "^0.
|
|
101
|
+
"@lexical/react": "^0.44.0",
|
|
102
|
+
"lexical": "^0.44.0",
|
|
104
103
|
"lucide-react": "^1.0.0",
|
|
105
104
|
"react": ">=19",
|
|
106
105
|
"react-dom": ">=19"
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { NestedContentRendererProvider, RichEditor } from "@haklex/rich-editor";
|
|
3
|
-
import { BlockHandlePlugin } from "@haklex/rich-plugin-block-handle";
|
|
4
|
-
import { FloatingToolbarPlugin } from "@haklex/rich-plugin-floating-toolbar";
|
|
5
|
-
import { FloatingLinkEditorPlugin } from "@haklex/rich-plugin-link-edit";
|
|
6
|
-
import { MentionMenuPlugin } from "@haklex/rich-plugin-mention";
|
|
7
|
-
import { SlashMenuPlugin } from "@haklex/rich-plugin-slash-menu";
|
|
8
|
-
import { TableRowColumnHandlesPlugin, TableCellResizerPlugin } from "@haklex/rich-plugin-table";
|
|
9
|
-
import { ExcalidrawEditNode, embedEditNodes, linkCardEditNodes, katexEditNodes, galleryEditNodes, codeSnippetEditNodes, ConvertToLinkCardAction, enhancedEditRendererConfig, ExcalidrawPlugin, EmbedPlugin, PasteLinkCardPlugin } from "@haklex/rich-renderers-edit";
|
|
10
|
-
import { useMemo, useCallback } from "react";
|
|
11
|
-
import { S as ShiroRenderer } from "./ShiroRenderer-lHgA6aH9.js";
|
|
12
|
-
const defaultExtraNodes = [
|
|
13
|
-
ExcalidrawEditNode,
|
|
14
|
-
...embedEditNodes,
|
|
15
|
-
...linkCardEditNodes,
|
|
16
|
-
...katexEditNodes,
|
|
17
|
-
...galleryEditNodes,
|
|
18
|
-
...codeSnippetEditNodes
|
|
19
|
-
];
|
|
20
|
-
function ShiroEditor({
|
|
21
|
-
extraNodes,
|
|
22
|
-
actions,
|
|
23
|
-
floatingToolbarActions,
|
|
24
|
-
children,
|
|
25
|
-
selfHostnames,
|
|
26
|
-
extraMentionPlatforms,
|
|
27
|
-
variant = "article",
|
|
28
|
-
theme = "light",
|
|
29
|
-
...props
|
|
30
|
-
}) {
|
|
31
|
-
const mergedNodes = useMemo(
|
|
32
|
-
() => extraNodes ? [...defaultExtraNodes, ...extraNodes] : defaultExtraNodes,
|
|
33
|
-
[extraNodes]
|
|
34
|
-
);
|
|
35
|
-
const renderNestedContent = useCallback(
|
|
36
|
-
(value, overrideVariant) => /* @__PURE__ */ jsx(ShiroRenderer, { theme, value, variant: overrideVariant ?? variant }),
|
|
37
|
-
[theme, variant]
|
|
38
|
-
);
|
|
39
|
-
const renderLinkExtraActions = useCallback(
|
|
40
|
-
({
|
|
41
|
-
url,
|
|
42
|
-
linkKey,
|
|
43
|
-
actionButtonClassName
|
|
44
|
-
}) => /* @__PURE__ */ jsx(ConvertToLinkCardAction, { className: actionButtonClassName, linkKey, url }),
|
|
45
|
-
[]
|
|
46
|
-
);
|
|
47
|
-
return /* @__PURE__ */ jsx(NestedContentRendererProvider, { value: renderNestedContent, children: /* @__PURE__ */ jsxs(
|
|
48
|
-
RichEditor,
|
|
49
|
-
{
|
|
50
|
-
...props,
|
|
51
|
-
extraNodes: mergedNodes,
|
|
52
|
-
rendererConfig: enhancedEditRendererConfig,
|
|
53
|
-
theme,
|
|
54
|
-
variant,
|
|
55
|
-
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
56
|
-
/* @__PURE__ */ jsx(SlashMenuPlugin, {}),
|
|
57
|
-
/* @__PURE__ */ jsx(MentionMenuPlugin, { extraPlatforms: extraMentionPlatforms }),
|
|
58
|
-
actions
|
|
59
|
-
] }),
|
|
60
|
-
children: [
|
|
61
|
-
/* @__PURE__ */ jsx(BlockHandlePlugin, {}),
|
|
62
|
-
/* @__PURE__ */ jsx(FloatingToolbarPlugin, { actions: floatingToolbarActions }),
|
|
63
|
-
/* @__PURE__ */ jsx(FloatingLinkEditorPlugin, { renderExtraActions: renderLinkExtraActions }),
|
|
64
|
-
/* @__PURE__ */ jsx(ExcalidrawPlugin, {}),
|
|
65
|
-
/* @__PURE__ */ jsx(EmbedPlugin, { selfHostnames }),
|
|
66
|
-
/* @__PURE__ */ jsx(PasteLinkCardPlugin, {}),
|
|
67
|
-
/* @__PURE__ */ jsx(TableRowColumnHandlesPlugin, {}),
|
|
68
|
-
/* @__PURE__ */ jsx(TableCellResizerPlugin, {}),
|
|
69
|
-
children
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
) });
|
|
73
|
-
}
|
|
74
|
-
export {
|
|
75
|
-
ShiroEditor as S
|
|
76
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { NestedContentRendererProvider } from "@haklex/rich-editor";
|
|
3
|
-
import { nestedDocNodes } from "@haklex/rich-ext-nested-doc/static";
|
|
4
|
-
import { ExcalidrawNode, embedNodes, galleryNodes, codeSnippetNodes, enhancedRendererConfig } from "@haklex/rich-renderers";
|
|
5
|
-
import { RichRenderer } from "@haklex/rich-static-renderer";
|
|
6
|
-
import { useMemo, useCallback } from "react";
|
|
7
|
-
const defaultExtraNodes = [
|
|
8
|
-
ExcalidrawNode,
|
|
9
|
-
...embedNodes,
|
|
10
|
-
...galleryNodes,
|
|
11
|
-
...codeSnippetNodes,
|
|
12
|
-
...nestedDocNodes
|
|
13
|
-
];
|
|
14
|
-
function ShiroRenderer({ extraNodes, rendererConfig, ...props }) {
|
|
15
|
-
const mergedNodes = useMemo(
|
|
16
|
-
() => extraNodes ? [...defaultExtraNodes, ...extraNodes] : defaultExtraNodes,
|
|
17
|
-
[extraNodes]
|
|
18
|
-
);
|
|
19
|
-
const mergedConfig = useMemo(
|
|
20
|
-
() => rendererConfig ? { ...enhancedRendererConfig, ...rendererConfig } : enhancedRendererConfig,
|
|
21
|
-
[rendererConfig]
|
|
22
|
-
);
|
|
23
|
-
const renderNestedContent = useCallback(
|
|
24
|
-
(value, overrideVariant) => /* @__PURE__ */ jsx(
|
|
25
|
-
ShiroRenderer,
|
|
26
|
-
{
|
|
27
|
-
nested: true,
|
|
28
|
-
extraNodes,
|
|
29
|
-
rendererConfig,
|
|
30
|
-
theme: props.theme,
|
|
31
|
-
value,
|
|
32
|
-
variant: overrideVariant ?? props.variant
|
|
33
|
-
}
|
|
34
|
-
),
|
|
35
|
-
[extraNodes, props.theme, props.variant, rendererConfig]
|
|
36
|
-
);
|
|
37
|
-
return /* @__PURE__ */ jsx(NestedContentRendererProvider, { value: renderNestedContent, children: /* @__PURE__ */ jsx(RichRenderer, { ...props, extraNodes: mergedNodes, rendererConfig: mergedConfig }) });
|
|
38
|
-
}
|
|
39
|
-
export {
|
|
40
|
-
ShiroRenderer as S
|
|
41
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ALL_TRANSFORMERS } from "@haklex/rich-editor/plugins";
|
|
2
|
-
import { CODE_SNIPPET_BLOCK_TRANSFORMER } from "@haklex/rich-ext-code-snippet";
|
|
3
|
-
import { EXCALIDRAW_BLOCK_TRANSFORMER } from "@haklex/rich-ext-excalidraw";
|
|
4
|
-
const SHIRO_EXT_MARKDOWN_TRANSFORMERS = [
|
|
5
|
-
CODE_SNIPPET_BLOCK_TRANSFORMER,
|
|
6
|
-
EXCALIDRAW_BLOCK_TRANSFORMER
|
|
7
|
-
];
|
|
8
|
-
const SHIRO_MARKDOWN_TRANSFORMERS = [
|
|
9
|
-
...ALL_TRANSFORMERS,
|
|
10
|
-
...SHIRO_EXT_MARKDOWN_TRANSFORMERS
|
|
11
|
-
];
|
|
12
|
-
function buildShiroMarkdownTransformers(extra = []) {
|
|
13
|
-
return [...SHIRO_MARKDOWN_TRANSFORMERS, ...extra];
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
SHIRO_EXT_MARKDOWN_TRANSFORMERS as S,
|
|
17
|
-
SHIRO_MARKDOWN_TRANSFORMERS as a,
|
|
18
|
-
buildShiroMarkdownTransformers as b
|
|
19
|
-
};
|