@xto/core 1.2.3 → 1.3.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/es/index.mjs +109 -107
- package/es/theme/index.d.ts +18 -5
- package/es/theme/index.mjs +274 -148
- package/lib/index.cjs +1 -1
- package/lib/theme/index.cjs +1 -1
- package/package.json +6 -6
package/es/index.mjs
CHANGED
|
@@ -1,121 +1,123 @@
|
|
|
1
|
-
import { applyCSSVars as
|
|
2
|
-
import { b as
|
|
3
|
-
import { useClickOutside as
|
|
4
|
-
import { createLocaleProvider as
|
|
1
|
+
import { applyCSSVars as r, applyDarkTheme as t, cssVarPrefix as n, darkCSSVars as i, defaultThemeConfig as a, generateCSSVars as d, generateColorPalette as l, getComponentSize as p, hexToRgb as x, isDarkTheme as u, mixColor as c, removeCSSVars as m, removeDarkTheme as g, rgbToHex as I, sizeMap as Z, toggleDarkTheme as S } from "./theme/index.mjs";
|
|
2
|
+
import { b as f, block as C, classNames as b, coerceToArray as y, compose as h, constant as D, createNamespace as v, debounce as M, deepClone as N, deepMerge as k, defaultNamespace as O, defaultTo as P, drawerZIndex as L, dropdownZIndex as V, e as w, element as A, flatten as j, get as z, getCurrentZIndex as E, getType as F, getZIndexList as R, identity as B, is as q, isAndroid as H, isArray as K, isBoolean as U, isBrowser as W, isDate as G, isDefined as J, isEmpty as Q, isFalse as X, isFunction as Y, isIOS as _, isMobile as $, isNil as ee, isNull as se, isNumber as oe, isObject as re, isPlainObject as te, isPromise as ne, isRegExp as ie, isString as ae, isSupportTouch as de, isTrue as le, isType as pe, isUndefined as xe, isWechat as ue, loadingZIndex as ce, m as me, messageZIndex as ge, modalZIndex as Ie, modifier as Ze, nextDrawerZIndex as Se, nextDropdownZIndex as Te, nextLoadingZIndex as fe, nextMessageZIndex as Ce, nextModalZIndex as be, nextPopoverZIndex as ye, nextSelectZIndex as he, nextTooltipZIndex as De, noop as ve, once as Me, pipe as Ne, popoverZIndex as ke, popupManage as Oe, resetZIndex as Pe, selectZIndex as Le, set as Ve, shortId as we, state as Ae, throttle as je, tooltipZIndex as ze, tryCatch as Ee, unary as Fe, unique as Re, useClass as Be, useComponentPrefix as qe, useNamespace as He, useZIndex as Ke, uuid as Ue } from "./utils/index.mjs";
|
|
3
|
+
import { useClickOutside as Ge, useDOMObserver as Je, useDelayedAction as Qe, useDisabled as Xe, useEscape as Ye, useFocus as _e, useIntersectionObserver as $e, useLoading as es, useModel as ss, useResize as os, useScroll as rs, useToggle as ts, useVisible as ns } from "./hooks/index.mjs";
|
|
4
|
+
import { createLocaleProvider as as, getSupportedLocales as ds, localeInjectionKey as ls, localeNames as ps, locales as xs, useLocale as us } from "./locale/index.mjs";
|
|
5
5
|
const e = "1.0.0";
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
r as applyCSSVars,
|
|
8
8
|
t as applyDarkTheme,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
f as b,
|
|
10
|
+
C as block,
|
|
11
|
+
b as classNames,
|
|
12
|
+
y as coerceToArray,
|
|
13
|
+
h as compose,
|
|
14
|
+
D as constant,
|
|
15
|
+
as as createLocaleProvider,
|
|
16
|
+
v as createNamespace,
|
|
17
|
+
n as cssVarPrefix,
|
|
18
18
|
i as darkCSSVars,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
M as debounce,
|
|
20
|
+
N as deepClone,
|
|
21
|
+
k as deepMerge,
|
|
22
|
+
O as defaultNamespace,
|
|
23
23
|
a as defaultThemeConfig,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
P as defaultTo,
|
|
25
|
+
L as drawerZIndex,
|
|
26
|
+
V as dropdownZIndex,
|
|
27
|
+
w as e,
|
|
28
|
+
A as element,
|
|
29
|
+
j as flatten,
|
|
30
30
|
d as generateCSSVars,
|
|
31
31
|
l as generateColorPalette,
|
|
32
|
-
|
|
32
|
+
z as get,
|
|
33
33
|
p as getComponentSize,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
E as getCurrentZIndex,
|
|
35
|
+
ds as getSupportedLocales,
|
|
36
|
+
F as getType,
|
|
37
|
+
R as getZIndexList,
|
|
38
38
|
x as hexToRgb,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
39
|
+
B as identity,
|
|
40
|
+
q as is,
|
|
41
|
+
H as isAndroid,
|
|
42
|
+
K as isArray,
|
|
43
|
+
U as isBoolean,
|
|
44
|
+
W as isBrowser,
|
|
45
|
+
u as isDarkTheme,
|
|
46
|
+
G as isDate,
|
|
47
|
+
J as isDefined,
|
|
48
|
+
Q as isEmpty,
|
|
49
|
+
X as isFalse,
|
|
50
|
+
Y as isFunction,
|
|
51
|
+
_ as isIOS,
|
|
52
|
+
$ as isMobile,
|
|
53
|
+
ee as isNil,
|
|
54
|
+
se as isNull,
|
|
55
|
+
oe as isNumber,
|
|
56
|
+
re as isObject,
|
|
57
|
+
te as isPlainObject,
|
|
57
58
|
ne as isPromise,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
59
|
+
ie as isRegExp,
|
|
60
|
+
ae as isString,
|
|
61
|
+
de as isSupportTouch,
|
|
62
|
+
le as isTrue,
|
|
63
|
+
pe as isType,
|
|
64
|
+
xe as isUndefined,
|
|
65
|
+
ue as isWechat,
|
|
66
|
+
ce as loadingZIndex,
|
|
67
|
+
ls as localeInjectionKey,
|
|
68
|
+
ps as localeNames,
|
|
69
|
+
xs as locales,
|
|
70
|
+
me as m,
|
|
71
|
+
ge as messageZIndex,
|
|
72
|
+
c as mixColor,
|
|
73
|
+
Ie as modalZIndex,
|
|
74
|
+
Ze as modifier,
|
|
75
|
+
Se as nextDrawerZIndex,
|
|
76
|
+
Te as nextDropdownZIndex,
|
|
77
|
+
fe as nextLoadingZIndex,
|
|
78
|
+
Ce as nextMessageZIndex,
|
|
79
|
+
be as nextModalZIndex,
|
|
80
|
+
ye as nextPopoverZIndex,
|
|
81
|
+
he as nextSelectZIndex,
|
|
82
|
+
De as nextTooltipZIndex,
|
|
83
|
+
ve as noop,
|
|
84
|
+
Me as once,
|
|
85
|
+
Ne as pipe,
|
|
86
|
+
ke as popoverZIndex,
|
|
87
|
+
Oe as popupManage,
|
|
88
|
+
m as removeCSSVars,
|
|
89
|
+
g as removeDarkTheme,
|
|
90
|
+
Pe as resetZIndex,
|
|
90
91
|
I as rgbToHex,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
92
|
+
Le as selectZIndex,
|
|
93
|
+
Ve as set,
|
|
94
|
+
we as shortId,
|
|
95
|
+
Z as sizeMap,
|
|
96
|
+
Ae as state,
|
|
97
|
+
je as throttle,
|
|
98
|
+
S as toggleDarkTheme,
|
|
99
|
+
ze as tooltipZIndex,
|
|
100
|
+
Ee as tryCatch,
|
|
101
|
+
Fe as unary,
|
|
102
|
+
Re as unique,
|
|
103
|
+
Be as useClass,
|
|
104
|
+
Ge as useClickOutside,
|
|
105
|
+
qe as useComponentPrefix,
|
|
106
|
+
Je as useDOMObserver,
|
|
107
|
+
Qe as useDelayedAction,
|
|
108
|
+
Xe as useDisabled,
|
|
109
|
+
Ye as useEscape,
|
|
110
|
+
_e as useFocus,
|
|
111
|
+
$e as useIntersectionObserver,
|
|
112
|
+
es as useLoading,
|
|
113
|
+
us as useLocale,
|
|
114
|
+
ss as useModel,
|
|
115
|
+
He as useNamespace,
|
|
116
|
+
os as useResize,
|
|
117
|
+
rs as useScroll,
|
|
118
|
+
ts as useToggle,
|
|
117
119
|
ns as useVisible,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
Ke as useZIndex,
|
|
121
|
+
Ue as uuid,
|
|
120
122
|
e as version
|
|
121
123
|
};
|
package/es/theme/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare const getComponentSize: (size: ComponentSize) => number;
|
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```ts
|
|
24
|
-
* const palette = generateColorPalette('#
|
|
24
|
+
* const palette = generateColorPalette('#4F46E5', 10)
|
|
25
25
|
* // 生成 10 个不同亮度的颜色
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
@@ -64,7 +64,7 @@ export declare const cssVarPrefix = "--xto";
|
|
|
64
64
|
* @example
|
|
65
65
|
* ```ts
|
|
66
66
|
* const vars = generateCSSVars(themeConfig)
|
|
67
|
-
* // { '--xto-color-primary': '#
|
|
67
|
+
* // { '--xto-color-primary': '#4F46E5', ... }
|
|
68
68
|
* ```
|
|
69
69
|
*/
|
|
70
70
|
export declare function generateCSSVars(config: ThemeConfig): Record<string, string>;
|
|
@@ -78,14 +78,27 @@ export declare function applyCSSVars(config: ThemeConfig): void;
|
|
|
78
78
|
*/
|
|
79
79
|
export declare function removeCSSVars(): void;
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
81
|
+
* 暗色主题 CSS 变量
|
|
82
|
+
* 使用 html.dark 类名方式切换
|
|
82
83
|
*/
|
|
83
84
|
export declare const darkCSSVars: Record<string, string>;
|
|
84
85
|
/**
|
|
85
|
-
*
|
|
86
|
+
* 应用暗色主题
|
|
87
|
+
* 在 <html> 元素上添加 dark 类名
|
|
86
88
|
*/
|
|
87
89
|
export declare function applyDarkTheme(): void;
|
|
88
90
|
/**
|
|
89
|
-
*
|
|
91
|
+
* 移除暗色主题
|
|
92
|
+
* 从 <html> 元素上移除 dark 类名
|
|
90
93
|
*/
|
|
91
94
|
export declare function removeDarkTheme(): void;
|
|
95
|
+
/**
|
|
96
|
+
* 检查是否为暗色模式
|
|
97
|
+
* @returns 是否为暗色模式
|
|
98
|
+
*/
|
|
99
|
+
export declare function isDarkTheme(): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* 切换暗色模式
|
|
102
|
+
* @param isDark 是否启用暗色模式
|
|
103
|
+
*/
|
|
104
|
+
export declare function toggleDarkTheme(isDark?: boolean): void;
|
package/es/theme/index.mjs
CHANGED
|
@@ -1,185 +1,311 @@
|
|
|
1
|
-
const
|
|
1
|
+
const b = {
|
|
2
2
|
mode: "light",
|
|
3
|
-
primary: "#
|
|
4
|
-
success: "#
|
|
5
|
-
warning: "#
|
|
6
|
-
danger: "#
|
|
7
|
-
info: "#
|
|
3
|
+
primary: "#4F46E5",
|
|
4
|
+
success: "#10B981",
|
|
5
|
+
warning: "#F59E0B",
|
|
6
|
+
danger: "#EF4444",
|
|
7
|
+
info: "#6B7280",
|
|
8
8
|
size: "default"
|
|
9
|
-
},
|
|
9
|
+
}, g = {
|
|
10
10
|
large: 40,
|
|
11
11
|
default: 32,
|
|
12
12
|
small: 24
|
|
13
|
-
},
|
|
14
|
-
function
|
|
15
|
-
const t = [],
|
|
16
|
-
let
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
} else if (
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
|
|
13
|
+
}, x = (l) => g[l];
|
|
14
|
+
function B(l, o = 10) {
|
|
15
|
+
const t = [], e = l.startsWith("#"), c = l.startsWith("rgb");
|
|
16
|
+
let n, s, a;
|
|
17
|
+
if (e) {
|
|
18
|
+
const i = l.slice(1);
|
|
19
|
+
n = parseInt(i.slice(0, 2), 16), s = parseInt(i.slice(2, 4), 16), a = parseInt(i.slice(4, 6), 16);
|
|
20
|
+
} else if (c) {
|
|
21
|
+
const i = l.match(/\d+/g);
|
|
22
|
+
if (i)
|
|
23
|
+
n = Number(i[0]), s = Number(i[1]), a = Number(i[2]);
|
|
24
24
|
else
|
|
25
25
|
return t;
|
|
26
26
|
} else
|
|
27
27
|
return t;
|
|
28
|
-
const
|
|
29
|
-
for (let
|
|
30
|
-
const
|
|
31
|
-
t.push(`rgb(${
|
|
28
|
+
const F = 100 / (o + 1);
|
|
29
|
+
for (let i = 1; i <= o; i++) {
|
|
30
|
+
const $ = 1 - F * i / 100, d = Math.round(n + (255 - n) * $), p = Math.round(s + (255 - s) * $), u = Math.round(a + (255 - a) * $);
|
|
31
|
+
t.push(`rgb(${d}, ${p}, ${u})`);
|
|
32
32
|
}
|
|
33
33
|
return t;
|
|
34
34
|
}
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
return
|
|
38
|
-
r: parseInt(
|
|
39
|
-
g: parseInt(
|
|
40
|
-
b: parseInt(
|
|
35
|
+
const h = (l) => {
|
|
36
|
+
const o = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(l);
|
|
37
|
+
return o ? {
|
|
38
|
+
r: parseInt(o[1], 16),
|
|
39
|
+
g: parseInt(o[2], 16),
|
|
40
|
+
b: parseInt(o[3], 16)
|
|
41
41
|
} : null;
|
|
42
|
-
},
|
|
43
|
-
const
|
|
44
|
-
if (!
|
|
45
|
-
const
|
|
46
|
-
return
|
|
47
|
-
},
|
|
48
|
-
function
|
|
49
|
-
const
|
|
42
|
+
}, m = (l, o, t) => "#" + [l, o, t].map((e) => e.toString(16).padStart(2, "0")).join(""), E = (l, o, t = 0.5) => {
|
|
43
|
+
const e = h(l), c = h(o);
|
|
44
|
+
if (!e || !c) return l;
|
|
45
|
+
const n = Math.round(e.r * (1 - t) + c.r * t), s = Math.round(e.g * (1 - t) + c.g * t), a = Math.round(e.b * (1 - t) + c.b * t);
|
|
46
|
+
return m(n, s, a);
|
|
47
|
+
}, r = "--xto";
|
|
48
|
+
function f(l) {
|
|
49
|
+
const o = r;
|
|
50
50
|
return {
|
|
51
|
-
//
|
|
52
|
-
[`${
|
|
53
|
-
[`${
|
|
54
|
-
[`${
|
|
55
|
-
[`${
|
|
56
|
-
[`${
|
|
51
|
+
// 品牌色
|
|
52
|
+
[`${o}-color-primary`]: l.primary,
|
|
53
|
+
[`${o}-color-on-primary`]: "#FFFFFF",
|
|
54
|
+
[`${o}-color-secondary`]: "#6366F1",
|
|
55
|
+
[`${o}-color-accent`]: "#EA580C",
|
|
56
|
+
[`${o}-color-destructive`]: "#DC2626",
|
|
57
|
+
[`${o}-color-ring`]: l.primary,
|
|
58
|
+
// 品牌色变体
|
|
59
|
+
[`${o}-color-primary-light-1`]: "#5B54E8",
|
|
60
|
+
[`${o}-color-primary-light-2`]: "#6366F1",
|
|
61
|
+
[`${o}-color-primary-light-3`]: "#7578F3",
|
|
62
|
+
[`${o}-color-primary-light-4`]: "#818CF8",
|
|
63
|
+
[`${o}-color-primary-light-5`]: "#93A0FA",
|
|
64
|
+
[`${o}-color-primary-light-6`]: "#A5B4FC",
|
|
65
|
+
[`${o}-color-primary-light-7`]: "#BCC5FD",
|
|
66
|
+
[`${o}-color-primary-light-8`]: "#D4D7FE",
|
|
67
|
+
[`${o}-color-primary-light-9`]: "#EEF2FF",
|
|
68
|
+
// 语义色
|
|
69
|
+
[`${o}-color-success`]: l.success,
|
|
70
|
+
[`${o}-color-success-light-1`]: "#14C68E",
|
|
71
|
+
[`${o}-color-success-light-2`]: "#1AD49B",
|
|
72
|
+
[`${o}-color-success-light-3`]: "#2DD4A0",
|
|
73
|
+
[`${o}-color-success-light-4`]: "#34D399",
|
|
74
|
+
[`${o}-color-success-light-5`]: "#4EDDA6",
|
|
75
|
+
[`${o}-color-success-light-6`]: "#6EE7B7",
|
|
76
|
+
[`${o}-color-success-light-7`]: "#A7F3D0",
|
|
77
|
+
[`${o}-color-success-light-8`]: "#D1FAE5",
|
|
78
|
+
[`${o}-color-success-light-9`]: "#ECFDF5",
|
|
79
|
+
[`${o}-color-warning`]: l.warning,
|
|
80
|
+
[`${o}-color-warning-light-1`]: "#F7A621",
|
|
81
|
+
[`${o}-color-warning-light-2`]: "#F9B037",
|
|
82
|
+
[`${o}-color-warning-light-3`]: "#FBBF24",
|
|
83
|
+
[`${o}-color-warning-light-4`]: "#FCD34D",
|
|
84
|
+
[`${o}-color-warning-light-5`]: "#FDE047",
|
|
85
|
+
[`${o}-color-warning-light-6`]: "#FEE78A",
|
|
86
|
+
[`${o}-color-warning-light-7`]: "#FEF3C7",
|
|
87
|
+
[`${o}-color-warning-light-8`]: "#FEF9C3",
|
|
88
|
+
[`${o}-color-warning-light-9`]: "#FFFBEB",
|
|
89
|
+
[`${o}-color-danger`]: l.danger,
|
|
90
|
+
[`${o}-color-danger-light-1`]: "#F15353",
|
|
91
|
+
[`${o}-color-danger-light-2`]: "#F36363",
|
|
92
|
+
[`${o}-color-danger-light-3`]: "#F87171",
|
|
93
|
+
[`${o}-color-danger-light-4`]: "#F98A8A",
|
|
94
|
+
[`${o}-color-danger-light-5`]: "#FCA5A5",
|
|
95
|
+
[`${o}-color-danger-light-6`]: "#FDBDBD",
|
|
96
|
+
[`${o}-color-danger-light-7`]: "#FECACA",
|
|
97
|
+
[`${o}-color-danger-light-8`]: "#FEE2E2",
|
|
98
|
+
[`${o}-color-danger-light-9`]: "#FEF2F2",
|
|
99
|
+
[`${o}-color-info`]: l.info,
|
|
100
|
+
[`${o}-color-info-light-1`]: "#7B8290",
|
|
101
|
+
[`${o}-color-info-light-2`]: "#8A919E",
|
|
102
|
+
[`${o}-color-info-light-3`]: "#9CA3AF",
|
|
103
|
+
[`${o}-color-info-light-4`]: "#AAB0BB",
|
|
104
|
+
[`${o}-color-info-light-5`]: "#B8BDC7",
|
|
105
|
+
[`${o}-color-info-light-6`]: "#C9CDD5",
|
|
106
|
+
[`${o}-color-info-light-7`]: "#D1D5DB",
|
|
107
|
+
[`${o}-color-info-light-8`]: "#E5E7EB",
|
|
108
|
+
[`${o}-color-info-light-9`]: "#F3F4F6",
|
|
57
109
|
// 文本颜色
|
|
58
|
-
[`${
|
|
59
|
-
[`${
|
|
60
|
-
[`${
|
|
61
|
-
[`${
|
|
62
|
-
[`${
|
|
110
|
+
[`${o}-color-text-primary`]: "#1F2937",
|
|
111
|
+
[`${o}-color-text-regular`]: "#4B5563",
|
|
112
|
+
[`${o}-color-text-secondary`]: "#6B7280",
|
|
113
|
+
[`${o}-color-text-placeholder`]: "#9CA3AF",
|
|
114
|
+
[`${o}-color-text-disabled`]: "#D1D5DB",
|
|
63
115
|
// 边框颜色
|
|
64
|
-
[`${
|
|
65
|
-
[`${
|
|
66
|
-
[`${
|
|
67
|
-
[`${
|
|
68
|
-
[`${
|
|
69
|
-
[`${
|
|
116
|
+
[`${o}-border-color`]: "#D1D5DB",
|
|
117
|
+
[`${o}-border-color-light`]: "#E5E7EB",
|
|
118
|
+
[`${o}-border-color-lighter`]: "#F3F4F6",
|
|
119
|
+
[`${o}-border-color-extra-light`]: "#F9FAFB",
|
|
120
|
+
[`${o}-border-color-dark`]: "#9CA3AF",
|
|
121
|
+
[`${o}-border-color-darker`]: "#6B7280",
|
|
70
122
|
// 填充颜色
|
|
71
|
-
[`${
|
|
72
|
-
[`${
|
|
73
|
-
[`${
|
|
74
|
-
[`${
|
|
75
|
-
[`${
|
|
76
|
-
[`${
|
|
77
|
-
[`${
|
|
123
|
+
[`${o}-fill-color`]: "#F3F4F6",
|
|
124
|
+
[`${o}-fill-color-light`]: "#F9FAFB",
|
|
125
|
+
[`${o}-fill-color-lighter`]: "#F9FAFB",
|
|
126
|
+
[`${o}-fill-color-extra-light`]: "#F9FAFB",
|
|
127
|
+
[`${o}-fill-color-dark`]: "#E5E7EB",
|
|
128
|
+
[`${o}-fill-color-darker`]: "#D1D5DB",
|
|
129
|
+
[`${o}-fill-color-blank`]: "#FFFFFF",
|
|
78
130
|
// 背景颜色
|
|
79
|
-
[`${
|
|
80
|
-
[`${
|
|
81
|
-
[`${
|
|
82
|
-
// 字体
|
|
83
|
-
[`${r}-font-family`]: "'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif",
|
|
84
|
-
[`${r}-font-size-extra-small`]: "12px",
|
|
85
|
-
[`${r}-font-size-small`]: "13px",
|
|
86
|
-
[`${r}-font-size-base`]: "14px",
|
|
87
|
-
[`${r}-font-size-medium`]: "16px",
|
|
88
|
-
[`${r}-font-size-large`]: "18px",
|
|
89
|
-
[`${r}-font-size-extra-large`]: "20px",
|
|
90
|
-
// 行高
|
|
91
|
-
[`${r}-line-height-extra-small`]: "1.4",
|
|
92
|
-
[`${r}-line-height-small`]: "1.5",
|
|
93
|
-
[`${r}-line-height-base`]: "1.6",
|
|
94
|
-
[`${r}-line-height-medium`]: "1.7",
|
|
95
|
-
[`${r}-line-height-large`]: "1.8",
|
|
96
|
-
[`${r}-line-height-extra-large`]: "1.9",
|
|
131
|
+
[`${o}-bg-color`]: "#FFFFFF",
|
|
132
|
+
[`${o}-bg-color-page`]: "#F9FAFB",
|
|
133
|
+
[`${o}-bg-color-overlay`]: "#FFFFFF",
|
|
97
134
|
// 圆角
|
|
98
|
-
[`${
|
|
99
|
-
[`${
|
|
100
|
-
[`${
|
|
101
|
-
[`${
|
|
102
|
-
[`${
|
|
135
|
+
[`${o}-border-radius-small`]: "4px",
|
|
136
|
+
[`${o}-border-radius-base`]: "6px",
|
|
137
|
+
[`${o}-border-radius-large`]: "8px",
|
|
138
|
+
[`${o}-border-radius-xl`]: "12px",
|
|
139
|
+
[`${o}-border-radius-round`]: "20px",
|
|
140
|
+
[`${o}-border-radius-circle`]: "100%",
|
|
103
141
|
// 阴影
|
|
104
|
-
[`${
|
|
105
|
-
[`${
|
|
106
|
-
[`${
|
|
107
|
-
[`${
|
|
142
|
+
[`${o}-shadow-subtle`]: "0 1px 2px rgba(0, 0, 0, 0.05)",
|
|
143
|
+
[`${o}-shadow-base`]: "0 2px 4px rgba(0, 0, 0, 0.08)",
|
|
144
|
+
[`${o}-shadow-elevated`]: "0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
145
|
+
[`${o}-shadow-prominent`]: "0 8px 24px rgba(0, 0, 0, 0.12)",
|
|
146
|
+
// 字体
|
|
147
|
+
[`${o}-font-family`]: "'Inter', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif",
|
|
148
|
+
[`${o}-font-size-xs`]: "12px",
|
|
149
|
+
[`${o}-font-size-sm`]: "13px",
|
|
150
|
+
[`${o}-font-size-base`]: "14px",
|
|
151
|
+
[`${o}-font-size-md`]: "16px",
|
|
152
|
+
[`${o}-font-size-lg`]: "18px",
|
|
153
|
+
[`${o}-font-size-xl`]: "20px",
|
|
154
|
+
// 行高
|
|
155
|
+
[`${o}-line-height-tight`]: "1.3",
|
|
156
|
+
[`${o}-line-height-base`]: "1.5",
|
|
157
|
+
[`${o}-line-height-normal`]: "1.6",
|
|
158
|
+
[`${o}-line-height-loose`]: "1.8",
|
|
159
|
+
// 间距
|
|
160
|
+
[`${o}-spacing-xs`]: "4px",
|
|
161
|
+
[`${o}-spacing-sm`]: "8px",
|
|
162
|
+
[`${o}-spacing-md`]: "12px",
|
|
163
|
+
[`${o}-spacing-base`]: "16px",
|
|
164
|
+
[`${o}-spacing-lg`]: "24px",
|
|
165
|
+
[`${o}-spacing-xl`]: "32px",
|
|
108
166
|
// 组件尺寸
|
|
109
|
-
[`${
|
|
110
|
-
[`${
|
|
111
|
-
[`${
|
|
167
|
+
[`${o}-component-size`]: `${g[l.size]}px`,
|
|
168
|
+
[`${o}-component-size-large`]: `${g.large}px`,
|
|
169
|
+
[`${o}-component-size-small`]: `${g.small}px`,
|
|
112
170
|
// 动画
|
|
113
|
-
[`${
|
|
114
|
-
[`${
|
|
115
|
-
[`${
|
|
171
|
+
[`${o}-transition-duration-fast`]: "150ms",
|
|
172
|
+
[`${o}-transition-duration-base`]: "250ms",
|
|
173
|
+
[`${o}-transition-duration-slow`]: "350ms",
|
|
174
|
+
[`${o}-transition-easing`]: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
175
|
+
[`${o}-transition-easing-in`]: "cubic-bezier(0.4, 0, 1, 1)",
|
|
176
|
+
[`${o}-transition-easing-out`]: "cubic-bezier(0, 0, 0.2, 1)"
|
|
116
177
|
};
|
|
117
178
|
}
|
|
118
|
-
function
|
|
119
|
-
const
|
|
120
|
-
Object.entries(
|
|
121
|
-
t.style.setProperty(
|
|
179
|
+
function A(l) {
|
|
180
|
+
const o = f(l), t = document.documentElement;
|
|
181
|
+
Object.entries(o).forEach(([e, c]) => {
|
|
182
|
+
t.style.setProperty(e, c);
|
|
122
183
|
});
|
|
123
184
|
}
|
|
124
|
-
function
|
|
125
|
-
const
|
|
126
|
-
for (let t =
|
|
127
|
-
const
|
|
128
|
-
|
|
185
|
+
function D() {
|
|
186
|
+
const o = document.documentElement.style;
|
|
187
|
+
for (let t = o.length - 1; t >= 0; t--) {
|
|
188
|
+
const e = o[t];
|
|
189
|
+
e.startsWith(r) && o.removeProperty(e);
|
|
129
190
|
}
|
|
130
191
|
}
|
|
131
|
-
const
|
|
192
|
+
const C = {
|
|
193
|
+
// 品牌色
|
|
194
|
+
[`${r}-color-primary`]: "#818CF8",
|
|
195
|
+
[`${r}-color-on-primary`]: "#1E1B4B",
|
|
196
|
+
[`${r}-color-secondary`]: "#A5B4FC",
|
|
197
|
+
[`${r}-color-accent`]: "#FB923C",
|
|
198
|
+
[`${r}-color-destructive`]: "#F87171",
|
|
199
|
+
[`${r}-color-ring`]: "#818CF8",
|
|
200
|
+
// 品牌色变体
|
|
201
|
+
[`${r}-color-primary-light-1`]: "#7578F3",
|
|
202
|
+
[`${r}-color-primary-light-2`]: "#6366F1",
|
|
203
|
+
[`${r}-color-primary-light-3`]: "#6366F1",
|
|
204
|
+
[`${r}-color-primary-light-4`]: "#4F46E5",
|
|
205
|
+
[`${r}-color-primary-light-5`]: "#4338CA",
|
|
206
|
+
[`${r}-color-primary-light-6`]: "#3730A3",
|
|
207
|
+
[`${r}-color-primary-light-7`]: "#312E81",
|
|
208
|
+
[`${r}-color-primary-light-8`]: "#2B2680",
|
|
209
|
+
[`${r}-color-primary-light-9`]: "#1E1B4B",
|
|
210
|
+
// 语义色
|
|
211
|
+
[`${r}-color-success`]: "#34D399",
|
|
212
|
+
[`${r}-color-success-light-1`]: "#2DD4A0",
|
|
213
|
+
[`${r}-color-success-light-2`]: "#1AD49B",
|
|
214
|
+
[`${r}-color-success-light-3`]: "#14C68E",
|
|
215
|
+
[`${r}-color-success-light-4`]: "#10B981",
|
|
216
|
+
[`${r}-color-success-light-5`]: "#059669",
|
|
217
|
+
[`${r}-color-success-light-6`]: "#047857",
|
|
218
|
+
[`${r}-color-success-light-7`]: "#065F46",
|
|
219
|
+
[`${r}-color-success-light-8`]: "#064E3B",
|
|
220
|
+
[`${r}-color-success-light-9`]: "#022C22",
|
|
221
|
+
[`${r}-color-warning`]: "#FBBF24",
|
|
222
|
+
[`${r}-color-warning-light-1`]: "#F9B037",
|
|
223
|
+
[`${r}-color-warning-light-2`]: "#F7A621",
|
|
224
|
+
[`${r}-color-warning-light-3`]: "#F59E0B",
|
|
225
|
+
[`${r}-color-warning-light-4`]: "#D97706",
|
|
226
|
+
[`${r}-color-warning-light-5`]: "#B45309",
|
|
227
|
+
[`${r}-color-warning-light-6`]: "#92400E",
|
|
228
|
+
[`${r}-color-warning-light-7`]: "#78350F",
|
|
229
|
+
[`${r}-color-warning-light-8`]: "#451A03",
|
|
230
|
+
[`${r}-color-warning-light-9`]: "#1C1917",
|
|
231
|
+
[`${r}-color-danger`]: "#F87171",
|
|
232
|
+
[`${r}-color-danger-light-1`]: "#F36363",
|
|
233
|
+
[`${r}-color-danger-light-2`]: "#F15353",
|
|
234
|
+
[`${r}-color-danger-light-3`]: "#EF4444",
|
|
235
|
+
[`${r}-color-danger-light-4`]: "#DC2626",
|
|
236
|
+
[`${r}-color-danger-light-5`]: "#B91C1C",
|
|
237
|
+
[`${r}-color-danger-light-6`]: "#991B1B",
|
|
238
|
+
[`${r}-color-danger-light-7`]: "#7F1D1D",
|
|
239
|
+
[`${r}-color-danger-light-8`]: "#450A0A",
|
|
240
|
+
[`${r}-color-danger-light-9`]: "#1C1917",
|
|
241
|
+
[`${r}-color-info`]: "#9CA3AF",
|
|
242
|
+
[`${r}-color-info-light-1`]: "#8A919E",
|
|
243
|
+
[`${r}-color-info-light-2`]: "#7B8290",
|
|
244
|
+
[`${r}-color-info-light-3`]: "#6B7280",
|
|
245
|
+
[`${r}-color-info-light-4`]: "#4B5563",
|
|
246
|
+
[`${r}-color-info-light-5`]: "#374151",
|
|
247
|
+
[`${r}-color-info-light-6`]: "#1F2937",
|
|
248
|
+
[`${r}-color-info-light-7`]: "#111827",
|
|
249
|
+
[`${r}-color-info-light-8`]: "#0A0F1A",
|
|
250
|
+
[`${r}-color-info-light-9`]: "#030712",
|
|
132
251
|
// 文本颜色
|
|
133
|
-
[`${
|
|
134
|
-
[`${
|
|
135
|
-
[`${
|
|
136
|
-
[`${
|
|
137
|
-
[`${
|
|
252
|
+
[`${r}-color-text-primary`]: "#F9FAFB",
|
|
253
|
+
[`${r}-color-text-regular`]: "#E5E7EB",
|
|
254
|
+
[`${r}-color-text-secondary`]: "#9CA3AF",
|
|
255
|
+
[`${r}-color-text-placeholder`]: "#6B7280",
|
|
256
|
+
[`${r}-color-text-disabled`]: "#4B5563",
|
|
138
257
|
// 边框颜色
|
|
139
|
-
[`${
|
|
140
|
-
[`${
|
|
141
|
-
[`${
|
|
142
|
-
[`${
|
|
143
|
-
[`${
|
|
144
|
-
[`${
|
|
258
|
+
[`${r}-border-color`]: "#374151",
|
|
259
|
+
[`${r}-border-color-light`]: "#1F2937",
|
|
260
|
+
[`${r}-border-color-lighter`]: "#111827",
|
|
261
|
+
[`${r}-border-color-extra-light`]: "#0A0F1A",
|
|
262
|
+
[`${r}-border-color-dark`]: "#4B5563",
|
|
263
|
+
[`${r}-border-color-darker`]: "#6B7280",
|
|
145
264
|
// 填充颜色
|
|
146
|
-
[`${
|
|
147
|
-
[`${
|
|
148
|
-
[`${
|
|
149
|
-
[`${
|
|
150
|
-
[`${
|
|
151
|
-
[`${
|
|
152
|
-
[`${
|
|
265
|
+
[`${r}-fill-color`]: "#1F2937",
|
|
266
|
+
[`${r}-fill-color-light`]: "#111827",
|
|
267
|
+
[`${r}-fill-color-lighter`]: "#0A0F1A",
|
|
268
|
+
[`${r}-fill-color-extra-light`]: "#030712",
|
|
269
|
+
[`${r}-fill-color-dark`]: "#374151",
|
|
270
|
+
[`${r}-fill-color-darker`]: "#4B5563",
|
|
271
|
+
[`${r}-fill-color-blank`]: "#111827",
|
|
153
272
|
// 背景颜色
|
|
154
|
-
[`${
|
|
155
|
-
[`${
|
|
156
|
-
[`${
|
|
273
|
+
[`${r}-bg-color`]: "#111827",
|
|
274
|
+
[`${r}-bg-color-page`]: "#030712",
|
|
275
|
+
[`${r}-bg-color-overlay`]: "#1F2937",
|
|
276
|
+
// 阴影(暗色模式需更深阴影才可见)
|
|
277
|
+
[`${r}-shadow-subtle`]: "0 1px 3px rgba(0, 0, 0, 0.2)",
|
|
278
|
+
[`${r}-shadow-base`]: "0 2px 6px rgba(0, 0, 0, 0.25)",
|
|
279
|
+
[`${r}-shadow-elevated`]: "0 4px 16px rgba(0, 0, 0, 0.3)",
|
|
280
|
+
[`${r}-shadow-prominent`]: "0 8px 32px rgba(0, 0, 0, 0.35)"
|
|
157
281
|
};
|
|
158
|
-
function
|
|
159
|
-
|
|
160
|
-
Object.entries(b).forEach(([r, t]) => {
|
|
161
|
-
e.style.setProperty(r, t);
|
|
162
|
-
});
|
|
282
|
+
function y() {
|
|
283
|
+
document.documentElement.classList.add("dark");
|
|
163
284
|
}
|
|
164
|
-
function
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
285
|
+
function w() {
|
|
286
|
+
document.documentElement.classList.remove("dark");
|
|
287
|
+
}
|
|
288
|
+
function k() {
|
|
289
|
+
return document.documentElement.classList.contains("dark");
|
|
290
|
+
}
|
|
291
|
+
function z(l) {
|
|
292
|
+
l === void 0 ? document.documentElement.classList.toggle("dark") : l ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark");
|
|
169
293
|
}
|
|
170
294
|
export {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
E as
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
295
|
+
A as applyCSSVars,
|
|
296
|
+
y as applyDarkTheme,
|
|
297
|
+
r as cssVarPrefix,
|
|
298
|
+
C as darkCSSVars,
|
|
299
|
+
b as defaultThemeConfig,
|
|
300
|
+
f as generateCSSVars,
|
|
301
|
+
B as generateColorPalette,
|
|
302
|
+
x as getComponentSize,
|
|
303
|
+
h as hexToRgb,
|
|
304
|
+
k as isDarkTheme,
|
|
305
|
+
E as mixColor,
|
|
306
|
+
D as removeCSSVars,
|
|
307
|
+
w as removeDarkTheme,
|
|
308
|
+
m as rgbToHex,
|
|
309
|
+
g as sizeMap,
|
|
310
|
+
z as toggleDarkTheme
|
|
185
311
|
};
|
package/lib/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./theme/index.cjs"),e=require("./utils/index.cjs"),o=require("./hooks/index.cjs"),n=require("./locale/index.cjs"),t="1.0.0";exports.applyCSSVars=s.applyCSSVars;exports.applyDarkTheme=s.applyDarkTheme;exports.cssVarPrefix=s.cssVarPrefix;exports.darkCSSVars=s.darkCSSVars;exports.defaultThemeConfig=s.defaultThemeConfig;exports.generateCSSVars=s.generateCSSVars;exports.generateColorPalette=s.generateColorPalette;exports.getComponentSize=s.getComponentSize;exports.hexToRgb=s.hexToRgb;exports.mixColor=s.mixColor;exports.removeCSSVars=s.removeCSSVars;exports.removeDarkTheme=s.removeDarkTheme;exports.rgbToHex=s.rgbToHex;exports.sizeMap=s.sizeMap;exports.b=e.b;exports.block=e.block;exports.classNames=e.classNames;exports.coerceToArray=e.coerceToArray;exports.compose=e.compose;exports.constant=e.constant;exports.createNamespace=e.createNamespace;exports.debounce=e.debounce;exports.deepClone=e.deepClone;exports.deepMerge=e.deepMerge;exports.defaultNamespace=e.defaultNamespace;exports.defaultTo=e.defaultTo;exports.drawerZIndex=e.drawerZIndex;exports.dropdownZIndex=e.dropdownZIndex;exports.e=e.e;exports.element=e.element;exports.flatten=e.flatten;exports.get=e.get;exports.getCurrentZIndex=e.getCurrentZIndex;exports.getType=e.getType;exports.getZIndexList=e.getZIndexList;exports.identity=e.identity;exports.is=e.is;exports.isAndroid=e.isAndroid;exports.isArray=e.isArray;exports.isBoolean=e.isBoolean;exports.isBrowser=e.isBrowser;exports.isDate=e.isDate;exports.isDefined=e.isDefined;exports.isEmpty=e.isEmpty;exports.isFalse=e.isFalse;exports.isFunction=e.isFunction;exports.isIOS=e.isIOS;exports.isMobile=e.isMobile;exports.isNil=e.isNil;exports.isNull=e.isNull;exports.isNumber=e.isNumber;exports.isObject=e.isObject;exports.isPlainObject=e.isPlainObject;exports.isPromise=e.isPromise;exports.isRegExp=e.isRegExp;exports.isString=e.isString;exports.isSupportTouch=e.isSupportTouch;exports.isTrue=e.isTrue;exports.isType=e.isType;exports.isUndefined=e.isUndefined;exports.isWechat=e.isWechat;exports.loadingZIndex=e.loadingZIndex;exports.m=e.m;exports.messageZIndex=e.messageZIndex;exports.modalZIndex=e.modalZIndex;exports.modifier=e.modifier;exports.nextDrawerZIndex=e.nextDrawerZIndex;exports.nextDropdownZIndex=e.nextDropdownZIndex;exports.nextLoadingZIndex=e.nextLoadingZIndex;exports.nextMessageZIndex=e.nextMessageZIndex;exports.nextModalZIndex=e.nextModalZIndex;exports.nextPopoverZIndex=e.nextPopoverZIndex;exports.nextSelectZIndex=e.nextSelectZIndex;exports.nextTooltipZIndex=e.nextTooltipZIndex;exports.noop=e.noop;exports.once=e.once;exports.pipe=e.pipe;exports.popoverZIndex=e.popoverZIndex;exports.popupManage=e.popupManage;exports.resetZIndex=e.resetZIndex;exports.selectZIndex=e.selectZIndex;exports.set=e.set;exports.shortId=e.shortId;exports.state=e.state;exports.throttle=e.throttle;exports.tooltipZIndex=e.tooltipZIndex;exports.tryCatch=e.tryCatch;exports.unary=e.unary;exports.unique=e.unique;exports.useClass=e.useClass;exports.useComponentPrefix=e.useComponentPrefix;exports.useNamespace=e.useNamespace;exports.useZIndex=e.useZIndex;exports.uuid=e.uuid;exports.useClickOutside=o.useClickOutside;exports.useDOMObserver=o.useDOMObserver;exports.useDelayedAction=o.useDelayedAction;exports.useDisabled=o.useDisabled;exports.useEscape=o.useEscape;exports.useFocus=o.useFocus;exports.useIntersectionObserver=o.useIntersectionObserver;exports.useLoading=o.useLoading;exports.useModel=o.useModel;exports.useResize=o.useResize;exports.useScroll=o.useScroll;exports.useToggle=o.useToggle;exports.useVisible=o.useVisible;exports.createLocaleProvider=n.createLocaleProvider;exports.getSupportedLocales=n.getSupportedLocales;exports.localeInjectionKey=n.localeInjectionKey;exports.localeNames=n.localeNames;exports.locales=n.locales;exports.useLocale=n.useLocale;exports.version=t;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./theme/index.cjs"),e=require("./utils/index.cjs"),o=require("./hooks/index.cjs"),n=require("./locale/index.cjs"),t="1.0.0";exports.applyCSSVars=s.applyCSSVars;exports.applyDarkTheme=s.applyDarkTheme;exports.cssVarPrefix=s.cssVarPrefix;exports.darkCSSVars=s.darkCSSVars;exports.defaultThemeConfig=s.defaultThemeConfig;exports.generateCSSVars=s.generateCSSVars;exports.generateColorPalette=s.generateColorPalette;exports.getComponentSize=s.getComponentSize;exports.hexToRgb=s.hexToRgb;exports.isDarkTheme=s.isDarkTheme;exports.mixColor=s.mixColor;exports.removeCSSVars=s.removeCSSVars;exports.removeDarkTheme=s.removeDarkTheme;exports.rgbToHex=s.rgbToHex;exports.sizeMap=s.sizeMap;exports.toggleDarkTheme=s.toggleDarkTheme;exports.b=e.b;exports.block=e.block;exports.classNames=e.classNames;exports.coerceToArray=e.coerceToArray;exports.compose=e.compose;exports.constant=e.constant;exports.createNamespace=e.createNamespace;exports.debounce=e.debounce;exports.deepClone=e.deepClone;exports.deepMerge=e.deepMerge;exports.defaultNamespace=e.defaultNamespace;exports.defaultTo=e.defaultTo;exports.drawerZIndex=e.drawerZIndex;exports.dropdownZIndex=e.dropdownZIndex;exports.e=e.e;exports.element=e.element;exports.flatten=e.flatten;exports.get=e.get;exports.getCurrentZIndex=e.getCurrentZIndex;exports.getType=e.getType;exports.getZIndexList=e.getZIndexList;exports.identity=e.identity;exports.is=e.is;exports.isAndroid=e.isAndroid;exports.isArray=e.isArray;exports.isBoolean=e.isBoolean;exports.isBrowser=e.isBrowser;exports.isDate=e.isDate;exports.isDefined=e.isDefined;exports.isEmpty=e.isEmpty;exports.isFalse=e.isFalse;exports.isFunction=e.isFunction;exports.isIOS=e.isIOS;exports.isMobile=e.isMobile;exports.isNil=e.isNil;exports.isNull=e.isNull;exports.isNumber=e.isNumber;exports.isObject=e.isObject;exports.isPlainObject=e.isPlainObject;exports.isPromise=e.isPromise;exports.isRegExp=e.isRegExp;exports.isString=e.isString;exports.isSupportTouch=e.isSupportTouch;exports.isTrue=e.isTrue;exports.isType=e.isType;exports.isUndefined=e.isUndefined;exports.isWechat=e.isWechat;exports.loadingZIndex=e.loadingZIndex;exports.m=e.m;exports.messageZIndex=e.messageZIndex;exports.modalZIndex=e.modalZIndex;exports.modifier=e.modifier;exports.nextDrawerZIndex=e.nextDrawerZIndex;exports.nextDropdownZIndex=e.nextDropdownZIndex;exports.nextLoadingZIndex=e.nextLoadingZIndex;exports.nextMessageZIndex=e.nextMessageZIndex;exports.nextModalZIndex=e.nextModalZIndex;exports.nextPopoverZIndex=e.nextPopoverZIndex;exports.nextSelectZIndex=e.nextSelectZIndex;exports.nextTooltipZIndex=e.nextTooltipZIndex;exports.noop=e.noop;exports.once=e.once;exports.pipe=e.pipe;exports.popoverZIndex=e.popoverZIndex;exports.popupManage=e.popupManage;exports.resetZIndex=e.resetZIndex;exports.selectZIndex=e.selectZIndex;exports.set=e.set;exports.shortId=e.shortId;exports.state=e.state;exports.throttle=e.throttle;exports.tooltipZIndex=e.tooltipZIndex;exports.tryCatch=e.tryCatch;exports.unary=e.unary;exports.unique=e.unique;exports.useClass=e.useClass;exports.useComponentPrefix=e.useComponentPrefix;exports.useNamespace=e.useNamespace;exports.useZIndex=e.useZIndex;exports.uuid=e.uuid;exports.useClickOutside=o.useClickOutside;exports.useDOMObserver=o.useDOMObserver;exports.useDelayedAction=o.useDelayedAction;exports.useDisabled=o.useDisabled;exports.useEscape=o.useEscape;exports.useFocus=o.useFocus;exports.useIntersectionObserver=o.useIntersectionObserver;exports.useLoading=o.useLoading;exports.useModel=o.useModel;exports.useResize=o.useResize;exports.useScroll=o.useScroll;exports.useToggle=o.useToggle;exports.useVisible=o.useVisible;exports.createLocaleProvider=n.createLocaleProvider;exports.getSupportedLocales=n.getSupportedLocales;exports.localeInjectionKey=n.localeInjectionKey;exports.localeNames=n.localeNames;exports.locales=n.locales;exports.useLocale=n.useLocale;exports.version=t;
|
package/lib/theme/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b={mode:"light",primary:"#4F46E5",success:"#10B981",warning:"#F59E0B",danger:"#EF4444",info:"#6B7280",size:"default"},g={large:40,default:32,small:24},x=l=>g[l];function B(l,o=10){const e=[],t=l.startsWith("#"),c=l.startsWith("rgb");let n,a,s;if(t){const i=l.slice(1);n=parseInt(i.slice(0,2),16),a=parseInt(i.slice(2,4),16),s=parseInt(i.slice(4,6),16)}else if(c){const i=l.match(/\d+/g);if(i)n=Number(i[0]),a=Number(i[1]),s=Number(i[2]);else return e}else return e;const p=100/(o+1);for(let i=1;i<=o;i++){const $=1-p*i/100,m=Math.round(n+(255-n)*$),u=Math.round(a+(255-a)*$),f=Math.round(s+(255-s)*$);e.push(`rgb(${m}, ${u}, ${f})`)}return e}const h=l=>{const o=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(l);return o?{r:parseInt(o[1],16),g:parseInt(o[2],16),b:parseInt(o[3],16)}:null},d=(l,o,e)=>"#"+[l,o,e].map(t=>t.toString(16).padStart(2,"0")).join(""),E=(l,o,e=.5)=>{const t=h(l),c=h(o);if(!t||!c)return l;const n=Math.round(t.r*(1-e)+c.r*e),a=Math.round(t.g*(1-e)+c.g*e),s=Math.round(t.b*(1-e)+c.b*e);return d(n,a,s)},r="--xto";function F(l){const o=r;return{[`${o}-color-primary`]:l.primary,[`${o}-color-on-primary`]:"#FFFFFF",[`${o}-color-secondary`]:"#6366F1",[`${o}-color-accent`]:"#EA580C",[`${o}-color-destructive`]:"#DC2626",[`${o}-color-ring`]:l.primary,[`${o}-color-primary-light-1`]:"#5B54E8",[`${o}-color-primary-light-2`]:"#6366F1",[`${o}-color-primary-light-3`]:"#7578F3",[`${o}-color-primary-light-4`]:"#818CF8",[`${o}-color-primary-light-5`]:"#93A0FA",[`${o}-color-primary-light-6`]:"#A5B4FC",[`${o}-color-primary-light-7`]:"#BCC5FD",[`${o}-color-primary-light-8`]:"#D4D7FE",[`${o}-color-primary-light-9`]:"#EEF2FF",[`${o}-color-success`]:l.success,[`${o}-color-success-light-1`]:"#14C68E",[`${o}-color-success-light-2`]:"#1AD49B",[`${o}-color-success-light-3`]:"#2DD4A0",[`${o}-color-success-light-4`]:"#34D399",[`${o}-color-success-light-5`]:"#4EDDA6",[`${o}-color-success-light-6`]:"#6EE7B7",[`${o}-color-success-light-7`]:"#A7F3D0",[`${o}-color-success-light-8`]:"#D1FAE5",[`${o}-color-success-light-9`]:"#ECFDF5",[`${o}-color-warning`]:l.warning,[`${o}-color-warning-light-1`]:"#F7A621",[`${o}-color-warning-light-2`]:"#F9B037",[`${o}-color-warning-light-3`]:"#FBBF24",[`${o}-color-warning-light-4`]:"#FCD34D",[`${o}-color-warning-light-5`]:"#FDE047",[`${o}-color-warning-light-6`]:"#FEE78A",[`${o}-color-warning-light-7`]:"#FEF3C7",[`${o}-color-warning-light-8`]:"#FEF9C3",[`${o}-color-warning-light-9`]:"#FFFBEB",[`${o}-color-danger`]:l.danger,[`${o}-color-danger-light-1`]:"#F15353",[`${o}-color-danger-light-2`]:"#F36363",[`${o}-color-danger-light-3`]:"#F87171",[`${o}-color-danger-light-4`]:"#F98A8A",[`${o}-color-danger-light-5`]:"#FCA5A5",[`${o}-color-danger-light-6`]:"#FDBDBD",[`${o}-color-danger-light-7`]:"#FECACA",[`${o}-color-danger-light-8`]:"#FEE2E2",[`${o}-color-danger-light-9`]:"#FEF2F2",[`${o}-color-info`]:l.info,[`${o}-color-info-light-1`]:"#7B8290",[`${o}-color-info-light-2`]:"#8A919E",[`${o}-color-info-light-3`]:"#9CA3AF",[`${o}-color-info-light-4`]:"#AAB0BB",[`${o}-color-info-light-5`]:"#B8BDC7",[`${o}-color-info-light-6`]:"#C9CDD5",[`${o}-color-info-light-7`]:"#D1D5DB",[`${o}-color-info-light-8`]:"#E5E7EB",[`${o}-color-info-light-9`]:"#F3F4F6",[`${o}-color-text-primary`]:"#1F2937",[`${o}-color-text-regular`]:"#4B5563",[`${o}-color-text-secondary`]:"#6B7280",[`${o}-color-text-placeholder`]:"#9CA3AF",[`${o}-color-text-disabled`]:"#D1D5DB",[`${o}-border-color`]:"#D1D5DB",[`${o}-border-color-light`]:"#E5E7EB",[`${o}-border-color-lighter`]:"#F3F4F6",[`${o}-border-color-extra-light`]:"#F9FAFB",[`${o}-border-color-dark`]:"#9CA3AF",[`${o}-border-color-darker`]:"#6B7280",[`${o}-fill-color`]:"#F3F4F6",[`${o}-fill-color-light`]:"#F9FAFB",[`${o}-fill-color-lighter`]:"#F9FAFB",[`${o}-fill-color-extra-light`]:"#F9FAFB",[`${o}-fill-color-dark`]:"#E5E7EB",[`${o}-fill-color-darker`]:"#D1D5DB",[`${o}-fill-color-blank`]:"#FFFFFF",[`${o}-bg-color`]:"#FFFFFF",[`${o}-bg-color-page`]:"#F9FAFB",[`${o}-bg-color-overlay`]:"#FFFFFF",[`${o}-border-radius-small`]:"4px",[`${o}-border-radius-base`]:"6px",[`${o}-border-radius-large`]:"8px",[`${o}-border-radius-xl`]:"12px",[`${o}-border-radius-round`]:"20px",[`${o}-border-radius-circle`]:"100%",[`${o}-shadow-subtle`]:"0 1px 2px rgba(0, 0, 0, 0.05)",[`${o}-shadow-base`]:"0 2px 4px rgba(0, 0, 0, 0.08)",[`${o}-shadow-elevated`]:"0 4px 12px rgba(0, 0, 0, 0.1)",[`${o}-shadow-prominent`]:"0 8px 24px rgba(0, 0, 0, 0.12)",[`${o}-font-family`]:"'Inter', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif",[`${o}-font-size-xs`]:"12px",[`${o}-font-size-sm`]:"13px",[`${o}-font-size-base`]:"14px",[`${o}-font-size-md`]:"16px",[`${o}-font-size-lg`]:"18px",[`${o}-font-size-xl`]:"20px",[`${o}-line-height-tight`]:"1.3",[`${o}-line-height-base`]:"1.5",[`${o}-line-height-normal`]:"1.6",[`${o}-line-height-loose`]:"1.8",[`${o}-spacing-xs`]:"4px",[`${o}-spacing-sm`]:"8px",[`${o}-spacing-md`]:"12px",[`${o}-spacing-base`]:"16px",[`${o}-spacing-lg`]:"24px",[`${o}-spacing-xl`]:"32px",[`${o}-component-size`]:`${g[l.size]}px`,[`${o}-component-size-large`]:`${g.large}px`,[`${o}-component-size-small`]:`${g.small}px`,[`${o}-transition-duration-fast`]:"150ms",[`${o}-transition-duration-base`]:"250ms",[`${o}-transition-duration-slow`]:"350ms",[`${o}-transition-easing`]:"cubic-bezier(0.4, 0, 0.2, 1)",[`${o}-transition-easing-in`]:"cubic-bezier(0.4, 0, 1, 1)",[`${o}-transition-easing-out`]:"cubic-bezier(0, 0, 0.2, 1)"}}function A(l){const o=F(l),e=document.documentElement;Object.entries(o).forEach(([t,c])=>{e.style.setProperty(t,c)})}function C(){const o=document.documentElement.style;for(let e=o.length-1;e>=0;e--){const t=o[e];t.startsWith(r)&&o.removeProperty(t)}}const D={[`${r}-color-primary`]:"#818CF8",[`${r}-color-on-primary`]:"#1E1B4B",[`${r}-color-secondary`]:"#A5B4FC",[`${r}-color-accent`]:"#FB923C",[`${r}-color-destructive`]:"#F87171",[`${r}-color-ring`]:"#818CF8",[`${r}-color-primary-light-1`]:"#7578F3",[`${r}-color-primary-light-2`]:"#6366F1",[`${r}-color-primary-light-3`]:"#6366F1",[`${r}-color-primary-light-4`]:"#4F46E5",[`${r}-color-primary-light-5`]:"#4338CA",[`${r}-color-primary-light-6`]:"#3730A3",[`${r}-color-primary-light-7`]:"#312E81",[`${r}-color-primary-light-8`]:"#2B2680",[`${r}-color-primary-light-9`]:"#1E1B4B",[`${r}-color-success`]:"#34D399",[`${r}-color-success-light-1`]:"#2DD4A0",[`${r}-color-success-light-2`]:"#1AD49B",[`${r}-color-success-light-3`]:"#14C68E",[`${r}-color-success-light-4`]:"#10B981",[`${r}-color-success-light-5`]:"#059669",[`${r}-color-success-light-6`]:"#047857",[`${r}-color-success-light-7`]:"#065F46",[`${r}-color-success-light-8`]:"#064E3B",[`${r}-color-success-light-9`]:"#022C22",[`${r}-color-warning`]:"#FBBF24",[`${r}-color-warning-light-1`]:"#F9B037",[`${r}-color-warning-light-2`]:"#F7A621",[`${r}-color-warning-light-3`]:"#F59E0B",[`${r}-color-warning-light-4`]:"#D97706",[`${r}-color-warning-light-5`]:"#B45309",[`${r}-color-warning-light-6`]:"#92400E",[`${r}-color-warning-light-7`]:"#78350F",[`${r}-color-warning-light-8`]:"#451A03",[`${r}-color-warning-light-9`]:"#1C1917",[`${r}-color-danger`]:"#F87171",[`${r}-color-danger-light-1`]:"#F36363",[`${r}-color-danger-light-2`]:"#F15353",[`${r}-color-danger-light-3`]:"#EF4444",[`${r}-color-danger-light-4`]:"#DC2626",[`${r}-color-danger-light-5`]:"#B91C1C",[`${r}-color-danger-light-6`]:"#991B1B",[`${r}-color-danger-light-7`]:"#7F1D1D",[`${r}-color-danger-light-8`]:"#450A0A",[`${r}-color-danger-light-9`]:"#1C1917",[`${r}-color-info`]:"#9CA3AF",[`${r}-color-info-light-1`]:"#8A919E",[`${r}-color-info-light-2`]:"#7B8290",[`${r}-color-info-light-3`]:"#6B7280",[`${r}-color-info-light-4`]:"#4B5563",[`${r}-color-info-light-5`]:"#374151",[`${r}-color-info-light-6`]:"#1F2937",[`${r}-color-info-light-7`]:"#111827",[`${r}-color-info-light-8`]:"#0A0F1A",[`${r}-color-info-light-9`]:"#030712",[`${r}-color-text-primary`]:"#F9FAFB",[`${r}-color-text-regular`]:"#E5E7EB",[`${r}-color-text-secondary`]:"#9CA3AF",[`${r}-color-text-placeholder`]:"#6B7280",[`${r}-color-text-disabled`]:"#4B5563",[`${r}-border-color`]:"#374151",[`${r}-border-color-light`]:"#1F2937",[`${r}-border-color-lighter`]:"#111827",[`${r}-border-color-extra-light`]:"#0A0F1A",[`${r}-border-color-dark`]:"#4B5563",[`${r}-border-color-darker`]:"#6B7280",[`${r}-fill-color`]:"#1F2937",[`${r}-fill-color-light`]:"#111827",[`${r}-fill-color-lighter`]:"#0A0F1A",[`${r}-fill-color-extra-light`]:"#030712",[`${r}-fill-color-dark`]:"#374151",[`${r}-fill-color-darker`]:"#4B5563",[`${r}-fill-color-blank`]:"#111827",[`${r}-bg-color`]:"#111827",[`${r}-bg-color-page`]:"#030712",[`${r}-bg-color-overlay`]:"#1F2937",[`${r}-shadow-subtle`]:"0 1px 3px rgba(0, 0, 0, 0.2)",[`${r}-shadow-base`]:"0 2px 6px rgba(0, 0, 0, 0.25)",[`${r}-shadow-elevated`]:"0 4px 16px rgba(0, 0, 0, 0.3)",[`${r}-shadow-prominent`]:"0 8px 32px rgba(0, 0, 0, 0.35)"};function y(){document.documentElement.classList.add("dark")}function w(){document.documentElement.classList.remove("dark")}function k(){return document.documentElement.classList.contains("dark")}function S(l){l===void 0?document.documentElement.classList.toggle("dark"):l?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}exports.applyCSSVars=A;exports.applyDarkTheme=y;exports.cssVarPrefix=r;exports.darkCSSVars=D;exports.defaultThemeConfig=b;exports.generateCSSVars=F;exports.generateColorPalette=B;exports.getComponentSize=x;exports.hexToRgb=h;exports.isDarkTheme=k;exports.mixColor=E;exports.removeCSSVars=C;exports.removeDarkTheme=w;exports.rgbToHex=d;exports.sizeMap=g;exports.toggleDarkTheme=S;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xto/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Xto Core - Theme, hooks, utils, i18n and types",
|
|
5
5
|
"homepage": "https://jinguchu.github.io/xto-ui/",
|
|
6
6
|
"repository": {
|
|
@@ -45,18 +45,18 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
|
-
"scripts": {
|
|
49
|
-
"build": "vite build"
|
|
50
|
-
},
|
|
51
48
|
"peerDependencies": {
|
|
52
49
|
"vue": "^3.4.0"
|
|
53
50
|
},
|
|
54
51
|
"devDependencies": {
|
|
55
|
-
"@xto/build": "workspace:*",
|
|
56
52
|
"typescript": "^5.4.2",
|
|
57
53
|
"vite": "^5.2.0",
|
|
58
54
|
"vite-plugin-dts": "^4.5.4",
|
|
59
55
|
"vitest": "^1.4.0",
|
|
60
|
-
"vue": "^3.4.21"
|
|
56
|
+
"vue": "^3.4.21",
|
|
57
|
+
"@xto/build": "0.1.0"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "vite build"
|
|
61
61
|
}
|
|
62
62
|
}
|