@windrun-huaiin/third-ui 22.0.1 → 23.0.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/fuma/server/features/base.d.ts +2 -0
- package/dist/fuma/server/features/base.js +13 -0
- package/dist/fuma/server/features/base.mjs +11 -0
- package/dist/fuma/server/features/code.d.ts +3 -0
- package/dist/fuma/server/features/code.js +66 -0
- package/dist/fuma/server/features/code.mjs +64 -0
- package/dist/fuma/server/features/math.d.ts +2 -0
- package/dist/fuma/server/features/math.js +14 -0
- package/dist/fuma/server/features/math.mjs +12 -0
- package/dist/fuma/server/features/mermaid.d.ts +2 -0
- package/dist/fuma/server/features/mermaid.js +13 -0
- package/dist/fuma/server/features/mermaid.mjs +11 -0
- package/dist/fuma/server/features/type-table.d.ts +2 -0
- package/dist/fuma/server/features/type-table.js +12 -0
- package/dist/fuma/server/features/type-table.mjs +10 -0
- package/dist/fuma/server/features/widgets.d.ts +2 -0
- package/dist/fuma/server/features/widgets.js +26 -0
- package/dist/fuma/server/features/widgets.mjs +24 -0
- package/dist/fuma/server/optional-features.d.ts +6 -8
- package/dist/fuma/server/optional-features.js +13 -107
- package/dist/fuma/server/optional-features.mjs +6 -104
- package/dist/fuma/server/site-mdx-base.d.ts +13 -0
- package/dist/fuma/server/site-mdx-base.js +32 -0
- package/dist/fuma/server/site-mdx-base.mjs +29 -0
- package/dist/fuma/server/site-mdx-components.d.ts +1 -1
- package/dist/fuma/server/site-mdx-components.js +7 -8
- package/dist/fuma/server/site-mdx-components.mjs +8 -9
- package/dist/fuma/server/site-mdx-fallbacks.d.ts +18 -0
- package/dist/fuma/server/site-mdx-fallbacks.js +49 -0
- package/dist/fuma/server/site-mdx-fallbacks.mjs +45 -0
- package/dist/fuma/server/site-mdx-features/code.d.ts +1 -0
- package/dist/fuma/server/site-mdx-features/code.js +7 -0
- package/dist/fuma/server/site-mdx-features/code.mjs +1 -0
- package/dist/fuma/server/site-mdx-features/math.d.ts +1 -0
- package/dist/fuma/server/site-mdx-features/math.js +7 -0
- package/dist/fuma/server/site-mdx-features/math.mjs +1 -0
- package/dist/fuma/server/site-mdx-features/mermaid.d.ts +1 -0
- package/dist/fuma/server/site-mdx-features/mermaid.js +7 -0
- package/dist/fuma/server/site-mdx-features/mermaid.mjs +1 -0
- package/dist/fuma/server/site-mdx-features/type-table.d.ts +1 -0
- package/dist/fuma/server/site-mdx-features/type-table.js +7 -0
- package/dist/fuma/server/site-mdx-features/type-table.mjs +1 -0
- package/dist/fuma/server/site-mdx-presets.d.ts +2 -1
- package/dist/fuma/server/site-mdx-presets.js +22 -13
- package/dist/fuma/server/site-mdx-presets.mjs +22 -12
- package/dist/fuma/share/markdown-component-map.js +43 -29
- package/dist/fuma/share/markdown-component-map.mjs +42 -28
- package/package.json +29 -4
- package/src/fuma/server/features/base.tsx +23 -0
- package/src/fuma/server/features/code.tsx +104 -0
- package/src/fuma/server/features/math.ts +16 -0
- package/src/fuma/server/features/mermaid.tsx +21 -0
- package/src/fuma/server/features/type-table.ts +12 -0
- package/src/fuma/server/features/widgets.tsx +34 -0
- package/src/fuma/server/optional-features.tsx +6 -168
- package/src/fuma/server/site-mdx-base.tsx +62 -0
- package/src/fuma/server/site-mdx-components.tsx +10 -12
- package/src/fuma/server/site-mdx-fallbacks.tsx +122 -0
- package/src/fuma/server/site-mdx-features/code.ts +1 -0
- package/src/fuma/server/site-mdx-features/math.ts +1 -0
- package/src/fuma/server/site-mdx-features/mermaid.ts +1 -0
- package/src/fuma/server/site-mdx-features/type-table.ts +1 -0
- package/src/fuma/server/site-mdx-presets.ts +52 -1
- package/src/fuma/share/markdown-component-map.tsx +5 -4
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var markdownComponentMap = require('../../share/markdown-component-map.js');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var siteMdxFallbacks = require('../site-mdx-fallbacks.js');
|
|
7
|
+
|
|
8
|
+
const ImageZoom = React.lazy(() => Promise.resolve().then(function () { return require('../../heavy/image-zoom.js'); }).then((mod) => ({ default: mod.ImageZoom })));
|
|
9
|
+
function createBaseMdxComponents(imageFallbackSrc) {
|
|
10
|
+
return Object.assign(Object.assign(Object.assign({}, markdownComponentMap.baseMarkdownComponents), siteMdxFallbacks.createMissingMdxFeatureComponents()), { img: (props) => (jsxRuntime.jsx(ImageZoom, Object.assign({}, props, { fallbackSrc: imageFallbackSrc }))) });
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.createBaseMdxComponents = createBaseMdxComponents;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { baseMarkdownComponents } from '../../share/markdown-component-map.mjs';
|
|
3
|
+
import { lazy } from 'react';
|
|
4
|
+
import { createMissingMdxFeatureComponents } from '../site-mdx-fallbacks.mjs';
|
|
5
|
+
|
|
6
|
+
const ImageZoom = lazy(() => import('../../heavy/image-zoom.mjs').then((mod) => ({ default: mod.ImageZoom })));
|
|
7
|
+
function createBaseMdxComponents(imageFallbackSrc) {
|
|
8
|
+
return Object.assign(Object.assign(Object.assign({}, baseMarkdownComponents), createMissingMdxFeatureComponents()), { img: (props) => (jsx(ImageZoom, Object.assign({}, props, { fallbackSrc: imageFallbackSrc }))) });
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { createBaseMdxComponents };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var icons = require('@windrun-huaiin/base-ui/icons');
|
|
6
|
+
|
|
7
|
+
const CodeBlock = React.lazy(() => import('fumadocs-ui/components/codeblock').then((mod) => ({ default: mod.CodeBlock })));
|
|
8
|
+
const Pre = React.lazy(() => import('fumadocs-ui/components/codeblock').then((mod) => ({ default: mod.Pre })));
|
|
9
|
+
const defaultCodeLanguageIconMap = {
|
|
10
|
+
css: jsxRuntime.jsx(icons.CSSIcon, {}),
|
|
11
|
+
csv: jsxRuntime.jsx(icons.CSVIcon, {}),
|
|
12
|
+
diff: jsxRuntime.jsx(icons.DiffIcon, {}),
|
|
13
|
+
html: jsxRuntime.jsx(icons.HtmlIcon, {}),
|
|
14
|
+
http: jsxRuntime.jsx(icons.HttpIcon, {}),
|
|
15
|
+
java: jsxRuntime.jsx(icons.JavaIcon, {}),
|
|
16
|
+
json: jsxRuntime.jsx(icons.JsonIcon, {}),
|
|
17
|
+
jsonc: jsxRuntime.jsx(icons.SquareDashedBottomCodeIcon, {}),
|
|
18
|
+
log: jsxRuntime.jsx(icons.LogIcon, {}),
|
|
19
|
+
mdx: jsxRuntime.jsx(icons.MDXIcon, {}),
|
|
20
|
+
plaintext: jsxRuntime.jsx(icons.TxtIcon, {}),
|
|
21
|
+
regex: jsxRuntime.jsx(icons.RegexIcon, {}),
|
|
22
|
+
scheme: jsxRuntime.jsx(icons.SchemeIcon, {}),
|
|
23
|
+
sql: jsxRuntime.jsx(icons.SQLIcon, {}),
|
|
24
|
+
text: jsxRuntime.jsx(icons.TxtIcon, {}),
|
|
25
|
+
txt: jsxRuntime.jsx(icons.TxtIcon, {}),
|
|
26
|
+
xml: jsxRuntime.jsx(icons.XMLIcon, {}),
|
|
27
|
+
yaml: jsxRuntime.jsx(icons.YamlIcon, {}),
|
|
28
|
+
yml: jsxRuntime.jsx(icons.YamlIcon, {}),
|
|
29
|
+
};
|
|
30
|
+
function tryToMatchIcon(props, iconMap) {
|
|
31
|
+
var _a;
|
|
32
|
+
let lang;
|
|
33
|
+
const dataLanguage = props['data-language'];
|
|
34
|
+
if (dataLanguage && dataLanguage.trim() !== '') {
|
|
35
|
+
lang = dataLanguage.trim().toLowerCase();
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
const title = props.title;
|
|
39
|
+
if (title) {
|
|
40
|
+
const titleParts = title.split('.');
|
|
41
|
+
if (titleParts.length > 1 && titleParts[0] !== '') {
|
|
42
|
+
const extension = (_a = titleParts.pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
43
|
+
if (extension) {
|
|
44
|
+
lang = extension;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (lang && iconMap[lang]) {
|
|
50
|
+
return iconMap[lang];
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
function createCodeMdxComponents(iconMap = {}) {
|
|
55
|
+
const mergedIconMap = Object.assign(Object.assign({}, defaultCodeLanguageIconMap), iconMap);
|
|
56
|
+
return {
|
|
57
|
+
pre: (props) => {
|
|
58
|
+
const customIcon = tryToMatchIcon(props, mergedIconMap);
|
|
59
|
+
return (jsxRuntime.jsx(CodeBlock, Object.assign({}, props, (customIcon && { icon: customIcon }), { children: jsxRuntime.jsx(Pre, { children: props.children }) })));
|
|
60
|
+
},
|
|
61
|
+
CodeBlock,
|
|
62
|
+
Pre,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
exports.createCodeMdxComponents = createCodeMdxComponents;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { lazy } from 'react';
|
|
3
|
+
import { YamlIcon, XMLIcon, TxtIcon, SQLIcon, SchemeIcon, RegexIcon, MDXIcon, LogIcon, SquareDashedBottomCodeIcon, JsonIcon, JavaIcon, HttpIcon, HtmlIcon, DiffIcon, CSVIcon, CSSIcon } from '@windrun-huaiin/base-ui/icons';
|
|
4
|
+
|
|
5
|
+
const CodeBlock = lazy(() => import('fumadocs-ui/components/codeblock').then((mod) => ({ default: mod.CodeBlock })));
|
|
6
|
+
const Pre = lazy(() => import('fumadocs-ui/components/codeblock').then((mod) => ({ default: mod.Pre })));
|
|
7
|
+
const defaultCodeLanguageIconMap = {
|
|
8
|
+
css: jsx(CSSIcon, {}),
|
|
9
|
+
csv: jsx(CSVIcon, {}),
|
|
10
|
+
diff: jsx(DiffIcon, {}),
|
|
11
|
+
html: jsx(HtmlIcon, {}),
|
|
12
|
+
http: jsx(HttpIcon, {}),
|
|
13
|
+
java: jsx(JavaIcon, {}),
|
|
14
|
+
json: jsx(JsonIcon, {}),
|
|
15
|
+
jsonc: jsx(SquareDashedBottomCodeIcon, {}),
|
|
16
|
+
log: jsx(LogIcon, {}),
|
|
17
|
+
mdx: jsx(MDXIcon, {}),
|
|
18
|
+
plaintext: jsx(TxtIcon, {}),
|
|
19
|
+
regex: jsx(RegexIcon, {}),
|
|
20
|
+
scheme: jsx(SchemeIcon, {}),
|
|
21
|
+
sql: jsx(SQLIcon, {}),
|
|
22
|
+
text: jsx(TxtIcon, {}),
|
|
23
|
+
txt: jsx(TxtIcon, {}),
|
|
24
|
+
xml: jsx(XMLIcon, {}),
|
|
25
|
+
yaml: jsx(YamlIcon, {}),
|
|
26
|
+
yml: jsx(YamlIcon, {}),
|
|
27
|
+
};
|
|
28
|
+
function tryToMatchIcon(props, iconMap) {
|
|
29
|
+
var _a;
|
|
30
|
+
let lang;
|
|
31
|
+
const dataLanguage = props['data-language'];
|
|
32
|
+
if (dataLanguage && dataLanguage.trim() !== '') {
|
|
33
|
+
lang = dataLanguage.trim().toLowerCase();
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
const title = props.title;
|
|
37
|
+
if (title) {
|
|
38
|
+
const titleParts = title.split('.');
|
|
39
|
+
if (titleParts.length > 1 && titleParts[0] !== '') {
|
|
40
|
+
const extension = (_a = titleParts.pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
41
|
+
if (extension) {
|
|
42
|
+
lang = extension;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (lang && iconMap[lang]) {
|
|
48
|
+
return iconMap[lang];
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
function createCodeMdxComponents(iconMap = {}) {
|
|
53
|
+
const mergedIconMap = Object.assign(Object.assign({}, defaultCodeLanguageIconMap), iconMap);
|
|
54
|
+
return {
|
|
55
|
+
pre: (props) => {
|
|
56
|
+
const customIcon = tryToMatchIcon(props, mergedIconMap);
|
|
57
|
+
return (jsx(CodeBlock, Object.assign({}, props, (customIcon && { icon: customIcon }), { children: jsx(Pre, { children: props.children }) })));
|
|
58
|
+
},
|
|
59
|
+
CodeBlock,
|
|
60
|
+
Pre,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { createCodeMdxComponents };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
const MathBlock = React.lazy(() => Promise.resolve().then(function () { return require('../../heavy/math.js'); }).then((mod) => ({ default: mod.MathBlock })));
|
|
6
|
+
const InlineMath = React.lazy(() => Promise.resolve().then(function () { return require('../../heavy/math.js'); }).then((mod) => ({ default: mod.InlineMath })));
|
|
7
|
+
function createMathMdxComponents() {
|
|
8
|
+
return {
|
|
9
|
+
MathBlock,
|
|
10
|
+
InlineMath,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.createMathMdxComponents = createMathMdxComponents;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { lazy } from 'react';
|
|
2
|
+
|
|
3
|
+
const MathBlock = lazy(() => import('../../heavy/math.mjs').then((mod) => ({ default: mod.MathBlock })));
|
|
4
|
+
const InlineMath = lazy(() => import('../../heavy/math.mjs').then((mod) => ({ default: mod.InlineMath })));
|
|
5
|
+
function createMathMdxComponents() {
|
|
6
|
+
return {
|
|
7
|
+
MathBlock,
|
|
8
|
+
InlineMath,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { createMathMdxComponents };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
const Mermaid = React.lazy(() => Promise.resolve().then(function () { return require('../../heavy/mermaid.js'); }).then((mod) => ({ default: mod.Mermaid })));
|
|
7
|
+
function createMermaidMdxComponents(watermarkEnabled, watermarkText) {
|
|
8
|
+
return {
|
|
9
|
+
Mermaid: (props) => (jsxRuntime.jsx(Mermaid, Object.assign({}, props, { watermarkEnabled: watermarkEnabled, watermarkText: watermarkText }))),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.createMermaidMdxComponents = createMermaidMdxComponents;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { lazy } from 'react';
|
|
3
|
+
|
|
4
|
+
const Mermaid = lazy(() => import('../../heavy/mermaid.mjs').then((mod) => ({ default: mod.Mermaid })));
|
|
5
|
+
function createMermaidMdxComponents(watermarkEnabled, watermarkText) {
|
|
6
|
+
return {
|
|
7
|
+
Mermaid: (props) => (jsx(Mermaid, Object.assign({}, props, { watermarkEnabled: watermarkEnabled, watermarkText: watermarkText }))),
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { createMermaidMdxComponents };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
const TypeTable = React.lazy(() => import('fumadocs-ui/components/type-table').then((mod) => ({ default: mod.TypeTable })));
|
|
6
|
+
function createTypeTableMdxComponents() {
|
|
7
|
+
return {
|
|
8
|
+
TypeTable,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
exports.createTypeTableMdxComponents = createTypeTableMdxComponents;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { lazy } from 'react';
|
|
2
|
+
|
|
3
|
+
const TypeTable = lazy(() => import('fumadocs-ui/components/type-table').then((mod) => ({ default: mod.TypeTable })));
|
|
4
|
+
function createTypeTableMdxComponents() {
|
|
5
|
+
return {
|
|
6
|
+
TypeTable,
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { createTypeTableMdxComponents };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var trophyCard = require('../../mdx/trophy-card.js');
|
|
6
|
+
var ziaCard = require('../../mdx/zia-card.js');
|
|
7
|
+
var gradientButton = require('../../mdx/gradient-button.js');
|
|
8
|
+
var ziaFile = require('../../mdx/zia-file.js');
|
|
9
|
+
var sunoEmbed = require('../../mdx/suno-embed.js');
|
|
10
|
+
|
|
11
|
+
const ImageGrid = React.lazy(() => Promise.resolve().then(function () { return require('../../heavy/image-grid.js'); }).then((mod) => ({ default: mod.ImageGrid })));
|
|
12
|
+
const ImageZoom = React.lazy(() => Promise.resolve().then(function () { return require('../../heavy/image-zoom.js'); }).then((mod) => ({ default: mod.ImageZoom })));
|
|
13
|
+
function createWidgetMdxComponents(cdnBaseUrl, imageFallbackSrc) {
|
|
14
|
+
return {
|
|
15
|
+
TrophyCard: trophyCard.TrophyCard,
|
|
16
|
+
ZiaCard: ziaCard.ZiaCard,
|
|
17
|
+
GradientButton: gradientButton.GradientButton,
|
|
18
|
+
ZiaFile: ziaFile.ZiaFile,
|
|
19
|
+
ZiaFolder: ziaFile.ZiaFolder,
|
|
20
|
+
SunoEmbed: sunoEmbed.SunoEmbed,
|
|
21
|
+
ImageGrid: (props) => (jsxRuntime.jsx(ImageGrid, Object.assign({}, props, { cdnBaseUrl: cdnBaseUrl }))),
|
|
22
|
+
ImageZoom: (props) => (jsxRuntime.jsx(ImageZoom, Object.assign({}, props, { fallbackSrc: imageFallbackSrc }))),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.createWidgetMdxComponents = createWidgetMdxComponents;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { lazy } from 'react';
|
|
3
|
+
import { TrophyCard } from '../../mdx/trophy-card.mjs';
|
|
4
|
+
import { ZiaCard } from '../../mdx/zia-card.mjs';
|
|
5
|
+
import { GradientButton } from '../../mdx/gradient-button.mjs';
|
|
6
|
+
import { ZiaFolder, ZiaFile } from '../../mdx/zia-file.mjs';
|
|
7
|
+
import { SunoEmbed } from '../../mdx/suno-embed.mjs';
|
|
8
|
+
|
|
9
|
+
const ImageGrid = lazy(() => import('../../heavy/image-grid.mjs').then((mod) => ({ default: mod.ImageGrid })));
|
|
10
|
+
const ImageZoom = lazy(() => import('../../heavy/image-zoom.mjs').then((mod) => ({ default: mod.ImageZoom })));
|
|
11
|
+
function createWidgetMdxComponents(cdnBaseUrl, imageFallbackSrc) {
|
|
12
|
+
return {
|
|
13
|
+
TrophyCard,
|
|
14
|
+
ZiaCard,
|
|
15
|
+
GradientButton,
|
|
16
|
+
ZiaFile,
|
|
17
|
+
ZiaFolder,
|
|
18
|
+
SunoEmbed,
|
|
19
|
+
ImageGrid: (props) => (jsx(ImageGrid, Object.assign({}, props, { cdnBaseUrl: cdnBaseUrl }))),
|
|
20
|
+
ImageZoom: (props) => (jsx(ImageZoom, Object.assign({}, props, { fallbackSrc: imageFallbackSrc }))),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { createWidgetMdxComponents };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export declare function createTypeTableMdxComponents(): MDXComponents;
|
|
8
|
-
export declare function createWidgetMdxComponents(cdnBaseUrl?: string, imageFallbackSrc?: string): MDXComponents;
|
|
1
|
+
export { createBaseMdxComponents } from './features/base';
|
|
2
|
+
export { createCodeMdxComponents } from './features/code';
|
|
3
|
+
export { createMathMdxComponents } from './features/math';
|
|
4
|
+
export { createMermaidMdxComponents } from './features/mermaid';
|
|
5
|
+
export { createTypeTableMdxComponents } from './features/type-table';
|
|
6
|
+
export { createWidgetMdxComponents } from './features/widgets';
|
|
@@ -1,111 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var imageGrid = require('../heavy/image-grid.js');
|
|
10
|
-
var math = require('../heavy/math.js');
|
|
11
|
-
var mermaid = require('../heavy/mermaid.js');
|
|
12
|
-
var trophyCard = require('../mdx/trophy-card.js');
|
|
13
|
-
var ziaCard = require('../mdx/zia-card.js');
|
|
14
|
-
var gradientButton = require('../mdx/gradient-button.js');
|
|
15
|
-
var ziaFile = require('../mdx/zia-file.js');
|
|
16
|
-
var sunoEmbed = require('../mdx/suno-embed.js');
|
|
3
|
+
var base = require('./features/base.js');
|
|
4
|
+
var code = require('./features/code.js');
|
|
5
|
+
var math = require('./features/math.js');
|
|
6
|
+
var mermaid = require('./features/mermaid.js');
|
|
7
|
+
var typeTable = require('./features/type-table.js');
|
|
8
|
+
var widgets = require('./features/widgets.js');
|
|
17
9
|
|
|
18
|
-
const defaultCodeLanguageIconMap = {
|
|
19
|
-
css: jsxRuntime.jsx(icons.CSSIcon, {}),
|
|
20
|
-
csv: jsxRuntime.jsx(icons.CSVIcon, {}),
|
|
21
|
-
diff: jsxRuntime.jsx(icons.DiffIcon, {}),
|
|
22
|
-
html: jsxRuntime.jsx(icons.HtmlIcon, {}),
|
|
23
|
-
http: jsxRuntime.jsx(icons.HttpIcon, {}),
|
|
24
|
-
java: jsxRuntime.jsx(icons.JavaIcon, {}),
|
|
25
|
-
json: jsxRuntime.jsx(icons.JsonIcon, {}),
|
|
26
|
-
jsonc: jsxRuntime.jsx(icons.SquareDashedBottomCodeIcon, {}),
|
|
27
|
-
log: jsxRuntime.jsx(icons.LogIcon, {}),
|
|
28
|
-
mdx: jsxRuntime.jsx(icons.MDXIcon, {}),
|
|
29
|
-
plaintext: jsxRuntime.jsx(icons.TxtIcon, {}),
|
|
30
|
-
regex: jsxRuntime.jsx(icons.RegexIcon, {}),
|
|
31
|
-
scheme: jsxRuntime.jsx(icons.SchemeIcon, {}),
|
|
32
|
-
sql: jsxRuntime.jsx(icons.SQLIcon, {}),
|
|
33
|
-
text: jsxRuntime.jsx(icons.TxtIcon, {}),
|
|
34
|
-
txt: jsxRuntime.jsx(icons.TxtIcon, {}),
|
|
35
|
-
xml: jsxRuntime.jsx(icons.XMLIcon, {}),
|
|
36
|
-
yaml: jsxRuntime.jsx(icons.YamlIcon, {}),
|
|
37
|
-
yml: jsxRuntime.jsx(icons.YamlIcon, {}),
|
|
38
|
-
};
|
|
39
|
-
function tryToMatchIcon(props, iconMap) {
|
|
40
|
-
var _a;
|
|
41
|
-
let lang;
|
|
42
|
-
const dataLanguage = props['data-language'];
|
|
43
|
-
if (dataLanguage && dataLanguage.trim() !== '') {
|
|
44
|
-
lang = dataLanguage.trim().toLowerCase();
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
const title = props.title;
|
|
48
|
-
if (title) {
|
|
49
|
-
const titleParts = title.split('.');
|
|
50
|
-
if (titleParts.length > 1 && titleParts[0] !== '') {
|
|
51
|
-
const extension = (_a = titleParts.pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
52
|
-
if (extension) {
|
|
53
|
-
lang = extension;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (lang && iconMap[lang]) {
|
|
59
|
-
return iconMap[lang];
|
|
60
|
-
}
|
|
61
|
-
return undefined;
|
|
62
|
-
}
|
|
63
|
-
function createBaseMdxComponents(imageFallbackSrc) {
|
|
64
|
-
return Object.assign(Object.assign({}, markdownComponentMap.baseMarkdownComponents), { img: (props) => (jsxRuntime.jsx(imageZoom.ImageZoom, Object.assign({}, props, { fallbackSrc: imageFallbackSrc }))) });
|
|
65
|
-
}
|
|
66
|
-
function createCodeMdxComponents(iconMap = {}) {
|
|
67
|
-
const mergedIconMap = Object.assign(Object.assign({}, defaultCodeLanguageIconMap), iconMap);
|
|
68
|
-
return {
|
|
69
|
-
pre: (props) => {
|
|
70
|
-
const customIcon = tryToMatchIcon(props, mergedIconMap);
|
|
71
|
-
return (jsxRuntime.jsx(codeblock.CodeBlock, Object.assign({}, props, (customIcon && { icon: customIcon }), { children: jsxRuntime.jsx(codeblock.Pre, { children: props.children }) })));
|
|
72
|
-
},
|
|
73
|
-
CodeBlock: codeblock.CodeBlock,
|
|
74
|
-
Pre: codeblock.Pre,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
function createMathMdxComponents() {
|
|
78
|
-
return {
|
|
79
|
-
MathBlock: math.MathBlock,
|
|
80
|
-
InlineMath: math.InlineMath,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function createMermaidMdxComponents(watermarkEnabled, watermarkText) {
|
|
84
|
-
return {
|
|
85
|
-
Mermaid: (props) => (jsxRuntime.jsx(mermaid.Mermaid, Object.assign({}, props, { watermarkEnabled: watermarkEnabled, watermarkText: watermarkText }))),
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
function createTypeTableMdxComponents() {
|
|
89
|
-
return {
|
|
90
|
-
TypeTable: typeTable.TypeTable,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
function createWidgetMdxComponents(cdnBaseUrl, imageFallbackSrc) {
|
|
94
|
-
return {
|
|
95
|
-
TrophyCard: trophyCard.TrophyCard,
|
|
96
|
-
ZiaCard: ziaCard.ZiaCard,
|
|
97
|
-
GradientButton: gradientButton.GradientButton,
|
|
98
|
-
ZiaFile: ziaFile.ZiaFile,
|
|
99
|
-
ZiaFolder: ziaFile.ZiaFolder,
|
|
100
|
-
SunoEmbed: sunoEmbed.SunoEmbed,
|
|
101
|
-
ImageGrid: (props) => (jsxRuntime.jsx(imageGrid.ImageGrid, Object.assign({}, props, { cdnBaseUrl: cdnBaseUrl }))),
|
|
102
|
-
ImageZoom: (props) => (jsxRuntime.jsx(imageZoom.ImageZoom, Object.assign({}, props, { fallbackSrc: imageFallbackSrc }))),
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
10
|
|
|
106
|
-
|
|
107
|
-
exports.
|
|
108
|
-
exports.
|
|
109
|
-
exports.
|
|
110
|
-
exports.
|
|
111
|
-
exports.
|
|
11
|
+
|
|
12
|
+
exports.createBaseMdxComponents = base.createBaseMdxComponents;
|
|
13
|
+
exports.createCodeMdxComponents = code.createCodeMdxComponents;
|
|
14
|
+
exports.createMathMdxComponents = math.createMathMdxComponents;
|
|
15
|
+
exports.createMermaidMdxComponents = mermaid.createMermaidMdxComponents;
|
|
16
|
+
exports.createTypeTableMdxComponents = typeTable.createTypeTableMdxComponents;
|
|
17
|
+
exports.createWidgetMdxComponents = widgets.createWidgetMdxComponents;
|
|
@@ -1,104 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { ImageGrid } from '../heavy/image-grid.mjs';
|
|
8
|
-
import { InlineMath, MathBlock } from '../heavy/math.mjs';
|
|
9
|
-
import { Mermaid } from '../heavy/mermaid.mjs';
|
|
10
|
-
import { TrophyCard } from '../mdx/trophy-card.mjs';
|
|
11
|
-
import { ZiaCard } from '../mdx/zia-card.mjs';
|
|
12
|
-
import { GradientButton } from '../mdx/gradient-button.mjs';
|
|
13
|
-
import { ZiaFolder, ZiaFile } from '../mdx/zia-file.mjs';
|
|
14
|
-
import { SunoEmbed } from '../mdx/suno-embed.mjs';
|
|
15
|
-
|
|
16
|
-
const defaultCodeLanguageIconMap = {
|
|
17
|
-
css: jsx(CSSIcon, {}),
|
|
18
|
-
csv: jsx(CSVIcon, {}),
|
|
19
|
-
diff: jsx(DiffIcon, {}),
|
|
20
|
-
html: jsx(HtmlIcon, {}),
|
|
21
|
-
http: jsx(HttpIcon, {}),
|
|
22
|
-
java: jsx(JavaIcon, {}),
|
|
23
|
-
json: jsx(JsonIcon, {}),
|
|
24
|
-
jsonc: jsx(SquareDashedBottomCodeIcon, {}),
|
|
25
|
-
log: jsx(LogIcon, {}),
|
|
26
|
-
mdx: jsx(MDXIcon, {}),
|
|
27
|
-
plaintext: jsx(TxtIcon, {}),
|
|
28
|
-
regex: jsx(RegexIcon, {}),
|
|
29
|
-
scheme: jsx(SchemeIcon, {}),
|
|
30
|
-
sql: jsx(SQLIcon, {}),
|
|
31
|
-
text: jsx(TxtIcon, {}),
|
|
32
|
-
txt: jsx(TxtIcon, {}),
|
|
33
|
-
xml: jsx(XMLIcon, {}),
|
|
34
|
-
yaml: jsx(YamlIcon, {}),
|
|
35
|
-
yml: jsx(YamlIcon, {}),
|
|
36
|
-
};
|
|
37
|
-
function tryToMatchIcon(props, iconMap) {
|
|
38
|
-
var _a;
|
|
39
|
-
let lang;
|
|
40
|
-
const dataLanguage = props['data-language'];
|
|
41
|
-
if (dataLanguage && dataLanguage.trim() !== '') {
|
|
42
|
-
lang = dataLanguage.trim().toLowerCase();
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
const title = props.title;
|
|
46
|
-
if (title) {
|
|
47
|
-
const titleParts = title.split('.');
|
|
48
|
-
if (titleParts.length > 1 && titleParts[0] !== '') {
|
|
49
|
-
const extension = (_a = titleParts.pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
50
|
-
if (extension) {
|
|
51
|
-
lang = extension;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (lang && iconMap[lang]) {
|
|
57
|
-
return iconMap[lang];
|
|
58
|
-
}
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
function createBaseMdxComponents(imageFallbackSrc) {
|
|
62
|
-
return Object.assign(Object.assign({}, baseMarkdownComponents), { img: (props) => (jsx(ImageZoom, Object.assign({}, props, { fallbackSrc: imageFallbackSrc }))) });
|
|
63
|
-
}
|
|
64
|
-
function createCodeMdxComponents(iconMap = {}) {
|
|
65
|
-
const mergedIconMap = Object.assign(Object.assign({}, defaultCodeLanguageIconMap), iconMap);
|
|
66
|
-
return {
|
|
67
|
-
pre: (props) => {
|
|
68
|
-
const customIcon = tryToMatchIcon(props, mergedIconMap);
|
|
69
|
-
return (jsx(CodeBlock, Object.assign({}, props, (customIcon && { icon: customIcon }), { children: jsx(Pre, { children: props.children }) })));
|
|
70
|
-
},
|
|
71
|
-
CodeBlock,
|
|
72
|
-
Pre,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
function createMathMdxComponents() {
|
|
76
|
-
return {
|
|
77
|
-
MathBlock,
|
|
78
|
-
InlineMath,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
function createMermaidMdxComponents(watermarkEnabled, watermarkText) {
|
|
82
|
-
return {
|
|
83
|
-
Mermaid: (props) => (jsx(Mermaid, Object.assign({}, props, { watermarkEnabled: watermarkEnabled, watermarkText: watermarkText }))),
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
function createTypeTableMdxComponents() {
|
|
87
|
-
return {
|
|
88
|
-
TypeTable,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
function createWidgetMdxComponents(cdnBaseUrl, imageFallbackSrc) {
|
|
92
|
-
return {
|
|
93
|
-
TrophyCard,
|
|
94
|
-
ZiaCard,
|
|
95
|
-
GradientButton,
|
|
96
|
-
ZiaFile,
|
|
97
|
-
ZiaFolder,
|
|
98
|
-
SunoEmbed,
|
|
99
|
-
ImageGrid: (props) => (jsx(ImageGrid, Object.assign({}, props, { cdnBaseUrl: cdnBaseUrl }))),
|
|
100
|
-
ImageZoom: (props) => (jsx(ImageZoom, Object.assign({}, props, { fallbackSrc: imageFallbackSrc }))),
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export { createBaseMdxComponents, createCodeMdxComponents, createMathMdxComponents, createMermaidMdxComponents, createTypeTableMdxComponents, createWidgetMdxComponents };
|
|
1
|
+
export { createBaseMdxComponents } from './features/base.mjs';
|
|
2
|
+
export { createCodeMdxComponents } from './features/code.mjs';
|
|
3
|
+
export { createMathMdxComponents } from './features/math.mjs';
|
|
4
|
+
export { createMermaidMdxComponents } from './features/mermaid.mjs';
|
|
5
|
+
export { createTypeTableMdxComponents } from './features/type-table.mjs';
|
|
6
|
+
export { createWidgetMdxComponents } from './features/widgets.mjs';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MDXComponents } from 'mdx/types';
|
|
2
|
+
export type SiteMdxFeatureComponents = MDXComponents;
|
|
3
|
+
export interface SiteMdxBaseOptions {
|
|
4
|
+
imageFallbackSrc?: string;
|
|
5
|
+
cdnBaseUrl?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CreateSiteMdxComponentsOptions {
|
|
8
|
+
baseOptions?: SiteMdxBaseOptions;
|
|
9
|
+
features?: SiteMdxFeatureComponents[];
|
|
10
|
+
additionalComponents?: MDXComponents;
|
|
11
|
+
}
|
|
12
|
+
export declare function createSiteMdxBaseComponents(options?: SiteMdxBaseOptions): MDXComponents;
|
|
13
|
+
export declare function createSiteMdxComponents(options?: CreateSiteMdxComponentsOptions): (components?: MDXComponents) => MDXComponents;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tabs = require('fumadocs-ui/components/tabs');
|
|
4
|
+
var callout = require('fumadocs-ui/components/callout');
|
|
5
|
+
var files = require('fumadocs-ui/components/files');
|
|
6
|
+
var accordion = require('fumadocs-ui/components/accordion');
|
|
7
|
+
var siteX = require('../site-x.js');
|
|
8
|
+
var base = require('./features/base.js');
|
|
9
|
+
var widgets = require('./features/widgets.js');
|
|
10
|
+
|
|
11
|
+
const defaultFumaUiComponents = {
|
|
12
|
+
Callout: callout.Callout,
|
|
13
|
+
File: files.File,
|
|
14
|
+
Folder: files.Folder,
|
|
15
|
+
Files: files.Files,
|
|
16
|
+
Accordion: accordion.Accordion,
|
|
17
|
+
Accordions: accordion.Accordions,
|
|
18
|
+
Tab: tabs.Tab,
|
|
19
|
+
Tabs: tabs.Tabs,
|
|
20
|
+
};
|
|
21
|
+
function createSiteMdxBaseComponents(options = {}) {
|
|
22
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, defaultFumaUiComponents), { SiteX: siteX.SiteX }), base.createBaseMdxComponents(options.imageFallbackSrc)), widgets.createWidgetMdxComponents(options.cdnBaseUrl, options.imageFallbackSrc));
|
|
23
|
+
}
|
|
24
|
+
function createSiteMdxComponents(options = {}) {
|
|
25
|
+
const { additionalComponents, baseOptions, features = [], } = options;
|
|
26
|
+
return function getMDXComponents(components) {
|
|
27
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, createSiteMdxBaseComponents(baseOptions)), features.reduce((acc, feature) => (Object.assign(Object.assign({}, acc), feature)), {})), additionalComponents), components);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
exports.createSiteMdxBaseComponents = createSiteMdxBaseComponents;
|
|
32
|
+
exports.createSiteMdxComponents = createSiteMdxComponents;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Tabs, Tab } from 'fumadocs-ui/components/tabs';
|
|
2
|
+
import { Callout } from 'fumadocs-ui/components/callout';
|
|
3
|
+
import { Files, Folder, File } from 'fumadocs-ui/components/files';
|
|
4
|
+
import { Accordions, Accordion } from 'fumadocs-ui/components/accordion';
|
|
5
|
+
import { SiteX } from '../site-x.mjs';
|
|
6
|
+
import { createBaseMdxComponents } from './features/base.mjs';
|
|
7
|
+
import { createWidgetMdxComponents } from './features/widgets.mjs';
|
|
8
|
+
|
|
9
|
+
const defaultFumaUiComponents = {
|
|
10
|
+
Callout,
|
|
11
|
+
File,
|
|
12
|
+
Folder,
|
|
13
|
+
Files,
|
|
14
|
+
Accordion,
|
|
15
|
+
Accordions,
|
|
16
|
+
Tab,
|
|
17
|
+
Tabs,
|
|
18
|
+
};
|
|
19
|
+
function createSiteMdxBaseComponents(options = {}) {
|
|
20
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, defaultFumaUiComponents), { SiteX }), createBaseMdxComponents(options.imageFallbackSrc)), createWidgetMdxComponents(options.cdnBaseUrl, options.imageFallbackSrc));
|
|
21
|
+
}
|
|
22
|
+
function createSiteMdxComponents(options = {}) {
|
|
23
|
+
const { additionalComponents, baseOptions, features = [], } = options;
|
|
24
|
+
return function getMDXComponents(components) {
|
|
25
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, createSiteMdxBaseComponents(baseOptions)), features.reduce((acc, feature) => (Object.assign(Object.assign({}, acc), feature)), {})), additionalComponents), components);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { createSiteMdxBaseComponents, createSiteMdxComponents };
|