@windrun-huaiin/base-ui 4.1.0 → 5.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/components/client/index.d.mts +5 -1
- package/dist/components/client/index.d.ts +5 -1
- package/dist/components/client/index.js +7 -56
- package/dist/components/client/index.js.map +1 -1
- package/dist/components/client/index.mjs +8 -57
- package/dist/components/client/index.mjs.map +1 -1
- package/dist/components/index.d.mts +8 -1
- package/dist/components/index.d.ts +8 -1
- package/dist/components/index.js +33 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +33 -1
- package/dist/components/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -9
- package/dist/index.d.ts +2 -9
- package/dist/index.js +63 -512
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -461
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -9
- package/src/components/404-page.tsx +7 -4
- package/src/components/client/index.ts +2 -1
- package/src/components/index.ts +2 -0
- package/src/components/site-icon.tsx +38 -0
- package/src/index.ts +1 -3
- package/dist/lib/index.d.mts +0 -24
- package/dist/lib/index.d.ts +0 -24
- package/dist/lib/index.js +0 -1174
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/index.mjs +0 -1167
- package/dist/lib/index.mjs.map +0 -1
- package/src/lib/icon-context.tsx +0 -57
- package/src/lib/index.ts +0 -5
- package/src/lib/site-icon.tsx +0 -46
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@windrun-huaiin/base-ui",
|
3
|
-
"version": "
|
3
|
+
"version": "5.0.0",
|
4
4
|
"description": "Base UI components for windrun-huaiin projects",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"module": "./dist/index.mjs",
|
@@ -26,11 +26,6 @@
|
|
26
26
|
"import": "./dist/components/client/index.mjs",
|
27
27
|
"require": "./dist/components/client/index.js"
|
28
28
|
},
|
29
|
-
"./lib/*": {
|
30
|
-
"types": "./dist/lib/*.d.ts",
|
31
|
-
"import": "./dist/lib/*.mjs",
|
32
|
-
"require": "./dist/lib/*.js"
|
33
|
-
},
|
34
29
|
"./src/*": "./src/*",
|
35
30
|
"./styles/base-ui.css": "./dist/base-ui.css"
|
36
31
|
},
|
@@ -48,11 +43,11 @@
|
|
48
43
|
"@radix-ui/react-slot": "^1.2.2",
|
49
44
|
"class-variance-authority": "^0.7.1",
|
50
45
|
"lucide-react": "^0.511.0",
|
51
|
-
"@windrun-huaiin/lib": "^
|
46
|
+
"@windrun-huaiin/lib": "^5.0.0"
|
52
47
|
},
|
53
48
|
"peerDependencies": {
|
54
|
-
"react": "19.
|
55
|
-
"react-dom": "19.
|
49
|
+
"react": "19.1.0",
|
50
|
+
"react-dom": "19.1.0",
|
56
51
|
"next": "15.3.2",
|
57
52
|
"next-intl": "^3.26.5",
|
58
53
|
"next-themes": "^0.4.6",
|
@@ -1,10 +1,13 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { NotFoundIcon } from "@base-ui/components/global-icon";
|
4
|
-
import {
|
5
|
-
import { useEffect, useState } from "react";
|
4
|
+
import { useEffect, useState, type ReactNode } from "react";
|
6
5
|
|
7
|
-
|
6
|
+
interface NotFoundPageProps {
|
7
|
+
siteIcon: ReactNode;
|
8
|
+
}
|
9
|
+
|
10
|
+
export function NotFoundPage({ siteIcon }: NotFoundPageProps) {
|
8
11
|
const [glitchText, setGlitchText] = useState("404");
|
9
12
|
|
10
13
|
// glitch effect
|
@@ -62,7 +65,7 @@ export function NotFoundPage() {
|
|
62
65
|
{/* decorative elements */}
|
63
66
|
<div className="flex justify-center items-center gap-8 pt-8 opacity-60">
|
64
67
|
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
65
|
-
|
68
|
+
{siteIcon}
|
66
69
|
<span>Woops!</span>
|
67
70
|
</div>
|
68
71
|
<div className="w-1 h-1 bg-purple-500 rounded-full animate-ping" />
|
package/src/components/index.ts
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
import { type LucideProps } from 'lucide-react';
|
2
|
+
import { cn } from '@lib/utils';
|
3
|
+
import { globalLucideIcons } from '@base-ui/components/global-icon';
|
4
|
+
import { themeIconColor } from '@base-ui/lib/theme-util';
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Create a SiteIcon component with specific configuration
|
8
|
+
* This function helps avoid React multi-instance issues by creating the icon component
|
9
|
+
* at the application level with explicit configuration
|
10
|
+
*/
|
11
|
+
export function createSiteIcon(iconConfig: string | React.ComponentType<LucideProps>) {
|
12
|
+
return function CreatedSiteIcon({
|
13
|
+
size = 24,
|
14
|
+
className,
|
15
|
+
...props
|
16
|
+
}: Omit<LucideProps, 'children'>) {
|
17
|
+
// render the icon, pass in the config value and attributes
|
18
|
+
if (typeof iconConfig === 'string') {
|
19
|
+
// string type: the key name of globalLucideIcons
|
20
|
+
if (iconConfig === '') {
|
21
|
+
// empty string use default icon
|
22
|
+
const DefaultIcon = globalLucideIcons['Download' as keyof typeof globalLucideIcons];
|
23
|
+
return <DefaultIcon size={size} className={cn(themeIconColor, className)} {...props} />;
|
24
|
+
}
|
25
|
+
const IconComponent = globalLucideIcons[iconConfig as keyof typeof globalLucideIcons];
|
26
|
+
if (!IconComponent) {
|
27
|
+
throw new Error(`[CreatedSiteIcon] Icon key "${iconConfig}" not found in globalLucideIcons.`);
|
28
|
+
}
|
29
|
+
return <IconComponent size={size} className={cn(themeIconColor, className)} {...props} />;
|
30
|
+
} else {
|
31
|
+
// React component type: custom icon component
|
32
|
+
const CustomIcon = iconConfig as React.ComponentType<LucideProps>;
|
33
|
+
const hasColorClass = className && /text-\w+/.test(className);
|
34
|
+
const finalClassName = hasColorClass ? className : cn(themeIconColor, className);
|
35
|
+
return <CustomIcon size={size} className={finalClassName} {...props} />;
|
36
|
+
}
|
37
|
+
};
|
38
|
+
}
|
package/src/index.ts
CHANGED
@@ -2,6 +2,4 @@
|
|
2
2
|
// ⚠️ IMPORTANT: Client components are NOT exported here to avoid server component contamination
|
3
3
|
// For client components, use: import { ... } from '@base-ui/components/client'
|
4
4
|
|
5
|
-
export * from './
|
6
|
-
export * from './components'; // Only server/universal components
|
7
|
-
export * from './lib';
|
5
|
+
export * from './components'; // Only server/universal components
|
package/dist/lib/index.d.mts
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { ComponentType, ReactNode } from 'react';
|
3
|
-
import { LucideProps } from 'lucide-react';
|
4
|
-
|
5
|
-
interface IconConfig {
|
6
|
-
siteIcon?: ComponentType | string;
|
7
|
-
}
|
8
|
-
interface IconConfigProviderProps {
|
9
|
-
config: IconConfig;
|
10
|
-
children: ReactNode;
|
11
|
-
}
|
12
|
-
/**
|
13
|
-
* IconConfigProvider - icon config provider based on React Context
|
14
|
-
* directly store the config value, without depending on module state
|
15
|
-
*/
|
16
|
-
declare function IconConfigProvider({ config, children }: IconConfigProviderProps): react_jsx_runtime.JSX.Element;
|
17
|
-
|
18
|
-
/**
|
19
|
-
* site icon component - client component
|
20
|
-
* based on React Context to get the config, solve the problem of cross-package module instance isolation
|
21
|
-
*/
|
22
|
-
declare function SiteIcon({ size, className, ...props }: Omit<LucideProps, 'children'>): react_jsx_runtime.JSX.Element;
|
23
|
-
|
24
|
-
export { type IconConfig, IconConfigProvider, SiteIcon };
|
package/dist/lib/index.d.ts
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { ComponentType, ReactNode } from 'react';
|
3
|
-
import { LucideProps } from 'lucide-react';
|
4
|
-
|
5
|
-
interface IconConfig {
|
6
|
-
siteIcon?: ComponentType | string;
|
7
|
-
}
|
8
|
-
interface IconConfigProviderProps {
|
9
|
-
config: IconConfig;
|
10
|
-
children: ReactNode;
|
11
|
-
}
|
12
|
-
/**
|
13
|
-
* IconConfigProvider - icon config provider based on React Context
|
14
|
-
* directly store the config value, without depending on module state
|
15
|
-
*/
|
16
|
-
declare function IconConfigProvider({ config, children }: IconConfigProviderProps): react_jsx_runtime.JSX.Element;
|
17
|
-
|
18
|
-
/**
|
19
|
-
* site icon component - client component
|
20
|
-
* based on React Context to get the config, solve the problem of cross-package module instance isolation
|
21
|
-
*/
|
22
|
-
declare function SiteIcon({ size, className, ...props }: Omit<LucideProps, 'children'>): react_jsx_runtime.JSX.Element;
|
23
|
-
|
24
|
-
export { type IconConfig, IconConfigProvider, SiteIcon };
|