@windrun-huaiin/third-ui 20.1.0 → 22.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 (123) hide show
  1. package/LICENSE +1 -1
  2. package/dist/ai/ai-markdown.js +1 -1
  3. package/dist/ai/ai-markdown.mjs +1 -1
  4. package/dist/clerk/clerk-page-context-generator.js +3 -2
  5. package/dist/clerk/clerk-page-context-generator.mjs +3 -2
  6. package/dist/clerk/clerk-page-generator.d.ts +0 -8
  7. package/dist/clerk/clerk-page-generator.js +4 -3
  8. package/dist/clerk/clerk-page-generator.mjs +4 -3
  9. package/dist/fuma/base/custom-header.d.ts +1 -1
  10. package/dist/fuma/base/custom-header.js +38 -36
  11. package/dist/fuma/base/custom-header.mjs +25 -23
  12. package/dist/fuma/base/custom-home-layout.d.ts +1 -1
  13. package/dist/fuma/base/custom-home-layout.js +1 -1
  14. package/dist/fuma/base/custom-home-layout.mjs +1 -1
  15. package/dist/fuma/base/header-theme-switch.d.ts +5 -0
  16. package/dist/fuma/base/header-theme-switch.js +42 -0
  17. package/dist/fuma/base/header-theme-switch.mjs +40 -0
  18. package/dist/fuma/base/index.d.ts +1 -0
  19. package/dist/fuma/base/index.js +7 -0
  20. package/dist/fuma/base/index.mjs +1 -0
  21. package/dist/fuma/base/site-layout.d.ts +116 -0
  22. package/dist/fuma/base/site-layout.js +72 -0
  23. package/dist/fuma/base/site-layout.mjs +65 -0
  24. package/dist/fuma/fuma-banner-suit.js +9 -6
  25. package/dist/fuma/fuma-banner-suit.mjs +10 -7
  26. package/dist/fuma/fuma-page-genarator.d.ts +2 -2
  27. package/dist/fuma/fuma-page-genarator.js +21 -8
  28. package/dist/fuma/fuma-page-genarator.mjs +21 -8
  29. package/dist/fuma/heavy/image-grid.d.ts +6 -0
  30. package/dist/fuma/heavy/image-grid.js +17 -0
  31. package/dist/fuma/heavy/image-grid.mjs +15 -0
  32. package/dist/fuma/heavy/image-zoom.d.ts +22 -0
  33. package/dist/fuma/heavy/image-zoom.js +39 -0
  34. package/dist/fuma/heavy/image-zoom.mjs +37 -0
  35. package/dist/fuma/heavy/index.d.ts +4 -0
  36. package/dist/fuma/heavy/index.js +15 -0
  37. package/dist/fuma/heavy/index.mjs +5 -0
  38. package/dist/fuma/heavy/math.d.ts +17 -0
  39. package/dist/fuma/heavy/math.js +60 -0
  40. package/dist/fuma/heavy/math.mjs +57 -0
  41. package/dist/fuma/heavy/mermaid.d.ts +13 -0
  42. package/dist/fuma/heavy/mermaid.js +360 -0
  43. package/dist/fuma/heavy/mermaid.mjs +358 -0
  44. package/dist/fuma/llm-copy-handler.js +3 -2
  45. package/dist/fuma/llm-copy-handler.mjs +3 -2
  46. package/dist/fuma/mdx/features.d.ts +8 -0
  47. package/dist/fuma/mdx/features.js +92 -0
  48. package/dist/fuma/mdx/features.mjs +85 -0
  49. package/dist/fuma/mdx/index.d.ts +0 -4
  50. package/dist/fuma/mdx/index.js +0 -8
  51. package/dist/fuma/mdx/index.mjs +0 -4
  52. package/dist/fuma/mdx/markdown-component-map.js +7 -1
  53. package/dist/fuma/mdx/markdown-component-map.mjs +7 -1
  54. package/dist/fuma/mdx/math.d.ts +17 -0
  55. package/dist/fuma/mdx/math.js +60 -0
  56. package/dist/fuma/mdx/math.mjs +57 -0
  57. package/dist/fuma/mdx/site-mdx-components.d.ts +13 -0
  58. package/dist/fuma/mdx/site-mdx-components.js +19 -0
  59. package/dist/fuma/mdx/site-mdx-components.mjs +17 -0
  60. package/dist/fuma/mdx/site-mdx-presets.d.ts +13 -0
  61. package/dist/fuma/mdx/site-mdx-presets.js +49 -0
  62. package/dist/fuma/mdx/site-mdx-presets.mjs +45 -0
  63. package/dist/fuma/mdx/toc-clerk-portable.js +9 -5
  64. package/dist/fuma/mdx/toc-clerk-portable.mjs +8 -4
  65. package/dist/fuma/mdx/zia-card.js +1 -1
  66. package/dist/fuma/mdx/zia-card.mjs +1 -1
  67. package/dist/fuma/mdx/zia-file.js +1 -0
  68. package/dist/fuma/mdx/zia-file.mjs +1 -0
  69. package/dist/fuma/server/optional-features.d.ts +8 -0
  70. package/dist/fuma/server/optional-features.js +111 -0
  71. package/dist/fuma/server/optional-features.mjs +104 -0
  72. package/dist/fuma/server/site-mdx-components.d.ts +13 -0
  73. package/dist/fuma/server/site-mdx-components.js +19 -0
  74. package/dist/fuma/server/site-mdx-components.mjs +17 -0
  75. package/dist/fuma/server/site-mdx-presets.d.ts +194 -0
  76. package/dist/fuma/server/site-mdx-presets.js +46 -0
  77. package/dist/fuma/server/site-mdx-presets.mjs +42 -0
  78. package/dist/fuma/share/index.d.ts +1 -0
  79. package/dist/fuma/share/index.js +7 -0
  80. package/dist/fuma/share/index.mjs +1 -0
  81. package/dist/fuma/share/markdown-component-map.d.ts +3 -0
  82. package/dist/fuma/share/markdown-component-map.js +79 -0
  83. package/dist/fuma/share/markdown-component-map.mjs +77 -0
  84. package/dist/lib/fuma-schema-check-util.js +19 -5
  85. package/dist/lib/fuma-schema-check-util.mjs +19 -5
  86. package/dist/lib/seo-metadata.d.ts +10 -0
  87. package/dist/main/x-button.js +2 -2
  88. package/dist/main/x-button.mjs +2 -2
  89. package/package.json +31 -8
  90. package/src/ai/ai-markdown.tsx +1 -1
  91. package/src/clerk/clerk-page-context-generator.tsx +6 -3
  92. package/src/clerk/clerk-page-generator.tsx +7 -13
  93. package/src/fuma/base/custom-header.tsx +32 -35
  94. package/src/fuma/base/custom-home-layout.tsx +2 -2
  95. package/src/fuma/base/header-theme-switch.tsx +88 -0
  96. package/src/fuma/base/index.ts +1 -0
  97. package/src/fuma/base/site-layout.tsx +289 -0
  98. package/src/fuma/fuma-banner-suit.tsx +30 -28
  99. package/src/fuma/fuma-page-genarator.tsx +27 -10
  100. package/src/fuma/{mdx → heavy}/image-grid.tsx +1 -1
  101. package/src/fuma/heavy/index.ts +7 -0
  102. package/src/fuma/heavy/math.tsx +130 -0
  103. package/src/fuma/llm-copy-handler.ts +3 -3
  104. package/src/fuma/mdx/index.ts +0 -4
  105. package/src/fuma/mdx/toc-clerk-portable.tsx +27 -24
  106. package/src/fuma/mdx/zia-card.tsx +1 -0
  107. package/src/fuma/mdx/zia-file.tsx +3 -1
  108. package/src/fuma/server/optional-features.tsx +168 -0
  109. package/src/fuma/server/site-mdx-components.tsx +48 -0
  110. package/src/fuma/server/site-mdx-presets.ts +80 -0
  111. package/src/fuma/share/index.ts +1 -0
  112. package/src/fuma/{mdx → share}/markdown-component-map.tsx +1 -1
  113. package/src/lib/fuma-schema-check-util.ts +22 -6
  114. package/src/lib/seo-metadata.ts +47 -0
  115. package/src/main/language-detector.tsx +0 -8
  116. package/src/main/x-button.tsx +2 -2
  117. package/src/styles/fuma.css +3 -7
  118. package/src/styles/third-ui.css +0 -4
  119. package/dist/main/ads-alert-dialog.d.ts +0 -15
  120. package/dist/main/ads-alert-dialog.js +0 -21
  121. package/dist/main/ads-alert-dialog.mjs +0 -19
  122. /package/src/fuma/{mdx → heavy}/image-zoom.tsx +0 -0
  123. /package/src/fuma/{mdx → heavy}/mermaid.tsx +0 -0
@@ -0,0 +1,104 @@
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 };
@@ -0,0 +1,13 @@
1
+ import type { MDXComponents } from 'mdx/types';
2
+ import type { ReactNode } from 'react';
3
+ import type { SiteMdxFeature } from '@windrun-huaiin/contracts/mdx';
4
+ export interface SiteMdxComponentsOptions {
5
+ imageFallbackSrc?: string;
6
+ cdnBaseUrl?: string;
7
+ watermarkEnabled?: boolean;
8
+ watermarkText?: string;
9
+ additionalComponents?: MDXComponents;
10
+ iconMap?: Record<string, ReactNode>;
11
+ features?: SiteMdxFeature[];
12
+ }
13
+ export declare function createSiteMdxComponents(options: SiteMdxComponentsOptions): (components?: MDXComponents) => MDXComponents;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ var siteMdxPresets = require('./site-mdx-presets.js');
4
+
5
+ function createSiteMdxComponents(options) {
6
+ const { additionalComponents, cdnBaseUrl, features = siteMdxPresets.DEFAULT_SITE_MDX_FEATURES, iconMap = {}, imageFallbackSrc, watermarkEnabled, watermarkText, } = options;
7
+ const featureMap = siteMdxPresets.createSiteFeatureComponentMap({
8
+ cdnBaseUrl,
9
+ iconMap,
10
+ imageFallbackSrc,
11
+ watermarkEnabled,
12
+ watermarkText,
13
+ });
14
+ return function getMDXComponents(components) {
15
+ return siteMdxPresets.composeSiteMdxComponents(features, featureMap, additionalComponents, components);
16
+ };
17
+ }
18
+
19
+ exports.createSiteMdxComponents = createSiteMdxComponents;
@@ -0,0 +1,17 @@
1
+ import { DEFAULT_SITE_MDX_FEATURES, createSiteFeatureComponentMap, composeSiteMdxComponents } from './site-mdx-presets.mjs';
2
+
3
+ function createSiteMdxComponents(options) {
4
+ const { additionalComponents, cdnBaseUrl, features = DEFAULT_SITE_MDX_FEATURES, iconMap = {}, imageFallbackSrc, watermarkEnabled, watermarkText, } = options;
5
+ const featureMap = createSiteFeatureComponentMap({
6
+ cdnBaseUrl,
7
+ iconMap,
8
+ imageFallbackSrc,
9
+ watermarkEnabled,
10
+ watermarkText,
11
+ });
12
+ return function getMDXComponents(components) {
13
+ return composeSiteMdxComponents(features, featureMap, additionalComponents, components);
14
+ };
15
+ }
16
+
17
+ export { createSiteMdxComponents };