@veltra/styles 1.0.15 → 2.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/_mixins.scss CHANGED
@@ -74,6 +74,18 @@
74
74
  }
75
75
  }
76
76
 
77
+ @mixin is-not($types...) {
78
+ $selector: '&';
79
+
80
+ @each $type in $types {
81
+ $selector: '#{$selector}:not(.is-#{$type})';
82
+ }
83
+
84
+ #{$selector} {
85
+ @content;
86
+ }
87
+ }
88
+
77
89
  @mixin bem($b, $e: null, $m: null) {
78
90
  $b: '.' + vars.$namespace + $b;
79
91
 
@@ -19,8 +19,8 @@ const darkTheme = lightTheme.new({
19
19
  black: "#000000"
20
20
  },
21
21
  filter: {
22
- blur: "blur(16px)",
23
- saturate: "saturate(180%)"
22
+ blur: "none",
23
+ saturate: "none"
24
24
  }
25
25
  },
26
26
  "text-color": {
@@ -38,7 +38,8 @@ const darkTheme = lightTheme.new({
38
38
  x: 0,
39
39
  y: 2,
40
40
  blur: 8,
41
- spread: 0
41
+ spread: 0,
42
+ emboss: "none"
42
43
  }
43
44
  });
44
45
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"dark.js","names":[],"sources":["../../src/theme/dark.ts"],"sourcesContent":["import { lightTheme } from './light'\n\nexport const darkTheme = lightTheme.new({\n color: {\n primary: '#4f8ff7',\n success: '#52c41a',\n warning: '#faad14',\n danger: '#ff4d4f',\n info: '#13c2c2',\n disabled: '#212020',\n default: '#595959'\n },\n\n bg: {\n color: {\n bottom: '#0f0f0f',\n middle: '#1a1a1a',\n top: '#262626',\n hover: '#303030',\n black: '#000000'\n },\n filter: { blur: 'blur(16px)', saturate: 'saturate(180%)' }\n },\n\n 'text-color': {\n title: '#f0f0f0',\n main: '#d9d9d9',\n second: '#a6a6a6',\n placeholder: '#737373',\n assist: '#595959',\n disabled: '#434343',\n white: '#ffffff'\n },\n\n border: { color: '#404040' },\n\n shadow: { color: 'rgba(255, 255, 255, 0.2)', x: 0, y: 2, blur: 8, spread: 0 }\n})\n"],"mappings":";;AAEA,MAAa,YAAY,WAAW,IAAI;CACtC,OAAO;EACL,SAAS;EACT,SAAS;EACT,SAAS;EACT,QAAQ;EACR,MAAM;EACN,UAAU;EACV,SAAS;EACV;CAED,IAAI;EACF,OAAO;GACL,QAAQ;GACR,QAAQ;GACR,KAAK;GACL,OAAO;GACP,OAAO;GACR;EACD,QAAQ;GAAE,MAAM;GAAc,UAAU;GAAkB;EAC3D;CAED,cAAc;EACZ,OAAO;EACP,MAAM;EACN,QAAQ;EACR,aAAa;EACb,QAAQ;EACR,UAAU;EACV,OAAO;EACR;CAED,QAAQ,EAAE,OAAO,WAAW;CAE5B,QAAQ;EAAE,OAAO;EAA4B,GAAG;EAAG,GAAG;EAAG,MAAM;EAAG,QAAQ;EAAG;CAC9E,CAAC"}
1
+ {"version":3,"file":"dark.js","names":[],"sources":["../../src/theme/dark.ts"],"sourcesContent":["import { lightTheme } from './light'\n\nexport const darkTheme = lightTheme.new({\n color: {\n primary: '#4f8ff7',\n success: '#52c41a',\n warning: '#faad14',\n danger: '#ff4d4f',\n info: '#13c2c2',\n disabled: '#212020',\n default: '#595959'\n },\n\n bg: {\n color: {\n bottom: '#0f0f0f',\n middle: '#1a1a1a',\n top: '#262626',\n hover: '#303030',\n black: '#000000'\n },\n filter: { blur: 'none', saturate: 'none' }\n },\n\n 'text-color': {\n title: '#f0f0f0',\n main: '#d9d9d9',\n second: '#a6a6a6',\n placeholder: '#737373',\n assist: '#595959',\n disabled: '#434343',\n white: '#ffffff'\n },\n\n border: { color: '#404040' },\n\n shadow: { color: 'rgba(255, 255, 255, 0.2)', x: 0, y: 2, blur: 8, spread: 0, emboss: 'none' }\n})\n"],"mappings":";;AAEA,MAAa,YAAY,WAAW,IAAI;CACtC,OAAO;EACL,SAAS;EACT,SAAS;EACT,SAAS;EACT,QAAQ;EACR,MAAM;EACN,UAAU;EACV,SAAS;EACV;CAED,IAAI;EACF,OAAO;GACL,QAAQ;GACR,QAAQ;GACR,KAAK;GACL,OAAO;GACP,OAAO;GACR;EACD,QAAQ;GAAE,MAAM;GAAQ,UAAU;GAAQ;EAC3C;CAED,cAAc;EACZ,OAAO;EACP,MAAM;EACN,QAAQ;EACR,aAAa;EACb,QAAQ;EACR,UAAU;EACV,OAAO;EACR;CAED,QAAQ,EAAE,OAAO,WAAW;CAE5B,QAAQ;EAAE,OAAO;EAA4B,GAAG;EAAG,GAAG;EAAG,MAAM;EAAG,QAAQ;EAAG,QAAQ;EAAQ;CAC9F,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { UITheme } from "./ui-theme.js";
2
+
3
+ //#region src/theme/glass.d.ts
4
+ declare const glassLightTheme: UITheme;
5
+ declare const glassDarkTheme: UITheme;
6
+ //#endregion
7
+ export { glassDarkTheme, glassLightTheme };
8
+ //# sourceMappingURL=glass.d.ts.map
@@ -0,0 +1,89 @@
1
+ import { lightTheme } from "./light.js";
2
+ //#region src/theme/glass.ts
3
+ const glassLightTheme = lightTheme.new({
4
+ color: {
5
+ primary: "#3B82F6",
6
+ success: "#10B981",
7
+ warning: "#F59E0B",
8
+ danger: "#EF4444",
9
+ info: "#06B6D4",
10
+ disabled: "#E5E7EB",
11
+ default: "#F3F4F6"
12
+ },
13
+ bg: {
14
+ color: {
15
+ bottom: "rgba(255, 255, 255, 0.45)",
16
+ middle: "rgba(255, 255, 255, 0.55)",
17
+ top: "rgba(255, 255, 255, 0.6)",
18
+ hover: "rgba(255, 255, 255, 0.75)",
19
+ black: "#000000"
20
+ },
21
+ filter: {
22
+ blur: "blur(24px)",
23
+ saturate: "saturate(180%)"
24
+ }
25
+ },
26
+ border: {
27
+ color: "rgba(255, 255, 255, 0.5)",
28
+ width: 1,
29
+ style: "solid"
30
+ },
31
+ "text-color": {
32
+ title: "#1E293B",
33
+ main: "#334155",
34
+ placeholder: "#94A3B8",
35
+ second: "#64748B",
36
+ assist: "#CBD5E1",
37
+ disabled: "#94A3B8",
38
+ white: "#FFFFFF"
39
+ },
40
+ shadow: {
41
+ color: "rgba(0, 0, 0, 0.08)",
42
+ x: 0,
43
+ y: 4,
44
+ blur: 24,
45
+ spread: 0,
46
+ emboss: "none"
47
+ }
48
+ });
49
+ const glassDarkTheme = glassLightTheme.new({
50
+ color: {
51
+ disabled: "#374151",
52
+ default: "#1E293B"
53
+ },
54
+ bg: {
55
+ color: {
56
+ bottom: "rgba(15, 23, 42, 0.6)",
57
+ middle: "rgba(15, 23, 42, 0.7)",
58
+ top: "rgba(15, 23, 42, 0.75)",
59
+ hover: "rgba(30, 41, 59, 0.85)",
60
+ black: "#000000"
61
+ },
62
+ filter: {
63
+ blur: "blur(20px)",
64
+ saturate: "saturate(200%)"
65
+ }
66
+ },
67
+ border: { color: "rgba(255, 255, 255, 0.12)" },
68
+ "text-color": {
69
+ title: "#F8FAFC",
70
+ main: "#F1F5F9",
71
+ second: "#94A3B8",
72
+ placeholder: "#64748B",
73
+ assist: "#64748B",
74
+ disabled: "#475569",
75
+ white: "#ffffff"
76
+ },
77
+ shadow: {
78
+ color: "rgba(0, 0, 0, 0.35)",
79
+ x: 0,
80
+ y: 4,
81
+ blur: 32,
82
+ spread: 0,
83
+ emboss: "none"
84
+ }
85
+ });
86
+ //#endregion
87
+ export { glassDarkTheme, glassLightTheme };
88
+
89
+ //# sourceMappingURL=glass.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glass.js","names":[],"sources":["../../src/theme/glass.ts"],"sourcesContent":["import { lightTheme } from './light'\n\nexport const glassLightTheme = lightTheme.new({\n color: {\n primary: '#3B82F6',\n success: '#10B981',\n warning: '#F59E0B',\n danger: '#EF4444',\n info: '#06B6D4',\n disabled: '#E5E7EB',\n default: '#F3F4F6'\n },\n bg: {\n color: {\n bottom: 'rgba(255, 255, 255, 0.45)',\n middle: 'rgba(255, 255, 255, 0.55)',\n top: 'rgba(255, 255, 255, 0.6)',\n hover: 'rgba(255, 255, 255, 0.75)',\n black: '#000000'\n },\n filter: { blur: 'blur(24px)', saturate: 'saturate(180%)' }\n },\n border: { color: 'rgba(255, 255, 255, 0.5)', width: 1, style: 'solid' },\n 'text-color': {\n title: '#1E293B',\n main: '#334155',\n placeholder: '#94A3B8',\n second: '#64748B',\n assist: '#CBD5E1',\n disabled: '#94A3B8',\n white: '#FFFFFF'\n },\n shadow: { color: 'rgba(0, 0, 0, 0.08)', x: 0, y: 4, blur: 24, spread: 0, emboss: 'none' }\n})\n\nexport const glassDarkTheme = glassLightTheme.new({\n color: { disabled: '#374151', default: '#1E293B' },\n bg: {\n color: {\n bottom: 'rgba(15, 23, 42, 0.6)',\n middle: 'rgba(15, 23, 42, 0.7)',\n top: 'rgba(15, 23, 42, 0.75)',\n hover: 'rgba(30, 41, 59, 0.85)',\n black: '#000000'\n },\n filter: { blur: 'blur(20px)', saturate: 'saturate(200%)' }\n },\n border: { color: 'rgba(255, 255, 255, 0.12)' },\n 'text-color': {\n title: '#F8FAFC',\n main: '#F1F5F9',\n second: '#94A3B8',\n placeholder: '#64748B',\n assist: '#64748B',\n disabled: '#475569',\n white: '#ffffff'\n },\n shadow: { color: 'rgba(0, 0, 0, 0.35)', x: 0, y: 4, blur: 32, spread: 0, emboss: 'none' }\n})\n"],"mappings":";;AAEA,MAAa,kBAAkB,WAAW,IAAI;CAC5C,OAAO;EACL,SAAS;EACT,SAAS;EACT,SAAS;EACT,QAAQ;EACR,MAAM;EACN,UAAU;EACV,SAAS;EACV;CACD,IAAI;EACF,OAAO;GACL,QAAQ;GACR,QAAQ;GACR,KAAK;GACL,OAAO;GACP,OAAO;GACR;EACD,QAAQ;GAAE,MAAM;GAAc,UAAU;GAAkB;EAC3D;CACD,QAAQ;EAAE,OAAO;EAA4B,OAAO;EAAG,OAAO;EAAS;CACvE,cAAc;EACZ,OAAO;EACP,MAAM;EACN,aAAa;EACb,QAAQ;EACR,QAAQ;EACR,UAAU;EACV,OAAO;EACR;CACD,QAAQ;EAAE,OAAO;EAAuB,GAAG;EAAG,GAAG;EAAG,MAAM;EAAI,QAAQ;EAAG,QAAQ;EAAQ;CAC1F,CAAC;AAEF,MAAa,iBAAiB,gBAAgB,IAAI;CAChD,OAAO;EAAE,UAAU;EAAW,SAAS;EAAW;CAClD,IAAI;EACF,OAAO;GACL,QAAQ;GACR,QAAQ;GACR,KAAK;GACL,OAAO;GACP,OAAO;GACR;EACD,QAAQ;GAAE,MAAM;GAAc,UAAU;GAAkB;EAC3D;CACD,QAAQ,EAAE,OAAO,6BAA6B;CAC9C,cAAc;EACZ,OAAO;EACP,MAAM;EACN,QAAQ;EACR,aAAa;EACb,QAAQ;EACR,UAAU;EACV,OAAO;EACR;CACD,QAAQ;EAAE,OAAO;EAAuB,GAAG;EAAG,GAAG;EAAG,MAAM;EAAI,QAAQ;EAAG,QAAQ;EAAQ;CAC1F,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { UITheme } from "./ui-theme.js";
2
+
3
+ //#region src/theme/hero.d.ts
4
+ declare const heroLightTheme: UITheme;
5
+ declare const heroDarkTheme: UITheme;
6
+ //#endregion
7
+ export { heroDarkTheme, heroLightTheme };
8
+ //# sourceMappingURL=hero.d.ts.map
@@ -0,0 +1,75 @@
1
+ import { lightTheme } from "./light.js";
2
+ //#region src/theme/hero.ts
3
+ const heroLightTheme = lightTheme.new({
4
+ color: {
5
+ primary: "#7828c8",
6
+ success: "#17c964",
7
+ warning: "#f5a524",
8
+ danger: "#f31260",
9
+ info: "#006fee",
10
+ disabled: "#f4f4f5",
11
+ default: "#f4f4f5"
12
+ },
13
+ border: {
14
+ width: 2,
15
+ color: "#00000000"
16
+ },
17
+ "text-color": {
18
+ title: "#11181C",
19
+ main: "#11181C",
20
+ second: "#71717A",
21
+ placeholder: "#A1A1AA",
22
+ assist: "#A1A1AA",
23
+ disabled: "#A1A1AA",
24
+ white: "#FFFFFF"
25
+ },
26
+ radius: {
27
+ small: 8,
28
+ default: 12,
29
+ large: 14
30
+ },
31
+ shadow: {
32
+ color: "rgba(0, 0, 0, 0.08)",
33
+ x: 0,
34
+ y: 4,
35
+ blur: 14,
36
+ spread: 0,
37
+ emboss: "0 2px 4px 0 #0000000a,0 1px 2px 0 #0000000f,0 0 3px 0px #0000000f"
38
+ }
39
+ });
40
+ const heroDarkTheme = heroLightTheme.new({
41
+ color: {
42
+ primary: "#9353d3",
43
+ disabled: "#27272a",
44
+ default: "#27272a"
45
+ },
46
+ bg: { color: {
47
+ bottom: "#000000",
48
+ middle: "#18181b",
49
+ top: "#27272a",
50
+ hover: "#3f3f46",
51
+ black: "#000000"
52
+ } },
53
+ border: { color: "#3f3f46" },
54
+ "text-color": {
55
+ title: "#ECEDEE",
56
+ main: "#ECEDEE",
57
+ second: "#A1A1AA",
58
+ placeholder: "#71717A",
59
+ assist: "#71717A",
60
+ disabled: "#71717A",
61
+ white: "#000000"
62
+ },
63
+ shadow: {
64
+ color: "rgba(0, 0, 0, 0.2)",
65
+ x: 0,
66
+ y: 4,
67
+ blur: 14,
68
+ spread: 0,
69
+ emboss: "0 2px 4px 0 #0000000a,0 1px 2px 0 #0000000f,0 0 1px 0 #0000000f"
70
+ }
71
+ });
72
+ //#endregion
73
+ export { heroDarkTheme, heroLightTheme };
74
+
75
+ //# sourceMappingURL=hero.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hero.js","names":[],"sources":["../../src/theme/hero.ts"],"sourcesContent":["import { lightTheme } from './light'\n\nexport const heroLightTheme = lightTheme.new({\n color: {\n primary: '#7828c8', // purple\n success: '#17c964',\n warning: '#f5a524',\n danger: '#f31260',\n info: '#006fee',\n disabled: '#f4f4f5',\n default: '#f4f4f5'\n },\n border: { width: 2, color: '#00000000' },\n 'text-color': {\n title: '#11181C',\n main: '#11181C',\n second: '#71717A',\n placeholder: '#A1A1AA',\n assist: '#A1A1AA',\n disabled: '#A1A1AA',\n white: '#FFFFFF'\n },\n radius: { small: 8, default: 12, large: 14 },\n shadow: {\n color: 'rgba(0, 0, 0, 0.08)',\n x: 0,\n y: 4,\n blur: 14,\n spread: 0,\n emboss: '0 2px 4px 0 #0000000a,0 1px 2px 0 #0000000f,0 0 3px 0px #0000000f'\n }\n})\n\nexport const heroDarkTheme = heroLightTheme.new({\n color: { primary: '#9353d3', disabled: '#27272a', default: '#27272a' },\n bg: {\n color: {\n bottom: '#000000',\n middle: '#18181b',\n top: '#27272a',\n hover: '#3f3f46',\n black: '#000000'\n }\n },\n border: { color: '#3f3f46' },\n 'text-color': {\n title: '#ECEDEE',\n main: '#ECEDEE',\n second: '#A1A1AA',\n placeholder: '#71717A',\n assist: '#71717A',\n disabled: '#71717A',\n white: '#000000'\n },\n shadow: {\n color: 'rgba(0, 0, 0, 0.2)',\n x: 0,\n y: 4,\n blur: 14,\n spread: 0,\n emboss: '0 2px 4px 0 #0000000a,0 1px 2px 0 #0000000f,0 0 1px 0 #0000000f'\n }\n})\n"],"mappings":";;AAEA,MAAa,iBAAiB,WAAW,IAAI;CAC3C,OAAO;EACL,SAAS;EACT,SAAS;EACT,SAAS;EACT,QAAQ;EACR,MAAM;EACN,UAAU;EACV,SAAS;EACV;CACD,QAAQ;EAAE,OAAO;EAAG,OAAO;EAAa;CACxC,cAAc;EACZ,OAAO;EACP,MAAM;EACN,QAAQ;EACR,aAAa;EACb,QAAQ;EACR,UAAU;EACV,OAAO;EACR;CACD,QAAQ;EAAE,OAAO;EAAG,SAAS;EAAI,OAAO;EAAI;CAC5C,QAAQ;EACN,OAAO;EACP,GAAG;EACH,GAAG;EACH,MAAM;EACN,QAAQ;EACR,QAAQ;EACT;CACF,CAAC;AAEF,MAAa,gBAAgB,eAAe,IAAI;CAC9C,OAAO;EAAE,SAAS;EAAW,UAAU;EAAW,SAAS;EAAW;CACtE,IAAI,EACF,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,KAAK;EACL,OAAO;EACP,OAAO;EACR,EACF;CACD,QAAQ,EAAE,OAAO,WAAW;CAC5B,cAAc;EACZ,OAAO;EACP,MAAM;EACN,QAAQ;EACR,aAAa;EACb,QAAQ;EACR,UAAU;EACV,OAAO;EACR;CACD,QAAQ;EACN,OAAO;EACP,GAAG;EACH,GAAG;EACH,MAAM;EACN,QAAQ;EACR,QAAQ;EACT;CACF,CAAC"}
@@ -3,6 +3,9 @@ import { RGBColor, Theme } from "./type.js";
3
3
  import { UITheme } from "./ui-theme.js";
4
4
  import { lightTheme } from "./light.js";
5
5
  import { darkTheme } from "./dark.js";
6
+ import { shadcnDarkTheme, shadcnLightTheme } from "./shadcn.js";
7
+ import { heroDarkTheme, heroLightTheme } from "./hero.js";
8
+ import { glassDarkTheme, glassLightTheme } from "./glass.js";
6
9
  import { HEXToRGB, cssVar, defineBySize, mixColor } from "./helper.js";
7
10
  import { currentTheme, loadTheme, setTheme } from "../load-theme.js";
8
- export { HEXToRGB, RGBColor, Theme, UITheme, componentCssVarsDark, componentCssVarsDarkDecls, componentCssVarsLight, componentCssVarsLightDecls, cssVar, currentTheme, darkTheme, defineBySize, lightTheme, loadTheme, mixColor, setTheme, themeTokenVar };
11
+ export { HEXToRGB, RGBColor, Theme, UITheme, componentCssVarsDark, componentCssVarsDarkDecls, componentCssVarsLight, componentCssVarsLightDecls, cssVar, currentTheme, darkTheme, defineBySize, glassDarkTheme, glassLightTheme, heroDarkTheme, heroLightTheme, lightTheme, loadTheme, mixColor, setTheme, shadcnDarkTheme, shadcnLightTheme, themeTokenVar };
@@ -3,5 +3,8 @@ import { HEXToRGB, cssVar, defineBySize, mixColor } from "./helper.js";
3
3
  import { UITheme } from "./ui-theme.js";
4
4
  import { lightTheme } from "./light.js";
5
5
  import { darkTheme } from "./dark.js";
6
+ import { shadcnDarkTheme, shadcnLightTheme } from "./shadcn.js";
7
+ import { heroDarkTheme, heroLightTheme } from "./hero.js";
8
+ import { glassDarkTheme, glassLightTheme } from "./glass.js";
6
9
  import { currentTheme, loadTheme, setTheme } from "../load-theme.js";
7
- export { HEXToRGB, UITheme, componentCssVarsDark, componentCssVarsDarkDecls, componentCssVarsLight, componentCssVarsLightDecls, cssVar, currentTheme, darkTheme, defineBySize, lightTheme, loadTheme, mixColor, setTheme, themeTokenVar };
10
+ export { HEXToRGB, UITheme, componentCssVarsDark, componentCssVarsDarkDecls, componentCssVarsLight, componentCssVarsLightDecls, cssVar, currentTheme, darkTheme, defineBySize, glassDarkTheme, glassLightTheme, heroDarkTheme, heroLightTheme, lightTheme, loadTheme, mixColor, setTheme, shadcnDarkTheme, shadcnLightTheme, themeTokenVar };
@@ -20,8 +20,8 @@ const lightTheme = new UITheme({
20
20
  black: "#000000"
21
21
  },
22
22
  filter: {
23
- blur: "blur(16px)",
24
- saturate: "saturate(180%)"
23
+ blur: "none",
24
+ saturate: "none"
25
25
  }
26
26
  },
27
27
  border: {
@@ -69,7 +69,8 @@ const lightTheme = new UITheme({
69
69
  x: 0,
70
70
  y: 0,
71
71
  blur: 4,
72
- spread: 1
72
+ spread: 1,
73
+ emboss: "none"
73
74
  },
74
75
  gap: defineBySize({
75
76
  small: 6,
@@ -1 +1 @@
1
- {"version":3,"file":"light.js","names":[],"sources":["../../src/theme/light.ts"],"sourcesContent":["import { defineBySize } from './helper'\nimport { UITheme } from './ui-theme'\n\nexport const lightTheme: UITheme = new UITheme(\n {\n color: {\n primary: '#1E88E5',\n success: '#2ba471',\n warning: '#e37318',\n danger: '#d54941',\n info: '#009688',\n disabled: '#f5f7fa',\n default: '#f1f5f9'\n },\n\n bg: {\n color: {\n bottom: '#f5f5f5',\n middle: '#fafafa',\n top: '#ffffff',\n hover: '#f5f7fa',\n black: '#000000'\n },\n\n filter: { blur: 'blur(16px)', saturate: 'saturate(180%)' }\n },\n\n border: { color: '#dcdfe6', width: 1, style: 'solid' },\n\n 'text-color': {\n title: '#303133',\n main: '#606266',\n placeholder: '#a8abb2',\n second: '#979797',\n assist: '#c0c4cc',\n disabled: '#a8abb2',\n white: '#fff'\n },\n\n radius: defineBySize({ small: 4, default: 6, large: 8 }),\n\n 'form-component-height': defineBySize({ small: 24, default: 32, large: 40 }),\n\n 'font-family':\n 'system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"PingFang SC\", \"Hiragino Sans GB\", \"Microsoft YaHei\", sans-serif',\n\n 'font-size-title': defineBySize({ small: 16, default: 16, large: 18 }),\n\n 'font-size-main': defineBySize({ small: 12, default: 14, large: 16 }),\n\n 'font-size-assist': defineBySize({ small: 12, default: 12, large: 14 }),\n\n shadow: { color: '#0000001a', x: 0, y: 0, blur: 4, spread: 1 },\n\n gap: defineBySize({ small: 6, default: 8, large: 12 }),\n\n breakpoint: { xs: 600, sm: 960, md: 1280, lg: 1920 }\n },\n { reactive: false }\n)\n"],"mappings":";;;AAGA,MAAa,aAAsB,IAAI,QACrC;CACE,OAAO;EACL,SAAS;EACT,SAAS;EACT,SAAS;EACT,QAAQ;EACR,MAAM;EACN,UAAU;EACV,SAAS;EACV;CAED,IAAI;EACF,OAAO;GACL,QAAQ;GACR,QAAQ;GACR,KAAK;GACL,OAAO;GACP,OAAO;GACR;EAED,QAAQ;GAAE,MAAM;GAAc,UAAU;GAAkB;EAC3D;CAED,QAAQ;EAAE,OAAO;EAAW,OAAO;EAAG,OAAO;EAAS;CAEtD,cAAc;EACZ,OAAO;EACP,MAAM;EACN,aAAa;EACb,QAAQ;EACR,QAAQ;EACR,UAAU;EACV,OAAO;EACR;CAED,QAAQ,aAAa;EAAE,OAAO;EAAG,SAAS;EAAG,OAAO;EAAG,CAAC;CAExD,yBAAyB,aAAa;EAAE,OAAO;EAAI,SAAS;EAAI,OAAO;EAAI,CAAC;CAE5E,eACE;CAEF,mBAAmB,aAAa;EAAE,OAAO;EAAI,SAAS;EAAI,OAAO;EAAI,CAAC;CAEtE,kBAAkB,aAAa;EAAE,OAAO;EAAI,SAAS;EAAI,OAAO;EAAI,CAAC;CAErE,oBAAoB,aAAa;EAAE,OAAO;EAAI,SAAS;EAAI,OAAO;EAAI,CAAC;CAEvE,QAAQ;EAAE,OAAO;EAAa,GAAG;EAAG,GAAG;EAAG,MAAM;EAAG,QAAQ;EAAG;CAE9D,KAAK,aAAa;EAAE,OAAO;EAAG,SAAS;EAAG,OAAO;EAAI,CAAC;CAEtD,YAAY;EAAE,IAAI;EAAK,IAAI;EAAK,IAAI;EAAM,IAAI;EAAM;CACrD,EACD,EAAE,UAAU,OAAO,CACpB"}
1
+ {"version":3,"file":"light.js","names":[],"sources":["../../src/theme/light.ts"],"sourcesContent":["import { defineBySize } from './helper'\nimport { UITheme } from './ui-theme'\n\nexport const lightTheme: UITheme = new UITheme(\n {\n color: {\n primary: '#1E88E5',\n success: '#2ba471',\n warning: '#e37318',\n danger: '#d54941',\n info: '#009688',\n disabled: '#f5f7fa',\n default: '#f1f5f9'\n },\n\n bg: {\n color: {\n bottom: '#f5f5f5',\n middle: '#fafafa',\n top: '#ffffff',\n hover: '#f5f7fa',\n black: '#000000'\n },\n\n filter: { blur: 'none', saturate: 'none' }\n },\n\n border: { color: '#dcdfe6', width: 1, style: 'solid' },\n\n 'text-color': {\n title: '#303133',\n main: '#606266',\n placeholder: '#a8abb2',\n second: '#979797',\n assist: '#c0c4cc',\n disabled: '#a8abb2',\n white: '#fff'\n },\n\n radius: defineBySize({ small: 4, default: 6, large: 8 }),\n\n 'form-component-height': defineBySize({ small: 24, default: 32, large: 40 }),\n\n 'font-family':\n 'system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"PingFang SC\", \"Hiragino Sans GB\", \"Microsoft YaHei\", sans-serif',\n\n 'font-size-title': defineBySize({ small: 16, default: 16, large: 18 }),\n\n 'font-size-main': defineBySize({ small: 12, default: 14, large: 16 }),\n\n 'font-size-assist': defineBySize({ small: 12, default: 12, large: 14 }),\n\n shadow: { color: '#0000001a', x: 0, y: 0, blur: 4, spread: 1, emboss: 'none' },\n\n gap: defineBySize({ small: 6, default: 8, large: 12 }),\n\n breakpoint: { xs: 600, sm: 960, md: 1280, lg: 1920 }\n },\n { reactive: false }\n)\n"],"mappings":";;;AAGA,MAAa,aAAsB,IAAI,QACrC;CACE,OAAO;EACL,SAAS;EACT,SAAS;EACT,SAAS;EACT,QAAQ;EACR,MAAM;EACN,UAAU;EACV,SAAS;EACV;CAED,IAAI;EACF,OAAO;GACL,QAAQ;GACR,QAAQ;GACR,KAAK;GACL,OAAO;GACP,OAAO;GACR;EAED,QAAQ;GAAE,MAAM;GAAQ,UAAU;GAAQ;EAC3C;CAED,QAAQ;EAAE,OAAO;EAAW,OAAO;EAAG,OAAO;EAAS;CAEtD,cAAc;EACZ,OAAO;EACP,MAAM;EACN,aAAa;EACb,QAAQ;EACR,QAAQ;EACR,UAAU;EACV,OAAO;EACR;CAED,QAAQ,aAAa;EAAE,OAAO;EAAG,SAAS;EAAG,OAAO;EAAG,CAAC;CAExD,yBAAyB,aAAa;EAAE,OAAO;EAAI,SAAS;EAAI,OAAO;EAAI,CAAC;CAE5E,eACE;CAEF,mBAAmB,aAAa;EAAE,OAAO;EAAI,SAAS;EAAI,OAAO;EAAI,CAAC;CAEtE,kBAAkB,aAAa;EAAE,OAAO;EAAI,SAAS;EAAI,OAAO;EAAI,CAAC;CAErE,oBAAoB,aAAa;EAAE,OAAO;EAAI,SAAS;EAAI,OAAO;EAAI,CAAC;CAEvE,QAAQ;EAAE,OAAO;EAAa,GAAG;EAAG,GAAG;EAAG,MAAM;EAAG,QAAQ;EAAG,QAAQ;EAAQ;CAE9E,KAAK,aAAa;EAAE,OAAO;EAAG,SAAS;EAAG,OAAO;EAAI,CAAC;CAEtD,YAAY;EAAE,IAAI;EAAK,IAAI;EAAK,IAAI;EAAM,IAAI;EAAM;CACrD,EACD,EAAE,UAAU,OAAO,CACpB"}
@@ -0,0 +1,8 @@
1
+ import { UITheme } from "./ui-theme.js";
2
+
3
+ //#region src/theme/shadcn.d.ts
4
+ declare const shadcnLightTheme: UITheme;
5
+ declare const shadcnDarkTheme: UITheme;
6
+ //#endregion
7
+ export { shadcnDarkTheme, shadcnLightTheme };
8
+ //# sourceMappingURL=shadcn.d.ts.map
@@ -0,0 +1,71 @@
1
+ import { lightTheme } from "./light.js";
2
+ //#region src/theme/shadcn.ts
3
+ const shadcnLightTheme = lightTheme.new({
4
+ color: {
5
+ primary: "#18181b",
6
+ success: "#22c55e",
7
+ warning: "#f59e0b",
8
+ danger: "#ef4444",
9
+ info: "#3b82f6",
10
+ disabled: "#f4f4f5",
11
+ default: "#fafafa"
12
+ },
13
+ bg: { color: {
14
+ bottom: "#f4f4f5",
15
+ middle: "#fafafa",
16
+ top: "#ffffff",
17
+ hover: "#f4f4f5",
18
+ black: "#000000"
19
+ } },
20
+ border: { color: "#e4e4e7" },
21
+ "text-color": {
22
+ title: "#09090b",
23
+ main: "#09090b",
24
+ second: "#71717a",
25
+ placeholder: "#a1a1aa",
26
+ assist: "#a1a1aa",
27
+ disabled: "#a1a1aa",
28
+ white: "#ffffff"
29
+ },
30
+ radius: {
31
+ small: 4,
32
+ default: 6,
33
+ large: 8
34
+ },
35
+ shadow: {
36
+ color: "rgba(0, 0, 0, 0.05)",
37
+ x: 0,
38
+ y: 1,
39
+ blur: 2,
40
+ spread: 0,
41
+ emboss: "none"
42
+ }
43
+ });
44
+ const shadcnDarkTheme = shadcnLightTheme.new({
45
+ color: {
46
+ primary: "#fafafa",
47
+ disabled: "#27272a",
48
+ default: "#18181b"
49
+ },
50
+ bg: { color: {
51
+ bottom: "#09090b",
52
+ middle: "#18181b",
53
+ top: "#27272a",
54
+ hover: "#27272a",
55
+ black: "#000000"
56
+ } },
57
+ border: { color: "#27272a" },
58
+ "text-color": {
59
+ title: "#fafafa",
60
+ main: "#fafafa",
61
+ second: "#a1a1aa",
62
+ placeholder: "#71717a",
63
+ assist: "#71717a",
64
+ disabled: "#71717a",
65
+ white: "#000000"
66
+ }
67
+ });
68
+ //#endregion
69
+ export { shadcnDarkTheme, shadcnLightTheme };
70
+
71
+ //# sourceMappingURL=shadcn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shadcn.js","names":[],"sources":["../../src/theme/shadcn.ts"],"sourcesContent":["import { lightTheme } from './light'\n\nexport const shadcnLightTheme = lightTheme.new({\n color: {\n primary: '#18181b', // zinc-900\n success: '#22c55e',\n warning: '#f59e0b',\n danger: '#ef4444',\n info: '#3b82f6',\n disabled: '#f4f4f5',\n default: '#fafafa'\n },\n bg: {\n color: {\n bottom: '#f4f4f5',\n middle: '#fafafa',\n top: '#ffffff',\n hover: '#f4f4f5',\n black: '#000000'\n }\n },\n border: { color: '#e4e4e7' },\n 'text-color': {\n title: '#09090b',\n main: '#09090b',\n second: '#71717a',\n placeholder: '#a1a1aa',\n assist: '#a1a1aa',\n disabled: '#a1a1aa',\n white: '#ffffff'\n },\n radius: { small: 4, default: 6, large: 8 },\n shadow: { color: 'rgba(0, 0, 0, 0.05)', x: 0, y: 1, blur: 2, spread: 0, emboss: 'none' }\n})\n\nexport const shadcnDarkTheme = shadcnLightTheme.new({\n color: {\n primary: '#fafafa', // zinc-50\n disabled: '#27272a',\n default: '#18181b'\n },\n bg: {\n color: {\n bottom: '#09090b',\n middle: '#18181b',\n top: '#27272a',\n hover: '#27272a',\n black: '#000000'\n }\n },\n border: { color: '#27272a' },\n 'text-color': {\n title: '#fafafa',\n main: '#fafafa',\n second: '#a1a1aa',\n placeholder: '#71717a',\n assist: '#71717a',\n disabled: '#71717a',\n white: '#000000'\n }\n})\n"],"mappings":";;AAEA,MAAa,mBAAmB,WAAW,IAAI;CAC7C,OAAO;EACL,SAAS;EACT,SAAS;EACT,SAAS;EACT,QAAQ;EACR,MAAM;EACN,UAAU;EACV,SAAS;EACV;CACD,IAAI,EACF,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,KAAK;EACL,OAAO;EACP,OAAO;EACR,EACF;CACD,QAAQ,EAAE,OAAO,WAAW;CAC5B,cAAc;EACZ,OAAO;EACP,MAAM;EACN,QAAQ;EACR,aAAa;EACb,QAAQ;EACR,UAAU;EACV,OAAO;EACR;CACD,QAAQ;EAAE,OAAO;EAAG,SAAS;EAAG,OAAO;EAAG;CAC1C,QAAQ;EAAE,OAAO;EAAuB,GAAG;EAAG,GAAG;EAAG,MAAM;EAAG,QAAQ;EAAG,QAAQ;EAAQ;CACzF,CAAC;AAEF,MAAa,kBAAkB,iBAAiB,IAAI;CAClD,OAAO;EACL,SAAS;EACT,UAAU;EACV,SAAS;EACV;CACD,IAAI,EACF,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,KAAK;EACL,OAAO;EACP,OAAO;EACR,EACF;CACD,QAAQ,EAAE,OAAO,WAAW;CAC5B,cAAc;EACZ,OAAO;EACP,MAAM;EACN,QAAQ;EACR,aAAa;EACb,QAAQ;EACR,UAAU;EACV,OAAO;EACR;CACF,CAAC"}
@@ -72,7 +72,8 @@ type Theme = {
72
72
  x: number; /** 阴影垂直偏移 */
73
73
  y: number; /** 阴影模糊半径 */
74
74
  blur: number; /** 阴影扩散半径 */
75
- spread: number;
75
+ spread: number; /** 浮雕阴影:非浮雕主题为 'none',浮雕主题为完整 box-shadow 值 */
76
+ emboss: string;
76
77
  }; /** 间距 */
77
78
  gap: {
78
79
  /** 小间距 */small: number; /** 默认间距 */
@@ -67,7 +67,7 @@ var UITheme = class UITheme {
67
67
  }
68
68
  renderBGFilter(theme) {
69
69
  const { filter } = theme.bg;
70
- return `--u-bg-filter: ${filter.blur} ${filter.saturate}`;
70
+ return `--u-bg-filter: ${filter.blur === "none" ? "none" : `${filter.blur} ${filter.saturate}`}`;
71
71
  }
72
72
  /** 主题变量声明列表,均为 `--u-` 前缀的 CSS 自定义属性 */
73
73
  themeToDeclarationList(theme) {
@@ -1 +1 @@
1
- {"version":3,"file":"ui-theme.js","names":[],"sources":["../../src/theme/ui-theme.ts"],"sourcesContent":["import { isObj, o, str } from '@cat-kit/core'\nimport { withUnit } from '@veltra/utils'\nimport { reactive, toRaw, watch } from 'vue'\n\nimport { componentCssVarsDarkDecls, componentCssVarsLightDecls } from './component-css-vars'\nimport { mixColor } from './helper'\nimport type { Theme } from './type'\n\ntype RecursivePartial<T> = {\n [P in keyof T]?: T[P] extends object ? RecursivePartial<T[P]> : T[P]\n}\n\nexport class UITheme {\n static themeID = 'ultra-ui-theme'\n\n private static adoptedSheet: CSSStyleSheet | null = null\n\n readonly theme: Theme\n\n private readonly reactiveEnabled: boolean\n\n constructor(theme: Theme, options?: { reactive?: boolean }) {\n this.reactiveEnabled = options?.reactive !== false\n this.theme = reactive(theme) as Theme\n if (this.reactiveEnabled) {\n watch(this.theme, () => this.render(), { deep: true })\n }\n }\n\n static setTheme(mode: 'light' | 'dark' | 'auto'): void {\n if (typeof document === 'undefined') return\n const el = document.documentElement\n if (mode === 'auto') {\n delete el.dataset.theme\n } else {\n el.dataset.theme = mode\n }\n }\n\n private renderBase(\n theme: Record<string, unknown>,\n themeRules: string[] = [],\n parentKey = '--u'\n ): string[] {\n Object.keys(theme).forEach((key) => {\n const value = theme[key]\n const varKey = `${parentKey.startsWith('-') ? parentKey : str(parentKey).kebabCase()}-${str(key).kebabCase()}`\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n this.renderBase(value as Record<string, unknown>, themeRules, varKey)\n } else {\n if (value || value === 0) {\n const v = withUnit(value as number | string, 'px')\n if (v !== undefined) {\n themeRules.push(`${varKey}: ${v}`)\n }\n }\n }\n })\n\n return themeRules\n }\n\n private renderBorder(theme: Theme): string {\n const border = Object.keys(theme.border)\n .map((key) => `var(--u-border-${key})`)\n .join(' ')\n\n return `--u-border: ${border}`\n }\n\n private renderTypeColor(theme: Theme): string {\n const { color } = theme\n\n const types = Object.keys(color)\n const rates = [1, 3, 5, 7, 9]\n\n return types\n .map((type) => {\n const colorValue = color[type as keyof typeof color]! as `#${string}`\n\n return rates\n .map((rate) => {\n const light = `--u-color-${type}-light-${rate}: ${mixColor(\n colorValue,\n '#fff',\n rate / 10\n )}`\n const dark = `--u-color-${type}-dark-${rate}: ${mixColor(\n colorValue,\n '#000',\n rate / 10\n )}`\n return `${light};${dark}`\n })\n .join(';')\n })\n .join(';')\n }\n\n private renderShadow(_theme: Theme): string {\n const shadow = ['x', 'y', 'blur', 'spread', 'color']\n .map((k) => `var(--u-shadow-${k})`)\n .join(' ')\n\n return `--u-shadow: ${shadow}`\n }\n\n private renderBGColorAlpha(theme: Theme): string {\n const { color } = theme.bg\n return Object.keys(color)\n .map((type) => `--u-bg-color-${type}-alpha: ${color[type as keyof typeof color]}aa`)\n .join(';')\n }\n\n private renderBGFilter(theme: Theme): string {\n const { filter } = theme.bg\n return `--u-bg-filter: ${filter.blur} ${filter.saturate}`\n }\n\n /** 主题变量声明列表,均为 `--u-` 前缀的 CSS 自定义属性 */\n themeToDeclarationList(theme: Theme): string[] {\n const raw = theme as unknown as Record<string, unknown>\n const lines: string[] = [...this.renderBase(raw)]\n const chunks = [\n this.renderTypeColor(theme),\n this.renderShadow(theme),\n this.renderBGColorAlpha(theme),\n this.renderBGFilter(theme),\n this.renderBorder(theme)\n ]\n for (const c of chunks) {\n lines.push(\n ...c\n .split(';')\n .map((s) => s.trim())\n .filter(Boolean)\n )\n }\n return lines\n }\n\n private static declarationBlock(decls: string[]): string {\n return decls.join(';')\n }\n\n private static removeExistingStyleTag(doc: Document): void {\n const el = doc.getElementById(UITheme.themeID)\n if (el?.parentNode) {\n el.parentNode.removeChild(el)\n }\n }\n\n private static applyGlobalCSS(css: string): void {\n const doc = typeof document !== 'undefined' ? document : undefined\n if (!doc) return\n\n const canAdopt =\n typeof CSSStyleSheet !== 'undefined' && 'adoptedStyleSheets' in Document.prototype\n\n if (canAdopt) {\n UITheme.removeExistingStyleTag(doc)\n if (!UITheme.adoptedSheet) {\n UITheme.adoptedSheet = new CSSStyleSheet()\n doc.adoptedStyleSheets = [...doc.adoptedStyleSheets, UITheme.adoptedSheet]\n }\n UITheme.adoptedSheet.replaceSync(css)\n } else {\n if (UITheme.adoptedSheet) {\n UITheme.adoptedSheet = null\n }\n let style = doc.getElementById(UITheme.themeID)\n if (!style) {\n style = doc.createElement('style')\n style.id = UITheme.themeID\n doc.head.appendChild(style)\n }\n style.textContent = css\n }\n }\n\n /** 内置 light/dark:支持 data-theme 与 prefers-color-scheme */\n static injectBuiltInThemes(light: UITheme, dark: UITheme): void {\n const lightDecls = [\n ...light.themeToDeclarationList(toRaw(light.theme)),\n ...componentCssVarsLightDecls\n ]\n const darkDecls = [\n ...dark.themeToDeclarationList(toRaw(dark.theme)),\n ...componentCssVarsDarkDecls\n ]\n const lightBlock = UITheme.declarationBlock(lightDecls)\n const darkBlock = UITheme.declarationBlock(darkDecls)\n\n const css = [\n `html { ${lightBlock} }`,\n `@media (prefers-color-scheme: dark) {`,\n ` html:not([data-theme=\"light\"]) { ${darkBlock} }`,\n `}`,\n `html[data-theme=\"light\"] { ${lightBlock} }`,\n `html[data-theme=\"dark\"] { ${darkBlock} }`\n ].join('\\n')\n\n UITheme.applyGlobalCSS(css)\n }\n\n render(): void {\n const decls = [...this.themeToDeclarationList(toRaw(this.theme)), ...componentCssVarsLightDecls]\n const block = UITheme.declarationBlock(decls)\n const css = `html { ${block} }`\n UITheme.applyGlobalCSS(css)\n }\n\n new(customTheme: RecursivePartial<Theme> = {}): UITheme {\n function delEmpty(obj: Record<string, unknown>) {\n Object.keys(obj).forEach((key) => {\n const value = obj[key]\n if (isObj(value)) {\n return delEmpty(value as Record<string, unknown>)\n }\n if (!value && value !== 0) {\n delete obj[key]\n }\n })\n }\n\n delEmpty(customTheme as Record<string, unknown>)\n\n const base = JSON.parse(JSON.stringify(toRaw(this.theme))) as Record<string, any>\n o(base).deepExtend(customTheme as Record<string, any>)\n return new UITheme(base as Theme, { reactive: this.reactiveEnabled })\n }\n}\n"],"mappings":";;;;;;AAYA,IAAa,UAAb,MAAa,QAAQ;CACnB,OAAO,UAAU;CAEjB,OAAe,eAAqC;CAEpD;CAEA;CAEA,YAAY,OAAc,SAAkC;AAC1D,OAAK,kBAAkB,SAAS,aAAa;AAC7C,OAAK,QAAQ,SAAS,MAAM;AAC5B,MAAI,KAAK,gBACP,OAAM,KAAK,aAAa,KAAK,QAAQ,EAAE,EAAE,MAAM,MAAM,CAAC;;C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C;AACtD,SAAO,IAAI,QAAQ,MAAe,EAAE,UAAU,KAAK,iBAAiB,CAAC"}
1
+ {"version":3,"file":"ui-theme.js","names":[],"sources":["../../src/theme/ui-theme.ts"],"sourcesContent":["import { isObj, o, str } from '@cat-kit/core'\nimport { withUnit } from '@veltra/utils'\nimport { reactive, toRaw, watch } from 'vue'\n\nimport { componentCssVarsDarkDecls, componentCssVarsLightDecls } from './component-css-vars'\nimport { mixColor } from './helper'\nimport type { Theme } from './type'\n\ntype RecursivePartial<T> = {\n [P in keyof T]?: T[P] extends object ? RecursivePartial<T[P]> : T[P]\n}\n\nexport class UITheme {\n static themeID = 'ultra-ui-theme'\n\n private static adoptedSheet: CSSStyleSheet | null = null\n\n readonly theme: Theme\n\n private readonly reactiveEnabled: boolean\n\n constructor(theme: Theme, options?: { reactive?: boolean }) {\n this.reactiveEnabled = options?.reactive !== false\n this.theme = reactive(theme) as Theme\n if (this.reactiveEnabled) {\n watch(this.theme, () => this.render(), { deep: true })\n }\n }\n\n static setTheme(mode: 'light' | 'dark' | 'auto'): void {\n if (typeof document === 'undefined') return\n const el = document.documentElement\n if (mode === 'auto') {\n delete el.dataset.theme\n } else {\n el.dataset.theme = mode\n }\n }\n\n private renderBase(\n theme: Record<string, unknown>,\n themeRules: string[] = [],\n parentKey = '--u'\n ): string[] {\n Object.keys(theme).forEach((key) => {\n const value = theme[key]\n const varKey = `${parentKey.startsWith('-') ? parentKey : str(parentKey).kebabCase()}-${str(key).kebabCase()}`\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n this.renderBase(value as Record<string, unknown>, themeRules, varKey)\n } else {\n if (value || value === 0) {\n const v = withUnit(value as number | string, 'px')\n if (v !== undefined) {\n themeRules.push(`${varKey}: ${v}`)\n }\n }\n }\n })\n\n return themeRules\n }\n\n private renderBorder(theme: Theme): string {\n const border = Object.keys(theme.border)\n .map((key) => `var(--u-border-${key})`)\n .join(' ')\n\n return `--u-border: ${border}`\n }\n\n private renderTypeColor(theme: Theme): string {\n const { color } = theme\n\n const types = Object.keys(color)\n const rates = [1, 3, 5, 7, 9]\n\n return types\n .map((type) => {\n const colorValue = color[type as keyof typeof color]! as `#${string}`\n\n return rates\n .map((rate) => {\n const light = `--u-color-${type}-light-${rate}: ${mixColor(\n colorValue,\n '#fff',\n rate / 10\n )}`\n const dark = `--u-color-${type}-dark-${rate}: ${mixColor(\n colorValue,\n '#000',\n rate / 10\n )}`\n return `${light};${dark}`\n })\n .join(';')\n })\n .join(';')\n }\n\n private renderShadow(_theme: Theme): string {\n const shadow = ['x', 'y', 'blur', 'spread', 'color']\n .map((k) => `var(--u-shadow-${k})`)\n .join(' ')\n\n return `--u-shadow: ${shadow}`\n }\n\n private renderBGColorAlpha(theme: Theme): string {\n const { color } = theme.bg\n return Object.keys(color)\n .map((type) => `--u-bg-color-${type}-alpha: ${color[type as keyof typeof color]}aa`)\n .join(';')\n }\n\n private renderBGFilter(theme: Theme): string {\n const { filter } = theme.bg\n const value = filter.blur === 'none' ? 'none' : `${filter.blur} ${filter.saturate}`\n return `--u-bg-filter: ${value}`\n }\n\n /** 主题变量声明列表,均为 `--u-` 前缀的 CSS 自定义属性 */\n themeToDeclarationList(theme: Theme): string[] {\n const raw = theme as unknown as Record<string, unknown>\n const lines: string[] = [...this.renderBase(raw)]\n const chunks = [\n this.renderTypeColor(theme),\n this.renderShadow(theme),\n this.renderBGColorAlpha(theme),\n this.renderBGFilter(theme),\n this.renderBorder(theme)\n ]\n for (const c of chunks) {\n lines.push(\n ...c\n .split(';')\n .map((s) => s.trim())\n .filter(Boolean)\n )\n }\n return lines\n }\n\n private static declarationBlock(decls: string[]): string {\n return decls.join(';')\n }\n\n private static removeExistingStyleTag(doc: Document): void {\n const el = doc.getElementById(UITheme.themeID)\n if (el?.parentNode) {\n el.parentNode.removeChild(el)\n }\n }\n\n private static applyGlobalCSS(css: string): void {\n const doc = typeof document !== 'undefined' ? document : undefined\n if (!doc) return\n\n const canAdopt =\n typeof CSSStyleSheet !== 'undefined' && 'adoptedStyleSheets' in Document.prototype\n\n if (canAdopt) {\n UITheme.removeExistingStyleTag(doc)\n if (!UITheme.adoptedSheet) {\n UITheme.adoptedSheet = new CSSStyleSheet()\n doc.adoptedStyleSheets = [...doc.adoptedStyleSheets, UITheme.adoptedSheet]\n }\n UITheme.adoptedSheet.replaceSync(css)\n } else {\n if (UITheme.adoptedSheet) {\n UITheme.adoptedSheet = null\n }\n let style = doc.getElementById(UITheme.themeID)\n if (!style) {\n style = doc.createElement('style')\n style.id = UITheme.themeID\n doc.head.appendChild(style)\n }\n style.textContent = css\n }\n }\n\n /** 内置 light/dark:支持 data-theme 与 prefers-color-scheme */\n static injectBuiltInThemes(light: UITheme, dark: UITheme): void {\n const lightDecls = [\n ...light.themeToDeclarationList(toRaw(light.theme)),\n ...componentCssVarsLightDecls\n ]\n const darkDecls = [\n ...dark.themeToDeclarationList(toRaw(dark.theme)),\n ...componentCssVarsDarkDecls\n ]\n const lightBlock = UITheme.declarationBlock(lightDecls)\n const darkBlock = UITheme.declarationBlock(darkDecls)\n\n const css = [\n `html { ${lightBlock} }`,\n `@media (prefers-color-scheme: dark) {`,\n ` html:not([data-theme=\"light\"]) { ${darkBlock} }`,\n `}`,\n `html[data-theme=\"light\"] { ${lightBlock} }`,\n `html[data-theme=\"dark\"] { ${darkBlock} }`\n ].join('\\n')\n\n UITheme.applyGlobalCSS(css)\n }\n\n render(): void {\n const decls = [...this.themeToDeclarationList(toRaw(this.theme)), ...componentCssVarsLightDecls]\n const block = UITheme.declarationBlock(decls)\n const css = `html { ${block} }`\n UITheme.applyGlobalCSS(css)\n }\n\n new(customTheme: RecursivePartial<Theme> = {}): UITheme {\n function delEmpty(obj: Record<string, unknown>) {\n Object.keys(obj).forEach((key) => {\n const value = obj[key]\n if (isObj(value)) {\n return delEmpty(value as Record<string, unknown>)\n }\n if (!value && value !== 0) {\n delete obj[key]\n }\n })\n }\n\n delEmpty(customTheme as Record<string, unknown>)\n\n const base = JSON.parse(JSON.stringify(toRaw(this.theme))) as Record<string, any>\n o(base).deepExtend(customTheme as Record<string, any>)\n return new UITheme(base as Theme, { reactive: this.reactiveEnabled })\n }\n}\n"],"mappings":";;;;;;AAYA,IAAa,UAAb,MAAa,QAAQ;CACnB,OAAO,UAAU;CAEjB,OAAe,eAAqC;CAEpD;CAEA;CAEA,YAAY,OAAc,SAAkC;AAC1D,OAAK,kBAAkB,SAAS,aAAa;AAC7C,OAAK,QAAQ,SAAS,MAAM;AAC5B,MAAI,KAAK,gBACP,OAAM,KAAK,aAAa,KAAK,QAAQ,EAAE,EAAE,MAAM,MAAM,CAAC;;CAI1D,OAAO,SAAS,MAAuC;AACrD,MAAI,OAAO,aAAa,YAAa;EACrC,MAAM,KAAK,SAAS;AACpB,MAAI,SAAS,OACX,QAAO,GAAG,QAAQ;MAElB,IAAG,QAAQ,QAAQ;;CAIvB,WACE,OACA,aAAuB,EAAE,EACzB,YAAY,OACF;AACV,SAAO,KAAK,MAAM,CAAC,SAAS,QAAQ;GAClC,MAAM,QAAQ,MAAM;GACpB,MAAM,SAAS,GAAG,UAAU,WAAW,IAAI,GAAG,YAAY,IAAI,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,IAAI,CAAC,WAAW;AAC5G,OAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM,CACtE,MAAK,WAAW,OAAkC,YAAY,OAAO;YAEjE,SAAS,UAAU,GAAG;IACxB,MAAM,IAAI,SAAS,OAA0B,KAAK;AAClD,QAAI,MAAM,KAAA,EACR,YAAW,KAAK,GAAG,OAAO,IAAI,IAAI;;IAIxC;AAEF,SAAO;;CAGT,aAAqB,OAAsB;AAKzC,SAAO,eAJQ,OAAO,KAAK,MAAM,OAAO,CACrC,KAAK,QAAQ,kBAAkB,IAAI,GAAG,CACtC,KAAK,IAEoB;;CAG9B,gBAAwB,OAAsB;EAC5C,MAAM,EAAE,UAAU;EAElB,MAAM,QAAQ,OAAO,KAAK,MAAM;EAChC,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iBAAiB,MACZ,CAAC;AAC5B,UAAQ,eAAe,IAAI;;CAG7B,IAAI,cAAuC,EAAE,EAAW;EACtD,SAAS,SAAS,KAA8B;AAC9C,UAAO,KAAK,IAAI,CAAC,SAAS,QAAQ;IAChC,MAAM,QAAQ,IAAI;AAClB,QAAI,MAAM,MAAM,CACd,QAAO,SAAS,MAAiC;AAEnD,QAAI,CAAC,SAAS,UAAU,EACtB,QAAO,IAAI;KAEb;;AAGJ,WAAS,YAAuC;EAEhD,MAAM,OAAO,KAAK,MAAM,KAAK,UAAU,MAAM,KAAK,MAAM,CAAC,CAAC;AAC1D,IAAE,KAAK,CAAC,WAAW,YAAmC;AACtD,SAAO,IAAI,QAAQ,MAAe,EAAE,UAAU,KAAK,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltra/styles",
3
- "version": "1.0.15",
3
+ "version": "2.0.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -60,8 +60,8 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "@cat-kit/core": "^1.1.3",
63
- "@veltra/compositions": "1.0.15",
64
- "@veltra/utils": "1.0.15"
63
+ "@veltra/compositions": "2.0.0",
64
+ "@veltra/utils": "2.0.0"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "vue": "^3.5.33"
@@ -0,0 +1,39 @@
1
+ import { compileString } from 'sass-embedded'
2
+ import { describe, expect, it } from 'vitest'
3
+
4
+ const compileScss = (source: string) =>
5
+ compileString(source, { syntax: 'scss', url: new URL('./__test__.scss', import.meta.url) }).css
6
+
7
+ describe('mixins', () => {
8
+ it('is-not appends a negated state selector to the current selector', () => {
9
+ const css = compileScss(`
10
+ @use '../mixins' as m;
11
+
12
+ .u-input {
13
+ @include m.is-not(disabled) {
14
+ &:hover {
15
+ border-color: red;
16
+ }
17
+ }
18
+ }
19
+ `)
20
+
21
+ expect(css).toContain('.u-input:not(.is-disabled):hover')
22
+ })
23
+
24
+ it('is-not supports multiple negated state selectors', () => {
25
+ const css = compileScss(`
26
+ @use '../mixins' as m;
27
+
28
+ .u-expression-editor {
29
+ @include m.is-not(disabled, readonly) {
30
+ &:focus-within {
31
+ border-color: red;
32
+ }
33
+ }
34
+ }
35
+ `)
36
+
37
+ expect(css).toContain('.u-expression-editor:not(.is-disabled):not(.is-readonly):focus-within')
38
+ })
39
+ })
package/src/_mixins.scss CHANGED
@@ -74,6 +74,18 @@
74
74
  }
75
75
  }
76
76
 
77
+ @mixin is-not($types...) {
78
+ $selector: '&';
79
+
80
+ @each $type in $types {
81
+ $selector: '#{$selector}:not(.is-#{$type})';
82
+ }
83
+
84
+ #{$selector} {
85
+ @content;
86
+ }
87
+ }
88
+
77
89
  @mixin bem($b, $e: null, $m: null) {
78
90
  $b: '.' + vars.$namespace + $b;
79
91
 
package/src/theme/dark.ts CHANGED
@@ -19,7 +19,7 @@ export const darkTheme = lightTheme.new({
19
19
  hover: '#303030',
20
20
  black: '#000000'
21
21
  },
22
- filter: { blur: 'blur(16px)', saturate: 'saturate(180%)' }
22
+ filter: { blur: 'none', saturate: 'none' }
23
23
  },
24
24
 
25
25
  'text-color': {
@@ -34,5 +34,5 @@ export const darkTheme = lightTheme.new({
34
34
 
35
35
  border: { color: '#404040' },
36
36
 
37
- shadow: { color: 'rgba(255, 255, 255, 0.2)', x: 0, y: 2, blur: 8, spread: 0 }
37
+ shadow: { color: 'rgba(255, 255, 255, 0.2)', x: 0, y: 2, blur: 8, spread: 0, emboss: 'none' }
38
38
  })
@@ -0,0 +1,59 @@
1
+ import { lightTheme } from './light'
2
+
3
+ export const glassLightTheme = lightTheme.new({
4
+ color: {
5
+ primary: '#3B82F6',
6
+ success: '#10B981',
7
+ warning: '#F59E0B',
8
+ danger: '#EF4444',
9
+ info: '#06B6D4',
10
+ disabled: '#E5E7EB',
11
+ default: '#F3F4F6'
12
+ },
13
+ bg: {
14
+ color: {
15
+ bottom: 'rgba(255, 255, 255, 0.45)',
16
+ middle: 'rgba(255, 255, 255, 0.55)',
17
+ top: 'rgba(255, 255, 255, 0.6)',
18
+ hover: 'rgba(255, 255, 255, 0.75)',
19
+ black: '#000000'
20
+ },
21
+ filter: { blur: 'blur(24px)', saturate: 'saturate(180%)' }
22
+ },
23
+ border: { color: 'rgba(255, 255, 255, 0.5)', width: 1, style: 'solid' },
24
+ 'text-color': {
25
+ title: '#1E293B',
26
+ main: '#334155',
27
+ placeholder: '#94A3B8',
28
+ second: '#64748B',
29
+ assist: '#CBD5E1',
30
+ disabled: '#94A3B8',
31
+ white: '#FFFFFF'
32
+ },
33
+ shadow: { color: 'rgba(0, 0, 0, 0.08)', x: 0, y: 4, blur: 24, spread: 0, emboss: 'none' }
34
+ })
35
+
36
+ export const glassDarkTheme = glassLightTheme.new({
37
+ color: { disabled: '#374151', default: '#1E293B' },
38
+ bg: {
39
+ color: {
40
+ bottom: 'rgba(15, 23, 42, 0.6)',
41
+ middle: 'rgba(15, 23, 42, 0.7)',
42
+ top: 'rgba(15, 23, 42, 0.75)',
43
+ hover: 'rgba(30, 41, 59, 0.85)',
44
+ black: '#000000'
45
+ },
46
+ filter: { blur: 'blur(20px)', saturate: 'saturate(200%)' }
47
+ },
48
+ border: { color: 'rgba(255, 255, 255, 0.12)' },
49
+ 'text-color': {
50
+ title: '#F8FAFC',
51
+ main: '#F1F5F9',
52
+ second: '#94A3B8',
53
+ placeholder: '#64748B',
54
+ assist: '#64748B',
55
+ disabled: '#475569',
56
+ white: '#ffffff'
57
+ },
58
+ shadow: { color: 'rgba(0, 0, 0, 0.35)', x: 0, y: 4, blur: 32, spread: 0, emboss: 'none' }
59
+ })
@@ -0,0 +1,63 @@
1
+ import { lightTheme } from './light'
2
+
3
+ export const heroLightTheme = lightTheme.new({
4
+ color: {
5
+ primary: '#7828c8', // purple
6
+ success: '#17c964',
7
+ warning: '#f5a524',
8
+ danger: '#f31260',
9
+ info: '#006fee',
10
+ disabled: '#f4f4f5',
11
+ default: '#f4f4f5'
12
+ },
13
+ border: { width: 2, color: '#00000000' },
14
+ 'text-color': {
15
+ title: '#11181C',
16
+ main: '#11181C',
17
+ second: '#71717A',
18
+ placeholder: '#A1A1AA',
19
+ assist: '#A1A1AA',
20
+ disabled: '#A1A1AA',
21
+ white: '#FFFFFF'
22
+ },
23
+ radius: { small: 8, default: 12, large: 14 },
24
+ shadow: {
25
+ color: 'rgba(0, 0, 0, 0.08)',
26
+ x: 0,
27
+ y: 4,
28
+ blur: 14,
29
+ spread: 0,
30
+ emboss: '0 2px 4px 0 #0000000a,0 1px 2px 0 #0000000f,0 0 3px 0px #0000000f'
31
+ }
32
+ })
33
+
34
+ export const heroDarkTheme = heroLightTheme.new({
35
+ color: { primary: '#9353d3', disabled: '#27272a', default: '#27272a' },
36
+ bg: {
37
+ color: {
38
+ bottom: '#000000',
39
+ middle: '#18181b',
40
+ top: '#27272a',
41
+ hover: '#3f3f46',
42
+ black: '#000000'
43
+ }
44
+ },
45
+ border: { color: '#3f3f46' },
46
+ 'text-color': {
47
+ title: '#ECEDEE',
48
+ main: '#ECEDEE',
49
+ second: '#A1A1AA',
50
+ placeholder: '#71717A',
51
+ assist: '#71717A',
52
+ disabled: '#71717A',
53
+ white: '#000000'
54
+ },
55
+ shadow: {
56
+ color: 'rgba(0, 0, 0, 0.2)',
57
+ x: 0,
58
+ y: 4,
59
+ blur: 14,
60
+ spread: 0,
61
+ emboss: '0 2px 4px 0 #0000000a,0 1px 2px 0 #0000000f,0 0 1px 0 #0000000f'
62
+ }
63
+ })
@@ -8,6 +8,9 @@ export {
8
8
  export { UITheme } from './ui-theme'
9
9
  export { lightTheme } from './light'
10
10
  export { darkTheme } from './dark'
11
+ export { shadcnLightTheme, shadcnDarkTheme } from './shadcn'
12
+ export { heroLightTheme, heroDarkTheme } from './hero'
13
+ export { glassLightTheme, glassDarkTheme } from './glass'
11
14
  export type * from './type'
12
15
  export { cssVar, defineBySize, HEXToRGB, mixColor } from './helper'
13
16
  export { currentTheme, loadTheme, setTheme } from '../load-theme'
@@ -22,7 +22,7 @@ export const lightTheme: UITheme = new UITheme(
22
22
  black: '#000000'
23
23
  },
24
24
 
25
- filter: { blur: 'blur(16px)', saturate: 'saturate(180%)' }
25
+ filter: { blur: 'none', saturate: 'none' }
26
26
  },
27
27
 
28
28
  border: { color: '#dcdfe6', width: 1, style: 'solid' },
@@ -50,7 +50,7 @@ export const lightTheme: UITheme = new UITheme(
50
50
 
51
51
  'font-size-assist': defineBySize({ small: 12, default: 12, large: 14 }),
52
52
 
53
- shadow: { color: '#0000001a', x: 0, y: 0, blur: 4, spread: 1 },
53
+ shadow: { color: '#0000001a', x: 0, y: 0, blur: 4, spread: 1, emboss: 'none' },
54
54
 
55
55
  gap: defineBySize({ small: 6, default: 8, large: 12 }),
56
56
 
@@ -0,0 +1,61 @@
1
+ import { lightTheme } from './light'
2
+
3
+ export const shadcnLightTheme = lightTheme.new({
4
+ color: {
5
+ primary: '#18181b', // zinc-900
6
+ success: '#22c55e',
7
+ warning: '#f59e0b',
8
+ danger: '#ef4444',
9
+ info: '#3b82f6',
10
+ disabled: '#f4f4f5',
11
+ default: '#fafafa'
12
+ },
13
+ bg: {
14
+ color: {
15
+ bottom: '#f4f4f5',
16
+ middle: '#fafafa',
17
+ top: '#ffffff',
18
+ hover: '#f4f4f5',
19
+ black: '#000000'
20
+ }
21
+ },
22
+ border: { color: '#e4e4e7' },
23
+ 'text-color': {
24
+ title: '#09090b',
25
+ main: '#09090b',
26
+ second: '#71717a',
27
+ placeholder: '#a1a1aa',
28
+ assist: '#a1a1aa',
29
+ disabled: '#a1a1aa',
30
+ white: '#ffffff'
31
+ },
32
+ radius: { small: 4, default: 6, large: 8 },
33
+ shadow: { color: 'rgba(0, 0, 0, 0.05)', x: 0, y: 1, blur: 2, spread: 0, emboss: 'none' }
34
+ })
35
+
36
+ export const shadcnDarkTheme = shadcnLightTheme.new({
37
+ color: {
38
+ primary: '#fafafa', // zinc-50
39
+ disabled: '#27272a',
40
+ default: '#18181b'
41
+ },
42
+ bg: {
43
+ color: {
44
+ bottom: '#09090b',
45
+ middle: '#18181b',
46
+ top: '#27272a',
47
+ hover: '#27272a',
48
+ black: '#000000'
49
+ }
50
+ },
51
+ border: { color: '#27272a' },
52
+ 'text-color': {
53
+ title: '#fafafa',
54
+ main: '#fafafa',
55
+ second: '#a1a1aa',
56
+ placeholder: '#71717a',
57
+ assist: '#71717a',
58
+ disabled: '#71717a',
59
+ white: '#000000'
60
+ }
61
+ })
package/src/theme/type.ts CHANGED
@@ -132,6 +132,8 @@ export type Theme = {
132
132
  blur: number
133
133
  /** 阴影扩散半径 */
134
134
  spread: number
135
+ /** 浮雕阴影:非浮雕主题为 'none',浮雕主题为完整 box-shadow 值 */
136
+ emboss: string
135
137
  }
136
138
  /** 间距 */
137
139
  gap: {
@@ -114,7 +114,8 @@ export class UITheme {
114
114
 
115
115
  private renderBGFilter(theme: Theme): string {
116
116
  const { filter } = theme.bg
117
- return `--u-bg-filter: ${filter.blur} ${filter.saturate}`
117
+ const value = filter.blur === 'none' ? 'none' : `${filter.blur} ${filter.saturate}`
118
+ return `--u-bg-filter: ${value}`
118
119
  }
119
120
 
120
121
  /** 主题变量声明列表,均为 `--u-` 前缀的 CSS 自定义属性 */