@pixerate/editor 0.236.0 → 0.238.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 (91) hide show
  1. package/README.md +1 -1
  2. package/dist/agent/index.cjs +40 -39
  3. package/dist/agent/index.js +9 -8
  4. package/dist/animation/index.cjs +7 -6
  5. package/dist/animation/index.js +6 -5
  6. package/dist/animation-editor/index.cjs +66 -65
  7. package/dist/animation-editor/index.js +9 -8
  8. package/dist/{brushstrokeRender-WDTKD54B.cjs → brushstrokeRender-MPOM7BFW.cjs} +7 -5
  9. package/dist/{brushstrokeRender-MAHOXL7K.js → brushstrokeRender-WB67GMUP.js} +4 -2
  10. package/dist/canvas/index.cjs +55 -54
  11. package/dist/canvas/index.js +10 -9
  12. package/dist/chart/index.cjs +159 -158
  13. package/dist/chart/index.js +9 -8
  14. package/dist/{chunk-L6Y7TSQ4.js → chunk-36ZTV7WO.js} +1 -1
  15. package/dist/{chunk-JVNGCS26.js → chunk-3E36VDMJ.js} +1 -1
  16. package/dist/{chunk-WRZ6C4TU.cjs → chunk-3R5P3DVY.cjs} +6 -6
  17. package/dist/{chunk-RUONPPMC.cjs → chunk-44BMJJVA.cjs} +8 -8
  18. package/dist/{chunk-YBAPT7NL.js → chunk-6ADHGQ73.js} +4 -2
  19. package/dist/chunk-7AHBW2CQ.cjs +200 -0
  20. package/dist/{chunk-EUIDTZNQ.cjs → chunk-7PT4RJL5.cjs} +113 -111
  21. package/dist/{chunk-CU6ANS5L.js → chunk-7YGBSFC6.js} +2 -2
  22. package/dist/{chunk-ATKKG76G.cjs → chunk-AD7GA3TL.cjs} +23 -23
  23. package/dist/{chunk-FSLKBQU7.js → chunk-AIS56JOO.js} +3 -3
  24. package/dist/{chunk-5VQXSS2S.cjs → chunk-BBUE3UJL.cjs} +86 -86
  25. package/dist/{chunk-7272D3K2.js → chunk-BP6KSGVD.js} +6 -4
  26. package/dist/{chunk-F6R67I3A.js → chunk-CXXXAZ7H.js} +1 -1
  27. package/dist/{chunk-5DQPDXOM.cjs → chunk-D2SGV525.cjs} +76 -76
  28. package/dist/chunk-F67XMVDI.js +200 -0
  29. package/dist/{chunk-PHYOZK3B.js → chunk-FQVVO5YA.js} +85 -8
  30. package/dist/{chunk-UXETV2NC.cjs → chunk-GA4EU4P3.cjs} +4 -4
  31. package/dist/{chunk-UFEDHACQ.js → chunk-GXAK6Q5J.js} +2 -2
  32. package/dist/{chunk-MHLU6GRJ.js → chunk-JEGJP4OW.js} +7 -196
  33. package/dist/{chunk-GOBOCZZI.js → chunk-LEQKZGQI.js} +1 -1
  34. package/dist/{chunk-M5GLQQWG.cjs → chunk-LJZRHVZV.cjs} +2 -2
  35. package/dist/{chunk-N76AMOKE.cjs → chunk-MOW3JMNG.cjs} +42 -42
  36. package/dist/{chunk-WKMUBATU.js → chunk-N4DFDI73.js} +1 -1
  37. package/dist/{chunk-GNZI3KYK.cjs → chunk-NKTNLJUJ.cjs} +49 -9
  38. package/dist/{chunk-TQOL6CF7.js → chunk-PJYG6FCF.js} +49 -9
  39. package/dist/{chunk-V3L7U63N.cjs → chunk-PP6BXVRL.cjs} +1 -1
  40. package/dist/{chunk-TFF2GTGN.cjs → chunk-PPFJHTW5.cjs} +24 -22
  41. package/dist/{chunk-6ZZKRH7R.js → chunk-QARCM66V.js} +3 -3
  42. package/dist/{chunk-5UEFBM2M.cjs → chunk-RD7RX52G.cjs} +18 -207
  43. package/dist/{chunk-CDP2AKMA.js → chunk-RV5DKZHU.js} +1 -1
  44. package/dist/{chunk-HUAISCUX.cjs → chunk-T7KQEMAE.cjs} +18 -18
  45. package/dist/{chunk-BQE3Y6ZO.cjs → chunk-THXFU3JB.cjs} +5 -5
  46. package/dist/{chunk-4ZC5QJE2.cjs → chunk-UTI5IITZ.cjs} +3 -3
  47. package/dist/{chunk-XSVUNSDJ.js → chunk-UUBO6RB5.js} +1 -1
  48. package/dist/{chunk-WPWHT4Z6.cjs → chunk-UZU6DIZA.cjs} +221 -144
  49. package/dist/{chunk-M2TPMYJE.js → chunk-V6DT2CDH.js} +1 -1
  50. package/dist/{chunk-WV5WTOC6.cjs → chunk-W7GRGGBH.cjs} +16 -16
  51. package/dist/{chunk-23E5GI2U.js → chunk-WGN7AUKB.js} +2 -2
  52. package/dist/{chunk-YMREOA67.js → chunk-XK4SST43.js} +2 -2
  53. package/dist/{chunk-SOSBOS5T.cjs → chunk-XWOLPNBW.cjs} +22 -22
  54. package/dist/{chunk-ILP77UD6.js → chunk-YGQVCQTG.js} +1 -1
  55. package/dist/{chunk-GXLZZVR5.cjs → chunk-ZXNO3ZOX.cjs} +37 -37
  56. package/dist/color/index.cjs +6 -4
  57. package/dist/color/index.js +9 -7
  58. package/dist/export/index.cjs +8 -7
  59. package/dist/export/index.js +7 -6
  60. package/dist/extensions/index.cjs +13 -10
  61. package/dist/extensions/index.js +12 -9
  62. package/dist/extensions/loading-node.d.cts +45 -1
  63. package/dist/extensions/loading-node.d.ts +45 -1
  64. package/dist/gradient/index.cjs +29 -28
  65. package/dist/gradient/index.js +4 -3
  66. package/dist/image-editor/index.cjs +778 -777
  67. package/dist/image-editor/index.js +9 -8
  68. package/dist/index.cjs +19 -16
  69. package/dist/index.js +13 -10
  70. package/dist/paint-editor/controller.d.cts +31 -1
  71. package/dist/paint-editor/controller.d.ts +31 -1
  72. package/dist/paint-editor/index.cjs +403 -195
  73. package/dist/paint-editor/index.js +231 -23
  74. package/dist/paint-editor/sticker-tools.d.cts +1 -1
  75. package/dist/paint-editor/sticker-tools.d.ts +1 -1
  76. package/dist/paint-editor/stickers.d.cts +10 -3
  77. package/dist/paint-editor/stickers.d.ts +10 -3
  78. package/dist/paint-editor/ui.d.cts +10 -3
  79. package/dist/paint-editor/ui.d.ts +10 -3
  80. package/dist/tokens/index.cjs +4 -3
  81. package/dist/tokens/index.js +3 -2
  82. package/dist/typography/index.cjs +8 -7
  83. package/dist/typography/index.js +3 -2
  84. package/dist/vector/index.cjs +967 -966
  85. package/dist/vector/index.js +9 -8
  86. package/dist/video-editor/index.cjs +7 -6
  87. package/dist/video-editor/index.js +6 -5
  88. package/package.json +1 -1
  89. package/skills/pixerate-color/SKILL.md +3 -0
  90. package/skills/pixerate-image-editor/SKILL.md +1 -0
  91. package/skills/pixerate-paint-editor/SKILL.md +6 -2
@@ -0,0 +1,200 @@
1
+ import {
2
+ D65_XY,
3
+ apply,
4
+ invert,
5
+ mul,
6
+ rgbToXyzMatrix,
7
+ xyToXyz
8
+ } from "./chunk-6ONMQ6WF.js";
9
+
10
+ // src/color/convert.ts
11
+ function srgbToLinear(v) {
12
+ const sign = Math.sign(v);
13
+ const abs = Math.abs(v);
14
+ return sign * (abs <= 0.04045 ? abs / 12.92 : ((abs + 0.055) / 1.055) ** 2.4);
15
+ }
16
+ function linearToSrgb(v) {
17
+ const sign = Math.sign(v);
18
+ const abs = Math.abs(v);
19
+ return sign * (abs <= 31308e-7 ? 12.92 * abs : 1.055 * abs ** (1 / 2.4) - 0.055);
20
+ }
21
+ function rgbToHsl(rgba) {
22
+ const { r, g, b, a } = rgba;
23
+ const max = Math.max(r, g, b);
24
+ const min = Math.min(r, g, b);
25
+ const d = max - min;
26
+ const l = (max + min) / 2;
27
+ let h = 0;
28
+ if (d > 0) {
29
+ if (max === r) h = 60 * ((g - b) / d % 6);
30
+ else if (max === g) h = 60 * ((b - r) / d + 2);
31
+ else h = 60 * ((r - g) / d + 4);
32
+ }
33
+ if (h < 0) h += 360;
34
+ const s = d === 0 ? 0 : d / (1 - Math.abs(2 * l - 1));
35
+ return { h, s, l, alpha: a };
36
+ }
37
+ function hslToRgb(hsla) {
38
+ const { h, s, l, alpha } = hsla;
39
+ const hh = (h % 360 + 360) % 360 / 60;
40
+ const c = (1 - Math.abs(2 * l - 1)) * s;
41
+ const x = c * (1 - Math.abs(hh % 2 - 1));
42
+ const m = l - c / 2;
43
+ let r = 0;
44
+ let g = 0;
45
+ let b = 0;
46
+ if (hh < 1) {
47
+ r = c;
48
+ g = x;
49
+ b = 0;
50
+ } else if (hh < 2) {
51
+ r = x;
52
+ g = c;
53
+ b = 0;
54
+ } else if (hh < 3) {
55
+ r = 0;
56
+ g = c;
57
+ b = x;
58
+ } else if (hh < 4) {
59
+ r = 0;
60
+ g = x;
61
+ b = c;
62
+ } else if (hh < 5) {
63
+ r = x;
64
+ g = 0;
65
+ b = c;
66
+ } else {
67
+ r = c;
68
+ g = 0;
69
+ b = x;
70
+ }
71
+ return { r: r + m, g: g + m, b: b + m, a: alpha };
72
+ }
73
+ function rgbToHsv(rgba) {
74
+ const { r, g, b, a } = rgba;
75
+ const max = Math.max(r, g, b);
76
+ const min = Math.min(r, g, b);
77
+ const d = max - min;
78
+ let h = 0;
79
+ if (d > 0) {
80
+ if (max === r) h = 60 * ((g - b) / d % 6);
81
+ else if (max === g) h = 60 * ((b - r) / d + 2);
82
+ else h = 60 * ((r - g) / d + 4);
83
+ }
84
+ if (h < 0) h += 360;
85
+ const s = max === 0 ? 0 : d / max;
86
+ return { h, s, v: max, alpha: a };
87
+ }
88
+ function hsvToRgb(hsva) {
89
+ const { h, s, v, alpha } = hsva;
90
+ const hh = (h % 360 + 360) % 360 / 60;
91
+ const c = v * s;
92
+ const x = c * (1 - Math.abs(hh % 2 - 1));
93
+ const m = v - c;
94
+ let r = 0;
95
+ let g = 0;
96
+ let b = 0;
97
+ if (hh < 1) {
98
+ r = c;
99
+ g = x;
100
+ b = 0;
101
+ } else if (hh < 2) {
102
+ r = x;
103
+ g = c;
104
+ b = 0;
105
+ } else if (hh < 3) {
106
+ r = 0;
107
+ g = c;
108
+ b = x;
109
+ } else if (hh < 4) {
110
+ r = 0;
111
+ g = x;
112
+ b = c;
113
+ } else if (hh < 5) {
114
+ r = x;
115
+ g = 0;
116
+ b = c;
117
+ } else {
118
+ r = c;
119
+ g = 0;
120
+ b = x;
121
+ }
122
+ return { r: r + m, g: g + m, b: b + m, a: alpha };
123
+ }
124
+ function rgbToOklab(rgba) {
125
+ const lr = srgbToLinear(rgba.r);
126
+ const lg = srgbToLinear(rgba.g);
127
+ const lb = srgbToLinear(rgba.b);
128
+ const l = Math.cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb);
129
+ const m = Math.cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb);
130
+ const s = Math.cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb);
131
+ return {
132
+ l: 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,
133
+ a: 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,
134
+ b: 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s,
135
+ alpha: rgba.a
136
+ };
137
+ }
138
+ function oklabToRgb(lab) {
139
+ const l_ = lab.l + 0.3963377774 * lab.a + 0.2158037573 * lab.b;
140
+ const m_ = lab.l - 0.1055613458 * lab.a - 0.0638541728 * lab.b;
141
+ const s_ = lab.l - 0.0894841775 * lab.a - 1.291485548 * lab.b;
142
+ const l = l_ ** 3;
143
+ const m = m_ ** 3;
144
+ const s = s_ ** 3;
145
+ return {
146
+ r: linearToSrgb(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s),
147
+ g: linearToSrgb(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s),
148
+ b: linearToSrgb(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s),
149
+ a: lab.alpha
150
+ };
151
+ }
152
+ function oklabToOklch(lab) {
153
+ const c = Math.hypot(lab.a, lab.b);
154
+ let h = 0;
155
+ if (c >= 1e-6) {
156
+ h = Math.atan2(lab.b, lab.a) * 180 / Math.PI;
157
+ if (h < 0) h += 360;
158
+ if (h >= 360) h -= 360;
159
+ }
160
+ return { l: lab.l, c, h, alpha: lab.alpha };
161
+ }
162
+ function oklchToOklab(lch) {
163
+ const rad = lch.h * Math.PI / 180;
164
+ return {
165
+ l: lch.l,
166
+ a: lch.c * Math.cos(rad),
167
+ b: lch.c * Math.sin(rad),
168
+ alpha: lch.alpha
169
+ };
170
+ }
171
+ var D65_XYZ = xyToXyz(D65_XY);
172
+ var SRGB_TO_XYZ = rgbToXyzMatrix([0.64, 0.33], [0.3, 0.6], [0.15, 0.06], D65_XYZ);
173
+ var P3_TO_XYZ = rgbToXyzMatrix([0.68, 0.32], [0.265, 0.69], [0.15, 0.06], D65_XYZ);
174
+ var XYZ_TO_SRGB = invert(SRGB_TO_XYZ);
175
+ var XYZ_TO_P3 = invert(P3_TO_XYZ);
176
+ var P3_TO_SRGB_MAT = mul(XYZ_TO_SRGB, P3_TO_XYZ);
177
+ var SRGB_TO_P3_MAT = mul(XYZ_TO_P3, SRGB_TO_XYZ);
178
+ function linearSrgbToDisplayP3(rgb) {
179
+ const out = apply(SRGB_TO_P3_MAT, [rgb.r, rgb.g, rgb.b]);
180
+ return { r: out[0], g: out[1], b: out[2], a: rgb.a };
181
+ }
182
+ function displayP3ToLinearSrgb(rgb) {
183
+ const out = apply(P3_TO_SRGB_MAT, [rgb.r, rgb.g, rgb.b]);
184
+ return { r: out[0], g: out[1], b: out[2], a: rgb.a };
185
+ }
186
+
187
+ export {
188
+ srgbToLinear,
189
+ linearToSrgb,
190
+ rgbToHsl,
191
+ hslToRgb,
192
+ rgbToHsv,
193
+ hsvToRgb,
194
+ rgbToOklab,
195
+ oklabToRgb,
196
+ oklabToOklch,
197
+ oklchToOklab,
198
+ linearSrgbToDisplayP3,
199
+ displayP3ToLinearSrgb
200
+ };
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  CHART_OOXML_NS,
9
9
  chartFromOoxml
10
- } from "./chunk-L6Y7TSQ4.js";
10
+ } from "./chunk-36ZTV7WO.js";
11
11
  import {
12
12
  compareDocuments
13
13
  } from "./chunk-V5OOP74P.js";
@@ -35,10 +35,10 @@ import {
35
35
  searchDocument,
36
36
  sliceContainsTable,
37
37
  syncInitialContent
38
- } from "./chunk-FSLKBQU7.js";
38
+ } from "./chunk-AIS56JOO.js";
39
39
  import {
40
40
  chartDataToTable
41
- } from "./chunk-6ZZKRH7R.js";
41
+ } from "./chunk-QARCM66V.js";
42
42
  import {
43
43
  PIXERATE_DOCUMENT_MIME,
44
44
  getClipboardData,
@@ -411,12 +411,66 @@ var TemplateSuggestions = Extension2.create({
411
411
 
412
412
  // src/extensions/loading-node.ts
413
413
  import { Node as Node2 } from "@tiptap/core";
414
+ import { DOMSerializer } from "@tiptap/pm/model";
415
+ var SVG_NS = "http://www.w3.org/2000/svg";
416
+ function loadingSpinnerSpec() {
417
+ return [
418
+ `${SVG_NS} svg`,
419
+ {
420
+ width: "1em",
421
+ height: "1em",
422
+ viewBox: "0 0 24 24",
423
+ fill: "none",
424
+ "aria-hidden": "true",
425
+ focusable: "false",
426
+ "data-loading-indicator": ""
427
+ },
428
+ ["circle", { cx: "12", cy: "12", r: "9", stroke: "currentColor", "stroke-width": "3", opacity: "0.25" }],
429
+ [
430
+ "path",
431
+ { d: "M21 12a9 9 0 0 0-9-9", stroke: "currentColor", "stroke-width": "3", "stroke-linecap": "round" },
432
+ [
433
+ "animateTransform",
434
+ {
435
+ attributeName: "transform",
436
+ type: "rotate",
437
+ from: "0 12 12",
438
+ to: "360 12 12",
439
+ dur: "0.8s",
440
+ repeatCount: "indefinite"
441
+ }
442
+ ]
443
+ ]
444
+ ];
445
+ }
446
+ var viewState = (node, options) => ({
447
+ id: node.attrs.id ?? null,
448
+ label: options.label
449
+ });
450
+ var placeholderAttributes = (options, HTMLAttributes) => safeMergeAttributes(
451
+ {
452
+ "data-type": "loading",
453
+ role: "status",
454
+ "aria-label": options.label,
455
+ class: "inline-flex items-center px-1.5 py-0.5 text-xs text-muted-foreground"
456
+ },
457
+ options.HTMLAttributes,
458
+ HTMLAttributes
459
+ );
414
460
  var LoadingNode = Node2.create({
415
461
  name: "loadingNode",
416
462
  group: "inline",
417
463
  inline: true,
418
464
  selectable: true,
419
465
  atom: true,
466
+ addOptions() {
467
+ return {
468
+ label: "Loading\u2026",
469
+ HTMLAttributes: {},
470
+ renderIndicator: null,
471
+ nodeView: null
472
+ };
473
+ },
420
474
  addAttributes() {
421
475
  return {
422
476
  id: {
@@ -439,12 +493,34 @@ var LoadingNode = Node2.create({
439
493
  renderHTML({ HTMLAttributes }) {
440
494
  return [
441
495
  "span",
442
- safeMergeAttributes(HTMLAttributes, {
443
- "data-type": "loading",
444
- class: "inline-flex items-center px-1.5 py-0.5 text-xs text-muted-foreground animate-pulse"
445
- }),
446
- "\u23F3"
496
+ placeholderAttributes(this.options, HTMLAttributes),
497
+ (this.options.renderIndicator ?? loadingSpinnerSpec)()
447
498
  ];
499
+ },
500
+ addNodeView() {
501
+ const options = this.options;
502
+ return ({ node, HTMLAttributes }) => {
503
+ const mount = options.nodeView;
504
+ const { dom } = DOMSerializer.renderSpec(document, [
505
+ "span",
506
+ placeholderAttributes(options, HTMLAttributes),
507
+ ...mount ? [] : [(options.renderIndicator ?? loadingSpinnerSpec)()]
508
+ ]);
509
+ const element = dom;
510
+ const renderer = mount?.(element, viewState(node, options)) ?? null;
511
+ return {
512
+ dom: element,
513
+ update: (next) => {
514
+ if (next.type !== node.type) return false;
515
+ if (next.attrs.id) element.setAttribute("data-id", String(next.attrs.id));
516
+ else element.removeAttribute("data-id");
517
+ renderer?.update(viewState(next, options));
518
+ return true;
519
+ },
520
+ ignoreMutation: () => true,
521
+ destroy: () => renderer?.destroy()
522
+ };
523
+ };
448
524
  }
449
525
  });
450
526
 
@@ -6394,6 +6470,7 @@ export {
6394
6470
  GradientText,
6395
6471
  SlashCommands,
6396
6472
  TemplateSuggestions,
6473
+ loadingSpinnerSpec,
6397
6474
  LoadingNode,
6398
6475
  SMILIE_REPLACEMENTS,
6399
6476
  smilieAutocorrectRules,
@@ -8,7 +8,7 @@ var _chunkA6QWKBJPcjs = require('./chunk-A6QWKBJP.cjs');
8
8
 
9
9
 
10
10
 
11
- var _chunk5UEFBM2Mcjs = require('./chunk-5UEFBM2M.cjs');
11
+ var _chunkRD7RX52Gcjs = require('./chunk-RD7RX52G.cjs');
12
12
 
13
13
  // src/tokens/types.ts
14
14
  var TOKEN_TYPES = ["color", "number", "string", "boolean"];
@@ -1389,10 +1389,10 @@ var contrastPairs = {
1389
1389
  const modes = { [collection.id]: mode.id, [b.collectionId]: _nullishCoalesce(_optionalChain([findTokenMode, 'call', _26 => _26(getTokenCollection(state, b.collectionId), mode.name), 'optionalAccess', _27 => _27.id]), () => ( mode.id)) };
1390
1390
  const fv = resolveToken(state, f.id, modes);
1391
1391
  const bv = resolveToken(state, b.id, modes);
1392
- const fc = fv.ok && typeof fv.value === "string" ? _chunk5UEFBM2Mcjs.parseColor.call(void 0, fv.value) : null;
1393
- const bc = bv.ok && typeof bv.value === "string" ? _chunk5UEFBM2Mcjs.parseColor.call(void 0, bv.value) : null;
1392
+ const fc = fv.ok && typeof fv.value === "string" ? _chunkRD7RX52Gcjs.parseColor.call(void 0, fv.value) : null;
1393
+ const bc = bv.ok && typeof bv.value === "string" ? _chunkRD7RX52Gcjs.parseColor.call(void 0, bv.value) : null;
1394
1394
  if (!fc || !bc) continue;
1395
- const r = _chunk5UEFBM2Mcjs.contrastRatio.call(void 0, fc, bc);
1395
+ const r = _chunkRD7RX52Gcjs.contrastRatio.call(void 0, fc, bc);
1396
1396
  if (r < ratio) {
1397
1397
  findings.push({
1398
1398
  severity: "error",
@@ -11,10 +11,10 @@ import {
11
11
  CHART_OOXML_NS,
12
12
  CHART_OOXML_RELATIONSHIP,
13
13
  chartToOoxml
14
- } from "./chunk-L6Y7TSQ4.js";
14
+ } from "./chunk-36ZTV7WO.js";
15
15
  import {
16
16
  normalizeChartSpec
17
- } from "./chunk-6ZZKRH7R.js";
17
+ } from "./chunk-QARCM66V.js";
18
18
 
19
19
  // src/export/images.ts
20
20
  var DOCX_IMAGE_TYPES = {
@@ -1,188 +1,11 @@
1
1
  import {
2
- D65_XY,
3
- apply,
4
- invert,
5
- mul,
6
- rgbToXyzMatrix,
7
- xyToXyz
8
- } from "./chunk-6ONMQ6WF.js";
9
-
10
- // src/color/convert.ts
11
- function srgbToLinear(v) {
12
- const sign = Math.sign(v);
13
- const abs = Math.abs(v);
14
- return sign * (abs <= 0.04045 ? abs / 12.92 : ((abs + 0.055) / 1.055) ** 2.4);
15
- }
16
- function linearToSrgb(v) {
17
- const sign = Math.sign(v);
18
- const abs = Math.abs(v);
19
- return sign * (abs <= 31308e-7 ? 12.92 * abs : 1.055 * abs ** (1 / 2.4) - 0.055);
20
- }
21
- function rgbToHsl(rgba) {
22
- const { r, g, b, a } = rgba;
23
- const max = Math.max(r, g, b);
24
- const min = Math.min(r, g, b);
25
- const d = max - min;
26
- const l = (max + min) / 2;
27
- let h = 0;
28
- if (d > 0) {
29
- if (max === r) h = 60 * ((g - b) / d % 6);
30
- else if (max === g) h = 60 * ((b - r) / d + 2);
31
- else h = 60 * ((r - g) / d + 4);
32
- }
33
- if (h < 0) h += 360;
34
- const s = d === 0 ? 0 : d / (1 - Math.abs(2 * l - 1));
35
- return { h, s, l, alpha: a };
36
- }
37
- function hslToRgb(hsla) {
38
- const { h, s, l, alpha } = hsla;
39
- const hh = (h % 360 + 360) % 360 / 60;
40
- const c = (1 - Math.abs(2 * l - 1)) * s;
41
- const x = c * (1 - Math.abs(hh % 2 - 1));
42
- const m = l - c / 2;
43
- let r = 0;
44
- let g = 0;
45
- let b = 0;
46
- if (hh < 1) {
47
- r = c;
48
- g = x;
49
- b = 0;
50
- } else if (hh < 2) {
51
- r = x;
52
- g = c;
53
- b = 0;
54
- } else if (hh < 3) {
55
- r = 0;
56
- g = c;
57
- b = x;
58
- } else if (hh < 4) {
59
- r = 0;
60
- g = x;
61
- b = c;
62
- } else if (hh < 5) {
63
- r = x;
64
- g = 0;
65
- b = c;
66
- } else {
67
- r = c;
68
- g = 0;
69
- b = x;
70
- }
71
- return { r: r + m, g: g + m, b: b + m, a: alpha };
72
- }
73
- function rgbToHsv(rgba) {
74
- const { r, g, b, a } = rgba;
75
- const max = Math.max(r, g, b);
76
- const min = Math.min(r, g, b);
77
- const d = max - min;
78
- let h = 0;
79
- if (d > 0) {
80
- if (max === r) h = 60 * ((g - b) / d % 6);
81
- else if (max === g) h = 60 * ((b - r) / d + 2);
82
- else h = 60 * ((r - g) / d + 4);
83
- }
84
- if (h < 0) h += 360;
85
- const s = max === 0 ? 0 : d / max;
86
- return { h, s, v: max, alpha: a };
87
- }
88
- function hsvToRgb(hsva) {
89
- const { h, s, v, alpha } = hsva;
90
- const hh = (h % 360 + 360) % 360 / 60;
91
- const c = v * s;
92
- const x = c * (1 - Math.abs(hh % 2 - 1));
93
- const m = v - c;
94
- let r = 0;
95
- let g = 0;
96
- let b = 0;
97
- if (hh < 1) {
98
- r = c;
99
- g = x;
100
- b = 0;
101
- } else if (hh < 2) {
102
- r = x;
103
- g = c;
104
- b = 0;
105
- } else if (hh < 3) {
106
- r = 0;
107
- g = c;
108
- b = x;
109
- } else if (hh < 4) {
110
- r = 0;
111
- g = x;
112
- b = c;
113
- } else if (hh < 5) {
114
- r = x;
115
- g = 0;
116
- b = c;
117
- } else {
118
- r = c;
119
- g = 0;
120
- b = x;
121
- }
122
- return { r: r + m, g: g + m, b: b + m, a: alpha };
123
- }
124
- function rgbToOklab(rgba) {
125
- const lr = srgbToLinear(rgba.r);
126
- const lg = srgbToLinear(rgba.g);
127
- const lb = srgbToLinear(rgba.b);
128
- const l = Math.cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb);
129
- const m = Math.cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb);
130
- const s = Math.cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb);
131
- return {
132
- l: 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,
133
- a: 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,
134
- b: 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s,
135
- alpha: rgba.a
136
- };
137
- }
138
- function oklabToRgb(lab) {
139
- const l_ = lab.l + 0.3963377774 * lab.a + 0.2158037573 * lab.b;
140
- const m_ = lab.l - 0.1055613458 * lab.a - 0.0638541728 * lab.b;
141
- const s_ = lab.l - 0.0894841775 * lab.a - 1.291485548 * lab.b;
142
- const l = l_ ** 3;
143
- const m = m_ ** 3;
144
- const s = s_ ** 3;
145
- return {
146
- r: linearToSrgb(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s),
147
- g: linearToSrgb(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s),
148
- b: linearToSrgb(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s),
149
- a: lab.alpha
150
- };
151
- }
152
- function oklabToOklch(lab) {
153
- const c = Math.hypot(lab.a, lab.b);
154
- let h = 0;
155
- if (c >= 1e-6) {
156
- h = Math.atan2(lab.b, lab.a) * 180 / Math.PI;
157
- if (h < 0) h += 360;
158
- if (h >= 360) h -= 360;
159
- }
160
- return { l: lab.l, c, h, alpha: lab.alpha };
161
- }
162
- function oklchToOklab(lch) {
163
- const rad = lch.h * Math.PI / 180;
164
- return {
165
- l: lch.l,
166
- a: lch.c * Math.cos(rad),
167
- b: lch.c * Math.sin(rad),
168
- alpha: lch.alpha
169
- };
170
- }
171
- var D65_XYZ = xyToXyz(D65_XY);
172
- var SRGB_TO_XYZ = rgbToXyzMatrix([0.64, 0.33], [0.3, 0.6], [0.15, 0.06], D65_XYZ);
173
- var P3_TO_XYZ = rgbToXyzMatrix([0.68, 0.32], [0.265, 0.69], [0.15, 0.06], D65_XYZ);
174
- var XYZ_TO_SRGB = invert(SRGB_TO_XYZ);
175
- var XYZ_TO_P3 = invert(P3_TO_XYZ);
176
- var P3_TO_SRGB_MAT = mul(XYZ_TO_SRGB, P3_TO_XYZ);
177
- var SRGB_TO_P3_MAT = mul(XYZ_TO_P3, SRGB_TO_XYZ);
178
- function linearSrgbToDisplayP3(rgb) {
179
- const out = apply(SRGB_TO_P3_MAT, [rgb.r, rgb.g, rgb.b]);
180
- return { r: out[0], g: out[1], b: out[2], a: rgb.a };
181
- }
182
- function displayP3ToLinearSrgb(rgb) {
183
- const out = apply(P3_TO_SRGB_MAT, [rgb.r, rgb.g, rgb.b]);
184
- return { r: out[0], g: out[1], b: out[2], a: rgb.a };
185
- }
2
+ displayP3ToLinearSrgb,
3
+ hslToRgb,
4
+ linearToSrgb,
5
+ oklabToRgb,
6
+ oklchToOklab,
7
+ srgbToLinear
8
+ } from "./chunk-F67XMVDI.js";
186
9
 
187
10
  // src/color/named.ts
188
11
  var NAMED_COLORS = {
@@ -610,18 +433,6 @@ function readableTextColor(background, candidates = [BLACK, WHITE]) {
610
433
  }
611
434
 
612
435
  export {
613
- srgbToLinear,
614
- linearToSrgb,
615
- rgbToHsl,
616
- hslToRgb,
617
- rgbToHsv,
618
- hsvToRgb,
619
- rgbToOklab,
620
- oklabToRgb,
621
- oklabToOklch,
622
- oklchToOklab,
623
- linearSrgbToDisplayP3,
624
- displayP3ToLinearSrgb,
625
436
  NAMED_COLORS,
626
437
  parseColor,
627
438
  isColor,
@@ -18,7 +18,7 @@ import {
18
18
  CHART_STACKINGS,
19
19
  CHART_TRENDLINE_TYPES,
20
20
  CHART_TYPES
21
- } from "./chunk-6ZZKRH7R.js";
21
+ } from "./chunk-QARCM66V.js";
22
22
 
23
23
  // src/chart/schemas.ts
24
24
  var VALUE = { type: ["number", "string", "null"], description: 'A number, numeric text ("1,200", "12%", "$40", "(3)") or null for a gap.' };
@@ -4,7 +4,7 @@
4
4
  var _chunkDWJJI6RTcjs = require('./chunk-DWJJI6RT.cjs');
5
5
 
6
6
 
7
- var _chunk4ZC5QJE2cjs = require('./chunk-4ZC5QJE2.cjs');
7
+ var _chunkUTI5IITZcjs = require('./chunk-UTI5IITZ.cjs');
8
8
 
9
9
  // src/animation/keyframes.ts
10
10
  var ANIMATION_TIME_EPSILON = 1e-6;
@@ -46,7 +46,7 @@ function interpolateAnimationValue(from, to, t, type = "number") {
46
46
  if (t <= 0) return from;
47
47
  if (t >= 1) return to;
48
48
  if (type === "color" || typeof from === "string" && typeof to === "string") {
49
- const mixed = _chunk4ZC5QJE2cjs.mixColorsOklab.call(void 0, from, to, t);
49
+ const mixed = _chunkUTI5IITZcjs.mixColorsOklab.call(void 0, from, to, t);
50
50
  if (mixed !== null) return mixed;
51
51
  }
52
52
  return from;