@soybeanjs/unocss-shadcn 0.0.1
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 +3 -0
- package/dist/index.d.ts +117 -0
- package/dist/index.js +56 -0
- package/package.json +70 -0
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { DeepPartial, Preset } from "@unocss/core";
|
|
2
|
+
import { Theme } from "@unocss/preset-mini";
|
|
3
|
+
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
type HslColorString = `${number} ${number}% ${number}%`;
|
|
6
|
+
type ThemeCSSVars = {
|
|
7
|
+
background: HslColorString;
|
|
8
|
+
foreground: HslColorString;
|
|
9
|
+
card: HslColorString;
|
|
10
|
+
'card-foreground': HslColorString;
|
|
11
|
+
popover: HslColorString;
|
|
12
|
+
'popover-foreground': HslColorString;
|
|
13
|
+
primary: HslColorString;
|
|
14
|
+
'primary-foreground': HslColorString;
|
|
15
|
+
secondary: HslColorString;
|
|
16
|
+
'secondary-foreground': HslColorString;
|
|
17
|
+
muted: HslColorString;
|
|
18
|
+
'muted-foreground': HslColorString;
|
|
19
|
+
accent: HslColorString;
|
|
20
|
+
'accent-foreground': HslColorString;
|
|
21
|
+
destructive: HslColorString;
|
|
22
|
+
'destructive-foreground': HslColorString;
|
|
23
|
+
border: HslColorString;
|
|
24
|
+
input: HslColorString;
|
|
25
|
+
ring: HslColorString;
|
|
26
|
+
radius?: string;
|
|
27
|
+
};
|
|
28
|
+
type ThemeCSSVarKey = keyof ThemeCSSVars;
|
|
29
|
+
type FeedbackColorOfThemeCssVars = {
|
|
30
|
+
success: HslColorString;
|
|
31
|
+
'success-foreground': HslColorString;
|
|
32
|
+
warning: HslColorString;
|
|
33
|
+
'warning-foreground': HslColorString;
|
|
34
|
+
info: HslColorString;
|
|
35
|
+
'info-foreground': HslColorString;
|
|
36
|
+
carbon: HslColorString;
|
|
37
|
+
'carbon-foreground': HslColorString;
|
|
38
|
+
};
|
|
39
|
+
type FeedbackColorOfThemeCssVarKey = keyof FeedbackColorOfThemeCssVars;
|
|
40
|
+
type SidebarColorOfThemeCssVars = {
|
|
41
|
+
'sidebar-background': HslColorString;
|
|
42
|
+
'sidebar-foreground': HslColorString;
|
|
43
|
+
'sidebar-border': HslColorString;
|
|
44
|
+
'sidebar-ring': HslColorString;
|
|
45
|
+
'sidebar-primary': HslColorString;
|
|
46
|
+
'sidebar-primary-foreground': HslColorString;
|
|
47
|
+
'sidebar-accent': HslColorString;
|
|
48
|
+
'sidebar-accent-foreground': HslColorString;
|
|
49
|
+
};
|
|
50
|
+
interface ThemeCSSVarsVariant {
|
|
51
|
+
name: string;
|
|
52
|
+
light: ThemeCSSVars;
|
|
53
|
+
dark: ThemeCSSVars;
|
|
54
|
+
}
|
|
55
|
+
interface FeedbackColorOfThemeCssVarsVariant {
|
|
56
|
+
light: FeedbackColorOfThemeCssVars;
|
|
57
|
+
dark: FeedbackColorOfThemeCssVars;
|
|
58
|
+
}
|
|
59
|
+
interface SidebarColorOfThemeCssVarsVariant {
|
|
60
|
+
light: SidebarColorOfThemeCssVars;
|
|
61
|
+
dark: SidebarColorOfThemeCssVars;
|
|
62
|
+
}
|
|
63
|
+
type ThemeConfigColor = 'default' | 'zinc' | 'slate' | 'stone' | 'gray' | 'neutral' | 'red' | 'rose' | 'orange' | 'green' | 'blue' | 'yellow' | 'violet';
|
|
64
|
+
type ThemeConfig<T = ThemeConfigColor> = {
|
|
65
|
+
name: T;
|
|
66
|
+
label: string;
|
|
67
|
+
cssVars: {
|
|
68
|
+
light: ThemeCSSVars;
|
|
69
|
+
dark: ThemeCSSVars;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
type ColorOptions = ThemeConfigColor | ThemeCSSVarsVariant | ({
|
|
73
|
+
base: ThemeConfigColor;
|
|
74
|
+
} & DeepPartial<ThemeCSSVarsVariant>);
|
|
75
|
+
interface ThemeOptions {
|
|
76
|
+
/**
|
|
77
|
+
* theme color options
|
|
78
|
+
*
|
|
79
|
+
* @default 'default'
|
|
80
|
+
*/
|
|
81
|
+
color?: ColorOptions | false;
|
|
82
|
+
/** feedback color */
|
|
83
|
+
feedbackColor?: FeedbackColorOfThemeCssVarsVariant;
|
|
84
|
+
/** sidebar color */
|
|
85
|
+
sidebar?: SidebarColorOfThemeCssVarsVariant;
|
|
86
|
+
/**
|
|
87
|
+
* theme radius
|
|
88
|
+
*
|
|
89
|
+
* @default 0.5
|
|
90
|
+
*/
|
|
91
|
+
radius?: number | false;
|
|
92
|
+
/**
|
|
93
|
+
* dark theme selector
|
|
94
|
+
*
|
|
95
|
+
* @default '.dark'
|
|
96
|
+
*/
|
|
97
|
+
darkSelector?: string;
|
|
98
|
+
}
|
|
99
|
+
type PresetShadcnOptions = ThemeOptions | ThemeOptions[];
|
|
100
|
+
type ThemeColorKey = Extract<ThemeCSSVarKey, 'primary' | 'secondary' | 'destructive'> | Extract<FeedbackColorOfThemeCssVarKey, 'success' | 'warning' | 'info' | 'carbon'>;
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/generate.d.ts
|
|
103
|
+
declare function generateCSSVars(theme: PresetShadcnOptions, onlyOne?: boolean): string;
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/index.d.ts
|
|
106
|
+
declare const builtinColors: ThemeConfigColor[];
|
|
107
|
+
declare const builtinColorMap: Record<ThemeConfigColor, string>;
|
|
108
|
+
declare const builtinRadiuses: readonly [0, 0.3, 0.5, 0.75, 1];
|
|
109
|
+
/**
|
|
110
|
+
* The UnoCSS preset of shadcn style.
|
|
111
|
+
*
|
|
112
|
+
* @param options - The options for the preset.
|
|
113
|
+
* @param globals - Whether to generate global variables, like *.border-color, body.color, body.background.
|
|
114
|
+
*/
|
|
115
|
+
declare function presetShadcn(options?: PresetShadcnOptions, globals?: boolean): Preset<Theme>;
|
|
116
|
+
//#endregion
|
|
117
|
+
export { type PresetShadcnOptions, type ThemeColorKey, type ThemeConfig, type ThemeConfigColor, type ThemeOptions, builtinColorMap, builtinColors, builtinRadiuses, presetShadcn as default, presetShadcn, generateCSSVars };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import{mergeDeep as e}from"@unocss/core";import{generateTailwindPalette as t}from"@soybeanjs/color-palette";import{colord as n}from"colord";const r=[{name:`default`,label:`Default`,cssVars:{light:{background:`0 0% 100%`,foreground:`224 71.4% 4.1%`,card:`0 0% 100%`,"card-foreground":`224 71.4% 4.1%`,popover:`0 0% 100%`,"popover-foreground":`224 71.4% 4.1%`,primary:`236.9 100% 69.61%`,"primary-foreground":`0 0% 100%`,secondary:`229 20% 90%`,"secondary-foreground":`229 20% 30%`,muted:`220 14.3% 95.9%`,"muted-foreground":`220 8.9% 46.1%`,accent:`220 14.3% 95.9%`,"accent-foreground":`220.9 39.3% 11%`,destructive:`0 92.99% 56.11%`,"destructive-foreground":`0 0% 100%`,border:`220 13% 91%`,input:`220 13% 91%`,ring:`262.1 83.3% 57.8%`},dark:{background:`224 71.4% 4.1%`,foreground:`210 20% 98%`,card:`224 71.4% 4.1%`,"card-foreground":`210 20% 98%`,popover:`224 71.4% 4.1%`,"popover-foreground":`210 20% 98%`,primary:`236.9 100% 69.61%`,"primary-foreground":`0 0% 100%`,secondary:`229 14% 8%`,"secondary-foreground":`229 14% 68%`,muted:`215 27.9% 16.9%`,"muted-foreground":`217.9 10.6% 64.9%`,accent:`215 27.9% 16.9%`,"accent-foreground":`210 20% 98%`,destructive:`0 92.99% 56.11%`,"destructive-foreground":`0 0% 100%`,border:`215 27.9% 16.9%`,input:`215 27.9% 16.9%`,ring:`263.4 70% 50.4%`}}},{name:`zinc`,label:`Zinc`,cssVars:{light:{background:`0 0% 100%`,foreground:`240 10% 3.9%`,card:`0 0% 100%`,"card-foreground":`240 10% 3.9%`,popover:`0 0% 100%`,"popover-foreground":`240 10% 3.9%`,primary:`240 5.9% 10%`,"primary-foreground":`0 0% 98%`,secondary:`240 4.8% 95.9%`,"secondary-foreground":`240 5.9% 10%`,muted:`240 4.8% 95.9%`,"muted-foreground":`240 3.8% 46.1%`,accent:`240 4.8% 95.9%`,"accent-foreground":`240 5.9% 10%`,destructive:`0 84.2% 60.2%`,"destructive-foreground":`0 0% 98%`,border:`240 5.9% 90%`,input:`240 5.9% 90%`,ring:`240 5.9% 10%`,radius:`0.5rem`},dark:{background:`240 10% 3.9%`,foreground:`0 0% 98%`,card:`240 10% 3.9%`,"card-foreground":`0 0% 98%`,popover:`240 10% 3.9%`,"popover-foreground":`0 0% 98%`,primary:`0 0% 98%`,"primary-foreground":`240 5.9% 10%`,secondary:`240 3.7% 15.9%`,"secondary-foreground":`0 0% 98%`,muted:`240 3.7% 15.9%`,"muted-foreground":`240 5% 64.9%`,accent:`240 3.7% 15.9%`,"accent-foreground":`0 0% 98%`,destructive:`0 62.8% 30.6%`,"destructive-foreground":`0 0% 98%`,border:`240 3.7% 15.9%`,input:`240 3.7% 15.9%`,ring:`240 4.9% 83.9%`}}},{name:`slate`,label:`Slate`,cssVars:{light:{background:`0 0% 100%`,foreground:`222.2 84% 4.9%`,card:`0 0% 100%`,"card-foreground":`222.2 84% 4.9%`,popover:`0 0% 100%`,"popover-foreground":`222.2 84% 4.9%`,primary:`222.2 47.4% 11.2%`,"primary-foreground":`210 40% 98%`,secondary:`210 40% 96.1%`,"secondary-foreground":`222.2 47.4% 11.2%`,muted:`210 40% 96.1%`,"muted-foreground":`215.4 16.3% 46.9%`,accent:`210 40% 96.1%`,"accent-foreground":`222.2 47.4% 11.2%`,destructive:`0 84.2% 60.2%`,"destructive-foreground":`210 40% 98%`,border:`214.3 31.8% 91.4%`,input:`214.3 31.8% 91.4%`,ring:`222.2 84% 4.9%`,radius:`0.5rem`},dark:{background:`222.2 84% 4.9%`,foreground:`210 40% 98%`,card:`222.2 84% 4.9%`,"card-foreground":`210 40% 98%`,popover:`222.2 84% 4.9%`,"popover-foreground":`210 40% 98%`,primary:`210 40% 98%`,"primary-foreground":`222.2 47.4% 11.2%`,secondary:`217.2 32.6% 17.5%`,"secondary-foreground":`210 40% 98%`,muted:`217.2 32.6% 17.5%`,"muted-foreground":`215 20.2% 65.1%`,accent:`217.2 32.6% 17.5%`,"accent-foreground":`210 40% 98%`,destructive:`0 62.8% 30.6%`,"destructive-foreground":`210 40% 98%`,border:`217.2 32.6% 17.5%`,input:`217.2 32.6% 17.5%`,ring:`212.7 26.8% 83.9%`}}},{name:`stone`,label:`Stone`,cssVars:{light:{background:`0 0% 100%`,foreground:`20 14.3% 4.1%`,card:`0 0% 100%`,"card-foreground":`20 14.3% 4.1%`,popover:`0 0% 100%`,"popover-foreground":`20 14.3% 4.1%`,primary:`24 9.8% 10%`,"primary-foreground":`60 9.1% 97.8%`,secondary:`60 4.8% 95.9%`,"secondary-foreground":`24 9.8% 10%`,muted:`60 4.8% 95.9%`,"muted-foreground":`25 5.3% 44.7%`,accent:`60 4.8% 95.9%`,"accent-foreground":`24 9.8% 10%`,destructive:`0 84.2% 60.2%`,"destructive-foreground":`60 9.1% 97.8%`,border:`20 5.9% 90%`,input:`20 5.9% 90%`,ring:`20 14.3% 4.1%`,radius:`0.95rem`},dark:{background:`20 14.3% 4.1%`,foreground:`60 9.1% 97.8%`,card:`20 14.3% 4.1%`,"card-foreground":`60 9.1% 97.8%`,popover:`20 14.3% 4.1%`,"popover-foreground":`60 9.1% 97.8%`,primary:`60 9.1% 97.8%`,"primary-foreground":`24 9.8% 10%`,secondary:`12 6.5% 15.1%`,"secondary-foreground":`60 9.1% 97.8%`,muted:`12 6.5% 15.1%`,"muted-foreground":`24 5.4% 63.9%`,accent:`12 6.5% 15.1%`,"accent-foreground":`60 9.1% 97.8%`,destructive:`0 62.8% 30.6%`,"destructive-foreground":`60 9.1% 97.8%`,border:`12 6.5% 15.1%`,input:`12 6.5% 15.1%`,ring:`24 5.7% 82.9%`}}},{name:`gray`,label:`Gray`,cssVars:{light:{background:`0 0% 100%`,foreground:`224 71.4% 4.1%`,card:`0 0% 100%`,"card-foreground":`224 71.4% 4.1%`,popover:`0 0% 100%`,"popover-foreground":`224 71.4% 4.1%`,primary:`220.9 39.3% 11%`,"primary-foreground":`210 20% 98%`,secondary:`220 14.3% 95.9%`,"secondary-foreground":`220.9 39.3% 11%`,muted:`220 14.3% 95.9%`,"muted-foreground":`220 8.9% 46.1%`,accent:`220 14.3% 95.9%`,"accent-foreground":`220.9 39.3% 11%`,destructive:`0 84.2% 60.2%`,"destructive-foreground":`210 20% 98%`,border:`220 13% 91%`,input:`220 13% 91%`,ring:`224 71.4% 4.1%`,radius:`0.35rem`},dark:{background:`224 71.4% 4.1%`,foreground:`210 20% 98%`,card:`224 71.4% 4.1%`,"card-foreground":`210 20% 98%`,popover:`224 71.4% 4.1%`,"popover-foreground":`210 20% 98%`,primary:`210 20% 98%`,"primary-foreground":`220.9 39.3% 11%`,secondary:`215 27.9% 16.9%`,"secondary-foreground":`210 20% 98%`,muted:`215 27.9% 16.9%`,"muted-foreground":`217.9 10.6% 64.9%`,accent:`215 27.9% 16.9%`,"accent-foreground":`210 20% 98%`,destructive:`0 62.8% 30.6%`,"destructive-foreground":`210 20% 98%`,border:`215 27.9% 16.9%`,input:`215 27.9% 16.9%`,ring:`216 12.2% 83.9%`}}},{name:`neutral`,label:`Neutral`,cssVars:{light:{background:`0 0% 100%`,foreground:`0 0% 3.9%`,card:`0 0% 100%`,"card-foreground":`0 0% 3.9%`,popover:`0 0% 100%`,"popover-foreground":`0 0% 3.9%`,primary:`0 0% 9%`,"primary-foreground":`0 0% 98%`,secondary:`0 0% 96.1%`,"secondary-foreground":`0 0% 9%`,muted:`0 0% 96.1%`,"muted-foreground":`0 0% 45.1%`,accent:`0 0% 96.1%`,"accent-foreground":`0 0% 9%`,destructive:`0 84.2% 60.2%`,"destructive-foreground":`0 0% 98%`,border:`0 0% 89.8%`,input:`0 0% 89.8%`,ring:`0 0% 3.9%`},dark:{background:`0 0% 3.9%`,foreground:`0 0% 98%`,card:`0 0% 3.9%`,"card-foreground":`0 0% 98%`,popover:`0 0% 3.9%`,"popover-foreground":`0 0% 98%`,primary:`0 0% 98%`,"primary-foreground":`0 0% 9%`,secondary:`0 0% 14.9%`,"secondary-foreground":`0 0% 98%`,muted:`0 0% 14.9%`,"muted-foreground":`0 0% 63.9%`,accent:`0 0% 14.9%`,"accent-foreground":`0 0% 98%`,destructive:`0 62.8% 30.6%`,"destructive-foreground":`0 0% 98%`,border:`0 0% 14.9%`,input:`0 0% 14.9%`,ring:`0 0% 83.1%`}}},{name:`red`,label:`Red`,cssVars:{light:{background:`0 0% 100%`,foreground:`0 0% 3.9%`,card:`0 0% 100%`,"card-foreground":`0 0% 3.9%`,popover:`0 0% 100%`,"popover-foreground":`0 0% 3.9%`,primary:`0 72.2% 50.6%`,"primary-foreground":`0 85.7% 97.3%`,secondary:`0 0% 96.1%`,"secondary-foreground":`0 0% 9%`,muted:`0 0% 96.1%`,"muted-foreground":`0 0% 45.1%`,accent:`0 0% 96.1%`,"accent-foreground":`0 0% 9%`,destructive:`0 84.2% 60.2%`,"destructive-foreground":`0 0% 98%`,border:`0 0% 89.8%`,input:`0 0% 89.8%`,ring:`0 72.2% 50.6%`,radius:`0.4rem`},dark:{background:`0 0% 3.9%`,foreground:`0 0% 98%`,card:`0 0% 3.9%`,"card-foreground":`0 0% 98%`,popover:`0 0% 3.9%`,"popover-foreground":`0 0% 98%`,primary:`0 72.2% 50.6%`,"primary-foreground":`0 85.7% 97.3%`,secondary:`0 0% 14.9%`,"secondary-foreground":`0 0% 98%`,muted:`0 0% 14.9%`,"muted-foreground":`0 0% 63.9%`,accent:`0 0% 14.9%`,"accent-foreground":`0 0% 98%`,destructive:`0 62.8% 30.6%`,"destructive-foreground":`0 0% 98%`,border:`0 0% 14.9%`,input:`0 0% 14.9%`,ring:`0 72.2% 50.6%`}}},{name:`rose`,label:`Rose`,cssVars:{light:{background:`0 0% 100%`,foreground:`240 10% 3.9%`,card:`0 0% 100%`,"card-foreground":`240 10% 3.9%`,popover:`0 0% 100%`,"popover-foreground":`240 10% 3.9%`,primary:`346.8 77.2% 49.8%`,"primary-foreground":`355.7 100% 97.3%`,secondary:`240 4.8% 95.9%`,"secondary-foreground":`240 5.9% 10%`,muted:`240 4.8% 95.9%`,"muted-foreground":`240 3.8% 46.1%`,accent:`240 4.8% 95.9%`,"accent-foreground":`240 5.9% 10%`,destructive:`0 84.2% 60.2%`,"destructive-foreground":`0 0% 98%`,border:`240 5.9% 90%`,input:`240 5.9% 90%`,ring:`346.8 77.2% 49.8%`,radius:`0.5rem`},dark:{background:`20 14.3% 4.1%`,foreground:`0 0% 95%`,popover:`0 0% 9%`,"popover-foreground":`0 0% 95%`,card:`24 9.8% 10%`,"card-foreground":`0 0% 95%`,primary:`346.8 77.2% 49.8%`,"primary-foreground":`355.7 100% 97.3%`,secondary:`240 3.7% 15.9%`,"secondary-foreground":`0 0% 98%`,muted:`0 0% 15%`,"muted-foreground":`240 5% 64.9%`,accent:`12 6.5% 15.1%`,"accent-foreground":`0 0% 98%`,destructive:`0 62.8% 30.6%`,"destructive-foreground":`0 85.7% 97.3%`,border:`240 3.7% 15.9%`,input:`240 3.7% 15.9%`,ring:`346.8 77.2% 49.8%`}}},{name:`orange`,label:`Orange`,cssVars:{light:{background:`0 0% 100%`,foreground:`20 14.3% 4.1%`,card:`0 0% 100%`,"card-foreground":`20 14.3% 4.1%`,popover:`0 0% 100%`,"popover-foreground":`20 14.3% 4.1%`,primary:`24.6 95% 53.1%`,"primary-foreground":`60 9.1% 97.8%`,secondary:`60 4.8% 95.9%`,"secondary-foreground":`24 9.8% 10%`,muted:`60 4.8% 95.9%`,"muted-foreground":`25 5.3% 44.7%`,accent:`60 4.8% 95.9%`,"accent-foreground":`24 9.8% 10%`,destructive:`0 84.2% 60.2%`,"destructive-foreground":`60 9.1% 97.8%`,border:`20 5.9% 90%`,input:`20 5.9% 90%`,ring:`24.6 95% 53.1%`,radius:`0.95rem`},dark:{background:`20 14.3% 4.1%`,foreground:`60 9.1% 97.8%`,card:`20 14.3% 4.1%`,"card-foreground":`60 9.1% 97.8%`,popover:`20 14.3% 4.1%`,"popover-foreground":`60 9.1% 97.8%`,primary:`20.5 90.2% 48.2%`,"primary-foreground":`60 9.1% 97.8%`,secondary:`12 6.5% 15.1%`,"secondary-foreground":`60 9.1% 97.8%`,muted:`12 6.5% 15.1%`,"muted-foreground":`24 5.4% 63.9%`,accent:`12 6.5% 15.1%`,"accent-foreground":`60 9.1% 97.8%`,destructive:`0 72.2% 50.6%`,"destructive-foreground":`60 9.1% 97.8%`,border:`12 6.5% 15.1%`,input:`12 6.5% 15.1%`,ring:`20.5 90.2% 48.2%`}}},{name:`green`,label:`Green`,cssVars:{light:{background:`0 0% 100%`,foreground:`240 10% 3.9%`,card:`0 0% 100%`,"card-foreground":`240 10% 3.9%`,popover:`0 0% 100%`,"popover-foreground":`240 10% 3.9%`,primary:`142.1 76.2% 36.3%`,"primary-foreground":`355.7 100% 97.3%`,secondary:`240 4.8% 95.9%`,"secondary-foreground":`240 5.9% 10%`,muted:`240 4.8% 95.9%`,"muted-foreground":`240 3.8% 46.1%`,accent:`240 4.8% 95.9%`,"accent-foreground":`240 5.9% 10%`,destructive:`0 84.2% 60.2%`,"destructive-foreground":`0 0% 98%`,border:`240 5.9% 90%`,input:`240 5.9% 90%`,ring:`142.1 76.2% 36.3%`},dark:{background:`20 14.3% 4.1%`,foreground:`0 0% 95%`,popover:`0 0% 9%`,"popover-foreground":`0 0% 95%`,card:`24 9.8% 10%`,"card-foreground":`0 0% 95%`,primary:`142.1 70.6% 45.3%`,"primary-foreground":`144.9 80.4% 10%`,secondary:`240 3.7% 15.9%`,"secondary-foreground":`0 0% 98%`,muted:`0 0% 15%`,"muted-foreground":`240 5% 64.9%`,accent:`12 6.5% 15.1%`,"accent-foreground":`0 0% 98%`,destructive:`0 62.8% 30.6%`,"destructive-foreground":`0 85.7% 97.3%`,border:`240 3.7% 15.9%`,input:`240 3.7% 15.9%`,ring:`142.4 71.8% 29.2%`}}},{name:`blue`,label:`Blue`,cssVars:{light:{background:`0 0% 100%`,foreground:`222.2 84% 4.9%`,card:`0 0% 100%`,"card-foreground":`222.2 84% 4.9%`,popover:`0 0% 100%`,"popover-foreground":`222.2 84% 4.9%`,primary:`221.2 83.2% 53.3%`,"primary-foreground":`210 40% 98%`,secondary:`210 40% 96.1%`,"secondary-foreground":`222.2 47.4% 11.2%`,muted:`210 40% 96.1%`,"muted-foreground":`215.4 16.3% 46.9%`,accent:`210 40% 96.1%`,"accent-foreground":`222.2 47.4% 11.2%`,destructive:`0 84.2% 60.2%`,"destructive-foreground":`210 40% 98%`,border:`214.3 31.8% 91.4%`,input:`214.3 31.8% 91.4%`,ring:`221.2 83.2% 53.3%`},dark:{background:`222.2 84% 4.9%`,foreground:`210 40% 98%`,card:`222.2 84% 4.9%`,"card-foreground":`210 40% 98%`,popover:`222.2 84% 4.9%`,"popover-foreground":`210 40% 98%`,primary:`217.2 91.2% 59.8%`,"primary-foreground":`222.2 47.4% 11.2%`,secondary:`217.2 32.6% 17.5%`,"secondary-foreground":`210 40% 98%`,muted:`217.2 32.6% 17.5%`,"muted-foreground":`215 20.2% 65.1%`,accent:`217.2 32.6% 17.5%`,"accent-foreground":`210 40% 98%`,destructive:`0 62.8% 30.6%`,"destructive-foreground":`210 40% 98%`,border:`217.2 32.6% 17.5%`,input:`217.2 32.6% 17.5%`,ring:`224.3 76.3% 48%`}}},{name:`yellow`,label:`Yellow`,cssVars:{light:{background:`0 0% 100%`,foreground:`20 14.3% 4.1%`,card:`0 0% 100%`,"card-foreground":`20 14.3% 4.1%`,popover:`0 0% 100%`,"popover-foreground":`20 14.3% 4.1%`,primary:`47.9 95.8% 53.1%`,"primary-foreground":`26 83.3% 14.1%`,secondary:`60 4.8% 95.9%`,"secondary-foreground":`24 9.8% 10%`,muted:`60 4.8% 95.9%`,"muted-foreground":`25 5.3% 44.7%`,accent:`60 4.8% 95.9%`,"accent-foreground":`24 9.8% 10%`,destructive:`0 84.2% 60.2%`,"destructive-foreground":`60 9.1% 97.8%`,border:`20 5.9% 90%`,input:`20 5.9% 90%`,ring:`20 14.3% 4.1%`,radius:`0.95rem`},dark:{background:`20 14.3% 4.1%`,foreground:`60 9.1% 97.8%`,card:`20 14.3% 4.1%`,"card-foreground":`60 9.1% 97.8%`,popover:`20 14.3% 4.1%`,"popover-foreground":`60 9.1% 97.8%`,primary:`47.9 95.8% 53.1%`,"primary-foreground":`26 83.3% 14.1%`,secondary:`12 6.5% 15.1%`,"secondary-foreground":`60 9.1% 97.8%`,muted:`12 6.5% 15.1%`,"muted-foreground":`24 5.4% 63.9%`,accent:`12 6.5% 15.1%`,"accent-foreground":`60 9.1% 97.8%`,destructive:`0 62.8% 30.6%`,"destructive-foreground":`60 9.1% 97.8%`,border:`12 6.5% 15.1%`,input:`12 6.5% 15.1%`,ring:`35.5 91.7% 32.9%`}}},{name:`violet`,label:`Violet`,cssVars:{light:{background:`0 0% 100%`,foreground:`224 71.4% 4.1%`,card:`0 0% 100%`,"card-foreground":`224 71.4% 4.1%`,popover:`0 0% 100%`,"popover-foreground":`224 71.4% 4.1%`,primary:`262.1 83.3% 57.8%`,"primary-foreground":`210 20% 98%`,secondary:`220 14.3% 95.9%`,"secondary-foreground":`220.9 39.3% 11%`,muted:`220 14.3% 95.9%`,"muted-foreground":`220 8.9% 46.1%`,accent:`220 14.3% 95.9%`,"accent-foreground":`220.9 39.3% 11%`,destructive:`0 84.2% 60.2%`,"destructive-foreground":`210 20% 98%`,border:`220 13% 91%`,input:`220 13% 91%`,ring:`262.1 83.3% 57.8%`},dark:{background:`224 71.4% 4.1%`,foreground:`210 20% 98%`,card:`224 71.4% 4.1%`,"card-foreground":`210 20% 98%`,popover:`224 71.4% 4.1%`,"popover-foreground":`210 20% 98%`,primary:`263.4 70% 50.4%`,"primary-foreground":`210 20% 98%`,secondary:`215 27.9% 16.9%`,"secondary-foreground":`210 20% 98%`,muted:`215 27.9% 16.9%`,"muted-foreground":`217.9 10.6% 64.9%`,accent:`215 27.9% 16.9%`,"accent-foreground":`210 20% 98%`,destructive:`0 62.8% 30.6%`,"destructive-foreground":`210 20% 98%`,border:`215 27.9% 16.9%`,input:`215 27.9% 16.9%`,ring:`263.4 70% 50.4%`}}}],i=`background.foreground.card.card-foreground.popover.popover-foreground.primary.primary-foreground.destructive.destructive-foreground.success.success-foreground.warning.warning-foreground.info.info-foreground.secondary.secondary-foreground.carbon.carbon-foreground.muted.muted-foreground.accent.accent-foreground.border.input.ring.sidebar-background.sidebar-foreground.sidebar-border.sidebar-ring.sidebar-primary.sidebar-primary-foreground.sidebar-accent.sidebar-accent-foreground`.split(`.`),a=[`primary`,`destructive`,`success`,`warning`,`info`,`carbon`];function o(e){return Object.entries(e).map(([e,r])=>{let o=e;if(!i.includes(o))return``;let s=` --${o}: ${r};`;if(a.includes(o)){let e=t(`hsl(${r.split(` `).join(`, `)})`);for(let[t,r]of Object.entries(e)){let{h:e,s:i,l:a}=n(r).toHsl();s+=`\n --${o}-${t}: ${e} ${i}% ${a}%;`}}return s}).filter(Boolean).join(`
|
|
2
|
+
`)}function s(e,t,n){let{darkSelector:r,radius:i,themeName:a}=n,o=a&&a!==`default`;return`
|
|
3
|
+
${o?`.theme-${a}`:`:root`} {
|
|
4
|
+
${e}
|
|
5
|
+
${i||i===0?c(i):``}
|
|
6
|
+
}
|
|
7
|
+
${o?`.theme-${a}${r}`:r} {
|
|
8
|
+
${t}
|
|
9
|
+
}`}function c(e){return` --radius: ${e}rem;`}function l(e){return`
|
|
10
|
+
:root {
|
|
11
|
+
${c(e)}
|
|
12
|
+
}
|
|
13
|
+
`}function u(){return`
|
|
14
|
+
* {
|
|
15
|
+
border-color: hsl(var(--border));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
body {
|
|
19
|
+
color: hsl(var(--foreground));
|
|
20
|
+
background: hsl(var(--background));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.lucide {
|
|
24
|
+
width: 1.25em;
|
|
25
|
+
height: 1.25em;
|
|
26
|
+
}
|
|
27
|
+
`}function d(e){let t=r.find(t=>t.name===e);if(!t)throw Error(`Unknown color: ${e}`);return{name:e,...t.cssVars}}function f(t){let n,r,i;return typeof t==`string`?(i=t,{light:n,dark:r}=d(t)):`base`in t?(i=t.base,{light:n,dark:r}=e(d(t.base),t)):(i=t.name,{light:n,dark:r}=t),{light:n,dark:r,name:i}}function p(){return{light:{success:`140 79% 45%`,"success-foreground":`0 0% 100%`,warning:`37 91% 55%`,"warning-foreground":`0 0% 100%`,info:`215 100% 54%`,"info-foreground":`0 0% 100%`,carbon:`240 4% 16%`,"carbon-foreground":`0 0% 98%`},dark:{success:`140 79% 45%`,"success-foreground":`0 0% 100%`,warning:`37 91% 55%`,"warning-foreground":`0 0% 100%`,info:`215 100% 54%`,"info-foreground":`0 0% 100%`,carbon:`220 14.3% 95.9%`,"carbon-foreground":`220.9 39.3% 11%`}}}function m(){return{light:{"sidebar-background":`0 0% 98%`,"sidebar-foreground":`240 5.3% 26.1%`,"sidebar-primary":`236.9 100% 69.61%`,"sidebar-primary-foreground":`0 0% 98%`,"sidebar-accent":`240 4.8% 95.9%`,"sidebar-accent-foreground":`240 5.9% 10%`,"sidebar-border":`220 13% 91%`,"sidebar-ring":`217.2 91.2% 59.8%`},dark:{"sidebar-background":`240 5.9% 10%`,"sidebar-foreground":`240 4.8% 95.9%`,"sidebar-primary":`236.9 100% 69.61%`,"sidebar-primary-foreground":`0 0% 100%`,"sidebar-accent":`240 3.7% 15.9%`,"sidebar-accent-foreground":`240 4.8% 95.9%`,"sidebar-border":`240 3.7% 15.9%`,"sidebar-ring":`217.2 91.2% 59.8%`}}}function h(e,t=!0){if(Array.isArray(e))return e.map(e=>h(e,!1)).join(`
|
|
28
|
+
`);let{color:n=`default`,radius:r=.5,darkSelector:i=`.dark`,feedbackColor:a=p(),sidebar:c=m()}=e,u=``;if(!n)r&&(u+=l(r));else{let{light:e,dark:l,name:d}=f(n),p=o({...e,...a.light,...c.light}),m=o({...l,...a.dark,...c.dark});u+=s(p,m,{radius:r,themeName:!t&&d,darkSelector:i})}return u}const g=r.map(e=>e.name),_=r.reduce((e,t)=>(e[t.name]=t.cssVars.light.primary,e),{}),v=[0,.3,.5,.75,1];function y(e={},t=!0){return{name:`unocss-preset-soybean-ui`,preflights:[{getCSS:()=>`
|
|
29
|
+
@keyframes shadcn-down { from{ height: 0 } to { height: var(--soybean-accordion-content-height)} }
|
|
30
|
+
@keyframes shadcn-up { from{ height: var(--soybean-accordion-content-height)} to { height: 0 } }
|
|
31
|
+
@keyframes shadcn-collapsible-down { from{ height: 0 } to { height: var(--soybean-collapsible-content-height)} }
|
|
32
|
+
@keyframes shadcn-collapsible-up { from{ height: var(--soybean-collapsible-content-height)} to { height: 0 } }
|
|
33
|
+
|
|
34
|
+
${h(e)}
|
|
35
|
+
|
|
36
|
+
${t?u():``}
|
|
37
|
+
`},{getCSS:()=>`
|
|
38
|
+
html.size-xs {
|
|
39
|
+
font-size: 12px;
|
|
40
|
+
}
|
|
41
|
+
html.size-sm {
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
}
|
|
44
|
+
html.size-md {
|
|
45
|
+
font-size: 16px;
|
|
46
|
+
}
|
|
47
|
+
html.size-lg {
|
|
48
|
+
font-size: 18px;
|
|
49
|
+
}
|
|
50
|
+
html.size-xl {
|
|
51
|
+
font-size: 20px;
|
|
52
|
+
}
|
|
53
|
+
html.size-2xl {
|
|
54
|
+
font-size: 24px;
|
|
55
|
+
}
|
|
56
|
+
`}],rules:[[`animate-accordion-down`,{animation:`shadcn-down 0.2s ease-out`}],[`animate-accordion-up`,{animation:`shadcn-up 0.2s ease-out`}],[`animate-collapsible-down`,{animation:`shadcn-collapsible-down 0.2s ease-out`}],[`animate-collapsible-up`,{animation:`shadcn-collapsible-up 0.2s ease-out`}]],theme:{colors:{border:`hsl(var(--border))`,input:`hsl(var(--input))`,ring:`hsl(var(--ring))`,background:`hsl(var(--background))`,foreground:`hsl(var(--foreground))`,primary:{DEFAULT:`hsl(var(--primary))`,foreground:`hsl(var(--primary-foreground))`,50:`hsl(var(--primary-50))`,100:`hsl(var(--primary-100))`,200:`hsl(var(--primary-200))`,300:`hsl(var(--primary-300))`,400:`hsl(var(--primary-400))`,500:`hsl(var(--primary-500))`,600:`hsl(var(--primary-600))`,700:`hsl(var(--primary-700))`,800:`hsl(var(--primary-800))`,900:`hsl(var(--primary-900))`,950:`hsl(var(--primary-950))`},destructive:{DEFAULT:`hsl(var(--destructive))`,foreground:`hsl(var(--destructive-foreground))`,50:`hsl(var(--destructive-50))`,100:`hsl(var(--destructive-100))`,200:`hsl(var(--destructive-200))`,300:`hsl(var(--destructive-300))`,400:`hsl(var(--destructive-400))`,500:`hsl(var(--destructive-500))`,600:`hsl(var(--destructive-600))`,700:`hsl(var(--destructive-700))`,800:`hsl(var(--destructive-800))`,900:`hsl(var(--destructive-900))`,950:`hsl(var(--destructive-950))`},success:{DEFAULT:`hsl(var(--success))`,foreground:`hsl(var(--success-foreground))`,50:`hsl(var(--success-50))`,100:`hsl(var(--success-100))`,200:`hsl(var(--success-200))`,300:`hsl(var(--success-300))`,400:`hsl(var(--success-400))`,500:`hsl(var(--success-500))`,600:`hsl(var(--success-600))`,700:`hsl(var(--success-700))`,800:`hsl(var(--success-800))`,900:`hsl(var(--success-900))`,950:`hsl(var(--success-950))`},warning:{DEFAULT:`hsl(var(--warning))`,foreground:`hsl(var(--warning-foreground))`,50:`hsl(var(--warning-50))`,100:`hsl(var(--warning-100))`,200:`hsl(var(--warning-200))`,300:`hsl(var(--warning-300))`,400:`hsl(var(--warning-400))`,500:`hsl(var(--warning-500))`,600:`hsl(var(--warning-600))`,700:`hsl(var(--warning-700))`,800:`hsl(var(--warning-800))`,900:`hsl(var(--warning-900))`,950:`hsl(var(--warning-950))`},info:{DEFAULT:`hsl(var(--info))`,foreground:`hsl(var(--info-foreground))`,50:`hsl(var(--info-50))`,100:`hsl(var(--info-100))`,200:`hsl(var(--info-200))`,300:`hsl(var(--info-300))`,400:`hsl(var(--info-400))`,500:`hsl(var(--info-500))`,600:`hsl(var(--info-600))`,700:`hsl(var(--info-700))`,800:`hsl(var(--info-800))`,900:`hsl(var(--info-900))`,950:`hsl(var(--info-950))`},carbon:{DEFAULT:`hsl(var(--carbon))`,foreground:`hsl(var(--carbon-foreground))`,50:`hsl(var(--carbon-50))`,100:`hsl(var(--carbon-100))`,200:`hsl(var(--carbon-200))`,300:`hsl(var(--carbon-300))`,400:`hsl(var(--carbon-400))`,500:`hsl(var(--carbon-500))`,600:`hsl(var(--carbon-600))`,700:`hsl(var(--carbon-700))`,800:`hsl(var(--carbon-800))`,900:`hsl(var(--carbon-900))`,950:`hsl(var(--carbon-950))`},secondary:{DEFAULT:`hsl(var(--secondary))`,foreground:`hsl(var(--secondary-foreground))`},muted:{DEFAULT:`hsl(var(--muted))`,foreground:`hsl(var(--muted-foreground))`},accent:{DEFAULT:`hsl(var(--accent))`,foreground:`hsl(var(--accent-foreground))`},popover:{DEFAULT:`hsl(var(--popover))`,foreground:`hsl(var(--popover-foreground))`},card:{DEFAULT:`hsl(var(--card))`,foreground:`hsl(var(--card-foreground))`},"sidebar-background":`hsl(var(--sidebar-background))`,"sidebar-foreground":`hsl(var(--sidebar-foreground))`,"sidebar-border":`hsl(var(--sidebar-border))`,"sidebar-ring":`hsl(var(--sidebar-ring))`,"sidebar-primary":`hsl(var(--sidebar-primary))`,"sidebar-primary-foreground":`hsl(var(--sidebar-primary-foreground))`,"sidebar-accent":`hsl(var(--sidebar-accent))`,"sidebar-accent-foreground":`hsl(var(--sidebar-accent-foreground))`},borderRadius:{xl:`calc(var(--radius) + 4px)`,lg:`var(--radius)`,md:`calc(var(--radius) - 2px)`,sm:`calc(var(--radius) - 4px)`},fontSize:{"4xs":[`0.375rem`,`0.5rem`],"3xs":[`0.5rem`,`0.625rem`],"2xs":[`0.625rem`,`0.75rem`]}}}}var b=y;export{_ as builtinColorMap,g as builtinColors,v as builtinRadiuses,b as default,h as generateCSSVars,y as presetShadcn};
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@soybeanjs/unocss-shadcn",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"description": "unocss preset for Soybean UI",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Soybean",
|
|
8
|
+
"email": "soybeanjs@outlook.com",
|
|
9
|
+
"url": "https://github.com/soybeanjs"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"homepage": "https://github.com/soybeanjs/unocss-shadcn",
|
|
13
|
+
"repository": {
|
|
14
|
+
"url": "https://github.com/soybeanjs/unocss-shadcn.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/soybeanjs/unocss-shadcn/issues"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"registry": "https://registry.npmjs.org/"
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js",
|
|
26
|
+
"require": "./dist/index.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"main": "dist/index.js",
|
|
30
|
+
"module": "dist/index.js",
|
|
31
|
+
"types": "dist/index.d.ts",
|
|
32
|
+
"files": [
|
|
33
|
+
"dist"
|
|
34
|
+
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@soybeanjs/color-palette": "^0.2.1",
|
|
37
|
+
"@unocss/core": "^66.5.4",
|
|
38
|
+
"@unocss/preset-mini": "^66.5.4",
|
|
39
|
+
"colord": "^2.9.3"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@soybeanjs/cli": "1.4.1",
|
|
43
|
+
"@soybeanjs/eslint-config": "1.7.1",
|
|
44
|
+
"@types/node": "24.10.0",
|
|
45
|
+
"eslint": "9.39.1",
|
|
46
|
+
"lint-staged": "16.2.6",
|
|
47
|
+
"simple-git-hooks": "2.13.1",
|
|
48
|
+
"tsdown": "0.16.0",
|
|
49
|
+
"tsx": "4.20.6",
|
|
50
|
+
"typescript": "5.9.3"
|
|
51
|
+
},
|
|
52
|
+
"simple-git-hooks": {
|
|
53
|
+
"commit-msg": "pnpm soy git-commit-verify",
|
|
54
|
+
"pre-commit": "pnpm typecheck && pnpm lint-staged"
|
|
55
|
+
},
|
|
56
|
+
"lint-staged": {
|
|
57
|
+
"*": "eslint --fix"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "tsdown",
|
|
61
|
+
"cleanup": "soy cleanup",
|
|
62
|
+
"commit": "soy git-commit",
|
|
63
|
+
"dev": "tsdown",
|
|
64
|
+
"lint": "eslint . --fix",
|
|
65
|
+
"publish-pkg": "pnpm publish --access public",
|
|
66
|
+
"release": "soy release",
|
|
67
|
+
"typecheck": "tsc --noEmit --skipLibCheck",
|
|
68
|
+
"update-pkg": "soy ncu"
|
|
69
|
+
}
|
|
70
|
+
}
|