@pixerate/editor 0.163.0 → 0.165.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.
Files changed (159) hide show
  1. package/dist/agent/index.cjs +54 -39
  2. package/dist/agent/index.js +24 -9
  3. package/dist/animation/index.cjs +6 -5
  4. package/dist/animation/index.js +5 -4
  5. package/dist/animation-editor/index.cjs +65 -64
  6. package/dist/animation-editor/index.js +8 -7
  7. package/dist/bridge/cli.cjs +3 -3
  8. package/dist/bridge/cli.js +2 -2
  9. package/dist/bridge/index.cjs +3 -3
  10. package/dist/bridge/index.js +2 -2
  11. package/dist/canvas/displacement.d.cts +34 -2
  12. package/dist/canvas/displacement.d.ts +34 -2
  13. package/dist/canvas/explosion-tools.d.cts +43 -0
  14. package/dist/canvas/explosion-tools.d.ts +43 -0
  15. package/dist/canvas/explosionLayout.d.cts +50 -0
  16. package/dist/canvas/explosionLayout.d.ts +50 -0
  17. package/dist/canvas/explosionState.d.cts +52 -0
  18. package/dist/canvas/explosionState.d.ts +52 -0
  19. package/dist/canvas/index.cjs +512 -168
  20. package/dist/canvas/index.d.cts +3 -0
  21. package/dist/canvas/index.d.ts +3 -0
  22. package/dist/canvas/index.js +434 -90
  23. package/dist/canvas/types.d.cts +27 -2
  24. package/dist/canvas/types.d.ts +27 -2
  25. package/dist/chart/controller.d.cts +31 -2
  26. package/dist/chart/controller.d.ts +31 -2
  27. package/dist/chart/index.cjs +504 -132
  28. package/dist/chart/index.d.cts +2 -0
  29. package/dist/chart/index.d.ts +2 -0
  30. package/dist/chart/index.js +386 -14
  31. package/dist/chart/layout-families.d.cts +7 -0
  32. package/dist/chart/layout-families.d.ts +7 -0
  33. package/dist/chart/links.d.cts +34 -0
  34. package/dist/chart/links.d.ts +34 -0
  35. package/dist/chart/mermaid.d.cts +9 -6
  36. package/dist/chart/mermaid.d.ts +9 -6
  37. package/dist/chart/schemas.d.cts +3 -0
  38. package/dist/chart/schemas.d.ts +3 -0
  39. package/dist/chart/spec.d.cts +3 -2
  40. package/dist/chart/spec.d.ts +3 -2
  41. package/dist/chart/style.d.cts +33 -0
  42. package/dist/chart/style.d.ts +33 -0
  43. package/dist/chart/types.d.cts +24 -2
  44. package/dist/chart/types.d.ts +24 -2
  45. package/dist/{chunk-TALQONZ5.js → chunk-2J5VLJHC.js} +3 -3
  46. package/dist/{chunk-3NEZJCBY.js → chunk-2ZRN43IN.js} +340 -201
  47. package/dist/{chunk-ZVNAMTFO.cjs → chunk-3FSUJIXN.cjs} +18 -174
  48. package/dist/{chunk-RQCMSEM5.cjs → chunk-4QUUHTGJ.cjs} +2 -2
  49. package/dist/{chunk-CIPIESX4.cjs → chunk-4ZC5QJE2.cjs} +3 -3
  50. package/dist/{chunk-S6X2QRVU.cjs → chunk-5UEFBM2M.cjs} +1 -138
  51. package/dist/{chunk-YSAGBIRW.cjs → chunk-64VWWR5U.cjs} +16 -16
  52. package/dist/{chunk-QYZGBVNC.js → chunk-7272D3K2.js} +10 -8
  53. package/dist/{chunk-462WGGXX.cjs → chunk-AMX23CSN.cjs} +27 -16
  54. package/dist/{chunk-3VLOOO3G.js → chunk-BDIM6NVW.js} +1 -1
  55. package/dist/{chunk-POR54B55.js → chunk-CRFSQWKQ.js} +4 -1
  56. package/dist/{chunk-GZ2FM3ZB.js → chunk-DKNEQX7T.js} +6 -162
  57. package/dist/{chunk-JCXMJUQO.cjs → chunk-EGZM52EO.cjs} +3 -3
  58. package/dist/{chunk-ES3UEVUT.cjs → chunk-EUIDTZNQ.cjs} +112 -110
  59. package/dist/{chunk-H3OEM3Q2.js → chunk-F6R67I3A.js} +1 -1
  60. package/dist/{chunk-5FNGLV2D.js → chunk-FEU2XVQH.js} +15 -3
  61. package/dist/{chunk-SZA42R4N.js → chunk-FRBRLKNQ.js} +154 -16
  62. package/dist/chunk-HIDFL5LQ.js +484 -0
  63. package/dist/{chunk-MKTDELCD.js → chunk-I5MRJW7B.js} +1 -1
  64. package/dist/{chunk-SDHZG5TF.js → chunk-ILP77UD6.js} +160 -2
  65. package/dist/{chunk-GKNEJ6EN.cjs → chunk-IMRXC7OA.cjs} +241 -103
  66. package/dist/chunk-KGRZMHZB.js +204 -0
  67. package/dist/{chunk-SET6KJOP.js → chunk-LPIKXPBM.js} +1 -1
  68. package/dist/{chunk-BQWGN5WH.js → chunk-M2TPMYJE.js} +1 -1
  69. package/dist/{chunk-GTELFJRE.cjs → chunk-M5GLQQWG.cjs} +2 -2
  70. package/dist/{chunk-4VU4CP7R.js → chunk-MHLU6GRJ.js} +1 -138
  71. package/dist/{chunk-D54JHQK2.cjs → chunk-MKXK6E4O.cjs} +51 -51
  72. package/dist/{chunk-DAPQGA55.js → chunk-N7NBGT2Y.js} +2 -2
  73. package/dist/chunk-O6OGNDND.js +164 -0
  74. package/dist/{chunk-22KLZZGH.cjs → chunk-ODFCS7HF.cjs} +8 -8
  75. package/dist/{chunk-PA3IMPPS.cjs → chunk-OVYQAYGH.cjs} +81 -81
  76. package/dist/{chunk-YXOW456B.js → chunk-PPEDZ5WR.js} +1 -1
  77. package/dist/{chunk-YGG7WDWT.cjs → chunk-Q25WAFTD.cjs} +21 -18
  78. package/dist/{chunk-SBQVEBSU.cjs → chunk-QO2T6KA5.cjs} +165 -67
  79. package/dist/{chunk-24M7VD6M.cjs → chunk-S4EIAIEW.cjs} +7 -7
  80. package/dist/{chunk-M4MIZPQI.cjs → chunk-SJ2CPTQC.cjs} +189 -15
  81. package/dist/chunk-TFF2GTGN.cjs +153 -0
  82. package/dist/chunk-TTCJPX4U.cjs +204 -0
  83. package/dist/{chunk-NZD2MZJC.cjs → chunk-TVQW26AV.cjs} +35 -23
  84. package/dist/{chunk-R3P2M7HU.cjs → chunk-UVXTOZ2B.cjs} +346 -207
  85. package/dist/{chunk-WI7QJA7A.cjs → chunk-UXETV2NC.cjs} +161 -3
  86. package/dist/{chunk-Z4P2RBMJ.js → chunk-V5GSY3NC.js} +101 -3
  87. package/dist/{chunk-QY4KUDMY.js → chunk-VRXXAXUT.js} +2 -2
  88. package/dist/chunk-VU6WQSMB.cjs +164 -0
  89. package/dist/{chunk-OXERWBKE.js → chunk-X5W645RI.js} +3 -3
  90. package/dist/{chunk-NHLYK3AX.js → chunk-XBQX76CT.js} +182 -8
  91. package/dist/{chunk-5AARIS3R.cjs → chunk-XCDGM7TD.cjs} +37 -37
  92. package/dist/{chunk-EVXQNQND.js → chunk-XZB3TJ6K.js} +16 -5
  93. package/dist/chunk-YBAPT7NL.js +153 -0
  94. package/dist/chunk-Z2UQYMPS.cjs +484 -0
  95. package/dist/color/index.cjs +5 -3
  96. package/dist/color/index.js +12 -10
  97. package/dist/diagram/index.cjs +55 -243
  98. package/dist/diagram/index.js +12 -200
  99. package/dist/export/index.cjs +7 -6
  100. package/dist/export/index.js +6 -5
  101. package/dist/extensions/index.cjs +12 -9
  102. package/dist/extensions/index.js +11 -8
  103. package/dist/gradient/index.cjs +29 -27
  104. package/dist/gradient/index.js +6 -4
  105. package/dist/image-editor/index.cjs +644 -643
  106. package/dist/image-editor/index.js +7 -6
  107. package/dist/index.cjs +21 -18
  108. package/dist/index.js +14 -11
  109. package/dist/paint-editor/index.cjs +19 -18
  110. package/dist/paint-editor/index.js +7 -6
  111. package/dist/parameters/index.cjs +2 -2
  112. package/dist/parameters/index.js +1 -1
  113. package/dist/persistence/assetWrites.d.cts +22 -0
  114. package/dist/persistence/assetWrites.d.ts +22 -0
  115. package/dist/persistence/assets.d.cts +71 -0
  116. package/dist/persistence/assets.d.ts +71 -0
  117. package/dist/persistence/documentStore.d.cts +17 -1
  118. package/dist/persistence/documentStore.d.ts +17 -1
  119. package/dist/persistence/documentTools.d.cts +5 -1
  120. package/dist/persistence/documentTools.d.ts +5 -1
  121. package/dist/persistence/editorAutosave.d.cts +7 -0
  122. package/dist/persistence/editorAutosave.d.ts +7 -0
  123. package/dist/persistence/index.cjs +141 -21
  124. package/dist/persistence/index.js +130 -10
  125. package/dist/persistence/storage.d.cts +13 -1
  126. package/dist/persistence/storage.d.ts +13 -1
  127. package/dist/spreadsheet/index.cjs +3 -3
  128. package/dist/spreadsheet/index.js +2 -2
  129. package/dist/tokens/index.cjs +11 -3
  130. package/dist/tokens/index.d.cts +1 -0
  131. package/dist/tokens/index.d.ts +1 -0
  132. package/dist/tokens/index.js +10 -2
  133. package/dist/tokens/style.d.cts +36 -0
  134. package/dist/tokens/style.d.ts +36 -0
  135. package/dist/tools/index.cjs +15 -3
  136. package/dist/tools/index.d.cts +2 -0
  137. package/dist/tools/index.d.ts +2 -0
  138. package/dist/tools/index.js +14 -2
  139. package/dist/tools/style-tools.d.cts +19 -0
  140. package/dist/tools/style-tools.d.ts +19 -0
  141. package/dist/tools/style.d.cts +212 -0
  142. package/dist/tools/style.d.ts +212 -0
  143. package/dist/tools/view.d.cts +6 -0
  144. package/dist/tools/view.d.ts +6 -0
  145. package/dist/typography/index.cjs +8 -6
  146. package/dist/typography/index.js +5 -3
  147. package/dist/vector/index.cjs +953 -952
  148. package/dist/vector/index.js +7 -6
  149. package/dist/video-editor/index.cjs +8 -7
  150. package/dist/video-editor/index.js +6 -5
  151. package/package.json +1 -1
  152. package/skills/README.md +12 -0
  153. package/skills/pixerate-agent-tools/SKILL.md +34 -1
  154. package/skills/pixerate-chart/SKILL.md +41 -9
  155. package/skills/pixerate-image-editor/SKILL.md +2 -0
  156. package/skills/pixerate-paint-editor/SKILL.md +2 -0
  157. package/skills/pixerate-tokens/SKILL.md +5 -0
  158. package/dist/chunk-ERAGQL2N.cjs +0 -68
  159. package/dist/chunk-KMU6QJB7.js +0 -68
@@ -6,6 +6,7 @@
6
6
 
7
7
 
8
8
 
9
+ var _chunkTFF2GTGNcjs = require('./chunk-TFF2GTGN.cjs');
9
10
 
10
11
 
11
12
 
@@ -20,7 +21,8 @@
20
21
 
21
22
 
22
23
 
23
- var _chunkS6X2QRVUcjs = require('./chunk-S6X2QRVU.cjs');
24
+
25
+ var _chunk5UEFBM2Mcjs = require('./chunk-5UEFBM2M.cjs');
24
26
 
25
27
  // src/color/vision.ts
26
28
  var CVD = {
@@ -43,13 +45,13 @@ var CVD = {
43
45
  var clamp01 = (v) => Math.max(0, Math.min(1, v));
44
46
  function simulateColorVision(c, vision) {
45
47
  if (vision === "normal") return c;
46
- const lr = _chunkS6X2QRVUcjs.srgbToLinear.call(void 0, c.r);
47
- const lg = _chunkS6X2QRVUcjs.srgbToLinear.call(void 0, c.g);
48
- const lb = _chunkS6X2QRVUcjs.srgbToLinear.call(void 0, c.b);
48
+ const lr = _chunk5UEFBM2Mcjs.srgbToLinear.call(void 0, c.r);
49
+ const lg = _chunk5UEFBM2Mcjs.srgbToLinear.call(void 0, c.g);
50
+ const lb = _chunk5UEFBM2Mcjs.srgbToLinear.call(void 0, c.b);
49
51
  const m = CVD[vision];
50
- const r = _chunkS6X2QRVUcjs.linearToSrgb.call(void 0, clamp01(m[0][0] * lr + m[0][1] * lg + m[0][2] * lb));
51
- const g = _chunkS6X2QRVUcjs.linearToSrgb.call(void 0, clamp01(m[1][0] * lr + m[1][1] * lg + m[1][2] * lb));
52
- const b = _chunkS6X2QRVUcjs.linearToSrgb.call(void 0, clamp01(m[2][0] * lr + m[2][1] * lg + m[2][2] * lb));
52
+ const r = _chunk5UEFBM2Mcjs.linearToSrgb.call(void 0, clamp01(m[0][0] * lr + m[0][1] * lg + m[0][2] * lb));
53
+ const g = _chunk5UEFBM2Mcjs.linearToSrgb.call(void 0, clamp01(m[1][0] * lr + m[1][1] * lg + m[1][2] * lb));
54
+ const b = _chunk5UEFBM2Mcjs.linearToSrgb.call(void 0, clamp01(m[2][0] * lr + m[2][1] * lg + m[2][2] * lb));
53
55
  return { r, g, b, a: c.a };
54
56
  }
55
57
  function checkPaletteColors(colors, options = {}) {
@@ -57,8 +59,8 @@ function checkPaletteColors(colors, options = {}) {
57
59
  const minDistance = _nullishCoalesce(options.minDistance, () => ( 0.08));
58
60
  const minContrast = _nullishCoalesce(options.minContrast, () => ( 1.5));
59
61
  const visions = _nullishCoalesce(options.visions, () => ( ["normal", "protanopia", "deuteranopia", "tritanopia"]));
60
- const parsed = colors.map((c) => _chunkS6X2QRVUcjs.parseColor.call(void 0, c));
61
- const surfaceParsed = _chunkS6X2QRVUcjs.parseColor.call(void 0, surfaceStr);
62
+ const parsed = colors.map((c) => _chunk5UEFBM2Mcjs.parseColor.call(void 0, c));
63
+ const surfaceParsed = _chunk5UEFBM2Mcjs.parseColor.call(void 0, surfaceStr);
62
64
  const skipped = colors.filter((_, i) => !parsed[i]);
63
65
  const issues = [];
64
66
  const closest = {};
@@ -68,7 +70,7 @@ function checkPaletteColors(colors, options = {}) {
68
70
  for (let a = 0; a < seen.length; a++) {
69
71
  for (let b = a + 1; b < seen.length; b++) {
70
72
  if (!seen[a] || !seen[b]) continue;
71
- const distance = _chunkS6X2QRVUcjs.deltaEOK.call(void 0, seen[a], seen[b]);
73
+ const distance = _chunkTFF2GTGNcjs.deltaEOK.call(void 0, seen[a], seen[b]);
72
74
  if (!best || distance < best.distance) {
73
75
  best = {
74
76
  a,
@@ -92,7 +94,7 @@ function checkPaletteColors(colors, options = {}) {
92
94
  const contrast = colors.map((_, i) => {
93
95
  const c = parsed[i];
94
96
  if (!c || !surfaceParsed) return null;
95
- const ratio = _chunkS6X2QRVUcjs.contrastRatio.call(void 0, c, surfaceParsed);
97
+ const ratio = _chunk5UEFBM2Mcjs.contrastRatio.call(void 0, c, surfaceParsed);
96
98
  return Math.round(ratio * 100) / 100;
97
99
  });
98
100
  contrast.forEach((ratio, i) => {
@@ -153,11 +155,11 @@ function hueToWheel(hue, wheel) {
153
155
  function colorHarmony(base, kind, options = {}) {
154
156
  const wheel = _nullishCoalesce(options.wheel, () => ( "ryb"));
155
157
  const rgb = parseHex(base, "base");
156
- const hsv = _chunkS6X2QRVUcjs.rgbToHsv.call(void 0, rgb);
158
+ const hsv = _chunk5UEFBM2Mcjs.rgbToHsv.call(void 0, rgb);
157
159
  const start = hueToWheel(hsv.h, wheel);
158
160
  const at = (angle) => {
159
161
  const a = (angle % 360 + 360) % 360;
160
- return { color: toHex(_chunkS6X2QRVUcjs.hsvToRgb.call(void 0, { ...hsv, h: wheelToHue(a, wheel) })), angle: Math.round(a * 10) / 10 };
162
+ return { color: toHex(_chunk5UEFBM2Mcjs.hsvToRgb.call(void 0, { ...hsv, h: wheelToHue(a, wheel) })), angle: Math.round(a * 10) / 10 };
161
163
  };
162
164
  const spread = _nullishCoalesce(options.spread, () => ( 30));
163
165
  const offsets = {
@@ -169,10 +171,10 @@ function colorHarmony(base, kind, options = {}) {
169
171
  square: [0, 90, 180, 270]
170
172
  };
171
173
  if (kind === "monochromatic") {
172
- const hsl = _chunkS6X2QRVUcjs.rgbToHsl.call(void 0, rgb);
174
+ const hsl = _chunk5UEFBM2Mcjs.rgbToHsl.call(void 0, rgb);
173
175
  const steps = [0, -0.3, -0.15, 0.15, 0.3];
174
176
  return steps.map((d) => {
175
- const c = d === 0 ? rgb : _chunkS6X2QRVUcjs.hslToRgb.call(void 0, { ...hsl, l: Math.min(0.97, Math.max(0.03, hsl.l + d)) });
177
+ const c = d === 0 ? rgb : _chunk5UEFBM2Mcjs.hslToRgb.call(void 0, { ...hsl, l: Math.min(0.97, Math.max(0.03, hsl.l + d)) });
176
178
  return { color: toHex(c), angle: Math.round(start * 10) / 10 };
177
179
  });
178
180
  }
@@ -183,17 +185,17 @@ function colorHarmony(base, kind, options = {}) {
183
185
 
184
186
  // src/color/mix.ts
185
187
  function mixColors(from, to, t, options = {}) {
186
- const c1 = _chunkS6X2QRVUcjs.parseColor.call(void 0, from);
187
- const c2 = _chunkS6X2QRVUcjs.parseColor.call(void 0, to);
188
+ const c1 = _chunk5UEFBM2Mcjs.parseColor.call(void 0, from);
189
+ const c2 = _chunk5UEFBM2Mcjs.parseColor.call(void 0, to);
188
190
  if (!c1 || !c2) return null;
189
191
  const space = _nullishCoalesce(options.space, () => ( "oklab"));
190
192
  const alpha = c1.a + (c2.a - c1.a) * t;
191
193
  if (space === "oklab") {
192
- const lab1 = _chunkS6X2QRVUcjs.rgbToOklab.call(void 0, c1);
193
- const lab2 = _chunkS6X2QRVUcjs.rgbToOklab.call(void 0, c2);
194
+ const lab1 = _chunk5UEFBM2Mcjs.rgbToOklab.call(void 0, c1);
195
+ const lab2 = _chunk5UEFBM2Mcjs.rgbToOklab.call(void 0, c2);
194
196
  if (alpha <= 1e-9) {
195
197
  const lab3 = { l: lab1.l + (lab2.l - lab1.l) * t, a: 0, b: 0, alpha: 0 };
196
- return _chunkS6X2QRVUcjs.formatHex.call(void 0, _chunkS6X2QRVUcjs.oklabToRgb.call(void 0, lab3));
198
+ return _chunkTFF2GTGNcjs.formatHex.call(void 0, _chunk5UEFBM2Mcjs.oklabToRgb.call(void 0, lab3));
197
199
  }
198
200
  const premul = (k) => lab1[k] * lab1.alpha + (lab2[k] * lab2.alpha - lab1[k] * lab1.alpha) * t;
199
201
  const lab = {
@@ -202,11 +204,11 @@ function mixColors(from, to, t, options = {}) {
202
204
  b: premul("b") / alpha,
203
205
  alpha
204
206
  };
205
- return _chunkS6X2QRVUcjs.formatHex.call(void 0, _chunkS6X2QRVUcjs.oklabToRgb.call(void 0, lab));
207
+ return _chunkTFF2GTGNcjs.formatHex.call(void 0, _chunk5UEFBM2Mcjs.oklabToRgb.call(void 0, lab));
206
208
  }
207
209
  if (space === "oklch") {
208
- const lch1 = _chunkS6X2QRVUcjs.oklabToOklch.call(void 0, _chunkS6X2QRVUcjs.rgbToOklab.call(void 0, c1));
209
- const lch2 = _chunkS6X2QRVUcjs.oklabToOklch.call(void 0, _chunkS6X2QRVUcjs.rgbToOklab.call(void 0, c2));
210
+ const lch1 = _chunk5UEFBM2Mcjs.oklabToOklch.call(void 0, _chunk5UEFBM2Mcjs.rgbToOklab.call(void 0, c1));
211
+ const lch2 = _chunk5UEFBM2Mcjs.oklabToOklch.call(void 0, _chunk5UEFBM2Mcjs.rgbToOklab.call(void 0, c2));
210
212
  let h1 = lch1.h;
211
213
  let h2 = lch2.h;
212
214
  const diff = h2 - h1;
@@ -215,41 +217,41 @@ function mixColors(from, to, t, options = {}) {
215
217
  const h = ((h1 + (h2 - h1) * t) % 360 + 360) % 360;
216
218
  if (alpha <= 1e-9) {
217
219
  const l2 = lch1.l + (lch2.l - lch1.l) * t;
218
- return _chunkS6X2QRVUcjs.formatHex.call(void 0, _chunkS6X2QRVUcjs.oklabToRgb.call(void 0, _chunkS6X2QRVUcjs.oklchToOklab.call(void 0, { l: l2, c: 0, h: 0, alpha: 0 })));
220
+ return _chunkTFF2GTGNcjs.formatHex.call(void 0, _chunk5UEFBM2Mcjs.oklabToRgb.call(void 0, _chunk5UEFBM2Mcjs.oklchToOklab.call(void 0, { l: l2, c: 0, h: 0, alpha: 0 })));
219
221
  }
220
222
  const lPremul = lch1.l * lch1.alpha + (lch2.l * lch2.alpha - lch1.l * lch1.alpha) * t;
221
223
  const cPremul = lch1.c * lch1.alpha + (lch2.c * lch2.alpha - lch1.c * lch1.alpha) * t;
222
224
  const l = lPremul / alpha;
223
225
  const c = cPremul / alpha;
224
- return _chunkS6X2QRVUcjs.formatHex.call(void 0, _chunkS6X2QRVUcjs.oklabToRgb.call(void 0, _chunkS6X2QRVUcjs.oklchToOklab.call(void 0, { l, c, h, alpha })));
226
+ return _chunkTFF2GTGNcjs.formatHex.call(void 0, _chunk5UEFBM2Mcjs.oklabToRgb.call(void 0, _chunk5UEFBM2Mcjs.oklchToOklab.call(void 0, { l, c, h, alpha })));
225
227
  }
226
228
  if (space === "srgb-linear") {
227
- const lr1 = _chunkS6X2QRVUcjs.srgbToLinear.call(void 0, c1.r);
228
- const lg1 = _chunkS6X2QRVUcjs.srgbToLinear.call(void 0, c1.g);
229
- const lb1 = _chunkS6X2QRVUcjs.srgbToLinear.call(void 0, c1.b);
230
- const lr2 = _chunkS6X2QRVUcjs.srgbToLinear.call(void 0, c2.r);
231
- const lg2 = _chunkS6X2QRVUcjs.srgbToLinear.call(void 0, c2.g);
232
- const lb2 = _chunkS6X2QRVUcjs.srgbToLinear.call(void 0, c2.b);
229
+ const lr1 = _chunk5UEFBM2Mcjs.srgbToLinear.call(void 0, c1.r);
230
+ const lg1 = _chunk5UEFBM2Mcjs.srgbToLinear.call(void 0, c1.g);
231
+ const lb1 = _chunk5UEFBM2Mcjs.srgbToLinear.call(void 0, c1.b);
232
+ const lr2 = _chunk5UEFBM2Mcjs.srgbToLinear.call(void 0, c2.r);
233
+ const lg2 = _chunk5UEFBM2Mcjs.srgbToLinear.call(void 0, c2.g);
234
+ const lb2 = _chunk5UEFBM2Mcjs.srgbToLinear.call(void 0, c2.b);
233
235
  if (alpha <= 1e-9) {
234
- return _chunkS6X2QRVUcjs.formatHex.call(void 0, {
235
- r: _chunkS6X2QRVUcjs.linearToSrgb.call(void 0, lr1 + (lr2 - lr1) * t),
236
- g: _chunkS6X2QRVUcjs.linearToSrgb.call(void 0, lg1 + (lg2 - lg1) * t),
237
- b: _chunkS6X2QRVUcjs.linearToSrgb.call(void 0, lb1 + (lb2 - lb1) * t),
236
+ return _chunkTFF2GTGNcjs.formatHex.call(void 0, {
237
+ r: _chunk5UEFBM2Mcjs.linearToSrgb.call(void 0, lr1 + (lr2 - lr1) * t),
238
+ g: _chunk5UEFBM2Mcjs.linearToSrgb.call(void 0, lg1 + (lg2 - lg1) * t),
239
+ b: _chunk5UEFBM2Mcjs.linearToSrgb.call(void 0, lb1 + (lb2 - lb1) * t),
238
240
  a: 0
239
241
  });
240
242
  }
241
243
  const premulR2 = lr1 * c1.a + (lr2 * c2.a - lr1 * c1.a) * t;
242
244
  const premulG2 = lg1 * c1.a + (lg2 * c2.a - lg1 * c1.a) * t;
243
245
  const premulB2 = lb1 * c1.a + (lb2 * c2.a - lb1 * c1.a) * t;
244
- return _chunkS6X2QRVUcjs.formatHex.call(void 0, {
245
- r: _chunkS6X2QRVUcjs.linearToSrgb.call(void 0, premulR2 / alpha),
246
- g: _chunkS6X2QRVUcjs.linearToSrgb.call(void 0, premulG2 / alpha),
247
- b: _chunkS6X2QRVUcjs.linearToSrgb.call(void 0, premulB2 / alpha),
246
+ return _chunkTFF2GTGNcjs.formatHex.call(void 0, {
247
+ r: _chunk5UEFBM2Mcjs.linearToSrgb.call(void 0, premulR2 / alpha),
248
+ g: _chunk5UEFBM2Mcjs.linearToSrgb.call(void 0, premulG2 / alpha),
249
+ b: _chunk5UEFBM2Mcjs.linearToSrgb.call(void 0, premulB2 / alpha),
248
250
  a: alpha
249
251
  });
250
252
  }
251
253
  if (alpha <= 1e-9) {
252
- return _chunkS6X2QRVUcjs.formatHex.call(void 0, {
254
+ return _chunkTFF2GTGNcjs.formatHex.call(void 0, {
253
255
  r: c1.r + (c2.r - c1.r) * t,
254
256
  g: c1.g + (c2.g - c1.g) * t,
255
257
  b: c1.b + (c2.b - c1.b) * t,
@@ -259,7 +261,7 @@ function mixColors(from, to, t, options = {}) {
259
261
  const premulR = c1.r * c1.a + (c2.r * c2.a - c1.r * c1.a) * t;
260
262
  const premulG = c1.g * c1.a + (c2.g * c2.a - c1.g * c1.a) * t;
261
263
  const premulB = c1.b * c1.a + (c2.b * c2.a - c1.b * c1.a) * t;
262
- return _chunkS6X2QRVUcjs.formatHex.call(void 0, {
264
+ return _chunkTFF2GTGNcjs.formatHex.call(void 0, {
263
265
  r: premulR / alpha,
264
266
  g: premulG / alpha,
265
267
  b: premulB / alpha,
@@ -269,9 +271,9 @@ function mixColors(from, to, t, options = {}) {
269
271
 
270
272
  // src/color/recent.ts
271
273
  function pushRecentColor(list, color, max = 12) {
272
- const normal = _chunkS6X2QRVUcjs.normalizeColor.call(void 0, color);
274
+ const normal = _chunkTFF2GTGNcjs.normalizeColor.call(void 0, color);
273
275
  if (!normal) return list.slice();
274
- const next = [normal, ...list.filter((c) => _chunkS6X2QRVUcjs.normalizeColor.call(void 0, c) !== normal)];
276
+ const next = [normal, ...list.filter((c) => _chunkTFF2GTGNcjs.normalizeColor.call(void 0, c) !== normal)];
275
277
  return next.slice(0, max);
276
278
  }
277
279
 
@@ -287,7 +289,7 @@ function isDualColor(value) {
287
289
  function parseDualColor(input) {
288
290
  if (input === null || input === void 0) return null;
289
291
  if (isDualColor(input)) {
290
- if (_chunkS6X2QRVUcjs.parseColor.call(void 0, input.light) === null || _chunkS6X2QRVUcjs.parseColor.call(void 0, input.dark) === null) {
292
+ if (_chunk5UEFBM2Mcjs.parseColor.call(void 0, input.light) === null || _chunk5UEFBM2Mcjs.parseColor.call(void 0, input.dark) === null) {
291
293
  return null;
292
294
  }
293
295
  return { light: input.light, dark: input.dark };
@@ -321,12 +323,12 @@ function parseDualColor(input) {
321
323
  const lightPart = inner.slice(0, commaIndex).trim();
322
324
  const darkPart = inner.slice(commaIndex + 1).trim();
323
325
  if (!lightPart || !darkPart) return null;
324
- if (_chunkS6X2QRVUcjs.parseColor.call(void 0, lightPart) === null || _chunkS6X2QRVUcjs.parseColor.call(void 0, darkPart) === null) {
326
+ if (_chunk5UEFBM2Mcjs.parseColor.call(void 0, lightPart) === null || _chunk5UEFBM2Mcjs.parseColor.call(void 0, darkPart) === null) {
325
327
  return null;
326
328
  }
327
329
  return { light: lightPart, dark: darkPart };
328
330
  }
329
- if (_chunkS6X2QRVUcjs.parseColor.call(void 0, trimmed) !== null) {
331
+ if (_chunk5UEFBM2Mcjs.parseColor.call(void 0, trimmed) !== null) {
330
332
  return { light: trimmed, dark: trimmed };
331
333
  }
332
334
  }
@@ -335,8 +337,8 @@ function parseDualColor(input) {
335
337
  function normalizeDualColor(input) {
336
338
  const parsed = parseDualColor(input);
337
339
  if (!parsed) return null;
338
- const light = _chunkS6X2QRVUcjs.normalizeColor.call(void 0, parsed.light);
339
- const dark = _chunkS6X2QRVUcjs.normalizeColor.call(void 0, parsed.dark);
340
+ const light = _chunkTFF2GTGNcjs.normalizeColor.call(void 0, parsed.light);
341
+ const dark = _chunkTFF2GTGNcjs.normalizeColor.call(void 0, parsed.dark);
340
342
  if (!light || !dark) return null;
341
343
  return { light, dark };
342
344
  }
@@ -346,22 +348,22 @@ function resolveColor(value, scheme) {
346
348
  return scheme === "dark" ? normalized.dark : normalized.light;
347
349
  }
348
350
  function formatDualColor(value) {
349
- const light = _nullishCoalesce(_chunkS6X2QRVUcjs.normalizeColor.call(void 0, value.light), () => ( value.light));
350
- const dark = _nullishCoalesce(_chunkS6X2QRVUcjs.normalizeColor.call(void 0, value.dark), () => ( value.dark));
351
+ const light = _nullishCoalesce(_chunkTFF2GTGNcjs.normalizeColor.call(void 0, value.light), () => ( value.light));
352
+ const dark = _nullishCoalesce(_chunkTFF2GTGNcjs.normalizeColor.call(void 0, value.dark), () => ( value.dark));
351
353
  if (light === dark) {
352
354
  return light;
353
355
  }
354
356
  return `light-dark(${light}, ${dark})`;
355
357
  }
356
358
  function isSameInBothSchemes(value) {
357
- const light = _chunkS6X2QRVUcjs.normalizeColor.call(void 0, value.light);
358
- const dark = _chunkS6X2QRVUcjs.normalizeColor.call(void 0, value.dark);
359
+ const light = _chunkTFF2GTGNcjs.normalizeColor.call(void 0, value.light);
360
+ const dark = _chunkTFF2GTGNcjs.normalizeColor.call(void 0, value.dark);
359
361
  if (!light || !dark) return value.light === value.dark;
360
362
  return light === dark;
361
363
  }
362
364
  function setDualColorSide(value, scheme, color) {
363
365
  const base = _nullishCoalesce(normalizeDualColor(value), () => ( { light: "#000000", dark: "#000000" }));
364
- const normColor = _nullishCoalesce(_chunkS6X2QRVUcjs.normalizeColor.call(void 0, color), () => ( color));
366
+ const normColor = _nullishCoalesce(_chunkTFF2GTGNcjs.normalizeColor.call(void 0, color), () => ( color));
365
367
  return {
366
368
  light: scheme === "light" ? normColor : base.light,
367
369
  dark: scheme === "dark" ? normColor : base.dark
@@ -369,35 +371,35 @@ function setDualColorSide(value, scheme, color) {
369
371
  }
370
372
  function deriveDualColor(color, options) {
371
373
  const fromScheme = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _2 => _2.from]), () => ( "light"));
372
- const baseRgba = _chunkS6X2QRVUcjs.parseColor.call(void 0, color);
374
+ const baseRgba = _chunk5UEFBM2Mcjs.parseColor.call(void 0, color);
373
375
  if (!baseRgba) {
374
376
  throw new Error(`"${String(color)}" is not a colour; pass hex, rgb(), hsl(), oklch() or a CSS colour name.`);
375
377
  }
376
378
  if (_optionalChain([options, 'optionalAccess', _3 => _3.surfaces]) && !normalizeDualColor(options.surfaces)) {
377
379
  throw new Error('The surfaces need a readable light and dark colour, e.g. { light: "#ffffff", dark: "#0b0b0f" }.');
378
380
  }
379
- const baseHex = _chunkS6X2QRVUcjs.formatHex.call(void 0, baseRgba);
380
- const lab = _chunkS6X2QRVUcjs.rgbToOklab.call(void 0, baseRgba);
381
- const lch = _chunkS6X2QRVUcjs.oklabToOklch.call(void 0, lab);
381
+ const baseHex = _chunkTFF2GTGNcjs.formatHex.call(void 0, baseRgba);
382
+ const lab = _chunk5UEFBM2Mcjs.rgbToOklab.call(void 0, baseRgba);
383
+ const lch = _chunk5UEFBM2Mcjs.oklabToOklch.call(void 0, lab);
382
384
  const startL = clamp(1.05 - lch.l, 0.12, 0.95);
383
385
  const targetC = lch.c * 0.9;
384
386
  const targetH = lch.h;
385
387
  let derivedHex;
386
388
  if (_optionalChain([options, 'optionalAccess', _4 => _4.surfaces])) {
387
389
  const surfaces = options.surfaces;
388
- const fromSurfaceRgba = _chunkS6X2QRVUcjs.parseColor.call(void 0, surfaces[fromScheme]);
390
+ const fromSurfaceRgba = _chunk5UEFBM2Mcjs.parseColor.call(void 0, surfaces[fromScheme]);
389
391
  const targetScheme = fromScheme === "light" ? "dark" : "light";
390
- const targetSurfaceRgba = _chunkS6X2QRVUcjs.parseColor.call(void 0, surfaces[targetScheme]);
391
- const targetRatio = _chunkS6X2QRVUcjs.contrastRatio.call(void 0, baseRgba, fromSurfaceRgba);
392
- const targetSurfaceL = _chunkS6X2QRVUcjs.oklabToOklch.call(void 0, _chunkS6X2QRVUcjs.rgbToOklab.call(void 0, targetSurfaceRgba)).l;
392
+ const targetSurfaceRgba = _chunk5UEFBM2Mcjs.parseColor.call(void 0, surfaces[targetScheme]);
393
+ const targetRatio = _chunk5UEFBM2Mcjs.contrastRatio.call(void 0, baseRgba, fromSurfaceRgba);
394
+ const targetSurfaceL = _chunk5UEFBM2Mcjs.oklabToOklch.call(void 0, _chunk5UEFBM2Mcjs.rgbToOklab.call(void 0, targetSurfaceRgba)).l;
393
395
  const preferHigherL = targetSurfaceL < 0.5;
394
396
  let bestDiff = Infinity;
395
397
  let bestL = startL;
396
398
  for (let candL = 0.05; candL <= 0.98; candL += 5e-3) {
397
- const candRgb = _chunkS6X2QRVUcjs.toSrgbGamut.call(void 0,
398
- _chunkS6X2QRVUcjs.oklabToRgb.call(void 0, _chunkS6X2QRVUcjs.oklchToOklab.call(void 0, { l: candL, c: targetC, h: targetH, alpha: baseRgba.a }))
399
+ const candRgb = _chunkTFF2GTGNcjs.toSrgbGamut.call(void 0,
400
+ _chunk5UEFBM2Mcjs.oklabToRgb.call(void 0, _chunk5UEFBM2Mcjs.oklchToOklab.call(void 0, { l: candL, c: targetC, h: targetH, alpha: baseRgba.a }))
399
401
  );
400
- const ratio = _chunkS6X2QRVUcjs.contrastRatio.call(void 0, candRgb, targetSurfaceRgba);
402
+ const ratio = _chunk5UEFBM2Mcjs.contrastRatio.call(void 0, candRgb, targetSurfaceRgba);
401
403
  const diff = Math.abs(ratio - targetRatio);
402
404
  const isBetter = diff < bestDiff - 1e-4 || Math.abs(diff - bestDiff) <= 1e-4 && (preferHigherL ? candL > bestL : candL < bestL);
403
405
  if (isBetter) {
@@ -405,15 +407,15 @@ function deriveDualColor(color, options) {
405
407
  bestL = candL;
406
408
  }
407
409
  }
408
- const finalRgba = _chunkS6X2QRVUcjs.toSrgbGamut.call(void 0,
409
- _chunkS6X2QRVUcjs.oklabToRgb.call(void 0, _chunkS6X2QRVUcjs.oklchToOklab.call(void 0, { l: bestL, c: targetC, h: targetH, alpha: baseRgba.a }))
410
+ const finalRgba = _chunkTFF2GTGNcjs.toSrgbGamut.call(void 0,
411
+ _chunk5UEFBM2Mcjs.oklabToRgb.call(void 0, _chunk5UEFBM2Mcjs.oklchToOklab.call(void 0, { l: bestL, c: targetC, h: targetH, alpha: baseRgba.a }))
410
412
  );
411
- derivedHex = _chunkS6X2QRVUcjs.formatHex.call(void 0, finalRgba);
413
+ derivedHex = _chunkTFF2GTGNcjs.formatHex.call(void 0, finalRgba);
412
414
  } else {
413
- const finalRgba = _chunkS6X2QRVUcjs.toSrgbGamut.call(void 0,
414
- _chunkS6X2QRVUcjs.oklabToRgb.call(void 0, _chunkS6X2QRVUcjs.oklchToOklab.call(void 0, { l: startL, c: targetC, h: targetH, alpha: baseRgba.a }))
415
+ const finalRgba = _chunkTFF2GTGNcjs.toSrgbGamut.call(void 0,
416
+ _chunk5UEFBM2Mcjs.oklabToRgb.call(void 0, _chunk5UEFBM2Mcjs.oklchToOklab.call(void 0, { l: startL, c: targetC, h: targetH, alpha: baseRgba.a }))
415
417
  );
416
- derivedHex = _chunkS6X2QRVUcjs.formatHex.call(void 0, finalRgba);
418
+ derivedHex = _chunkTFF2GTGNcjs.formatHex.call(void 0, finalRgba);
417
419
  }
418
420
  return fromScheme === "light" ? { light: baseHex, dark: derivedHex } : { light: derivedHex, dark: baseHex };
419
421
  }
@@ -428,14 +430,14 @@ function checkDualColorContrast(foreground, background, options) {
428
430
  const lightBgHex = bg.light;
429
431
  const darkFgHex = fg.dark;
430
432
  const darkBgHex = bg.dark;
431
- const lightFg = _chunkS6X2QRVUcjs.parseColor.call(void 0, lightFgHex);
432
- const lightBg = _chunkS6X2QRVUcjs.parseColor.call(void 0, lightBgHex);
433
- const darkFg = _chunkS6X2QRVUcjs.parseColor.call(void 0, darkFgHex);
434
- const darkBg = _chunkS6X2QRVUcjs.parseColor.call(void 0, darkBgHex);
435
- const lightRatio = Math.round(_chunkS6X2QRVUcjs.contrastRatio.call(void 0, lightFg, lightBg) * 100) / 100;
436
- const darkRatio = Math.round(_chunkS6X2QRVUcjs.contrastRatio.call(void 0, darkFg, darkBg) * 100) / 100;
437
- const lightLevel = _chunkS6X2QRVUcjs.contrastLevel.call(void 0, lightRatio, { large });
438
- const darkLevel = _chunkS6X2QRVUcjs.contrastLevel.call(void 0, darkRatio, { large });
433
+ const lightFg = _chunk5UEFBM2Mcjs.parseColor.call(void 0, lightFgHex);
434
+ const lightBg = _chunk5UEFBM2Mcjs.parseColor.call(void 0, lightBgHex);
435
+ const darkFg = _chunk5UEFBM2Mcjs.parseColor.call(void 0, darkFgHex);
436
+ const darkBg = _chunk5UEFBM2Mcjs.parseColor.call(void 0, darkBgHex);
437
+ const lightRatio = Math.round(_chunk5UEFBM2Mcjs.contrastRatio.call(void 0, lightFg, lightBg) * 100) / 100;
438
+ const darkRatio = Math.round(_chunk5UEFBM2Mcjs.contrastRatio.call(void 0, darkFg, darkBg) * 100) / 100;
439
+ const lightLevel = _chunk5UEFBM2Mcjs.contrastLevel.call(void 0, lightRatio, { large });
440
+ const darkLevel = _chunk5UEFBM2Mcjs.contrastLevel.call(void 0, darkRatio, { large });
439
441
  const issues = [];
440
442
  if (lightLevel === "fail") {
441
443
  issues.push(
@@ -552,7 +554,7 @@ function requireColor(input, name) {
552
554
  if (typeof input !== "string" || !input.trim()) {
553
555
  fail(`"${String(input)}" is not a colour I can read; use hex (#2a4b8d), rgb(), hsl(), oklch() or a CSS colour name.`);
554
556
  }
555
- const parsed = _chunkS6X2QRVUcjs.parseColor.call(void 0, input);
557
+ const parsed = _chunk5UEFBM2Mcjs.parseColor.call(void 0, input);
556
558
  if (!parsed) {
557
559
  fail(`"${input}" is not a colour I can read; use hex (#2a4b8d), rgb(), hsl(), oklch() or a CSS colour name.`);
558
560
  }
@@ -565,7 +567,7 @@ function requireDualColor(input, name) {
565
567
  }
566
568
  return parsed;
567
569
  }
568
- var findAccessibleLightness = (fg, bg, large) => _chunkS6X2QRVUcjs.suggestAccessibleForeground.call(void 0, fg, bg, { large });
570
+ var findAccessibleLightness = (fg, bg, large) => _chunkTFF2GTGNcjs.suggestAccessibleForeground.call(void 0, fg, bg, { large });
569
571
  function createColorToolProvider(options = {}) {
570
572
  const id = _nullishCoalesce(options.id, () => ( "color"));
571
573
  const namespace = _nullishCoalesce(options.namespace, () => ( "color"));
@@ -585,18 +587,18 @@ function createColorToolProvider(options = {}) {
585
587
  handler: (args) => {
586
588
  const { color } = args;
587
589
  const rgba = requireColor(color, "color");
588
- const inGamut = _chunkS6X2QRVUcjs.inSrgbGamut.call(void 0, rgba);
589
- const mappedRgba = inGamut ? rgba : _chunkS6X2QRVUcjs.toSrgbGamut.call(void 0, rgba);
590
- const hsl = _chunkS6X2QRVUcjs.rgbToHsl.call(void 0, mappedRgba);
591
- const oklab = _chunkS6X2QRVUcjs.rgbToOklab.call(void 0, rgba);
592
- const oklch = _chunkS6X2QRVUcjs.oklabToOklch.call(void 0, oklab);
590
+ const inGamut = _chunkTFF2GTGNcjs.inSrgbGamut.call(void 0, rgba);
591
+ const mappedRgba = inGamut ? rgba : _chunkTFF2GTGNcjs.toSrgbGamut.call(void 0, rgba);
592
+ const hsl = _chunk5UEFBM2Mcjs.rgbToHsl.call(void 0, mappedRgba);
593
+ const oklab = _chunk5UEFBM2Mcjs.rgbToOklab.call(void 0, rgba);
594
+ const oklch = _chunk5UEFBM2Mcjs.oklabToOklch.call(void 0, oklab);
593
595
  const formats = ["hex", "rgb", "hsl", "oklab", "oklch"];
594
596
  const css = {};
595
597
  for (const f of formats) {
596
- css[f] = _chunkS6X2QRVUcjs.formatColor.call(void 0, rgba, f);
598
+ css[f] = _chunkTFF2GTGNcjs.formatColor.call(void 0, rgba, f);
597
599
  }
598
600
  return {
599
- hex: _chunkS6X2QRVUcjs.formatHex.call(void 0, mappedRgba),
601
+ hex: _chunkTFF2GTGNcjs.formatHex.call(void 0, mappedRgba),
600
602
  alpha: Math.round(rgba.a * 1e3) / 1e3,
601
603
  rgb: {
602
604
  r: Math.round(Math.min(1, Math.max(0, mappedRgba.r)) * 255),
@@ -615,8 +617,8 @@ function createColorToolProvider(options = {}) {
615
617
  },
616
618
  css,
617
619
  inSrgbGamut: inGamut,
618
- ...inGamut ? {} : { gamutMappedHex: _chunkS6X2QRVUcjs.formatHex.call(void 0, mappedRgba) },
619
- relativeLuminance: Math.round(_chunkS6X2QRVUcjs.relativeLuminance.call(void 0, mappedRgba) * 1e4) / 1e4
620
+ ...inGamut ? {} : { gamutMappedHex: _chunkTFF2GTGNcjs.formatHex.call(void 0, mappedRgba) },
621
+ relativeLuminance: Math.round(_chunk5UEFBM2Mcjs.relativeLuminance.call(void 0, mappedRgba) * 1e4) / 1e4
620
622
  };
621
623
  }
622
624
  };
@@ -639,11 +641,11 @@ function createColorToolProvider(options = {}) {
639
641
  const { foreground, background, large = false } = args;
640
642
  const fg = requireColor(foreground, "foreground");
641
643
  const bg = requireColor(background, "background");
642
- const ratio = Math.round(_chunkS6X2QRVUcjs.contrastRatio.call(void 0, fg, bg) * 100) / 100;
643
- const level = _chunkS6X2QRVUcjs.contrastLevel.call(void 0, ratio, { large });
644
+ const ratio = Math.round(_chunk5UEFBM2Mcjs.contrastRatio.call(void 0, fg, bg) * 100) / 100;
645
+ const level = _chunk5UEFBM2Mcjs.contrastLevel.call(void 0, ratio, { large });
644
646
  const passesAA = level === "AA" || level === "AAA";
645
647
  const passesAAA = level === "AAA";
646
- const suggestion = passesAA ? void 0 : _chunkS6X2QRVUcjs.suggestAccessibleForeground.call(void 0, fg, bg, { large });
648
+ const suggestion = passesAA ? void 0 : _chunkTFF2GTGNcjs.suggestAccessibleForeground.call(void 0, fg, bg, { large });
647
649
  return {
648
650
  ratio,
649
651
  level,
@@ -725,7 +727,7 @@ function createColorToolProvider(options = {}) {
725
727
  handler: (args) => {
726
728
  const { base, kind, wheel = "rgb", spread } = args;
727
729
  const rgba = requireColor(base, "base");
728
- const hex = _chunkS6X2QRVUcjs.formatHex.call(void 0, _chunkS6X2QRVUcjs.toSrgbGamut.call(void 0, rgba));
730
+ const hex = _chunkTFF2GTGNcjs.formatHex.call(void 0, _chunkTFF2GTGNcjs.toSrgbGamut.call(void 0, rgba));
729
731
  if (!HARMONY_KINDS.includes(kind)) {
730
732
  fail(`Unknown harmony kind "${kind}"; expected one of ${HARMONY_KINDS.join(", ")}.`);
731
733
  }
@@ -830,10 +832,10 @@ function createColorToolProvider(options = {}) {
830
832
  from,
831
833
  surfaces: keepContrast ? resolvedSurfaces : void 0
832
834
  });
833
- const lightSurfaceRgba = _chunkS6X2QRVUcjs.parseColor.call(void 0, resolvedSurfaces.light);
834
- const darkSurfaceRgba = _chunkS6X2QRVUcjs.parseColor.call(void 0, resolvedSurfaces.dark);
835
- const lightRatio = Math.round(_chunkS6X2QRVUcjs.contrastRatio.call(void 0, _chunkS6X2QRVUcjs.parseColor.call(void 0, derived.light), lightSurfaceRgba) * 100) / 100;
836
- const darkRatio = Math.round(_chunkS6X2QRVUcjs.contrastRatio.call(void 0, _chunkS6X2QRVUcjs.parseColor.call(void 0, derived.dark), darkSurfaceRgba) * 100) / 100;
835
+ const lightSurfaceRgba = _chunk5UEFBM2Mcjs.parseColor.call(void 0, resolvedSurfaces.light);
836
+ const darkSurfaceRgba = _chunk5UEFBM2Mcjs.parseColor.call(void 0, resolvedSurfaces.dark);
837
+ const lightRatio = Math.round(_chunk5UEFBM2Mcjs.contrastRatio.call(void 0, _chunk5UEFBM2Mcjs.parseColor.call(void 0, derived.light), lightSurfaceRgba) * 100) / 100;
838
+ const darkRatio = Math.round(_chunk5UEFBM2Mcjs.contrastRatio.call(void 0, _chunk5UEFBM2Mcjs.parseColor.call(void 0, derived.dark), darkSurfaceRgba) * 100) / 100;
837
839
  return {
838
840
  light: derived.light,
839
841
  dark: derived.dark,
@@ -876,16 +878,16 @@ function createColorToolProvider(options = {}) {
876
878
  const res = checkDualColorContrast(fg, bg, { large });
877
879
  let suggestion;
878
880
  if (res.light.level === "fail") {
879
- const lightFg = _chunkS6X2QRVUcjs.parseColor.call(void 0, fg.light);
880
- const lightBg = _chunkS6X2QRVUcjs.parseColor.call(void 0, bg.light);
881
+ const lightFg = _chunk5UEFBM2Mcjs.parseColor.call(void 0, fg.light);
882
+ const lightBg = _chunk5UEFBM2Mcjs.parseColor.call(void 0, bg.light);
881
883
  const fixed = findAccessibleLightness(lightFg, lightBg, large);
882
884
  if (fixed) {
883
885
  suggestion = { ..._nullishCoalesce(suggestion, () => ( {})), light: fixed };
884
886
  }
885
887
  }
886
888
  if (res.dark.level === "fail") {
887
- const darkFg = _chunkS6X2QRVUcjs.parseColor.call(void 0, fg.dark);
888
- const darkBg = _chunkS6X2QRVUcjs.parseColor.call(void 0, bg.dark);
889
+ const darkFg = _chunk5UEFBM2Mcjs.parseColor.call(void 0, fg.dark);
890
+ const darkBg = _chunk5UEFBM2Mcjs.parseColor.call(void 0, bg.dark);
889
891
  const fixed = findAccessibleLightness(darkFg, darkBg, large);
890
892
  if (fixed) {
891
893
  suggestion = { ..._nullishCoalesce(suggestion, () => ( {})), dark: fixed };
@@ -969,13 +971,13 @@ function pickerStateFromColor(input, previous) {
969
971
  if (typeof input === "object" && "r" in input && "g" in input && "b" in input) {
970
972
  rgba = input;
971
973
  } else if (typeof input === "string") {
972
- rgba = _chunkS6X2QRVUcjs.parseColor.call(void 0, input);
974
+ rgba = _chunk5UEFBM2Mcjs.parseColor.call(void 0, input);
973
975
  } else {
974
976
  return null;
975
977
  }
976
978
  if (!rgba) return null;
977
- const clampedRgba = _chunkS6X2QRVUcjs.toSrgbGamut.call(void 0, rgba);
978
- const hsva = _chunkS6X2QRVUcjs.rgbToHsv.call(void 0, clampedRgba);
979
+ const clampedRgba = _chunkTFF2GTGNcjs.toSrgbGamut.call(void 0, rgba);
980
+ const hsva = _chunk5UEFBM2Mcjs.rgbToHsv.call(void 0, clampedRgba);
979
981
  let h = hsva.h;
980
982
  let s = hsva.s;
981
983
  const v = hsva.v;
@@ -996,13 +998,13 @@ function pickerStateFromColor(input, previous) {
996
998
  };
997
999
  }
998
1000
  function pickerStateToHex(state, forceAlpha = false) {
999
- const rgba = _chunkS6X2QRVUcjs.hsvToRgb.call(void 0, {
1001
+ const rgba = _chunk5UEFBM2Mcjs.hsvToRgb.call(void 0, {
1000
1002
  h: state.h,
1001
1003
  s: state.s,
1002
1004
  v: state.v,
1003
1005
  alpha: state.alpha
1004
1006
  });
1005
- const hex = _chunkS6X2QRVUcjs.formatHex.call(void 0, rgba);
1007
+ const hex = _chunkTFF2GTGNcjs.formatHex.call(void 0, rgba);
1006
1008
  if (forceAlpha && hex.length === 7) {
1007
1009
  return hex + "ff";
1008
1010
  }
@@ -1091,13 +1093,13 @@ function pickerKeyStep(state, target, key, shift) {
1091
1093
  }
1092
1094
  }
1093
1095
  function pickerAreaBackground(state) {
1094
- const pureHueRgb = _chunkS6X2QRVUcjs.hsvToRgb.call(void 0, { h: state.h, s: 1, v: 1, alpha: 1 });
1095
- const hueHex = _chunkS6X2QRVUcjs.formatHex.call(void 0, pureHueRgb);
1096
+ const pureHueRgb = _chunk5UEFBM2Mcjs.hsvToRgb.call(void 0, { h: state.h, s: 1, v: 1, alpha: 1 });
1097
+ const hueHex = _chunkTFF2GTGNcjs.formatHex.call(void 0, pureHueRgb);
1096
1098
  return `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${hueHex})`;
1097
1099
  }
1098
1100
  function pickerAlphaBackground(state) {
1099
- const opaqueRgb = _chunkS6X2QRVUcjs.hsvToRgb.call(void 0, { h: state.h, s: state.s, v: state.v, alpha: 1 });
1100
- const hex = _chunkS6X2QRVUcjs.formatHex.call(void 0, opaqueRgb);
1101
+ const opaqueRgb = _chunk5UEFBM2Mcjs.hsvToRgb.call(void 0, { h: state.h, s: state.s, v: state.v, alpha: 1 });
1102
+ const hex = _chunkTFF2GTGNcjs.formatHex.call(void 0, opaqueRgb);
1101
1103
  return `linear-gradient(to right, transparent, ${hex})`;
1102
1104
  }
1103
1105
  var PICKER_HUE_BACKGROUND = "linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%)";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-5UJHB3BW.js";
5
5
  import {
6
6
  mixColorsOklab
7
- } from "./chunk-BQWGN5WH.js";
7
+ } from "./chunk-M2TPMYJE.js";
8
8
 
9
9
  // src/animation/keyframes.ts
10
10
  var ANIMATION_TIME_EPSILON = 1e-6;
@@ -13,11 +13,12 @@ import {
13
13
  CHART_ORIENTATIONS,
14
14
  CHART_RADAR_GRATICULES,
15
15
  CHART_REFERENCE_AXES,
16
+ CHART_SANKEY_LINK_COLORS,
16
17
  CHART_SERIES_TYPES,
17
18
  CHART_STACKINGS,
18
19
  CHART_TRENDLINE_TYPES,
19
20
  CHART_TYPES
20
- } from "./chunk-3NEZJCBY.js";
21
+ } from "./chunk-2ZRN43IN.js";
21
22
 
22
23
  // src/chart/schemas.ts
23
24
  var VALUE = { type: ["number", "string", "null"], description: 'A number, numeric text ("1,200", "12%", "$40", "(3)") or null for a gap.' };
@@ -112,6 +113,13 @@ var TREE_NODE = {
112
113
  };
113
114
  var TREE_DEFS = { chartTreeNode: TREE_NODE };
114
115
  var TREE_PATH = { type: "array", items: { type: "string" }, minItems: 1, description: 'Names from the top level down to the node, e.g. ["Europe", "France"] (from get_chart treeTable or spec.tree).' };
116
+ var LINK_PROPS = {
117
+ source: { type: "string", description: "Name of the node the flow leaves." },
118
+ target: { type: "string", description: "Name of the node it reaches (a different node; flows only go forwards, no loops)." },
119
+ value: { type: "number", exclusiveMinimum: 0, description: "How much flows, above 0 (its width)." },
120
+ color: { type: "string", description: "CSS colour (default: by sankeyLinkColor)." }
121
+ };
122
+ var LINK_INDEX = { type: "integer", minimum: 0, description: "Flow index (0 = first), as get_chart lists them in spec.links." };
115
123
  var ERROR_BARS = (what) => ({
116
124
  type: ["object", "null"],
117
125
  description: `${what} null removes them.`,
@@ -149,7 +157,7 @@ var SERIES_PROPS = {
149
157
  xErrorBars: ERROR_BARS("Error bars along the x axis (scatter and bubble charts with numeric x values; amounts in x units).")
150
158
  };
151
159
  var CHART_UPDATE_PROPERTIES = {
152
- type: { type: "string", enum: [...CHART_TYPES], description: "Chart type. slope joins each category from the first series (before) to the second (after); likert reads each category as a question and the series as answers from most negative to most positive; parliament draws the first series as seats; sunburst draws the grouped data (set_chart_tree) as rings, and a treemap with grouped data nests its groups." },
160
+ type: { type: "string", enum: [...CHART_TYPES], description: "Chart type. slope joins each category from the first series (before) to the second (after); likert reads each category as a question and the series as answers from most negative to most positive; parliament draws the first series as seats; sunburst draws the grouped data (set_chart_tree) as rings, and a treemap with grouped data nests its groups; sankey draws the flows (set_chart_links)." },
153
161
  title: { type: "string", description: 'Title ("" for none).' },
154
162
  subtitle: { type: "string", description: 'Subtitle ("" for none).' },
155
163
  xAxis: AXIS("Category axis (or numeric x axis of scatter / bubble charts)."),
@@ -185,7 +193,9 @@ var CHART_UPDATE_PROPERTIES = {
185
193
  parliamentArc: { type: "number", minimum: 90, maximum: 360, description: "Parliament: sweep of the hemicycle in degrees (default 180)." },
186
194
  parliamentMajority: { type: ["integer", "null"], minimum: 1, description: "Parliament: seats needed for a majority, drawn as a dashed line (null: half of the seats plus one)." },
187
195
  parliamentLabel: { type: "string", description: 'Parliament: caption under the seat total ("" writes "seats").' },
188
- sunburstLabel: { type: "string", description: 'Sunburst: caption under the total in the centre ("" for none).' }
196
+ sunburstLabel: { type: "string", description: 'Sunburst: caption under the total in the centre ("" for none).' },
197
+ sankeyLinkColor: { type: "string", enum: [...CHART_SANKEY_LINK_COLORS], description: "Sankey: colour each flow by its source node (default), its target node, or grey." },
198
+ sankeyNodes: { type: "array", items: { type: "string" }, description: "Sankey: node names in the order to stack them within their columns (reorder to untangle crossing flows); nodes left out follow in the order the flows name them." }
189
199
  };
190
200
 
191
201
  export {
@@ -202,6 +212,8 @@ export {
202
212
  REFERENCE_INDEX,
203
213
  TREE_DEFS,
204
214
  TREE_PATH,
215
+ LINK_PROPS,
216
+ LINK_INDEX,
205
217
  SERIES_PROPS,
206
218
  CHART_UPDATE_PROPERTIES
207
219
  };