@xaui/core 0.1.5 → 0.1.7
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/index.cjs +14 -0
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +13 -0
- package/dist/theme/index.cjs +33 -29
- package/dist/theme/index.d.cts +4 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.js +33 -29
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var src_exports = {};
|
|
22
22
|
__export(src_exports, {
|
|
23
|
+
getSafeThemeColor: () => getSafeThemeColor,
|
|
23
24
|
withOpacity: () => withOpacity
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -30,7 +31,20 @@ function withOpacity(color, opacity) {
|
|
|
30
31
|
const alpha = Math.round(clampedOpacity * 255).toString(16).padStart(2, "0");
|
|
31
32
|
return `${color}${alpha}`;
|
|
32
33
|
}
|
|
34
|
+
var validThemeColors = [
|
|
35
|
+
"primary",
|
|
36
|
+
"secondary",
|
|
37
|
+
"tertiary",
|
|
38
|
+
"danger",
|
|
39
|
+
"warning",
|
|
40
|
+
"success",
|
|
41
|
+
"default"
|
|
42
|
+
];
|
|
43
|
+
function getSafeThemeColor(themeColor) {
|
|
44
|
+
return validThemeColors.includes(themeColor) ? themeColor : "primary";
|
|
45
|
+
}
|
|
33
46
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34
47
|
0 && (module.exports = {
|
|
48
|
+
getSafeThemeColor,
|
|
35
49
|
withOpacity
|
|
36
50
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -5,5 +5,8 @@
|
|
|
5
5
|
* @returns Color with opacity
|
|
6
6
|
*/
|
|
7
7
|
declare function withOpacity(color: string, opacity: number): string;
|
|
8
|
+
declare const validThemeColors: readonly ["primary", "secondary", "tertiary", "danger", "warning", "success", "default"];
|
|
9
|
+
declare function getSafeThemeColor(themeColor: string): ValidThemeColor;
|
|
10
|
+
type ValidThemeColor = (typeof validThemeColors)[number];
|
|
8
11
|
|
|
9
|
-
export { withOpacity };
|
|
12
|
+
export { getSafeThemeColor, withOpacity };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,5 +5,8 @@
|
|
|
5
5
|
* @returns Color with opacity
|
|
6
6
|
*/
|
|
7
7
|
declare function withOpacity(color: string, opacity: number): string;
|
|
8
|
+
declare const validThemeColors: readonly ["primary", "secondary", "tertiary", "danger", "warning", "success", "default"];
|
|
9
|
+
declare function getSafeThemeColor(themeColor: string): ValidThemeColor;
|
|
10
|
+
type ValidThemeColor = (typeof validThemeColors)[number];
|
|
8
11
|
|
|
9
|
-
export { withOpacity };
|
|
12
|
+
export { getSafeThemeColor, withOpacity };
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,19 @@ function withOpacity(color, opacity) {
|
|
|
4
4
|
const alpha = Math.round(clampedOpacity * 255).toString(16).padStart(2, "0");
|
|
5
5
|
return `${color}${alpha}`;
|
|
6
6
|
}
|
|
7
|
+
var validThemeColors = [
|
|
8
|
+
"primary",
|
|
9
|
+
"secondary",
|
|
10
|
+
"tertiary",
|
|
11
|
+
"danger",
|
|
12
|
+
"warning",
|
|
13
|
+
"success",
|
|
14
|
+
"default"
|
|
15
|
+
];
|
|
16
|
+
function getSafeThemeColor(themeColor) {
|
|
17
|
+
return validThemeColors.includes(themeColor) ? themeColor : "primary";
|
|
18
|
+
}
|
|
7
19
|
export {
|
|
20
|
+
getSafeThemeColor,
|
|
8
21
|
withOpacity
|
|
9
22
|
};
|
package/dist/theme/index.cjs
CHANGED
|
@@ -321,24 +321,24 @@ var colors = {
|
|
|
321
321
|
// src/theme/theme-colors.ts
|
|
322
322
|
var themeColors = {
|
|
323
323
|
primary: {
|
|
324
|
-
main: colors.
|
|
324
|
+
main: colors.purple[800],
|
|
325
325
|
foreground: colors.white,
|
|
326
|
-
background: colors.
|
|
326
|
+
background: colors.purple[200]
|
|
327
327
|
},
|
|
328
328
|
secondary: {
|
|
329
|
-
main: colors.
|
|
329
|
+
main: colors.zinc[500],
|
|
330
330
|
foreground: colors.white,
|
|
331
|
-
background: colors.purple[
|
|
331
|
+
background: colors.purple[200]
|
|
332
332
|
},
|
|
333
333
|
tertiary: {
|
|
334
|
-
main: colors.
|
|
334
|
+
main: colors.stone[500],
|
|
335
335
|
foreground: colors.white,
|
|
336
|
-
background: colors.
|
|
336
|
+
background: colors.red[100]
|
|
337
337
|
},
|
|
338
338
|
danger: {
|
|
339
|
-
main: colors.red[
|
|
339
|
+
main: colors.red[700],
|
|
340
340
|
foreground: colors.white,
|
|
341
|
-
background: colors.
|
|
341
|
+
background: colors.rose[200]
|
|
342
342
|
},
|
|
343
343
|
warning: {
|
|
344
344
|
main: colors.amber[600],
|
|
@@ -351,33 +351,33 @@ var themeColors = {
|
|
|
351
351
|
background: colors.green[100]
|
|
352
352
|
},
|
|
353
353
|
default: {
|
|
354
|
-
main: colors.
|
|
355
|
-
foreground: colors.
|
|
356
|
-
background: colors.
|
|
354
|
+
main: colors.white,
|
|
355
|
+
foreground: colors.zinc[900],
|
|
356
|
+
background: colors.zinc[200]
|
|
357
357
|
},
|
|
358
358
|
background: colors.white,
|
|
359
|
-
foreground: colors.
|
|
359
|
+
foreground: colors.zinc[900]
|
|
360
360
|
};
|
|
361
361
|
var darkThemeColors = {
|
|
362
362
|
primary: {
|
|
363
|
-
main: colors.
|
|
364
|
-
foreground: colors.
|
|
365
|
-
background: colors.
|
|
363
|
+
main: colors.purple[300],
|
|
364
|
+
foreground: colors.purple[950],
|
|
365
|
+
background: colors.purple[900]
|
|
366
366
|
},
|
|
367
367
|
secondary: {
|
|
368
|
-
main: colors.
|
|
369
|
-
foreground: colors.
|
|
370
|
-
background: colors.
|
|
368
|
+
main: colors.zinc[300],
|
|
369
|
+
foreground: colors.zinc[700],
|
|
370
|
+
background: colors.zinc[600]
|
|
371
371
|
},
|
|
372
372
|
tertiary: {
|
|
373
|
-
main: colors.
|
|
374
|
-
foreground: colors.
|
|
375
|
-
background: colors.
|
|
373
|
+
main: colors.red[200],
|
|
374
|
+
foreground: colors.pink[950],
|
|
375
|
+
background: colors.stone[600]
|
|
376
376
|
},
|
|
377
377
|
danger: {
|
|
378
|
-
main: colors.red[
|
|
379
|
-
foreground: colors.
|
|
380
|
-
background: colors.red[
|
|
378
|
+
main: colors.red[300],
|
|
379
|
+
foreground: colors.rose[950],
|
|
380
|
+
background: colors.red[800]
|
|
381
381
|
},
|
|
382
382
|
warning: {
|
|
383
383
|
main: colors.amber[400],
|
|
@@ -390,12 +390,12 @@ var darkThemeColors = {
|
|
|
390
390
|
background: colors.green[900]
|
|
391
391
|
},
|
|
392
392
|
default: {
|
|
393
|
-
main: colors.
|
|
394
|
-
foreground: colors.
|
|
395
|
-
background: colors.
|
|
393
|
+
main: colors.zinc[900],
|
|
394
|
+
foreground: colors.stone[200],
|
|
395
|
+
background: colors.zinc[700]
|
|
396
396
|
},
|
|
397
|
-
background: colors.
|
|
398
|
-
foreground: colors.
|
|
397
|
+
background: colors.zinc[900],
|
|
398
|
+
foreground: colors.stone[200]
|
|
399
399
|
};
|
|
400
400
|
|
|
401
401
|
// src/theme/theme-config.ts
|
|
@@ -482,11 +482,15 @@ var baseTheme = {
|
|
|
482
482
|
}
|
|
483
483
|
};
|
|
484
484
|
var theme = {
|
|
485
|
+
palette: colors,
|
|
485
486
|
colors: themeColors,
|
|
487
|
+
mode: "light",
|
|
486
488
|
...baseTheme
|
|
487
489
|
};
|
|
488
490
|
var darkTheme = {
|
|
491
|
+
palette: colors,
|
|
489
492
|
colors: darkThemeColors,
|
|
493
|
+
mode: "dark",
|
|
490
494
|
...baseTheme
|
|
491
495
|
};
|
|
492
496
|
var defaultTheme = theme;
|
package/dist/theme/index.d.cts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { colors } from '../tokens/index.cjs';
|
|
2
|
+
|
|
1
3
|
type ColorScheme = {
|
|
2
4
|
main: string;
|
|
3
5
|
foreground: string;
|
|
@@ -108,6 +110,8 @@ interface ThemeShadows {
|
|
|
108
110
|
};
|
|
109
111
|
}
|
|
110
112
|
interface XUITheme {
|
|
113
|
+
mode: 'light' | 'dark';
|
|
114
|
+
palette: typeof colors;
|
|
111
115
|
colors: ThemeColors;
|
|
112
116
|
spacing: ThemeSpacing;
|
|
113
117
|
borderRadius: ThemeBorderRadius;
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { colors } from '../tokens/index.js';
|
|
2
|
+
|
|
1
3
|
type ColorScheme = {
|
|
2
4
|
main: string;
|
|
3
5
|
foreground: string;
|
|
@@ -108,6 +110,8 @@ interface ThemeShadows {
|
|
|
108
110
|
};
|
|
109
111
|
}
|
|
110
112
|
interface XUITheme {
|
|
113
|
+
mode: 'light' | 'dark';
|
|
114
|
+
palette: typeof colors;
|
|
111
115
|
colors: ThemeColors;
|
|
112
116
|
spacing: ThemeSpacing;
|
|
113
117
|
borderRadius: ThemeBorderRadius;
|
package/dist/theme/index.js
CHANGED
|
@@ -5,24 +5,24 @@ import {
|
|
|
5
5
|
// src/theme/theme-colors.ts
|
|
6
6
|
var themeColors = {
|
|
7
7
|
primary: {
|
|
8
|
-
main: colors.
|
|
8
|
+
main: colors.purple[800],
|
|
9
9
|
foreground: colors.white,
|
|
10
|
-
background: colors.
|
|
10
|
+
background: colors.purple[200]
|
|
11
11
|
},
|
|
12
12
|
secondary: {
|
|
13
|
-
main: colors.
|
|
13
|
+
main: colors.zinc[500],
|
|
14
14
|
foreground: colors.white,
|
|
15
|
-
background: colors.purple[
|
|
15
|
+
background: colors.purple[200]
|
|
16
16
|
},
|
|
17
17
|
tertiary: {
|
|
18
|
-
main: colors.
|
|
18
|
+
main: colors.stone[500],
|
|
19
19
|
foreground: colors.white,
|
|
20
|
-
background: colors.
|
|
20
|
+
background: colors.red[100]
|
|
21
21
|
},
|
|
22
22
|
danger: {
|
|
23
|
-
main: colors.red[
|
|
23
|
+
main: colors.red[700],
|
|
24
24
|
foreground: colors.white,
|
|
25
|
-
background: colors.
|
|
25
|
+
background: colors.rose[200]
|
|
26
26
|
},
|
|
27
27
|
warning: {
|
|
28
28
|
main: colors.amber[600],
|
|
@@ -35,33 +35,33 @@ var themeColors = {
|
|
|
35
35
|
background: colors.green[100]
|
|
36
36
|
},
|
|
37
37
|
default: {
|
|
38
|
-
main: colors.
|
|
39
|
-
foreground: colors.
|
|
40
|
-
background: colors.
|
|
38
|
+
main: colors.white,
|
|
39
|
+
foreground: colors.zinc[900],
|
|
40
|
+
background: colors.zinc[200]
|
|
41
41
|
},
|
|
42
42
|
background: colors.white,
|
|
43
|
-
foreground: colors.
|
|
43
|
+
foreground: colors.zinc[900]
|
|
44
44
|
};
|
|
45
45
|
var darkThemeColors = {
|
|
46
46
|
primary: {
|
|
47
|
-
main: colors.
|
|
48
|
-
foreground: colors.
|
|
49
|
-
background: colors.
|
|
47
|
+
main: colors.purple[300],
|
|
48
|
+
foreground: colors.purple[950],
|
|
49
|
+
background: colors.purple[900]
|
|
50
50
|
},
|
|
51
51
|
secondary: {
|
|
52
|
-
main: colors.
|
|
53
|
-
foreground: colors.
|
|
54
|
-
background: colors.
|
|
52
|
+
main: colors.zinc[300],
|
|
53
|
+
foreground: colors.zinc[700],
|
|
54
|
+
background: colors.zinc[600]
|
|
55
55
|
},
|
|
56
56
|
tertiary: {
|
|
57
|
-
main: colors.
|
|
58
|
-
foreground: colors.
|
|
59
|
-
background: colors.
|
|
57
|
+
main: colors.red[200],
|
|
58
|
+
foreground: colors.pink[950],
|
|
59
|
+
background: colors.stone[600]
|
|
60
60
|
},
|
|
61
61
|
danger: {
|
|
62
|
-
main: colors.red[
|
|
63
|
-
foreground: colors.
|
|
64
|
-
background: colors.red[
|
|
62
|
+
main: colors.red[300],
|
|
63
|
+
foreground: colors.rose[950],
|
|
64
|
+
background: colors.red[800]
|
|
65
65
|
},
|
|
66
66
|
warning: {
|
|
67
67
|
main: colors.amber[400],
|
|
@@ -74,12 +74,12 @@ var darkThemeColors = {
|
|
|
74
74
|
background: colors.green[900]
|
|
75
75
|
},
|
|
76
76
|
default: {
|
|
77
|
-
main: colors.
|
|
78
|
-
foreground: colors.
|
|
79
|
-
background: colors.
|
|
77
|
+
main: colors.zinc[900],
|
|
78
|
+
foreground: colors.stone[200],
|
|
79
|
+
background: colors.zinc[700]
|
|
80
80
|
},
|
|
81
|
-
background: colors.
|
|
82
|
-
foreground: colors.
|
|
81
|
+
background: colors.zinc[900],
|
|
82
|
+
foreground: colors.stone[200]
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
// src/theme/theme-config.ts
|
|
@@ -166,11 +166,15 @@ var baseTheme = {
|
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
168
|
var theme = {
|
|
169
|
+
palette: colors,
|
|
169
170
|
colors: themeColors,
|
|
171
|
+
mode: "light",
|
|
170
172
|
...baseTheme
|
|
171
173
|
};
|
|
172
174
|
var darkTheme = {
|
|
175
|
+
palette: colors,
|
|
173
176
|
colors: darkThemeColors,
|
|
177
|
+
mode: "dark",
|
|
174
178
|
...baseTheme
|
|
175
179
|
};
|
|
176
180
|
var defaultTheme = theme;
|