@windrun-huaiin/third-ui 22.0.1 → 23.1.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/README.md +152 -189
- 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 +2 -0
- package/dist/fuma/server/features/code.js +65 -0
- package/dist/fuma/server/features/code.mjs +63 -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 +36 -0
- package/dist/fuma/server/site-mdx-base.mjs +33 -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 +25 -0
- package/dist/fuma/server/site-mdx-fallbacks.js +79 -0
- package/dist/fuma/server/site-mdx-fallbacks.mjs +73 -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 +28 -13
- package/src/fuma/server/features/base.tsx +23 -0
- package/src/fuma/server/features/code.tsx +100 -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/site-mdx-base.tsx +66 -0
- package/src/fuma/server/site-mdx-fallbacks.tsx +172 -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/share/markdown-component-map.tsx +5 -4
- package/src/fuma/server/optional-features.tsx +0 -168
- package/src/fuma/server/site-mdx-components.tsx +0 -48
- package/src/fuma/server/site-mdx-presets.ts +0 -80
package/README.md
CHANGED
|
@@ -1,222 +1,185 @@
|
|
|
1
1
|
# @windrun-huaiin/third-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This README currently documents only the Fuma/MDX component design in `third-ui`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Other modules in this package, such as Clerk, main application UI, AI UI, fingerprint, SEO helpers, and shared layout utilities, are intentionally not covered here.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
## MDX Component Layer
|
|
8
|
+
|
|
9
|
+
The Fuma/MDX part of `third-ui` provides the rendering component map used by application MDX pages.
|
|
10
|
+
|
|
11
|
+
It is not responsible for reading files or compiling MDX. That belongs to `@windrun-huaiin/fumadocs-local-md`.
|
|
12
|
+
|
|
13
|
+
The split is:
|
|
14
|
+
|
|
15
|
+
- `local-md`: content source, frontmatter/meta parsing, Markdown/MDX compilation, render execution safety.
|
|
16
|
+
- `third-ui`: React components used when MDX is rendered.
|
|
17
|
+
- application: chooses which compiler features and renderer features are imported.
|
|
18
|
+
|
|
19
|
+
## Design Goals
|
|
20
|
+
|
|
21
|
+
- Keep the base MDX component map useful but small.
|
|
22
|
+
- Make heavyweight rendering features explicit imports.
|
|
23
|
+
- Avoid old aggregate component entries that import every renderer feature at module load time.
|
|
24
|
+
- Let application code be the capability declaration.
|
|
25
|
+
- Preserve a safe fallback path when disabled or unknown MDX components appear in content.
|
|
26
|
+
- Keep renderer-only capabilities separate from compiler-only capabilities.
|
|
27
|
+
|
|
28
|
+
## Current Entry Model
|
|
29
|
+
|
|
30
|
+
New applications should use the base site MDX entry:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
@windrun-huaiin/third-ui/fuma/server/site-mdx/base
|
|
9
34
|
```
|
|
10
35
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
│ └── app/
|
|
19
|
-
│ └── globals.css
|
|
20
|
-
├── node_modules/
|
|
21
|
-
│ ├── @windrun-huaiin/
|
|
22
|
-
│ │ ├── third-ui/
|
|
23
|
-
│ │ │ └── src/ # This is third-ui src
|
|
24
|
-
│ │ └── base-ui/
|
|
25
|
-
│ │ └── src/ # This is base-ui src
|
|
26
|
-
└── package.json
|
|
36
|
+
Optional renderer features live behind physical subpath entries:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
@windrun-huaiin/third-ui/fuma/server/site-mdx/features/code
|
|
40
|
+
@windrun-huaiin/third-ui/fuma/server/site-mdx/features/math
|
|
41
|
+
@windrun-huaiin/third-ui/fuma/server/site-mdx/features/mermaid
|
|
42
|
+
@windrun-huaiin/third-ui/fuma/server/site-mdx/features/type-table
|
|
27
43
|
```
|
|
28
44
|
|
|
29
|
-
|
|
45
|
+
The old aggregate entries have been removed. There is no supported `site-mdx-components` entry and no `optional-features` aggregate entry.
|
|
30
46
|
|
|
31
|
-
|
|
32
|
-
@import 'tailwindcss';
|
|
47
|
+
## Base Components
|
|
33
48
|
|
|
34
|
-
|
|
35
|
-
@source "../node_modules/@windrun-huaiin/base-ui/src/**/*.{js,ts,jsx,tsx}";
|
|
36
|
-
@source "./src/**/*.{js,ts,jsx,tsx}";
|
|
49
|
+
The base entry is the minimum component set for normal documentation content.
|
|
37
50
|
|
|
38
|
-
|
|
39
|
-
@import '@windrun-huaiin/third-ui/styles/third-ui.css';
|
|
40
|
-
```
|
|
51
|
+
It includes:
|
|
41
52
|
|
|
53
|
+
- Fuma UI basics: `Card`, `Cards`, `Callout`, `File`, `Folder`, `Files`, `Accordion`, `Accordions`, `Tab`, `Tabs`.
|
|
54
|
+
- Markdown element renderers: headings, links, blockquote, lists, table, inline code, pre, image, and related primitive tags.
|
|
55
|
+
- Site-level lightweight components: `SiteX`, `TrophyCard`, `ZiaCard`, `GradientButton`, `ZiaFile`, `ZiaFolder`, `SunoEmbed`.
|
|
56
|
+
- Image rendering integration with image fallback and CDN-related options.
|
|
57
|
+
- Feature-specific fallback components for disabled math, Mermaid, type table, and code-tab style components.
|
|
42
58
|
|
|
43
|
-
|
|
59
|
+
It intentionally does not include heavyweight renderer implementations such as Mermaid, KaTeX rendering, Fuma codeblock rendering, or type-table rendering.
|
|
44
60
|
|
|
45
|
-
|
|
61
|
+
## Renderer Feature Matrix
|
|
46
62
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
63
|
+
| Capability | Renderer Entry | Compiler Entry Required | Notes |
|
|
64
|
+
| --- | --- | --- | --- |
|
|
65
|
+
| `base` | `site-mdx/base` | `local-md/presets/fuma-docs/base` | Required for normal MDX rendering |
|
|
66
|
+
| `code` | `site-mdx/features/code` | `local-md/presets/fuma-docs/features/code` | Enables Fuma codeblock UI and built-in language icon mapping |
|
|
67
|
+
| `math` | `site-mdx/features/math` | `local-md/presets/fuma-docs/features/math` | Enables `MathBlock` and `InlineMath` rendering |
|
|
68
|
+
| `mermaid` | `site-mdx/features/mermaid` | Not required | Renderer-only component capability |
|
|
69
|
+
| `type-table` | `site-mdx/features/type-table` | Not required | Renderer-only component capability |
|
|
70
|
+
| `npm` | Not required | `local-md/presets/fuma-docs/features/npm` | Compiler-only content transform |
|
|
51
71
|
|
|
52
|
-
|
|
53
|
-
import { CTA, Features } from '@windrun-huaiin/third-ui/main';
|
|
72
|
+
This table is the main rule for application integration.
|
|
54
73
|
|
|
55
|
-
|
|
56
|
-
import { FumaPageGenerator, FumaBannerSuit } from '@windrun-huaiin/third-ui/fuma/server';
|
|
74
|
+
`code` and `math` need both compiler and renderer support. `npm` is compiler-only. `mermaid` and `type-table` are renderer-only.
|
|
57
75
|
|
|
58
|
-
|
|
59
|
-
import { TocFooterWrapper, PortableClerkTOC } from '@windrun-huaiin/third-ui/fuma/mdx';
|
|
60
|
-
```
|
|
76
|
+
## Bundle Cropping Rule
|
|
61
77
|
|
|
62
|
-
|
|
63
|
-
```tsx
|
|
64
|
-
// Clerk user component (need to pass in translations and configuration)
|
|
65
|
-
<ClerkUser
|
|
66
|
-
locale="zh"
|
|
67
|
-
clerkAuthInModal={true}
|
|
68
|
-
t={{ signIn: "Sign in" }}
|
|
69
|
-
t2={{ terms: "Terms of Service", privacy: "Privacy Policy" }}
|
|
70
|
-
/>
|
|
71
|
-
|
|
72
|
-
// Clerk organization component
|
|
73
|
-
<ClerkOrganization locale="zh" className="custom-class" />
|
|
74
|
-
|
|
75
|
-
// Main application components
|
|
76
|
-
<CTA />
|
|
77
|
-
<Features />
|
|
78
|
-
```
|
|
78
|
+
Renderer pruning is based on import boundaries.
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
1. **Modularization**: Grouped by functional domain, support import on demand
|
|
83
|
-
2. **Parameterization**: Remove hard-coded dependencies, pass configuration through props
|
|
84
|
-
3. **Type safety**: Full TypeScript support
|
|
85
|
-
4. **Path alias**: Use `@/` alias internally, keep code clean
|
|
86
|
-
|
|
87
|
-
## Dependencies
|
|
88
|
-
|
|
89
|
-
- `@windrun-huaiin/base-ui`: Base UI components
|
|
90
|
-
- `@windrun-huaiin/lib`: General utility library
|
|
91
|
-
- `@clerk/nextjs`: Clerk authentication
|
|
92
|
-
- `fumadocs-core`, `fumadocs-ui`: Fumadocs documentation
|
|
93
|
-
|
|
94
|
-
## Notes
|
|
95
|
-
|
|
96
|
-
- Components have removed direct `appConfig` dependencies, and configuration is passed through props
|
|
97
|
-
- Clerk components need to provide correct translations in the application layer
|
|
98
|
-
- Some components may require specific CSS animation classes (e.g. `animate-cta-gradient-wave`)
|
|
99
|
-
|
|
100
|
-
## Component List
|
|
101
|
-
|
|
102
|
-
### Clerk module
|
|
103
|
-
- `ClerkProviderClient` - Clerk authentication provider
|
|
104
|
-
- `ClerkUser` - User button component
|
|
105
|
-
- `ClerkOrganization` - Organization switcher component
|
|
106
|
-
|
|
107
|
-
### Main module
|
|
108
|
-
- `CTA` - Call-to-Action component
|
|
109
|
-
- `Features` - Feature showcase component
|
|
110
|
-
- `Footer` - Footer component
|
|
111
|
-
- `Gallery` - Image gallery component
|
|
112
|
-
- `GoToTop` - Go to top button
|
|
113
|
-
- `SEOContent` - SEO content component
|
|
114
|
-
- `Tips` - Tip component
|
|
115
|
-
|
|
116
|
-
### Fuma module
|
|
117
|
-
- `getMDXComponents` - MDX component configuration function
|
|
118
|
-
- `createMDXComponents` - MDX component factory function
|
|
119
|
-
- `TocFooter` - Table of contents footer component
|
|
120
|
-
- `FumaBannerSuit` - Fumadocs banner component
|
|
121
|
-
|
|
122
|
-
### Fuma MDX submodule
|
|
123
|
-
- `Mermaid` - Flowchart component
|
|
124
|
-
- `ImageZoom` - Image zoom component
|
|
125
|
-
- `TrophyCard` - Trophy card component
|
|
126
|
-
- `ImageGrid` - Image grid component
|
|
127
|
-
- `ZiaCard` - Zia card component
|
|
128
|
-
- `GradientButton` - Gradient button component
|
|
129
|
-
|
|
130
|
-
## Usage
|
|
131
|
-
|
|
132
|
-
### Clerk components
|
|
133
|
-
|
|
134
|
-
```tsx
|
|
135
|
-
import { ClerkProviderClient, ClerkUser } from '@windrun-huaiin/third-ui/clerk';
|
|
136
|
-
|
|
137
|
-
// Use in layout.tsx
|
|
138
|
-
<ClerkProviderClient
|
|
139
|
-
signInUrl="/sign-in"
|
|
140
|
-
signUpUrl="/sign-up"
|
|
141
|
-
waitlistUrl="/waitlist"
|
|
142
|
-
>
|
|
143
|
-
{children}
|
|
144
|
-
</ClerkProviderClient>
|
|
145
|
-
|
|
146
|
-
// Use in navigation bar
|
|
147
|
-
<ClerkUser clerkAuthInModal={true} />
|
|
148
|
-
```
|
|
80
|
+
If an application does not import `site-mdx/features/mermaid`, Mermaid renderer code should not be pulled into the base renderer entry. The same rule applies to code, math, and type-table renderer features.
|
|
149
81
|
|
|
150
|
-
|
|
82
|
+
Do not reintroduce a file that imports all renderer features and then chooses one at runtime. That pattern defeats bundle cropping because static imports run before configuration checks.
|
|
151
83
|
|
|
152
|
-
|
|
153
|
-
import { CTA, Features, Footer } from '@windrun-huaiin/third-ui/main';
|
|
84
|
+
Correct model:
|
|
154
85
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
<Footer />
|
|
159
|
-
```
|
|
86
|
+
- base entry imports only base renderers and lightweight fallback components.
|
|
87
|
+
- each optional feature entry imports only its own renderer implementation.
|
|
88
|
+
- application code imports the feature entries it wants.
|
|
160
89
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
// Use TocFooter
|
|
180
|
-
<TocFooter
|
|
181
|
-
lastModified={page.data.date}
|
|
182
|
-
showCopy={true}
|
|
183
|
-
editPath="src/docs/your-file.mdx"
|
|
184
|
-
githubBaseUrl="https://github.com/your-org/your-repo/edit/main/"
|
|
185
|
-
/>
|
|
186
|
-
```
|
|
90
|
+
## Fallback Design
|
|
91
|
+
|
|
92
|
+
There are two fallback layers.
|
|
93
|
+
|
|
94
|
+
The first layer lives in `third-ui`.
|
|
95
|
+
|
|
96
|
+
It provides feature-aware fallbacks for known but disabled MDX capabilities:
|
|
97
|
+
|
|
98
|
+
- `MathBlock`
|
|
99
|
+
- `InlineMath`
|
|
100
|
+
- `Mermaid`
|
|
101
|
+
- `TypeTable`
|
|
102
|
+
- `CodeBlockTab`
|
|
103
|
+
- `CodeBlockTabs`
|
|
104
|
+
- `CodeBlockTabsList`
|
|
105
|
+
- `CodeBlockTabsTrigger`
|
|
106
|
+
|
|
107
|
+
These fallbacks render visible warning blocks instead of silently dropping content.
|
|
187
108
|
|
|
188
|
-
|
|
109
|
+
The second layer lives in `local-md`.
|
|
189
110
|
|
|
190
|
-
|
|
111
|
+
It is the final safety net for arbitrary unknown PascalCase components, such as:
|
|
191
112
|
|
|
192
113
|
```mdx
|
|
193
|
-
|
|
194
|
-
<Mermaid
|
|
195
|
-
chart="graph TD; A-->B"
|
|
196
|
-
title="My Diagram"
|
|
197
|
-
/>
|
|
198
|
-
|
|
199
|
-
<!-- Image grid, CDN URL automatically applied -->
|
|
200
|
-
<ImageGrid
|
|
201
|
-
type="url"
|
|
202
|
-
images={["image1.webp", "image2.webp"]}
|
|
203
|
-
altPrefix="example"
|
|
204
|
-
/>
|
|
205
|
-
|
|
206
|
-
<!-- Image zoom, placeholder image automatically applied -->
|
|
207
|
-
<ImageZoom src="/some-image.jpg" alt="Example" />
|
|
114
|
+
<CalloutXXX />
|
|
208
115
|
```
|
|
209
116
|
|
|
210
|
-
|
|
117
|
+
`local-md` detects missing component references from the compiled MDX output and injects generic fallback components before rendering. This prevents unknown MDX components from crashing the page.
|
|
118
|
+
|
|
119
|
+
The priority order is:
|
|
120
|
+
|
|
121
|
+
- application-provided MDX components
|
|
122
|
+
- enabled `third-ui` renderer feature components
|
|
123
|
+
- `third-ui` known disabled-feature fallbacks
|
|
124
|
+
- `local-md` generic unknown-component fallback
|
|
125
|
+
|
|
126
|
+
## Heavy Renderer Boundary
|
|
127
|
+
|
|
128
|
+
Heavy renderers are isolated under dedicated feature paths or heavy modules.
|
|
129
|
+
|
|
130
|
+
Examples:
|
|
131
|
+
|
|
132
|
+
- Mermaid rendering is behind the Mermaid feature entry.
|
|
133
|
+
- Math rendering uses the math feature entry and lazy heavy math renderer.
|
|
134
|
+
- Type table rendering is behind the type-table feature entry.
|
|
135
|
+
- Fuma codeblock rendering is behind the code feature entry.
|
|
136
|
+
|
|
137
|
+
The code renderer owns its programming-language icon map internally. Applications should not pass a global icon map into `createCodeMdxComponents()`.
|
|
138
|
+
|
|
139
|
+
This keeps `site-mdx/base` from becoming a hidden dependency sink.
|
|
140
|
+
|
|
141
|
+
## Application Rules
|
|
142
|
+
|
|
143
|
+
Applications should treat their MDX integration files as the capability declaration.
|
|
144
|
+
|
|
145
|
+
For `apps/ddaas`, the important files are:
|
|
146
|
+
|
|
147
|
+
- `src/lib/content-source.ts`: compiler/source capabilities.
|
|
148
|
+
- `src/components/mdx-components.tsx`: renderer/component capabilities.
|
|
149
|
+
|
|
150
|
+
When enabling a capability:
|
|
151
|
+
|
|
152
|
+
- import the compiler feature only if the capability needs compiler support.
|
|
153
|
+
- import the renderer feature only if the capability needs renderer support.
|
|
154
|
+
- add the imported feature to the matching `features` list.
|
|
155
|
+
- do not import unused feature entries “just in case”.
|
|
156
|
+
|
|
157
|
+
If an application creates its own MDX component and that component imports a heavy package directly, the package can still enter the bundle. That is expected and belongs to the application layer.
|
|
158
|
+
|
|
159
|
+
## Styling
|
|
160
|
+
|
|
161
|
+
MDX components assume the application includes the package styles and Tailwind source scanning for `third-ui`.
|
|
162
|
+
|
|
163
|
+
The exact global CSS setup is application-specific, but MDX pages need the same base styles used by the rest of the Fuma UI integration.
|
|
164
|
+
|
|
165
|
+
## Export Map
|
|
166
|
+
|
|
167
|
+
MDX-related exports currently relevant to this design:
|
|
211
168
|
|
|
169
|
+
| Export | Purpose |
|
|
170
|
+
| --- | --- |
|
|
171
|
+
| `./fuma/server/site-mdx/base` | Recommended base MDX component factory |
|
|
172
|
+
| `./fuma/server/site-mdx/features/code` | Optional code renderer components |
|
|
173
|
+
| `./fuma/server/site-mdx/features/math` | Optional math renderer components |
|
|
174
|
+
| `./fuma/server/site-mdx/features/mermaid` | Optional Mermaid renderer components |
|
|
175
|
+
| `./fuma/server/site-mdx/features/type-table` | Optional type-table renderer components |
|
|
176
|
+
| `./fuma/mdx` | Shared MDX building blocks used by pages and widgets |
|
|
177
|
+
| `./fuma/heavy` | Heavy renderer exports; avoid importing from app base paths unless intentionally needed |
|
|
178
|
+
| `./fuma/share` | Shared markdown component utilities |
|
|
212
179
|
|
|
213
|
-
##
|
|
180
|
+
## Non-Goals
|
|
214
181
|
|
|
215
|
-
-
|
|
216
|
-
-
|
|
217
|
-
-
|
|
218
|
-
-
|
|
219
|
-
- [Newspaper Template](https://newspaper-template.org/en)
|
|
220
|
-
- [breathing exercise](https://breathingexercise.net/en)
|
|
221
|
-
- [ai directory list](https://aidirectorylist.com/en)
|
|
222
|
-
- [reve image directory](https://reveimage.directory/en)
|
|
182
|
+
- This README does not document Clerk, main UI, AI UI, fingerprint, or SEO helpers.
|
|
183
|
+
- The base MDX entry should not become an all-features preset.
|
|
184
|
+
- Runtime feature flags should not be used as the primary pruning mechanism.
|
|
185
|
+
- Unknown MDX components should not crash the page.
|
|
@@ -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,65 @@
|
|
|
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() {
|
|
55
|
+
return {
|
|
56
|
+
pre: (props) => {
|
|
57
|
+
const customIcon = tryToMatchIcon(props, defaultCodeLanguageIconMap);
|
|
58
|
+
return (jsxRuntime.jsx(CodeBlock, Object.assign({}, props, (customIcon && { icon: customIcon }), { children: jsxRuntime.jsx(Pre, { children: props.children }) })));
|
|
59
|
+
},
|
|
60
|
+
CodeBlock,
|
|
61
|
+
Pre,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
exports.createCodeMdxComponents = createCodeMdxComponents;
|
|
@@ -0,0 +1,63 @@
|
|
|
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() {
|
|
53
|
+
return {
|
|
54
|
+
pre: (props) => {
|
|
55
|
+
const customIcon = tryToMatchIcon(props, defaultCodeLanguageIconMap);
|
|
56
|
+
return (jsx(CodeBlock, Object.assign({}, props, (customIcon && { icon: customIcon }), { children: jsx(Pre, { children: props.children }) })));
|
|
57
|
+
},
|
|
58
|
+
CodeBlock,
|
|
59
|
+
Pre,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
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 };
|