@pixerate/editor 0.250.0 → 0.251.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 -41
- package/dist/agent/index.js +9 -10
- package/dist/animation/index.cjs +6 -7
- package/dist/animation/index.js +5 -6
- package/dist/animation-editor/index.cjs +70 -70
- package/dist/animation-editor/index.js +12 -12
- package/dist/brushes/index.cjs +1406 -0
- package/dist/brushes/index.d.cts +12 -0
- package/dist/brushes/index.d.ts +12 -0
- package/dist/brushes/index.js +1406 -0
- package/dist/brushes/migrate.d.cts +17 -0
- package/dist/brushes/migrate.d.ts +17 -0
- package/dist/brushes/normalize.d.cts +15 -0
- package/dist/brushes/normalize.d.ts +15 -0
- package/dist/brushes/presets.d.cts +12 -0
- package/dist/brushes/presets.d.ts +12 -0
- package/dist/brushes/resolve.d.cts +56 -0
- package/dist/brushes/resolve.d.ts +56 -0
- package/dist/brushes/schema.d.cts +29 -0
- package/dist/brushes/schema.d.ts +29 -0
- package/dist/brushes/types.d.cts +323 -0
- package/dist/brushes/types.d.ts +323 -0
- package/dist/{brushstrokeRender-2FHFLSEG.js → brushstrokeRender-5PYSKZIJ.js} +8 -8
- package/dist/{brushstrokeRender-QGRXOKDA.cjs → brushstrokeRender-7FLLSQEC.cjs} +14 -14
- package/dist/canvas/index.cjs +57 -58
- package/dist/canvas/index.js +31 -32
- package/dist/chart/index.cjs +159 -160
- package/dist/chart/index.js +9 -10
- package/dist/{chunk-NOHJP5TK.js → chunk-2ZJ4DT3M.js} +1 -1
- package/dist/{chunk-XZNU4DUX.cjs → chunk-3NS5C7FB.cjs} +76 -76
- package/dist/{chunk-UTI5IITZ.cjs → chunk-4ZC5QJE2.cjs} +3 -3
- package/dist/{chunk-SMSGP2HQ.js → chunk-5JNA6LLY.js} +1 -1
- package/dist/{chunk-RD7RX52G.cjs → chunk-5UEFBM2M.cjs} +207 -18
- package/dist/{chunk-WA44NKPF.js → chunk-62Z5WLRA.js} +1 -1
- package/dist/{chunk-BVRRIW7F.js → chunk-6GRUVGKU.js} +3 -3
- package/dist/{chunk-QARCM66V.js → chunk-6ZZKRH7R.js} +3 -3
- package/dist/{chunk-BP6KSGVD.js → chunk-7272D3K2.js} +4 -6
- package/dist/{chunk-NTRAVM2I.js → chunk-7P6VF3FG.js} +2 -2
- package/dist/chunk-APX63ILU.js +173 -0
- package/dist/{chunk-W7L4HUT2.cjs → chunk-CJ6TBL2N.cjs} +16 -16
- package/dist/{chunk-7PT4RJL5.cjs → chunk-EUIDTZNQ.cjs} +111 -113
- package/dist/{chunk-CXXXAZ7H.js → chunk-F6R67I3A.js} +1 -1
- package/dist/{chunk-I7NJPHWV.cjs → chunk-FQPUF2W2.cjs} +35 -606
- package/dist/{chunk-D5KGAO4Z.js → chunk-GCVFEPJG.js} +2 -573
- package/dist/{chunk-LEQKZGQI.js → chunk-GOBOCZZI.js} +1 -1
- package/dist/{chunk-KDLBJ6QR.js → chunk-GYMMNCFT.js} +3 -3
- package/dist/{chunk-NUTMINJZ.cjs → chunk-H7ET2ISK.cjs} +52 -52
- package/dist/chunk-HS6QDWDF.cjs +1029 -0
- package/dist/{chunk-T7KQEMAE.cjs → chunk-HUAISCUX.cjs} +18 -18
- package/dist/{chunk-YGQVCQTG.js → chunk-ILP77UD6.js} +1 -1
- package/dist/{chunk-S6OT6CTS.cjs → chunk-IWEVV63O.cjs} +31 -33
- package/dist/{chunk-M2VKFE5L.cjs → chunk-JFHBXNR2.cjs} +88 -88
- package/dist/{chunk-WPUXGDH4.cjs → chunk-JPEHXIB5.cjs} +10 -10
- package/dist/chunk-JSDND7DF.cjs +173 -0
- package/dist/{chunk-36ZTV7WO.js → chunk-L6Y7TSQ4.js} +1 -1
- package/dist/{chunk-YW43M56C.cjs → chunk-LFMKWGFL.cjs} +1 -1
- package/dist/{chunk-V6DT2CDH.js → chunk-M2TPMYJE.js} +1 -1
- package/dist/{chunk-LJZRHVZV.cjs → chunk-M5GLQQWG.cjs} +2 -2
- package/dist/{chunk-JEGJP4OW.js → chunk-MHLU6GRJ.js} +196 -7
- package/dist/{chunk-KMPM5JM5.js → chunk-MONXNVZK.js} +4 -6
- package/dist/chunk-MTKY6K3Q.js +1029 -0
- package/dist/{chunk-MOW3JMNG.cjs → chunk-N76AMOKE.cjs} +42 -42
- package/dist/{chunk-75K3W4D6.cjs → chunk-NKGB64CW.cjs} +16 -16
- package/dist/{chunk-SGPIVHJB.js → chunk-P3K2JCJA.js} +3 -3
- package/dist/chunk-PXDIAYB6.cjs +594 -0
- package/dist/{chunk-3TWOCSCY.js → chunk-QC3OXRE4.js} +9 -9
- package/dist/{chunk-YM6ZBTXG.cjs → chunk-QLSGTCYT.cjs} +23 -23
- package/dist/{chunk-7YW7T5TJ.js → chunk-RHPSE2YR.js} +2 -2
- package/dist/{chunk-44BMJJVA.cjs → chunk-RUONPPMC.cjs} +8 -8
- package/dist/{chunk-ATK6ABN3.cjs → chunk-SABJMH6M.cjs} +145 -12
- package/dist/{chunk-XWOLPNBW.cjs → chunk-SOSBOS5T.cjs} +22 -22
- package/dist/{chunk-PPFJHTW5.cjs → chunk-TFF2GTGN.cjs} +22 -24
- package/dist/{chunk-X7WRL5ZZ.cjs → chunk-TLOGFIIV.cjs} +37 -37
- package/dist/chunk-TXFWZ5ZJ.js +594 -0
- package/dist/{chunk-GXAK6Q5J.js → chunk-UFEDHACQ.js} +2 -2
- package/dist/{chunk-GA4EU4P3.cjs → chunk-UXETV2NC.cjs} +4 -4
- package/dist/{chunk-N4DFDI73.js → chunk-WKMUBATU.js} +1 -1
- package/dist/{chunk-3R5P3DVY.cjs → chunk-WRZ6C4TU.cjs} +6 -6
- package/dist/{chunk-U4NUOKBT.js → chunk-WZOGDKCQ.js} +134 -1
- package/dist/{chunk-6ADHGQ73.js → chunk-YBAPT7NL.js} +2 -4
- package/dist/color/index.cjs +4 -6
- package/dist/color/index.js +7 -9
- package/dist/export/index.cjs +7 -8
- package/dist/export/index.js +6 -7
- package/dist/extensions/index.cjs +10 -11
- package/dist/extensions/index.js +9 -10
- package/dist/gradient/index.cjs +33 -34
- package/dist/gradient/index.js +4 -5
- package/dist/image-editor/index.cjs +845 -844
- package/dist/image-editor/index.js +39 -38
- package/dist/index.cjs +16 -17
- package/dist/index.js +10 -11
- package/dist/paint/index.cjs +6 -4
- package/dist/paint/index.js +21 -19
- package/dist/paint-editor/brushes.d.cts +1 -2
- package/dist/paint-editor/brushes.d.ts +1 -2
- package/dist/paint-editor/index.cjs +2193 -694
- package/dist/paint-editor/index.js +1575 -76
- package/dist/paint-editor/mark-settings.d.cts +104 -0
- package/dist/paint-editor/mark-settings.d.ts +104 -0
- package/dist/paint-editor/procedural.d.cts +2 -75
- package/dist/paint-editor/procedural.d.ts +2 -75
- package/dist/paint-editor/stickers.d.cts +1 -22
- package/dist/paint-editor/stickers.d.ts +1 -22
- package/dist/raster/index.cjs +2 -2
- package/dist/raster/index.js +9 -9
- package/dist/stickers/index.cjs +10 -10
- package/dist/stickers/index.js +9 -9
- package/dist/tokens/index.cjs +3 -4
- package/dist/tokens/index.js +2 -3
- package/dist/typography/index.cjs +7 -8
- package/dist/typography/index.js +2 -3
- package/dist/vector/index.cjs +974 -974
- package/dist/vector/index.js +12 -12
- package/dist/video-editor/index.cjs +6 -7
- package/dist/video-editor/index.js +5 -6
- package/package.json +11 -1
- package/dist/chunk-4JNWA3VT.cjs +0 -302
- package/dist/chunk-7AHBW2CQ.cjs +0 -200
- package/dist/chunk-F67XMVDI.js +0 -200
- package/dist/chunk-GT77U7QG.cjs +0 -2637
- package/dist/chunk-OTEPAQJX.js +0 -2637
- package/dist/chunk-WKH5ZAUA.js +0 -302
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkWRZ6C4TUcjs = require('./chunk-WRZ6C4TU.cjs');
|
|
12
12
|
|
|
13
13
|
// src/chart/ooxml.ts
|
|
14
14
|
var CHART_OOXML_NS = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
@@ -111,11 +111,11 @@ function chartFromOoxml(xml, options = {}) {
|
|
|
111
111
|
try {
|
|
112
112
|
doc = new (parser(options))().parseFromString(xml, "application/xml");
|
|
113
113
|
} catch (error) {
|
|
114
|
-
return { spec:
|
|
114
|
+
return { spec: _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, {}).spec, issues: [{ path: "", message: `The chart XML could not be read: ${error.message}` }], unsupported, lossless: false };
|
|
115
115
|
}
|
|
116
116
|
const root = doc.documentElement;
|
|
117
117
|
if (!root || root.localName !== "chartSpace" || doc.getElementsByTagName("parsererror").length) {
|
|
118
|
-
return { spec:
|
|
118
|
+
return { spec: _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, {}).spec, issues: [{ path: "", message: "This is not a chart part: expected a c:chartSpace (or cx:chartSpace) root element." }], unsupported, lossless: false };
|
|
119
119
|
}
|
|
120
120
|
if (_optionalChain([root, 'access', _14 => _14.namespaceURI, 'optionalAccess', _15 => _15.includes, 'call', _16 => _16("chartex")]) || kid(root, "chartData")) return readChartex(root, issues, unsupported);
|
|
121
121
|
const chart = kid(root, "chart");
|
|
@@ -280,7 +280,7 @@ function chartFromOoxml(xml, options = {}) {
|
|
|
280
280
|
}
|
|
281
281
|
if (!types.length) {
|
|
282
282
|
issues.push({ path: "plotArea", message: unsupported.length ? `The chart type is not supported: ${unsupported.join(", ")}.` : "The chart has no plot groups." });
|
|
283
|
-
return { spec:
|
|
283
|
+
return { spec: _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, input).spec, issues, unsupported, lossless: false };
|
|
284
284
|
}
|
|
285
285
|
const first = types[0];
|
|
286
286
|
const combo = types.some((t) => t !== first);
|
|
@@ -290,14 +290,14 @@ function chartFromOoxml(xml, options = {}) {
|
|
|
290
290
|
if (!combo) {
|
|
291
291
|
for (const s of series) if (s.axis) issues.push({ path: "series", message: `"${s.name}" is on a second value axis.` });
|
|
292
292
|
}
|
|
293
|
-
if (types.some((t) => !
|
|
293
|
+
if (types.some((t) => !_chunkWRZ6C4TUcjs.isCartesianChart.call(void 0, t)) && combo) unsupported.push("a pie or radar mixed with other chart types");
|
|
294
294
|
input.series = series;
|
|
295
295
|
input.categories = categories.length ? categories : Array.from({ length: Math.max(0, ...series.map((s) => s.values.length)) }, (_, i) => `${i + 1}`);
|
|
296
296
|
input.stacking = stacking;
|
|
297
297
|
input.orientation = orientation;
|
|
298
298
|
input.dataLabels = dataLabels;
|
|
299
299
|
input.points = points || first !== "line";
|
|
300
|
-
if (bool(val(groups[0], "varyColors")) && !combo &&
|
|
300
|
+
if (bool(val(groups[0], "varyColors")) && !combo && _chunkWRZ6C4TUcjs.isCartesianChart.call(void 0, first) && series.length === 1) input.varyColors = true;
|
|
301
301
|
const readAxis = (a, fallback) => {
|
|
302
302
|
const axis = { ...fallback, format: {} };
|
|
303
303
|
if (!a) return axis;
|
|
@@ -324,12 +324,12 @@ function chartFromOoxml(xml, options = {}) {
|
|
|
324
324
|
};
|
|
325
325
|
const xy = first === "scatter" || first === "bubble";
|
|
326
326
|
const catAxis = _nullishCoalesce(_nullishCoalesce(kid(plot, "catAx"), () => ( kid(plot, "dateAx"))), () => ( (xy ? valAxes.find((a) => !vertical(a)) : void 0)));
|
|
327
|
-
input.xAxis = readAxis(catAxis,
|
|
327
|
+
input.xAxis = readAxis(catAxis, _chunkWRZ6C4TUcjs.defaultChartAxis.call(void 0, false));
|
|
328
328
|
if (kid(plot, "dateAx")) input.xAxis.kind = "date";
|
|
329
|
-
input.yAxis = readAxis(_nullishCoalesce(_nullishCoalesce(primaryAxis, () => ( valAxes.find(vertical))), () => ( valAxes[0])),
|
|
329
|
+
input.yAxis = readAxis(_nullishCoalesce(_nullishCoalesce(primaryAxis, () => ( valAxes.find(vertical))), () => ( valAxes[0])), _chunkWRZ6C4TUcjs.defaultChartAxis.call(void 0, true));
|
|
330
330
|
const secondaryAxis = valAxes.find((a) => a !== primaryAxis && (xy ? vertical(a) && a !== primaryAxis : true) && a !== catAxis);
|
|
331
|
-
if (series.some((s) => s.axis === "secondary") && secondaryAxis) input.yAxis2 = readAxis(secondaryAxis,
|
|
332
|
-
const { spec, issues: specIssues } =
|
|
331
|
+
if (series.some((s) => s.axis === "secondary") && secondaryAxis) input.yAxis2 = readAxis(secondaryAxis, _chunkWRZ6C4TUcjs.defaultChartAxis.call(void 0, false));
|
|
332
|
+
const { spec, issues: specIssues } = _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, input);
|
|
333
333
|
issues.push(...specIssues);
|
|
334
334
|
const uniq = [...new Set(unsupported)];
|
|
335
335
|
return { spec, issues, unsupported: uniq, lossless: uniq.length === 0 && specIssues.length === 0 };
|
|
@@ -382,7 +382,7 @@ function readChartex(root, issues, unsupported) {
|
|
|
382
382
|
const type = layouts[layout];
|
|
383
383
|
if (!type) {
|
|
384
384
|
issues.push({ path: "plotArea", message: `The chart layout "${layout || "unknown"}" is not supported.` });
|
|
385
|
-
return { spec:
|
|
385
|
+
return { spec: _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, {}).spec, issues, unsupported: [layout || "unknown chartex layout"], lossless: false };
|
|
386
386
|
}
|
|
387
387
|
if (layout === "paretoLine") unsupported.push("pareto line");
|
|
388
388
|
const series = [];
|
|
@@ -409,18 +409,18 @@ function readChartex(root, issues, unsupported) {
|
|
|
409
409
|
const first = data.get(_nullishCoalesce(_optionalChain([kid, 'call', _35 => _35(seriesEls[0], "dataId"), 'optionalAccess', _36 => _36.getAttribute, 'call', _37 => _37("val")]), () => ( "0")));
|
|
410
410
|
if ((type === "treemap" || type === "sunburst") && _optionalChain([first, 'optionalAccess', _38 => _38.paths])) {
|
|
411
411
|
const treeIssues = [];
|
|
412
|
-
input.tree =
|
|
412
|
+
input.tree = _chunkWRZ6C4TUcjs.chartTreeFromRows.call(void 0, first.paths.map((path2, i) => ({ path: path2, value: _nullishCoalesce(first.values[i], () => ( 0)) })), treeIssues);
|
|
413
413
|
for (const t of treeIssues) issues.push({ path: "chartData", message: t.message });
|
|
414
414
|
}
|
|
415
|
-
const { spec, issues: specIssues } =
|
|
415
|
+
const { spec, issues: specIssues } = _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, input);
|
|
416
416
|
issues.push(...specIssues);
|
|
417
417
|
return { spec, issues, unsupported, lossless: unsupported.length === 0 && specIssues.length === 0 };
|
|
418
418
|
}
|
|
419
419
|
var esc = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
420
420
|
var hex = (color) => {
|
|
421
421
|
if (!color) return null;
|
|
422
|
-
const rgb =
|
|
423
|
-
return rgb ?
|
|
422
|
+
const rgb = _chunkWRZ6C4TUcjs.parseChartColor.call(void 0, color);
|
|
423
|
+
return rgb ? _chunkWRZ6C4TUcjs.chartRgbToHex.call(void 0, rgb).slice(1).toUpperCase() : null;
|
|
424
424
|
};
|
|
425
425
|
var fillXml = (color, line = false) => {
|
|
426
426
|
const h = hex(color);
|
|
@@ -464,7 +464,7 @@ function errBarsXml(bars, dir) {
|
|
|
464
464
|
var MARKER_OUT = { circle: "circle", square: "square", diamond: "diamond", triangle: "triangle", cross: "x", none: "none" };
|
|
465
465
|
function chartToOoxml(spec) {
|
|
466
466
|
const issues = [];
|
|
467
|
-
const family =
|
|
467
|
+
const family = _chunkWRZ6C4TUcjs.chartFamily.call(void 0, spec);
|
|
468
468
|
let type = spec.type;
|
|
469
469
|
if (family === "waterfall" || family === "histogram" || family === "box" || family === "funnel") {
|
|
470
470
|
issues.push(`${spec.type} charts are written as bar charts: DrawingML has no ${spec.type} type (Office 2016 stores it as chartex).`);
|
|
@@ -512,7 +512,7 @@ function chartToOoxml(spec) {
|
|
|
512
512
|
const ids = { cat: 500000001, val: 500000002, cat2: 500000003, val2: 500000004 };
|
|
513
513
|
const xy = family === "xy" || type === "scatter" || type === "bubble";
|
|
514
514
|
const pieLike = type === "pie" || type === "donut";
|
|
515
|
-
const typed = (s) => pieLike || type === "radar" ? type : type === "bubble" ? "bubble" : xy ? "scatter" :
|
|
515
|
+
const typed = (s) => pieLike || type === "radar" ? type : type === "bubble" ? "bubble" : xy ? "scatter" : _chunkWRZ6C4TUcjs.chartSeriesType.call(void 0, { type }, s);
|
|
516
516
|
const groups = [];
|
|
517
517
|
visible.forEach((s) => {
|
|
518
518
|
const kind = typed(s);
|
|
@@ -575,7 +575,7 @@ function chartToOoxml(spec) {
|
|
|
575
575
|
return `<c:ser>${parts.join("")}</c:ser>`;
|
|
576
576
|
};
|
|
577
577
|
const dLbls = `<c:dLbls><c:showLegendKey val="0"/><c:showVal val="${spec.dataLabels ? 1 : 0}"/><c:showCatName val="0"/><c:showSerName val="0"/><c:showPercent val="0"/><c:showBubbleSize val="0"/></c:dLbls>`;
|
|
578
|
-
const vary =
|
|
578
|
+
const vary = _chunkWRZ6C4TUcjs.chartVariesColors.call(void 0, spec) ? 1 : 0;
|
|
579
579
|
const groupXml = groups.map((g) => {
|
|
580
580
|
const axes2 = g.secondary ? `<c:axId val="${ids.cat2}"/><c:axId val="${ids.val2}"/>` : `<c:axId val="${ids.cat}"/><c:axId val="${ids.val}"/>`;
|
|
581
581
|
const sers = g.series.map(({ s, index }) => serXml(g.kind, s, index)).join("");
|
|
@@ -4,20 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkEUIDTZNQcjs = require('./chunk-EUIDTZNQ.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkTFF2GTGNcjs = require('./chunk-TFF2GTGN.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var _chunkRD7RX52Gcjs = require('./chunk-RD7RX52G.cjs');
|
|
17
16
|
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
var _chunk7AHBW2CQcjs = require('./chunk-7AHBW2CQ.cjs');
|
|
18
|
+
var _chunk5UEFBM2Mcjs = require('./chunk-5UEFBM2M.cjs');
|
|
21
19
|
|
|
22
20
|
// src/gradient/model.ts
|
|
23
21
|
function clamp(v, min, max) {
|
|
@@ -72,9 +70,9 @@ function normalizeGradient(input) {
|
|
|
72
70
|
const rawStop = s;
|
|
73
71
|
let normColor = null;
|
|
74
72
|
if (typeof rawStop.color === "string" || rawStop.color && typeof rawStop.color === "object") {
|
|
75
|
-
const dual =
|
|
73
|
+
const dual = _chunkEUIDTZNQcjs.normalizeDualColor.call(void 0, rawStop.color);
|
|
76
74
|
if (dual) {
|
|
77
|
-
normColor =
|
|
75
|
+
normColor = _chunkEUIDTZNQcjs.formatDualColor.call(void 0, dual);
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
78
|
if (!normColor) {
|
|
@@ -144,7 +142,7 @@ function createGradient(colorsOrOptions, options) {
|
|
|
144
142
|
const stops = resolvedColors.map((color, i) => ({
|
|
145
143
|
id: `s${i + 1}`,
|
|
146
144
|
offset: i / (resolvedColors.length - 1),
|
|
147
|
-
color:
|
|
145
|
+
color: _chunkEUIDTZNQcjs.formatDualColor.call(void 0, _nullishCoalesce(_chunkEUIDTZNQcjs.normalizeDualColor.call(void 0, color), () => ( { light: "#000000", dark: "#000000" })))
|
|
148
146
|
}));
|
|
149
147
|
const res2 = normalizeGradient({
|
|
150
148
|
...options,
|
|
@@ -196,7 +194,7 @@ function isDualColorValue(val) {
|
|
|
196
194
|
if (typeof val === "string") {
|
|
197
195
|
return val.trim().toLowerCase().startsWith("light-dark(");
|
|
198
196
|
}
|
|
199
|
-
if (
|
|
197
|
+
if (_chunkEUIDTZNQcjs.isDualColor.call(void 0, val)) {
|
|
200
198
|
return val.light !== val.dark;
|
|
201
199
|
}
|
|
202
200
|
return false;
|
|
@@ -210,7 +208,7 @@ function resolveGradient(g, scheme) {
|
|
|
210
208
|
center: g.center ? { ...g.center } : void 0,
|
|
211
209
|
stops: g.stops.map((s) => ({
|
|
212
210
|
...s,
|
|
213
|
-
color: _nullishCoalesce(
|
|
211
|
+
color: _nullishCoalesce(_chunkEUIDTZNQcjs.resolveColor.call(void 0, s.color, scheme), () => ( s.color))
|
|
214
212
|
}))
|
|
215
213
|
};
|
|
216
214
|
}
|
|
@@ -238,7 +236,7 @@ function sampleGradient(g, t, scheme = "light") {
|
|
|
238
236
|
if (s0.midpoint !== void 0) {
|
|
239
237
|
u = gradientMidpointRemap(u, s0.midpoint);
|
|
240
238
|
}
|
|
241
|
-
const mixed =
|
|
239
|
+
const mixed = _chunkEUIDTZNQcjs.mixColors.call(void 0, s0.color, s1.color, u, { space: _nullishCoalesce(g.interpolation, () => ( "oklab")) });
|
|
242
240
|
return _nullishCoalesce(mixed, () => ( s0.color));
|
|
243
241
|
}
|
|
244
242
|
function insertGradientStop(g, offset, color) {
|
|
@@ -577,12 +575,12 @@ ${stopsXml.join("\n")}
|
|
|
577
575
|
</linearGradient>`;
|
|
578
576
|
}
|
|
579
577
|
function checkGradient(g, options = {}) {
|
|
580
|
-
const dual = isDualGradient(g) ||
|
|
578
|
+
const dual = isDualGradient(g) || _chunkEUIDTZNQcjs.isDualColor.call(void 0, options.surface) || _chunkEUIDTZNQcjs.isDualColor.call(void 0, options.text);
|
|
581
579
|
if (dual) {
|
|
582
580
|
const lightG = resolveGradient(g, "light");
|
|
583
581
|
const darkG = resolveGradient(g, "dark");
|
|
584
|
-
const lightText = options.text ? _nullishCoalesce(
|
|
585
|
-
const darkText = options.text ? _nullishCoalesce(
|
|
582
|
+
const lightText = options.text ? _nullishCoalesce(_chunkEUIDTZNQcjs.resolveColor.call(void 0, options.text, "light"), () => ( void 0)) : void 0;
|
|
583
|
+
const darkText = options.text ? _nullishCoalesce(_chunkEUIDTZNQcjs.resolveColor.call(void 0, options.text, "dark"), () => ( void 0)) : void 0;
|
|
586
584
|
const checkScheme = (grad, txt, schemeName) => {
|
|
587
585
|
const issues2 = [];
|
|
588
586
|
for (let i = 0; i < grad.stops.length - 1; i++) {
|
|
@@ -590,10 +588,10 @@ function checkGradient(g, options = {}) {
|
|
|
590
588
|
if (gap < 5e-3) {
|
|
591
589
|
issues2.push(`[${schemeName}] Stops "${grad.stops[i].id}" and "${grad.stops[i + 1].id}" are too close (gap < 0.005).`);
|
|
592
590
|
}
|
|
593
|
-
const c1 =
|
|
594
|
-
const c2 =
|
|
591
|
+
const c1 = _chunk5UEFBM2Mcjs.parseColor.call(void 0, grad.stops[i].color);
|
|
592
|
+
const c2 = _chunk5UEFBM2Mcjs.parseColor.call(void 0, grad.stops[i + 1].color);
|
|
595
593
|
if (c1 && c2 && gap < 0.05) {
|
|
596
|
-
const dE =
|
|
594
|
+
const dE = _chunkTFF2GTGNcjs.deltaEOK.call(void 0, c1, c2);
|
|
597
595
|
if (dE > 0.5) {
|
|
598
596
|
issues2.push(
|
|
599
597
|
`[${schemeName}] Banding risk between stops "${grad.stops[i].id}" and "${grad.stops[i + 1].id}" (\u0394EOK = ${dE.toFixed(2)} across gap ${gap.toFixed(3)}).`
|
|
@@ -602,20 +600,20 @@ function checkGradient(g, options = {}) {
|
|
|
602
600
|
}
|
|
603
601
|
}
|
|
604
602
|
for (const s of grad.stops) {
|
|
605
|
-
const c =
|
|
606
|
-
if (c && !
|
|
603
|
+
const c = _chunk5UEFBM2Mcjs.parseColor.call(void 0, s.color);
|
|
604
|
+
if (c && !_chunkTFF2GTGNcjs.inSrgbGamut.call(void 0, c)) {
|
|
607
605
|
issues2.push(`[${schemeName}] Stop "${s.id}" colour ${s.color} is outside standard sRGB gamut.`);
|
|
608
606
|
}
|
|
609
607
|
}
|
|
610
608
|
let lowest;
|
|
611
609
|
if (txt) {
|
|
612
|
-
const parsedTxt =
|
|
610
|
+
const parsedTxt = _chunk5UEFBM2Mcjs.parseColor.call(void 0, txt);
|
|
613
611
|
if (parsedTxt) {
|
|
614
612
|
let minRatio = Infinity;
|
|
615
613
|
for (let step = 0; step <= 32; step++) {
|
|
616
|
-
const sample =
|
|
614
|
+
const sample = _chunk5UEFBM2Mcjs.parseColor.call(void 0, sampleGradient(grad, step / 32, schemeName));
|
|
617
615
|
if (sample) {
|
|
618
|
-
const r =
|
|
616
|
+
const r = _chunk5UEFBM2Mcjs.contrastRatio.call(void 0, parsedTxt, sample);
|
|
619
617
|
if (r < minRatio) minRatio = r;
|
|
620
618
|
}
|
|
621
619
|
}
|
|
@@ -637,10 +635,10 @@ function checkGradient(g, options = {}) {
|
|
|
637
635
|
if (gap < 5e-3) {
|
|
638
636
|
issues.push(`Stops "${g.stops[i].id}" and "${g.stops[i + 1].id}" are too close (gap < 0.005).`);
|
|
639
637
|
}
|
|
640
|
-
const c1 =
|
|
641
|
-
const c2 =
|
|
638
|
+
const c1 = _chunk5UEFBM2Mcjs.parseColor.call(void 0, g.stops[i].color);
|
|
639
|
+
const c2 = _chunk5UEFBM2Mcjs.parseColor.call(void 0, g.stops[i + 1].color);
|
|
642
640
|
if (c1 && c2 && gap < 0.05) {
|
|
643
|
-
const dE =
|
|
641
|
+
const dE = _chunkTFF2GTGNcjs.deltaEOK.call(void 0, c1, c2);
|
|
644
642
|
if (dE > 0.5) {
|
|
645
643
|
issues.push(
|
|
646
644
|
`Banding risk between stops "${g.stops[i].id}" and "${g.stops[i + 1].id}" (\u0394EOK = ${dE.toFixed(2)} across gap ${gap.toFixed(3)}).`
|
|
@@ -649,20 +647,20 @@ function checkGradient(g, options = {}) {
|
|
|
649
647
|
}
|
|
650
648
|
}
|
|
651
649
|
for (const s of g.stops) {
|
|
652
|
-
const c =
|
|
653
|
-
if (c && !
|
|
650
|
+
const c = _chunk5UEFBM2Mcjs.parseColor.call(void 0, s.color);
|
|
651
|
+
if (c && !_chunkTFF2GTGNcjs.inSrgbGamut.call(void 0, c)) {
|
|
654
652
|
issues.push(`Stop "${s.id}" colour ${s.color} is outside standard sRGB gamut.`);
|
|
655
653
|
}
|
|
656
654
|
}
|
|
657
655
|
let lowestTextContrast;
|
|
658
656
|
if (options.text) {
|
|
659
|
-
const parsedTxt =
|
|
657
|
+
const parsedTxt = _chunk5UEFBM2Mcjs.parseColor.call(void 0, options.text);
|
|
660
658
|
if (parsedTxt) {
|
|
661
659
|
let minRatio = Infinity;
|
|
662
660
|
for (let step = 0; step <= 32; step++) {
|
|
663
|
-
const sample =
|
|
661
|
+
const sample = _chunk5UEFBM2Mcjs.parseColor.call(void 0, sampleGradient(g, step / 32, "light"));
|
|
664
662
|
if (sample) {
|
|
665
|
-
const r =
|
|
663
|
+
const r = _chunk5UEFBM2Mcjs.contrastRatio.call(void 0, parsedTxt, sample);
|
|
666
664
|
if (r < minRatio) minRatio = r;
|
|
667
665
|
}
|
|
668
666
|
}
|
|
@@ -804,7 +802,7 @@ function gradientTrackBackground(g) {
|
|
|
804
802
|
// src/gradient/sample.ts
|
|
805
803
|
var DEFAULT_TOLERANCE = 0.06;
|
|
806
804
|
function toRgba(color) {
|
|
807
|
-
if (typeof color === "string") return
|
|
805
|
+
if (typeof color === "string") return _chunk5UEFBM2Mcjs.parseColor.call(void 0, color);
|
|
808
806
|
if (Array.isArray(color) && color.length >= 4 && color.slice(0, 4).every((v) => Number.isFinite(v))) {
|
|
809
807
|
return { r: color[0] / 255, g: color[1] / 255, b: color[2] / 255, a: color[3] / 255 };
|
|
810
808
|
}
|
|
@@ -844,7 +842,7 @@ function fitGradientStops(samples, options = {}) {
|
|
|
844
842
|
if (!s || !Number.isFinite(s.offset)) continue;
|
|
845
843
|
const c = toRgba(s.color);
|
|
846
844
|
if (!c) continue;
|
|
847
|
-
const lab2 =
|
|
845
|
+
const lab2 = _chunk5UEFBM2Mcjs.rgbToOklab.call(void 0, { ...c, a: _nullishCoalesce(c.a, () => ( 1)) });
|
|
848
846
|
raw.push({ t: Math.min(1, Math.max(0, s.offset)), v: [lab2.l, lab2.a, lab2.b, _nullishCoalesce(c.a, () => ( 1))] });
|
|
849
847
|
}
|
|
850
848
|
if (raw.length < 2) throw new Error(`Need at least two readable samples to make a gradient; got ${raw.length}.`);
|
|
@@ -877,7 +875,7 @@ function fitGradientStops(samples, options = {}) {
|
|
|
877
875
|
}
|
|
878
876
|
const stops = at.map((i, k) => {
|
|
879
877
|
const [l, a, b, alpha] = lab[i].v;
|
|
880
|
-
const color =
|
|
878
|
+
const color = _chunkTFF2GTGNcjs.formatHex.call(void 0, _chunk5UEFBM2Mcjs.oklabToRgb.call(void 0, { l, a, b, alpha: Math.min(1, Math.max(0, alpha)) }));
|
|
881
879
|
return { id: `s${k + 1}`, offset: k === 0 ? 0 : k === at.length - 1 ? 1 : Math.round(lab[i].t * 1e3) / 1e3, color };
|
|
882
880
|
});
|
|
883
881
|
return { stops, maxError: Math.round(maxErrorOf(lab, at) * 1e4) / 1e4 };
|