@a_ng_d/utils-ui-color-palette 1.3.6 → 1.3.8
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/modules/data/data.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,WAAW,EAGZ,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EAEjB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,0BAA0B,CAAA;AAIjC,MAAM,CAAC,OAAO,OAAO,IAAI;IACvB,OAAO,CAAC,IAAI,CAAmB;IAC/B,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,IAAI,CAAC,CAAmB;IAChC,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,YAAY,CAAoB;gBAE5B,EACV,IAAI,EACJ,MAAM,EACN,IAAI,GACL,EAAE;QACD,IAAI,EAAE,iBAAiB,CAAA;QACvB,MAAM,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAA;QACjC,IAAI,CAAC,EAAE,iBAAiB,CAAA;KACzB;IAeD,eAAe,oBAmUd;IAED,eAAe,aACH,KAAK,CACX,eAAe,GACf,SAAS,GACT,aAAa,GACb,UAAU,GACV,IAAI,GACJ,KAAK,GACL,aAAa,CAChB,iBACc,KAAK,CAAC,WAAW,CAAC,mBAsDlC;IAED,mBAAmB,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/modules/data/data.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,WAAW,EAGZ,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EAEjB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,0BAA0B,CAAA;AAIjC,MAAM,CAAC,OAAO,OAAO,IAAI;IACvB,OAAO,CAAC,IAAI,CAAmB;IAC/B,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,IAAI,CAAC,CAAmB;IAChC,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,YAAY,CAAoB;gBAE5B,EACV,IAAI,EACJ,MAAM,EACN,IAAI,GACL,EAAE;QACD,IAAI,EAAE,iBAAiB,CAAA;QACvB,MAAM,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAA;QACjC,IAAI,CAAC,EAAE,iBAAiB,CAAA;KACzB;IAeD,eAAe,oBAmUd;IAED,eAAe,aACH,KAAK,CACX,eAAe,GACf,SAAS,GACT,aAAa,GACb,UAAU,GACV,IAAI,GACJ,KAAK,GACL,aAAa,CAChB,iBACc,KAAK,CAAC,WAAW,CAAC,mBAsDlC;IAED,mBAAmB,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC,uBAW3C;CACF"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
var v = Object.defineProperty;
|
|
2
|
-
var E = (g, r,
|
|
3
|
-
var
|
|
2
|
+
var E = (g, r, h) => r in g ? v(g, r, { enumerable: !0, configurable: !0, writable: !0, value: h }) : g[r] = h;
|
|
3
|
+
var u = (g, r, h) => E(g, typeof r != "symbol" ? r + "" : r, h);
|
|
4
4
|
import { C as k, H as f } from "../../color-1CXTuV84.js";
|
|
5
5
|
import { c as s } from "../../index-Beb8qoyd.js";
|
|
6
6
|
class A {
|
|
7
7
|
constructor({
|
|
8
8
|
base: r,
|
|
9
|
-
themes:
|
|
9
|
+
themes: h,
|
|
10
10
|
meta: e
|
|
11
11
|
}) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
12
|
+
u(this, "base");
|
|
13
|
+
u(this, "themes");
|
|
14
|
+
u(this, "meta");
|
|
15
|
+
u(this, "paletteData");
|
|
16
|
+
u(this, "currentScale");
|
|
17
|
+
u(this, "makePaletteData", () => (this.themes.forEach((r) => {
|
|
18
|
+
const h = {
|
|
19
19
|
id: r.id,
|
|
20
20
|
name: r.name,
|
|
21
21
|
description: r.description,
|
|
@@ -37,7 +37,7 @@ class A {
|
|
|
37
37
|
chromaShifting: e.chroma.shift !== void 0 ? e.chroma.shift : 100,
|
|
38
38
|
algorithmVersion: this.base.algorithmVersion,
|
|
39
39
|
visionSimulationMode: r.visionSimulationMode
|
|
40
|
-
}),
|
|
40
|
+
}), l = new k({
|
|
41
41
|
render: "RGB",
|
|
42
42
|
sourceColor: s(e.alpha.backgroundColor).rgb(),
|
|
43
43
|
algorithmVersion: this.base.algorithmVersion,
|
|
@@ -48,61 +48,61 @@ class A {
|
|
|
48
48
|
return this.base.areSourceColorsLocked ? [
|
|
49
49
|
a,
|
|
50
50
|
t.setColorWithAlpha(),
|
|
51
|
-
|
|
51
|
+
l.setColorWithAlpha()
|
|
52
52
|
] : [
|
|
53
53
|
a,
|
|
54
54
|
t.lcha(),
|
|
55
|
-
|
|
55
|
+
l.lcha()
|
|
56
56
|
];
|
|
57
57
|
case "OKLCH":
|
|
58
58
|
return this.base.areSourceColorsLocked ? [
|
|
59
59
|
a,
|
|
60
60
|
t.setColorWithAlpha(),
|
|
61
|
-
|
|
61
|
+
l.setColorWithAlpha()
|
|
62
62
|
] : [
|
|
63
63
|
a,
|
|
64
64
|
t.oklcha(),
|
|
65
|
-
|
|
65
|
+
l.oklcha()
|
|
66
66
|
];
|
|
67
67
|
case "LAB":
|
|
68
68
|
return this.base.areSourceColorsLocked ? [
|
|
69
69
|
a,
|
|
70
70
|
t.setColorWithAlpha(),
|
|
71
|
-
|
|
71
|
+
l.setColorWithAlpha()
|
|
72
72
|
] : [
|
|
73
73
|
a,
|
|
74
74
|
t.laba(),
|
|
75
|
-
|
|
75
|
+
l.laba()
|
|
76
76
|
];
|
|
77
77
|
case "OKLAB":
|
|
78
78
|
return this.base.areSourceColorsLocked ? [
|
|
79
79
|
a,
|
|
80
80
|
t.setColorWithAlpha(),
|
|
81
|
-
|
|
81
|
+
l.setColorWithAlpha()
|
|
82
82
|
] : [
|
|
83
83
|
a,
|
|
84
84
|
t.oklaba(),
|
|
85
|
-
|
|
85
|
+
l.oklaba()
|
|
86
86
|
];
|
|
87
87
|
case "HSL":
|
|
88
88
|
return this.base.areSourceColorsLocked ? [
|
|
89
89
|
a,
|
|
90
90
|
t.setColorWithAlpha(),
|
|
91
|
-
|
|
91
|
+
l.setColorWithAlpha()
|
|
92
92
|
] : [
|
|
93
93
|
a,
|
|
94
94
|
t.hsla(),
|
|
95
|
-
|
|
95
|
+
l.hsla()
|
|
96
96
|
];
|
|
97
97
|
case "HSLUV":
|
|
98
98
|
return this.base.areSourceColorsLocked ? [
|
|
99
99
|
a,
|
|
100
100
|
t.setColorWithAlpha(),
|
|
101
|
-
|
|
101
|
+
l.setColorWithAlpha()
|
|
102
102
|
] : [
|
|
103
103
|
a,
|
|
104
104
|
t.hsluva(),
|
|
105
|
-
|
|
105
|
+
l.hsluva()
|
|
106
106
|
];
|
|
107
107
|
default:
|
|
108
108
|
return [a, [0, 0, 0], [255, 255, 255]];
|
|
@@ -144,64 +144,64 @@ class A {
|
|
|
144
144
|
description: e.description,
|
|
145
145
|
shades: [],
|
|
146
146
|
type: "color"
|
|
147
|
-
},
|
|
147
|
+
}, i = [
|
|
148
148
|
e.rgb.r * 255,
|
|
149
149
|
e.rgb.g * 255,
|
|
150
150
|
e.rgb.b * 255
|
|
151
|
-
],
|
|
152
|
-
|
|
151
|
+
], b = new f();
|
|
152
|
+
b.rgb_r = e.rgb.r, b.rgb_g = e.rgb.g, b.rgb_b = e.rgb.b, b.rgbToHsluv(), S.shades.push({
|
|
153
153
|
name: "source",
|
|
154
154
|
description: "Source color",
|
|
155
|
-
hex: s(
|
|
156
|
-
rgb:
|
|
157
|
-
gl: s(
|
|
158
|
-
lch: s(
|
|
159
|
-
oklch: s(
|
|
160
|
-
lab: s(
|
|
161
|
-
oklab: s(
|
|
162
|
-
hsl: s(
|
|
155
|
+
hex: s(i).hex(),
|
|
156
|
+
rgb: i,
|
|
157
|
+
gl: s(i).gl(),
|
|
158
|
+
lch: s(i).lch(),
|
|
159
|
+
oklch: s(i).oklch(),
|
|
160
|
+
lab: s(i).lab(),
|
|
161
|
+
oklab: s(i).oklab(),
|
|
162
|
+
hsl: s(i).hsl(),
|
|
163
163
|
hsluv: [
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
b.hsluv_h,
|
|
165
|
+
b.hsluv_s,
|
|
166
|
+
b.hsluv_l
|
|
167
167
|
],
|
|
168
168
|
type: "source color"
|
|
169
169
|
});
|
|
170
|
-
const
|
|
170
|
+
const c = d.map(
|
|
171
171
|
(a) => s.distance(
|
|
172
|
-
s(
|
|
172
|
+
s(i).hex(),
|
|
173
173
|
s(a[1]).hex(),
|
|
174
174
|
"rgb"
|
|
175
175
|
)
|
|
176
|
-
),
|
|
176
|
+
), o = c.indexOf(Math.min(...c));
|
|
177
177
|
d.forEach((a, t) => {
|
|
178
|
-
const
|
|
179
|
-
s(
|
|
178
|
+
const l = s.distance(
|
|
179
|
+
s(i).hex(),
|
|
180
180
|
s(a[1]).hex(),
|
|
181
181
|
"rgb"
|
|
182
182
|
), C = Object.keys(this.currentScale).find(
|
|
183
183
|
(L) => L === a[0][0]
|
|
184
|
-
) ?? "0",
|
|
184
|
+
) ?? "0", n = new f(), p = new k({
|
|
185
185
|
render: "RGB",
|
|
186
|
-
sourceColor: s(
|
|
186
|
+
sourceColor: s(i).rgb(),
|
|
187
187
|
visionSimulationMode: r.visionSimulationMode
|
|
188
188
|
}).setColor(), m = new k({
|
|
189
189
|
render: "HEX",
|
|
190
|
-
sourceColor: s(
|
|
190
|
+
sourceColor: s(i).rgb(),
|
|
191
191
|
visionSimulationMode: r.visionSimulationMode
|
|
192
192
|
}).setColor();
|
|
193
|
-
t ===
|
|
193
|
+
t === o && this.base.areSourceColorsLocked && !e.alpha.isEnabled ? (n.rgb_r = Number(p[0]) / 255, n.rgb_g = Number(p[1]) / 255, n.rgb_b = Number(p[2]) / 255) : (n.rgb_r = Number(a[1][0]) / 255, n.rgb_g = Number(a[1][1]) / 255, n.rgb_b = Number(a[1][2]) / 255), n.rgbToHsluv(), S.shades.push({
|
|
194
194
|
name: C,
|
|
195
195
|
description: `Shade color with ${typeof a[0][1] == "number" ? a[0][1].toFixed(1) : a[0][1]}% of ${e.alpha.isEnabled ? "opacity" : "lightness"}`,
|
|
196
|
-
hex: t ===
|
|
197
|
-
rgb: t ===
|
|
198
|
-
gl: t ===
|
|
199
|
-
lch: t ===
|
|
200
|
-
oklch: t ===
|
|
201
|
-
lab: t ===
|
|
202
|
-
oklab: t ===
|
|
203
|
-
hsl: t ===
|
|
204
|
-
hsluv: [
|
|
196
|
+
hex: t === o && this.base.areSourceColorsLocked && !e.alpha.isEnabled ? s(m).hex() : s(a[1]).hex(),
|
|
197
|
+
rgb: t === o && this.base.areSourceColorsLocked && !e.alpha.isEnabled ? s(m).rgb() : s(a[1]).rgb(),
|
|
198
|
+
gl: t === o && this.base.areSourceColorsLocked && !e.alpha.isEnabled ? s(m).gl() : s(a[1]).gl(),
|
|
199
|
+
lch: t === o && this.base.areSourceColorsLocked && !e.alpha.isEnabled ? s(m).lch() : s(a[1]).lch(),
|
|
200
|
+
oklch: t === o && this.base.areSourceColorsLocked && !e.alpha.isEnabled ? s(m).oklch() : s(a[1]).oklch(),
|
|
201
|
+
lab: t === o && this.base.areSourceColorsLocked && !e.alpha.isEnabled ? s(m).lab() : s(a[1]).lab(),
|
|
202
|
+
oklab: t === o && this.base.areSourceColorsLocked && !e.alpha.isEnabled ? s(m).oklab() : s(a[1]).oklab(),
|
|
203
|
+
hsl: t === o && this.base.areSourceColorsLocked && !e.alpha.isEnabled ? s(m).hsl() : s(a[1]).hsl(),
|
|
204
|
+
hsluv: [n.hsluv_h, n.hsluv_s, n.hsluv_l],
|
|
205
205
|
alpha: e.alpha.isEnabled ? parseFloat((a[0][1] / 100).toFixed(2)) : void 0,
|
|
206
206
|
backgroundColor: e.alpha.isEnabled && e.alpha.backgroundColor ? s(a[2]).rgb() : void 0,
|
|
207
207
|
mixedColor: e.alpha.isEnabled && e.alpha.backgroundColor ? new k({
|
|
@@ -215,30 +215,30 @@ class A {
|
|
|
215
215
|
],
|
|
216
216
|
[...a[2], 1]
|
|
217
217
|
) : void 0,
|
|
218
|
-
isClosestToRef:
|
|
219
|
-
isSourceColorLocked: t ===
|
|
218
|
+
isClosestToRef: l < 4 && !this.base.areSourceColorsLocked,
|
|
219
|
+
isSourceColorLocked: t === o && this.base.areSourceColorsLocked && !e.alpha.isEnabled,
|
|
220
220
|
isTransparent: e.alpha.isEnabled,
|
|
221
221
|
type: "color shade"
|
|
222
222
|
});
|
|
223
|
-
}),
|
|
224
|
-
}), this.paletteData.themes.push(
|
|
223
|
+
}), h.colors.push(S);
|
|
224
|
+
}), this.paletteData.themes.push(h);
|
|
225
225
|
}), this.paletteData));
|
|
226
|
-
|
|
227
|
-
const e = this.makePaletteData(), d = e.themes.filter((
|
|
228
|
-
return d.flatMap((
|
|
229
|
-
(
|
|
230
|
-
const
|
|
231
|
-
(
|
|
226
|
+
u(this, "makeLibraryData", (r, h) => {
|
|
227
|
+
const e = this.makePaletteData(), d = e.themes.filter((i) => i.type === "custom theme").length === 0 ? e.themes.filter((i) => i.type === "default theme") : e.themes.filter((i) => i.type === "custom theme");
|
|
228
|
+
return d.flatMap((i) => i.colors.flatMap(
|
|
229
|
+
(b) => b.shades.flatMap((c) => {
|
|
230
|
+
const o = d[0].type === "custom theme" ? `${e.name === "" ? "" : e.name + " / "}${i.name} / ${b.name}` : `${e.name === "" ? "" : e.name} / ${b.name}`, a = `${i.id}:${b.id}:${c.name}`, t = h == null ? void 0 : h.find(
|
|
231
|
+
(l) => l.id === a
|
|
232
232
|
);
|
|
233
233
|
return {
|
|
234
234
|
id: a,
|
|
235
|
-
name:
|
|
236
|
-
path:
|
|
237
|
-
alpha:
|
|
238
|
-
...(r == null ? void 0 : r.includes("hex")) && { hex:
|
|
239
|
-
...(r == null ? void 0 : r.includes("gl")) && { gl:
|
|
235
|
+
name: c.name,
|
|
236
|
+
path: o,
|
|
237
|
+
alpha: c.alpha ?? 1,
|
|
238
|
+
...(r == null ? void 0 : r.includes("hex")) && { hex: c.hex },
|
|
239
|
+
...(r == null ? void 0 : r.includes("gl")) && { gl: c.gl },
|
|
240
240
|
...(r == null ? void 0 : r.includes("description")) && {
|
|
241
|
-
description:
|
|
241
|
+
description: `${b.description !== "" ? b.description + "・" : ""}${c.description}`
|
|
242
242
|
},
|
|
243
243
|
...(r == null ? void 0 : r.includes("collection_id")) && {
|
|
244
244
|
collectionId: t == null ? void 0 : t.collectionId
|
|
@@ -256,20 +256,21 @@ class A {
|
|
|
256
256
|
})
|
|
257
257
|
));
|
|
258
258
|
});
|
|
259
|
-
|
|
259
|
+
u(this, "makePaletteFullData", (r = ["hex"]) => ({
|
|
260
260
|
base: this.base,
|
|
261
261
|
themes: this.themes,
|
|
262
262
|
libraryData: this.makeLibraryData(r),
|
|
263
263
|
meta: this.meta,
|
|
264
|
+
version: "2025.06",
|
|
264
265
|
type: "UI_COLOR_PALETTE"
|
|
265
266
|
}));
|
|
266
267
|
var d;
|
|
267
|
-
this.base = r, this.themes =
|
|
268
|
+
this.base = r, this.themes = h, this.meta = e, this.paletteData = {
|
|
268
269
|
name: r.name ?? "UI Color Palette",
|
|
269
270
|
description: r.description,
|
|
270
271
|
themes: [],
|
|
271
272
|
type: "palette"
|
|
272
|
-
}, this.currentScale = ((d =
|
|
273
|
+
}, this.currentScale = ((d = h.find((S) => S.isEnabled)) == null ? void 0 : d.scale) ?? {};
|
|
273
274
|
}
|
|
274
275
|
}
|
|
275
276
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.js","sources":["../../../src/modules/data/data.ts"],"sourcesContent":["import { Hsluv } from 'hsluv'\nimport chroma from 'chroma-js'\nimport {\n LibraryData,\n PaletteData,\n PaletteDataColorItem,\n PaletteDataThemeItem,\n} from '@tps/data.types'\nimport {\n MetaConfiguration,\n BaseConfiguration,\n ScaleConfiguration,\n ThemeConfiguration,\n FullConfiguration,\n} from '@tps/configuration.types'\nimport { Channel, HexModel } from '@tps/color.types'\nimport Color from '@modules/color/color'\n\nexport default class Data {\n private base: BaseConfiguration\n private themes: Array<ThemeConfiguration>\n private meta?: MetaConfiguration\n private paletteData: PaletteData\n private currentScale: ScaleConfiguration\n\n constructor({\n base,\n themes,\n meta,\n }: {\n base: BaseConfiguration\n themes: Array<ThemeConfiguration>\n meta?: MetaConfiguration\n }) {\n this.base = base\n this.themes = themes\n this.meta = meta\n this.paletteData = {\n name: base.name ?? 'UI Color Palette',\n description: base.description,\n themes: [],\n type: 'palette',\n }\n this.currentScale =\n themes.find((theme) => theme.isEnabled)?.scale ??\n ({} as ScaleConfiguration)\n }\n\n makePaletteData = () => {\n this.themes.forEach((theme) => {\n const paletteDataThemeItem: PaletteDataThemeItem = {\n id: theme.id,\n name: theme.name,\n description: theme.description,\n colors: [],\n type: theme.type,\n }\n this.base.colors.forEach((color) => {\n const scaledColors = Object.entries(theme.scale)\n .reverse()\n .map((lightness) => {\n if (color.alpha.isEnabled) {\n const foregroundColorData = new Color({\n render: 'RGB',\n sourceColor: [\n color.rgb.r * 255,\n color.rgb.g * 255,\n color.rgb.b * 255,\n ],\n alpha: parseFloat((lightness[1] / 100).toFixed(2)),\n hueShifting:\n color.hue.shift !== undefined ? color.hue.shift : 0,\n chromaShifting:\n color.chroma.shift !== undefined ? color.chroma.shift : 100,\n algorithmVersion: this.base.algorithmVersion,\n visionSimulationMode: theme.visionSimulationMode,\n })\n const backgroundColorData = new Color({\n render: 'RGB',\n sourceColor: chroma(color.alpha.backgroundColor).rgb(),\n algorithmVersion: this.base.algorithmVersion,\n visionSimulationMode: theme.visionSimulationMode,\n })\n\n switch (this.base.colorSpace) {\n case 'LCH':\n return this.base.areSourceColorsLocked\n ? [\n lightness,\n foregroundColorData.setColorWithAlpha(),\n backgroundColorData.setColorWithAlpha(),\n ]\n : [\n lightness,\n foregroundColorData.lcha(),\n backgroundColorData.lcha(),\n ]\n case 'OKLCH':\n return this.base.areSourceColorsLocked\n ? [\n lightness,\n foregroundColorData.setColorWithAlpha(),\n backgroundColorData.setColorWithAlpha(),\n ]\n : [\n lightness,\n foregroundColorData.oklcha(),\n backgroundColorData.oklcha(),\n ]\n case 'LAB':\n return this.base.areSourceColorsLocked\n ? [\n lightness,\n foregroundColorData.setColorWithAlpha(),\n backgroundColorData.setColorWithAlpha(),\n ]\n : [\n lightness,\n foregroundColorData.laba(),\n backgroundColorData.laba(),\n ]\n case 'OKLAB':\n return this.base.areSourceColorsLocked\n ? [\n lightness,\n foregroundColorData.setColorWithAlpha(),\n backgroundColorData.setColorWithAlpha(),\n ]\n : [\n lightness,\n foregroundColorData.oklaba(),\n backgroundColorData.oklaba(),\n ]\n case 'HSL':\n return this.base.areSourceColorsLocked\n ? [\n lightness,\n foregroundColorData.setColorWithAlpha(),\n backgroundColorData.setColorWithAlpha(),\n ]\n : [\n lightness,\n foregroundColorData.hsla(),\n backgroundColorData.hsla(),\n ]\n case 'HSLUV':\n return this.base.areSourceColorsLocked\n ? [\n lightness,\n foregroundColorData.setColorWithAlpha(),\n backgroundColorData.setColorWithAlpha(),\n ]\n : [\n lightness,\n foregroundColorData.hsluva(),\n backgroundColorData.hsluva(),\n ]\n default:\n return [lightness, [0, 0, 0], [255, 255, 255]]\n }\n } else {\n const colorData = new Color({\n render: 'RGB',\n sourceColor: [\n color.rgb.r * 255,\n color.rgb.g * 255,\n color.rgb.b * 255,\n ],\n lightness: lightness[1],\n hueShifting:\n color.hue.shift !== undefined ? color.hue.shift : 0,\n chromaShifting:\n color.chroma.shift !== undefined ? color.chroma.shift : 100,\n algorithmVersion: this.base.algorithmVersion,\n visionSimulationMode: theme.visionSimulationMode,\n })\n\n switch (this.base.colorSpace) {\n case 'LCH':\n return [lightness, colorData.lch()]\n case 'OKLCH':\n return [lightness, colorData.oklch()]\n case 'LAB':\n return [lightness, colorData.lab()]\n case 'OKLAB':\n return [lightness, colorData.oklab()]\n case 'HSL':\n return [lightness, colorData.hsl()]\n case 'HSLUV':\n return [lightness, colorData.hsluv()]\n default:\n return [lightness, [0, 0, 0]]\n }\n }\n })\n\n const paletteDataColorItem: PaletteDataColorItem = {\n id: color.id,\n name: color.name,\n description: color.description,\n shades: [],\n type: 'color',\n },\n sourceColor: Channel = [\n color.rgb.r * 255,\n color.rgb.g * 255,\n color.rgb.b * 255,\n ]\n\n const sourceHsluv = new Hsluv()\n sourceHsluv.rgb_r = color.rgb.r\n sourceHsluv.rgb_g = color.rgb.g\n sourceHsluv.rgb_b = color.rgb.b\n sourceHsluv.rgbToHsluv()\n\n paletteDataColorItem.shades.push({\n name: 'source',\n description: 'Source color',\n hex: chroma(sourceColor).hex(),\n rgb: sourceColor,\n gl: chroma(sourceColor).gl(),\n lch: chroma(sourceColor).lch(),\n oklch: chroma(sourceColor).oklch(),\n lab: chroma(sourceColor).lab(),\n oklab: chroma(sourceColor).oklab(),\n hsl: chroma(sourceColor).hsl(),\n hsluv: [\n sourceHsluv.hsluv_h,\n sourceHsluv.hsluv_s,\n sourceHsluv.hsluv_l,\n ],\n type: 'source color',\n })\n\n const distances = scaledColors.map((shade) =>\n chroma.distance(\n chroma(sourceColor).hex(),\n chroma(shade[1] as Channel).hex(),\n 'rgb'\n )\n )\n const minDistanceIndex = distances.indexOf(Math.min(...distances))\n\n scaledColors.forEach((scaledColor, index) => {\n const distance: number = chroma.distance(\n chroma(sourceColor).hex(),\n chroma(scaledColor[1] as Channel).hex(),\n 'rgb'\n )\n const scaleName: string =\n Object.keys(this.currentScale).find(\n (key) => key === scaledColor[0][0]\n ) ?? '0'\n const newHsluv = new Hsluv()\n const simulatedSourceColorRgb = new Color({\n render: 'RGB',\n sourceColor: chroma(sourceColor).rgb(),\n visionSimulationMode: theme.visionSimulationMode,\n }).setColor() as Channel\n const simulatedSourceColorHex = new Color({\n render: 'HEX',\n sourceColor: chroma(sourceColor).rgb(),\n visionSimulationMode: theme.visionSimulationMode,\n }).setColor() as HexModel\n\n if (\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ) {\n newHsluv.rgb_r = Number(simulatedSourceColorRgb[0]) / 255\n newHsluv.rgb_g = Number(simulatedSourceColorRgb[1]) / 255\n newHsluv.rgb_b = Number(simulatedSourceColorRgb[2]) / 255\n } else {\n newHsluv.rgb_r = Number(scaledColor[1][0]) / 255\n newHsluv.rgb_g = Number(scaledColor[1][1]) / 255\n newHsluv.rgb_b = Number(scaledColor[1][2]) / 255\n }\n newHsluv.rgbToHsluv()\n\n paletteDataColorItem.shades.push({\n name: scaleName,\n description: `Shade color with ${typeof scaledColor[0][1] === 'number' ? scaledColor[0][1].toFixed(1) : scaledColor[0][1]}% of ${\n color.alpha.isEnabled ? 'opacity' : 'lightness'\n }`,\n hex:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ? chroma(simulatedSourceColorHex).hex()\n : chroma(scaledColor[1] as Channel).hex(),\n rgb:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ? chroma(simulatedSourceColorHex).rgb()\n : chroma(scaledColor[1] as Channel).rgb(),\n gl:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ? chroma(simulatedSourceColorHex).gl()\n : chroma(scaledColor[1] as Channel).gl(),\n lch:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ? chroma(simulatedSourceColorHex).lch()\n : chroma(scaledColor[1] as Channel).lch(),\n oklch:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ? chroma(simulatedSourceColorHex).oklch()\n : chroma(scaledColor[1] as Channel).oklch(),\n lab:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ? chroma(simulatedSourceColorHex).lab()\n : chroma(scaledColor[1] as Channel).lab(),\n oklab:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ? chroma(simulatedSourceColorHex).oklab()\n : chroma(scaledColor[1] as Channel).oklab(),\n hsl:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ? chroma(simulatedSourceColorHex).hsl()\n : chroma(scaledColor[1] as Channel).hsl(),\n hsluv: [newHsluv.hsluv_h, newHsluv.hsluv_s, newHsluv.hsluv_l],\n alpha: color.alpha.isEnabled\n ? parseFloat(((scaledColor[0][1] as number) / 100).toFixed(2))\n : undefined,\n backgroundColor:\n color.alpha.isEnabled && color.alpha.backgroundColor\n ? chroma(scaledColor[2] as Channel).rgb()\n : undefined,\n mixedColor:\n color.alpha.isEnabled && color.alpha.backgroundColor\n ? new Color({\n visionSimulationMode: theme.visionSimulationMode,\n }).mixColorsRgb(\n [\n ...(scaledColor[1] as Channel),\n parseFloat(\n ((scaledColor[0][1] as number) / 100).toFixed(2)\n ),\n ],\n [...(scaledColor[2] as Channel), 1]\n )\n : undefined,\n isClosestToRef: distance < 4 && !this.base.areSourceColorsLocked,\n isSourceColorLocked:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled,\n isTransparent: color.alpha.isEnabled,\n type: 'color shade',\n })\n })\n\n paletteDataThemeItem.colors.push(paletteDataColorItem)\n })\n this.paletteData.themes.push(paletteDataThemeItem)\n })\n\n return this.paletteData\n }\n\n makeLibraryData = (\n options?: Array<\n | 'collection_id'\n | 'mode_id'\n | 'variable_id'\n | 'style_id'\n | 'gl'\n | 'hex'\n | 'description'\n >,\n previousData?: Array<LibraryData>\n ) => {\n const paletteData = this.makePaletteData()\n const workingThemes =\n paletteData.themes.filter((theme) => theme.type === 'custom theme')\n .length === 0\n ? paletteData.themes.filter((theme) => theme.type === 'default theme')\n : paletteData.themes.filter((theme) => theme.type === 'custom theme')\n\n const libraryData: Array<LibraryData> = workingThemes.flatMap((theme) => {\n return theme.colors.flatMap((color) =>\n color.shades.flatMap((shade) => {\n const path =\n workingThemes[0].type === 'custom theme'\n ? `${\n paletteData.name === '' ? '' : paletteData.name + ' / '\n }${theme.name} / ${color.name}`\n : `${paletteData.name === '' ? '' : paletteData.name} / ${\n color.name\n }`\n const generatedId = `${theme.id}:${color.id}:${shade.name}`\n\n const previousItem = previousData?.find(\n (item) => item.id === generatedId\n )\n\n return {\n id: generatedId,\n name: shade.name,\n path: path,\n alpha: shade.alpha ?? 1,\n ...(options?.includes('hex') && { hex: shade.hex }),\n ...(options?.includes('gl') && { gl: shade.gl }),\n ...(options?.includes('description') && {\n description: shade.description,\n }),\n ...(options?.includes('collection_id') && {\n collectionId: previousItem?.collectionId,\n }),\n ...(options?.includes('mode_id') && {\n modeId: previousItem?.modeId,\n }),\n ...(options?.includes('variable_id') && {\n variableId: previousItem?.variableId,\n }),\n ...(options?.includes('style_id') && {\n styleId: previousItem?.styleId,\n }),\n }\n })\n )\n })\n\n return libraryData\n }\n\n makePaletteFullData = (model: ['hex' | 'gl'] = ['hex']) => {\n const fullPaletteData = {\n base: this.base,\n themes: this.themes,\n libraryData: this.makeLibraryData(model),\n meta: this.meta,\n type: 'UI_COLOR_PALETTE',\n } as FullConfiguration\n\n return fullPaletteData\n }\n}\n"],"names":["Data","base","themes","meta","__publicField","theme","paletteDataThemeItem","color","scaledColors","lightness","foregroundColorData","Color","backgroundColorData","chroma","colorData","paletteDataColorItem","sourceColor","sourceHsluv","Hsluv","distances","shade","minDistanceIndex","scaledColor","index","distance","scaleName","key","newHsluv","simulatedSourceColorRgb","simulatedSourceColorHex","options","previousData","paletteData","workingThemes","path","generatedId","previousItem","item","model","_a"],"mappings":";;;;;AAkBA,MAAqBA,EAAK;AAAA,EAOxB,YAAY;AAAA,IACV,MAAAC;AAAA,IACA,QAAAC;AAAA,IACA,MAAAC;AAAA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;AAAA,MACjB,MAAMF,EAAK,QAAQ;AAAA,MACnB,aAAaA,EAAK;AAAA,MAClB,QAAQ,CAAC;AAAA,MACT,MAAM;AAAA,IACR,GACK,KAAA,iBACHsC,IAAArC,EAAO,KAAK,CAACG,MAAUA,EAAM,SAAS,MAAtC,gBAAAkC,EAAyC,UACxC,CAAC;AAAA,EAAA;AAqZR;"}
|
|
1
|
+
{"version":3,"file":"data.js","sources":["../../../src/modules/data/data.ts"],"sourcesContent":["import { Hsluv } from 'hsluv'\nimport chroma from 'chroma-js'\nimport {\n LibraryData,\n PaletteData,\n PaletteDataColorItem,\n PaletteDataThemeItem,\n} from '@tps/data.types'\nimport {\n MetaConfiguration,\n BaseConfiguration,\n ScaleConfiguration,\n ThemeConfiguration,\n FullConfiguration,\n} from '@tps/configuration.types'\nimport { Channel, HexModel } from '@tps/color.types'\nimport Color from '@modules/color/color'\n\nexport default class Data {\n private base: BaseConfiguration\n private themes: Array<ThemeConfiguration>\n private meta?: MetaConfiguration\n private paletteData: PaletteData\n private currentScale: ScaleConfiguration\n\n constructor({\n base,\n themes,\n meta,\n }: {\n base: BaseConfiguration\n themes: Array<ThemeConfiguration>\n meta?: MetaConfiguration\n }) {\n this.base = base\n this.themes = themes\n this.meta = meta\n this.paletteData = {\n name: base.name ?? 'UI Color Palette',\n description: base.description,\n themes: [],\n type: 'palette',\n }\n this.currentScale =\n themes.find((theme) => theme.isEnabled)?.scale ??\n ({} as ScaleConfiguration)\n }\n\n makePaletteData = () => {\n this.themes.forEach((theme) => {\n const paletteDataThemeItem: PaletteDataThemeItem = {\n id: theme.id,\n name: theme.name,\n description: theme.description,\n colors: [],\n type: theme.type,\n }\n this.base.colors.forEach((color) => {\n const scaledColors = Object.entries(theme.scale)\n .reverse()\n .map((lightness) => {\n if (color.alpha.isEnabled) {\n const foregroundColorData = new Color({\n render: 'RGB',\n sourceColor: [\n color.rgb.r * 255,\n color.rgb.g * 255,\n color.rgb.b * 255,\n ],\n alpha: parseFloat((lightness[1] / 100).toFixed(2)),\n hueShifting:\n color.hue.shift !== undefined ? color.hue.shift : 0,\n chromaShifting:\n color.chroma.shift !== undefined ? color.chroma.shift : 100,\n algorithmVersion: this.base.algorithmVersion,\n visionSimulationMode: theme.visionSimulationMode,\n })\n const backgroundColorData = new Color({\n render: 'RGB',\n sourceColor: chroma(color.alpha.backgroundColor).rgb(),\n algorithmVersion: this.base.algorithmVersion,\n visionSimulationMode: theme.visionSimulationMode,\n })\n\n switch (this.base.colorSpace) {\n case 'LCH':\n return this.base.areSourceColorsLocked\n ? [\n lightness,\n foregroundColorData.setColorWithAlpha(),\n backgroundColorData.setColorWithAlpha(),\n ]\n : [\n lightness,\n foregroundColorData.lcha(),\n backgroundColorData.lcha(),\n ]\n case 'OKLCH':\n return this.base.areSourceColorsLocked\n ? [\n lightness,\n foregroundColorData.setColorWithAlpha(),\n backgroundColorData.setColorWithAlpha(),\n ]\n : [\n lightness,\n foregroundColorData.oklcha(),\n backgroundColorData.oklcha(),\n ]\n case 'LAB':\n return this.base.areSourceColorsLocked\n ? [\n lightness,\n foregroundColorData.setColorWithAlpha(),\n backgroundColorData.setColorWithAlpha(),\n ]\n : [\n lightness,\n foregroundColorData.laba(),\n backgroundColorData.laba(),\n ]\n case 'OKLAB':\n return this.base.areSourceColorsLocked\n ? [\n lightness,\n foregroundColorData.setColorWithAlpha(),\n backgroundColorData.setColorWithAlpha(),\n ]\n : [\n lightness,\n foregroundColorData.oklaba(),\n backgroundColorData.oklaba(),\n ]\n case 'HSL':\n return this.base.areSourceColorsLocked\n ? [\n lightness,\n foregroundColorData.setColorWithAlpha(),\n backgroundColorData.setColorWithAlpha(),\n ]\n : [\n lightness,\n foregroundColorData.hsla(),\n backgroundColorData.hsla(),\n ]\n case 'HSLUV':\n return this.base.areSourceColorsLocked\n ? [\n lightness,\n foregroundColorData.setColorWithAlpha(),\n backgroundColorData.setColorWithAlpha(),\n ]\n : [\n lightness,\n foregroundColorData.hsluva(),\n backgroundColorData.hsluva(),\n ]\n default:\n return [lightness, [0, 0, 0], [255, 255, 255]]\n }\n } else {\n const colorData = new Color({\n render: 'RGB',\n sourceColor: [\n color.rgb.r * 255,\n color.rgb.g * 255,\n color.rgb.b * 255,\n ],\n lightness: lightness[1],\n hueShifting:\n color.hue.shift !== undefined ? color.hue.shift : 0,\n chromaShifting:\n color.chroma.shift !== undefined ? color.chroma.shift : 100,\n algorithmVersion: this.base.algorithmVersion,\n visionSimulationMode: theme.visionSimulationMode,\n })\n\n switch (this.base.colorSpace) {\n case 'LCH':\n return [lightness, colorData.lch()]\n case 'OKLCH':\n return [lightness, colorData.oklch()]\n case 'LAB':\n return [lightness, colorData.lab()]\n case 'OKLAB':\n return [lightness, colorData.oklab()]\n case 'HSL':\n return [lightness, colorData.hsl()]\n case 'HSLUV':\n return [lightness, colorData.hsluv()]\n default:\n return [lightness, [0, 0, 0]]\n }\n }\n })\n\n const paletteDataColorItem: PaletteDataColorItem = {\n id: color.id,\n name: color.name,\n description: color.description,\n shades: [],\n type: 'color',\n },\n sourceColor: Channel = [\n color.rgb.r * 255,\n color.rgb.g * 255,\n color.rgb.b * 255,\n ]\n\n const sourceHsluv = new Hsluv()\n sourceHsluv.rgb_r = color.rgb.r\n sourceHsluv.rgb_g = color.rgb.g\n sourceHsluv.rgb_b = color.rgb.b\n sourceHsluv.rgbToHsluv()\n\n paletteDataColorItem.shades.push({\n name: 'source',\n description: 'Source color',\n hex: chroma(sourceColor).hex(),\n rgb: sourceColor,\n gl: chroma(sourceColor).gl(),\n lch: chroma(sourceColor).lch(),\n oklch: chroma(sourceColor).oklch(),\n lab: chroma(sourceColor).lab(),\n oklab: chroma(sourceColor).oklab(),\n hsl: chroma(sourceColor).hsl(),\n hsluv: [\n sourceHsluv.hsluv_h,\n sourceHsluv.hsluv_s,\n sourceHsluv.hsluv_l,\n ],\n type: 'source color',\n })\n\n const distances = scaledColors.map((shade) =>\n chroma.distance(\n chroma(sourceColor).hex(),\n chroma(shade[1] as Channel).hex(),\n 'rgb'\n )\n )\n const minDistanceIndex = distances.indexOf(Math.min(...distances))\n\n scaledColors.forEach((scaledColor, index) => {\n const distance: number = chroma.distance(\n chroma(sourceColor).hex(),\n chroma(scaledColor[1] as Channel).hex(),\n 'rgb'\n )\n const scaleName: string =\n Object.keys(this.currentScale).find(\n (key) => key === scaledColor[0][0]\n ) ?? '0'\n const newHsluv = new Hsluv()\n const simulatedSourceColorRgb = new Color({\n render: 'RGB',\n sourceColor: chroma(sourceColor).rgb(),\n visionSimulationMode: theme.visionSimulationMode,\n }).setColor() as Channel\n const simulatedSourceColorHex = new Color({\n render: 'HEX',\n sourceColor: chroma(sourceColor).rgb(),\n visionSimulationMode: theme.visionSimulationMode,\n }).setColor() as HexModel\n\n if (\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ) {\n newHsluv.rgb_r = Number(simulatedSourceColorRgb[0]) / 255\n newHsluv.rgb_g = Number(simulatedSourceColorRgb[1]) / 255\n newHsluv.rgb_b = Number(simulatedSourceColorRgb[2]) / 255\n } else {\n newHsluv.rgb_r = Number(scaledColor[1][0]) / 255\n newHsluv.rgb_g = Number(scaledColor[1][1]) / 255\n newHsluv.rgb_b = Number(scaledColor[1][2]) / 255\n }\n newHsluv.rgbToHsluv()\n\n paletteDataColorItem.shades.push({\n name: scaleName,\n description: `Shade color with ${typeof scaledColor[0][1] === 'number' ? scaledColor[0][1].toFixed(1) : scaledColor[0][1]}% of ${\n color.alpha.isEnabled ? 'opacity' : 'lightness'\n }`,\n hex:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ? chroma(simulatedSourceColorHex).hex()\n : chroma(scaledColor[1] as Channel).hex(),\n rgb:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ? chroma(simulatedSourceColorHex).rgb()\n : chroma(scaledColor[1] as Channel).rgb(),\n gl:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ? chroma(simulatedSourceColorHex).gl()\n : chroma(scaledColor[1] as Channel).gl(),\n lch:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ? chroma(simulatedSourceColorHex).lch()\n : chroma(scaledColor[1] as Channel).lch(),\n oklch:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ? chroma(simulatedSourceColorHex).oklch()\n : chroma(scaledColor[1] as Channel).oklch(),\n lab:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ? chroma(simulatedSourceColorHex).lab()\n : chroma(scaledColor[1] as Channel).lab(),\n oklab:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ? chroma(simulatedSourceColorHex).oklab()\n : chroma(scaledColor[1] as Channel).oklab(),\n hsl:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled\n ? chroma(simulatedSourceColorHex).hsl()\n : chroma(scaledColor[1] as Channel).hsl(),\n hsluv: [newHsluv.hsluv_h, newHsluv.hsluv_s, newHsluv.hsluv_l],\n alpha: color.alpha.isEnabled\n ? parseFloat(((scaledColor[0][1] as number) / 100).toFixed(2))\n : undefined,\n backgroundColor:\n color.alpha.isEnabled && color.alpha.backgroundColor\n ? chroma(scaledColor[2] as Channel).rgb()\n : undefined,\n mixedColor:\n color.alpha.isEnabled && color.alpha.backgroundColor\n ? new Color({\n visionSimulationMode: theme.visionSimulationMode,\n }).mixColorsRgb(\n [\n ...(scaledColor[1] as Channel),\n parseFloat(\n ((scaledColor[0][1] as number) / 100).toFixed(2)\n ),\n ],\n [...(scaledColor[2] as Channel), 1]\n )\n : undefined,\n isClosestToRef: distance < 4 && !this.base.areSourceColorsLocked,\n isSourceColorLocked:\n index === minDistanceIndex &&\n this.base.areSourceColorsLocked &&\n !color.alpha.isEnabled,\n isTransparent: color.alpha.isEnabled,\n type: 'color shade',\n })\n })\n\n paletteDataThemeItem.colors.push(paletteDataColorItem)\n })\n this.paletteData.themes.push(paletteDataThemeItem)\n })\n\n return this.paletteData\n }\n\n makeLibraryData = (\n options?: Array<\n | 'collection_id'\n | 'mode_id'\n | 'variable_id'\n | 'style_id'\n | 'gl'\n | 'hex'\n | 'description'\n >,\n previousData?: Array<LibraryData>\n ) => {\n const paletteData = this.makePaletteData()\n const workingThemes =\n paletteData.themes.filter((theme) => theme.type === 'custom theme')\n .length === 0\n ? paletteData.themes.filter((theme) => theme.type === 'default theme')\n : paletteData.themes.filter((theme) => theme.type === 'custom theme')\n\n const libraryData: Array<LibraryData> = workingThemes.flatMap((theme) => {\n return theme.colors.flatMap((color) =>\n color.shades.flatMap((shade) => {\n const path =\n workingThemes[0].type === 'custom theme'\n ? `${\n paletteData.name === '' ? '' : paletteData.name + ' / '\n }${theme.name} / ${color.name}`\n : `${paletteData.name === '' ? '' : paletteData.name} / ${\n color.name\n }`\n const generatedId = `${theme.id}:${color.id}:${shade.name}`\n\n const previousItem = previousData?.find(\n (item) => item.id === generatedId\n )\n\n return {\n id: generatedId,\n name: shade.name,\n path: path,\n alpha: shade.alpha ?? 1,\n ...(options?.includes('hex') && { hex: shade.hex }),\n ...(options?.includes('gl') && { gl: shade.gl }),\n ...(options?.includes('description') && {\n description: `${color.description !== '' ? color.description + '・' : ''}${shade.description}`,\n }),\n ...(options?.includes('collection_id') && {\n collectionId: previousItem?.collectionId,\n }),\n ...(options?.includes('mode_id') && {\n modeId: previousItem?.modeId,\n }),\n ...(options?.includes('variable_id') && {\n variableId: previousItem?.variableId,\n }),\n ...(options?.includes('style_id') && {\n styleId: previousItem?.styleId,\n }),\n }\n })\n )\n })\n\n return libraryData\n }\n\n makePaletteFullData = (model: ['hex' | 'gl'] = ['hex']) => {\n const fullPaletteData = {\n base: this.base,\n themes: this.themes,\n libraryData: this.makeLibraryData(model),\n meta: this.meta,\n version: '2025.06',\n type: 'UI_COLOR_PALETTE',\n } as FullConfiguration\n\n return fullPaletteData\n }\n}\n"],"names":["Data","base","themes","meta","__publicField","theme","paletteDataThemeItem","color","scaledColors","lightness","foregroundColorData","Color","backgroundColorData","chroma","colorData","paletteDataColorItem","sourceColor","sourceHsluv","Hsluv","distances","shade","minDistanceIndex","scaledColor","index","distance","scaleName","key","newHsluv","simulatedSourceColorRgb","simulatedSourceColorHex","options","previousData","paletteData","workingThemes","path","generatedId","previousItem","item","model","_a"],"mappings":";;;;;AAkBA,MAAqBA,EAAK;AAAA,EAOxB,YAAY;AAAA,IACV,MAAAC;AAAA,IACA,QAAAC;AAAA,IACA,MAAAC;AAAA,EAAA,GAKC;AAdK,IAAAC,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AAyBR,IAAAA,EAAA,yBAAkB,OACX,KAAA,OAAO,QAAQ,CAACC,MAAU;AAC7B,YAAMC,IAA6C;AAAA,QACjD,IAAID,EAAM;AAAA,QACV,MAAMA,EAAM;AAAA,QACZ,aAAaA,EAAM;AAAA,QACnB,QAAQ,CAAC;AAAA,QACT,MAAMA,EAAM;AAAA,MACd;AACA,WAAK,KAAK,OAAO,QAAQ,CAACE,MAAU;AAC5B,cAAAC,IAAe,OAAO,QAAQH,EAAM,KAAK,EAC5C,QAAQ,EACR,IAAI,CAACI,MAAc;AACd,cAAAF,EAAM,MAAM,WAAW;AACnB,kBAAAG,IAAsB,IAAIC,EAAM;AAAA,cACpC,QAAQ;AAAA,cACR,aAAa;AAAA,gBACXJ,EAAM,IAAI,IAAI;AAAA,gBACdA,EAAM,IAAI,IAAI;AAAA,gBACdA,EAAM,IAAI,IAAI;AAAA,cAChB;AAAA,cACA,OAAO,YAAYE,EAAU,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;AAAA,cACjD,aACEF,EAAM,IAAI,UAAU,SAAYA,EAAM,IAAI,QAAQ;AAAA,cACpD,gBACEA,EAAM,OAAO,UAAU,SAAYA,EAAM,OAA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EAAc;AAAA,YAC5B;AAAA,YACA,IAAIN,KAAA,gBAAAA,EAAS,SAAS,gBAAe;AAAA,cACnC,SAASM,KAAA,gBAAAA,EAAc;AAAA,YAAA;AAAA,UAE3B;AAAA,QACD,CAAA;AAAA,MACH,CACD;AAAA,IAGH;AAEA,IAAAhC,EAAA,6BAAsB,CAACkC,IAAwB,CAAC,KAAK,OAC3B;AAAA,MACtB,MAAM,KAAK;AAAA,MACX,QAAQ,KAAK;AAAA,MACb,aAAa,KAAK,gBAAgBA,CAAK;AAAA,MACvC,MAAM,KAAK;AAAA,MACX,SAAS;AAAA,MACT,MAAM;AAAA,IACR;;AA7ZA,SAAK,OAAOrC,GACZ,KAAK,SAASC,GACd,KAAK,OAAOC,GACZ,KAAK,cAAc;AAAA,MACjB,MAAMF,EAAK,QAAQ;AAAA,MACnB,aAAaA,EAAK;AAAA,MAClB,QAAQ,CAAC;AAAA,MACT,MAAM;AAAA,IACR,GACK,KAAA,iBACHsC,IAAArC,EAAO,KAAK,CAACG,MAAUA,EAAM,SAAS,MAAtC,gBAAAkC,EAAyC,UACxC,CAAC;AAAA,EAAA;AAsZR;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a_ng_d/utils-ui-color-palette",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.8",
|
|
5
5
|
"description": "Core utilities library for UI Color Palette - a color management plugin for design tools. This library provides the foundational color manipulation, contrast calculation, and palette generation features used in the plugin.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|