@pixerate/editor 0.237.0 → 0.239.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/dist/agent/index.cjs +40 -39
- package/dist/agent/index.js +9 -8
- package/dist/animation/index.cjs +7 -6
- package/dist/animation/index.js +6 -5
- package/dist/animation-editor/index.cjs +66 -65
- package/dist/animation-editor/index.js +9 -8
- package/dist/{brushstrokeRender-WDTKD54B.cjs → brushstrokeRender-MPOM7BFW.cjs} +7 -5
- package/dist/{brushstrokeRender-MAHOXL7K.js → brushstrokeRender-WB67GMUP.js} +4 -2
- package/dist/canvas/index.cjs +55 -54
- package/dist/canvas/index.js +10 -9
- package/dist/chart/index.cjs +159 -158
- package/dist/chart/index.js +9 -8
- package/dist/{chunk-L6Y7TSQ4.js → chunk-36ZTV7WO.js} +1 -1
- package/dist/{chunk-JVNGCS26.js → chunk-3E36VDMJ.js} +1 -1
- package/dist/{chunk-WRZ6C4TU.cjs → chunk-3R5P3DVY.cjs} +6 -6
- package/dist/{chunk-RUONPPMC.cjs → chunk-44BMJJVA.cjs} +8 -8
- package/dist/{chunk-YBAPT7NL.js → chunk-6ADHGQ73.js} +4 -2
- package/dist/chunk-7AHBW2CQ.cjs +200 -0
- package/dist/{chunk-EUIDTZNQ.cjs → chunk-7PT4RJL5.cjs} +113 -111
- package/dist/{chunk-CU6ANS5L.js → chunk-7YGBSFC6.js} +2 -2
- package/dist/{chunk-ATKKG76G.cjs → chunk-AD7GA3TL.cjs} +23 -23
- package/dist/{chunk-FSLKBQU7.js → chunk-AIS56JOO.js} +3 -3
- package/dist/{chunk-5VQXSS2S.cjs → chunk-BBUE3UJL.cjs} +86 -86
- package/dist/{chunk-7272D3K2.js → chunk-BP6KSGVD.js} +6 -4
- package/dist/{chunk-F6R67I3A.js → chunk-CXXXAZ7H.js} +1 -1
- package/dist/{chunk-5DQPDXOM.cjs → chunk-D2SGV525.cjs} +76 -76
- package/dist/chunk-F67XMVDI.js +200 -0
- package/dist/{chunk-JVSX5QTS.js → chunk-FQVVO5YA.js} +3 -3
- package/dist/{chunk-UXETV2NC.cjs → chunk-GA4EU4P3.cjs} +4 -4
- package/dist/{chunk-UFEDHACQ.js → chunk-GXAK6Q5J.js} +2 -2
- package/dist/{chunk-MHLU6GRJ.js → chunk-JEGJP4OW.js} +7 -196
- package/dist/chunk-KMPM5JM5.js +936 -0
- package/dist/{chunk-GOBOCZZI.js → chunk-LEQKZGQI.js} +1 -1
- package/dist/{chunk-M5GLQQWG.cjs → chunk-LJZRHVZV.cjs} +2 -2
- package/dist/{chunk-N76AMOKE.cjs → chunk-MOW3JMNG.cjs} +42 -42
- package/dist/{chunk-WKMUBATU.js → chunk-N4DFDI73.js} +1 -1
- package/dist/{chunk-GNZI3KYK.cjs → chunk-NKTNLJUJ.cjs} +49 -9
- package/dist/{chunk-TQOL6CF7.js → chunk-PJYG6FCF.js} +49 -9
- package/dist/{chunk-V3L7U63N.cjs → chunk-PP6BXVRL.cjs} +1 -1
- package/dist/{chunk-TFF2GTGN.cjs → chunk-PPFJHTW5.cjs} +24 -22
- package/dist/{chunk-6ZZKRH7R.js → chunk-QARCM66V.js} +3 -3
- package/dist/{chunk-5UEFBM2M.cjs → chunk-RD7RX52G.cjs} +18 -207
- package/dist/{chunk-CDP2AKMA.js → chunk-RV5DKZHU.js} +1 -1
- package/dist/chunk-S6OT6CTS.cjs +936 -0
- package/dist/{chunk-HUAISCUX.cjs → chunk-T7KQEMAE.cjs} +18 -18
- package/dist/{chunk-BQE3Y6ZO.cjs → chunk-THXFU3JB.cjs} +5 -5
- package/dist/{chunk-4ZC5QJE2.cjs → chunk-UTI5IITZ.cjs} +3 -3
- package/dist/{chunk-XSVUNSDJ.js → chunk-UUBO6RB5.js} +1 -1
- package/dist/{chunk-CZWUDFR3.cjs → chunk-UZU6DIZA.cjs} +52 -52
- package/dist/{chunk-M2TPMYJE.js → chunk-V6DT2CDH.js} +1 -1
- package/dist/{chunk-WV5WTOC6.cjs → chunk-W7GRGGBH.cjs} +16 -16
- package/dist/{chunk-23E5GI2U.js → chunk-WGN7AUKB.js} +2 -2
- package/dist/{chunk-YMREOA67.js → chunk-XK4SST43.js} +2 -2
- package/dist/{chunk-SOSBOS5T.cjs → chunk-XWOLPNBW.cjs} +22 -22
- package/dist/{chunk-ILP77UD6.js → chunk-YGQVCQTG.js} +1 -1
- package/dist/{chunk-GXLZZVR5.cjs → chunk-ZXNO3ZOX.cjs} +37 -37
- package/dist/color/index.cjs +6 -4
- package/dist/color/index.js +9 -7
- package/dist/export/index.cjs +8 -7
- package/dist/export/index.js +7 -6
- package/dist/extensions/index.cjs +11 -10
- package/dist/extensions/index.js +10 -9
- package/dist/gradient/index.cjs +104 -813
- package/dist/gradient/index.d.cts +1 -0
- package/dist/gradient/index.d.ts +1 -0
- package/dist/gradient/index.js +87 -796
- package/dist/gradient/sample.d.cts +69 -0
- package/dist/gradient/sample.d.ts +69 -0
- package/dist/image-editor/index.cjs +826 -778
- package/dist/image-editor/index.js +57 -9
- package/dist/index.cjs +17 -16
- package/dist/index.js +11 -10
- package/dist/paint-editor/controller.d.cts +31 -1
- package/dist/paint-editor/controller.d.ts +31 -1
- package/dist/paint-editor/index.cjs +403 -195
- package/dist/paint-editor/index.js +231 -23
- package/dist/paint-editor/sticker-tools.d.cts +1 -1
- package/dist/paint-editor/sticker-tools.d.ts +1 -1
- package/dist/paint-editor/stickers.d.cts +10 -3
- package/dist/paint-editor/stickers.d.ts +10 -3
- package/dist/paint-editor/ui.d.cts +10 -3
- package/dist/paint-editor/ui.d.ts +10 -3
- package/dist/tokens/index.cjs +4 -3
- package/dist/tokens/index.js +3 -2
- package/dist/typography/index.cjs +8 -7
- package/dist/typography/index.js +3 -2
- package/dist/vector/index.cjs +967 -966
- package/dist/vector/index.js +9 -8
- package/dist/video-editor/index.cjs +7 -6
- package/dist/video-editor/index.js +6 -5
- package/package.json +1 -1
- package/skills/pixerate-color/SKILL.md +3 -0
- package/skills/pixerate-image-editor/SKILL.md +1 -0
- package/skills/pixerate-paint-editor/SKILL.md +6 -2
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
var _chunkRD7RX52Gcjs = require('./chunk-RD7RX52G.cjs');
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
|
|
@@ -10,7 +11,8 @@
|
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
|
|
15
|
+
var _chunk7AHBW2CQcjs = require('./chunk-7AHBW2CQ.cjs');
|
|
14
16
|
|
|
15
17
|
// src/color/gamut.ts
|
|
16
18
|
var clamp01 = (v) => Math.min(1, Math.max(0, v));
|
|
@@ -18,12 +20,12 @@ function inSrgbGamut(c, epsilon = 1e-5) {
|
|
|
18
20
|
return c.r >= -epsilon && c.r <= 1 + epsilon && c.g >= -epsilon && c.g <= 1 + epsilon && c.b >= -epsilon && c.b <= 1 + epsilon;
|
|
19
21
|
}
|
|
20
22
|
function deltaEOK(a, b) {
|
|
21
|
-
const la =
|
|
22
|
-
const lb =
|
|
23
|
+
const la = _chunk7AHBW2CQcjs.rgbToOklab.call(void 0, a);
|
|
24
|
+
const lb = _chunk7AHBW2CQcjs.rgbToOklab.call(void 0, b);
|
|
23
25
|
return Math.hypot(la.l - lb.l, la.a - lb.a, la.b - lb.b);
|
|
24
26
|
}
|
|
25
27
|
function toSrgbGamut(c) {
|
|
26
|
-
const lch =
|
|
28
|
+
const lch = _chunk7AHBW2CQcjs.oklabToOklch.call(void 0, _chunk7AHBW2CQcjs.rgbToOklab.call(void 0, c));
|
|
27
29
|
if (lch.l >= 1) return { r: 1, g: 1, b: 1, a: c.a };
|
|
28
30
|
if (lch.l <= 0) return { r: 0, g: 0, b: 0, a: c.a };
|
|
29
31
|
if (inSrgbGamut(c)) {
|
|
@@ -36,7 +38,7 @@ function toSrgbGamut(c) {
|
|
|
36
38
|
const EPS = 1e-4;
|
|
37
39
|
for (let i = 0; i < 30; i++) {
|
|
38
40
|
const mid = (low + high) / 2;
|
|
39
|
-
const candidate =
|
|
41
|
+
const candidate = _chunk7AHBW2CQcjs.oklabToRgb.call(void 0, _chunk7AHBW2CQcjs.oklchToOklab.call(void 0, { l: lch.l, c: mid, h: lch.h, alpha: c.a }));
|
|
40
42
|
const clipped = {
|
|
41
43
|
r: clamp01(candidate.r),
|
|
42
44
|
g: clamp01(candidate.g),
|
|
@@ -83,21 +85,21 @@ function formatColor(c, format) {
|
|
|
83
85
|
return c.a < 1 ? `rgb(${r} ${g} ${b} / ${round2(c.a)})` : `rgb(${r} ${g} ${b})`;
|
|
84
86
|
}
|
|
85
87
|
case "hsl": {
|
|
86
|
-
const hsl =
|
|
88
|
+
const hsl = _chunk7AHBW2CQcjs.rgbToHsl.call(void 0, toSrgbGamut(c));
|
|
87
89
|
const h = (Math.round(hsl.h * 100) / 100).toString();
|
|
88
90
|
const s = (Math.round(hsl.s * 1e4) / 100).toString();
|
|
89
91
|
const l = (Math.round(hsl.l * 1e4) / 100).toString();
|
|
90
92
|
return c.a < 1 ? `hsl(${h} ${s}% ${l}% / ${round2(c.a)})` : `hsl(${h} ${s}% ${l}%)`;
|
|
91
93
|
}
|
|
92
94
|
case "oklch": {
|
|
93
|
-
const lch =
|
|
95
|
+
const lch = _chunk7AHBW2CQcjs.oklabToOklch.call(void 0, _chunk7AHBW2CQcjs.rgbToOklab.call(void 0, c));
|
|
94
96
|
const l = (lch.l * 100).toFixed(2);
|
|
95
97
|
const ch = lch.c.toFixed(4);
|
|
96
98
|
const h = lch.h.toFixed(2);
|
|
97
99
|
return c.a < 1 ? `oklch(${l}% ${ch} ${h} / ${round2(c.a)})` : `oklch(${l}% ${ch} ${h})`;
|
|
98
100
|
}
|
|
99
101
|
case "oklab": {
|
|
100
|
-
const lab =
|
|
102
|
+
const lab = _chunk7AHBW2CQcjs.rgbToOklab.call(void 0, c);
|
|
101
103
|
const l = (lab.l * 100).toFixed(2);
|
|
102
104
|
const a = lab.a.toFixed(4);
|
|
103
105
|
const b = lab.b.toFixed(4);
|
|
@@ -105,36 +107,36 @@ function formatColor(c, format) {
|
|
|
105
107
|
}
|
|
106
108
|
case "p3": {
|
|
107
109
|
const linSrgb = {
|
|
108
|
-
r:
|
|
109
|
-
g:
|
|
110
|
-
b:
|
|
110
|
+
r: _chunk7AHBW2CQcjs.srgbToLinear.call(void 0, c.r),
|
|
111
|
+
g: _chunk7AHBW2CQcjs.srgbToLinear.call(void 0, c.g),
|
|
112
|
+
b: _chunk7AHBW2CQcjs.srgbToLinear.call(void 0, c.b),
|
|
111
113
|
a: c.a
|
|
112
114
|
};
|
|
113
|
-
const linP3 =
|
|
114
|
-
const r =
|
|
115
|
-
const g =
|
|
116
|
-
const b =
|
|
115
|
+
const linP3 = _chunk7AHBW2CQcjs.linearSrgbToDisplayP3.call(void 0, linSrgb);
|
|
116
|
+
const r = _chunk7AHBW2CQcjs.linearToSrgb.call(void 0, linP3.r).toFixed(4);
|
|
117
|
+
const g = _chunk7AHBW2CQcjs.linearToSrgb.call(void 0, linP3.g).toFixed(4);
|
|
118
|
+
const b = _chunk7AHBW2CQcjs.linearToSrgb.call(void 0, linP3.b).toFixed(4);
|
|
117
119
|
return c.a < 1 ? `color(display-p3 ${r} ${g} ${b} / ${round2(c.a)})` : `color(display-p3 ${r} ${g} ${b})`;
|
|
118
120
|
}
|
|
119
121
|
}
|
|
120
122
|
}
|
|
121
123
|
function normalizeColor(input) {
|
|
122
|
-
const parsed =
|
|
124
|
+
const parsed = _chunkRD7RX52Gcjs.parseColor.call(void 0, input);
|
|
123
125
|
return parsed ? formatHex(parsed) : null;
|
|
124
126
|
}
|
|
125
127
|
|
|
126
128
|
// src/color/suggest.ts
|
|
127
129
|
function suggestAccessibleForeground(foreground, background, options = {}) {
|
|
128
130
|
const large = _nullishCoalesce(options.large, () => ( false));
|
|
129
|
-
const lch =
|
|
130
|
-
const asHex = (l) =>
|
|
131
|
+
const lch = _chunk7AHBW2CQcjs.oklabToOklch.call(void 0, _chunk7AHBW2CQcjs.rgbToOklab.call(void 0, foreground));
|
|
132
|
+
const asHex = (l) => _chunkRD7RX52Gcjs.parseColor.call(void 0, formatHex(toSrgbGamut(_chunk7AHBW2CQcjs.oklabToRgb.call(void 0, _chunk7AHBW2CQcjs.oklchToOklab.call(void 0, { ...lch, l })))));
|
|
131
133
|
for (let d = 0.01; d <= 1; d += 0.01) {
|
|
132
134
|
const downCand = asHex(Math.max(0, lch.l - d));
|
|
133
135
|
const upCand = asHex(Math.min(1, lch.l + d));
|
|
134
|
-
const downRatio =
|
|
135
|
-
const upRatio =
|
|
136
|
-
const downPass =
|
|
137
|
-
const upPass =
|
|
136
|
+
const downRatio = _chunkRD7RX52Gcjs.contrastRatio.call(void 0, downCand, background);
|
|
137
|
+
const upRatio = _chunkRD7RX52Gcjs.contrastRatio.call(void 0, upCand, background);
|
|
138
|
+
const downPass = _chunkRD7RX52Gcjs.contrastLevel.call(void 0, downRatio, { large }) !== "fail";
|
|
139
|
+
const upPass = _chunkRD7RX52Gcjs.contrastLevel.call(void 0, upRatio, { large }) !== "fail";
|
|
138
140
|
if (downPass && upPass) return formatHex(downRatio >= upRatio ? downCand : upCand);
|
|
139
141
|
if (downPass) return formatHex(downCand);
|
|
140
142
|
if (upPass) return formatHex(upCand);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
simulateColorVision
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BP6KSGVD.js";
|
|
4
4
|
import {
|
|
5
5
|
deltaEOK
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6ADHGQ73.js";
|
|
7
7
|
import {
|
|
8
8
|
rgbToOklab
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-F67XMVDI.js";
|
|
10
10
|
|
|
11
11
|
// src/chart/color.ts
|
|
12
12
|
var NAMED = {
|
|
@@ -5,184 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
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 = _chunkIPJ3TEYRcjs.xyToXyz.call(void 0, _chunkIPJ3TEYRcjs.D65_XY);
|
|
172
|
-
var SRGB_TO_XYZ = _chunkIPJ3TEYRcjs.rgbToXyzMatrix.call(void 0, [0.64, 0.33], [0.3, 0.6], [0.15, 0.06], D65_XYZ);
|
|
173
|
-
var P3_TO_XYZ = _chunkIPJ3TEYRcjs.rgbToXyzMatrix.call(void 0, [0.68, 0.32], [0.265, 0.69], [0.15, 0.06], D65_XYZ);
|
|
174
|
-
var XYZ_TO_SRGB = _chunkIPJ3TEYRcjs.invert.call(void 0, SRGB_TO_XYZ);
|
|
175
|
-
var XYZ_TO_P3 = _chunkIPJ3TEYRcjs.invert.call(void 0, P3_TO_XYZ);
|
|
176
|
-
var P3_TO_SRGB_MAT = _chunkIPJ3TEYRcjs.mul.call(void 0, XYZ_TO_SRGB, P3_TO_XYZ);
|
|
177
|
-
var SRGB_TO_P3_MAT = _chunkIPJ3TEYRcjs.mul.call(void 0, XYZ_TO_P3, SRGB_TO_XYZ);
|
|
178
|
-
function linearSrgbToDisplayP3(rgb) {
|
|
179
|
-
const out = _chunkIPJ3TEYRcjs.apply.call(void 0, 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 = _chunkIPJ3TEYRcjs.apply.call(void 0, 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
|
-
}
|
|
8
|
+
var _chunk7AHBW2CQcjs = require('./chunk-7AHBW2CQ.cjs');
|
|
186
9
|
|
|
187
10
|
// src/color/named.ts
|
|
188
11
|
var NAMED_COLORS = {
|
|
@@ -430,7 +253,7 @@ function parseColor(input) {
|
|
|
430
253
|
const s = parsePercentOrNumber(parts[1], 100);
|
|
431
254
|
const l = parsePercentOrNumber(parts[2], 100);
|
|
432
255
|
if (h === null || s === null || l === null) return null;
|
|
433
|
-
return hslToRgb({ h, s, l, alpha: alphaVal });
|
|
256
|
+
return _chunk7AHBW2CQcjs.hslToRgb.call(void 0, { h, s, l, alpha: alphaVal });
|
|
434
257
|
}
|
|
435
258
|
const oklabMatch = OKLAB_RE.exec(text);
|
|
436
259
|
if (oklabMatch) {
|
|
@@ -446,7 +269,7 @@ function parseColor(input) {
|
|
|
446
269
|
const a = parsePercentOrNumber(parts[1], 1);
|
|
447
270
|
const b = parsePercentOrNumber(parts[2], 1);
|
|
448
271
|
if (l === null || a === null || b === null) return null;
|
|
449
|
-
return oklabToRgb({ l, a, b, alpha: alphaVal });
|
|
272
|
+
return _chunk7AHBW2CQcjs.oklabToRgb.call(void 0, { l, a, b, alpha: alphaVal });
|
|
450
273
|
}
|
|
451
274
|
const oklchMatch = OKLCH_RE.exec(text);
|
|
452
275
|
if (oklchMatch) {
|
|
@@ -462,7 +285,7 @@ function parseColor(input) {
|
|
|
462
285
|
const c = parsePercentOrNumber(parts[1], 1);
|
|
463
286
|
const h = parseAngle(parts[2]);
|
|
464
287
|
if (l === null || c === null || h === null) return null;
|
|
465
|
-
return oklabToRgb(oklchToOklab({ l, c, h, alpha: alphaVal }));
|
|
288
|
+
return _chunk7AHBW2CQcjs.oklabToRgb.call(void 0, _chunk7AHBW2CQcjs.oklchToOklab.call(void 0, { l, c, h, alpha: alphaVal }));
|
|
466
289
|
}
|
|
467
290
|
const colorMatch = COLOR_FN_RE.exec(text);
|
|
468
291
|
if (colorMatch) {
|
|
@@ -485,21 +308,21 @@ function parseColor(input) {
|
|
|
485
308
|
}
|
|
486
309
|
if (space === "srgb-linear") {
|
|
487
310
|
return {
|
|
488
|
-
r: linearToSrgb(c1),
|
|
489
|
-
g: linearToSrgb(c2),
|
|
490
|
-
b: linearToSrgb(c3),
|
|
311
|
+
r: _chunk7AHBW2CQcjs.linearToSrgb.call(void 0, c1),
|
|
312
|
+
g: _chunk7AHBW2CQcjs.linearToSrgb.call(void 0, c2),
|
|
313
|
+
b: _chunk7AHBW2CQcjs.linearToSrgb.call(void 0, c3),
|
|
491
314
|
a: alphaVal
|
|
492
315
|
};
|
|
493
316
|
}
|
|
494
317
|
if (space === "display-p3") {
|
|
495
|
-
const linP3R = srgbToLinear(c1);
|
|
496
|
-
const linP3G = srgbToLinear(c2);
|
|
497
|
-
const linP3B = srgbToLinear(c3);
|
|
498
|
-
const linSrgb = displayP3ToLinearSrgb({ r: linP3R, g: linP3G, b: linP3B, a: alphaVal });
|
|
318
|
+
const linP3R = _chunk7AHBW2CQcjs.srgbToLinear.call(void 0, c1);
|
|
319
|
+
const linP3G = _chunk7AHBW2CQcjs.srgbToLinear.call(void 0, c2);
|
|
320
|
+
const linP3B = _chunk7AHBW2CQcjs.srgbToLinear.call(void 0, c3);
|
|
321
|
+
const linSrgb = _chunk7AHBW2CQcjs.displayP3ToLinearSrgb.call(void 0, { r: linP3R, g: linP3G, b: linP3B, a: alphaVal });
|
|
499
322
|
return {
|
|
500
|
-
r: linearToSrgb(linSrgb.r),
|
|
501
|
-
g: linearToSrgb(linSrgb.g),
|
|
502
|
-
b: linearToSrgb(linSrgb.b),
|
|
323
|
+
r: _chunk7AHBW2CQcjs.linearToSrgb.call(void 0, linSrgb.r),
|
|
324
|
+
g: _chunk7AHBW2CQcjs.linearToSrgb.call(void 0, linSrgb.g),
|
|
325
|
+
b: _chunk7AHBW2CQcjs.linearToSrgb.call(void 0, linSrgb.b),
|
|
503
326
|
a: alphaVal
|
|
504
327
|
};
|
|
505
328
|
}
|
|
@@ -565,9 +388,9 @@ function composite(fg, bg) {
|
|
|
565
388
|
};
|
|
566
389
|
}
|
|
567
390
|
function relativeLuminance(c) {
|
|
568
|
-
const r = srgbToLinear(c.r);
|
|
569
|
-
const g = srgbToLinear(c.g);
|
|
570
|
-
const b = srgbToLinear(c.b);
|
|
391
|
+
const r = _chunk7AHBW2CQcjs.srgbToLinear.call(void 0, c.r);
|
|
392
|
+
const g = _chunk7AHBW2CQcjs.srgbToLinear.call(void 0, c.g);
|
|
393
|
+
const b = _chunk7AHBW2CQcjs.srgbToLinear.call(void 0, c.b);
|
|
571
394
|
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
572
395
|
}
|
|
573
396
|
function contrastRatio(foreground, background) {
|
|
@@ -617,16 +440,4 @@ function readableTextColor(background, candidates = [BLACK, WHITE]) {
|
|
|
617
440
|
|
|
618
441
|
|
|
619
442
|
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.rgbToHsv = rgbToHsv; exports.hsvToRgb = hsvToRgb; exports.rgbToOklab = rgbToOklab; exports.oklabToRgb = oklabToRgb; exports.oklabToOklch = oklabToOklch; exports.oklchToOklab = oklchToOklab; exports.linearSrgbToDisplayP3 = linearSrgbToDisplayP3; exports.displayP3ToLinearSrgb = displayP3ToLinearSrgb; exports.NAMED_COLORS = NAMED_COLORS; exports.parseColor = parseColor; exports.isColor = isColor; exports.relativeLuminance = relativeLuminance; exports.contrastRatio = contrastRatio; exports.contrastLevel = contrastLevel; exports.readableTextColor = readableTextColor;
|
|
443
|
+
exports.NAMED_COLORS = NAMED_COLORS; exports.parseColor = parseColor; exports.isColor = isColor; exports.relativeLuminance = relativeLuminance; exports.contrastRatio = contrastRatio; exports.contrastLevel = contrastLevel; exports.readableTextColor = readableTextColor;
|
|
@@ -74,7 +74,7 @@ function profileAlongPolyline(points, values, count = 32) {
|
|
|
74
74
|
var round3 = (v) => Math.round(v * 1e3) / 1e3;
|
|
75
75
|
var loading = null;
|
|
76
76
|
function loadCanvasBrushstrokeRenderer() {
|
|
77
|
-
loading ??= import("./brushstrokeRender-
|
|
77
|
+
loading ??= import("./brushstrokeRender-WB67GMUP.js").catch((error) => {
|
|
78
78
|
loading = null;
|
|
79
79
|
throw error;
|
|
80
80
|
});
|