@yelbolt/engine-ui-color-palette 1.10.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.
Files changed (109) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +430 -0
  3. package/dist/color-DTr3No_G.js +540 -0
  4. package/dist/color-DTr3No_G.js.map +1 -0
  5. package/dist/formats/primitives/makeCompose.d.ts +4 -0
  6. package/dist/formats/primitives/makeCompose.d.ts.map +1 -0
  7. package/dist/formats/primitives/makeCssCustomProps.d.ts +5 -0
  8. package/dist/formats/primitives/makeCssCustomProps.d.ts.map +1 -0
  9. package/dist/formats/primitives/makeCsv.d.ts +13 -0
  10. package/dist/formats/primitives/makeCsv.d.ts.map +1 -0
  11. package/dist/formats/primitives/makeDtcgTokens.d.ts +5 -0
  12. package/dist/formats/primitives/makeDtcgTokens.d.ts.map +1 -0
  13. package/dist/formats/primitives/makeLessVariables.d.ts +5 -0
  14. package/dist/formats/primitives/makeLessVariables.d.ts.map +1 -0
  15. package/dist/formats/primitives/makeNativeTokens.d.ts +4 -0
  16. package/dist/formats/primitives/makeNativeTokens.d.ts.map +1 -0
  17. package/dist/formats/primitives/makeResources.d.ts +4 -0
  18. package/dist/formats/primitives/makeResources.d.ts.map +1 -0
  19. package/dist/formats/primitives/makeScssVariables.d.ts +5 -0
  20. package/dist/formats/primitives/makeScssVariables.d.ts.map +1 -0
  21. package/dist/formats/primitives/makeStyleDictionaryV3Tokens.d.ts +4 -0
  22. package/dist/formats/primitives/makeStyleDictionaryV3Tokens.d.ts.map +1 -0
  23. package/dist/formats/primitives/makeSwiftUI.d.ts +4 -0
  24. package/dist/formats/primitives/makeSwiftUI.d.ts.map +1 -0
  25. package/dist/formats/primitives/makeTailwindV3Config.d.ts +4 -0
  26. package/dist/formats/primitives/makeTailwindV3Config.d.ts.map +1 -0
  27. package/dist/formats/primitives/makeTailwindV4Config.d.ts +4 -0
  28. package/dist/formats/primitives/makeTailwindV4Config.d.ts.map +1 -0
  29. package/dist/formats/primitives/makeUIKit.d.ts +4 -0
  30. package/dist/formats/primitives/makeUIKit.d.ts.map +1 -0
  31. package/dist/formats/primitives/makeUniversalTokens.d.ts +4 -0
  32. package/dist/formats/primitives/makeUniversalTokens.d.ts.map +1 -0
  33. package/dist/formats/semantics/_helpers.d.ts +26 -0
  34. package/dist/formats/semantics/_helpers.d.ts.map +1 -0
  35. package/dist/formats/semantics/makeComposeSemantics.d.ts +5 -0
  36. package/dist/formats/semantics/makeComposeSemantics.d.ts.map +1 -0
  37. package/dist/formats/semantics/makeCssSemantics.d.ts +5 -0
  38. package/dist/formats/semantics/makeCssSemantics.d.ts.map +1 -0
  39. package/dist/formats/semantics/makeCsvSemantics.d.ts +5 -0
  40. package/dist/formats/semantics/makeCsvSemantics.d.ts.map +1 -0
  41. package/dist/formats/semantics/makeDtcgSemantics.d.ts +5 -0
  42. package/dist/formats/semantics/makeDtcgSemantics.d.ts.map +1 -0
  43. package/dist/formats/semantics/makeLessSemantics.d.ts +5 -0
  44. package/dist/formats/semantics/makeLessSemantics.d.ts.map +1 -0
  45. package/dist/formats/semantics/makeNativeSemantics.d.ts +5 -0
  46. package/dist/formats/semantics/makeNativeSemantics.d.ts.map +1 -0
  47. package/dist/formats/semantics/makeResourcesSemantics.d.ts +5 -0
  48. package/dist/formats/semantics/makeResourcesSemantics.d.ts.map +1 -0
  49. package/dist/formats/semantics/makeScssSemantics.d.ts +5 -0
  50. package/dist/formats/semantics/makeScssSemantics.d.ts.map +1 -0
  51. package/dist/formats/semantics/makeStyleDictionaryV3Semantics.d.ts +5 -0
  52. package/dist/formats/semantics/makeStyleDictionaryV3Semantics.d.ts.map +1 -0
  53. package/dist/formats/semantics/makeSwiftUISemantics.d.ts +5 -0
  54. package/dist/formats/semantics/makeSwiftUISemantics.d.ts.map +1 -0
  55. package/dist/formats/semantics/makeTailwindV3Semantics.d.ts +5 -0
  56. package/dist/formats/semantics/makeTailwindV3Semantics.d.ts.map +1 -0
  57. package/dist/formats/semantics/makeTailwindV4Semantics.d.ts +5 -0
  58. package/dist/formats/semantics/makeTailwindV4Semantics.d.ts.map +1 -0
  59. package/dist/formats/semantics/makeUIKitSemantics.d.ts +5 -0
  60. package/dist/formats/semantics/makeUIKitSemantics.d.ts.map +1 -0
  61. package/dist/formats/semantics/makeUniversalSemantics.d.ts +5 -0
  62. package/dist/formats/semantics/makeUniversalSemantics.d.ts.map +1 -0
  63. package/dist/index-Beb8qoyd.js +1403 -0
  64. package/dist/index-Beb8qoyd.js.map +1 -0
  65. package/dist/index.d.ts +14 -0
  66. package/dist/index.d.ts.map +1 -0
  67. package/dist/index.js +17 -0
  68. package/dist/index.js.map +1 -0
  69. package/dist/modules/code/code.d.ts +28 -0
  70. package/dist/modules/code/code.d.ts.map +1 -0
  71. package/dist/modules/code/code.js +1312 -0
  72. package/dist/modules/code/code.js.map +1 -0
  73. package/dist/modules/color/color.d.ts +49 -0
  74. package/dist/modules/color/color.d.ts.map +1 -0
  75. package/dist/modules/color/color.js +6 -0
  76. package/dist/modules/color/color.js.map +1 -0
  77. package/dist/modules/color-harmony/color-harmony.d.ts +25 -0
  78. package/dist/modules/color-harmony/color-harmony.d.ts.map +1 -0
  79. package/dist/modules/color-harmony/color-harmony.js +147 -0
  80. package/dist/modules/color-harmony/color-harmony.js.map +1 -0
  81. package/dist/modules/contrast/contrast.d.ts +19 -0
  82. package/dist/modules/contrast/contrast.d.ts.map +1 -0
  83. package/dist/modules/contrast/contrast.js +187 -0
  84. package/dist/modules/contrast/contrast.js.map +1 -0
  85. package/dist/modules/data/data.d.ts +17 -0
  86. package/dist/modules/data/data.d.ts.map +1 -0
  87. package/dist/modules/data/data.js +461 -0
  88. package/dist/modules/data/data.js.map +1 -0
  89. package/dist/modules/dominant-colors/dominant-colors.d.ts +39 -0
  90. package/dist/modules/dominant-colors/dominant-colors.d.ts.map +1 -0
  91. package/dist/modules/dominant-colors/dominant-colors.js +198 -0
  92. package/dist/modules/dominant-colors/dominant-colors.js.map +1 -0
  93. package/dist/modules/system/system.d.ts +17 -0
  94. package/dist/modules/system/system.d.ts.map +1 -0
  95. package/dist/modules/system/system.js +78 -0
  96. package/dist/modules/system/system.js.map +1 -0
  97. package/dist/types/code.types.d.ts +6 -0
  98. package/dist/types/code.types.d.ts.map +1 -0
  99. package/dist/types/color.types.d.ts +45 -0
  100. package/dist/types/color.types.d.ts.map +1 -0
  101. package/dist/types/configuration.types.d.ts +154 -0
  102. package/dist/types/configuration.types.d.ts.map +1 -0
  103. package/dist/types/data.types.d.ts +135 -0
  104. package/dist/types/data.types.d.ts.map +1 -0
  105. package/dist/types/model.types.d.ts +3 -0
  106. package/dist/types/model.types.d.ts.map +1 -0
  107. package/dist/types/system.types.d.ts +40 -0
  108. package/dist/types/system.types.d.ts.map +1 -0
  109. package/package.json +65 -0
@@ -0,0 +1,1312 @@
1
+ var U = Object.defineProperty;
2
+ var K = (r, p, h) => p in r ? U(r, p, { enumerable: !0, configurable: !0, writable: !0, value: h }) : r[p] = h;
3
+ var C = (r, p, h) => K(r, typeof p != "symbol" ? p + "" : p, h);
4
+ import { c as v } from "../../index-Beb8qoyd.js";
5
+ var I = Object.defineProperty, R = (r, p, h) => p in r ? I(r, p, { enumerable: !0, configurable: !0, writable: !0, value: h }) : r[p] = h, M = (r, p, h) => R(r, typeof p != "symbol" ? p + "" : p, h);
6
+ class d {
7
+ constructor(p) {
8
+ M(this, "string"), M(this, "doSnakeCase", () => this.string.toLowerCase().split(" ").join("_").replace(/[@/$^%#&!?.,;:+=<>(){}"«»]/g, "")), M(this, "doPascalCase", () => this.string.charAt(0).toUpperCase() + this.string.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (h) => h.toUpperCase()).replace(/[@/$^%#&!?.,;:+=<>(){}"«» ]/g, "").slice(1)), M(this, "doKebabCase", () => this.string.toLowerCase().split(" ").join("-").replace(/[@/$^%#&!?.,;:+=<>(){}"«»]/g, "")), M(this, "doCamelCase", () => this.string.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (h) => h.toUpperCase()).replace(/[@/$^%#&!?.,;:+=<>(){}"«» ]/g, "")), this.string = p;
9
+ }
10
+ }
11
+ const j = (r) => {
12
+ const p = r.split(":");
13
+ if (p.length !== 3) return null;
14
+ const [h, c, m] = p;
15
+ return !h || !c || !m ? null : { themeId: h, colorId: c, shadeName: m };
16
+ }, L = (r, p, h) => {
17
+ const c = r.themes.find((i) => i.id === p), m = c == null ? void 0 : c.colors.find((i) => i.id === h);
18
+ return (m == null ? void 0 : m.name) ?? null;
19
+ }, F = (r, p) => {
20
+ var h;
21
+ return ((h = r.themes.find((c) => c.id === p)) == null ? void 0 : h.name) ?? null;
22
+ }, x = (r) => r.themes.filter((p) => p.type === "custom theme").length === 0 ? r.themes.filter((p) => p.type === "default theme") : r.themes.filter((p) => p.type === "custom theme"), g = (r, p) => p.refs.map((h) => {
23
+ if (h.shadeId === null)
24
+ return {
25
+ themeId: h.themeId,
26
+ themeName: F(r, h.themeId),
27
+ colorName: null,
28
+ shadeName: null,
29
+ isUnbound: !0
30
+ };
31
+ const c = j(h.shadeId);
32
+ return c ? {
33
+ themeId: h.themeId,
34
+ themeName: F(r, h.themeId),
35
+ colorName: L(r, h.themeId, c.colorId),
36
+ shadeName: c.shadeName,
37
+ isUnbound: !1
38
+ } : {
39
+ themeId: h.themeId,
40
+ themeName: F(r, h.themeId),
41
+ colorName: null,
42
+ shadeName: null,
43
+ isUnbound: !0
44
+ };
45
+ }), w = (r, p) => {
46
+ const h = [], c = [], m = [];
47
+ return p.tokens.forEach((i) => {
48
+ if (i.isExcluded) {
49
+ m.push(i);
50
+ return;
51
+ }
52
+ g(r, i).every((e) => e.isUnbound) ? c.push(i) : h.push(i);
53
+ }), { bound: h, unbound: c, excluded: m };
54
+ }, V = (r, p) => {
55
+ const { bound: h, unbound: c } = w(r, p), m = x(r), i = m.filter((a) => a.type === "custom theme"), o = {};
56
+ c.length > 0 && (o._unbound = c.map((a) => a.pathNames.join(".")));
57
+ const e = (a, t, s) => {
58
+ let n = a;
59
+ for (let l = 0; l < t.length - 1; l++) {
60
+ const f = t[l];
61
+ (typeof n[f] != "object" || n[f] === null) && (n[f] = {}), n = n[f];
62
+ }
63
+ n[t[t.length - 1]] = s;
64
+ }, u = (a, t) => ({
65
+ $ref: `${new d(a).doKebabCase()}.${t}`
66
+ });
67
+ return i.length === 0 ? h.forEach((a) => {
68
+ const t = a.pathNames.map((l) => new d(l).doKebabCase()), n = g(r, a).find((l) => !l.isUnbound);
69
+ !n || !n.colorName || !n.shadeName || e(o, t, u(n.colorName, n.shadeName));
70
+ }) : m.forEach((a) => {
71
+ const t = new d(a.name).doKebabCase(), s = {};
72
+ h.forEach((n) => {
73
+ const l = n.pathNames.map((b) => new d(b).doKebabCase()), $ = g(r, n).find((b) => b.themeId === a.id);
74
+ !$ || $.isUnbound || !$.colorName || !$.shadeName || e(s, l, u($.colorName, $.shadeName));
75
+ }), o[t] = s;
76
+ }), JSON.stringify(o, null, 2);
77
+ }, O = (r, p) => {
78
+ const { bound: h, unbound: c } = w(r, p), m = x(r), i = r.themes.find((t) => t.type === "default theme") ?? m[0], o = m.filter((t) => t.type === "custom theme"), e = ["import UIKit", ""];
79
+ c.length > 0 && (e.push("// Unbound semantic tokens"), c.forEach((t) => e.push(`// ${t.pathNames.join("-")}`)), e.push(""));
80
+ const u = (t) => new d(t.join(" ")).doCamelCase(), a = (t, s, n) => {
81
+ const l = new d(s).doCamelCase(), f = n === "source" ? "Source" : new d(n).doPascalCase();
82
+ return t ? `Color.${new d(t).doPascalCase()}.${l}${f}` : `Color.${l}${f}`;
83
+ };
84
+ return e.push("struct SemanticToken {"), o.length === 0 ? h.forEach((t) => {
85
+ const s = g(r, t), n = s.find((l) => l.themeId === i.id && !l.isUnbound) ?? s.find((l) => !l.isUnbound);
86
+ !n || !n.colorName || !n.shadeName || e.push(
87
+ ` static let ${u(t.pathNames)} = ${a(null, n.colorName, n.shadeName)}`
88
+ );
89
+ }) : m.forEach((t) => {
90
+ const s = new d(t.name).doPascalCase();
91
+ e.push(` struct ${s} {`), h.forEach((n) => {
92
+ const f = g(r, n).find(($) => $.themeId === t.id);
93
+ !f || f.isUnbound || !f.colorName || !f.shadeName || e.push(
94
+ ` static let ${u(n.pathNames)} = ${a(t.name, f.colorName, f.shadeName)}`
95
+ );
96
+ }), e.push(" }");
97
+ }), e.push("}"), e.join(`
98
+ `);
99
+ }, P = (r, p) => {
100
+ const { bound: h, unbound: c } = w(r, p), m = x(r), i = r.themes.find((t) => t.type === "default theme") ?? m[0], o = m.filter((t) => t.type === "custom theme"), e = ['@import "tailwindcss";', ""];
101
+ c.length > 0 && (e.push("/* Unbound semantic tokens */"), c.forEach((t) => e.push(`/* ${t.pathNames.join("-")} */`)), e.push(""));
102
+ const u = (t) => `--color-${t.map((s) => new d(s).doKebabCase()).join("-")}`, a = (t, s) => `var(--color-${new d(t).doKebabCase()}-${s})`;
103
+ return e.push("@theme {"), h.forEach((t) => {
104
+ const s = g(r, t), n = s.find((l) => l.themeId === i.id && !l.isUnbound) ?? s.find((l) => !l.isUnbound);
105
+ !n || !n.colorName || !n.shadeName || e.push(
106
+ ` ${u(t.pathNames)}: ${a(n.colorName, n.shadeName)};`
107
+ );
108
+ }), e.push("}"), o.forEach((t) => {
109
+ const s = [];
110
+ h.forEach((n) => {
111
+ const l = g(r, n), f = l.find((b) => b.themeId === t.id), $ = l.find((b) => b.themeId === i.id && !b.isUnbound) ?? l.find((b) => !b.isUnbound);
112
+ !f || f.isUnbound || !f.colorName || !f.shadeName || $ && $.colorName === f.colorName && $.shadeName === f.shadeName || s.push(
113
+ ` ${u(n.pathNames)}: ${a(f.colorName, f.shadeName)};`
114
+ );
115
+ }), s.length !== 0 && (e.push(""), e.push(`/* ${t.name} */`), e.push(`[data-theme='${new d(t.name).doKebabCase()}'] {`), e.push(...s), e.push("}"));
116
+ }), e.join(`
117
+ `);
118
+ }, H = (r, p) => {
119
+ const { bound: h, unbound: c } = w(r, p), m = x(r), i = r.themes.find((t) => t.type === "default theme") ?? m[0], o = m.filter((t) => t.type === "custom theme"), e = [];
120
+ e.push("// Semantic token map. Import alongside primitives.js:"), e.push("// const primitives = require('./primitives.js')"), e.push("// const semantics = require('./semantics.js')(primitives)"), e.push(""), c.length > 0 && (e.push("// Unbound semantic tokens"), c.forEach((t) => e.push(`// ${t.pathNames.join("-")}`)), e.push(""));
121
+ const u = (t) => `'${t.map((s) => new d(s).doKebabCase()).join("-")}'`, a = (t, s, n) => {
122
+ const l = new d(s).doKebabCase();
123
+ return t ? `primitives['${t}']['${l}']['${n}']` : `primitives['${l}']['${n}']`;
124
+ };
125
+ return e.push("module.exports = function (primitives) {"), e.push(" return {"), o.length === 0 ? h.forEach((t) => {
126
+ const s = g(r, t), n = s.find((l) => l.themeId === i.id && !l.isUnbound) ?? s.find((l) => !l.isUnbound);
127
+ !n || !n.colorName || !n.shadeName || e.push(
128
+ ` ${u(t.pathNames)}: ${a(null, n.colorName, n.shadeName)},`
129
+ );
130
+ }) : m.forEach((t) => {
131
+ const s = new d(t.name).doKebabCase();
132
+ e.push(` '${s}': {`), h.forEach((n) => {
133
+ const f = g(r, n).find(($) => $.themeId === t.id);
134
+ !f || f.isUnbound || !f.colorName || !f.shadeName || e.push(
135
+ ` ${u(n.pathNames)}: ${a(s, f.colorName, f.shadeName)},`
136
+ );
137
+ }), e.push(" },");
138
+ }), e.push(" }"), e.push("}"), e.join(`
139
+ `);
140
+ }, B = (r, p) => {
141
+ const { bound: h, unbound: c } = w(r, p), m = x(r), i = r.themes.find((t) => t.type === "default theme") ?? m[0], o = m.filter((t) => t.type === "custom theme"), e = ["import SwiftUI", ""];
142
+ c.length > 0 && (e.push("// Unbound semantic tokens"), c.forEach((t) => e.push(`// ${t.pathNames.join("-")}`)), e.push(""));
143
+ const u = (t) => new d(t.join(" ")).doCamelCase(), a = (t, s, n) => {
144
+ const l = new d(s).doCamelCase(), f = n === "source" ? "Source" : new d(n).doPascalCase();
145
+ return t ? `Color.Token().${new d(t).doCamelCase()}${new d(s).doPascalCase()}${f}` : `Color.Token().${l}${f}`;
146
+ };
147
+ return e.push("public extension Color {"), e.push(" static let SemanticToken = Color.SemanticTokenColor()"), e.push(" struct SemanticTokenColor {"), o.length === 0 ? h.forEach((t) => {
148
+ const s = g(r, t), n = s.find((l) => l.themeId === i.id && !l.isUnbound) ?? s.find((l) => !l.isUnbound);
149
+ !n || !n.colorName || !n.shadeName || e.push(
150
+ ` public let ${u(t.pathNames)} = ${a(null, n.colorName, n.shadeName)}`
151
+ );
152
+ }) : m.forEach((t) => {
153
+ const s = new d(t.name).doCamelCase();
154
+ h.forEach((n) => {
155
+ const f = g(r, n).find((b) => b.themeId === t.id);
156
+ if (!f || f.isUnbound || !f.colorName || !f.shadeName) return;
157
+ const $ = s + new d(n.pathNames.join(" ")).doPascalCase().replace(/\s+/g, "");
158
+ e.push(
159
+ ` public let ${$} = ${a(t.name, f.colorName, f.shadeName)}`
160
+ );
161
+ });
162
+ }), e.push(" }"), e.push("}"), e.join(`
163
+ `);
164
+ }, G = (r, p) => {
165
+ const { bound: h, unbound: c } = w(r, p), m = x(r), i = r.themes.find((s) => s.type === "default theme") ?? m[0], o = m.filter((s) => s.type === "custom theme"), e = {};
166
+ c.length > 0 && (e._unbound = c.map((s) => s.pathNames.join(".")));
167
+ const u = (s, n, l) => {
168
+ let f = s;
169
+ for (let $ = 0; $ < n.length - 1; $++) {
170
+ const b = n[$];
171
+ (typeof f[b] != "object" || f[b] === null) && (f[b] = {}), f = f[b];
172
+ }
173
+ f[n[n.length - 1]] = l;
174
+ }, a = (s, n) => `{color.${new d(s).doKebabCase()}.${n}}`, t = {};
175
+ return h.forEach((s) => {
176
+ const n = s.pathNames.map((b) => new d(b).doKebabCase()), l = g(r, s), f = l.find((b) => b.themeId === i.id && !b.isUnbound) ?? l.find((b) => !b.isUnbound);
177
+ if (!f || !f.colorName || !f.shadeName) return;
178
+ const $ = {
179
+ type: "color",
180
+ value: a(f.colorName, f.shadeName)
181
+ };
182
+ s.description && ($.comment = s.description), u(t, n, $);
183
+ }), e.semantic = t, o.forEach((s) => {
184
+ const n = new d(s.name).doKebabCase(), l = {};
185
+ h.forEach((f) => {
186
+ const $ = f.pathNames.map((k) => new d(k).doKebabCase()), b = g(r, f), N = b.find((k) => k.themeId === s.id), y = b.find(
187
+ (k) => k.themeId === i.id && !k.isUnbound
188
+ ) ?? b.find((k) => !k.isUnbound);
189
+ if (!N || N.isUnbound || !N.colorName || !N.shadeName || y && y.colorName === N.colorName && y.shadeName === N.shadeName)
190
+ return;
191
+ const T = {
192
+ type: "color",
193
+ value: a(N.colorName, N.shadeName)
194
+ };
195
+ u(l, $, T);
196
+ }), Object.keys(l).length > 0 && (e[n] = l);
197
+ }), JSON.stringify(e, null, 2);
198
+ }, A = (r, p) => {
199
+ const { bound: h, unbound: c } = w(r, p), m = x(r), i = r.themes.find((s) => s.type === "default theme") ?? m[0], o = m.filter((s) => s.type === "custom theme"), e = [];
200
+ c.length > 0 && (e.push("// Unbound semantic tokens"), c.forEach((s) => e.push(`// ${s.pathNames.join("-")}`)), e.push(""));
201
+ const u = (s) => s.map((n) => new d(n).doKebabCase()).join("-"), a = (s, n) => `$${new d(s).doKebabCase()}-${n}`, t = (s, n) => `var(--${new d(s).doKebabCase()}-${n})`;
202
+ return o.length === 0 ? (h.forEach((s) => {
203
+ const n = g(r, s), l = n.find((f) => f.themeId === i.id && !f.isUnbound) ?? n.find((f) => !f.isUnbound);
204
+ !l || !l.colorName || !l.shadeName || e.push(
205
+ `$${u(s.pathNames)}: ${a(l.colorName, l.shadeName)};`
206
+ );
207
+ }), e.join(`
208
+ `)) : (h.forEach((s) => {
209
+ e.push(`$${u(s.pathNames)}: var(--${u(s.pathNames)});`);
210
+ }), e.push(""), m.forEach((s) => {
211
+ const n = s.type === "default theme", l = `${new d(s.name).doKebabCase()}-semantics`;
212
+ e.push(`@mixin ${l} {`), h.forEach((f) => {
213
+ const b = g(r, f).find((N) => N.themeId === s.id);
214
+ !b || b.isUnbound || !b.colorName || !b.shadeName || e.push(
215
+ ` --${u(f.pathNames)}: ${t(b.colorName, b.shadeName)};`
216
+ );
217
+ }), e.push("}"), e.push(""), n ? (e.push(":root {"), e.push(` @include ${l};`), e.push("}")) : (e.push(`:root[data-theme='${new d(s.name).doKebabCase()}'] {`), e.push(` @include ${l};`), e.push("}")), e.push("");
218
+ }), e.join(`
219
+ `).replace(/\n+$/, `
220
+ `));
221
+ }, _ = (r, p) => {
222
+ const { bound: h, unbound: c } = w(r, p), m = x(r), i = r.themes.find((t) => t.type === "default theme") ?? m[0], o = m.filter((t) => t.type === "custom theme"), e = [
223
+ '<?xml version="1.0" encoding="utf-8"?>',
224
+ "<resources>"
225
+ ];
226
+ c.length > 0 && (e.push(" <!-- Unbound semantic tokens -->"), c.forEach((t) => e.push(` <!-- ${t.pathNames.join("-")} -->`)));
227
+ const u = (t) => t.map((s) => new d(s).doSnakeCase()).join("_"), a = (t, s, n) => {
228
+ const l = new d(s).doSnakeCase(), f = n === "source" ? "source" : n;
229
+ return t ? `@color/${new d(t).doSnakeCase()}_${l}_${f}` : `@color/${l}_${f}`;
230
+ };
231
+ return o.length === 0 ? h.forEach((t) => {
232
+ const s = g(r, t), n = s.find((l) => l.themeId === i.id && !l.isUnbound) ?? s.find((l) => !l.isUnbound);
233
+ !n || !n.colorName || !n.shadeName || e.push(
234
+ ` <color name="${u(t.pathNames)}">${a(null, n.colorName, n.shadeName)}</color>`
235
+ );
236
+ }) : m.forEach((t) => {
237
+ const s = new d(t.name).doSnakeCase();
238
+ e.push(` <!-- ${t.name} -->`), h.forEach((n) => {
239
+ const f = g(r, n).find(($) => $.themeId === t.id);
240
+ !f || f.isUnbound || !f.colorName || !f.shadeName || e.push(
241
+ ` <color name="${s}_${u(n.pathNames)}">${a(t.name, f.colorName, f.shadeName)}</color>`
242
+ );
243
+ });
244
+ }), e.push("</resources>"), e.join(`
245
+ `);
246
+ }, S = (r) => {
247
+ const p = r.name, h = (o, e, u) => ({
248
+ $type: "color",
249
+ $value: e.isTransparent ? v(u.hex).alpha(e.alpha ?? 1).hex() : e.hex,
250
+ $description: o.description !== "" ? o.description + " - " + e.description : e.description
251
+ }), c = (o, e) => ({
252
+ name: o,
253
+ group: "Modes",
254
+ description: e,
255
+ selectedTokenSets: {
256
+ [`${p}/${o}`]: "enabled"
257
+ }
258
+ }), m = r.themes.filter((o) => o.type === "custom theme").length === 0 ? r.themes.filter((o) => o.type === "default theme") : r.themes.filter((o) => o.type === "custom theme"), i = {
259
+ $themes: m.filter((o) => o.type === "custom theme").map((o) => c(o.name, o.description)),
260
+ $metadata: {
261
+ activeThemes: [],
262
+ tokenSetOrder: m.filter((o) => o.type === "custom theme").map(
263
+ (o) => `${new d(p).doSnakeCase()}/${new d(o.name).doSnakeCase()}`
264
+ ),
265
+ activeSets: []
266
+ }
267
+ };
268
+ return m[0].type === "custom theme" ? m.forEach((o) => {
269
+ i[`${p}/${o.name}`] = {}, o.colors.forEach((e) => {
270
+ const u = e.shades.find(
271
+ (a) => a.type === "source color"
272
+ );
273
+ e.shades.forEach((a) => {
274
+ a && u && (i[`${p}/${o.name}`][`${new d(e.name).doSnakeCase()}.${a.name}`] = h(e, a, u));
275
+ });
276
+ });
277
+ }) : m.forEach((o) => {
278
+ i[p] = {}, o.colors.forEach((e) => {
279
+ const u = e.shades.find(
280
+ (a) => a.type === "source color"
281
+ );
282
+ e.shades.forEach((a) => {
283
+ a && u && (i[p][`${new d(e.name).doSnakeCase()}.${a.name}`] = h(e, a, u));
284
+ });
285
+ });
286
+ }), JSON.stringify(i, null, " ");
287
+ }, J = (r, p) => {
288
+ const h = JSON.parse(S(r)), { bound: c, unbound: m } = w(r, p), i = x(r), o = r.themes.find((n) => n.type === "default theme") ?? i[0], e = i.filter((n) => n.type === "custom theme"), u = r.name, a = (n, l) => `{${new d(n).doSnakeCase()}.${l}}`, t = e.length === 0 ? u : `${u}/semantic`;
289
+ h[t] = h[t] ?? {};
290
+ const s = h[t];
291
+ return c.forEach((n) => {
292
+ const l = n.pathNames.map((N) => new d(N).doSnakeCase()).join("."), f = g(r, n), $ = f.find((N) => N.themeId === o.id && !N.isUnbound) ?? f.find((N) => !N.isUnbound);
293
+ if (!$ || !$.colorName || !$.shadeName) return;
294
+ const b = {
295
+ $type: "color",
296
+ $value: a($.colorName, $.shadeName)
297
+ };
298
+ n.description && (b.$description = n.description), s[l] = b;
299
+ }), e.forEach((n) => {
300
+ const l = `${u}/${new d(n.name).doSnakeCase()}-semantic`, f = {};
301
+ c.forEach(($) => {
302
+ const b = $.pathNames.map((k) => new d(k).doSnakeCase()).join("."), N = g(r, $), y = N.find((k) => k.themeId === n.id), T = N.find(
303
+ (k) => k.themeId === o.id && !k.isUnbound
304
+ ) ?? N.find((k) => !k.isUnbound);
305
+ !y || y.isUnbound || !y.colorName || !y.shadeName || T && T.colorName === y.colorName && T.shadeName === y.shadeName || (f[b] = {
306
+ $type: "color",
307
+ $value: a(y.colorName, y.shadeName)
308
+ });
309
+ }), Object.keys(f).length > 0 && (h[l] = f);
310
+ }), m.length > 0 && (h._unbound = m.map((n) => n.pathNames.join("."))), JSON.stringify(h, null, " ");
311
+ }, X = (r, p) => {
312
+ const { bound: h, unbound: c } = w(r, p), m = x(r), i = r.themes.find((t) => t.type === "default theme") ?? m[0], o = m.filter((t) => t.type === "custom theme"), e = [];
313
+ c.length > 0 && (e.push("// Unbound semantic tokens"), c.forEach((t) => e.push(`// ${t.pathNames.join("-")}`)), e.push(""));
314
+ const u = (t) => t.map((s) => new d(s).doKebabCase()).join("-"), a = (t, s) => `@${new d(t).doKebabCase()}-${s}`;
315
+ return o.length === 0 ? (h.forEach((t) => {
316
+ const s = g(r, t), n = s.find((l) => l.themeId === i.id && !l.isUnbound) ?? s.find((l) => !l.isUnbound);
317
+ !n || !n.colorName || !n.shadeName || e.push(
318
+ `@${u(t.pathNames)}: ${a(n.colorName, n.shadeName)};`
319
+ );
320
+ }), e.join(`
321
+ `)) : (m.forEach((t) => {
322
+ const s = t.type === "default theme", n = `${new d(t.name).doKebabCase()}-semantics`;
323
+ e.push(`.${n}() {`), h.forEach((l) => {
324
+ const $ = g(r, l).find((b) => b.themeId === t.id);
325
+ !$ || $.isUnbound || !$.colorName || !$.shadeName || e.push(
326
+ ` @${u(l.pathNames)}: ${a($.colorName, $.shadeName)};`
327
+ );
328
+ }), e.push("}"), e.push(""), s ? (e.push(":root {"), e.push(` .${n}();`), e.push("}")) : (e.push(`:root[data-theme='${new d(t.name).doKebabCase()}'] {`), e.push(` .${n}();`), e.push("}")), e.push("");
329
+ }), e.join(`
330
+ `).replace(/\n+$/, `
331
+ `));
332
+ }, z = (r, p) => {
333
+ const { bound: h, unbound: c } = w(r, p), m = x(r), i = r.themes.find((t) => t.type === "default theme") ?? m[0], o = m.filter((t) => t.type === "custom theme"), e = {};
334
+ c.length > 0 && (e.$description = "Unbound semantic tokens (no resolution): " + c.map((t) => t.pathNames.join(".")).join(", "));
335
+ const u = (t, s, n) => {
336
+ let l = t;
337
+ for (let f = 0; f < s.length - 1; f++) {
338
+ const $ = s[f];
339
+ (typeof l[$] != "object" || l[$] === null) && (l[$] = {}), l = l[$];
340
+ }
341
+ l[s[s.length - 1]] = n;
342
+ }, a = (t, s) => `{${new d(t).doKebabCase()}.${s}}`;
343
+ return h.forEach((t) => {
344
+ const s = t.pathNames.map((b) => new d(b).doKebabCase()), n = g(r, t), l = n.find((b) => b.themeId === i.id && !b.isUnbound) ?? n.find((b) => !b.isUnbound);
345
+ if (!l || !l.colorName || !l.shadeName) return;
346
+ const f = {
347
+ $type: "color",
348
+ $value: a(l.colorName, l.shadeName)
349
+ };
350
+ t.description && (f.$description = t.description);
351
+ const $ = {};
352
+ o.forEach((b) => {
353
+ const N = n.find((y) => y.themeId === b.id);
354
+ !N || N.isUnbound || !N.colorName || !N.shadeName || l.colorName === N.colorName && l.shadeName === N.shadeName || ($[new d(b.name).doKebabCase()] = {
355
+ $value: a(N.colorName, N.shadeName)
356
+ });
357
+ }), Object.keys($).length > 0 && (f.$extensions = { mode: $ }), u(e, s, f);
358
+ }), JSON.stringify(e, null, 2);
359
+ }, E = (r) => /[",\n]/.test(r) ? `"${r.replace(/"/g, '""')}"` : r, Z = (r, p) => {
360
+ const h = ["path,themeId,colorId,shadeName,shadeId"];
361
+ return p.tokens.forEach((c) => {
362
+ const m = c.pathNames.join("/");
363
+ c.refs.forEach((i) => {
364
+ if (i.shadeId === null) {
365
+ h.push(`${E(m)},${E(i.themeId)},,,`);
366
+ return;
367
+ }
368
+ const o = j(i.shadeId);
369
+ if (!o) {
370
+ h.push(
371
+ `${E(m)},${E(i.themeId)},,,${E(i.shadeId)}`
372
+ );
373
+ return;
374
+ }
375
+ h.push(
376
+ `${E(m)},${E(i.themeId)},${E(o.colorId)},${E(o.shadeName)},${E(i.shadeId)}`
377
+ );
378
+ });
379
+ }), h.join(`
380
+ `);
381
+ }, q = (r, p) => {
382
+ const { bound: h, unbound: c } = w(r, p), m = x(r), i = r.themes.find((t) => t.type === "default theme") ?? m[0], o = [];
383
+ c.length > 0 && (o.push("/* Unbound semantic tokens */"), c.forEach((t) => o.push(`/* ${t.pathNames.join("-")} */`)), o.push(""));
384
+ const e = (t) => `--${t.map((s) => new d(s).doKebabCase()).join("-")}`, u = (t, s) => `var(--${new d(t).doKebabCase()}-${s})`, a = [];
385
+ return h.forEach((t) => {
386
+ const s = g(r, t), n = s.find((l) => l.themeId === i.id && !l.isUnbound) ?? s.find((l) => !l.isUnbound);
387
+ !n || !n.colorName || !n.shadeName || a.push(
388
+ ` ${e(t.pathNames)}: ${u(n.colorName, n.shadeName)};`
389
+ );
390
+ }), o.push(":root {"), o.push(...a), o.push("}"), m.filter((t) => t.type === "custom theme").forEach((t) => {
391
+ const s = [];
392
+ h.forEach((n) => {
393
+ const l = g(r, n), f = l.find((b) => b.themeId === t.id), $ = l.find((b) => b.themeId === i.id && !b.isUnbound) ?? l.find((b) => !b.isUnbound);
394
+ !f || f.isUnbound || !f.colorName || !f.shadeName || $ && $.colorName === f.colorName && $.shadeName === f.shadeName || s.push(
395
+ ` ${e(n.pathNames)}: ${u(f.colorName, f.shadeName)};`
396
+ );
397
+ }), s.length !== 0 && (o.push(""), o.push(`/* ${t.name} */`), o.push(`:root[data-theme='${new d(t.name).doKebabCase()}'] {`), o.push(...s), o.push("}"));
398
+ }), o.join(`
399
+ `);
400
+ }, W = (r, p) => {
401
+ const { bound: h, unbound: c } = w(r, p), m = x(r), i = r.themes.find((t) => t.type === "default theme") ?? m[0], o = m.filter((t) => t.type === "custom theme"), e = ["import androidx.compose.ui.graphics.Color", ""];
402
+ c.length > 0 && (e.push("// Unbound semantic tokens"), c.forEach((t) => e.push(`// ${t.pathNames.join("-")}`)), e.push(""));
403
+ const u = (t) => t.map((s) => new d(s).doSnakeCase()).join("_"), a = (t, s, n) => {
404
+ const l = new d(s).doSnakeCase(), f = n === "source" ? "source" : n;
405
+ return t ? `${new d(t).doSnakeCase()}_${l}_${f}` : `${l}_${f}`;
406
+ };
407
+ return o.length === 0 ? h.forEach((t) => {
408
+ const s = g(r, t), n = s.find((l) => l.themeId === i.id && !l.isUnbound) ?? s.find((l) => !l.isUnbound);
409
+ !n || !n.colorName || !n.shadeName || e.push(
410
+ `val ${u(t.pathNames)} = ${a(null, n.colorName, n.shadeName)}`
411
+ );
412
+ }) : m.forEach((t) => {
413
+ const s = new d(t.name).doSnakeCase();
414
+ e.push(`// ${t.name}`), h.forEach((n) => {
415
+ const f = g(r, n).find(($) => $.themeId === t.id);
416
+ !f || f.isUnbound || !f.colorName || !f.shadeName || e.push(
417
+ `val ${s}_${u(n.pathNames)} = ${a(t.name, f.colorName, f.shadeName)}`
418
+ );
419
+ }), e.push("");
420
+ }), e.join(`
421
+ `).replace(/\n+$/, `
422
+ `);
423
+ }, Q = (r) => {
424
+ const p = r.themes.filter((i) => i.type === "custom theme").length === 0 ? r.themes.filter((i) => i.type === "default theme") : r.themes.filter((i) => i.type === "custom theme"), h = {}, c = (i) => (isNaN(i.hsl[0]) && (i.hsl[0] = 0), isNaN(i.lch[2]) && (i.lch[2] = 0), isNaN(i.oklch[2]) && (i.oklch[2] = 0), {
425
+ rgb: {
426
+ r: Math.floor(i.rgb[0]),
427
+ g: Math.floor(i.rgb[1]),
428
+ b: Math.floor(i.rgb[2])
429
+ },
430
+ gl: {
431
+ r: parseFloat(i.gl[0].toFixed(3)),
432
+ g: parseFloat(i.gl[1].toFixed(3)),
433
+ b: parseFloat(i.gl[2].toFixed(3))
434
+ },
435
+ lch: {
436
+ l: Math.floor(i.lch[0]),
437
+ c: Math.floor(i.lch[1]),
438
+ h: Math.floor(i.lch[2])
439
+ },
440
+ oklch: {
441
+ l: parseFloat(i.oklch[0].toFixed(3)),
442
+ c: parseFloat(i.oklch[1].toFixed(3)),
443
+ h: Math.floor(i.oklch[2])
444
+ },
445
+ lab: {
446
+ l: Math.floor(i.lab[0]),
447
+ a: Math.floor(i.lab[1]),
448
+ b: Math.floor(i.lab[2])
449
+ },
450
+ oklab: {
451
+ l: parseFloat(i.oklab[0].toFixed(3)),
452
+ a: parseFloat(i.oklab[1].toFixed(3)),
453
+ b: parseFloat(i.oklab[2].toFixed(3))
454
+ },
455
+ hsl: {
456
+ h: Math.floor(i.hsl[0]),
457
+ s: Math.floor(i.hsl[1] * 100),
458
+ l: Math.floor(i.hsl[2] * 100)
459
+ },
460
+ hsluv: {
461
+ h: Math.floor(i.hsluv[0]),
462
+ s: Math.floor(i.hsluv[1]),
463
+ l: Math.floor(i.hsluv[2])
464
+ },
465
+ hex: i.hex,
466
+ description: i.description,
467
+ type: "color shade/tint"
468
+ }), m = (i, o) => ({
469
+ rgb: {
470
+ r: Math.floor(o.rgb[0]),
471
+ g: Math.floor(o.rgb[1]),
472
+ b: Math.floor(o.rgb[2])
473
+ },
474
+ gl: {
475
+ r: parseFloat(o.gl[0].toFixed(3)),
476
+ g: parseFloat(o.gl[1].toFixed(3)),
477
+ b: parseFloat(o.gl[2].toFixed(3))
478
+ },
479
+ lch: {
480
+ l: Math.floor(o.lch[0]),
481
+ c: Math.floor(o.lch[1]),
482
+ h: Math.floor(o.lch[2])
483
+ },
484
+ oklch: {
485
+ l: parseFloat(o.oklch[0].toFixed(3)),
486
+ c: parseFloat(o.oklch[1].toFixed(3)),
487
+ h: Math.floor(o.oklch[2])
488
+ },
489
+ lab: {
490
+ l: Math.floor(o.lab[0]),
491
+ a: Math.floor(o.lab[1]),
492
+ b: Math.floor(o.lab[2])
493
+ },
494
+ oklab: {
495
+ l: parseFloat(o.oklab[0].toFixed(3)),
496
+ a: parseFloat(o.oklab[1].toFixed(3)),
497
+ b: parseFloat(o.oklab[2].toFixed(3))
498
+ },
499
+ hsl: {
500
+ h: Math.floor(o.hsl[0]),
501
+ s: Math.floor(o.hsl[1] * 100),
502
+ l: Math.floor(o.hsl[2] * 100)
503
+ },
504
+ hsluv: {
505
+ h: Math.floor(o.hsluv[0]),
506
+ s: Math.floor(o.hsluv[1]),
507
+ l: Math.floor(o.hsluv[2])
508
+ },
509
+ hex: o.hex,
510
+ alpha: i.alpha,
511
+ description: i.description,
512
+ type: "color shade/tint"
513
+ });
514
+ return p[0].type === "custom theme" ? p.forEach((i) => {
515
+ h[i.name] = {}, i.colors.forEach((o) => {
516
+ const e = o.shades.find(
517
+ (u) => u.type === "source color"
518
+ );
519
+ h[i.name][o.name] = {}, o.shades.forEach((u) => {
520
+ u && e && (h[i.name][o.name][u.name] = u.isTransparent ? m(u, e) : c(u));
521
+ }), h[i.name][o.name].description = o.description, h[i.name][o.name].type = "color";
522
+ }), h[i.name].description = i.description, h[i.name].type = "color mode";
523
+ }) : p.forEach((i) => {
524
+ i.colors.forEach((o) => {
525
+ const e = o.shades.find(
526
+ (u) => u.type === "source color"
527
+ );
528
+ h[o.name] = {}, o.shades.forEach((u) => {
529
+ u && e && (h[o.name][u.name] = u.isTransparent ? m(u, e) : c(u));
530
+ }), h[o.name].description = o.description, h[o.name].type = "color";
531
+ });
532
+ }), h.description = r.description, h.type = "color palette", JSON.stringify(h, null, " ");
533
+ }, Y = (r) => {
534
+ const p = r.themes.filter((c) => c.type === "custom theme").length === 0 ? r.themes.filter((c) => c.type === "default theme") : r.themes.filter((c) => c.type === "custom theme"), h = [];
535
+ return p.forEach((c) => {
536
+ const m = [];
537
+ c.colors.forEach((i) => {
538
+ const o = i.shades.find((e) => e.type === "source color");
539
+ m.push(`// ${i.name}`), i.shades.reverse().forEach((e) => {
540
+ m.push(
541
+ e.isTransparent ? `static let ${new d(i.name).doPascalCase()}${e.name === "source" ? "Source" : e.name} = UIColor(red: ${o == null ? void 0 : o.gl[0].toFixed(
542
+ 3
543
+ )}, green: ${o == null ? void 0 : o.gl[1].toFixed(3)}, blue: ${o == null ? void 0 : o.gl[2].toFixed(
544
+ 3
545
+ )}, alpha: ${e.alpha ?? 1})` : `static let ${new d(i.name).doPascalCase()}${e.name === "source" ? "Source" : e.name} = UIColor(red: ${e.gl[0].toFixed(
546
+ 3
547
+ )}, green: ${e.gl[1].toFixed(3)}, blue: ${e.gl[2].toFixed(
548
+ 3
549
+ )})`
550
+ );
551
+ }), m.push("");
552
+ }), m.pop(), p[0].type === "custom theme" ? h.push(
553
+ `// ${c.name}
554
+ struct ${new d(c.name).doPascalCase()} {
555
+ ${m.join(
556
+ `
557
+ `
558
+ )}
559
+ }`
560
+ ) : h.push(`${m.join(`
561
+ `)}`);
562
+ }), `import UIKit
563
+
564
+ struct Color {
565
+ ${h.join(`
566
+
567
+ `)}
568
+ }`;
569
+ }, D = (r) => {
570
+ const p = r.themes.filter((c) => c.type === "custom theme").length === 0 ? r.themes.filter((c) => c.type === "default theme") : r.themes.filter((c) => c.type === "custom theme");
571
+ let h = `@import "tailwindcss";
572
+
573
+ @theme {
574
+ --color-*: initial;
575
+
576
+ `;
577
+ return p[0].type !== "custom theme" ? p.forEach((c) => {
578
+ c.colors.forEach((m) => {
579
+ const i = m.shades.find(
580
+ (a) => a.type === "source color"
581
+ ), o = new d(m.name).doKebabCase();
582
+ h += ` /* ${m.name} */
583
+ `, m.shades.sort().forEach((a) => {
584
+ const t = a.isTransparent ? v((i == null ? void 0 : i.hex) ?? "#000000").alpha(a.alpha ?? 1).hex() : a.hex, s = new d(a.name).doKebabCase();
585
+ h += ` --color-${o}-${s}: ${t};
586
+ `;
587
+ });
588
+ const e = m === c.colors[c.colors.length - 1], u = c === p[p.length - 1];
589
+ e && u || (h += `
590
+ `);
591
+ });
592
+ }) : p.forEach((c) => {
593
+ const m = new d(c.name).doKebabCase();
594
+ c.colors.forEach((i) => {
595
+ const o = i.shades.find(
596
+ (t) => t.type === "source color"
597
+ ), e = new d(i.name).doKebabCase();
598
+ h += ` /* ${c.name} - ${i.name} */
599
+ `, i.shades.forEach((t) => {
600
+ const s = t.isTransparent ? v((o == null ? void 0 : o.hex) ?? "#000000").alpha(t.alpha ?? 1).hex() : t.hex, n = new d(t.name).doKebabCase();
601
+ h += ` --color-${m}-${e}-${n}: ${s};
602
+ `;
603
+ });
604
+ const u = i === c.colors[c.colors.length - 1], a = c === p[p.length - 1];
605
+ u && a || (h += `
606
+ `);
607
+ });
608
+ }), h += `}
609
+ `, h;
610
+ }, ee = (r) => {
611
+ const p = r.themes.filter((c) => c.type === "custom theme").length === 0 ? r.themes.filter((c) => c.type === "default theme") : r.themes.filter((c) => c.type === "custom theme"), h = {
612
+ theme: {
613
+ colors: {}
614
+ }
615
+ };
616
+ return r.themes[0].colors.forEach((c) => {
617
+ h.theme.colors[new d(c.name).doKebabCase()] = {};
618
+ }), p[0].type === "custom theme" ? p.forEach((c) => {
619
+ c.colors.forEach((m) => {
620
+ const i = m.shades.find(
621
+ (o) => o.type === "source color"
622
+ );
623
+ h.theme.colors[new d(m.name).doKebabCase()][new d(c.name).doKebabCase()] = {}, m.shades.forEach((o) => {
624
+ h.theme.colors[new d(m.name).doKebabCase()][new d(c.name).doKebabCase()][new d(o.name).doKebabCase()] = o.isTransparent ? v((i == null ? void 0 : i.hex) ?? "#000000").alpha(o.alpha ?? 1).hex() : o.hex;
625
+ });
626
+ });
627
+ }) : p.forEach((c) => {
628
+ c.colors.forEach((m) => {
629
+ const i = m.shades.find(
630
+ (o) => o.type === "source color"
631
+ );
632
+ h.theme.colors[new d(m.name).doKebabCase()] = {}, m.shades.sort().forEach((o) => {
633
+ h.theme.colors[new d(m.name).doKebabCase()][new d(o.name).doKebabCase()] = o.isTransparent ? v((i == null ? void 0 : i.hex) ?? "#000000").alpha(o.alpha ?? 1).hex() : o.hex;
634
+ });
635
+ });
636
+ }), `/** @type {import('tailwindcss').Config} */
637
+ module.exports = ${JSON.stringify(h, null, " ")}`;
638
+ }, oe = (r) => {
639
+ const p = r.themes.filter((c) => c.type === "custom theme").length === 0 ? r.themes.filter((c) => c.type === "default theme") : r.themes.filter((c) => c.type === "custom theme"), h = [];
640
+ return p.forEach((c) => {
641
+ c.colors.forEach((m) => {
642
+ const i = m.shades.find((e) => e.type === "source color"), o = [];
643
+ o.push(
644
+ `// ${p[0].type === "custom theme" ? c.name + " - " : ""}${m.name}`
645
+ ), m.shades.reverse().forEach((e) => {
646
+ o.push(
647
+ e.isTransparent ? `public let ${p[0].type === "custom theme" ? new d(c.name + " " + m.name).doPascalCase() : new d(m.name).doPascalCase()}${e.name === "source" ? "Source" : e.name} = Color(red: ${i == null ? void 0 : i.gl[0].toFixed(
648
+ 3
649
+ )}, green: ${i == null ? void 0 : i.gl[1].toFixed(3)}, blue: ${e.gl[2].toFixed(
650
+ 3
651
+ )}).opacity(${e.alpha ?? 1})` : `public let ${p[0].type === "custom theme" ? new d(c.name + " " + m.name).doPascalCase() : new d(m.name).doPascalCase()}${e.name === "source" ? "Source" : e.name} = Color(red: ${e.gl[0].toFixed(
652
+ 3
653
+ )}, green: ${e.gl[1].toFixed(3)}, blue: ${e.gl[2].toFixed(
654
+ 3
655
+ )})`
656
+ );
657
+ }), o.push(""), o.forEach((e) => h.push(e));
658
+ });
659
+ }), h.pop(), `import SwiftUI
660
+
661
+ public extension Color {
662
+ static let Token = Color.TokenColor()
663
+ struct TokenColor {
664
+ ${h.join(
665
+ `
666
+ `
667
+ )}
668
+ }
669
+ }`;
670
+ }, te = (r) => {
671
+ const p = r.themes.filter((m) => m.type === "custom theme").length === 0 ? r.themes.filter((m) => m.type === "default theme") : r.themes.filter((m) => m.type === "custom theme"), h = {
672
+ color: {}
673
+ }, c = (m, i, o) => ({
674
+ type: "color",
675
+ value: i.isTransparent ? v(o.hex).alpha(i.alpha ?? 1).hex() : i.hex,
676
+ comment: m.description !== "" ? m.description + " - " + i.description : i.description
677
+ });
678
+ return r.themes[0].colors.forEach((m) => {
679
+ h.color[m.name] = {};
680
+ }), p[0].type === "custom theme" ? p.forEach((m) => {
681
+ m.colors.forEach((i) => {
682
+ const o = i.shades.find(
683
+ (e) => e.type === "source color"
684
+ );
685
+ h.color[i.name][m.name] = {}, i.shades.forEach((e) => {
686
+ e && o && (h.color[i.name][m.name][e.name] = c(
687
+ i,
688
+ e,
689
+ o
690
+ ));
691
+ });
692
+ });
693
+ }) : p.forEach((m) => {
694
+ m.colors.forEach((i) => {
695
+ const o = i.shades.find(
696
+ (e) => e.type === "source color"
697
+ );
698
+ h.color[i.name] = {}, i.shades.forEach((e) => {
699
+ e && o && (h.color[i.name][e.name] = c(i, e, o));
700
+ });
701
+ });
702
+ }), JSON.stringify(h, null, " ");
703
+ }, se = (r, p) => {
704
+ const h = r.themes.filter((s) => s.type === "custom theme").length === 0 ? r.themes.filter((s) => s.type === "default theme") : r.themes.filter((s) => s.type === "custom theme"), c = [], m = [], i = (s) => {
705
+ var l;
706
+ isNaN(s.hsl[0]) && (s.hsl[0] = 0), isNaN(s.lch[2]) && (s.lch[2] = 0), isNaN(s.oklch[2]) && (s.oklch[2] = 0);
707
+ const n = {
708
+ RGB: () => `rgb(${Math.floor(s.rgb[0])} ${Math.floor(
709
+ s.rgb[1]
710
+ )} ${Math.floor(s.rgb[2])})`,
711
+ HEX: () => s.hex,
712
+ HSL: () => `hsl(${Math.floor(s.hsl[0])} ${Math.floor(
713
+ s.hsl[1] * 100
714
+ )}% ${Math.floor(s.hsl[2] * 100)}%)`,
715
+ LCH: () => `lch(${Math.floor(s.lch[0])}% ${Math.floor(
716
+ s.lch[1]
717
+ )} ${Math.floor(s.lch[2])})`,
718
+ OKLCH: () => `oklch(${Math.floor(s.oklch[0] * 100)}% ${s.oklch[1].toFixed(3)} ${Math.floor(s.oklch[2])})`
719
+ };
720
+ return (l = n[p ?? "RGB"]) == null ? void 0 : l.call(n);
721
+ }, o = (s, n) => {
722
+ var f;
723
+ isNaN(s.hsl[0]) && (s.hsl[0] = 0), isNaN(s.lch[2]) && (s.lch[2] = 0), isNaN(s.oklch[2]) && (s.oklch[2] = 0);
724
+ const l = {
725
+ RGB: () => {
726
+ var $;
727
+ return `rgb(${Math.floor(n.rgb[0])} ${Math.floor(
728
+ n.rgb[1]
729
+ )} ${Math.floor(n.rgb[2])} / ${(($ = s.alpha) == null ? void 0 : $.toFixed(2)) ?? 1})`;
730
+ },
731
+ HEX: () => v(n.hex).alpha(s.alpha ?? 1).hex(),
732
+ HSL: () => {
733
+ var $;
734
+ return `hsl(${Math.floor(n.hsl[0])} ${Math.floor(
735
+ n.hsl[1] * 100
736
+ )}%, ${Math.floor(n.hsl[2] * 100)}% / ${(($ = s.alpha) == null ? void 0 : $.toFixed(2)) ?? 1})`;
737
+ },
738
+ LCH: () => {
739
+ var $;
740
+ return `lch(${Math.floor(n.lch[0])}% ${Math.floor(
741
+ n.lch[1]
742
+ )} ${Math.floor(n.lch[2])} / ${(($ = s.alpha) == null ? void 0 : $.toFixed(2)) ?? 1})`;
743
+ },
744
+ OKLCH: () => {
745
+ var $;
746
+ return `oklch(${Math.floor(n.oklch[0 * 100])}% ${n.oklch[1].toFixed(3)} ${Math.floor(n.oklch[2])} / ${(($ = s.alpha) == null ? void 0 : $.toFixed(2)) ?? 1})`;
747
+ }
748
+ };
749
+ return (f = l[p ?? "RGB"]) == null ? void 0 : f.call(l);
750
+ }, e = h.find(
751
+ (s) => s.type === "default theme"
752
+ );
753
+ if (e) {
754
+ const s = [];
755
+ return e.colors.forEach((n, l) => {
756
+ l > 0 && s.push(""), s.push(`// ${n.name}`), n.shades.reverse().forEach((f) => {
757
+ const $ = n.shades.find((N) => N.type === "source color"), b = `$${new d(n.name).doKebabCase()}-${f.name}`;
758
+ $ && s.push(
759
+ `${b}: ${f.isTransparent ? o(f, $) : i(f)};`
760
+ );
761
+ });
762
+ }), c.push(s.join(`
763
+ `)), c.join(`
764
+ `);
765
+ }
766
+ h.forEach((s) => {
767
+ const n = new d(s.name).doKebabCase(), l = [];
768
+ l.push(`// ${s.name}`), l.push(`@mixin ${n} {`), s.colors.forEach((f, $) => {
769
+ $ > 0 && l.push(""), l.push(` // ${f.name}`), f.shades.reverse().forEach((b) => {
770
+ const N = f.shades.find((k) => k.type === "source color"), T = `--${new d(f.name).doKebabCase()}-${b.name}`;
771
+ N && l.push(
772
+ ` ${T}: ${b.isTransparent ? o(b, N) : i(b)};`
773
+ );
774
+ });
775
+ }), l.push("}"), c.push(l.join(`
776
+ `));
777
+ });
778
+ const u = /* @__PURE__ */ new Set();
779
+ if (h.forEach((s) => {
780
+ s.colors.forEach((n) => {
781
+ n.shades.forEach((l) => {
782
+ if (n.shades.find(($) => $.type === "source color")) {
783
+ const b = `--${new d(n.name).doKebabCase()}-${l.name}`;
784
+ u.add(b);
785
+ }
786
+ });
787
+ });
788
+ }), u.size > 0) {
789
+ const s = /* @__PURE__ */ new Map();
790
+ u.forEach((n) => {
791
+ const l = n.match(/--([a-zA-Z0-9-]+)-([a-zA-Z0-9-]+)/);
792
+ if (l) {
793
+ const f = l[1];
794
+ s.has(f) || s.set(f, []);
795
+ const $ = `$${n.substring(2)}`;
796
+ s.get(f).push(`${$}: var(${n});`);
797
+ }
798
+ }), s.forEach((n, l) => {
799
+ m.push(
800
+ `// ${l.charAt(0).toUpperCase() + l.slice(1)}`
801
+ ), m.push(...n), m.push("");
802
+ }), m.length > 0 && m[m.length - 1] === "" && m.pop(), c.push(m.join(`
803
+ `));
804
+ }
805
+ const a = [":root {"];
806
+ h.forEach((s, n) => {
807
+ const l = new d(s.name).doKebabCase();
808
+ a.push(` &[data-theme="${l}"] {
809
+ @include ${l};
810
+ }`), n !== h.length - 1 && a.push("");
811
+ }), a.push("}"), c.push(a.join(`
812
+ `));
813
+ const t = [];
814
+ return h.forEach((s) => {
815
+ const n = new d(s.name).doKebabCase();
816
+ t.push(`.${n} {
817
+ @include ${n};
818
+ }`);
819
+ }), c.push(t.join(`
820
+
821
+ `)), c.join(`
822
+
823
+ `);
824
+ }, ne = (r) => {
825
+ const p = r.themes.filter((c) => c.type === "custom theme").length === 0 ? r.themes.filter((c) => c.type === "default theme") : r.themes.filter((c) => c.type === "custom theme"), h = [];
826
+ return p.forEach((c) => {
827
+ c.colors.forEach((m) => {
828
+ const i = m.shades.find((e) => e.type === "source color"), o = [];
829
+ o.push(
830
+ `<!--${p[0].type === "custom theme" ? `${c.name} - ${m.name}-->` : `${m.name}-->`}`
831
+ ), m.shades.reverse().forEach((e) => {
832
+ o.push(
833
+ `<color name="${p[0].type === "custom theme" ? new d(c.name + " " + m.name).doSnakeCase() : new d(m.name).doSnakeCase()}_${e.name}">${e.isTransparent ? v((i == null ? void 0 : i.hex) ?? "#000000").alpha(e.alpha ?? 1).hex() : e.hex}</color>`
834
+ );
835
+ }), o.push(""), o.forEach((e) => h.push(e));
836
+ });
837
+ }), h.pop(), `<?xml version="1.0" encoding="utf-8"?>
838
+ <resources>
839
+ ${h.join(
840
+ `
841
+ `
842
+ )}
843
+ </resources>`;
844
+ }, ae = (r, p) => {
845
+ const h = r.themes.filter((a) => a.type === "custom theme").length === 0 ? r.themes.filter((a) => a.type === "default theme") : r.themes.filter((a) => a.type === "custom theme"), c = [], m = (a) => {
846
+ var s;
847
+ isNaN(a.hsl[0]) && (a.hsl[0] = 0), isNaN(a.lch[2]) && (a.lch[2] = 0), isNaN(a.oklch[2]) && (a.oklch[2] = 0);
848
+ const t = {
849
+ RGB: () => `rgb(${Math.floor(a.rgb[0])} ${Math.floor(
850
+ a.rgb[1]
851
+ )} ${Math.floor(a.rgb[2])})`,
852
+ HEX: () => a.hex,
853
+ HSL: () => `hsl(${Math.floor(a.hsl[0])} ${Math.floor(
854
+ a.hsl[1] * 100
855
+ )}% ${Math.floor(a.hsl[2] * 100)}%)`,
856
+ LCH: () => `lch(${Math.floor(a.lch[0])}% ${Math.floor(
857
+ a.lch[1]
858
+ )} ${Math.floor(a.lch[2])})`,
859
+ OKLCH: () => `oklch(${Math.floor(a.oklch[0] * 100)}% ${a.oklch[1].toFixed(3)} ${Math.floor(a.oklch[2])})`
860
+ };
861
+ return (s = t[p ?? "RGB"]) == null ? void 0 : s.call(t);
862
+ }, i = (a, t) => {
863
+ var n;
864
+ isNaN(a.hsl[0]) && (a.hsl[0] = 0), isNaN(a.lch[2]) && (a.lch[2] = 0), isNaN(a.oklch[2]) && (a.oklch[2] = 0);
865
+ const s = {
866
+ RGB: () => {
867
+ var l;
868
+ return `rgb(${Math.floor(t.rgb[0])} ${Math.floor(
869
+ t.rgb[1]
870
+ )} ${Math.floor(t.rgb[2])} / ${((l = a.alpha) == null ? void 0 : l.toFixed(2)) ?? 1})`;
871
+ },
872
+ HEX: () => v(t.hex).alpha(a.alpha ?? 1).hex(),
873
+ HSL: () => {
874
+ var l;
875
+ return `hsl(${Math.floor(t.hsl[0])} ${Math.floor(
876
+ t.hsl[1] * 100
877
+ )}% ${Math.floor(t.hsl[2] * 100)}% / ${((l = a.alpha) == null ? void 0 : l.toFixed(2)) ?? 1})`;
878
+ },
879
+ LCH: () => {
880
+ var l;
881
+ return `lch(${Math.floor(t.lch[0])}% ${Math.floor(
882
+ t.lch[1]
883
+ )} ${Math.floor(t.lch[2])} / ${((l = a.alpha) == null ? void 0 : l.toFixed(2)) ?? 1})`;
884
+ },
885
+ OKLCH: () => {
886
+ var l;
887
+ return `oklch(${Math.floor(t.oklch[0] * 100)}% ${t.oklch[1].toFixed(3)} ${Math.floor(t.oklch[2])} / ${((l = a.alpha) == null ? void 0 : l.toFixed(2)) ?? 1})`;
888
+ }
889
+ };
890
+ return (n = s[p ?? "RGB"]) == null ? void 0 : n.call(s);
891
+ }, o = h.find(
892
+ (a) => a.type === "default theme"
893
+ );
894
+ if (o) {
895
+ const a = [];
896
+ return o.colors.forEach((t, s) => {
897
+ s > 0 && a.push(""), a.push(`// ${t.name}`), t.shades.reverse().forEach((n) => {
898
+ const l = t.shades.find(($) => $.type === "source color"), f = `@${new d(t.name).doKebabCase()}-${n.name}`;
899
+ l && a.push(
900
+ `${f}: ${n.isTransparent ? i(n, l) : m(n)};`
901
+ );
902
+ });
903
+ }), c.push(a.join(`
904
+ `)), c.join(`
905
+ `);
906
+ }
907
+ h.forEach((a) => {
908
+ const t = new d(a.name).doKebabCase(), s = [];
909
+ s.push(`// ${a.name}`), s.push(`.${t}() {`), a.colors.forEach((n, l) => {
910
+ l > 0 && s.push(""), s.push(` // ${n.name}`), n.shades.reverse().forEach((f) => {
911
+ const $ = n.shades.find((N) => N.type === "source color"), b = `@${new d(n.name).doKebabCase()}-${f.name}`;
912
+ $ && s.push(
913
+ ` ${b}: ${f.isTransparent ? i(f, $) : m(f)};`
914
+ );
915
+ });
916
+ }), s.push("}"), c.push(s.join(`
917
+ `));
918
+ });
919
+ const e = [":root {"];
920
+ h.forEach((a, t) => {
921
+ const s = new d(a.name).doKebabCase();
922
+ e.push(` &[data-theme="${s}"] {
923
+ .${s}();
924
+ }`), t !== h.length - 1 && e.push("");
925
+ }), e.push("}"), c.push(e.join(`
926
+ `));
927
+ const u = [];
928
+ return h.forEach((a) => {
929
+ const t = new d(a.name).doKebabCase();
930
+ u.push(`.${t} {
931
+ .${t}();
932
+ }`);
933
+ }), c.push(u.join(`
934
+
935
+ `)), c.join(`
936
+
937
+ `);
938
+ }, ie = (r, p) => {
939
+ const h = r.themes.filter((o) => o.type === "custom theme").length === 0 ? r.themes.filter((o) => o.type === "default theme") : r.themes.filter((o) => o.type === "custom theme"), c = {}, m = (o) => {
940
+ var u;
941
+ isNaN(o.oklch[2]) && (o.oklch[2] = 0);
942
+ const e = {
943
+ RGB: () => ({
944
+ colorSpace: "srgb",
945
+ components: [
946
+ parseFloat(o.gl[0].toFixed(3)),
947
+ parseFloat(o.gl[1].toFixed(3)),
948
+ parseFloat(o.gl[2].toFixed(3))
949
+ ],
950
+ hex: o.hex
951
+ }),
952
+ OKLCH: () => ({
953
+ colorSpace: "oklch",
954
+ components: [
955
+ parseFloat(o.oklch[0].toFixed(3)),
956
+ parseFloat(o.oklch[1].toFixed(3)),
957
+ parseFloat(o.oklch[2].toFixed(0))
958
+ ],
959
+ hex: o.hex
960
+ })
961
+ };
962
+ return (u = e[p ?? "RGB"]) == null ? void 0 : u.call(e);
963
+ }, i = (o, e) => {
964
+ var a;
965
+ isNaN(e.oklch[2]) && (e.oklch[2] = 0);
966
+ const u = {
967
+ RGB: () => ({
968
+ colorSpace: "srgb",
969
+ components: [
970
+ parseFloat(o.gl[0].toFixed(3)),
971
+ parseFloat(o.gl[1].toFixed(3)),
972
+ parseFloat(o.gl[2].toFixed(3))
973
+ ],
974
+ hex: o.hex,
975
+ alpha: e.alpha
976
+ }),
977
+ OKLCH: () => ({
978
+ colorSpace: "oklch",
979
+ components: [
980
+ parseFloat(o.oklch[0].toFixed(3)),
981
+ parseFloat(o.oklch[1].toFixed(3)),
982
+ parseFloat(o.oklch[2].toFixed(0))
983
+ ],
984
+ hex: o.hex,
985
+ alpha: e.alpha
986
+ })
987
+ };
988
+ return (a = u[p ?? "RGB"]) == null ? void 0 : a.call(u);
989
+ };
990
+ return h[0].type === "custom theme" ? h.forEach((o) => {
991
+ o.colors.forEach((e) => {
992
+ const u = e.shades.find(
993
+ (a) => a.type === "source color"
994
+ );
995
+ c[e.name] || (c[e.name] = {
996
+ $type: "color"
997
+ }), e.shades.forEach((a) => {
998
+ !c[e.name][a.name] && u && (c[e.name][a.name] = {
999
+ $type: "color",
1000
+ $value: a.isTransparent ? i(u, a) : m(a),
1001
+ $description: e.description !== "" ? e.description + " - " + a.description : a.description,
1002
+ $extensions: {
1003
+ mode: {},
1004
+ "com.uicp.wcag": {},
1005
+ "com.uicp.apca": {}
1006
+ }
1007
+ }), u && (c[e.name][a.name].$extensions.mode[o.name] = a.isTransparent ? i(u, a) : m(a), a.textContrast && (c[e.name][a.name].$extensions["com.uicp.wcag"][o.name] = {
1008
+ light: {
1009
+ score: a.textContrast.wcag.light.score,
1010
+ ratio: a.textContrast.wcag.light.ratio
1011
+ },
1012
+ dark: {
1013
+ score: a.textContrast.wcag.dark.score,
1014
+ ratio: a.textContrast.wcag.dark.ratio
1015
+ }
1016
+ }, c[e.name][a.name].$extensions["com.uicp.apca"][o.name] = {
1017
+ light: {
1018
+ score: a.textContrast.apca.light.lc,
1019
+ recommendation: a.textContrast.apca.light.recommendedUsage
1020
+ },
1021
+ dark: {
1022
+ score: a.textContrast.apca.dark.lc,
1023
+ recommendation: a.textContrast.apca.dark.recommendedUsage
1024
+ }
1025
+ }));
1026
+ });
1027
+ });
1028
+ }) : h.forEach((o) => {
1029
+ o.colors.forEach((e) => {
1030
+ const u = e.shades.find(
1031
+ (a) => a.type === "source color"
1032
+ );
1033
+ c[e.name] = {}, e.shades.forEach((a) => {
1034
+ a && u && (c[e.name][a.name] = {
1035
+ $type: "color",
1036
+ $value: a.isTransparent ? i(u, a) : m(a),
1037
+ $description: e.description !== "" ? e.description + " - " + a.description : a.description,
1038
+ ...a.textContrast && {
1039
+ $extensions: {
1040
+ "com.uicp.wcag": {
1041
+ light: {
1042
+ score: a.textContrast.wcag.light.score,
1043
+ ratio: a.textContrast.wcag.light.ratio
1044
+ },
1045
+ dark: {
1046
+ score: a.textContrast.wcag.dark.score,
1047
+ ratio: a.textContrast.wcag.dark.ratio
1048
+ }
1049
+ },
1050
+ "com.uicp.apca": {
1051
+ light: {
1052
+ score: a.textContrast.apca.light.lc,
1053
+ recommendation: a.textContrast.apca.light.recommendedUsage
1054
+ },
1055
+ dark: {
1056
+ score: a.textContrast.apca.dark.lc,
1057
+ recommendation: a.textContrast.apca.dark.recommendedUsage
1058
+ }
1059
+ }
1060
+ }
1061
+ }
1062
+ });
1063
+ });
1064
+ });
1065
+ }), JSON.stringify(c, null, " ");
1066
+ }, re = (r) => {
1067
+ const p = r.themes.filter((u) => u.type === "custom theme").length === 0 ? r.themes.filter((u) => u.type === "default theme") : r.themes.filter((u) => u.type === "custom theme"), h = [], c = [], m = [], i = [], o = [], e = [];
1068
+ return p.forEach((u) => {
1069
+ u.colors.forEach((a) => {
1070
+ a.shades.forEach((t) => {
1071
+ m.push(t.name), i.push(Math.floor(t.lch[0])), o.push(Math.floor(t.lch[1])), e.push(Math.floor(t.lch[2]));
1072
+ }), h.push({
1073
+ name: a.name,
1074
+ csv: `${a.name},Lightness,Chroma,Hue
1075
+ ${m.map((t, s) => `${t},${i[s]},${o[s]},${e[s]}`).join(`
1076
+ `)}`
1077
+ }), m.splice(0, m.length), i.splice(0, i.length), o.splice(0, o.length), e.splice(0, e.length);
1078
+ }), c.push({
1079
+ name: u.name,
1080
+ colors: h.map((a) => a),
1081
+ type: u.type
1082
+ }), h.splice(0, h.length);
1083
+ }), c;
1084
+ }, ce = (r, p) => {
1085
+ const h = r.themes.filter((o) => o.type === "custom theme").length === 0 ? r.themes.filter((o) => o.type === "default theme") : r.themes.filter((o) => o.type === "custom theme"), c = [], m = (o) => {
1086
+ var u;
1087
+ isNaN(o.hsl[0]) && (o.hsl[0] = 0), isNaN(o.lch[2]) && (o.lch[2] = 0), isNaN(o.oklch[2]) && (o.oklch[2] = 0);
1088
+ const e = {
1089
+ RGB: () => `rgb(${Math.floor(o.rgb[0])} ${Math.floor(
1090
+ o.rgb[1]
1091
+ )} ${Math.floor(o.rgb[2])})`,
1092
+ HEX: () => o.hex,
1093
+ HSL: () => `hsl(${Math.floor(o.hsl[0])} ${Math.floor(
1094
+ o.hsl[1] * 100
1095
+ )}% ${Math.floor(o.hsl[2] * 100)}%)`,
1096
+ LCH: () => `lch(${Math.floor(o.lch[0])}% ${Math.floor(
1097
+ o.lch[1]
1098
+ )} ${Math.floor(o.lch[2])})`,
1099
+ OKLCH: () => `oklch(${Math.floor(o.oklch[0] * 100)}% ${o.oklch[1].toFixed(3)} ${Math.floor(o.oklch[2])})`,
1100
+ P3: () => `color(display-p3 ${o.gl[0].toFixed(3)} ${o.gl[1].toFixed(
1101
+ 3
1102
+ )} ${o.gl[2].toFixed(3)})`
1103
+ };
1104
+ return (u = e[p ?? "RGB"]) == null ? void 0 : u.call(e);
1105
+ }, i = (o, e) => {
1106
+ var a;
1107
+ isNaN(o.hsl[0]) && (o.hsl[0] = 0), isNaN(o.lch[2]) && (o.lch[2] = 0), isNaN(o.oklch[2]) && (o.oklch[2] = 0);
1108
+ const u = {
1109
+ RGB: () => {
1110
+ var t;
1111
+ return `rgb(${Math.floor(e.rgb[0])} ${Math.floor(
1112
+ e.rgb[1]
1113
+ )} ${Math.floor(e.rgb[2])} / ${((t = o.alpha) == null ? void 0 : t.toFixed(2)) ?? 1})`;
1114
+ },
1115
+ HEX: () => v(e.hex).alpha(o.alpha ?? 1).hex(),
1116
+ HSL: () => {
1117
+ var t;
1118
+ return `hsl(${Math.floor(e.hsl[0])} ${Math.floor(
1119
+ e.hsl[1] * 100
1120
+ )}% ${Math.floor(e.hsl[2] * 100)}% / ${((t = o.alpha) == null ? void 0 : t.toFixed(2)) ?? 1})`;
1121
+ },
1122
+ LCH: () => {
1123
+ var t;
1124
+ return `lch(${Math.floor(e.lch[0])}% ${Math.floor(
1125
+ e.lch[1]
1126
+ )} ${Math.floor(e.lch[2])} / ${((t = o.alpha) == null ? void 0 : t.toFixed(2)) ?? 1})`;
1127
+ },
1128
+ OKLCH: () => {
1129
+ var t;
1130
+ return `oklch(${Math.floor(e.oklch[0 * 100])}% ${e.oklch[1].toFixed(3)} ${Math.floor(e.oklch[2])} / ${((t = o.alpha) == null ? void 0 : t.toFixed(2)) ?? 1})`;
1131
+ },
1132
+ P3: () => {
1133
+ var t;
1134
+ return `color(display-p3 ${e.gl[0].toFixed(3)} ${e.gl[1].toFixed(
1135
+ 3
1136
+ )} ${e.gl[2].toFixed(3)} / ${((t = o.alpha) == null ? void 0 : t.toFixed(2)) ?? 1})`;
1137
+ }
1138
+ };
1139
+ return (a = u[p ?? "RGB"]) == null ? void 0 : a.call(u);
1140
+ };
1141
+ return h.forEach((o) => {
1142
+ const e = [];
1143
+ o.colors.forEach((u) => {
1144
+ e.push(`/* ${u.name} */`), u.shades.reverse().forEach((a) => {
1145
+ const t = u.shades.find((s) => s.type === "source color");
1146
+ t && e.push(
1147
+ `--${new d(u.name).doKebabCase()}-${a.name}: ${a.isTransparent ? i(a, t) : m(a)};`
1148
+ );
1149
+ }), e.push("");
1150
+ }), e.pop(), c.push(
1151
+ `${o.type === "custom theme" ? `/* ${o.name} */
1152
+ ` : ""}:root${o.type === "custom theme" ? `[data-theme='${new d(o.name).doKebabCase()}']` : ""} {
1153
+ ${e.join(`
1154
+ `)}
1155
+ }`
1156
+ );
1157
+ }), c.join(`
1158
+
1159
+ `);
1160
+ }, he = (r) => {
1161
+ const p = r.themes.filter((c) => c.type === "custom theme").length === 0 ? r.themes.filter((c) => c.type === "default theme") : r.themes.filter((c) => c.type === "custom theme"), h = [];
1162
+ return p.forEach((c) => {
1163
+ c.colors.forEach((m) => {
1164
+ const i = m.shades.find((e) => e.type === "source color"), o = [];
1165
+ o.push(
1166
+ `// ${p[0].type === "custom theme" ? c.name + " - " : ""}${m.name}`
1167
+ ), m.shades.reverse().forEach((e) => {
1168
+ o.push(
1169
+ `val ${p[0].type === "custom theme" ? new d(c.name + " " + m.name).doSnakeCase() : new d(m.name).doSnakeCase()}_${e.name} = Color(${e.isTransparent ? v((i == null ? void 0 : i.hex) ?? "#000000").alpha(e.alpha ?? 1).hex().replace("#", "0xFF").toUpperCase() : e.hex.replace("#", "0xFF").toUpperCase()})`
1170
+ );
1171
+ }), o.push(""), o.forEach((e) => h.push(e));
1172
+ });
1173
+ }), h.pop(), `import androidx.compose.ui.graphics.Color
1174
+
1175
+ ${h.join(`
1176
+ `)}`;
1177
+ };
1178
+ class fe {
1179
+ constructor({
1180
+ paletteData: p,
1181
+ systemData: h
1182
+ }) {
1183
+ C(this, "paletteData");
1184
+ C(this, "systemData");
1185
+ C(this, "wrap", (p, h, c, m, i) => {
1186
+ const o = [
1187
+ { filename: p, content: h, mimeType: c }
1188
+ ];
1189
+ return i !== null && o.push({
1190
+ filename: m,
1191
+ content: i,
1192
+ mimeType: c
1193
+ }), o;
1194
+ });
1195
+ C(this, "makeCssCustomProps", (p = "RGB") => this.wrap(
1196
+ "primitives.css",
1197
+ ce(this.paletteData, p),
1198
+ "text/css",
1199
+ "semantics.css",
1200
+ this.systemData ? q(this.paletteData, this.systemData) : null
1201
+ ));
1202
+ C(this, "makeScssVariables", (p = "RGB") => this.wrap(
1203
+ "primitives.scss",
1204
+ se(this.paletteData, p),
1205
+ "text/x-scss",
1206
+ "semantics.scss",
1207
+ this.systemData ? A(this.paletteData, this.systemData) : null
1208
+ ));
1209
+ C(this, "makeLessVariables", (p = "RGB") => this.wrap(
1210
+ "primitives.less",
1211
+ ae(this.paletteData, p),
1212
+ "text/x-less",
1213
+ "semantics.less",
1214
+ this.systemData ? X(this.paletteData, this.systemData) : null
1215
+ ));
1216
+ C(this, "makeTailwindV3Config", () => this.wrap(
1217
+ "primitives.js",
1218
+ ee(this.paletteData),
1219
+ "text/javascript",
1220
+ "semantics.js",
1221
+ this.systemData ? H(this.paletteData, this.systemData) : null
1222
+ ));
1223
+ C(this, "makeTailwindV4Config", () => this.wrap(
1224
+ "primitives.css",
1225
+ D(this.paletteData),
1226
+ "text/css",
1227
+ "semantics.css",
1228
+ this.systemData ? P(this.paletteData, this.systemData) : null
1229
+ ));
1230
+ C(this, "makeDtcgTokens", (p = "RGB") => this.wrap(
1231
+ "primitives.json",
1232
+ ie(this.paletteData, p),
1233
+ "application/json",
1234
+ "semantics.json",
1235
+ this.systemData ? z(this.paletteData, this.systemData) : null
1236
+ ));
1237
+ C(this, "makeStyleDictionaryV3Tokens", () => this.wrap(
1238
+ "primitives.json",
1239
+ te(this.paletteData),
1240
+ "application/json",
1241
+ "semantics.json",
1242
+ this.systemData ? G(this.paletteData, this.systemData) : null
1243
+ ));
1244
+ C(this, "makeUniversalJson", () => this.wrap(
1245
+ "primitives.json",
1246
+ Q(this.paletteData),
1247
+ "application/json",
1248
+ "semantics.json",
1249
+ this.systemData ? V(this.paletteData, this.systemData) : null
1250
+ ));
1251
+ C(this, "makeNativeTokens", () => this.systemData ? [
1252
+ {
1253
+ filename: "tokens.json",
1254
+ content: J(this.paletteData, this.systemData),
1255
+ mimeType: "application/json"
1256
+ }
1257
+ ] : [
1258
+ {
1259
+ filename: "tokens.json",
1260
+ content: S(this.paletteData),
1261
+ mimeType: "application/json"
1262
+ }
1263
+ ]);
1264
+ C(this, "makeSwiftUI", () => this.wrap(
1265
+ "Primitives.swift",
1266
+ oe(this.paletteData),
1267
+ "text/swift",
1268
+ "SemanticTokens.swift",
1269
+ this.systemData ? B(this.paletteData, this.systemData) : null
1270
+ ));
1271
+ C(this, "makeUIKit", () => this.wrap(
1272
+ "Primitives.swift",
1273
+ Y(this.paletteData),
1274
+ "text/swift",
1275
+ "SemanticTokens.swift",
1276
+ this.systemData ? O(this.paletteData, this.systemData) : null
1277
+ ));
1278
+ C(this, "makeCompose", () => this.wrap(
1279
+ "Primitives.kt",
1280
+ he(this.paletteData),
1281
+ "text/x-kotlin",
1282
+ "SemanticTokens.kt",
1283
+ this.systemData ? W(this.paletteData, this.systemData) : null
1284
+ ));
1285
+ C(this, "makeResources", () => this.wrap(
1286
+ "primitives.xml",
1287
+ ne(this.paletteData),
1288
+ "text/xml",
1289
+ "semantics.xml",
1290
+ this.systemData ? _(this.paletteData, this.systemData) : null
1291
+ ));
1292
+ C(this, "makeCsv", () => {
1293
+ const p = re(this.paletteData), h = [
1294
+ {
1295
+ filename: "primitives.csv",
1296
+ content: JSON.stringify(p),
1297
+ mimeType: "text/csv"
1298
+ }
1299
+ ];
1300
+ return this.systemData && h.push({
1301
+ filename: "semantics.csv",
1302
+ content: Z(this.paletteData, this.systemData),
1303
+ mimeType: "text/csv"
1304
+ }), h;
1305
+ });
1306
+ this.paletteData = p, this.systemData = h;
1307
+ }
1308
+ }
1309
+ export {
1310
+ fe as default
1311
+ };
1312
+ //# sourceMappingURL=code.js.map