@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 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
  };
@@ -321,24 +321,24 @@ var colors = {
321
321
  // src/theme/theme-colors.ts
322
322
  var themeColors = {
323
323
  primary: {
324
- main: colors.blue[600],
324
+ main: colors.purple[800],
325
325
  foreground: colors.white,
326
- background: colors.blue[100]
326
+ background: colors.purple[200]
327
327
  },
328
328
  secondary: {
329
- main: colors.purple[600],
329
+ main: colors.zinc[500],
330
330
  foreground: colors.white,
331
- background: colors.purple[100]
331
+ background: colors.purple[200]
332
332
  },
333
333
  tertiary: {
334
- main: colors.orange[600],
334
+ main: colors.stone[500],
335
335
  foreground: colors.white,
336
- background: colors.orange[100]
336
+ background: colors.red[100]
337
337
  },
338
338
  danger: {
339
- main: colors.red[600],
339
+ main: colors.red[700],
340
340
  foreground: colors.white,
341
- background: colors.red[100]
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.gray[500],
355
- foreground: colors.white,
356
- background: colors.gray[100]
354
+ main: colors.white,
355
+ foreground: colors.zinc[900],
356
+ background: colors.zinc[200]
357
357
  },
358
358
  background: colors.white,
359
- foreground: colors.gray[900]
359
+ foreground: colors.zinc[900]
360
360
  };
361
361
  var darkThemeColors = {
362
362
  primary: {
363
- main: colors.blue[400],
364
- foreground: colors.gray[50],
365
- background: colors.blue[900]
363
+ main: colors.purple[300],
364
+ foreground: colors.purple[950],
365
+ background: colors.purple[900]
366
366
  },
367
367
  secondary: {
368
- main: colors.purple[400],
369
- foreground: colors.gray[50],
370
- background: colors.purple[900]
368
+ main: colors.zinc[300],
369
+ foreground: colors.zinc[700],
370
+ background: colors.zinc[600]
371
371
  },
372
372
  tertiary: {
373
- main: colors.orange[400],
374
- foreground: colors.gray[50],
375
- background: colors.orange[900]
373
+ main: colors.red[200],
374
+ foreground: colors.pink[950],
375
+ background: colors.stone[600]
376
376
  },
377
377
  danger: {
378
- main: colors.red[400],
379
- foreground: colors.gray[50],
380
- background: colors.red[900]
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.gray[400],
394
- foreground: colors.gray[50],
395
- background: colors.gray[800]
393
+ main: colors.zinc[900],
394
+ foreground: colors.stone[200],
395
+ background: colors.zinc[700]
396
396
  },
397
- background: colors.gray[950],
398
- foreground: colors.gray[50]
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;
@@ -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;
@@ -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;
@@ -5,24 +5,24 @@ import {
5
5
  // src/theme/theme-colors.ts
6
6
  var themeColors = {
7
7
  primary: {
8
- main: colors.blue[600],
8
+ main: colors.purple[800],
9
9
  foreground: colors.white,
10
- background: colors.blue[100]
10
+ background: colors.purple[200]
11
11
  },
12
12
  secondary: {
13
- main: colors.purple[600],
13
+ main: colors.zinc[500],
14
14
  foreground: colors.white,
15
- background: colors.purple[100]
15
+ background: colors.purple[200]
16
16
  },
17
17
  tertiary: {
18
- main: colors.orange[600],
18
+ main: colors.stone[500],
19
19
  foreground: colors.white,
20
- background: colors.orange[100]
20
+ background: colors.red[100]
21
21
  },
22
22
  danger: {
23
- main: colors.red[600],
23
+ main: colors.red[700],
24
24
  foreground: colors.white,
25
- background: colors.red[100]
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.gray[500],
39
- foreground: colors.white,
40
- background: colors.gray[100]
38
+ main: colors.white,
39
+ foreground: colors.zinc[900],
40
+ background: colors.zinc[200]
41
41
  },
42
42
  background: colors.white,
43
- foreground: colors.gray[900]
43
+ foreground: colors.zinc[900]
44
44
  };
45
45
  var darkThemeColors = {
46
46
  primary: {
47
- main: colors.blue[400],
48
- foreground: colors.gray[50],
49
- background: colors.blue[900]
47
+ main: colors.purple[300],
48
+ foreground: colors.purple[950],
49
+ background: colors.purple[900]
50
50
  },
51
51
  secondary: {
52
- main: colors.purple[400],
53
- foreground: colors.gray[50],
54
- background: colors.purple[900]
52
+ main: colors.zinc[300],
53
+ foreground: colors.zinc[700],
54
+ background: colors.zinc[600]
55
55
  },
56
56
  tertiary: {
57
- main: colors.orange[400],
58
- foreground: colors.gray[50],
59
- background: colors.orange[900]
57
+ main: colors.red[200],
58
+ foreground: colors.pink[950],
59
+ background: colors.stone[600]
60
60
  },
61
61
  danger: {
62
- main: colors.red[400],
63
- foreground: colors.gray[50],
64
- background: colors.red[900]
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.gray[400],
78
- foreground: colors.gray[50],
79
- background: colors.gray[800]
77
+ main: colors.zinc[900],
78
+ foreground: colors.stone[200],
79
+ background: colors.zinc[700]
80
80
  },
81
- background: colors.gray[950],
82
- foreground: colors.gray[50]
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaui/core",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "A modern React Native UI library with Flutter-inspired API, smooth animations, and comprehensive design system",
5
5
  "keywords": [
6
6
  "react-native",