@xaui/core 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,7 +13,7 @@ pnpm add @xaui/core
13
13
  - **Flutter-inspired Components**: Ready-to-use UI components with Flutter-like API and intuitive props (`padding`, `margin`, `borderRadius`)
14
14
  - **Powerful Theme System**: Dynamic theming with deep customization support
15
15
  - **Smooth Animations**: Built on React Native Reanimated for native performance
16
- - **Design System**: Integrated with @xaui/colors for consistent theming
16
+ - **Design System**: Integrated with @xaui/core/palette for consistent theming
17
17
  - **TypeScript First**: Fully typed for excellent developer experience
18
18
  - **Performance**: Optimized for mobile with native animations
19
19
 
@@ -0,0 +1,296 @@
1
+ // src/tokens/index.ts
2
+ var colors = {
3
+ slate: {
4
+ 50: "#f8fafc",
5
+ 100: "#f1f5f9",
6
+ 200: "#e2e8f0",
7
+ 300: "#cbd5e1",
8
+ 400: "#94a3b8",
9
+ 500: "#64748b",
10
+ 600: "#475569",
11
+ 700: "#334155",
12
+ 800: "#1e293b",
13
+ 900: "#0f172a",
14
+ 950: "#020617"
15
+ },
16
+ gray: {
17
+ 50: "#f9fafb",
18
+ 100: "#f3f4f6",
19
+ 200: "#e5e7eb",
20
+ 300: "#d1d5db",
21
+ 400: "#9ca3af",
22
+ 500: "#6b7280",
23
+ 600: "#4b5563",
24
+ 700: "#374151",
25
+ 800: "#1f2937",
26
+ 900: "#111827",
27
+ 950: "#030712"
28
+ },
29
+ zinc: {
30
+ 50: "#fafafa",
31
+ 100: "#f4f4f5",
32
+ 200: "#e4e4e7",
33
+ 300: "#d4d4d8",
34
+ 400: "#a1a1aa",
35
+ 500: "#71717a",
36
+ 600: "#52525b",
37
+ 700: "#3f3f46",
38
+ 800: "#27272a",
39
+ 900: "#18181b",
40
+ 950: "#09090b"
41
+ },
42
+ neutral: {
43
+ 50: "#fafafa",
44
+ 100: "#f5f5f5",
45
+ 200: "#e5e5e5",
46
+ 300: "#d4d4d4",
47
+ 400: "#a3a3a3",
48
+ 500: "#737373",
49
+ 600: "#525252",
50
+ 700: "#404040",
51
+ 800: "#262626",
52
+ 900: "#171717",
53
+ 950: "#0a0a0a"
54
+ },
55
+ stone: {
56
+ 50: "#fafaf9",
57
+ 100: "#f5f5f4",
58
+ 200: "#e7e5e4",
59
+ 300: "#d6d3d1",
60
+ 400: "#a8a29e",
61
+ 500: "#78716c",
62
+ 600: "#57534e",
63
+ 700: "#44403c",
64
+ 800: "#292524",
65
+ 900: "#1c1917",
66
+ 950: "#0c0a09"
67
+ },
68
+ red: {
69
+ 50: "#fef2f2",
70
+ 100: "#fee2e2",
71
+ 200: "#fecaca",
72
+ 300: "#fca5a5",
73
+ 400: "#f87171",
74
+ 500: "#ef4444",
75
+ 600: "#dc2626",
76
+ 700: "#b91c1c",
77
+ 800: "#991b1b",
78
+ 900: "#7f1d1d",
79
+ 950: "#450a0a"
80
+ },
81
+ orange: {
82
+ 50: "#fff7ed",
83
+ 100: "#ffedd5",
84
+ 200: "#fed7aa",
85
+ 300: "#fdba74",
86
+ 400: "#fb923c",
87
+ 500: "#f97316",
88
+ 600: "#ea580c",
89
+ 700: "#c2410c",
90
+ 800: "#9a3412",
91
+ 900: "#7c2d12",
92
+ 950: "#431407"
93
+ },
94
+ amber: {
95
+ 50: "#fffbeb",
96
+ 100: "#fef3c7",
97
+ 200: "#fde68a",
98
+ 300: "#fcd34d",
99
+ 400: "#fbbf24",
100
+ 500: "#f59e0b",
101
+ 600: "#d97706",
102
+ 700: "#b45309",
103
+ 800: "#92400e",
104
+ 900: "#78350f",
105
+ 950: "#451a03"
106
+ },
107
+ yellow: {
108
+ 50: "#fefce8",
109
+ 100: "#fef9c3",
110
+ 200: "#fef08a",
111
+ 300: "#fde047",
112
+ 400: "#facc15",
113
+ 500: "#eab308",
114
+ 600: "#ca8a04",
115
+ 700: "#a16207",
116
+ 800: "#854d0e",
117
+ 900: "#713f12",
118
+ 950: "#422006"
119
+ },
120
+ lime: {
121
+ 50: "#f7fee7",
122
+ 100: "#ecfccb",
123
+ 200: "#d9f99d",
124
+ 300: "#bef264",
125
+ 400: "#a3e635",
126
+ 500: "#84cc16",
127
+ 600: "#65a30d",
128
+ 700: "#4d7c0f",
129
+ 800: "#3f6212",
130
+ 900: "#365314",
131
+ 950: "#1a2e05"
132
+ },
133
+ green: {
134
+ 50: "#f0fdf4",
135
+ 100: "#dcfce7",
136
+ 200: "#bbf7d0",
137
+ 300: "#86efac",
138
+ 400: "#4ade80",
139
+ 500: "#22c55e",
140
+ 600: "#16a34a",
141
+ 700: "#15803d",
142
+ 800: "#166534",
143
+ 900: "#14532d",
144
+ 950: "#052e16"
145
+ },
146
+ emerald: {
147
+ 50: "#ecfdf5",
148
+ 100: "#d1fae5",
149
+ 200: "#a7f3d0",
150
+ 300: "#6ee7b7",
151
+ 400: "#34d399",
152
+ 500: "#10b981",
153
+ 600: "#059669",
154
+ 700: "#047857",
155
+ 800: "#065f46",
156
+ 900: "#064e3b",
157
+ 950: "#022c22"
158
+ },
159
+ teal: {
160
+ 50: "#f0fdfa",
161
+ 100: "#ccfbf1",
162
+ 200: "#99f6e4",
163
+ 300: "#5eead4",
164
+ 400: "#2dd4bf",
165
+ 500: "#14b8a6",
166
+ 600: "#0d9488",
167
+ 700: "#0f766e",
168
+ 800: "#115e59",
169
+ 900: "#134e4a",
170
+ 950: "#042f2e"
171
+ },
172
+ cyan: {
173
+ 50: "#ecfeff",
174
+ 100: "#cffafe",
175
+ 200: "#a5f3fc",
176
+ 300: "#67e8f9",
177
+ 400: "#22d3ee",
178
+ 500: "#06b6d4",
179
+ 600: "#0891b2",
180
+ 700: "#0e7490",
181
+ 800: "#155e75",
182
+ 900: "#164e63",
183
+ 950: "#083344"
184
+ },
185
+ sky: {
186
+ 50: "#f0f9ff",
187
+ 100: "#e0f2fe",
188
+ 200: "#bae6fd",
189
+ 300: "#7dd3fc",
190
+ 400: "#38bdf8",
191
+ 500: "#0ea5e9",
192
+ 600: "#0284c7",
193
+ 700: "#0369a1",
194
+ 800: "#075985",
195
+ 900: "#0c4a6e",
196
+ 950: "#082f49"
197
+ },
198
+ blue: {
199
+ 50: "#eff6ff",
200
+ 100: "#dbeafe",
201
+ 200: "#bfdbfe",
202
+ 300: "#93c5fd",
203
+ 400: "#60a5fa",
204
+ 500: "#3b82f6",
205
+ 600: "#2563eb",
206
+ 700: "#1d4ed8",
207
+ 800: "#1e40af",
208
+ 900: "#1e3a8a",
209
+ 950: "#172554"
210
+ },
211
+ indigo: {
212
+ 50: "#eef2ff",
213
+ 100: "#e0e7ff",
214
+ 200: "#c7d2fe",
215
+ 300: "#a5b4fc",
216
+ 400: "#818cf8",
217
+ 500: "#6366f1",
218
+ 600: "#4f46e5",
219
+ 700: "#4338ca",
220
+ 800: "#3730a3",
221
+ 900: "#312e81",
222
+ 950: "#1e1b4b"
223
+ },
224
+ violet: {
225
+ 50: "#f5f3ff",
226
+ 100: "#ede9fe",
227
+ 200: "#ddd6fe",
228
+ 300: "#c4b5fd",
229
+ 400: "#a78bfa",
230
+ 500: "#8b5cf6",
231
+ 600: "#7c3aed",
232
+ 700: "#6d28d9",
233
+ 800: "#5b21b6",
234
+ 900: "#4c1d95",
235
+ 950: "#2e1065"
236
+ },
237
+ purple: {
238
+ 50: "#faf5ff",
239
+ 100: "#f3e8ff",
240
+ 200: "#e9d5ff",
241
+ 300: "#d8b4fe",
242
+ 400: "#c084fc",
243
+ 500: "#a855f7",
244
+ 600: "#9333ea",
245
+ 700: "#7e22ce",
246
+ 800: "#6b21a8",
247
+ 900: "#581c87",
248
+ 950: "#3b0764"
249
+ },
250
+ fuchsia: {
251
+ 50: "#fdf4ff",
252
+ 100: "#fae8ff",
253
+ 200: "#f5d0fe",
254
+ 300: "#f0abfc",
255
+ 400: "#e879f9",
256
+ 500: "#d946ef",
257
+ 600: "#c026d3",
258
+ 700: "#a21caf",
259
+ 800: "#86198f",
260
+ 900: "#701a75",
261
+ 950: "#4a044e"
262
+ },
263
+ pink: {
264
+ 50: "#fdf2f8",
265
+ 100: "#fce7f3",
266
+ 200: "#fbcfe8",
267
+ 300: "#f9a8d4",
268
+ 400: "#f472b6",
269
+ 500: "#ec4899",
270
+ 600: "#db2777",
271
+ 700: "#be185d",
272
+ 800: "#9d174d",
273
+ 900: "#831843",
274
+ 950: "#500724"
275
+ },
276
+ rose: {
277
+ 50: "#fff1f2",
278
+ 100: "#ffe4e6",
279
+ 200: "#fecdd3",
280
+ 300: "#fda4af",
281
+ 400: "#fb7185",
282
+ 500: "#f43f5e",
283
+ 600: "#e11d48",
284
+ 700: "#be123c",
285
+ 800: "#9f1239",
286
+ 900: "#881337",
287
+ 950: "#4c0519"
288
+ },
289
+ black: "#000000",
290
+ white: "#ffffff",
291
+ transparent: "transparent"
292
+ };
293
+
294
+ export {
295
+ colors
296
+ };
package/dist/index.cjs CHANGED
@@ -18,11 +18,12 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ getSafeThemeColor: () => getSafeThemeColor,
23
24
  withOpacity: () => withOpacity
24
25
  });
25
- module.exports = __toCommonJS(index_exports);
26
+ module.exports = __toCommonJS(src_exports);
26
27
 
27
28
  // src/utils/colors-utils.ts
28
29
  function withOpacity(color, opacity) {
@@ -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
  };