@tachui/core 0.8.20 → 0.8.22

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.
@@ -1,28 +1,28 @@
1
- import { A as b } from "../index-JQ1sW1SK.js";
2
- import { L as rt, R as st, k as at } from "../index-JQ1sW1SK.js";
3
- import { J as S, K as C, k as x } from "../theme-CRLPHryV.js";
1
+ import { A as p } from "../index-JQ1sW1SK.js";
2
+ import { L as it, R as ot, k as lt } from "../index-JQ1sW1SK.js";
3
+ import { J as C, K as S, k as x } from "../theme-CRLPHryV.js";
4
4
  export * from "@tachui/types/assets";
5
- var k = Object.defineProperty, G = (i, t, e) => t in i ? k(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, p = (i, t, e) => G(i, typeof t != "symbol" ? t + "" : t, e);
6
- const E = class n extends b {
5
+ var H = Object.defineProperty, M = (i, t, e) => t in i ? H(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, y = (i, t, e) => M(i, typeof t != "symbol" ? t + "" : t, e);
6
+ const E = class a extends p {
7
7
  constructor(t) {
8
- if (super(t.name), p(this, "default"), p(this, "light"), p(this, "dark"), !t.default)
8
+ if (super(t.name), y(this, "default"), y(this, "light"), y(this, "dark"), !t.default)
9
9
  throw new Error(
10
10
  `ColorAsset "${t.name}" must specify a default color`
11
11
  );
12
- const e = n.validateColor(t.default);
12
+ const e = a.validateColor(t.default);
13
13
  if (!e.isValid)
14
14
  throw new Error(
15
15
  `Invalid default color format for asset "${t.name}": ${e.error}`
16
16
  );
17
17
  if (t.light) {
18
- const r = n.validateColor(t.light);
18
+ const r = a.validateColor(t.light);
19
19
  if (!r.isValid)
20
20
  throw new Error(
21
21
  `Invalid light color format for asset "${t.name}": ${r.error}`
22
22
  );
23
23
  }
24
24
  if (t.dark) {
25
- const r = n.validateColor(t.dark);
25
+ const r = a.validateColor(t.dark);
26
26
  if (!r.isValid)
27
27
  throw new Error(
28
28
  `Invalid dark color format for asset "${t.name}": ${r.error}`
@@ -31,7 +31,7 @@ const E = class n extends b {
31
31
  this.default = t.default, this.light = t.light, this.dark = t.dark;
32
32
  }
33
33
  static init(t) {
34
- return new n(t);
34
+ return new a(t);
35
35
  }
36
36
  /**
37
37
  * Validates a color string format
@@ -44,32 +44,32 @@ const E = class n extends b {
44
44
  error: "Color must be a non-empty string"
45
45
  };
46
46
  const e = t.trim();
47
- if (n.HEX_REGEX.test(e))
47
+ if (a.HEX_REGEX.test(e))
48
48
  return { isValid: !0, format: "hex" };
49
- if (n.RGB_REGEX.test(e)) {
50
- const a = e.match(n.RGB_REGEX), [, s, o, c] = a.map(Number);
49
+ if (a.RGB_REGEX.test(e)) {
50
+ const n = e.match(a.RGB_REGEX), [, s, o, c] = n.map(Number);
51
51
  return s <= 255 && o <= 255 && c <= 255 ? { isValid: !0, format: "rgb" } : {
52
52
  isValid: !1,
53
53
  error: "RGB values must be between 0 and 255"
54
54
  };
55
55
  }
56
- if (n.RGBA_REGEX.test(e)) {
57
- const a = e.match(n.RGBA_REGEX), [, s, o, c, l] = a, u = Number(s), h = Number(o), f = Number(c), m = Number(l);
58
- return u <= 255 && h <= 255 && f <= 255 && m >= 0 && m <= 1 ? { isValid: !0, format: "rgba" } : {
56
+ if (a.RGBA_REGEX.test(e)) {
57
+ const n = e.match(a.RGBA_REGEX), [, s, o, c, l] = n, u = Number(s), h = Number(o), f = Number(c), d = Number(l);
58
+ return u <= 255 && h <= 255 && f <= 255 && d >= 0 && d <= 1 ? { isValid: !0, format: "rgba" } : {
59
59
  isValid: !1,
60
60
  error: "RGBA values must be: RGB 0-255, alpha 0-1"
61
61
  };
62
62
  }
63
- if (n.HSL_REGEX.test(e)) {
64
- const a = e.match(n.HSL_REGEX), [, s, o, c] = a.map(Number);
63
+ if (a.HSL_REGEX.test(e)) {
64
+ const n = e.match(a.HSL_REGEX), [, s, o, c] = n.map(Number);
65
65
  return s <= 360 && o <= 100 && c <= 100 ? { isValid: !0, format: "hsl" } : {
66
66
  isValid: !1,
67
67
  error: "HSL values must be: H 0-360, S/L 0-100%"
68
68
  };
69
69
  }
70
- if (n.HSLA_REGEX.test(e)) {
71
- const a = e.match(n.HSLA_REGEX), [, s, o, c, l] = a, u = Number(s), h = Number(o), f = Number(c), m = Number(l);
72
- return u <= 360 && h <= 100 && f <= 100 && m >= 0 && m <= 1 ? { isValid: !0, format: "hsla" } : {
70
+ if (a.HSLA_REGEX.test(e)) {
71
+ const n = e.match(a.HSLA_REGEX), [, s, o, c, l] = n, u = Number(s), h = Number(o), f = Number(c), d = Number(l);
72
+ return u <= 360 && h <= 100 && f <= 100 && d >= 0 && d <= 1 ? { isValid: !0, format: "hsla" } : {
73
73
  isValid: !1,
74
74
  error: "HSLA values must be: H 0-360, S/L 0-100%, alpha 0-1"
75
75
  };
@@ -108,67 +108,67 @@ const E = class n extends b {
108
108
  };
109
109
  }
110
110
  static getCurrentTheme() {
111
- return S();
111
+ return C();
112
112
  }
113
113
  opacity(t) {
114
114
  if (!this.isFiniteInput(t, "opacity(alpha)"))
115
115
  return this;
116
- const e = n.clamp(t, 0, 1);
117
- return new n({
116
+ const e = a.clamp(t, 0, 1);
117
+ return new a({
118
118
  name: this.name,
119
- default: n.applyAlpha(this.default, e),
120
- light: this.light ? n.applyAlpha(this.light, e) : void 0,
121
- dark: this.dark ? n.applyAlpha(this.dark, e) : void 0
119
+ default: a.applyAlpha(this.default, e),
120
+ light: this.light ? a.applyAlpha(this.light, e) : void 0,
121
+ dark: this.dark ? a.applyAlpha(this.dark, e) : void 0
122
122
  });
123
123
  }
124
124
  saturate(t) {
125
125
  if (!this.isFiniteInput(t, "saturate(amount)"))
126
126
  return this;
127
- const e = n.clamp(t, -1, 1);
128
- return new n({
127
+ const e = a.clamp(t, -1, 1);
128
+ return new a({
129
129
  name: this.name,
130
- default: n.applySaturation(this.default, e),
131
- light: this.light ? n.applySaturation(this.light, e) : void 0,
132
- dark: this.dark ? n.applySaturation(this.dark, e) : void 0
130
+ default: a.applySaturation(this.default, e),
131
+ light: this.light ? a.applySaturation(this.light, e) : void 0,
132
+ dark: this.dark ? a.applySaturation(this.dark, e) : void 0
133
133
  });
134
134
  }
135
135
  brighten(t) {
136
136
  if (!this.isFiniteInput(t, "brighten(amount)"))
137
137
  return this;
138
- const e = n.clamp(t, -1, 1);
139
- return new n({
138
+ const e = a.clamp(t, -1, 1);
139
+ return new a({
140
140
  name: this.name,
141
- default: n.applyBrightness(this.default, e),
142
- light: this.light ? n.applyBrightness(this.light, e) : void 0,
143
- dark: this.dark ? n.applyBrightness(this.dark, e) : void 0
141
+ default: a.applyBrightness(this.default, e),
142
+ light: this.light ? a.applyBrightness(this.light, e) : void 0,
143
+ dark: this.dark ? a.applyBrightness(this.dark, e) : void 0
144
144
  });
145
145
  }
146
146
  contrast(t) {
147
147
  if (!this.isFiniteInput(t, "contrast(amount)"))
148
148
  return this;
149
- const e = n.clamp(t, -1, 1);
150
- return new n({
149
+ const e = a.clamp(t, -1, 1);
150
+ return new a({
151
151
  name: this.name,
152
- default: n.applyContrast(this.default, e),
153
- light: this.light ? n.applyContrast(this.light, e) : void 0,
154
- dark: this.dark ? n.applyContrast(this.dark, e) : void 0
152
+ default: a.applyContrast(this.default, e),
153
+ light: this.light ? a.applyContrast(this.light, e) : void 0,
154
+ dark: this.dark ? a.applyContrast(this.dark, e) : void 0
155
155
  });
156
156
  }
157
157
  rotateHue(t) {
158
158
  if (!this.isFiniteInput(t, "rotateHue(degrees)"))
159
159
  return this;
160
160
  const e = (t % 360 + 360) % 360;
161
- return new n({
161
+ return new a({
162
162
  name: this.name,
163
- default: n.applyHueRotation(this.default, e),
164
- light: this.light ? n.applyHueRotation(this.light, e) : void 0,
165
- dark: this.dark ? n.applyHueRotation(this.dark, e) : void 0
163
+ default: a.applyHueRotation(this.default, e),
164
+ light: this.light ? a.applyHueRotation(this.light, e) : void 0,
165
+ dark: this.dark ? a.applyHueRotation(this.dark, e) : void 0
166
166
  });
167
167
  }
168
168
  resolve() {
169
169
  const t = x() !== null;
170
170
  let e;
171
- return t ? e = C()() : e = n.getCurrentTheme(), e === "dark" ? this.dark || this.default : this.light || this.default;
171
+ return t ? e = S()() : e = a.getCurrentTheme(), e === "dark" ? this.dark || this.default : this.light || this.default;
172
172
  }
173
173
  isFiniteInput(t, e) {
174
174
  if (Number.isFinite(t))
@@ -189,111 +189,111 @@ const E = class n extends b {
189
189
  return `color-mix(in srgb, ${t} ${r}%, transparent)`;
190
190
  }
191
191
  static applyAlpha(t, e) {
192
- const r = t.trim(), a = n.formatAlpha(e);
193
- if (r.match(n.HEX_REGEX)) {
194
- const [f, m, d] = n.parseHex(r);
195
- return `rgba(${f}, ${m}, ${d}, ${a})`;
192
+ const r = t.trim(), n = a.formatAlpha(e);
193
+ if (r.match(a.HEX_REGEX)) {
194
+ const [f, d, m] = a.parseHex(r);
195
+ return `rgba(${f}, ${d}, ${m}, ${n})`;
196
196
  }
197
- const o = r.match(n.RGB_REGEX);
197
+ const o = r.match(a.RGB_REGEX);
198
198
  if (o) {
199
- const [, f, m, d] = o.map(Number);
200
- return `rgba(${f}, ${m}, ${d}, ${a})`;
199
+ const [, f, d, m] = o.map(Number);
200
+ return `rgba(${f}, ${d}, ${m}, ${n})`;
201
201
  }
202
- const c = r.match(n.RGBA_REGEX);
202
+ const c = r.match(a.RGBA_REGEX);
203
203
  if (c) {
204
- const [, f, m, d] = c.map(Number);
205
- return `rgba(${f}, ${m}, ${d}, ${a})`;
204
+ const [, f, d, m] = c.map(Number);
205
+ return `rgba(${f}, ${d}, ${m}, ${n})`;
206
206
  }
207
- const l = r.match(n.HSL_REGEX);
207
+ const l = r.match(a.HSL_REGEX);
208
208
  if (l) {
209
- const [, f, m, d] = l.map(Number);
210
- return `hsla(${f}, ${m}%, ${d}%, ${a})`;
209
+ const [, f, d, m] = l.map(Number);
210
+ return `hsla(${f}, ${d}%, ${m}%, ${n})`;
211
211
  }
212
- const u = r.match(n.HSLA_REGEX);
212
+ const u = r.match(a.HSLA_REGEX);
213
213
  if (u) {
214
- const [, f, m, d] = u.map(Number);
215
- return `hsla(${f}, ${m}%, ${d}%, ${a})`;
214
+ const [, f, d, m] = u.map(Number);
215
+ return `hsla(${f}, ${d}%, ${m}%, ${n})`;
216
216
  }
217
- const h = n.NAMED_COLOR_RGB[r.toLowerCase()];
217
+ const h = a.NAMED_COLOR_RGB[r.toLowerCase()];
218
218
  if (h) {
219
- const [f, m, d] = h;
220
- return `rgba(${f}, ${m}, ${d}, ${a})`;
219
+ const [f, d, m] = h;
220
+ return `rgba(${f}, ${d}, ${m}, ${n})`;
221
221
  }
222
- return n.toColorMix(r, e);
222
+ return a.toColorMix(r, e);
223
223
  }
224
224
  static parseHex(t) {
225
- const [e, r, a] = n.parseHexWithAlpha(t);
226
- return [e, r, a];
225
+ const [e, r, n] = a.parseHexWithAlpha(t);
226
+ return [e, r, n];
227
227
  }
228
228
  static parseHexWithAlpha(t) {
229
- const e = t.slice(1), r = e.length === 3 ? e.split("").map((l) => `${l}${l}`).join("") : e.length === 8 ? e.slice(0, 6) : e, a = e.length === 8 ? Number.parseInt(e.slice(6, 8), 16) / 255 : 1, s = Number.parseInt(r.slice(0, 2), 16), o = Number.parseInt(r.slice(2, 4), 16), c = Number.parseInt(r.slice(4, 6), 16);
230
- return [s, o, c, a];
229
+ const e = t.slice(1), r = e.length === 3 ? e.split("").map((l) => `${l}${l}`).join("") : e.length === 8 ? e.slice(0, 6) : e, n = e.length === 8 ? Number.parseInt(e.slice(6, 8), 16) / 255 : 1, s = Number.parseInt(r.slice(0, 2), 16), o = Number.parseInt(r.slice(2, 4), 16), c = Number.parseInt(r.slice(4, 6), 16);
230
+ return [s, o, c, n];
231
231
  }
232
232
  static applySaturation(t, e) {
233
- const r = n.parseColorToHsla(t);
233
+ const r = a.parseColorToHsla(t);
234
234
  if (!r)
235
235
  return t;
236
- const a = e >= 0 ? r.s + (1 - r.s) * e : r.s * (1 + e), s = n.clamp(a, 0, 1), [o, c, l] = n.hslToRgb(r.h, s, r.l);
237
- return r.a < 1 ? `rgba(${o}, ${c}, ${l}, ${n.formatAlpha(r.a)})` : n.rgbToHex(o, c, l);
236
+ const n = e >= 0 ? r.s + (1 - r.s) * e : r.s * (1 + e), s = a.clamp(n, 0, 1), [o, c, l] = a.hslToRgb(r.h, s, r.l);
237
+ return r.a < 1 ? `rgba(${o}, ${c}, ${l}, ${a.formatAlpha(r.a)})` : a.rgbToHex(o, c, l);
238
238
  }
239
239
  static applyBrightness(t, e) {
240
- const r = n.parseColorToRgba(t);
240
+ const r = a.parseColorToRgba(t);
241
241
  if (!r)
242
242
  return t;
243
- const a = (l) => {
243
+ const n = (l) => {
244
244
  const u = e >= 0 ? l + (255 - l) * e : l * (1 + e);
245
- return Math.round(n.clamp(u, 0, 255));
246
- }, s = a(r.r), o = a(r.g), c = a(r.b);
247
- return r.a < 1 ? `rgba(${s}, ${o}, ${c}, ${n.formatAlpha(r.a)})` : n.rgbToHex(s, o, c);
245
+ return Math.round(a.clamp(u, 0, 255));
246
+ }, s = n(r.r), o = n(r.g), c = n(r.b);
247
+ return r.a < 1 ? `rgba(${s}, ${o}, ${c}, ${a.formatAlpha(r.a)})` : a.rgbToHex(s, o, c);
248
248
  }
249
249
  static applyContrast(t, e) {
250
- const r = n.parseColorToRgba(t);
250
+ const r = a.parseColorToRgba(t);
251
251
  if (!r)
252
252
  return t;
253
- const a = 1 + e, s = (u) => {
254
- const f = (u / 255 - 0.5) * a + 0.5;
255
- return Math.round(n.clamp(f, 0, 1) * 255);
253
+ const n = 1 + e, s = (u) => {
254
+ const f = (u / 255 - 0.5) * n + 0.5;
255
+ return Math.round(a.clamp(f, 0, 1) * 255);
256
256
  }, o = s(r.r), c = s(r.g), l = s(r.b);
257
- return r.a < 1 ? `rgba(${o}, ${c}, ${l}, ${n.formatAlpha(r.a)})` : n.rgbToHex(o, c, l);
257
+ return r.a < 1 ? `rgba(${o}, ${c}, ${l}, ${a.formatAlpha(r.a)})` : a.rgbToHex(o, c, l);
258
258
  }
259
259
  static applyHueRotation(t, e) {
260
- const r = n.parseColorToHsla(t);
260
+ const r = a.parseColorToHsla(t);
261
261
  if (!r)
262
262
  return t;
263
- const a = (r.h + e) % 360, [s, o, c] = n.hslToRgb(a, r.s, r.l);
264
- return r.a < 1 ? `rgba(${s}, ${o}, ${c}, ${n.formatAlpha(r.a)})` : n.rgbToHex(s, o, c);
263
+ const n = (r.h + e) % 360, [s, o, c] = a.hslToRgb(n, r.s, r.l);
264
+ return r.a < 1 ? `rgba(${s}, ${o}, ${c}, ${a.formatAlpha(r.a)})` : a.rgbToHex(s, o, c);
265
265
  }
266
266
  static parseColorToRgba(t) {
267
267
  const e = t.trim();
268
- if (n.HEX_REGEX.test(e)) {
269
- const [l, u, h, f] = n.parseHexWithAlpha(e);
268
+ if (a.HEX_REGEX.test(e)) {
269
+ const [l, u, h, f] = a.parseHexWithAlpha(e);
270
270
  return { r: l, g: u, b: h, a: f };
271
271
  }
272
- const r = e.match(n.RGB_REGEX);
272
+ const r = e.match(a.RGB_REGEX);
273
273
  if (r) {
274
274
  const [, l, u, h] = r.map(Number);
275
275
  return { r: l, g: u, b: h, a: 1 };
276
276
  }
277
- const a = e.match(n.RGBA_REGEX);
278
- if (a) {
279
- const [, l, u, h, f] = a;
277
+ const n = e.match(a.RGBA_REGEX);
278
+ if (n) {
279
+ const [, l, u, h, f] = n;
280
280
  return { r: Number(l), g: Number(u), b: Number(h), a: Number(f) };
281
281
  }
282
- const s = e.match(n.HSL_REGEX);
282
+ const s = e.match(a.HSL_REGEX);
283
283
  if (s) {
284
- const [, l, u, h] = s.map(Number), [f, m, d] = n.hslToRgb(l, u / 100, h / 100);
285
- return { r: f, g: m, b: d, a: 1 };
284
+ const [, l, u, h] = s.map(Number), [f, d, m] = a.hslToRgb(l, u / 100, h / 100);
285
+ return { r: f, g: d, b: m, a: 1 };
286
286
  }
287
- const o = e.match(n.HSLA_REGEX);
287
+ const o = e.match(a.HSLA_REGEX);
288
288
  if (o) {
289
- const [, l, u, h, f] = o, [m, d, N] = n.hslToRgb(
289
+ const [, l, u, h, f] = o, [d, m, G] = a.hslToRgb(
290
290
  Number(l),
291
291
  Number(u) / 100,
292
292
  Number(h) / 100
293
293
  );
294
- return { r: m, g: d, b: N, a: Number(f) };
294
+ return { r: d, g: m, b: G, a: Number(f) };
295
295
  }
296
- const c = n.NAMED_COLOR_RGB[e.toLowerCase()];
296
+ const c = a.NAMED_COLOR_RGB[e.toLowerCase()];
297
297
  if (c) {
298
298
  const [l, u, h, f] = c;
299
299
  return { r: l, g: u, b: h, a: f };
@@ -301,51 +301,51 @@ const E = class n extends b {
301
301
  return null;
302
302
  }
303
303
  static parseColorToHsla(t) {
304
- const e = t.trim(), r = e.match(n.HSL_REGEX);
304
+ const e = t.trim(), r = e.match(a.HSL_REGEX);
305
305
  if (r) {
306
306
  const [, u, h, f] = r.map(Number);
307
307
  return { h: u, s: h / 100, l: f / 100, a: 1 };
308
308
  }
309
- const a = e.match(n.HSLA_REGEX);
310
- if (a) {
311
- const [, u, h, f, m] = a;
309
+ const n = e.match(a.HSLA_REGEX);
310
+ if (n) {
311
+ const [, u, h, f, d] = n;
312
312
  return {
313
313
  h: Number(u),
314
314
  s: Number(h) / 100,
315
315
  l: Number(f) / 100,
316
- a: Number(m)
316
+ a: Number(d)
317
317
  };
318
318
  }
319
- const s = n.parseColorToRgba(e);
319
+ const s = a.parseColorToRgba(e);
320
320
  if (!s)
321
321
  return null;
322
- const [o, c, l] = n.rgbToHsl(s.r, s.g, s.b);
322
+ const [o, c, l] = a.rgbToHsl(s.r, s.g, s.b);
323
323
  return { h: o, s: c, l, a: s.a };
324
324
  }
325
325
  static rgbToHsl(t, e, r) {
326
- const a = t / 255, s = e / 255, o = r / 255, c = Math.max(a, s, o), l = Math.min(a, s, o), u = c - l;
326
+ const n = t / 255, s = e / 255, o = r / 255, c = Math.max(n, s, o), l = Math.min(n, s, o), u = c - l;
327
327
  let h = 0;
328
- const f = (c + l) / 2, m = u === 0 ? 0 : u / (1 - Math.abs(2 * f - 1));
329
- return u !== 0 && (c === a ? h = (s - o) / u % 6 : c === s ? h = (o - a) / u + 2 : h = (a - s) / u + 4, h *= 60, h < 0 && (h += 360)), [h, m, f];
328
+ const f = (c + l) / 2, d = u === 0 ? 0 : u / (1 - Math.abs(2 * f - 1));
329
+ return u !== 0 && (c === n ? h = (s - o) / u % 6 : c === s ? h = (o - n) / u + 2 : h = (n - s) / u + 4, h *= 60, h < 0 && (h += 360)), [h, d, f];
330
330
  }
331
331
  static hslToRgb(t, e, r) {
332
- const a = (t % 360 + 360) % 360, s = (1 - Math.abs(2 * r - 1)) * e, o = s * (1 - Math.abs(a / 60 % 2 - 1)), c = r - s / 2;
332
+ const n = (t % 360 + 360) % 360, s = (1 - Math.abs(2 * r - 1)) * e, o = s * (1 - Math.abs(n / 60 % 2 - 1)), c = r - s / 2;
333
333
  let l = 0, u = 0, h = 0;
334
- a < 60 ? (l = s, u = o) : a < 120 ? (l = o, u = s) : a < 180 ? (u = s, h = o) : a < 240 ? (u = o, h = s) : a < 300 ? (l = o, h = s) : (l = s, h = o);
335
- const f = Math.round((l + c) * 255), m = Math.round((u + c) * 255), d = Math.round((h + c) * 255);
336
- return [f, m, d];
334
+ n < 60 ? (l = s, u = o) : n < 120 ? (l = o, u = s) : n < 180 ? (u = s, h = o) : n < 240 ? (u = o, h = s) : n < 300 ? (l = o, h = s) : (l = s, h = o);
335
+ const f = Math.round((l + c) * 255), d = Math.round((u + c) * 255), m = Math.round((h + c) * 255);
336
+ return [f, d, m];
337
337
  }
338
338
  static rgbToHex(t, e, r) {
339
- const a = (s) => s.toString(16).padStart(2, "0");
340
- return `#${a(t)}${a(e)}${a(r)}`.toUpperCase();
339
+ const n = (s) => s.toString(16).padStart(2, "0");
340
+ return `#${n(t)}${n(e)}${n(r)}`.toUpperCase();
341
341
  }
342
342
  };
343
- p(E, "HEX_REGEX", /^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/);
344
- p(E, "RGB_REGEX", /^rgb\s*\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)$/i);
345
- p(E, "RGBA_REGEX", /^rgba\s*\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]*\.?[0-9]+)\s*\)$/i);
346
- p(E, "HSL_REGEX", /^hsl\s*\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})%\s*,\s*([0-9]{1,3})%\s*\)$/i);
347
- p(E, "HSLA_REGEX", /^hsla\s*\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})%\s*,\s*([0-9]{1,3})%\s*,\s*([0-9]*\.?[0-9]+)\s*\)$/i);
348
- p(E, "NAMED_COLOR_RGB", {
343
+ y(E, "HEX_REGEX", /^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/);
344
+ y(E, "RGB_REGEX", /^rgb\s*\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)$/i);
345
+ y(E, "RGBA_REGEX", /^rgba\s*\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]*\.?[0-9]+)\s*\)$/i);
346
+ y(E, "HSL_REGEX", /^hsl\s*\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})%\s*,\s*([0-9]{1,3})%\s*\)$/i);
347
+ y(E, "HSLA_REGEX", /^hsla\s*\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})%\s*,\s*([0-9]{1,3})%\s*,\s*([0-9]*\.?[0-9]+)\s*\)$/i);
348
+ y(E, "NAMED_COLOR_RGB", {
349
349
  transparent: [0, 0, 0, 0],
350
350
  black: [0, 0, 0, 1],
351
351
  white: [255, 255, 255, 1],
@@ -371,10 +371,10 @@ p(E, "NAMED_COLOR_RGB", {
371
371
  fuchsia: [255, 0, 255, 1]
372
372
  });
373
373
  let g = E;
374
- var H = Object.defineProperty, M = (i, t, e) => t in i ? H(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, v = (i, t, e) => M(i, typeof t != "symbol" ? t + "" : t, e);
375
- class F extends b {
374
+ var L = Object.defineProperty, P = (i, t, e) => t in i ? L(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, A = (i, t, e) => P(i, typeof t != "symbol" ? t + "" : t, e);
375
+ class F extends p {
376
376
  constructor(t) {
377
- if (super(t.name), v(this, "default"), v(this, "light"), v(this, "dark"), v(this, "alt"), v(this, "placeholder"), !t.default)
377
+ if (super(t.name), A(this, "default"), A(this, "light"), A(this, "dark"), A(this, "alt"), A(this, "placeholder"), !t.default)
378
378
  throw new Error(`ImageAsset "${t.name}" must specify a default image path`);
379
379
  this.default = t.default, this.light = t.light, this.dark = t.dark, this.alt = t.options?.alt, this.placeholder = t.options?.placeholder;
380
380
  }
@@ -382,12 +382,12 @@ class F extends b {
382
382
  return new F(t);
383
383
  }
384
384
  static getCurrentTheme() {
385
- return S();
385
+ return C();
386
386
  }
387
387
  resolve() {
388
388
  const t = x() !== null;
389
389
  let e;
390
- return t ? e = C()() : e = F.getCurrentTheme(), e === "dark" ? this.dark || this.default : this.light || this.default;
390
+ return t ? e = S()() : e = F.getCurrentTheme(), e === "dark" ? this.dark || this.default : this.light || this.default;
391
391
  }
392
392
  // Additional accessors
393
393
  get src() {
@@ -403,21 +403,21 @@ class F extends b {
403
403
  return this.default;
404
404
  }
405
405
  }
406
- var L = Object.defineProperty, P = (i, t, e) => t in i ? L(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, A = (i, t, e) => P(i, typeof t != "symbol" ? t + "" : t, e);
407
- class w extends b {
408
- constructor(t, e = [], r = "", a = {}) {
409
- super(r || t), A(this, "family"), A(this, "fallbacks"), A(this, "options"), A(this, "loaded", !1), A(this, "loadPromise", null), this.family = t, this.fallbacks = e, this.options = {
406
+ var X = Object.defineProperty, T = (i, t, e) => t in i ? X(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, v = (i, t, e) => T(i, typeof t != "symbol" ? t + "" : t, e);
407
+ class w extends p {
408
+ constructor(t, e = [], r = "", n = {}) {
409
+ super(r || t), v(this, "family"), v(this, "fallbacks"), v(this, "options"), v(this, "loaded", !1), v(this, "loadPromise", null), this.family = t, this.fallbacks = e, this.options = {
410
410
  loading: "lazy",
411
411
  fontDisplay: "swap",
412
412
  preconnect: !0,
413
- ...a
413
+ ...n
414
414
  }, this.options.loading === "eager" && this.load();
415
415
  }
416
416
  /**
417
417
  * Static factory method for SwiftUI-style initialization
418
418
  */
419
- static init(t, e = [], r, a = {}) {
420
- return new w(t, e, r, a);
419
+ static init(t, e = [], r, n = {}) {
420
+ return new w(t, e, r, n);
421
421
  }
422
422
  /**
423
423
  * Get the full font-family CSS value including fallbacks
@@ -443,18 +443,18 @@ class w extends b {
443
443
  if (t) {
444
444
  if (e && typeof document < "u" && document.querySelector)
445
445
  try {
446
- const a = new URL(t).origin;
447
- if (!document.querySelector(`link[rel="preconnect"][href="${a}"]`)) {
446
+ const n = new URL(t).origin;
447
+ if (!document.querySelector(`link[rel="preconnect"][href="${n}"]`)) {
448
448
  const s = document.createElement("link");
449
- s.rel = "preconnect", s.href = a, s.crossOrigin = "anonymous", document.head.appendChild(s);
449
+ s.rel = "preconnect", s.href = n, s.crossOrigin = "anonymous", document.head.appendChild(s);
450
450
  }
451
451
  } catch {
452
452
  }
453
453
  if (t.endsWith(".css") || t.includes("fonts.googleapis.com") ? await this.loadFontCSS(t) : await this.loadFontFile(t), "fonts" in document)
454
454
  try {
455
455
  await document.fonts.ready;
456
- const a = `16px ${this.family.includes(" ") ? `"${this.family}"` : this.family}`;
457
- document.fonts.check(a) || console.warn(`⚠️ Font "${this.family}" may not have loaded correctly`);
456
+ const n = `16px ${this.family.includes(" ") ? `"${this.family}"` : this.family}`;
457
+ document.fonts.check(n) || console.warn(`⚠️ Font "${this.family}" may not have loaded correctly`);
458
458
  } catch {
459
459
  }
460
460
  }
@@ -480,7 +480,7 @@ class w extends b {
480
480
  * Load a font file directly and create @font-face rule
481
481
  */
482
482
  async loadFontFile(t) {
483
- const { fontFormat: e, fontDisplay: r, weightRange: a, widthRange: s } = this.options;
483
+ const { fontFormat: e, fontDisplay: r, weightRange: n, widthRange: s } = this.options;
484
484
  let o = "";
485
485
  e ? o = `format('${e}')` : t.endsWith(".woff2") ? o = "format('woff2')" : t.endsWith(".woff") ? o = "format('woff')" : t.endsWith(".ttf") && (o = "format('truetype')");
486
486
  let c = `
@@ -489,7 +489,7 @@ class w extends b {
489
489
  src: url("${t}") ${o};
490
490
  font-display: ${r || "swap"};
491
491
  `;
492
- a && (c += `font-weight: ${a[0]} ${a[1]};
492
+ n && (c += `font-weight: ${n[0]} ${n[1]};
493
493
  `), s && (c += `font-stretch: ${s[0]}% ${s[1]}%;
494
494
  `), c += "}";
495
495
  const l = document.createElement("style");
@@ -497,7 +497,7 @@ class w extends b {
497
497
  try {
498
498
  const u = new FontFace(this.family, `url(${t})`, {
499
499
  display: r || "swap",
500
- weight: a ? `${a[0]} ${a[1]}` : void 0,
500
+ weight: n ? `${n[0]} ${n[1]}` : void 0,
501
501
  stretch: s ? `${s[0]}% ${s[1]}%` : void 0
502
502
  });
503
503
  await u.load(), document.fonts.add(u);
@@ -523,7 +523,7 @@ class w extends b {
523
523
  return this.options.loading === "lazy" && !this.loaded && this.options.fontUrl && this.load(), this.value;
524
524
  }
525
525
  }
526
- const D = {
526
+ const q = {
527
527
  ultraLight: 100,
528
528
  thin: 200,
529
529
  light: 300,
@@ -533,7 +533,7 @@ const D = {
533
533
  bold: 700,
534
534
  heavy: 800,
535
535
  black: 900
536
- }, q = {
536
+ }, z = {
537
537
  ultraCondensed: 50,
538
538
  extraCondensed: 62.5,
539
539
  condensed: 75,
@@ -550,11 +550,11 @@ const D = {
550
550
  cursive: ["cursive"],
551
551
  fantasy: ["fantasy"]
552
552
  };
553
- function z(i = "sansSerif", t) {
553
+ function U(i = "sansSerif", t) {
554
554
  return new w("", [...R[i]], t || `system-${i}`);
555
555
  }
556
- function U(i, t = [400], e, r = {}) {
557
- const a = t.join(";"), o = `https://fonts.googleapis.com/css2?family=${i.replace(/\s+/g, "+")}:wght@${a}&display=swap`;
556
+ function j(i, t = [400], e, r = {}) {
557
+ const n = t.join(";"), o = `https://fonts.googleapis.com/css2?family=${i.replace(/\s+/g, "+")}:wght@${n}&display=swap`;
558
558
  return new w(
559
559
  i,
560
560
  [...R.sansSerif],
@@ -566,9 +566,9 @@ function U(i, t = [400], e, r = {}) {
566
566
  }
567
567
  );
568
568
  }
569
- function j(i, t, e, r = [...R.sansSerif], a) {
569
+ function K(i, t, e, r = [...R.sansSerif], n) {
570
570
  const s = {};
571
- return e.slant && (s.slnt = e.slant), e.optical && (s.opsz = e.optical), e.custom && Object.assign(s, e.custom), new w(i, r, a, {
571
+ return e.slant && (s.slnt = e.slant), e.optical && (s.opsz = e.optical), e.custom && Object.assign(s, e.custom), new w(i, r, n, {
572
572
  fontUrl: t,
573
573
  weightRange: e.weight,
574
574
  widthRange: e.width,
@@ -576,10 +576,10 @@ function j(i, t, e, r = [...R.sansSerif], a) {
576
576
  fontDisplay: "swap"
577
577
  });
578
578
  }
579
- var X = Object.defineProperty, T = (i, t, e) => t in i ? X(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, B = (i, t, e) => T(i, t + "", e);
580
- class V {
579
+ var B = Object.defineProperty, V = (i, t, e) => t in i ? B(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, I = (i, t, e) => V(i, t + "", e);
580
+ class O {
581
581
  constructor() {
582
- B(this, "assets", /* @__PURE__ */ new Map());
582
+ I(this, "assets", /* @__PURE__ */ new Map());
583
583
  }
584
584
  add(t, e) {
585
585
  this.assets.set(t, e);
@@ -601,14 +601,14 @@ class V {
601
601
  const r = this.assets.get(e);
602
602
  if (r)
603
603
  return r instanceof g ? new Proxy(r, {
604
- get: (a, s) => s === "light" || s === "dark" ? a[s] : s === "resolve" ? () => a.resolve() : s === "toString" || s === "valueOf" ? () => a.resolve() : a[s],
605
- has: (a, s) => s === "resolve" ? !0 : s in a
604
+ get: (n, s) => s === "light" || s === "dark" ? n[s] : s === "resolve" ? () => n.resolve() : s === "toString" || s === "valueOf" ? () => n.resolve() : n[s],
605
+ has: (n, s) => s === "resolve" ? !0 : s in n
606
606
  }) : r instanceof F ? new Proxy(r, {
607
- get: (a, s) => s === "lightSrc" || s === "darkSrc" || s === "src" || s === "defaultSrc" ? a[s] : s === "resolve" ? () => a.resolve() : s === "toString" || s === "valueOf" ? () => a.resolve() : a[s],
608
- has: (a, s) => s === "resolve" ? !0 : s in a
607
+ get: (n, s) => s === "lightSrc" || s === "darkSrc" || s === "src" || s === "defaultSrc" ? n[s] : s === "resolve" ? () => n.resolve() : s === "toString" || s === "valueOf" ? () => n.resolve() : n[s],
608
+ has: (n, s) => s === "resolve" ? !0 : s in n
609
609
  }) : r instanceof w ? new Proxy(r, {
610
- get: (a, s) => s === "family" || s === "fallbacks" || s === "options" ? a[s] : s === "resolve" ? () => a.resolve() : s === "toString" || s === "valueOf" ? () => a.resolve() : a[s],
611
- has: (a, s) => s === "resolve" ? !0 : s in a
610
+ get: (n, s) => s === "family" || s === "fallbacks" || s === "options" ? n[s] : s === "resolve" ? () => n.resolve() : s === "toString" || s === "valueOf" ? () => n.resolve() : n[s],
611
+ has: (n, s) => s === "resolve" ? !0 : s in n
612
612
  }) : r;
613
613
  },
614
614
  // Add ownKeys handler to support Object.keys() enumeration
@@ -619,29 +619,29 @@ class V {
619
619
  );
620
620
  }
621
621
  }
622
- const $ = new V(), I = $.asProxy(), K = I;
623
- function y(...i) {
622
+ const b = new O(), N = b.asProxy(), J = N;
623
+ function $(...i) {
624
624
  if (i.length === 0)
625
625
  throw new Error("registerAsset requires at least one argument");
626
626
  const t = i[0], e = i[1];
627
- if (typeof t == "string" && e instanceof b && i.length === 2)
628
- return $.add(t, e), e;
629
- if (t instanceof b && typeof e == "string" && i.length === 2)
630
- return $.add(e, t), t;
631
- if (t instanceof b && i.length === 1)
632
- return $.add(t.name, t), t;
633
- if (t instanceof b && e === void 0 && i.length === 2)
634
- return $.add(t.name, t), t;
635
- if (t instanceof b && i.length > 1) {
627
+ if (typeof t == "string" && e instanceof p && i.length === 2)
628
+ return b.add(t, e), e;
629
+ if (t instanceof p && typeof e == "string" && i.length === 2)
630
+ return b.add(e, t), t;
631
+ if (t instanceof p && i.length === 1)
632
+ return b.add(t.name, t), t;
633
+ if (t instanceof p && e === void 0 && i.length === 2)
634
+ return b.add(t.name, t), t;
635
+ if (t instanceof p && i.length > 1) {
636
636
  const r = [];
637
- i.forEach((a, s) => {
638
- if (!(a instanceof b))
637
+ i.forEach((n, s) => {
638
+ if (!(n instanceof p))
639
639
  throw new Error(
640
640
  `registerAsset variadic argument at index ${s} must be an Asset`
641
641
  );
642
- r.push(a);
643
- }), r.forEach((a) => {
644
- $.add(a.name, a);
642
+ r.push(n);
643
+ }), r.forEach((n) => {
644
+ b.add(n.name, n);
645
645
  });
646
646
  return;
647
647
  } else
@@ -649,7 +649,7 @@ function y(...i) {
649
649
  "registerAsset requires either (name, asset), (asset), (asset, overrideName), or (...assets)"
650
650
  );
651
651
  }
652
- function J(i, t, e = "") {
652
+ function Q(i, t, e = "") {
653
653
  return g.init({
654
654
  default: i,
655
655
  light: i,
@@ -657,100 +657,124 @@ function J(i, t, e = "") {
657
657
  name: e
658
658
  });
659
659
  }
660
- function Q(i, t, e, r = "", a) {
660
+ function Y(i, t, e, r = "", n) {
661
661
  return F.init({
662
662
  default: i,
663
663
  light: t,
664
664
  dark: e,
665
665
  name: r,
666
- options: a
666
+ options: n
667
667
  });
668
668
  }
669
- function Y(i, t = [], e = "", r) {
669
+ function Z(i, t = [], e = "", r) {
670
670
  return w.init(i, t, e, r);
671
671
  }
672
- function Z() {
673
- const i = $.getAll(), t = [];
672
+ function _() {
673
+ const i = b.getAll(), t = [];
674
674
  for (const [e, r] of i) {
675
- let a = "custom";
676
- r instanceof g ? a = "color" : r instanceof F ? a = "image" : r instanceof w && (a = "font"), t.push({
675
+ let n = "custom";
676
+ r instanceof g ? n = "color" : r instanceof F ? n = "image" : r instanceof w && (n = "font"), t.push({
677
677
  name: e,
678
- type: a,
678
+ type: n,
679
679
  asset: r
680
680
  });
681
681
  }
682
682
  return t.sort((e, r) => e.name.localeCompare(r.name));
683
683
  }
684
- function _() {
685
- return Array.from($.getAll().keys()).sort();
684
+ function tt(i) {
685
+ return b.get(i);
686
+ }
687
+ function k(i) {
688
+ if (i instanceof g)
689
+ return !0;
690
+ if (!i || typeof i != "object")
691
+ return !1;
692
+ const t = i;
693
+ return typeof t.resolve == "function" && typeof t.opacity == "function" && typeof t.saturate == "function" && typeof t.brighten == "function" && typeof t.contrast == "function" && typeof t.rotateHue == "function";
694
+ }
695
+ function et(i) {
696
+ const t = N[i];
697
+ return k(t) ? t : void 0;
698
+ }
699
+ function rt(i, t = "asset") {
700
+ if (!k(i))
701
+ throw new Error(`Asset "${t}" is not a ColorAsset`);
702
+ return i;
703
+ }
704
+ function st() {
705
+ return Array.from(b.getAll().keys()).sort();
686
706
  }
687
- y(g.init({
707
+ $(g.init({
688
708
  default: "#007AFF",
689
709
  light: "#007AFF",
690
710
  dark: "#0A84FF",
691
711
  name: "systemBlue"
692
712
  }));
693
- y(g.init({
713
+ $(g.init({
694
714
  default: "#34C759",
695
715
  light: "#34C759",
696
716
  dark: "#30D158",
697
717
  name: "systemGreen"
698
718
  }));
699
- y(g.init({
719
+ $(g.init({
700
720
  default: "#FF3B30",
701
721
  light: "#FF3B30",
702
722
  dark: "#FF453A",
703
723
  name: "systemRed"
704
724
  }));
705
- y(g.init({
725
+ $(g.init({
706
726
  default: "#FF9500",
707
727
  light: "#FF9500",
708
728
  dark: "#FF9F0A",
709
729
  name: "systemOrange"
710
730
  }));
711
- y(g.init({
731
+ $(g.init({
712
732
  default: "#5856D6",
713
733
  light: "#5856D6",
714
734
  dark: "#5E5CE6",
715
735
  name: "systemPurple"
716
736
  }));
717
- y(g.init({
737
+ $(g.init({
718
738
  default: "#FF2D55",
719
739
  light: "#FF2D55",
720
740
  dark: "#FF375F",
721
741
  name: "systemPink"
722
742
  }));
723
- y(g.init({
743
+ $(g.init({
724
744
  default: "#8E8E93",
725
745
  name: "systemGray"
726
746
  }));
727
- y(g.init({
747
+ $(g.init({
728
748
  default: "#000000",
729
749
  name: "systemBlack"
730
750
  }));
731
- y(g.init({
751
+ $(g.init({
732
752
  default: "#FFFFFF",
733
753
  name: "systemWhite"
734
754
  }));
735
755
  export {
736
- b as Asset,
737
- K as Assets,
756
+ p as Asset,
757
+ J as Assets,
738
758
  g as ColorAsset,
739
759
  w as FontAsset,
740
- D as FontWeight,
741
- q as FontWidth,
760
+ q as FontWeight,
761
+ z as FontWidth,
742
762
  F as ImageAsset,
743
- rt as LinearGradient,
744
- st as RadialGradient,
745
- at as StateGradient,
763
+ it as LinearGradient,
764
+ ot as RadialGradient,
765
+ lt as StateGradient,
746
766
  R as SystemFonts,
747
- J as createColorAsset,
748
- Y as createFontAsset,
749
- U as createGoogleFont,
750
- Q as createImageAsset,
751
- z as createSystemFont,
752
- j as createVariableFont,
753
- Z as getAssetInfo,
754
- _ as listAssetNames,
755
- y as registerAsset
767
+ rt as asColorAsset,
768
+ Q as createColorAsset,
769
+ Z as createFontAsset,
770
+ j as createGoogleFont,
771
+ Y as createImageAsset,
772
+ U as createSystemFont,
773
+ K as createVariableFont,
774
+ tt as getAsset,
775
+ _ as getAssetInfo,
776
+ et as getColorAsset,
777
+ k as isColorAsset,
778
+ st as listAssetNames,
779
+ $ as registerAsset
756
780
  };