@windrun-huaiin/base-ui 30.0.0 → 31.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/README.md +30 -175
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +0 -2
- package/dist/components/index.mjs +0 -1
- package/package.json +8 -2
- package/src/components/index.ts +0 -1
- package/src/components/404-page.tsx +0 -111
package/README.md
CHANGED
|
@@ -1,202 +1,57 @@
|
|
|
1
1
|
# Base UI Components
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A shared React UI package built with TypeScript and Tailwind CSS. It provides reusable base components, theme-adaptive utilities, common icons, global icon handling, and analytics script components for Windrun Huaiin applications.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The package focuses on consistent theme adaptation and responsive compatibility across desktop, tablet, and mobile experiences.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- **TypeScript Support**: Full type safety and IntelliSense
|
|
9
|
-
- **Tailwind CSS**: Utility-first CSS framework integration
|
|
10
|
-
- **Radix UI**: Accessible and unstyled UI primitives
|
|
11
|
-
- **Tree Shaking**: Only import what you need
|
|
7
|
+
## Core Features
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
### Theme Utilities
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
pnpm add @windrun-huaiin/base-ui
|
|
17
|
-
```
|
|
11
|
+
Theme utility classes and helpers for consistent visual styling across applications.
|
|
18
12
|
|
|
19
|
-
|
|
13
|
+
The theme system is designed to let components, icons, accents, and interaction states adapt to the selected palette without duplicating style logic in each application.
|
|
20
14
|
|
|
21
|
-
|
|
15
|
+
Supported theme palettes:
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
├── node_modules/
|
|
29
|
-
│ ├── @windrun-huaiin/
|
|
30
|
-
│ │ ├── third-ui/
|
|
31
|
-
│ │ │ └── src/ # This is third-ui src
|
|
32
|
-
│ │ └── base-ui/
|
|
33
|
-
│ │ └── src/ # This is base-ui src
|
|
34
|
-
└── package.json
|
|
35
|
-
```
|
|
17
|
+
- `purple`: `#AC62FD`
|
|
18
|
+
- `orange`: `#F97316`
|
|
19
|
+
- `indigo`: `#6366F1`
|
|
20
|
+
- `emerald`: `#48C892`
|
|
21
|
+
- `rose`: `#F43F5E`
|
|
36
22
|
|
|
37
|
-
|
|
23
|
+
Core module:
|
|
38
24
|
|
|
39
|
-
|
|
40
|
-
@import 'tailwindcss';
|
|
25
|
+
- `theme-util`
|
|
41
26
|
|
|
42
|
-
|
|
43
|
-
@source "../node_modules/@windrun-huaiin/base-ui/src/**/*.{js,ts,jsx,tsx}";
|
|
44
|
-
@source "./src/**/*.{js,ts,jsx,tsx}";
|
|
27
|
+
### Common Icons
|
|
45
28
|
|
|
46
|
-
|
|
47
|
-
@import '@windrun-huaiin/third-ui/styles/base-ui.css';
|
|
48
|
-
```
|
|
29
|
+
A unified icon set based on `lucide-icons` and commonly used SVG assets.
|
|
49
30
|
|
|
50
|
-
|
|
31
|
+
The icons are designed to work with the supported theme palettes, making it easier to keep product UI, navigation, actions, and status indicators visually consistent across different themes and screen sizes.
|
|
51
32
|
|
|
52
|
-
|
|
33
|
+
### Responsive Multi-Device Compatibility
|
|
53
34
|
|
|
54
|
-
|
|
35
|
+
Base components are intended for responsive layouts across common application surfaces, including desktop, tablet, and mobile screens.
|
|
55
36
|
|
|
56
|
-
|
|
57
|
-
- GitHub, D8, Clerk, Iterm
|
|
37
|
+
The package helps keep spacing, sizing, icons, and interaction patterns predictable across multiple viewport sizes, so shared UI remains consistent when reused by different applications.
|
|
58
38
|
|
|
59
|
-
|
|
60
|
-
- Markdown, MDX, Html, Json, XML, Yaml, CSV, Txt, Java, SQL, Log
|
|
39
|
+
### Global Site Icon Handler
|
|
61
40
|
|
|
62
|
-
|
|
63
|
-
- MAC, BTC, CSS, Mermaid
|
|
41
|
+
A global handler for site icons, intended to centralize favicon and related icon metadata handling across applications.
|
|
64
42
|
|
|
65
|
-
|
|
66
|
-
- LastUpdated, Snippets, Test, Diff
|
|
43
|
+
This keeps browser tab icons, app icons, and shared site icon behavior consistent without repeating setup in every application.
|
|
67
44
|
|
|
68
|
-
|
|
69
|
-
- DPA, SubP, T3P
|
|
45
|
+
### Analytics Script Components
|
|
70
46
|
|
|
71
|
-
|
|
72
|
-
- Http, Scheme
|
|
47
|
+
Reusable script components for integrating common analytics providers.
|
|
73
48
|
|
|
74
|
-
|
|
49
|
+
Supported providers:
|
|
75
50
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
import { GitHubIcon, BTCIcon, MmdIcon} from '@windrun-huaiin/base-ui';
|
|
51
|
+
- Google
|
|
52
|
+
- Microsoft
|
|
79
53
|
|
|
80
|
-
|
|
81
|
-
<GitHubIcon className="h-6 w-6" />
|
|
82
|
-
<BTCIcon className="h-4 w-4" />
|
|
83
|
-
<MmdIcon className="h-4 w-4" /> // Auto 16x16 size for Mermaid
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### 2. Dynamic Icon Loading
|
|
87
|
-
```tsx
|
|
88
|
-
import { getGlobalIcon } from '@windrun-huaiin/base-ui';
|
|
89
|
-
|
|
90
|
-
// Get icon component
|
|
91
|
-
const GitHubIcon = getGlobalIcon('GitHub');
|
|
92
|
-
<GitHubIcon className="h-6 w-6" />
|
|
93
|
-
|
|
94
|
-
// Get icon element (for fumadocs)
|
|
95
|
-
const iconElement = getGlobalIcon('GitHub', true);
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### 3. Utility Components
|
|
99
|
-
```tsx
|
|
100
|
-
import { SiteIcon, NotFoundIcon } from '@windrun-huaiin/base-ui';
|
|
101
|
-
|
|
102
|
-
// Pre-configured site icon
|
|
103
|
-
<SiteIcon />
|
|
104
|
-
|
|
105
|
-
// Pre-configured 404 icon
|
|
106
|
-
<NotFoundIcon />
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Benefits
|
|
110
|
-
|
|
111
|
-
- ✅ **Zero Configuration**: No need to copy SVG files to your project
|
|
112
|
-
- ✅ **Self-contained**: All icons are bundled as React components
|
|
113
|
-
- ✅ **Consistent Styling**: Global icon color configuration
|
|
114
|
-
- ✅ **Type Safety**: Full TypeScript support with auto-completion
|
|
115
|
-
- ✅ **Performance**: No network requests for icon files
|
|
116
|
-
- ✅ **Special Sizing**: Mermaid icon has optimized 16x16 default size
|
|
117
|
-
|
|
118
|
-
## Environment Variables
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
# Optional: Set global icon color (defaults to text-purple-500)
|
|
122
|
-
NEXT_PUBLIC_STYLE_ICON_COLOR=text-blue-600
|
|
123
|
-
```
|
|
54
|
+
These components provide a consistent way to add analytics scripts to applications while keeping script setup centralized in the shared UI package.
|
|
124
55
|
|
|
125
56
|
## License
|
|
126
|
-
|
|
127
|
-
MIT
|
|
128
|
-
|
|
129
|
-
## Included Components
|
|
130
|
-
|
|
131
|
-
### UI Components (ui/)
|
|
132
|
-
- Radix UI base components
|
|
133
|
-
- Unified styles and themes
|
|
134
|
-
- Full TypeScript support
|
|
135
|
-
|
|
136
|
-
### Base Components (components/)
|
|
137
|
-
- 404-page: 404 error page component
|
|
138
|
-
- cta: Call-to-Action component
|
|
139
|
-
- features: Feature showcase component
|
|
140
|
-
- footer: Footer component
|
|
141
|
-
- gallery: Image gallery component
|
|
142
|
-
- global-icon: Global icon management
|
|
143
|
-
- go-to-top: Go to top button
|
|
144
|
-
- LanguageDetector: Language detection component
|
|
145
|
-
- LanguageSwitcher: Language switcher component
|
|
146
|
-
- seo-content: SEO content component
|
|
147
|
-
- tips: Tip component
|
|
148
|
-
|
|
149
|
-
### Script Components (script/)
|
|
150
|
-
- GoogleAnalyticsScript: Google Analytics script
|
|
151
|
-
- MicrosoftClarityScript: Microsoft Clarity script
|
|
152
|
-
|
|
153
|
-
## Usage Example
|
|
154
|
-
|
|
155
|
-
```tsx
|
|
156
|
-
import { Button, NotFoundPage, LanguageSwitcher } from '@windrun-huaiin/base-ui';
|
|
157
|
-
|
|
158
|
-
// Use UI components
|
|
159
|
-
<Button variant="default" size="lg">
|
|
160
|
-
Click me
|
|
161
|
-
</Button>
|
|
162
|
-
|
|
163
|
-
// Use base components
|
|
164
|
-
<NotFoundPage />
|
|
165
|
-
|
|
166
|
-
// Use language switcher component (need to pass in configuration)
|
|
167
|
-
<LanguageSwitcher
|
|
168
|
-
locales={['en', 'zh']}
|
|
169
|
-
localeLabels={{ en: 'English', zh: '中文' }}
|
|
170
|
-
/>
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## Dependencies
|
|
174
|
-
|
|
175
|
-
- React 18+
|
|
176
|
-
- Next.js 15+
|
|
177
|
-
- TypeScript
|
|
178
|
-
|
|
179
|
-
## Development
|
|
180
|
-
|
|
181
|
-
```bash
|
|
182
|
-
# Build
|
|
183
|
-
pnpm build
|
|
184
|
-
|
|
185
|
-
# Development mode
|
|
186
|
-
pnpm dev
|
|
187
|
-
|
|
188
|
-
# Type check
|
|
189
|
-
pnpm type-check
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
## Showcase
|
|
194
|
-
|
|
195
|
-
- [Free Trivia Game](https://freetrivia.info/)
|
|
196
|
-
- [Music Poster](https://musicposter.org/en)
|
|
197
|
-
- [Image Narration](https://imagenarration.com/en)
|
|
198
|
-
- [Describe Yourself](https://describeyourself.org/en)
|
|
199
|
-
- [Newspaper Template](https://newspaper-template.org/en)
|
|
200
|
-
- [breathing exercise](https://breathingexercise.net/en)
|
|
201
|
-
- [ai directory list](https://aidirectorylist.com/en)
|
|
202
|
-
- [reve image directory](https://reveimage.directory/en)
|
|
57
|
+
MIT License
|
package/dist/components/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var _404Page = require('./404-page.js');
|
|
5
4
|
var languageSwitcher = require('./language-switcher.js');
|
|
6
5
|
var googleAnalyticsScript = require('./script/google-analytics-script.js');
|
|
7
6
|
var microsoftClarityScript = require('./script/microsoft-clarity-script.js');
|
|
@@ -9,7 +8,6 @@ var googleAnalyticsClient = require('./script/google-analytics-client.js');
|
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
|
|
12
|
-
exports.NotFoundPage = _404Page.NotFoundPage;
|
|
13
11
|
exports.LanguageSwitcher = languageSwitcher.LanguageSwitcher;
|
|
14
12
|
exports.GoogleAnalyticsScript = googleAnalyticsScript.GoogleAnalyticsScript;
|
|
15
13
|
exports.MicrosoftClarityScript = microsoftClarityScript.MicrosoftClarityScript;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { NotFoundPage } from './404-page.mjs';
|
|
3
2
|
export { LanguageSwitcher } from './language-switcher.mjs';
|
|
4
3
|
export { GoogleAnalyticsScript } from './script/google-analytics-script.mjs';
|
|
5
4
|
export { MicrosoftClarityScript } from './script/microsoft-clarity-script.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@windrun-huaiin/base-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "31.0.0",
|
|
4
4
|
"description": "Base UI components for windrun-huaiin projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"class-variance-authority": "^0.7.1",
|
|
60
60
|
"lucide-react": "^0.577.0",
|
|
61
61
|
"tslib": "^2.8.1",
|
|
62
|
-
"@windrun-huaiin/lib": "^
|
|
62
|
+
"@windrun-huaiin/lib": "^31.0.0"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"clsx": "^2.1.1",
|
|
@@ -90,6 +90,12 @@
|
|
|
90
90
|
"publishConfig": {
|
|
91
91
|
"access": "public"
|
|
92
92
|
},
|
|
93
|
+
"homepage": "https://d8ger.com",
|
|
94
|
+
"repository": {
|
|
95
|
+
"type": "git",
|
|
96
|
+
"url": "git+https://github.com/caofanCPU/next-ai-build.git",
|
|
97
|
+
"directory": "packages/base-ui"
|
|
98
|
+
},
|
|
93
99
|
"scripts": {
|
|
94
100
|
"build": "rollup -c rollup.config.mjs",
|
|
95
101
|
"build:prod": "rollup -c rollup.config.mjs",
|
package/src/components/index.ts
CHANGED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { NotFoundIcon } from "@base-ui/components/global-icon";
|
|
4
|
-
import { useEffect, useState, type ReactNode } from "react";
|
|
5
|
-
import { themeBgColor, themeViaColor, themeButtonGradientClass } from "@base-ui/lib";
|
|
6
|
-
import { cn } from "@windrun-huaiin/lib/utils";
|
|
7
|
-
|
|
8
|
-
interface NotFoundPageProps {
|
|
9
|
-
siteIcon: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function NotFoundPage({ siteIcon }: NotFoundPageProps) {
|
|
13
|
-
const [glitchText, setGlitchText] = useState("404");
|
|
14
|
-
|
|
15
|
-
// glitch effect
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const glitchChars = ["4", "0", "4", "?", "#", "!", "*", "&", "%", "$"];
|
|
18
|
-
|
|
19
|
-
const interval = setInterval(() => {
|
|
20
|
-
// 80% probability to display "404", 20% probability to display random characters
|
|
21
|
-
if (Math.random() < 0.5) {
|
|
22
|
-
setGlitchText("404");
|
|
23
|
-
} else {
|
|
24
|
-
const randomChars = Array.from(
|
|
25
|
-
{ length: 3 },
|
|
26
|
-
() => glitchChars[Math.floor(Math.random() * glitchChars.length)]
|
|
27
|
-
).join("");
|
|
28
|
-
setGlitchText(randomChars);
|
|
29
|
-
}
|
|
30
|
-
}, 600); // every 1.5 seconds
|
|
31
|
-
|
|
32
|
-
return () => clearInterval(interval);
|
|
33
|
-
}, []);
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<div className="flex min-h-dvh w-full flex-col items-center justify-center px-4 py-8">
|
|
37
|
-
{/* main content area */}
|
|
38
|
-
<div className="text-center space-y-8 max-w-2xl">
|
|
39
|
-
{/* 404 number - glitch effect */}
|
|
40
|
-
<div className="relative flex justify-center">
|
|
41
|
-
<h1
|
|
42
|
-
className={cn("text-8xl md:text-9xl font-bold bg-linear-to-r bg-clip-text text-transparent select-none", themeButtonGradientClass)}
|
|
43
|
-
style={{
|
|
44
|
-
fontFamily: "Montserrat, monospace",
|
|
45
|
-
textShadow: "0 0 30px rgba(172, 98, 253, 0.3)",
|
|
46
|
-
letterSpacing: "0.1em",
|
|
47
|
-
}}
|
|
48
|
-
>
|
|
49
|
-
{glitchText}
|
|
50
|
-
</h1>
|
|
51
|
-
{/* scan line effect */}
|
|
52
|
-
<div className="absolute inset-0 pointer-events-none">
|
|
53
|
-
<div className={cn("h-full w-full bg-linear-to-b from-transparent to-transparent animate-pulse", themeViaColor)} />
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
|
|
57
|
-
{/* error message */}
|
|
58
|
-
<div className="space-y-4">
|
|
59
|
-
<h2 className="text-2xl md:text-3xl font-semibold text-foreground">
|
|
60
|
-
Page Not Found
|
|
61
|
-
</h2>
|
|
62
|
-
<p className="text-lg text-muted-foreground max-w-md mx-auto leading-relaxed">
|
|
63
|
-
The page you're looking for doesn't exist
|
|
64
|
-
</p>
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
{/* decorative elements */}
|
|
68
|
-
<div className="flex justify-center items-center gap-8 pt-8 opacity-60">
|
|
69
|
-
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
|
70
|
-
{siteIcon}
|
|
71
|
-
<span>Woops!</span>
|
|
72
|
-
</div>
|
|
73
|
-
<div className={cn("w-2 h-2 rounded-full animate-ping", themeBgColor)} />
|
|
74
|
-
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
|
75
|
-
<NotFoundIcon />
|
|
76
|
-
<span>Error Code: 404</span>
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
|
|
81
|
-
{/* background decoration */}
|
|
82
|
-
<div className="fixed inset-0 pointer-events-none overflow-hidden -z-10">
|
|
83
|
-
{/* grid background */}
|
|
84
|
-
<div
|
|
85
|
-
className="absolute inset-0 opacity-[0.02] dark:opacity-[0.05]"
|
|
86
|
-
style={{
|
|
87
|
-
backgroundImage: `
|
|
88
|
-
linear-gradient(rgba(172, 98, 253, 0.1) 1px, transparent 1px),
|
|
89
|
-
linear-gradient(90deg, rgba(172, 98, 253, 0.1) 1px, transparent 1px)
|
|
90
|
-
`,
|
|
91
|
-
backgroundSize: "50px 50px",
|
|
92
|
-
}}
|
|
93
|
-
/>
|
|
94
|
-
|
|
95
|
-
{/* floating particles */}
|
|
96
|
-
{Array.from({ length: 6 }).map((_, i) => (
|
|
97
|
-
<div
|
|
98
|
-
key={i}
|
|
99
|
-
className={cn("absolute w-2 h-2 rounded-full animate-bounce", themeBgColor)}
|
|
100
|
-
style={{
|
|
101
|
-
left: `${20 + i * 15}%`,
|
|
102
|
-
top: `${30 + (i % 3) * 20}%`,
|
|
103
|
-
animationDelay: `${i * 0.5}s`,
|
|
104
|
-
animationDuration: `${2 + i * 0.3}s`,
|
|
105
|
-
}}
|
|
106
|
-
/>
|
|
107
|
-
))}
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
);
|
|
111
|
-
}
|