@xivdyetools/core 5.1.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +26 -0
- package/README.md +57 -10
- package/dist/data/locales/de.json +8 -1
- package/dist/data/locales/en.json +8 -1
- package/dist/data/locales/fr.json +8 -1
- package/dist/data/locales/ja.json +8 -1
- package/dist/data/locales/ko.json +8 -1
- package/dist/data/locales/zh.json +8 -1
- package/dist/data/munsell-hues.json +175 -0
- package/dist/data/oklch-hue-table.json +297 -0
- package/dist/index.d.ts +18 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/services/CharacterColorService.d.ts +1 -1
- package/dist/services/CharacterColorService.d.ts.map +1 -1
- package/dist/services/DyeService.d.ts +35 -0
- package/dist/services/DyeService.d.ts.map +1 -1
- package/dist/services/DyeService.js +35 -0
- package/dist/services/DyeService.js.map +1 -1
- package/dist/services/LocalizationService.d.ts +5 -1
- package/dist/services/LocalizationService.d.ts.map +1 -1
- package/dist/services/LocalizationService.js +8 -0
- package/dist/services/LocalizationService.js.map +1 -1
- package/dist/services/color/ColorConverter.d.ts +39 -0
- package/dist/services/color/ColorConverter.d.ts.map +1 -1
- package/dist/services/color/ColorConverter.js +173 -22
- package/dist/services/color/ColorConverter.js.map +1 -1
- package/dist/services/dye/DyeDatabase.d.ts +10 -1
- package/dist/services/dye/DyeDatabase.d.ts.map +1 -1
- package/dist/services/dye/DyeDatabase.js +34 -2
- package/dist/services/dye/DyeDatabase.js.map +1 -1
- package/dist/services/dye/HarmonyGenerator.d.ts +20 -0
- package/dist/services/dye/HarmonyGenerator.d.ts.map +1 -1
- package/dist/services/dye/HarmonyGenerator.js +11 -1
- package/dist/services/dye/HarmonyGenerator.js.map +1 -1
- package/dist/services/dye/HarmonySelector.d.ts +15 -1
- package/dist/services/dye/HarmonySelector.d.ts.map +1 -1
- package/dist/services/dye/HarmonySelector.js +20 -8
- package/dist/services/dye/HarmonySelector.js.map +1 -1
- package/dist/services/dye/wheels/ColorWheel.d.ts +29 -0
- package/dist/services/dye/wheels/ColorWheel.d.ts.map +1 -0
- package/dist/services/dye/wheels/ColorWheel.js +63 -0
- package/dist/services/dye/wheels/ColorWheel.js.map +1 -0
- package/dist/services/dye/wheels/hue-warp.d.ts +40 -0
- package/dist/services/dye/wheels/hue-warp.d.ts.map +1 -0
- package/dist/services/dye/wheels/hue-warp.js +144 -0
- package/dist/services/dye/wheels/hue-warp.js.map +1 -0
- package/dist/services/dye/wheels/munsell.d.ts +17 -0
- package/dist/services/dye/wheels/munsell.d.ts.map +1 -0
- package/dist/services/dye/wheels/munsell.js +18 -0
- package/dist/services/dye/wheels/munsell.js.map +1 -0
- package/dist/services/dye/wheels/oklch-hue.d.ts +22 -0
- package/dist/services/dye/wheels/oklch-hue.d.ts.map +1 -0
- package/dist/services/dye/wheels/oklch-hue.js +23 -0
- package/dist/services/dye/wheels/oklch-hue.js.map +1 -0
- package/dist/services/dye/wheels/oklch-lightness.d.ts +24 -0
- package/dist/services/dye/wheels/oklch-lightness.d.ts.map +1 -0
- package/dist/services/dye/wheels/oklch-lightness.js +65 -0
- package/dist/services/dye/wheels/oklch-lightness.js.map +1 -0
- package/dist/services/dye/wheels/rgb-ryb.d.ts +18 -0
- package/dist/services/dye/wheels/rgb-ryb.d.ts.map +1 -0
- package/dist/services/dye/wheels/rgb-ryb.js +47 -0
- package/dist/services/dye/wheels/rgb-ryb.js.map +1 -0
- package/dist/services/dye/wheels/types.d.ts +40 -0
- package/dist/services/dye/wheels/types.d.ts.map +1 -0
- package/dist/services/dye/wheels/types.js +11 -0
- package/dist/services/dye/wheels/types.js.map +1 -0
- package/dist/services/localization/LocaleLoader.d.ts +8 -0
- package/dist/services/localization/LocaleLoader.d.ts.map +1 -1
- package/dist/services/localization/LocaleLoader.js +8 -0
- package/dist/services/localization/LocaleLoader.js.map +1 -1
- package/dist/services/localization/LocaleRegistry.d.ts +9 -0
- package/dist/services/localization/LocaleRegistry.d.ts.map +1 -1
- package/dist/services/localization/LocaleRegistry.js +9 -0
- package/dist/services/localization/LocaleRegistry.js.map +1 -1
- package/dist/services/localization/TranslationProvider.d.ts +6 -1
- package/dist/services/localization/TranslationProvider.d.ts.map +1 -1
- package/dist/services/localization/TranslationProvider.js +8 -0
- package/dist/services/localization/TranslationProvider.js.map +1 -1
- package/package.json +13 -8
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hue-warp wheels: a monotone piecewise-linear bijection between sRGB/HSV hue
|
|
3
|
+
* and a wheel angle. RGB (identity), RYB, Munsell and OKLCH-hue are all this.
|
|
4
|
+
*
|
|
5
|
+
* The target keeps the BASE's HSV saturation and value on the mapped hue —
|
|
6
|
+
* the contract the 2026-09-03 harmony convergence rests on — so on the
|
|
7
|
+
* identity table this reproduces today's output bit for bit.
|
|
8
|
+
*
|
|
9
|
+
* @module services/dye/wheels/hue-warp
|
|
10
|
+
*/
|
|
11
|
+
import { ColorConverter } from '../../color/ColorConverter.js';
|
|
12
|
+
const mod360 = (x) => (x >= 0 && x < 360 ? x : ((x % 360) + 360) % 360);
|
|
13
|
+
/**
|
|
14
|
+
* Every table must be strictly increasing in both columns and run exactly
|
|
15
|
+
* from `[0,0]` to `[360,360]`; otherwise the inverse is ambiguous and a
|
|
16
|
+
* linear-search inverse returns a hue wrong by far more than the dent
|
|
17
|
+
* (research 05 §7: a 0.16° reversal produced a 13° error, silently).
|
|
18
|
+
*/
|
|
19
|
+
export function assertMonotoneTable(table, id) {
|
|
20
|
+
if (table.length < 2) {
|
|
21
|
+
throw new Error(`ColorWheel ${id}: table needs at least two pairs`);
|
|
22
|
+
}
|
|
23
|
+
const first = table[0];
|
|
24
|
+
const last = table[table.length - 1];
|
|
25
|
+
if (first[0] !== 0 || first[1] !== 0) {
|
|
26
|
+
throw new Error(`ColorWheel ${id}: table must start at [0,0]`);
|
|
27
|
+
}
|
|
28
|
+
if (last[0] !== 360 || last[1] !== 360) {
|
|
29
|
+
throw new Error(`ColorWheel ${id}: table must end at [360,360]`);
|
|
30
|
+
}
|
|
31
|
+
for (let i = 1; i < table.length; i++) {
|
|
32
|
+
if (!(table[i][0] > table[i - 1][0]) || !(table[i][1] > table[i - 1][1])) {
|
|
33
|
+
throw new Error(`ColorWheel ${id}: table is not strictly increasing at row ${i}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** Piecewise-linear map of `x` from column `from` to column `to`. */
|
|
38
|
+
function interpolate(table, x, from, to) {
|
|
39
|
+
const v = mod360(x);
|
|
40
|
+
let lo = 0;
|
|
41
|
+
let hi = table.length - 1;
|
|
42
|
+
while (hi - lo > 1) {
|
|
43
|
+
const mid = (lo + hi) >> 1;
|
|
44
|
+
if (table[mid][from] <= v)
|
|
45
|
+
lo = mid;
|
|
46
|
+
else
|
|
47
|
+
hi = mid;
|
|
48
|
+
}
|
|
49
|
+
const a = table[lo];
|
|
50
|
+
const b = table[hi];
|
|
51
|
+
const t = (v - a[from]) / (b[from] - a[from]);
|
|
52
|
+
return mod360(a[to] + t * (b[to] - a[to]));
|
|
53
|
+
}
|
|
54
|
+
/** sRGB/HSV hue → wheel angle. */
|
|
55
|
+
export function toWheelHue(table, hsvHue) {
|
|
56
|
+
return table.length === 2 ? mod360(hsvHue) : interpolate(table, hsvHue, 1, 0);
|
|
57
|
+
}
|
|
58
|
+
/** Wheel angle → sRGB/HSV hue. */
|
|
59
|
+
export function fromWheelHue(table, wheelHue) {
|
|
60
|
+
return table.length === 2 ? mod360(wheelHue) : interpolate(table, wheelHue, 0, 1);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Turn measured `[wheelAngle, hsvHue]` pairs — in any order, with the wheel
|
|
64
|
+
* column wrapping wherever the measurement put its zero — into a valid
|
|
65
|
+
* {@link WarpTable}: sorted by HSV hue, wheel column unwrapped, small dents
|
|
66
|
+
* monotonised with a running maximum, re-zeroed so HSV 0° ↦ wheel 0°, and
|
|
67
|
+
* closed with `[0,0]` and `[360,360]`.
|
|
68
|
+
*
|
|
69
|
+
* Every warp wheel is zeroed at sRGB red, so wheels differ in SPACING only;
|
|
70
|
+
* that is what lets the ring, the nodes and the base spoke share one origin.
|
|
71
|
+
*/
|
|
72
|
+
export function normalizeWarpTable(raw, id, options = {}) {
|
|
73
|
+
const maxCorrection = options.maxCorrectionDeg ?? 1;
|
|
74
|
+
if (raw.length < 3) {
|
|
75
|
+
throw new Error(`ColorWheel ${id}: need at least three measured pairs`);
|
|
76
|
+
}
|
|
77
|
+
const sorted = raw
|
|
78
|
+
.map(([w, h]) => [mod360(w), mod360(h)])
|
|
79
|
+
.sort((a, b) => a[1] - b[1]);
|
|
80
|
+
// Unwrap the wheel column: a backward step larger than half a turn is the
|
|
81
|
+
// measurement's own zero crossing, not a dent.
|
|
82
|
+
const unwrapped = [];
|
|
83
|
+
let offset = 0;
|
|
84
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
85
|
+
let w = sorted[i][0] + offset;
|
|
86
|
+
if (i > 0 && w < unwrapped[i - 1][0] - 180) {
|
|
87
|
+
offset += 360;
|
|
88
|
+
w += 360;
|
|
89
|
+
}
|
|
90
|
+
unwrapped.push([w, sorted[i][1]]);
|
|
91
|
+
}
|
|
92
|
+
// Monotonise small dents; refuse large ones.
|
|
93
|
+
for (let i = 1; i < unwrapped.length; i++) {
|
|
94
|
+
const prev = unwrapped[i - 1][0];
|
|
95
|
+
if (unwrapped[i][0] <= prev) {
|
|
96
|
+
const correction = prev - unwrapped[i][0];
|
|
97
|
+
if (correction > maxCorrection) {
|
|
98
|
+
throw new Error(`ColorWheel ${id}: wheel column reverses by ${correction.toFixed(3)}° at HSV ` +
|
|
99
|
+
`${unwrapped[i][1].toFixed(2)}°, more than the ${maxCorrection}° tolerance`);
|
|
100
|
+
}
|
|
101
|
+
unwrapped[i][0] = prev + 1e-6;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Wheel angle at HSV 0°, by interpolating across the wrap-around segment.
|
|
105
|
+
const [wFirst, hFirst] = unwrapped[0];
|
|
106
|
+
const [wLast, hLast] = unwrapped[unwrapped.length - 1];
|
|
107
|
+
const t = (360 - hLast) / (hFirst + 360 - hLast);
|
|
108
|
+
const w0 = wLast + t * (wFirst + 360 - wLast);
|
|
109
|
+
const table = [[0, 0]];
|
|
110
|
+
for (const [w, h] of unwrapped) {
|
|
111
|
+
const shifted = w - w0 + 360; // wFirst ≥ w0 − 360 by construction
|
|
112
|
+
if (h > 0 && shifted > 0 && shifted < 360)
|
|
113
|
+
table.push([shifted, h]);
|
|
114
|
+
}
|
|
115
|
+
table.push([360, 360]);
|
|
116
|
+
assertMonotoneTable(table, id);
|
|
117
|
+
return table;
|
|
118
|
+
}
|
|
119
|
+
/** Build a wheel from a table. Throws at construction on a bad table. */
|
|
120
|
+
export function hueWarpWheel(id, table) {
|
|
121
|
+
assertMonotoneTable(table, id);
|
|
122
|
+
return {
|
|
123
|
+
id,
|
|
124
|
+
// Every warp wheel's target is the base's own S/V on a re-spaced hue, so
|
|
125
|
+
// angular hue distance to `targetHue` is a meaningful ranking here.
|
|
126
|
+
carriesBaseHsv: true,
|
|
127
|
+
hueOf(hex) {
|
|
128
|
+
return toWheelHue(table, ColorConverter.hexToHsv(hex).h);
|
|
129
|
+
},
|
|
130
|
+
target(baseHex, wheelHue) {
|
|
131
|
+
const base = ColorConverter.hexToHsv(baseHex);
|
|
132
|
+
const targetHue = fromWheelHue(table, wheelHue);
|
|
133
|
+
return { targetHex: ColorConverter.hsvToHex(targetHue, base.s, base.v), targetHue };
|
|
134
|
+
},
|
|
135
|
+
ringStops(count) {
|
|
136
|
+
const stops = [];
|
|
137
|
+
for (let i = 0; i < count; i++) {
|
|
138
|
+
stops.push(ColorConverter.hsvToHex(fromWheelHue(table, (i * 360) / count), 100, 100));
|
|
139
|
+
}
|
|
140
|
+
return stops;
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
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Q,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,CAAC;QACD,MAAM,CAAC,OAAe,EAAE,QAAgB;YACtC,MAAM,IAAI,GAAG,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC9C,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YAChD,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;QACtF,CAAC;QACD,SAAS,CAAC,KAAa;YACrB,MAAM,KAAK,GAAe,EAAE,CAAC;YAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/B,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YACxF,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Munsell hue wheel: 40 principal hues at 3.6° per ASTM step, anchored
|
|
3
|
+
* to sRGB by the renotation data at Value 6 / Chroma 8 (see NOTICE).
|
|
4
|
+
* Red's complement is 5BG, a blue-green — the third answer after RGB (cyan)
|
|
5
|
+
* and RYB (green), and the one Japan's JIS Z 8721 teaches.
|
|
6
|
+
*
|
|
7
|
+
* The 40 raw renotation anchors the table was derived from live in the
|
|
8
|
+
* separate `data/munsell-anchors.json`, which nothing at runtime imports —
|
|
9
|
+
* only `munsell.test.ts`, for its cross-check. Keeping them out of this module
|
|
10
|
+
* keeps them out of every bundle that draws a wheel.
|
|
11
|
+
*
|
|
12
|
+
* @module services/dye/wheels/munsell
|
|
13
|
+
*/
|
|
14
|
+
import type { WarpTable } from './types.js';
|
|
15
|
+
export declare const MUNSELL_TABLE: WarpTable;
|
|
16
|
+
export declare const MUNSELL_WHEEL: import("./types.js").ColorWheel;
|
|
17
|
+
//# sourceMappingURL=munsell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"munsell.d.ts","sourceRoot":"","sources":["../../../../src/services/dye/wheels/munsell.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,aAAa,EAAE,SAAqD,CAAC;AAElF,eAAO,MAAM,aAAa,iCAAyC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Munsell hue wheel: 40 principal hues at 3.6° per ASTM step, anchored
|
|
3
|
+
* to sRGB by the renotation data at Value 6 / Chroma 8 (see NOTICE).
|
|
4
|
+
* Red's complement is 5BG, a blue-green — the third answer after RGB (cyan)
|
|
5
|
+
* and RYB (green), and the one Japan's JIS Z 8721 teaches.
|
|
6
|
+
*
|
|
7
|
+
* The 40 raw renotation anchors the table was derived from live in the
|
|
8
|
+
* separate `data/munsell-anchors.json`, which nothing at runtime imports —
|
|
9
|
+
* only `munsell.test.ts`, for its cross-check. Keeping them out of this module
|
|
10
|
+
* keeps them out of every bundle that draws a wheel.
|
|
11
|
+
*
|
|
12
|
+
* @module services/dye/wheels/munsell
|
|
13
|
+
*/
|
|
14
|
+
import munsellData from '../../../data/munsell-hues.json' with { type: 'json' };
|
|
15
|
+
import { hueWarpWheel } from './hue-warp.js';
|
|
16
|
+
export const MUNSELL_TABLE = munsellData.table;
|
|
17
|
+
export const MUNSELL_WHEEL = hueWarpWheel('munsell', MUNSELL_TABLE);
|
|
18
|
+
//# sourceMappingURL=munsell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"munsell.js","sourceRoot":"","sources":["../../../../src/services/dye/wheels/munsell.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,WAAW,MAAM,iCAAiC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,MAAM,CAAC,MAAM,aAAa,GAAc,WAAW,CAAC,KAA6B,CAAC;AAElF,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The OKLCH-hue wheel: the sRGB hue circle re-spaced so equal angles are equal
|
|
3
|
+
* OKLab hue steps. Targets still carry the base's HSV saturation and value, so
|
|
4
|
+
* it behaves like RYB (a different spacing), not like a different colour space.
|
|
5
|
+
*
|
|
6
|
+
* The raw OKLab hue of the pure-hue circle reverses by 0.16° across HSV
|
|
7
|
+
* 231.4°–240° — invisible on the ring, a 13° inverse error if left alone
|
|
8
|
+
* (research 05 §7). `normalizeWarpTable` monotonises it and the tests pin the
|
|
9
|
+
* result.
|
|
10
|
+
*
|
|
11
|
+
* The table is DATA, generated by `scripts/build-oklch-hue-table.ts` and
|
|
12
|
+
* committed: deriving it here meant 72 `hsvToHex` + `hexToOklch` round trips
|
|
13
|
+
* on every module load, in every bundle that touched a colour wheel.
|
|
14
|
+
* `scripts/lib/oklch-hue-table.test.ts` re-runs the derivation and compares,
|
|
15
|
+
* so the JSON cannot drift from the maths that produced it.
|
|
16
|
+
*
|
|
17
|
+
* @module services/dye/wheels/oklch-hue
|
|
18
|
+
*/
|
|
19
|
+
import type { WarpTable } from './types.js';
|
|
20
|
+
export declare const OKLCH_HUE_TABLE: WarpTable;
|
|
21
|
+
export declare const OKLCH_HUE_WHEEL: import("./types.js").ColorWheel;
|
|
22
|
+
//# sourceMappingURL=oklch-hue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oklch-hue.d.ts","sourceRoot":"","sources":["../../../../src/services/dye/wheels/oklch-hue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,eAAe,EAAE,SAAsD,CAAC;AAErF,eAAO,MAAM,eAAe,iCAA6C,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The OKLCH-hue wheel: the sRGB hue circle re-spaced so equal angles are equal
|
|
3
|
+
* OKLab hue steps. Targets still carry the base's HSV saturation and value, so
|
|
4
|
+
* it behaves like RYB (a different spacing), not like a different colour space.
|
|
5
|
+
*
|
|
6
|
+
* The raw OKLab hue of the pure-hue circle reverses by 0.16° across HSV
|
|
7
|
+
* 231.4°–240° — invisible on the ring, a 13° inverse error if left alone
|
|
8
|
+
* (research 05 §7). `normalizeWarpTable` monotonises it and the tests pin the
|
|
9
|
+
* result.
|
|
10
|
+
*
|
|
11
|
+
* The table is DATA, generated by `scripts/build-oklch-hue-table.ts` and
|
|
12
|
+
* committed: deriving it here meant 72 `hsvToHex` + `hexToOklch` round trips
|
|
13
|
+
* on every module load, in every bundle that touched a colour wheel.
|
|
14
|
+
* `scripts/lib/oklch-hue-table.test.ts` re-runs the derivation and compares,
|
|
15
|
+
* so the JSON cannot drift from the maths that produced it.
|
|
16
|
+
*
|
|
17
|
+
* @module services/dye/wheels/oklch-hue
|
|
18
|
+
*/
|
|
19
|
+
import oklchHueData from '../../../data/oklch-hue-table.json' with { type: 'json' };
|
|
20
|
+
import { hueWarpWheel } from './hue-warp.js';
|
|
21
|
+
export const OKLCH_HUE_TABLE = oklchHueData.table;
|
|
22
|
+
export const OKLCH_HUE_WHEEL = hueWarpWheel('oklch-hue', OKLCH_HUE_TABLE);
|
|
23
|
+
//# sourceMappingURL=oklch-hue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oklch-hue.js","sourceRoot":"","sources":["../../../../src/services/dye/wheels/oklch-hue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,YAAY,MAAM,oCAAoC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,MAAM,CAAC,MAAM,eAAe,GAAc,YAAY,CAAC,KAA6B,CAAC;AAErF,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The constant-lightness OKLCH wheel: rotate hue at the base's OKLab L and C,
|
|
3
|
+
* then gamut-map. Unlike the warp wheels this abandons the base's HSV S/V, so
|
|
4
|
+
* a light base yields light partners and palettes lean toward mid-tones —
|
|
5
|
+
* a deliberate product decision (spec §2.2), not a side effect.
|
|
6
|
+
*
|
|
7
|
+
* @module services/dye/wheels/oklch-lightness
|
|
8
|
+
*/
|
|
9
|
+
import type { ColorWheel } from './types.js';
|
|
10
|
+
/** Ring stops are painted at this L, at the maximum in-gamut chroma per hue. */
|
|
11
|
+
export declare const RING_LIGHTNESS = 0.65;
|
|
12
|
+
/**
|
|
13
|
+
* Below this OKLCH chroma a colour is treated as grey: no hue, no rotation.
|
|
14
|
+
*
|
|
15
|
+
* Pure White (#F9F8F4) measures OKLCH C ≈ 0.0054 and must stay grey under
|
|
16
|
+
* this wheel, so the threshold sits just above it — not at the 0.005 a first
|
|
17
|
+
* draft used, which is just below that dye's real chroma (cross-checked
|
|
18
|
+
* against culori's oklch converter) and would have let it rotate. 0.006
|
|
19
|
+
* stays well under the next dye up by chroma, Charcoal Grey at C ≈ 0.0083,
|
|
20
|
+
* so it does not swallow any colour meant to keep rotating.
|
|
21
|
+
*/
|
|
22
|
+
export declare const ACHROMATIC_CHROMA = 0.006;
|
|
23
|
+
export declare const OKLCH_LIGHTNESS_WHEEL: ColorWheel;
|
|
24
|
+
//# sourceMappingURL=oklch-lightness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oklch-lightness.d.ts","sourceRoot":"","sources":["../../../../src/services/dye/wheels/oklch-lightness.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,gFAAgF;AAChF,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,QAAQ,CAAC;AAMvC,eAAO,MAAM,qBAAqB,EAAE,UAyCnC,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The constant-lightness OKLCH wheel: rotate hue at the base's OKLab L and C,
|
|
3
|
+
* then gamut-map. Unlike the warp wheels this abandons the base's HSV S/V, so
|
|
4
|
+
* a light base yields light partners and palettes lean toward mid-tones —
|
|
5
|
+
* a deliberate product decision (spec §2.2), not a side effect.
|
|
6
|
+
*
|
|
7
|
+
* @module services/dye/wheels/oklch-lightness
|
|
8
|
+
*/
|
|
9
|
+
import { ColorConverter } from '../../color/ColorConverter.js';
|
|
10
|
+
/** Ring stops are painted at this L, at the maximum in-gamut chroma per hue. */
|
|
11
|
+
export const RING_LIGHTNESS = 0.65;
|
|
12
|
+
/**
|
|
13
|
+
* Below this OKLCH chroma a colour is treated as grey: no hue, no rotation.
|
|
14
|
+
*
|
|
15
|
+
* Pure White (#F9F8F4) measures OKLCH C ≈ 0.0054 and must stay grey under
|
|
16
|
+
* this wheel, so the threshold sits just above it — not at the 0.005 a first
|
|
17
|
+
* draft used, which is just below that dye's real chroma (cross-checked
|
|
18
|
+
* against culori's oklch converter) and would have let it rotate. 0.006
|
|
19
|
+
* stays well under the next dye up by chroma, Charcoal Grey at C ≈ 0.0083,
|
|
20
|
+
* so it does not swallow any colour meant to keep rotating.
|
|
21
|
+
*/
|
|
22
|
+
export const ACHROMATIC_CHROMA = 0.006;
|
|
23
|
+
const mod360 = (x) => ((x % 360) + 360) % 360;
|
|
24
|
+
let ringCache = null;
|
|
25
|
+
export const OKLCH_LIGHTNESS_WHEEL = {
|
|
26
|
+
id: 'oklch-lightness',
|
|
27
|
+
// This wheel abandons the base's HSV S/V for its OKLab L and C, so ranking
|
|
28
|
+
// candidates by angular hue distance would discard exactly the property the
|
|
29
|
+
// wheel exists to preserve. `HarmonySelector` reads this and forces ΔE.
|
|
30
|
+
carriesBaseHsv: false,
|
|
31
|
+
hueOf(hex) {
|
|
32
|
+
const { C, h } = ColorConverter.hexToOklch(hex);
|
|
33
|
+
// A grey has no hue: its measured OKLab angle is an artefact of 8-bit
|
|
34
|
+
// rounding (#808080 reads ≈ 90°, Pure White ≈ 250°), which would park the
|
|
35
|
+
// base spoke at an arbitrary and unstable angle. Every warp wheel puts a
|
|
36
|
+
// grey at 0 (HSV hue of a grey is 0); this one does too.
|
|
37
|
+
if (C < ACHROMATIC_CHROMA)
|
|
38
|
+
return 0;
|
|
39
|
+
return mod360(h);
|
|
40
|
+
},
|
|
41
|
+
target(baseHex, wheelHue) {
|
|
42
|
+
const base = ColorConverter.hexToOklch(baseHex);
|
|
43
|
+
if (base.C < ACHROMATIC_CHROMA) {
|
|
44
|
+
// A grey has no hue to rotate; every partner of a grey is that grey.
|
|
45
|
+
const { r, g, b } = ColorConverter.hexToRgb(baseHex);
|
|
46
|
+
const hex = ColorConverter.rgbToHex(r, g, b);
|
|
47
|
+
return { targetHex: hex, targetHue: ColorConverter.hexToHsv(hex).h };
|
|
48
|
+
}
|
|
49
|
+
const targetHex = ColorConverter.gamutMapOklch(base.L, base.C, mod360(wheelHue));
|
|
50
|
+
return { targetHex, targetHue: ColorConverter.hexToHsv(targetHex).h };
|
|
51
|
+
},
|
|
52
|
+
ringStops(count) {
|
|
53
|
+
if (ringCache && ringCache.count === count)
|
|
54
|
+
return ringCache.stops;
|
|
55
|
+
const stops = [];
|
|
56
|
+
for (let i = 0; i < count; i++) {
|
|
57
|
+
const h = (i * 360) / count;
|
|
58
|
+
const c = ColorConverter.maxChromaOklch(RING_LIGHTNESS, h);
|
|
59
|
+
stops.push(ColorConverter.gamutMapOklch(RING_LIGHTNESS, c, h));
|
|
60
|
+
}
|
|
61
|
+
ringCache = { count, stops };
|
|
62
|
+
return stops;
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=oklch-lightness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oklch-lightness.js","sourceRoot":"","sources":["../../../../src/services/dye/wheels/oklch-lightness.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG/D,gFAAgF;AAChF,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAEnC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEvC,MAAM,MAAM,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAE9D,IAAI,SAAS,GAAyD,IAAI,CAAC;AAE3E,MAAM,CAAC,MAAM,qBAAqB,GAAe;IAC/C,EAAE,EAAE,iBAAiB;IAErB,2EAA2E;IAC3E,4EAA4E;IAC5E,wEAAwE;IACxE,cAAc,EAAE,KAAK;IAErB,KAAK,CAAC,GAAW;QACf,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAChD,sEAAsE;QACtE,0EAA0E;QAC1E,yEAAyE;QACzE,yDAAyD;QACzD,IAAI,CAAC,GAAG,iBAAiB;YAAE,OAAO,CAAC,CAAC;QACpC,OAAO,MAAM,CAAC,C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AE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACjE,CAAC;QACD,SAAS,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The RGB (identity) and RYB (artist's) wheels.
|
|
3
|
+
*
|
|
4
|
+
* RYB is the 25-pair NodeBox/Paletton/Adobe hue warp. **Column 1 is the RYB
|
|
5
|
+
* angle, column 2 the sRGB hue** — the most-read write-up states it the other
|
|
6
|
+
* way round in prose while implementing it correctly, and reversing it turns
|
|
7
|
+
* red's complement from green into blue while a naïve "≠ 180°" test still
|
|
8
|
+
* passes (research 01 §1a). `registry.test.ts` asserts the values.
|
|
9
|
+
*
|
|
10
|
+
* @module services/dye/wheels/rgb-ryb
|
|
11
|
+
*/
|
|
12
|
+
import type { WarpTable } from './types.js';
|
|
13
|
+
/** The identity: today's Harmony Explorer, bit for bit. */
|
|
14
|
+
export declare const RGB_WHEEL: import("./types.js").ColorWheel;
|
|
15
|
+
/** `[rybAngle, srgbHue]`. Red's complement (RYB 180°) is sRGB 138°. */
|
|
16
|
+
export declare const RYB_TABLE: WarpTable;
|
|
17
|
+
export declare const RYB_WHEEL: import("./types.js").ColorWheel;
|
|
18
|
+
//# sourceMappingURL=rgb-ryb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rgb-ryb.d.ts","sourceRoot":"","sources":["../../../../src/services/dye/wheels/rgb-ryb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,2DAA2D;AAC3D,eAAO,MAAM,SAAS,iCAGpB,CAAC;AAEH,uEAAuE;AACvE,eAAO,MAAM,SAAS,EAAE,SA0BvB,CAAC;AAEF,eAAO,MAAM,SAAS,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The RGB (identity) and RYB (artist's) wheels.
|
|
3
|
+
*
|
|
4
|
+
* RYB is the 25-pair NodeBox/Paletton/Adobe hue warp. **Column 1 is the RYB
|
|
5
|
+
* angle, column 2 the sRGB hue** — the most-read write-up states it the other
|
|
6
|
+
* way round in prose while implementing it correctly, and reversing it turns
|
|
7
|
+
* red's complement from green into blue while a naïve "≠ 180°" test still
|
|
8
|
+
* passes (research 01 §1a). `registry.test.ts` asserts the values.
|
|
9
|
+
*
|
|
10
|
+
* @module services/dye/wheels/rgb-ryb
|
|
11
|
+
*/
|
|
12
|
+
import { hueWarpWheel } from './hue-warp.js';
|
|
13
|
+
/** The identity: today's Harmony Explorer, bit for bit. */
|
|
14
|
+
export const RGB_WHEEL = hueWarpWheel('rgb', [
|
|
15
|
+
[0, 0],
|
|
16
|
+
[360, 360],
|
|
17
|
+
]);
|
|
18
|
+
/** `[rybAngle, srgbHue]`. Red's complement (RYB 180°) is sRGB 138°. */
|
|
19
|
+
export const RYB_TABLE = [
|
|
20
|
+
[0, 0],
|
|
21
|
+
[15, 8],
|
|
22
|
+
[30, 17],
|
|
23
|
+
[45, 26],
|
|
24
|
+
[60, 34],
|
|
25
|
+
[75, 41],
|
|
26
|
+
[90, 48],
|
|
27
|
+
[105, 54],
|
|
28
|
+
[120, 60],
|
|
29
|
+
[135, 81],
|
|
30
|
+
[150, 103],
|
|
31
|
+
[165, 123],
|
|
32
|
+
[180, 138],
|
|
33
|
+
[195, 155],
|
|
34
|
+
[210, 171],
|
|
35
|
+
[225, 187],
|
|
36
|
+
[240, 204],
|
|
37
|
+
[255, 219],
|
|
38
|
+
[270, 234],
|
|
39
|
+
[285, 251],
|
|
40
|
+
[300, 267],
|
|
41
|
+
[315, 282],
|
|
42
|
+
[330, 298],
|
|
43
|
+
[345, 329],
|
|
44
|
+
[360, 360],
|
|
45
|
+
];
|
|
46
|
+
export const RYB_WHEEL = hueWarpWheel('ryb', RYB_TABLE);
|
|
47
|
+
//# sourceMappingURL=rgb-ryb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rgb-ryb.js","sourceRoot":"","sources":["../../../../src/services/dye/wheels/rgb-ryb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,2DAA2D;AAC3D,MAAM,CAAC,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,EAAE;IAC3C,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,CAAC,GAAG,EAAE,GAAG,CAAC;CACX,CAAC,CAAC;AAEH,uEAAuE;AACvE,MAAM,CAAC,MAAM,SAAS,GAAc;IAClC,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,CAAC,EAAE,EAAE,EAAE,CAAC;IACR,CAAC,EAAE,EAAE,EAAE,CAAC;IACR,CAAC,EAAE,EAAE,EAAE,CAAC;IACR,CAAC,EAAE,EAAE,EAAE,CAAC;IACR,CAAC,EAAE,EAAE,EAAE,CAAC;IACR,CAAC,GAAG,EAAE,EAAE,CAAC;IACT,CAAC,GAAG,EAAE,EAAE,CAAC;IACT,CAAC,GAAG,EAAE,EAAE,CAAC;IACT,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A colour wheel for the Harmony Explorer: how a colour becomes an angle, how
|
|
3
|
+
* an angle becomes a target colour, and how the ring is painted.
|
|
4
|
+
*
|
|
5
|
+
* Every consumer — the web app, the Discord bot, the OG card — reads wheels
|
|
6
|
+
* from this package and holds no list of its own (spec §2).
|
|
7
|
+
*
|
|
8
|
+
* @module services/dye/wheels/types
|
|
9
|
+
*/
|
|
10
|
+
import type { ColorWheelId, HexColor } from '@xivdyetools/types';
|
|
11
|
+
export type { ColorWheelId };
|
|
12
|
+
export interface ColorWheel {
|
|
13
|
+
readonly id: ColorWheelId;
|
|
14
|
+
/**
|
|
15
|
+
* True when targets carry the base's HSV S/V (hue-distance ranking is
|
|
16
|
+
* meaningful). False for wheels that preserve lightness/chroma instead,
|
|
17
|
+
* which must always rank by ΔE.
|
|
18
|
+
*/
|
|
19
|
+
readonly carriesBaseHsv: boolean;
|
|
20
|
+
/** Where a colour sits on this wheel, 0–360. */
|
|
21
|
+
hueOf(hex: string): number;
|
|
22
|
+
/**
|
|
23
|
+
* The ideal colour for a slot at `wheelHue`, carrying whatever this wheel
|
|
24
|
+
* preserves from the base. `targetHue` is always an sRGB/HSV hue, because
|
|
25
|
+
* the non-perceptual ranking branch compares dye HSV hue against it.
|
|
26
|
+
*/
|
|
27
|
+
target(baseHex: string, wheelHue: number): {
|
|
28
|
+
targetHex: HexColor;
|
|
29
|
+
targetHue: number;
|
|
30
|
+
};
|
|
31
|
+
/** Ring paint at `count` evenly spaced wheel angles, plain in-gamut hex. */
|
|
32
|
+
ringStops(count: number): readonly HexColor[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* `[wheelAngle, hsvHue]` pairs, both 0–360, first pair `[0, 0]`, last pair
|
|
36
|
+
* `[360, 360]`, both columns strictly increasing. A hue-warp wheel is defined
|
|
37
|
+
* entirely by one of these.
|
|
38
|
+
*/
|
|
39
|
+
export type WarpTable = ReadonlyArray<readonly [number, number]>;
|
|
40
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/services/dye/wheels/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEjE,YAAY,EAAE,YAAY,EAAE,CAAC;AAE7B,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,gDAAgD;IAChD,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG;QAAE,SAAS,EAAE,QAAQ,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IACtF,4EAA4E;IAC5E,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,QAAQ,EAAE,CAAC;CAC/C;AAED;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A colour wheel for the Harmony Explorer: how a colour becomes an angle, how
|
|
3
|
+
* an angle becomes a target colour, and how the ring is painted.
|
|
4
|
+
*
|
|
5
|
+
* Every consumer — the web app, the Discord bot, the OG card — reads wheels
|
|
6
|
+
* from this package and holds no list of its own (spec §2).
|
|
7
|
+
*
|
|
8
|
+
* @module services/dye/wheels/types
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/services/dye/wheels/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -18,6 +18,14 @@ export declare class LocaleLoader {
|
|
|
18
18
|
* @returns Locale data
|
|
19
19
|
* @throws {AppError} If locale file fails to load or is invalid
|
|
20
20
|
*
|
|
21
|
+
* Documentation-only note (2026-09-16 audit, coordinator ruling on
|
|
22
|
+
* BUG-010's sibling finding): the returned object is the **shared bundled
|
|
23
|
+
* locale module itself**, not a clone — every caller for a given locale
|
|
24
|
+
* gets back the same reference. Treat it as read-only. It is not cloned
|
|
25
|
+
* because there are six locale trees (`en`/`ja`/`de`/`fr`/`ko`/`zh`),
|
|
26
|
+
* loaded per call, and a deep clone on every lookup would be wasted work
|
|
27
|
+
* for data that is never legitimately mutated at runtime.
|
|
28
|
+
*
|
|
21
29
|
* @example
|
|
22
30
|
* ```typescript
|
|
23
31
|
* const loader = new LocaleLoader();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocaleLoader.d.ts","sourceRoot":"","sources":["../../../src/services/localization/LocaleLoader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAqBjE;;GAEG;AACH,qBAAa,YAAY;IACvB
|
|
1
|
+
{"version":3,"file":"LocaleLoader.d.ts","sourceRoot":"","sources":["../../../src/services/localization/LocaleLoader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAqBjE;;GAEG;AACH,qBAAa,YAAY;IACvB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU;IAuB1C;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;CAkB1B"}
|
|
@@ -34,6 +34,14 @@ export class LocaleLoader {
|
|
|
34
34
|
* @returns Locale data
|
|
35
35
|
* @throws {AppError} If locale file fails to load or is invalid
|
|
36
36
|
*
|
|
37
|
+
* Documentation-only note (2026-09-16 audit, coordinator ruling on
|
|
38
|
+
* BUG-010's sibling finding): the returned object is the **shared bundled
|
|
39
|
+
* locale module itself**, not a clone — every caller for a given locale
|
|
40
|
+
* gets back the same reference. Treat it as read-only. It is not cloned
|
|
41
|
+
* because there are six locale trees (`en`/`ja`/`de`/`fr`/`ko`/`zh`),
|
|
42
|
+
* loaded per call, and a deep clone on every lookup would be wasted work
|
|
43
|
+
* for data that is never legitimately mutated at runtime.
|
|
44
|
+
*
|
|
37
45
|
* @example
|
|
38
46
|
* ```typescript
|
|
39
47
|
* const loader = new LocaleLoader();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocaleLoader.js","sourceRoot":"","sources":["../../../src/services/localization/LocaleLoader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEzD,2DAA2D;AAC3D,OAAO,QAAQ,MAAM,4BAA4B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxE,OAAO,QAAQ,MAAM,4BAA4B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxE,OAAO,QAAQ,MAAM,4BAA4B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxE,OAAO,QAAQ,MAAM,4BAA4B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxE,OAAO,QAAQ,MAAM,4BAA4B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,C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
|
|
@@ -44,6 +44,15 @@ export declare class LocaleRegistry {
|
|
|
44
44
|
* @param locale - Locale code to retrieve
|
|
45
45
|
* @returns Locale data if cached, null otherwise
|
|
46
46
|
*
|
|
47
|
+
* Documentation-only note (2026-09-16 audit, coordinator ruling on
|
|
48
|
+
* BUG-010's sibling finding): this returns the **shared bundled locale
|
|
49
|
+
* module** registered via {@link registerLocale} (itself the same object
|
|
50
|
+
* `LocaleLoader.loadLocale` returned) — every caller retrieving a given
|
|
51
|
+
* locale gets back the same reference. Treat it as read-only; it is not
|
|
52
|
+
* cloned per lookup for the same reason `LocaleLoader` doesn't clone per
|
|
53
|
+
* load — six locale trees is real work to redo on every read for data
|
|
54
|
+
* that is never legitimately mutated at runtime.
|
|
55
|
+
*
|
|
47
56
|
* @example
|
|
48
57
|
* ```typescript
|
|
49
58
|
* const jaData = registry.getLocale('ja');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocaleRegistry.d.ts","sourceRoot":"","sources":["../../../src/services/localization/LocaleRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAA0C;IAEzD;;;;;;;;;;OAUG;IACH,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAItC;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO;IAItC
|
|
1
|
+
{"version":3,"file":"LocaleRegistry.d.ts","sourceRoot":"","sources":["../../../src/services/localization/LocaleRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAA0C;IAEzD;;;;;;;;;;OAUG;IACH,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAItC;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO;IAItC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI;IAIhD;;;;;;;;OAQG;IACH,KAAK,IAAI,IAAI;IAIb;;;;OAIG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
|
|
@@ -47,6 +47,15 @@ export class LocaleRegistry {
|
|
|
47
47
|
* @param locale - Locale code to retrieve
|
|
48
48
|
* @returns Locale data if cached, null otherwise
|
|
49
49
|
*
|
|
50
|
+
* Documentation-only note (2026-09-16 audit, coordinator ruling on
|
|
51
|
+
* BUG-010's sibling finding): this returns the **shared bundled locale
|
|
52
|
+
* module** registered via {@link registerLocale} (itself the same object
|
|
53
|
+
* `LocaleLoader.loadLocale` returned) — every caller retrieving a given
|
|
54
|
+
* locale gets back the same reference. Treat it as read-only; it is not
|
|
55
|
+
* cloned per lookup for the same reason `LocaleLoader` doesn't clone per
|
|
56
|
+
* load — six locale trees is real work to redo on every read for data
|
|
57
|
+
* that is never legitimately mutated at runtime.
|
|
58
|
+
*
|
|
50
59
|
* @example
|
|
51
60
|
* ```typescript
|
|
52
61
|
* const jaData = registry.getLocale('ja');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocaleRegistry.js","sourceRoot":"","sources":["../../../src/services/localization/LocaleRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;GAEG;AACH,MAAM,OAAO,cAAc;IACjB,OAAO,GAAgC,IAAI,GAAG,EAAE,CAAC;IAEzD;;;;;;;;;;OAUG;IACH,cAAc,CAAC,IAAgB;QAC7B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,MAAkB;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"LocaleRegistry.js","sourceRoot":"","sources":["../../../src/services/localization/LocaleRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;GAEG;AACH,MAAM,OAAO,cAAc;IACjB,OAAO,GAAgC,IAAI,GAAG,EAAE,CAAC;IAEzD;;;;;;;;;;OAUG;IACH,cAAc,CAAC,IAAgB;QAC7B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,MAAkB;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,SAAS,CAAC,MAAkB;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;IAC1C,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;CACF"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module services/localization
|
|
8
8
|
*/
|
|
9
|
-
import type { LocaleCode, TranslationKey, HarmonyTypeKey, VisionType, ToolKey, SheetKey, RaceKey, ClanKey } from '@xivdyetools/types';
|
|
9
|
+
import type { LocaleCode, TranslationKey, HarmonyTypeKey, VisionType, ToolKey, SheetKey, RaceKey, ClanKey, ColorWheelId } from '@xivdyetools/types';
|
|
10
10
|
import type { LocaleRegistry } from './LocaleRegistry.js';
|
|
11
11
|
/**
|
|
12
12
|
* Provides translations with automatic fallback to English
|
|
@@ -112,6 +112,11 @@ export declare class TranslationProvider {
|
|
|
112
112
|
* ```
|
|
113
113
|
*/
|
|
114
114
|
getHarmonyType(key: HarmonyTypeKey, locale: LocaleCode): string;
|
|
115
|
+
/**
|
|
116
|
+
* Localised display name of a Harmony Explorer colour wheel, with English
|
|
117
|
+
* fallback and finally the id itself, mirroring {@link getHarmonyType}.
|
|
118
|
+
*/
|
|
119
|
+
getColorWheelName(id: ColorWheelId, locale: LocaleCode): string;
|
|
115
120
|
/**
|
|
116
121
|
* Get vision type with fallback
|
|
117
122
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationProvider.d.ts","sourceRoot":"","sources":["../../../src/services/localization/TranslationProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,UAAU,EACV,OAAO,EACP,QAAQ,EACR,OAAO,EACP,OAAO,
|
|
1
|
+
{"version":3,"file":"TranslationProvider.d.ts","sourceRoot":"","sources":["../../../src/services/localization/TranslationProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,UAAU,EACV,OAAO,EACP,QAAQ,EACR,OAAO,EACP,OAAO,EACP,YAAY,EAEb,MAAM,oBAAoB,CAAC;AAM5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,cAAc;IAE5C;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM;IAqBzD;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,MAAM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