@a_ng_d/utils-ui-color-palette 1.4.0 → 1.4.2

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,54 +1,54 @@
1
1
  var M = Object.defineProperty;
2
2
  var E = (c, r, s) => r in c ? M(c, r, { enumerable: !0, configurable: !0, writable: !0, value: s }) : c[r] = s;
3
- var b = (c, r, s) => E(c, typeof r != "symbol" ? r + "" : r, s);
4
- import { C as g, H as C } from "../../color-1CXTuV84.js";
3
+ var u = (c, r, s) => E(c, typeof r != "symbol" ? r + "" : r, s);
4
+ import { C as d, H as C } from "../../color-1CXTuV84.js";
5
5
  import { c as p } from "../../index-Beb8qoyd.js";
6
6
  const S = (c) => {
7
- const r = c.themes.filter((o) => o.type === "custom theme").length === 0 ? c.themes.filter((o) => o.type === "default theme") : c.themes.filter((o) => o.type === "custom theme"), s = {}, a = (o) => ({
7
+ const r = c.themes.filter((a) => a.type === "custom theme").length === 0 ? c.themes.filter((a) => a.type === "default theme") : c.themes.filter((a) => a.type === "custom theme"), s = {}, o = (a) => (isNaN(a.hsl[0]) && (a.hsl[0] = 0), isNaN(a.lch[2]) && (a.lch[2] = 0), isNaN(a.oklch[2]) && (a.oklch[2] = 0), {
8
8
  rgb: {
9
- r: Math.floor(o.rgb[0]),
10
- g: Math.floor(o.rgb[1]),
11
- b: Math.floor(o.rgb[2])
9
+ r: Math.floor(a.rgb[0]),
10
+ g: Math.floor(a.rgb[1]),
11
+ b: Math.floor(a.rgb[2])
12
12
  },
13
13
  gl: {
14
- r: parseFloat(o.gl[0].toFixed(3)),
15
- g: parseFloat(o.gl[1].toFixed(3)),
16
- b: parseFloat(o.gl[2].toFixed(3))
14
+ r: parseFloat(a.gl[0].toFixed(3)),
15
+ g: parseFloat(a.gl[1].toFixed(3)),
16
+ b: parseFloat(a.gl[2].toFixed(3))
17
17
  },
18
18
  lch: {
19
- l: Math.floor(o.lch[0]),
20
- c: Math.floor(o.lch[1]),
21
- h: Math.floor(o.lch[2])
19
+ l: Math.floor(a.lch[0]),
20
+ c: Math.floor(a.lch[1]),
21
+ h: Math.floor(a.lch[2])
22
22
  },
23
23
  oklch: {
24
- l: parseFloat(o.oklch[0].toFixed(3)),
25
- c: parseFloat(o.oklch[1].toFixed(3)),
26
- h: Math.floor(o.oklch[2])
24
+ l: parseFloat(a.oklch[0].toFixed(3)),
25
+ c: parseFloat(a.oklch[1].toFixed(3)),
26
+ h: Math.floor(a.oklch[2])
27
27
  },
28
28
  lab: {
29
- l: Math.floor(o.lab[0]),
30
- a: Math.floor(o.lab[1]),
31
- b: Math.floor(o.lab[2])
29
+ l: Math.floor(a.lab[0]),
30
+ a: Math.floor(a.lab[1]),
31
+ b: Math.floor(a.lab[2])
32
32
  },
33
33
  oklab: {
34
- l: parseFloat(o.oklab[0].toFixed(3)),
35
- a: parseFloat(o.oklab[1].toFixed(3)),
36
- b: parseFloat(o.oklab[2].toFixed(3))
34
+ l: parseFloat(a.oklab[0].toFixed(3)),
35
+ a: parseFloat(a.oklab[1].toFixed(3)),
36
+ b: parseFloat(a.oklab[2].toFixed(3))
37
37
  },
38
38
  hsl: {
39
- h: Math.floor(o.hsl[0]),
40
- s: Math.floor(o.hsl[1] * 100),
41
- l: Math.floor(o.hsl[2] * 100)
39
+ h: Math.floor(a.hsl[0]),
40
+ s: Math.floor(a.hsl[1] * 100),
41
+ l: Math.floor(a.hsl[2] * 100)
42
42
  },
43
43
  hsluv: {
44
- h: Math.floor(o.hsluv[0]),
45
- s: Math.floor(o.hsluv[1]),
46
- l: Math.floor(o.hsluv[2])
44
+ h: Math.floor(a.hsluv[0]),
45
+ s: Math.floor(a.hsluv[1]),
46
+ l: Math.floor(a.hsluv[2])
47
47
  },
48
- hex: o.hex,
49
- description: o.description,
48
+ hex: a.hex,
49
+ description: a.description,
50
50
  type: "color shade/tint"
51
- }), h = (o, e) => ({
51
+ }), h = (a, e) => ({
52
52
  rgb: {
53
53
  r: Math.floor(e.rgb[0]),
54
54
  g: Math.floor(e.rgb[1]),
@@ -90,26 +90,26 @@ const S = (c) => {
90
90
  l: Math.floor(e.hsluv[2])
91
91
  },
92
92
  hex: e.hex,
93
- alpha: o.alpha,
94
- description: o.description,
93
+ alpha: a.alpha,
94
+ description: a.description,
95
95
  type: "color shade/tint"
96
96
  });
97
- return r[0].type === "custom theme" ? r.forEach((o) => {
98
- s[o.name] = {}, o.colors.forEach((e) => {
97
+ return r[0].type === "custom theme" ? r.forEach((a) => {
98
+ s[a.name] = {}, a.colors.forEach((e) => {
99
99
  const t = e.shades.find(
100
100
  (l) => l.type === "source color"
101
101
  );
102
- s[o.name][e.name] = {}, e.shades.forEach((l) => {
103
- l && t && (s[o.name][e.name][l.name] = l.isTransparent ? h(l, t) : a(l));
104
- }), s[o.name][e.name].description = e.description, s[o.name][e.name].type = "color";
105
- }), s[o.name].description = o.description, s[o.name].type = "color mode";
106
- }) : r.forEach((o) => {
107
- o.colors.forEach((e) => {
102
+ s[a.name][e.name] = {}, e.shades.forEach((l) => {
103
+ l && t && (s[a.name][e.name][l.name] = l.isTransparent ? h(l, t) : o(l));
104
+ }), s[a.name][e.name].description = e.description, s[a.name][e.name].type = "color";
105
+ }), s[a.name].description = a.description, s[a.name].type = "color mode";
106
+ }) : r.forEach((a) => {
107
+ a.colors.forEach((e) => {
108
108
  const t = e.shades.find(
109
109
  (l) => l.type === "source color"
110
110
  );
111
111
  s[e.name] = {}, e.shades.forEach((l) => {
112
- l && t && (s[e.name][l.name] = l.isTransparent ? h(l, t) : a(l));
112
+ l && t && (s[e.name][l.name] = l.isTransparent ? h(l, t) : o(l));
113
113
  }), s[e.name].description = e.description, s[e.name].type = "color";
114
114
  });
115
115
  }), s.description = c.description, s.type = "color palette", JSON.stringify(s, null, " ");
@@ -121,18 +121,18 @@ class f {
121
121
  }
122
122
  }
123
123
  const T = (c) => {
124
- const r = c.themes.filter((a) => a.type === "custom theme").length === 0 ? c.themes.filter((a) => a.type === "default theme") : c.themes.filter((a) => a.type === "custom theme"), s = [];
125
- return r.forEach((a) => {
124
+ const r = c.themes.filter((o) => o.type === "custom theme").length === 0 ? c.themes.filter((o) => o.type === "default theme") : c.themes.filter((o) => o.type === "custom theme"), s = [];
125
+ return r.forEach((o) => {
126
126
  const h = [];
127
- a.colors.forEach((o) => {
128
- const e = o.shades.find((t) => t.type === "source color");
129
- h.push(`// ${o.name}`), o.shades.reverse().forEach((t) => {
127
+ o.colors.forEach((a) => {
128
+ const e = a.shades.find((t) => t.type === "source color");
129
+ h.push(`// ${a.name}`), a.shades.reverse().forEach((t) => {
130
130
  h.push(
131
- t.isTransparent ? `static let ${new f(o.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = UIColor(red: ${e == null ? void 0 : e.gl[0].toFixed(
131
+ t.isTransparent ? `static let ${new f(a.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = UIColor(red: ${e == null ? void 0 : e.gl[0].toFixed(
132
132
  3
133
133
  )}, green: ${e == null ? void 0 : e.gl[1].toFixed(3)}, blue: ${e == null ? void 0 : e.gl[2].toFixed(
134
134
  3
135
- )}, alpha: ${t.alpha ?? 1})` : `static let ${new f(o.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = UIColor(red: ${t.gl[0].toFixed(
135
+ )}, alpha: ${t.alpha ?? 1})` : `static let ${new f(a.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = UIColor(red: ${t.gl[0].toFixed(
136
136
  3
137
137
  )}, green: ${t.gl[1].toFixed(3)}, blue: ${t.gl[2].toFixed(
138
138
  3
@@ -140,7 +140,7 @@ const T = (c) => {
140
140
  );
141
141
  }), h.push("");
142
142
  }), h.pop(), r[0].type === "custom theme" ? s.push(
143
- `struct ${new f(a.name).doPascalCase()} {
143
+ `struct ${new f(o.name).doPascalCase()} {
144
144
  ${h.join(
145
145
  `
146
146
  `
@@ -156,46 +156,46 @@ struct Color {
156
156
  `)}
157
157
  }`;
158
158
  }, L = (c) => {
159
- const r = c.themes.filter((a) => a.type === "custom theme").length === 0 ? c.themes.filter((a) => a.type === "default theme") : c.themes.filter((a) => a.type === "custom theme"), s = {
159
+ const r = c.themes.filter((o) => o.type === "custom theme").length === 0 ? c.themes.filter((o) => o.type === "default theme") : c.themes.filter((o) => o.type === "custom theme"), s = {
160
160
  theme: {
161
161
  colors: {}
162
162
  }
163
163
  };
164
- return c.themes[0].colors.forEach((a) => {
165
- s.theme.colors[new f(a.name).doKebabCase()] = {};
166
- }), r[0].type === "custom theme" ? r.forEach((a) => {
167
- a.colors.forEach((h) => {
168
- const o = h.shades.find(
164
+ return c.themes[0].colors.forEach((o) => {
165
+ s.theme.colors[new f(o.name).doKebabCase()] = {};
166
+ }), r[0].type === "custom theme" ? r.forEach((o) => {
167
+ o.colors.forEach((h) => {
168
+ const a = h.shades.find(
169
169
  (e) => e.type === "source color"
170
170
  );
171
- s.theme.colors[new f(h.name).doKebabCase()][new f(a.name).doKebabCase()] = {}, h.shades.forEach((e) => {
172
- s.theme.colors[new f(h.name).doKebabCase()][new f(a.name).doKebabCase()][new f(e.name).doKebabCase()] = e.isTransparent ? p((o == null ? void 0 : o.hex) ?? "#000000").alpha(e.alpha ?? 1).hex() : e.hex;
171
+ s.theme.colors[new f(h.name).doKebabCase()][new f(o.name).doKebabCase()] = {}, h.shades.forEach((e) => {
172
+ s.theme.colors[new f(h.name).doKebabCase()][new f(o.name).doKebabCase()][new f(e.name).doKebabCase()] = e.isTransparent ? p((a == null ? void 0 : a.hex) ?? "#000000").alpha(e.alpha ?? 1).hex() : e.hex;
173
173
  });
174
174
  });
175
- }) : r.forEach((a) => {
176
- a.colors.forEach((h) => {
177
- const o = h.shades.find(
175
+ }) : r.forEach((o) => {
176
+ o.colors.forEach((h) => {
177
+ const a = h.shades.find(
178
178
  (e) => e.type === "source color"
179
179
  );
180
180
  s.theme.colors[new f(h.name).doKebabCase()] = {}, h.shades.sort().forEach((e) => {
181
- s.theme.colors[new f(h.name).doKebabCase()][new f(e.name).doKebabCase()] = e.isTransparent ? p((o == null ? void 0 : o.hex) ?? "#000000").alpha(e.alpha ?? 1).hex() : e.hex;
181
+ s.theme.colors[new f(h.name).doKebabCase()][new f(e.name).doKebabCase()] = e.isTransparent ? p((a == null ? void 0 : a.hex) ?? "#000000").alpha(e.alpha ?? 1).hex() : e.hex;
182
182
  });
183
183
  });
184
184
  }), s;
185
- }, H = (c) => {
186
- const r = c.themes.filter((a) => a.type === "custom theme").length === 0 ? c.themes.filter((a) => a.type === "default theme") : c.themes.filter((a) => a.type === "custom theme"), s = [];
187
- return r.forEach((a) => {
188
- a.colors.forEach((h) => {
189
- const o = h.shades.find((t) => t.type === "source color"), e = [];
185
+ }, N = (c) => {
186
+ const r = c.themes.filter((o) => o.type === "custom theme").length === 0 ? c.themes.filter((o) => o.type === "default theme") : c.themes.filter((o) => o.type === "custom theme"), s = [];
187
+ return r.forEach((o) => {
188
+ o.colors.forEach((h) => {
189
+ const a = h.shades.find((t) => t.type === "source color"), e = [];
190
190
  e.push(
191
- `// ${r[0].type === "custom theme" ? a.name + " - " : ""}${h.name}`
191
+ `// ${r[0].type === "custom theme" ? o.name + " - " : ""}${h.name}`
192
192
  ), h.shades.reverse().forEach((t) => {
193
193
  e.push(
194
- t.isTransparent ? `public let ${r[0].type === "custom theme" ? new f(a.name + " " + h.name).doPascalCase() : new f(h.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = Color(red: ${o == null ? void 0 : o.gl[0].toFixed(
194
+ t.isTransparent ? `public let ${r[0].type === "custom theme" ? new f(o.name + " " + h.name).doPascalCase() : new f(h.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = Color(red: ${a == null ? void 0 : a.gl[0].toFixed(
195
195
  3
196
- )}, green: ${o == null ? void 0 : o.gl[1].toFixed(3)}, blue: ${t.gl[2].toFixed(
196
+ )}, green: ${a == null ? void 0 : a.gl[1].toFixed(3)}, blue: ${t.gl[2].toFixed(
197
197
  3
198
- )}).opacity(${t.alpha ?? 1})` : `public let ${r[0].type === "custom theme" ? new f(a.name + " " + h.name).doPascalCase() : new f(h.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = Color(red: ${t.gl[0].toFixed(
198
+ )}).opacity(${t.alpha ?? 1})` : `public let ${r[0].type === "custom theme" ? new f(o.name + " " + h.name).doPascalCase() : new f(h.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = Color(red: ${t.gl[0].toFixed(
199
199
  3
200
200
  )}, green: ${t.gl[1].toFixed(3)}, blue: ${t.gl[2].toFixed(
201
201
  3
@@ -214,42 +214,43 @@ public extension Color {
214
214
  )}
215
215
  }
216
216
  }`;
217
- }, P = (c) => {
217
+ }, H = (c) => {
218
218
  const r = c.themes.filter((h) => h.type === "custom theme").length === 0 ? c.themes.filter((h) => h.type === "default theme") : c.themes.filter((h) => h.type === "custom theme"), s = {
219
219
  color: {}
220
- }, a = (h, o, e) => ({
220
+ }, o = (h, a, e) => ({
221
221
  type: "color",
222
- value: o.isTransparent ? p(e.hex).alpha(o.alpha ?? 1).hex() : o.hex,
223
- comment: h.description !== "" ? h.description + " - " + o.description : o.description
222
+ value: a.isTransparent ? p(e.hex).alpha(a.alpha ?? 1).hex() : a.hex,
223
+ comment: h.description !== "" ? h.description + " - " + a.description : a.description
224
224
  });
225
225
  return c.themes[0].colors.forEach((h) => {
226
226
  s.color[h.name] = {};
227
227
  }), r[0].type === "custom theme" ? r.forEach((h) => {
228
- h.colors.forEach((o) => {
229
- const e = o.shades.find(
228
+ h.colors.forEach((a) => {
229
+ const e = a.shades.find(
230
230
  (t) => t.type === "source color"
231
231
  );
232
- s.color[o.name][h.name] = {}, o.shades.forEach((t) => {
233
- t && e && (s.color[o.name][h.name][t.name] = a(
234
- o,
232
+ s.color[a.name][h.name] = {}, a.shades.forEach((t) => {
233
+ t && e && (s.color[a.name][h.name][t.name] = o(
234
+ a,
235
235
  t,
236
236
  e
237
237
  ));
238
238
  });
239
239
  });
240
240
  }) : r.forEach((h) => {
241
- h.colors.forEach((o) => {
242
- const e = o.shades.find(
241
+ h.colors.forEach((a) => {
242
+ const e = a.shades.find(
243
243
  (t) => t.type === "source color"
244
244
  );
245
- s.color[o.name] = {}, o.shades.forEach((t) => {
246
- t && e && (s.color[o.name][t.name] = a(o, t, e));
245
+ s.color[a.name] = {}, a.shades.forEach((t) => {
246
+ t && e && (s.color[a.name][t.name] = o(a, t, e));
247
247
  });
248
248
  });
249
249
  }), JSON.stringify(s, null, " ");
250
- }, A = (c, r) => {
251
- const s = c.themes.filter((e) => e.type === "custom theme").length === 0 ? c.themes.filter((e) => e.type === "default theme") : c.themes.filter((e) => e.type === "custom theme"), a = [], h = (e) => {
250
+ }, P = (c, r) => {
251
+ const s = c.themes.filter((e) => e.type === "custom theme").length === 0 ? c.themes.filter((e) => e.type === "default theme") : c.themes.filter((e) => e.type === "custom theme"), o = [], h = (e) => {
252
252
  var l;
253
+ isNaN(e.hsl[0]) && (e.hsl[0] = 0), isNaN(e.lch[2]) && (e.lch[2] = 0);
253
254
  const t = {
254
255
  RGB: () => `rgb(${Math.floor(e.rgb[0])}, ${Math.floor(
255
256
  e.rgb[1]
@@ -266,58 +267,58 @@ public extension Color {
266
267
  )}, ${e.gl[2].toFixed(3)})`
267
268
  };
268
269
  return (l = t[r ?? "RGB"]) == null ? void 0 : l.call(t);
269
- }, o = (e, t) => {
270
- var n;
270
+ }, a = (e, t) => {
271
+ var i;
271
272
  const l = {
272
273
  RGB: () => {
273
- var i;
274
+ var n;
274
275
  return `rgba(${Math.floor(t.rgb[0])}, ${Math.floor(
275
276
  t.rgb[1]
276
- )}, ${Math.floor(t.rgb[2])}, ${((i = e.alpha) == null ? void 0 : i.toFixed(2)) ?? 1})`;
277
+ )}, ${Math.floor(t.rgb[2])}, ${((n = e.alpha) == null ? void 0 : n.toFixed(2)) ?? 1})`;
277
278
  },
278
279
  HEX: () => p(t.hex).alpha(e.alpha ?? 1).hex(),
279
280
  HSL: () => {
280
- var i;
281
+ var n;
281
282
  return `hsla(${Math.floor(t.hsl[0])}, ${Math.floor(
282
283
  t.hsl[1] * 100
283
- )}%, ${Math.floor(t.hsl[2] * 100)}%, ${((i = e.alpha) == null ? void 0 : i.toFixed(2)) ?? 1})`;
284
+ )}%, ${Math.floor(t.hsl[2] * 100)}%, ${((n = e.alpha) == null ? void 0 : n.toFixed(2)) ?? 1})`;
284
285
  },
285
286
  LCH: () => {
286
- var i;
287
+ var n;
287
288
  return `lch(${Math.floor(t.lch[0])}% ${Math.floor(
288
289
  t.lch[1]
289
- )} ${Math.floor(t.lch[2])} / ${((i = e.alpha) == null ? void 0 : i.toFixed(2)) ?? 1})`;
290
+ )} ${Math.floor(t.lch[2])} / ${((n = e.alpha) == null ? void 0 : n.toFixed(2)) ?? 1})`;
290
291
  },
291
292
  P3: () => {
292
- var i;
293
+ var n;
293
294
  return `color(display-p3 ${t.gl[0].toFixed(3)}, ${t.gl[1].toFixed(
294
295
  3
295
- )}, ${t.gl[2].toFixed(3)}, ${((i = e.alpha) == null ? void 0 : i.toFixed(2)) ?? 1})`;
296
+ )}, ${t.gl[2].toFixed(3)}, ${((n = e.alpha) == null ? void 0 : n.toFixed(2)) ?? 1})`;
296
297
  }
297
298
  };
298
- return (n = l[r ?? "RGB"]) == null ? void 0 : n.call(l);
299
+ return (i = l[r ?? "RGB"]) == null ? void 0 : i.call(l);
299
300
  };
300
301
  return s.forEach((e) => {
301
302
  const t = [];
302
303
  e.type === "custom theme" && (t.push(`// ${e.name} mode`), t.push(`@mixin ${new f(e.name).doCamelCase()}-mode {`)), e.colors.forEach((l) => {
303
- t.push(`// ${l.name}`), l.shades.reverse().forEach((n) => {
304
- const i = l.shades.find((u) => u.type === "source color"), m = `$${new f(l.name).doKebabCase()}-${n.name}`;
305
- i && (e.type === "custom theme" ? t.push(
306
- ` ${m}: ${n.isTransparent ? o(n, i) : h(n)};`
304
+ t.push(`// ${l.name}`), l.shades.reverse().forEach((i) => {
305
+ const n = l.shades.find((b) => b.type === "source color"), m = `$${new f(l.name).doKebabCase()}-${i.name}`;
306
+ n && (e.type === "custom theme" ? t.push(
307
+ ` ${m}: ${i.isTransparent ? a(i, n) : h(i)};`
307
308
  ) : t.push(
308
- `${m}: ${n.isTransparent ? o(n, i) : h(n)};`
309
+ `${m}: ${i.isTransparent ? a(i, n) : h(i)};`
309
310
  ));
310
311
  }), t.push("");
311
- }), e.type === "custom theme" && t.push("}"), a.push(t.join(`
312
+ }), e.type === "custom theme" && t.push("}"), o.push(t.join(`
312
313
  `));
313
- }), a.push(`
314
+ }), o.push(`
314
315
  // Color modes map
315
316
  $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
316
- const n = new f(e.name).doKebabCase();
317
- a.push(
318
- ` '${n}': ${new f(e.name).doCamelCase()}-mode${t < l.length - 1 ? "," : ""}`
317
+ const i = new f(e.name).doKebabCase();
318
+ o.push(
319
+ ` '${i}': ${new f(e.name).doCamelCase()}-mode${t < l.length - 1 ? "," : ""}`
319
320
  );
320
- }), a.push(`);
321
+ }), o.push(`);
321
322
 
322
323
  // Mode application mixin
323
324
  @mixin with-color-mode() {
@@ -329,19 +330,19 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
329
330
  @content($mode);
330
331
  }
331
332
  }
332
- }`), a.join(`
333
+ }`), o.join(`
333
334
 
334
335
  `);
335
- }, R = (c) => {
336
- const r = c.themes.filter((a) => a.type === "custom theme").length === 0 ? c.themes.filter((a) => a.type === "default theme") : c.themes.filter((a) => a.type === "custom theme"), s = [];
337
- return r.forEach((a) => {
338
- a.colors.forEach((h) => {
339
- const o = h.shades.find((t) => t.type === "source color"), e = [];
336
+ }, A = (c) => {
337
+ const r = c.themes.filter((o) => o.type === "custom theme").length === 0 ? c.themes.filter((o) => o.type === "default theme") : c.themes.filter((o) => o.type === "custom theme"), s = [];
338
+ return r.forEach((o) => {
339
+ o.colors.forEach((h) => {
340
+ const a = h.shades.find((t) => t.type === "source color"), e = [];
340
341
  e.push(
341
- `<!--${r[0].type === "custom theme" ? `${a.name} - ${h.name}-->` : `${h.name}-->`}`
342
+ `<!--${r[0].type === "custom theme" ? `${o.name} - ${h.name}-->` : `${h.name}-->`}`
342
343
  ), h.shades.reverse().forEach((t) => {
343
344
  e.push(
344
- `<color name="${r[0].type === "custom theme" ? new f(a.name + " " + h.name).doSnakeCase() : new f(h.name).doSnakeCase()}_${t.name}">${t.isTransparent ? p((o == null ? void 0 : o.hex) ?? "#000000").alpha(t.alpha ?? 1).hex() : t.hex}</color>`
345
+ `<color name="${r[0].type === "custom theme" ? new f(o.name + " " + h.name).doSnakeCase() : new f(h.name).doSnakeCase()}_${t.name}">${t.isTransparent ? p((a == null ? void 0 : a.hex) ?? "#000000").alpha(t.alpha ?? 1).hex() : t.hex}</color>`
345
346
  );
346
347
  }), e.push(""), e.forEach((t) => s.push(t));
347
348
  });
@@ -352,39 +353,39 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
352
353
  `
353
354
  )}
354
355
  </resources>`;
355
- }, B = (c) => {
356
- const r = c.themes.filter((o) => o.type === "custom theme").length === 0 ? c.themes.filter((o) => o.type === "default theme") : c.themes.filter((o) => o.type === "custom theme"), s = {
356
+ }, R = (c) => {
357
+ const r = c.themes.filter((a) => a.type === "custom theme").length === 0 ? c.themes.filter((a) => a.type === "default theme") : c.themes.filter((a) => a.type === "custom theme"), s = {
357
358
  $themes: [],
358
359
  $metadata: {
359
360
  activeThemes: [],
360
361
  tokenSetOrder: [],
361
362
  activeSets: []
362
363
  }
363
- }, a = c.name, h = (o, e, t) => ({
364
+ }, o = c.name, h = (a, e, t) => ({
364
365
  $type: "color",
365
366
  $value: e.isTransparent ? p(t.hex).alpha(e.alpha ?? 1).hex() : e.hex,
366
- $description: o.description !== "" ? o.description + " - " + e.description : e.description
367
+ $description: a.description !== "" ? a.description + " - " + e.description : e.description
367
368
  });
368
- return r[0].type === "custom theme" ? r.forEach((o) => {
369
- o.colors.forEach((e) => {
369
+ return r[0].type === "custom theme" ? r.forEach((a) => {
370
+ a.colors.forEach((e) => {
370
371
  const t = e.shades.find(
371
372
  (l) => l.type === "source color"
372
373
  );
373
- s[`${o.name}/${e.name}`] = {}, e.shades.forEach((l) => {
374
- l && t && (s[`${o.name}/${e.name}`][l.name] = h(
374
+ s[`${a.name}/${e.name}`] = {}, e.shades.forEach((l) => {
375
+ l && t && (s[`${a.name}/${e.name}`][l.name] = h(
375
376
  e,
376
377
  l,
377
378
  t
378
379
  ));
379
380
  });
380
381
  });
381
- }) : r.forEach((o) => {
382
- o.colors.forEach((e) => {
382
+ }) : r.forEach((a) => {
383
+ a.colors.forEach((e) => {
383
384
  const t = e.shades.find(
384
385
  (l) => l.type === "source color"
385
386
  );
386
- s[`${a}/${e.name}`] = {}, e.shades.forEach((l) => {
387
- l && t && (s[`${a}/${e.name}`][l.name] = h(
387
+ s[`${o}/${e.name}`] = {}, e.shades.forEach((l) => {
388
+ l && t && (s[`${o}/${e.name}`][l.name] = h(
388
389
  e,
389
390
  l,
390
391
  t
@@ -392,9 +393,10 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
392
393
  });
393
394
  });
394
395
  }), JSON.stringify(s, null, " ");
395
- }, K = (c, r) => {
396
- const s = c.themes.filter((t) => t.type === "custom theme").length === 0 ? c.themes.filter((t) => t.type === "default theme") : c.themes.filter((t) => t.type === "custom theme"), a = [], h = (t) => {
397
- var n;
396
+ }, B = (c, r) => {
397
+ const s = c.themes.filter((t) => t.type === "custom theme").length === 0 ? c.themes.filter((t) => t.type === "default theme") : c.themes.filter((t) => t.type === "custom theme"), o = [], h = (t) => {
398
+ var i;
399
+ isNaN(t.hsl[0]) && (t.hsl[0] = 0), isNaN(t.lch[2]) && (t.lch[2] = 0);
398
400
  const l = {
399
401
  RGB: () => `rgb(${Math.floor(t.rgb[0])}, ${Math.floor(
400
402
  t.rgb[1]
@@ -410,10 +412,10 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
410
412
  3
411
413
  )}, ${t.gl[2].toFixed(3)})`
412
414
  };
413
- return (n = l[r ?? "RGB"]) == null ? void 0 : n.call(l);
414
- }, o = (t, l) => {
415
- var i;
416
- const n = {
415
+ return (i = l[r ?? "RGB"]) == null ? void 0 : i.call(l);
416
+ }, a = (t, l) => {
417
+ var n;
418
+ const i = {
417
419
  RGB: () => {
418
420
  var m;
419
421
  return `rgba(${Math.floor(l.rgb[0])}, ${Math.floor(
@@ -440,51 +442,51 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
440
442
  )}, ${l.gl[2].toFixed(3)}, ${((m = t.alpha) == null ? void 0 : m.toFixed(2)) ?? 1})`;
441
443
  }
442
444
  };
443
- return (i = n[r ?? "RGB"]) == null ? void 0 : i.call(n);
445
+ return (n = i[r ?? "RGB"]) == null ? void 0 : n.call(i);
444
446
  }, e = s.find(
445
447
  (t) => t.type === "default theme"
446
448
  );
447
449
  if (e) {
448
450
  const t = [];
449
451
  e.colors.forEach((l) => {
450
- t.push(`// ${l.name}`), l.shades.reverse().forEach((n) => {
451
- const i = l.shades.find((u) => u.type === "source color"), m = `@${new f(l.name).doKebabCase()}-${n.name}`;
452
- i && t.push(
453
- `${m}: ${n.isTransparent ? o(n, i) : h(n)};`
452
+ t.push(`// ${l.name}`), l.shades.reverse().forEach((i) => {
453
+ const n = l.shades.find((b) => b.type === "source color"), m = `@${new f(l.name).doKebabCase()}-${i.name}`;
454
+ n && t.push(
455
+ `${m}: ${i.isTransparent ? a(i, n) : h(i)};`
454
456
  );
455
457
  }), t.push("");
456
- }), a.push(t.join(`
458
+ }), o.push(t.join(`
457
459
  `));
458
460
  }
459
461
  return s.filter((t) => t.type === "custom theme").forEach((t) => {
460
462
  const l = new f(t.name).doKebabCase();
461
- a.push(`
463
+ o.push(`
462
464
  // ${t.name} mode
463
465
  #${l} {
464
466
  .mode() {`);
465
- const n = [];
466
- t.colors.forEach((i) => {
467
- n.push(` // ${i.name}`), i.shades.reverse().forEach((m) => {
468
- const u = i.shades.find((d) => d.type === "source color"), x = `@${new f(i.name).doKebabCase()}-${m.name}`;
469
- u && n.push(
470
- ` ${x}: ${m.isTransparent ? o(m, u) : h(m)};`
467
+ const i = [];
468
+ t.colors.forEach((n) => {
469
+ i.push(` // ${n.name}`), n.shades.reverse().forEach((m) => {
470
+ const b = n.shades.find(($) => $.type === "source color"), x = `@${new f(n.name).doKebabCase()}-${m.name}`;
471
+ b && i.push(
472
+ ` ${x}: ${m.isTransparent ? a(m, b) : h(m)};`
471
473
  );
472
- }), n.push("");
473
- }), n.length > 0 && n.pop(), a.push(n.join(`
474
- `)), a.push(` }
474
+ }), i.push("");
475
+ }), i.length > 0 && i.pop(), o.push(i.join(`
476
+ `)), o.push(` }
475
477
  }`);
476
- }), a.push(`
478
+ }), o.push(`
477
479
  // Mode application
478
480
  .apply-mode(@mode) {
479
481
  & when (@mode = default) {
480
482
  // Default mode variables are already available
481
483
  }`), s.filter((t) => t.type === "custom theme").forEach((t) => {
482
484
  const l = new f(t.name).doKebabCase();
483
- a.push(`
485
+ o.push(`
484
486
  & when (@mode = ${l}) {
485
487
  #${l} > .mode();
486
488
  }`);
487
- }), a.push(`}
489
+ }), o.push(`}
488
490
 
489
491
  // Mode application via HTML attribute
490
492
  .with-mode(@selector) {
@@ -501,12 +503,13 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
501
503
  }).join(`
502
504
 
503
505
  `)}
504
- }`), a.join(`
506
+ }`), o.join(`
505
507
 
506
508
  `);
507
- }, N = (c, r) => {
508
- const s = c.themes.filter((e) => e.type === "custom theme").length === 0 ? c.themes.filter((e) => e.type === "default theme") : c.themes.filter((e) => e.type === "custom theme"), a = {}, h = (e) => {
509
+ }, K = (c, r) => {
510
+ const s = c.themes.filter((e) => e.type === "custom theme").length === 0 ? c.themes.filter((e) => e.type === "default theme") : c.themes.filter((e) => e.type === "custom theme"), o = {}, h = (e) => {
509
511
  var l;
512
+ isNaN(e.oklch[2]) && (e.oklch[2] = 0);
510
513
  const t = {
511
514
  RGB: () => ({
512
515
  colorSpace: "srgb",
@@ -528,8 +531,8 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
528
531
  })
529
532
  };
530
533
  return (l = t[r ?? "RGB"]) == null ? void 0 : l.call(t);
531
- }, o = (e, t) => {
532
- var n;
534
+ }, a = (e, t) => {
535
+ var i;
533
536
  const l = {
534
537
  RGB: () => ({
535
538
  colorSpace: "srgb",
@@ -552,43 +555,62 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
552
555
  alpha: t.alpha
553
556
  })
554
557
  };
555
- return (n = l[r ?? "RGB"]) == null ? void 0 : n.call(l);
558
+ return (i = l[r ?? "RGB"]) == null ? void 0 : i.call(l);
556
559
  };
557
560
  return s[0].type === "custom theme" ? s.forEach((e) => {
558
561
  e.colors.forEach((t) => {
559
562
  const l = t.shades.find(
560
- (n) => n.type === "source color"
563
+ (i) => i.type === "source color"
561
564
  );
562
- a[t.name] || (a[t.name] = {
565
+ o[t.name] || (o[t.name] = {
563
566
  $type: "color"
564
- }), t.shades.forEach((n) => {
565
- !a[t.name][n.name] && l && (a[t.name][n.name] = {
567
+ }), t.shades.forEach((i) => {
568
+ !o[t.name][i.name] && l && (o[t.name][i.name] = {
566
569
  $type: "color",
567
- $value: n.isTransparent ? o(l, n) : h(n),
568
- $description: t.description !== "" ? t.description + " - " + n.description : n.description,
570
+ $value: i.isTransparent ? a(l, i) : h(i),
571
+ $description: t.description !== "" ? t.description + " - " + i.description : i.description,
569
572
  $extensions: {
570
573
  mode: {}
571
574
  }
572
- }), l && (a[t.name][n.name].$extensions.mode[e.name] = n.isTransparent ? o(l, n) : h(n));
575
+ }), l && (o[t.name][i.name].$extensions.mode[e.name] = i.isTransparent ? a(l, i) : h(i));
573
576
  });
574
577
  });
575
578
  }) : s.forEach((e) => {
576
579
  e.colors.forEach((t) => {
577
580
  const l = t.shades.find(
578
- (n) => n.type === "source color"
581
+ (i) => i.type === "source color"
579
582
  );
580
- a[t.name] = {}, t.shades.forEach((n) => {
581
- n && l && (a[t.name][n.name] = {
583
+ o[t.name] = {}, t.shades.forEach((i) => {
584
+ i && l && (o[t.name][i.name] = {
582
585
  $type: "color",
583
- $value: n.isTransparent ? o(l, n) : h(n),
584
- $description: t.description !== "" ? t.description + " - " + n.description : n.description
586
+ $value: i.isTransparent ? a(l, i) : h(i),
587
+ $description: t.description !== "" ? t.description + " - " + i.description : i.description
585
588
  });
586
589
  });
587
590
  });
588
- }), JSON.stringify(a, null, " ");
589
- }, j = (c, r) => {
590
- const s = c.themes.filter((e) => e.type === "custom theme").length === 0 ? c.themes.filter((e) => e.type === "default theme") : c.themes.filter((e) => e.type === "custom theme"), a = [], h = (e) => {
591
+ }), JSON.stringify(o, null, " ");
592
+ }, j = (c) => {
593
+ const r = c.themes.filter((l) => l.type === "custom theme").length === 0 ? c.themes.filter((l) => l.type === "default theme") : c.themes.filter((l) => l.type === "custom theme"), s = [], o = [], h = [], a = [], e = [], t = [];
594
+ return r.forEach((l) => {
595
+ l.colors.forEach((i) => {
596
+ i.shades.forEach((n) => {
597
+ h.push(n.name), a.push(Math.floor(n.lch[0])), e.push(Math.floor(n.lch[1])), t.push(Math.floor(n.lch[2]));
598
+ }), s.push({
599
+ name: i.name,
600
+ csv: `${i.name},Lightness,Chroma,Hue
601
+ ${h.map((n, m) => `${n},${a[m]},${e[m]},${t[m]}`).join(`
602
+ `)}`
603
+ }), h.splice(0, h.length), a.splice(0, a.length), e.splice(0, e.length), t.splice(0, t.length);
604
+ }), o.push({
605
+ name: l.name,
606
+ colors: s.map((i) => i),
607
+ type: l.type
608
+ }), s.splice(0, s.length);
609
+ }), o;
610
+ }, G = (c, r) => {
611
+ const s = c.themes.filter((e) => e.type === "custom theme").length === 0 ? c.themes.filter((e) => e.type === "default theme") : c.themes.filter((e) => e.type === "custom theme"), o = [], h = (e) => {
591
612
  var l;
613
+ isNaN(e.hsl[0]) && (e.hsl[0] = 0), isNaN(e.lch[2]) && (e.lch[2] = 0);
592
614
  const t = {
593
615
  RGB: () => `rgb(${Math.floor(e.rgb[0])}, ${Math.floor(
594
616
  e.rgb[1]
@@ -597,73 +619,73 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
597
619
  HSL: () => `hsl(${Math.floor(e.hsl[0])} ${Math.floor(
598
620
  e.hsl[1] * 100
599
621
  )}% ${Math.floor(e.hsl[2] * 100)}%)`,
600
- LCH: () => `lch(${Math.floor(e.lch[0])}% ${Math.floor(
622
+ LCH: () => (e.lch[2] === null && (e.lch[2] = 0), `lch(${Math.floor(e.lch[0])}% ${Math.floor(
601
623
  e.lch[1]
602
- )} ${Math.floor(e.lch[2])})`,
624
+ )} ${Math.floor(e.lch[2])})`),
603
625
  P3: () => `color(display-p3 ${e.gl[0].toFixed(3)} ${e.gl[1].toFixed(
604
626
  3
605
627
  )} ${e.gl[2].toFixed(3)})`
606
628
  };
607
629
  return (l = t[r ?? "RGB"]) == null ? void 0 : l.call(t);
608
- }, o = (e, t) => {
609
- var n;
630
+ }, a = (e, t) => {
631
+ var i;
610
632
  const l = {
611
633
  RGB: () => {
612
- var i;
634
+ var n;
613
635
  return `rgb(${Math.floor(t.rgb[0])}, ${Math.floor(
614
636
  t.rgb[1]
615
- )}, ${Math.floor(t.rgb[2])} / ${((i = e.alpha) == null ? void 0 : i.toFixed(2)) ?? 1})`;
637
+ )}, ${Math.floor(t.rgb[2])} / ${((n = e.alpha) == null ? void 0 : n.toFixed(2)) ?? 1})`;
616
638
  },
617
639
  HEX: () => p(t.hex).alpha(e.alpha ?? 1).hex(),
618
640
  HSL: () => {
619
- var i;
641
+ var n;
620
642
  return `hsl(${Math.floor(t.hsl[0])} ${Math.floor(
621
643
  t.hsl[1] * 100
622
- )}% ${Math.floor(t.hsl[2] * 100)}% / ${((i = e.alpha) == null ? void 0 : i.toFixed(2)) ?? 1})`;
644
+ )}% ${Math.floor(t.hsl[2] * 100)}% / ${((n = e.alpha) == null ? void 0 : n.toFixed(2)) ?? 1})`;
623
645
  },
624
646
  LCH: () => {
625
- var i;
647
+ var n;
626
648
  return `lch(${Math.floor(t.lch[0])}% ${Math.floor(
627
649
  t.lch[1]
628
- )} ${Math.floor(t.lch[2])} / ${((i = e.alpha) == null ? void 0 : i.toFixed(2)) ?? 1})`;
650
+ )} ${Math.floor(t.lch[2])} / ${((n = e.alpha) == null ? void 0 : n.toFixed(2)) ?? 1})`;
629
651
  },
630
652
  P3: () => {
631
- var i;
653
+ var n;
632
654
  return `color(display-p3 ${t.gl[0].toFixed(3)} ${t.gl[1].toFixed(
633
655
  3
634
- )} ${t.gl[2].toFixed(3)} / ${((i = e.alpha) == null ? void 0 : i.toFixed(2)) ?? 1})`;
656
+ )} ${t.gl[2].toFixed(3)} / ${((n = e.alpha) == null ? void 0 : n.toFixed(2)) ?? 1})`;
635
657
  }
636
658
  };
637
- return (n = l[r ?? "RGB"]) == null ? void 0 : n.call(l);
659
+ return (i = l[r ?? "RGB"]) == null ? void 0 : i.call(l);
638
660
  };
639
661
  return s.forEach((e) => {
640
662
  const t = [];
641
663
  e.colors.forEach((l) => {
642
- t.push(`/* ${l.name} */`), l.shades.reverse().forEach((n) => {
643
- const i = l.shades.find((m) => m.type === "source color");
644
- i && t.push(
645
- `--${new f(l.name).doKebabCase()}-${n.name}: ${n.isTransparent ? o(n, i) : h(n)};`
664
+ t.push(`/* ${l.name} */`), l.shades.reverse().forEach((i) => {
665
+ const n = l.shades.find((m) => m.type === "source color");
666
+ n && t.push(
667
+ `--${new f(l.name).doKebabCase()}-${i.name}: ${i.isTransparent ? a(i, n) : h(i)};`
646
668
  );
647
669
  }), t.push("");
648
- }), t.pop(), a.push(
670
+ }), t.pop(), o.push(
649
671
  `:root${e.type === "custom theme" ? `[data-theme='${new f(e.name).doKebabCase()}']` : ""} {
650
672
  ${t.join(`
651
673
  `)}
652
674
  }`
653
675
  );
654
- }), a.join(`
676
+ }), o.join(`
655
677
 
656
678
  `);
657
- }, G = (c) => {
658
- const r = c.themes.filter((a) => a.type === "custom theme").length === 0 ? c.themes.filter((a) => a.type === "default theme") : c.themes.filter((a) => a.type === "custom theme"), s = [];
659
- return r.forEach((a) => {
660
- a.colors.forEach((h) => {
661
- const o = h.shades.find((t) => t.type === "source color"), e = [];
679
+ }, _ = (c) => {
680
+ const r = c.themes.filter((o) => o.type === "custom theme").length === 0 ? c.themes.filter((o) => o.type === "default theme") : c.themes.filter((o) => o.type === "custom theme"), s = [];
681
+ return r.forEach((o) => {
682
+ o.colors.forEach((h) => {
683
+ const a = h.shades.find((t) => t.type === "source color"), e = [];
662
684
  e.push(
663
- `// ${r[0].type === "custom theme" ? a.name + " - " : ""}${h.name}`
685
+ `// ${r[0].type === "custom theme" ? o.name + " - " : ""}${h.name}`
664
686
  ), h.shades.reverse().forEach((t) => {
665
687
  e.push(
666
- `val ${r[0].type === "custom theme" ? new f(a.name + " " + h.name).doSnakeCase() : new f(h.name).doSnakeCase()}_${t.name} = Color(${t.isTransparent ? p((o == null ? void 0 : o.hex) ?? "#000000").alpha(t.alpha ?? 1).hex().replace("#", "0xFF").toUpperCase() : t.hex.replace("#", "0xFF").toUpperCase()})`
688
+ `val ${r[0].type === "custom theme" ? new f(o.name + " " + h.name).doSnakeCase() : new f(h.name).doSnakeCase()}_${t.name} = Color(${t.isTransparent ? p((a == null ? void 0 : a.hex) ?? "#000000").alpha(t.alpha ?? 1).hex().replace("#", "0xFF").toUpperCase() : t.hex.replace("#", "0xFF").toUpperCase()})`
667
689
  );
668
690
  }), e.push(""), e.forEach((t) => s.push(t));
669
691
  });
@@ -672,18 +694,18 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
672
694
  ${s.join(`
673
695
  `)}`;
674
696
  };
675
- class D {
697
+ class O {
676
698
  constructor({
677
699
  base: r,
678
700
  themes: s,
679
- meta: a
701
+ meta: o
680
702
  }) {
681
- b(this, "base");
682
- b(this, "themes");
683
- b(this, "meta");
684
- b(this, "paletteData");
685
- b(this, "currentScale");
686
- b(this, "makePaletteData", () => (this.themes.forEach((r) => {
703
+ u(this, "base");
704
+ u(this, "themes");
705
+ u(this, "meta");
706
+ u(this, "paletteData");
707
+ u(this, "currentScale");
708
+ u(this, "makePaletteData", () => (this.themes.forEach((r) => {
687
709
  const s = {
688
710
  id: r.id,
689
711
  name: r.name,
@@ -691,134 +713,134 @@ class D {
691
713
  colors: [],
692
714
  type: r.type
693
715
  };
694
- this.base.colors.forEach((a) => {
695
- const h = Object.entries(r.scale).reverse().map((i) => {
696
- if (a.alpha.isEnabled) {
697
- const m = new g({
716
+ this.base.colors.forEach((o) => {
717
+ const h = Object.entries(r.scale).reverse().map((n) => {
718
+ if (o.alpha.isEnabled) {
719
+ const m = new d({
698
720
  render: "RGB",
699
721
  sourceColor: [
700
- a.rgb.r * 255,
701
- a.rgb.g * 255,
702
- a.rgb.b * 255
722
+ o.rgb.r * 255,
723
+ o.rgb.g * 255,
724
+ o.rgb.b * 255
703
725
  ],
704
- alpha: parseFloat((i[1] / 100).toFixed(2)),
705
- hueShifting: a.hue.shift !== void 0 ? a.hue.shift : 0,
706
- chromaShifting: a.chroma.shift !== void 0 ? a.chroma.shift : 100,
726
+ alpha: parseFloat((n[1] / 100).toFixed(2)),
727
+ hueShifting: o.hue.shift !== void 0 ? o.hue.shift : 0,
728
+ chromaShifting: o.chroma.shift !== void 0 ? o.chroma.shift : 100,
707
729
  algorithmVersion: this.base.algorithmVersion,
708
730
  visionSimulationMode: r.visionSimulationMode
709
- }), u = new g({
731
+ }), b = new d({
710
732
  render: "RGB",
711
- sourceColor: p(a.alpha.backgroundColor).rgb(),
733
+ sourceColor: p(o.alpha.backgroundColor).rgb(),
712
734
  algorithmVersion: this.base.algorithmVersion,
713
735
  visionSimulationMode: r.visionSimulationMode
714
736
  });
715
737
  switch (this.base.colorSpace) {
716
738
  case "LCH":
717
739
  return this.base.areSourceColorsLocked ? [
718
- i,
740
+ n,
719
741
  m.setColorWithAlpha(),
720
- u.setColorWithAlpha()
742
+ b.setColorWithAlpha()
721
743
  ] : [
722
- i,
744
+ n,
723
745
  m.lcha(),
724
- u.lcha()
746
+ b.lcha()
725
747
  ];
726
748
  case "OKLCH":
727
749
  return this.base.areSourceColorsLocked ? [
728
- i,
750
+ n,
729
751
  m.setColorWithAlpha(),
730
- u.setColorWithAlpha()
752
+ b.setColorWithAlpha()
731
753
  ] : [
732
- i,
754
+ n,
733
755
  m.oklcha(),
734
- u.oklcha()
756
+ b.oklcha()
735
757
  ];
736
758
  case "LAB":
737
759
  return this.base.areSourceColorsLocked ? [
738
- i,
760
+ n,
739
761
  m.setColorWithAlpha(),
740
- u.setColorWithAlpha()
762
+ b.setColorWithAlpha()
741
763
  ] : [
742
- i,
764
+ n,
743
765
  m.laba(),
744
- u.laba()
766
+ b.laba()
745
767
  ];
746
768
  case "OKLAB":
747
769
  return this.base.areSourceColorsLocked ? [
748
- i,
770
+ n,
749
771
  m.setColorWithAlpha(),
750
- u.setColorWithAlpha()
772
+ b.setColorWithAlpha()
751
773
  ] : [
752
- i,
774
+ n,
753
775
  m.oklaba(),
754
- u.oklaba()
776
+ b.oklaba()
755
777
  ];
756
778
  case "HSL":
757
779
  return this.base.areSourceColorsLocked ? [
758
- i,
780
+ n,
759
781
  m.setColorWithAlpha(),
760
- u.setColorWithAlpha()
782
+ b.setColorWithAlpha()
761
783
  ] : [
762
- i,
784
+ n,
763
785
  m.hsla(),
764
- u.hsla()
786
+ b.hsla()
765
787
  ];
766
788
  case "HSLUV":
767
789
  return this.base.areSourceColorsLocked ? [
768
- i,
790
+ n,
769
791
  m.setColorWithAlpha(),
770
- u.setColorWithAlpha()
792
+ b.setColorWithAlpha()
771
793
  ] : [
772
- i,
794
+ n,
773
795
  m.hsluva(),
774
- u.hsluva()
796
+ b.hsluva()
775
797
  ];
776
798
  default:
777
- return [i, [0, 0, 0], [255, 255, 255]];
799
+ return [n, [0, 0, 0], [255, 255, 255]];
778
800
  }
779
801
  } else {
780
- const m = new g({
802
+ const m = new d({
781
803
  render: "RGB",
782
804
  sourceColor: [
783
- a.rgb.r * 255,
784
- a.rgb.g * 255,
785
- a.rgb.b * 255
805
+ o.rgb.r * 255,
806
+ o.rgb.g * 255,
807
+ o.rgb.b * 255
786
808
  ],
787
- lightness: i[1],
788
- hueShifting: a.hue.shift !== void 0 ? a.hue.shift : 0,
789
- chromaShifting: a.chroma.shift !== void 0 ? a.chroma.shift : 100,
809
+ lightness: n[1],
810
+ hueShifting: o.hue.shift !== void 0 ? o.hue.shift : 0,
811
+ chromaShifting: o.chroma.shift !== void 0 ? o.chroma.shift : 100,
790
812
  algorithmVersion: this.base.algorithmVersion,
791
813
  visionSimulationMode: r.visionSimulationMode
792
814
  });
793
815
  switch (this.base.colorSpace) {
794
816
  case "LCH":
795
- return [i, m.lch()];
817
+ return [n, m.lch()];
796
818
  case "OKLCH":
797
- return [i, m.oklch()];
819
+ return [n, m.oklch()];
798
820
  case "LAB":
799
- return [i, m.lab()];
821
+ return [n, m.lab()];
800
822
  case "OKLAB":
801
- return [i, m.oklab()];
823
+ return [n, m.oklab()];
802
824
  case "HSL":
803
- return [i, m.hsl()];
825
+ return [n, m.hsl()];
804
826
  case "HSLUV":
805
- return [i, m.hsluv()];
827
+ return [n, m.hsluv()];
806
828
  default:
807
- return [i, [0, 0, 0]];
829
+ return [n, [0, 0, 0]];
808
830
  }
809
831
  }
810
- }), o = {
811
- id: a.id,
812
- name: a.name,
813
- description: a.description,
832
+ }), a = {
833
+ id: o.id,
834
+ name: o.name,
835
+ description: o.description,
814
836
  shades: [],
815
837
  type: "color"
816
838
  }, e = [
817
- a.rgb.r * 255,
818
- a.rgb.g * 255,
819
- a.rgb.b * 255
839
+ o.rgb.r * 255,
840
+ o.rgb.g * 255,
841
+ o.rgb.b * 255
820
842
  ], t = new C();
821
- t.rgb_r = a.rgb.r, t.rgb_g = a.rgb.g, t.rgb_b = a.rgb.b, t.rgbToHsluv(), o.shades.push({
843
+ t.rgb_r = o.rgb.r, t.rgb_g = o.rgb.g, t.rgb_b = o.rgb.b, t.rgbToHsluv(), a.shades.push({
822
844
  name: "source",
823
845
  description: "Source color",
824
846
  hex: p(e).hex(),
@@ -837,73 +859,73 @@ class D {
837
859
  type: "source color"
838
860
  });
839
861
  const l = h.map(
840
- (i) => p.distance(
862
+ (n) => p.distance(
841
863
  p(e).hex(),
842
- p(i[1]).hex(),
864
+ p(n[1]).hex(),
843
865
  "rgb"
844
866
  )
845
- ), n = l.indexOf(Math.min(...l));
846
- h.forEach((i, m) => {
847
- const u = p.distance(
867
+ ), i = l.indexOf(Math.min(...l));
868
+ h.forEach((n, m) => {
869
+ const b = p.distance(
848
870
  p(e).hex(),
849
- p(i[1]).hex(),
871
+ p(n[1]).hex(),
850
872
  "rgb"
851
873
  ), x = Object.keys(this.currentScale).find(
852
- (F) => F === i[0][0]
853
- ) ?? "0", d = new C(), y = new g({
874
+ (F) => F === n[0][0]
875
+ ) ?? "0", $ = new C(), y = new d({
854
876
  render: "RGB",
855
877
  sourceColor: p(e).rgb(),
856
878
  visionSimulationMode: r.visionSimulationMode
857
- }).setColor(), $ = new g({
879
+ }).setColor(), g = new d({
858
880
  render: "HEX",
859
881
  sourceColor: p(e).rgb(),
860
882
  visionSimulationMode: r.visionSimulationMode
861
883
  }).setColor();
862
- m === n && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? (d.rgb_r = Number(y[0]) / 255, d.rgb_g = Number(y[1]) / 255, d.rgb_b = Number(y[2]) / 255) : (d.rgb_r = Number(i[1][0]) / 255, d.rgb_g = Number(i[1][1]) / 255, d.rgb_b = Number(i[1][2]) / 255), d.rgbToHsluv(), o.shades.push({
884
+ m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? ($.rgb_r = Number(y[0]) / 255, $.rgb_g = Number(y[1]) / 255, $.rgb_b = Number(y[2]) / 255) : ($.rgb_r = Number(n[1][0]) / 255, $.rgb_g = Number(n[1][1]) / 255, $.rgb_b = Number(n[1][2]) / 255), $.rgbToHsluv(), a.shades.push({
863
885
  name: x,
864
- description: `Shade/Tint color with ${typeof i[0][1] == "number" ? i[0][1].toFixed(1) : i[0][1]}% of ${a.alpha.isEnabled ? "opacity" : "lightness"}`,
865
- hex: m === n && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? p($).hex() : p(i[1]).hex(),
866
- rgb: m === n && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? p($).rgb() : p(i[1]).rgb(),
867
- gl: m === n && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? p($).gl() : p(i[1]).gl(),
868
- lch: m === n && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? p($).lch() : p(i[1]).lch(),
869
- oklch: m === n && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? p($).oklch() : p(i[1]).oklch(),
870
- lab: m === n && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? p($).lab() : p(i[1]).lab(),
871
- oklab: m === n && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? p($).oklab() : p(i[1]).oklab(),
872
- hsl: m === n && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? p($).hsl() : p(i[1]).hsl(),
873
- hsluv: [d.hsluv_h, d.hsluv_s, d.hsluv_l],
874
- alpha: a.alpha.isEnabled ? parseFloat((i[0][1] / 100).toFixed(2)) : void 0,
875
- backgroundColor: a.alpha.isEnabled && a.alpha.backgroundColor ? p(i[2]).rgb() : void 0,
876
- mixedColor: a.alpha.isEnabled && a.alpha.backgroundColor ? new g({
886
+ description: `Shade/Tint color with ${typeof n[0][1] == "number" ? n[0][1].toFixed(1) : n[0][1]}% of ${o.alpha.isEnabled ? "opacity" : "lightness"}`,
887
+ hex: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? p(g).hex() : p(n[1]).hex(),
888
+ rgb: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? p(g).rgb() : p(n[1]).rgb(),
889
+ gl: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? p(g).gl() : p(n[1]).gl(),
890
+ lch: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? p(g).lch() : p(n[1]).lch(),
891
+ oklch: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? p(g).oklch() : p(n[1]).oklch(),
892
+ lab: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? p(g).lab() : p(n[1]).lab(),
893
+ oklab: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? p(g).oklab() : p(n[1]).oklab(),
894
+ hsl: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? p(g).hsl() : p(n[1]).hsl(),
895
+ hsluv: [$.hsluv_h, $.hsluv_s, $.hsluv_l],
896
+ alpha: o.alpha.isEnabled ? parseFloat((n[0][1] / 100).toFixed(2)) : void 0,
897
+ backgroundColor: o.alpha.isEnabled && o.alpha.backgroundColor ? p(n[2]).rgb() : void 0,
898
+ mixedColor: o.alpha.isEnabled && o.alpha.backgroundColor ? new d({
877
899
  visionSimulationMode: r.visionSimulationMode
878
900
  }).mixColorsRgb(
879
901
  [
880
- ...i[1],
902
+ ...n[1],
881
903
  parseFloat(
882
- (i[0][1] / 100).toFixed(2)
904
+ (n[0][1] / 100).toFixed(2)
883
905
  )
884
906
  ],
885
- [...i[2], 1]
907
+ [...n[2], 1]
886
908
  ) : void 0,
887
- isClosestToRef: u < 4 && !this.base.areSourceColorsLocked,
888
- isSourceColorLocked: m === n && this.base.areSourceColorsLocked && !a.alpha.isEnabled,
889
- isTransparent: a.alpha.isEnabled,
909
+ isClosestToRef: b < 4 && !this.base.areSourceColorsLocked,
910
+ isSourceColorLocked: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled,
911
+ isTransparent: o.alpha.isEnabled,
890
912
  type: "color shade/tint"
891
913
  });
892
- }), s.colors.push(o);
914
+ }), s.colors.push(a);
893
915
  }), this.paletteData.themes.push(s);
894
916
  }), this.paletteData));
895
- b(this, "makeLibraryData", (r, s) => {
896
- const a = this.makePaletteData();
897
- return a.themes.flatMap(
898
- (o) => o.colors.flatMap(
917
+ u(this, "makeLibraryData", (r, s) => {
918
+ const o = this.makePaletteData();
919
+ return o.themes.flatMap(
920
+ (a) => a.colors.flatMap(
899
921
  (e) => e.shades.flatMap((t) => {
900
- const l = `${o.id}:${e.id}:${t.name}`, n = s == null ? void 0 : s.find(
901
- (i) => i.id === l
922
+ const l = `${a.id}:${e.id}:${t.name}`, i = s == null ? void 0 : s.find(
923
+ (n) => n.id === l
902
924
  );
903
925
  return {
904
926
  id: l,
905
- paletteName: a.name,
906
- themeName: o.name,
927
+ paletteName: o.name,
928
+ themeName: a.name,
907
929
  colorName: e.name,
908
930
  shadeName: t.name,
909
931
  ...(r == null ? void 0 : r.includes("alpha")) && { alpha: t.alpha ?? 1 },
@@ -913,71 +935,75 @@ class D {
913
935
  description: e.description
914
936
  },
915
937
  ...(r == null ? void 0 : r.includes("collection_id")) && {
916
- collectionId: n == null ? void 0 : n.collectionId
938
+ collectionId: i == null ? void 0 : i.collectionId
917
939
  },
918
940
  ...(r == null ? void 0 : r.includes("mode_id")) && {
919
- modeId: n == null ? void 0 : n.modeId
941
+ modeId: i == null ? void 0 : i.modeId
920
942
  },
921
943
  ...(r == null ? void 0 : r.includes("variable_id")) && {
922
- variableId: n == null ? void 0 : n.variableId
944
+ variableId: i == null ? void 0 : i.variableId
923
945
  },
924
946
  ...(r == null ? void 0 : r.includes("style_id")) && {
925
- styleId: n == null ? void 0 : n.styleId
947
+ styleId: i == null ? void 0 : i.styleId
926
948
  }
927
949
  };
928
950
  })
929
951
  )
930
952
  );
931
953
  });
932
- b(this, "makeNativeTokens", () => {
954
+ u(this, "makeNativeTokens", () => {
933
955
  const r = this.makePaletteData();
934
- return B(r);
956
+ return R(r);
935
957
  });
936
- b(this, "makeDtcgTokens", (r = "RGB") => {
958
+ u(this, "makeDtcgTokens", (r = "RGB") => {
937
959
  const s = this.makePaletteData();
938
- return N(s, r);
960
+ return K(s, r);
939
961
  });
940
- b(this, "makeStyleDictionaryTokens", () => {
962
+ u(this, "makeStyleDictionaryTokens", () => {
941
963
  const r = this.makePaletteData();
942
- return P(r);
964
+ return H(r);
943
965
  });
944
- b(this, "makeUniversalJson", () => {
966
+ u(this, "makeUniversalJson", () => {
945
967
  const r = this.makePaletteData();
946
968
  return S(r);
947
969
  });
948
- b(this, "makeCssCustomProps", (r = "RGB") => {
970
+ u(this, "makeCssCustomProps", (r = "RGB") => {
949
971
  const s = this.makePaletteData();
950
- return j(s, r);
972
+ return G(s, r);
951
973
  });
952
- b(this, "makeScssVariable", (r = "RGB") => {
974
+ u(this, "makeScssVariable", (r = "RGB") => {
953
975
  const s = this.makePaletteData();
954
- return A(s, r);
976
+ return P(s, r);
955
977
  });
956
- b(this, "makeLessVariables", (r = "RGB") => {
978
+ u(this, "makeLessVariables", (r = "RGB") => {
957
979
  const s = this.makePaletteData();
958
- return K(s, r);
980
+ return B(s, r);
959
981
  });
960
- b(this, "makeTailwindConfig", () => {
982
+ u(this, "makeTailwindConfig", () => {
961
983
  const r = this.makePaletteData();
962
984
  return L(r);
963
985
  });
964
- b(this, "makeSwiftUI", () => {
986
+ u(this, "makeSwiftUI", () => {
965
987
  const r = this.makePaletteData();
966
- return H(r);
988
+ return N(r);
967
989
  });
968
- b(this, "makeUIKit", () => {
990
+ u(this, "makeUIKit", () => {
969
991
  const r = this.makePaletteData();
970
992
  return T(r);
971
993
  });
972
- b(this, "makeCompose", () => {
994
+ u(this, "makeCompose", () => {
973
995
  const r = this.makePaletteData();
974
- return G(r);
996
+ return _(r);
975
997
  });
976
- b(this, "makeResources", () => {
998
+ u(this, "makeResources", () => {
977
999
  const r = this.makePaletteData();
978
- return R(r);
1000
+ return A(r);
1001
+ });
1002
+ u(this, "makeCsv", () => {
1003
+ const r = this.makePaletteData();
1004
+ return j(r);
979
1005
  });
980
- b(this, "makePaletteFullData", () => ({
1006
+ u(this, "makePaletteFullData", () => ({
981
1007
  base: this.base,
982
1008
  themes: this.themes,
983
1009
  libraryData: this.makeLibraryData(),
@@ -986,15 +1012,15 @@ class D {
986
1012
  type: "UI_COLOR_PALETTE"
987
1013
  }));
988
1014
  var h;
989
- this.base = r, this.themes = s, this.meta = a, this.paletteData = {
1015
+ this.base = r, this.themes = s, this.meta = o, this.paletteData = {
990
1016
  name: r.name ?? "UI Color Palette",
991
1017
  description: r.description,
992
1018
  themes: [],
993
1019
  type: "palette"
994
- }, this.currentScale = ((h = s.find((o) => o.isEnabled)) == null ? void 0 : h.scale) ?? {};
1020
+ }, this.currentScale = ((h = s.find((a) => a.isEnabled)) == null ? void 0 : h.scale) ?? {};
995
1021
  }
996
1022
  }
997
1023
  export {
998
- D as default
1024
+ O as default
999
1025
  };
1000
1026
  //# sourceMappingURL=data.js.map