@windrun-huaiin/third-ui 22.0.0 → 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.
Files changed (67) hide show
  1. package/README.md +6 -6
  2. package/dist/fuma/server/features/base.d.ts +2 -0
  3. package/dist/fuma/server/features/base.js +13 -0
  4. package/dist/fuma/server/features/base.mjs +11 -0
  5. package/dist/fuma/server/features/code.d.ts +3 -0
  6. package/dist/fuma/server/features/code.js +66 -0
  7. package/dist/fuma/server/features/code.mjs +64 -0
  8. package/dist/fuma/server/features/math.d.ts +2 -0
  9. package/dist/fuma/server/features/math.js +14 -0
  10. package/dist/fuma/server/features/math.mjs +12 -0
  11. package/dist/fuma/server/features/mermaid.d.ts +2 -0
  12. package/dist/fuma/server/features/mermaid.js +13 -0
  13. package/dist/fuma/server/features/mermaid.mjs +11 -0
  14. package/dist/fuma/server/features/type-table.d.ts +2 -0
  15. package/dist/fuma/server/features/type-table.js +12 -0
  16. package/dist/fuma/server/features/type-table.mjs +10 -0
  17. package/dist/fuma/server/features/widgets.d.ts +2 -0
  18. package/dist/fuma/server/features/widgets.js +26 -0
  19. package/dist/fuma/server/features/widgets.mjs +24 -0
  20. package/dist/fuma/server/optional-features.d.ts +6 -8
  21. package/dist/fuma/server/optional-features.js +13 -107
  22. package/dist/fuma/server/optional-features.mjs +6 -104
  23. package/dist/fuma/server/site-mdx-base.d.ts +13 -0
  24. package/dist/fuma/server/site-mdx-base.js +32 -0
  25. package/dist/fuma/server/site-mdx-base.mjs +29 -0
  26. package/dist/fuma/server/site-mdx-components.d.ts +1 -1
  27. package/dist/fuma/server/site-mdx-components.js +7 -8
  28. package/dist/fuma/server/site-mdx-components.mjs +8 -9
  29. package/dist/fuma/server/site-mdx-fallbacks.d.ts +18 -0
  30. package/dist/fuma/server/site-mdx-fallbacks.js +49 -0
  31. package/dist/fuma/server/site-mdx-fallbacks.mjs +45 -0
  32. package/dist/fuma/server/site-mdx-features/code.d.ts +1 -0
  33. package/dist/fuma/server/site-mdx-features/code.js +7 -0
  34. package/dist/fuma/server/site-mdx-features/code.mjs +1 -0
  35. package/dist/fuma/server/site-mdx-features/math.d.ts +1 -0
  36. package/dist/fuma/server/site-mdx-features/math.js +7 -0
  37. package/dist/fuma/server/site-mdx-features/math.mjs +1 -0
  38. package/dist/fuma/server/site-mdx-features/mermaid.d.ts +1 -0
  39. package/dist/fuma/server/site-mdx-features/mermaid.js +7 -0
  40. package/dist/fuma/server/site-mdx-features/mermaid.mjs +1 -0
  41. package/dist/fuma/server/site-mdx-features/type-table.d.ts +1 -0
  42. package/dist/fuma/server/site-mdx-features/type-table.js +7 -0
  43. package/dist/fuma/server/site-mdx-features/type-table.mjs +1 -0
  44. package/dist/fuma/server/site-mdx-presets.d.ts +2 -1
  45. package/dist/fuma/server/site-mdx-presets.js +22 -13
  46. package/dist/fuma/server/site-mdx-presets.mjs +22 -12
  47. package/dist/fuma/share/markdown-component-map.js +43 -29
  48. package/dist/fuma/share/markdown-component-map.mjs +42 -28
  49. package/dist/lib/seo-metadata.js +34 -0
  50. package/dist/lib/seo-metadata.mjs +32 -0
  51. package/package.json +29 -7
  52. package/src/fuma/server/features/base.tsx +23 -0
  53. package/src/fuma/server/features/code.tsx +104 -0
  54. package/src/fuma/server/features/math.ts +16 -0
  55. package/src/fuma/server/features/mermaid.tsx +21 -0
  56. package/src/fuma/server/features/type-table.ts +12 -0
  57. package/src/fuma/server/features/widgets.tsx +34 -0
  58. package/src/fuma/server/optional-features.tsx +6 -168
  59. package/src/fuma/server/site-mdx-base.tsx +62 -0
  60. package/src/fuma/server/site-mdx-components.tsx +10 -12
  61. package/src/fuma/server/site-mdx-fallbacks.tsx +122 -0
  62. package/src/fuma/server/site-mdx-features/code.ts +1 -0
  63. package/src/fuma/server/site-mdx-features/math.ts +1 -0
  64. package/src/fuma/server/site-mdx-features/mermaid.ts +1 -0
  65. package/src/fuma/server/site-mdx-features/type-table.ts +1 -0
  66. package/src/fuma/server/site-mdx-presets.ts +52 -1
  67. package/src/fuma/share/markdown-component-map.tsx +5 -4
package/README.md CHANGED
@@ -42,10 +42,7 @@ Your-project/
42
42
 
43
43
  ## Usage Example
44
44
 
45
- ### Import all components
46
- ```tsx
47
- import { ClerkUser, CTA, TOC } from '@windrun-huaiin/third-ui';
48
- ```
45
+ Root entry import is not supported. Always import from an explicit subpath such as `@windrun-huaiin/third-ui/clerk` or `@windrun-huaiin/third-ui/main`.
49
46
 
50
47
  ### Import components by module
51
48
  ```tsx
@@ -56,7 +53,10 @@ import { ClerkUser, ClerkOrganization } from '@windrun-huaiin/third-ui/clerk';
56
53
  import { CTA, Features } from '@windrun-huaiin/third-ui/main';
57
54
 
58
55
  // Only import Fumadocs components
59
- import { TOC, FumaBannerSuit } from '@windrun-huaiin/third-ui/fuma';
56
+ import { FumaPageGenerator, FumaBannerSuit } from '@windrun-huaiin/third-ui/fuma/server';
57
+
58
+ // Shared MDX building blocks
59
+ import { TocFooterWrapper, PortableClerkTOC } from '@windrun-huaiin/third-ui/fuma/mdx';
60
60
  ```
61
61
 
62
62
  ### Use components
@@ -219,4 +219,4 @@ All configuration parameters will be automatically obtained from the global conf
219
219
  - [Newspaper Template](https://newspaper-template.org/en)
220
220
  - [breathing exercise](https://breathingexercise.net/en)
221
221
  - [ai directory list](https://aidirectorylist.com/en)
222
- - [reve image directory](https://reveimage.directory/en)
222
+ - [reve image directory](https://reveimage.directory/en)
@@ -0,0 +1,2 @@
1
+ import type { MDXComponents } from 'mdx/types';
2
+ export declare function createBaseMdxComponents(imageFallbackSrc?: string): MDXComponents;
@@ -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,3 @@
1
+ import type { MDXComponents } from 'mdx/types';
2
+ import { type ReactNode } from 'react';
3
+ export declare function createCodeMdxComponents(iconMap?: Record<string, ReactNode>): MDXComponents;
@@ -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,2 @@
1
+ import type { MDXComponents } from 'mdx/types';
2
+ export declare function createMathMdxComponents(): MDXComponents;
@@ -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,2 @@
1
+ import type { MDXComponents } from 'mdx/types';
2
+ export declare function createMermaidMdxComponents(watermarkEnabled?: boolean, watermarkText?: string): MDXComponents;
@@ -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,2 @@
1
+ import type { MDXComponents } from 'mdx/types';
2
+ export declare function createTypeTableMdxComponents(): MDXComponents;
@@ -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,2 @@
1
+ import type { MDXComponents } from 'mdx/types';
2
+ export declare function createWidgetMdxComponents(cdnBaseUrl?: string, imageFallbackSrc?: string): MDXComponents;
@@ -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
- import type { MDXComponents } from 'mdx/types';
2
- import type { ReactNode } from 'react';
3
- export declare function createBaseMdxComponents(imageFallbackSrc?: string): MDXComponents;
4
- export declare function createCodeMdxComponents(iconMap?: Record<string, ReactNode>): MDXComponents;
5
- export declare function createMathMdxComponents(): MDXComponents;
6
- export declare function createMermaidMdxComponents(watermarkEnabled?: boolean, watermarkText?: string): MDXComponents;
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 jsxRuntime = require('react/jsx-runtime');
4
- var codeblock = require('fumadocs-ui/components/codeblock');
5
- var typeTable = require('fumadocs-ui/components/type-table');
6
- var icons = require('@windrun-huaiin/base-ui/icons');
7
- var markdownComponentMap = require('../share/markdown-component-map.js');
8
- var imageZoom = require('../heavy/image-zoom.js');
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
- exports.createBaseMdxComponents = createBaseMdxComponents;
107
- exports.createCodeMdxComponents = createCodeMdxComponents;
108
- exports.createMathMdxComponents = createMathMdxComponents;
109
- exports.createMermaidMdxComponents = createMermaidMdxComponents;
110
- exports.createTypeTableMdxComponents = createTypeTableMdxComponents;
111
- exports.createWidgetMdxComponents = createWidgetMdxComponents;
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
- import { jsx } from 'react/jsx-runtime';
2
- import { Pre, CodeBlock } from 'fumadocs-ui/components/codeblock';
3
- import { TypeTable } from 'fumadocs-ui/components/type-table';
4
- import { YamlIcon, XMLIcon, TxtIcon, SQLIcon, SchemeIcon, RegexIcon, MDXIcon, LogIcon, SquareDashedBottomCodeIcon, JsonIcon, JavaIcon, HttpIcon, HtmlIcon, DiffIcon, CSVIcon, CSSIcon } from '@windrun-huaiin/base-ui/icons';
5
- import { baseMarkdownComponents } from '../share/markdown-component-map.mjs';
6
- import { ImageZoom } from '../heavy/image-zoom.mjs';
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;