@lobehub/ui 2.11.5 → 2.11.7
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/es/Markdown/Markdown.js +5 -19
- package/es/Markdown/SyntaxMarkdown/MarkdownRender.js +2 -2
- package/es/Markdown/SyntaxMarkdown/StreamdownRender.js +6 -2
- package/es/Markdown/SyntaxMarkdown/style.d.ts +3 -0
- package/es/Markdown/SyntaxMarkdown/style.js +10 -0
- package/es/Markdown/markdown.style.d.ts +1 -1
- package/es/Markdown/markdown.style.js +18 -19
- package/es/Markdown/style.d.ts +0 -1
- package/es/Markdown/style.js +5 -7
- package/es/Markdown/type.d.ts +2 -1
- package/es/hooks/useMarkdown/useMarkdownComponents.js +4 -6
- package/package.json +1 -1
package/es/Markdown/Markdown.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
-
var _excluded = ["ref", "children", "className", "style", "fullFeaturedCodeBlock", "onDoubleClick", "animated", "enableLatex", "enableMermaid", "enableImageGallery", "enableCustomFootnotes", "enableGithubAlert", "enableStream", "componentProps", "allowHtml", "fontSize", "headerMultiple", "marginMultiple", "showFootnotes", "variant", "reactMarkdownProps", "lineHeight", "rehypePlugins", "remarkPlugins", "remarkPluginsAhead", "components", "customRender", "citations"]
|
|
5
|
-
_excluded2 = ["children"];
|
|
4
|
+
var _excluded = ["ref", "children", "className", "style", "fullFeaturedCodeBlock", "onDoubleClick", "animated", "enableLatex", "enableMermaid", "enableImageGallery", "enableCustomFootnotes", "enableGithubAlert", "enableStream", "componentProps", "allowHtml", "fontSize", "headerMultiple", "marginMultiple", "showFootnotes", "variant", "reactMarkdownProps", "lineHeight", "rehypePlugins", "remarkPlugins", "remarkPluginsAhead", "components", "customRender", "citations"];
|
|
6
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
7
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -17,7 +16,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
17
16
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
18
17
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
19
18
|
import { cva } from 'class-variance-authority';
|
|
20
|
-
import { memo,
|
|
19
|
+
import { memo, useEffect, useMemo, useState } from 'react';
|
|
21
20
|
import { PreviewGroup } from "../Image";
|
|
22
21
|
import { MarkdownProvider } from "./components/MarkdownProvider";
|
|
23
22
|
import { MarkdownRender, StreamdownRender } from "./SyntaxMarkdown";
|
|
@@ -40,7 +39,8 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
|
40
39
|
enableImageGallery = _ref.enableImageGallery,
|
|
41
40
|
enableCustomFootnotes = _ref.enableCustomFootnotes,
|
|
42
41
|
enableGithubAlert = _ref.enableGithubAlert,
|
|
43
|
-
enableStream = _ref.enableStream,
|
|
42
|
+
_ref$enableStream = _ref.enableStream,
|
|
43
|
+
enableStream = _ref$enableStream === void 0 ? true : _ref$enableStream,
|
|
44
44
|
componentProps = _ref.componentProps,
|
|
45
45
|
allowHtml = _ref.allowHtml,
|
|
46
46
|
_ref$fontSize = _ref.fontSize,
|
|
@@ -90,7 +90,6 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
|
90
90
|
var variants = useMemo(function () {
|
|
91
91
|
return cva(styles.root, {
|
|
92
92
|
defaultVariants: {
|
|
93
|
-
animated: false,
|
|
94
93
|
enableLatex: true,
|
|
95
94
|
variant: 'default'
|
|
96
95
|
},
|
|
@@ -103,24 +102,12 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
|
103
102
|
enableLatex: {
|
|
104
103
|
true: styles.latex,
|
|
105
104
|
false: null
|
|
106
|
-
},
|
|
107
|
-
animated: {
|
|
108
|
-
true: styles.animated,
|
|
109
|
-
false: null
|
|
110
105
|
}
|
|
111
106
|
}
|
|
112
107
|
/* eslint-enable sort-keys-fix/sort-keys-fix */
|
|
113
108
|
});
|
|
114
109
|
}, [styles]);
|
|
115
|
-
var DefaultRender =
|
|
116
|
-
var children = _ref2.children,
|
|
117
|
-
reactMarkdownProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
118
|
-
return enableStream ? /*#__PURE__*/_jsx(StreamdownRender, _objectSpread(_objectSpread({}, reactMarkdownProps), {}, {
|
|
119
|
-
children: children
|
|
120
|
-
})) : /*#__PURE__*/_jsx(MarkdownRender, _objectSpread(_objectSpread({}, reactMarkdownProps), {}, {
|
|
121
|
-
children: children
|
|
122
|
-
}));
|
|
123
|
-
}, [enableStream]);
|
|
110
|
+
var DefaultRender = enableStream && delayedAnimated ? StreamdownRender : MarkdownRender;
|
|
124
111
|
var defaultDOM = /*#__PURE__*/_jsx(DefaultRender, _objectSpread(_objectSpread({}, reactMarkdownProps), {}, {
|
|
125
112
|
children: children
|
|
126
113
|
}));
|
|
@@ -128,7 +115,6 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
|
128
115
|
enable: enableImageGallery,
|
|
129
116
|
children: /*#__PURE__*/_jsx(Typography, _objectSpread(_objectSpread({
|
|
130
117
|
className: cx(variants({
|
|
131
|
-
animated: delayedAnimated,
|
|
132
118
|
enableLatex: enableLatex,
|
|
133
119
|
variant: variant
|
|
134
120
|
}), className),
|
|
@@ -10,7 +10,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
10
10
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
11
11
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
12
|
import { memo } from 'react';
|
|
13
|
-
import
|
|
13
|
+
import Markdown from 'react-markdown';
|
|
14
14
|
import { useMarkdownComponents, useMarkdownContent, useMarkdownRehypePlugins, useMarkdownRemarkPlugins } from "../../hooks/useMarkdown";
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
var MarkdownRenderer = /*#__PURE__*/memo(function (_ref) {
|
|
@@ -20,7 +20,7 @@ var MarkdownRenderer = /*#__PURE__*/memo(function (_ref) {
|
|
|
20
20
|
var components = useMarkdownComponents();
|
|
21
21
|
var rehypePluginsList = useMarkdownRehypePlugins();
|
|
22
22
|
var remarkPluginsList = useMarkdownRemarkPlugins();
|
|
23
|
-
return /*#__PURE__*/_jsx(
|
|
23
|
+
return /*#__PURE__*/_jsx(Markdown, _objectSpread(_objectSpread({}, rest), {}, {
|
|
24
24
|
components: components,
|
|
25
25
|
rehypePlugins: rehypePluginsList,
|
|
26
26
|
remarkPlugins: remarkPluginsList,
|
|
@@ -12,8 +12,9 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
12
12
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
13
13
|
import { marked } from 'marked';
|
|
14
14
|
import { memo, useId, useMemo } from 'react';
|
|
15
|
-
import
|
|
15
|
+
import Markdown from 'react-markdown';
|
|
16
16
|
import { useMarkdownComponents, useMarkdownContent, useMarkdownRehypePlugins, useMarkdownRemarkPlugins } from "../../hooks/useMarkdown";
|
|
17
|
+
import { useStyles } from "./style";
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
import { createElement as _createElement } from "react";
|
|
19
20
|
var parseMarkdownIntoBlocks = function parseMarkdownIntoBlocks(markdown) {
|
|
@@ -25,7 +26,7 @@ var parseMarkdownIntoBlocks = function parseMarkdownIntoBlocks(markdown) {
|
|
|
25
26
|
var StreamdownBlock = /*#__PURE__*/memo(function (_ref) {
|
|
26
27
|
var children = _ref.children,
|
|
27
28
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
-
return /*#__PURE__*/_jsx(
|
|
29
|
+
return /*#__PURE__*/_jsx(Markdown, _objectSpread(_objectSpread({}, rest), {}, {
|
|
29
30
|
children: children
|
|
30
31
|
}));
|
|
31
32
|
}, function (prevProps, nextProps) {
|
|
@@ -35,6 +36,8 @@ StreamdownBlock.displayName = 'StreamdownBlock';
|
|
|
35
36
|
export var StreamdownRender = /*#__PURE__*/memo(function (_ref2) {
|
|
36
37
|
var children = _ref2.children,
|
|
37
38
|
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
39
|
+
var _useStyles = useStyles(),
|
|
40
|
+
styles = _useStyles.styles;
|
|
38
41
|
var escapedContent = useMarkdownContent(children || '');
|
|
39
42
|
var components = useMarkdownComponents();
|
|
40
43
|
var rehypePluginsList = useMarkdownRehypePlugins();
|
|
@@ -44,6 +47,7 @@ export var StreamdownRender = /*#__PURE__*/memo(function (_ref2) {
|
|
|
44
47
|
return parseMarkdownIntoBlocks(typeof escapedContent === 'string' ? escapedContent : '');
|
|
45
48
|
}, [escapedContent]);
|
|
46
49
|
return /*#__PURE__*/_jsx("div", {
|
|
50
|
+
className: styles.animated,
|
|
47
51
|
children: blocks.map(function (block, index) {
|
|
48
52
|
return /*#__PURE__*/_createElement(StreamdownBlock, _objectSpread(_objectSpread({}, rest), {}, {
|
|
49
53
|
components: components,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var _templateObject, _templateObject2;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
+
import { createStyles, keyframes } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css;
|
|
6
|
+
var fadeIn = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n "])));
|
|
7
|
+
return {
|
|
8
|
+
animated: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .animate-fade-in,\n .katex-html span,\n span.line > span,\n code:not(:has(span.line)) {\n opacity: 1;\n animation: ", " 1s ease-in-out;\n }\n "])), fadeIn)
|
|
9
|
+
};
|
|
10
|
+
});
|
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18;
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
var IGNORE_CLASSNAME = '.ignore-markdown-style';
|
|
5
5
|
export var useStyles = createStyles(function (_ref) {
|
|
6
|
-
var
|
|
7
|
-
token = _ref.token,
|
|
6
|
+
var token = _ref.token,
|
|
8
7
|
css = _ref.css;
|
|
9
8
|
var __root = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n width: 100%;\n max-width: 100%;\n padding-inline: 1px;\n\n font-size: var(--lobe-markdown-font-size);\n line-height: var(--lobe-markdown-line-height);\n word-break: break-word;\n\n :root {\n --lobe-markdown-font-size: 16px;\n --lobe-markdown-header-multiple: 1;\n --lobe-markdown-margin-multiple: 2;\n --lobe-markdown-line-height: 1.8;\n --lobe-markdown-border-radius: ", ";\n --lobe-markdown-border-color: ", ";\n }\n\n ", " {\n font-size: 14px;\n line-height: 1.5;\n }\n "])), token.borderRadiusLG, token.colorFillQuaternary, IGNORE_CLASSNAME);
|
|
10
|
-
var a = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n a
|
|
11
|
-
var blockquote = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n blockquote
|
|
12
|
-
var code = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n code
|
|
13
|
-
var del = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n del
|
|
14
|
-
var details = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n details
|
|
15
|
-
var header = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n h1
|
|
16
|
-
var hr = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n hr
|
|
17
|
-
var img = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n img
|
|
18
|
-
var kbd = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n kbd
|
|
19
|
-
var list = css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n li
|
|
20
|
-
var p = css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n p
|
|
9
|
+
var a = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n a {\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n }\n "])), token.colorInfoText, token.colorInfoHover);
|
|
10
|
+
var blockquote = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n blockquote {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n margin-inline: 0;\n padding-block: 0;\n padding-inline: 1em;\n border-inline-start: solid 4px ", ";\n\n color: ", ";\n }\n "])), token.colorBorder, token.colorTextSecondary);
|
|
11
|
+
var code = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n code {\n &:not(:has(span)) {\n display: inline;\n\n margin-inline: 0.25em;\n padding-block: 0.2em;\n padding-inline: 0.4em;\n border: 1px solid var(--lobe-markdown-border-color);\n border-radius: 0.25em;\n\n font-family: ", ";\n font-size: 0.875em;\n line-height: 1;\n word-break: break-word;\n white-space: break-spaces;\n\n background: ", ";\n }\n }\n "])), token.fontFamilyCode, token.colorFillSecondary);
|
|
12
|
+
var del = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n del {\n color: ", ";\n text-decoration: line-through;\n }\n "])), token.colorTextDescription);
|
|
13
|
+
var details = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n details {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding-block: 0.75em;\n padding-inline: 1em;\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n\n background: ", ";\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n\n summary {\n cursor: pointer;\n display: flex;\n align-items: center;\n list-style: none;\n\n &::before {\n content: '';\n\n position: absolute;\n inset-inline-end: 1.25em;\n transform: rotateZ(-45deg);\n\n display: block;\n\n width: 0.4em;\n height: 0.4em;\n border-block-end: 1.5px solid ", ";\n border-inline-end: 1.5px solid ", ";\n\n font-family: ", ";\n\n transition: transform 200ms ", ";\n }\n }\n\n &[open] {\n summary {\n padding-block-end: 0.75em;\n border-block-end: 1px dashed ", ";\n\n &::before {\n transform: rotateZ(45deg);\n }\n }\n }\n }\n "])), token.colorFillTertiary, token.colorTextSecondary, token.colorTextSecondary, token.fontFamily, token.motionEaseOut, token.colorBorder);
|
|
14
|
+
var header = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-block: max(\n calc(var(--lobe-markdown-header-multiple) * var(--lobe-markdown-margin-multiple) * 0.4em),\n var(--lobe-markdown-font-size)\n );\n font-weight: bold;\n line-height: 1.25;\n }\n\n h1 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 1.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h2 {\n font-size: calc(var(--lobe-markdown-font-size) * (1 + var(--lobe-markdown-header-multiple)));\n }\n\n h3 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h4 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.25 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h5,\n h6 {\n font-size: calc(var(--lobe-markdown-font-size) * 1);\n }\n "])));
|
|
15
|
+
var hr = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n hr {\n width: 100%;\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 1.5em);\n border-color: ", ";\n border-style: dashed;\n border-width: 1px;\n border-block-start: none;\n border-inline-start: none;\n border-inline-end: none;\n }\n "])), token.colorBorder);
|
|
16
|
+
var img = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n img {\n max-width: 100%;\n }\n\n > img,\n > p > img {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n }\n "])));
|
|
17
|
+
var kbd = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n kbd {\n cursor: default;\n\n display: inline-block;\n\n min-width: 1em;\n margin-inline: 0.25em;\n padding-block: 0.2em;\n padding-inline: 0.4em;\n border: 1px solid ", ";\n border-radius: 0.25em;\n\n font-family: ", ";\n font-size: 0.875em;\n font-weight: 500;\n line-height: 1;\n text-align: center;\n\n background: ", ";\n }\n "])), token.colorBorderSecondary, token.fontFamily, token.colorBgLayout);
|
|
18
|
+
var list = css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n li {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.33em);\n\n p:first-child {\n display: inline;\n }\n }\n\n ul,\n ol {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n margin-inline-start: 1em;\n padding-inline-start: 0;\n list-style-position: outside;\n\n > ul,\n > ol {\n margin-block: 0;\n }\n\n > li {\n margin-inline-start: 1em;\n }\n }\n\n ol {\n list-style: auto;\n }\n\n ul {\n list-style-type: none;\n\n > li {\n &::before {\n content: '-';\n\n position: absolute;\n\n display: inline-block;\n\n margin-inline: -1em 0.5em;\n\n opacity: 0.5;\n }\n }\n }\n "])));
|
|
19
|
+
var p = css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n p {\n margin-block: 4px;\n line-height: var(--lobe-markdown-line-height);\n letter-spacing: 0.02em;\n\n &:not(:first-child) {\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n }\n\n &:not(:last-child) {\n margin-block-end: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n }\n }\n "])));
|
|
21
20
|
var pre = css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n pre {\n font-size: calc(var(--lobe-markdown-font-size) * 0.85);\n }\n "])));
|
|
22
|
-
var strong = css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n strong
|
|
23
|
-
var svg = css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n svg
|
|
24
|
-
var table = css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n table
|
|
25
|
-
var video = css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n > video
|
|
21
|
+
var strong = css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n strong {\n font-weight: 600;\n }\n "])));
|
|
22
|
+
var svg = css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n svg {\n line-height: 1;\n }\n "])));
|
|
23
|
+
var table = css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n table {\n unicode-bidi: isolate;\n overflow: auto hidden;\n display: block;\n border-spacing: 0;\n border-collapse: collapse;\n\n box-sizing: border-box;\n width: max-content;\n max-width: 100%;\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n\n text-align: start;\n text-indent: initial;\n text-wrap: pretty;\n word-break: auto-phrase;\n overflow-wrap: break-word;\n\n background: ", ";\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n\n code {\n word-break: break-word;\n }\n\n thead {\n background: ", ";\n }\n\n tr {\n box-shadow: 0 1px 0 var(--lobe-markdown-border-color);\n }\n\n th,\n td {\n min-width: 120px;\n padding-block: 0.75em;\n padding-inline: 1em;\n text-align: start;\n }\n }\n "])), token.colorFillQuaternary, token.colorFillQuaternary);
|
|
24
|
+
var video = css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n > video,\n > p > video {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n box-shadow: 0 0 0 1px var(--lobe-markdown-border-color);\n }\n\n video {\n max-width: 100%;\n }\n "])));
|
|
26
25
|
var gfm = css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n .markdown-alert {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n padding-inline-start: 1em;\n border-inline-start: solid 4px ", ";\n\n > p {\n margin-block-start: 0 !important;\n }\n }\n\n .markdown-alert > :first-child {\n margin-block-start: 0;\n }\n\n .markdown-alert > :last-child {\n margin-block-end: 0;\n }\n\n .markdown-alert-note {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-tip {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-important {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-warning {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-caution {\n border-inline-start-color: ", ";\n }\n\n .markdown-alert-title {\n display: flex;\n align-items: center;\n margin-block-end: 0.5em !important;\n font-weight: 500;\n }\n\n .markdown-alert-note .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .markdown-alert-tip .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .markdown-alert-important .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .markdown-alert-warning .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .markdown-alert-caution .markdown-alert-title {\n color: ", ";\n fill: ", ";\n }\n\n .octicon {\n overflow: visible !important;\n display: inline-block;\n margin-inline-end: 0.5em;\n vertical-align: text-bottom;\n }\n\n .task-list-item {\n &::before {\n display: none !important;\n }\n\n input[type='checkbox'] {\n margin-block: 0 0.25em;\n margin-inline: -1.6em 0.2em;\n vertical-align: middle;\n }\n\n input[type='checkbox']:dir(rtl) {\n margin: 0 -1.6em 0.25em 0.2em;\n }\n }\n\n /* Style the footnotes section. */\n\n .footnotes {\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 1em);\n font-size: smaller;\n color: #8b949e;\n\n #footnote-label {\n display: none;\n }\n\n > ol {\n margin: 0 !important;\n }\n }\n\n .sr-only {\n position: absolute;\n\n overflow: hidden;\n\n width: 1px;\n height: 1px;\n padding: 0;\n border: 0;\n\n word-wrap: normal;\n\n clip: rect(0, 0, 0, 0);\n }\n\n sup {\n line-height: var(--lobe-markdown-line-height);\n }\n\n sup:has(a[aria-describedby='footnote-label']) {\n margin-inline: 2px;\n vertical-align: super !important;\n\n [data-footnote-ref] {\n display: inline-block;\n\n width: 16px;\n height: 16px;\n border-radius: 4px;\n\n font-family: ", ";\n font-size: 10px;\n color: ", " !important;\n text-align: center;\n\n background: ", ";\n }\n }\n "])), token.colorBorder, token.colorInfo, token.colorSuccess, token.purple, token.colorWarning, token.colorError, token.colorInfo, token.colorInfo, token.colorSuccess, token.colorSuccess, token.purple, token.purple, token.colorWarning, token.colorWarning, token.colorError, token.colorError, token.fontFamilyCode, token.colorTextSecondary, token.colorFillSecondary);
|
|
27
26
|
return {
|
|
28
27
|
root: __root,
|
|
29
|
-
variant:
|
|
28
|
+
variant: css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n &:not(:has(", ")) {\n ", "\n }\n "])), IGNORE_CLASSNAME, [a, blockquote, code, del, details, header, hr, img, kbd, list, p, pre, strong, svg, table, video, gfm])
|
|
30
29
|
};
|
|
31
30
|
});
|
package/es/Markdown/style.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
2
|
-
animated: import("antd-style").SerializedStyles;
|
|
3
2
|
chat: import("antd-style").SerializedStyles;
|
|
4
3
|
latex: import("antd-style").SerializedStyles;
|
|
5
4
|
root: import("antd-style").SerializedStyles;
|
package/es/Markdown/style.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
var _templateObject, _templateObject2, _templateObject3
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import { createStyles
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
6
6
|
token = _ref.token,
|
|
7
7
|
isDarkMode = _ref.isDarkMode;
|
|
8
8
|
var cyanColor = isDarkMode ? token.cyan9A : token.cyan11A;
|
|
9
|
-
var fadeIn = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n "])));
|
|
10
9
|
return {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
root: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n max-width: 100%;\n "])))
|
|
10
|
+
chat: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n --lobe-markdown-border-radius: ", ";\n\n ol,\n ul {\n > li {\n &::marker {\n color: ", " !important;\n }\n\n > li {\n &::marker {\n color: ", " !important;\n }\n }\n }\n }\n\n ul {\n list-style: unset;\n\n > li {\n &::before {\n content: unset;\n display: unset;\n }\n }\n }\n "])), token.borderRadius, cyanColor, token.colorTextSecondary),
|
|
11
|
+
latex: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .katex-error {\n color: ", " !important;\n }\n\n .katex-html {\n overflow: auto hidden;\n padding: 3px;\n\n .base {\n margin-block: 0;\n margin-inline: auto;\n }\n\n .tag {\n position: relative !important;\n display: inline-block;\n padding-inline-start: 0.5rem;\n }\n }\n "])), token.colorTextDescription),
|
|
12
|
+
root: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n max-width: 100%;\n "])))
|
|
15
13
|
};
|
|
16
14
|
});
|
package/es/Markdown/type.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnchorProps } from 'antd';
|
|
2
|
-
import
|
|
2
|
+
import { CSSProperties, ElementType, FC, ReactNode, Ref } from 'react';
|
|
3
3
|
import type { Options as ReactMarkdownOptions } from 'react-markdown';
|
|
4
4
|
import type { Components } from 'react-markdown/lib';
|
|
5
5
|
import type { Pluggable } from 'unified';
|
|
@@ -17,6 +17,7 @@ export interface TypographyProps extends DivProps {
|
|
|
17
17
|
}
|
|
18
18
|
export interface SyntaxMarkdownProps {
|
|
19
19
|
allowHtml?: boolean;
|
|
20
|
+
allowHtmlList?: ElementType[];
|
|
20
21
|
animated?: boolean;
|
|
21
22
|
children: string;
|
|
22
23
|
citations?: CitationItem[];
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
var _excluded = ["children"];
|
|
4
3
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
7
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
6
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -49,11 +46,12 @@ export var useMarkdownComponents = function useMarkdownComponents() {
|
|
|
49
46
|
var memeP = useCallback(function (_ref) {
|
|
50
47
|
var _children$props;
|
|
51
48
|
var children = _ref.children,
|
|
52
|
-
|
|
49
|
+
className = _ref.className;
|
|
53
50
|
var hasImage = _typeof(children) === 'object' && (children === null || children === void 0 || (_children$props = children.props) === null || _children$props === void 0 || (_children$props = _children$props.node) === null || _children$props === void 0 ? void 0 : _children$props.tagName) === 'img';
|
|
54
|
-
return hasImage ? children : /*#__PURE__*/_jsx("p",
|
|
51
|
+
return hasImage ? children : /*#__PURE__*/_jsx("p", {
|
|
52
|
+
className: className,
|
|
55
53
|
children: children
|
|
56
|
-
})
|
|
54
|
+
});
|
|
57
55
|
}, []);
|
|
58
56
|
|
|
59
57
|
// Stable references for theme objects to prevent unnecessary re-renders
|