@pixerate/editor 0.161.0 → 0.162.1
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 +36 -35
- package/dist/agent/index.js +7 -6
- package/dist/animation/index.cjs +5 -4
- package/dist/animation/index.js +4 -3
- package/dist/animation-editor/index.cjs +63 -62
- package/dist/animation-editor/index.js +7 -6
- package/dist/{brushstrokeRender-Q4LI22QV.js → brushstrokeRender-7LXCU7PD.js} +2 -2
- package/dist/{brushstrokeRender-5WANQIG4.cjs → brushstrokeRender-VO4ZTWVA.cjs} +5 -5
- package/dist/canvas/index.cjs +40 -39
- package/dist/canvas/index.js +7 -6
- package/dist/chart/index.cjs +88 -87
- package/dist/chart/index.js +7 -6
- package/dist/{chunk-LQLZHP6F.js → chunk-36OKQDCF.js} +7 -4
- package/dist/{chunk-AKDWAWSY.cjs → chunk-3IHNXRUV.cjs} +45 -45
- package/dist/{chunk-72BGL3I2.js → chunk-3VLOOO3G.js} +1 -1
- package/dist/{chunk-TVO6W2Q6.cjs → chunk-4NGVHHJB.cjs} +17 -17
- package/dist/chunk-4VU4CP7R.js +769 -0
- package/dist/{chunk-MHEXLG3M.cjs → chunk-5AARIS3R.cjs} +37 -37
- package/dist/{chunk-DBIVICAO.js → chunk-7CKPUUN4.js} +1 -1
- package/dist/{chunk-57JLBGJ5.cjs → chunk-7YBDRJXT.cjs} +8 -8
- package/dist/{chunk-KY3FYKP3.js → chunk-BQWGN5WH.js} +1 -1
- package/dist/{chunk-LEUZ4FRC.cjs → chunk-CIPIESX4.cjs} +3 -3
- package/dist/chunk-CJE5MOIS.js +347 -0
- package/dist/{chunk-5QBRAIVK.js → chunk-CX6JLDFC.js} +3 -3
- package/dist/{chunk-R3QY7PPL.js → chunk-DTSTNRPH.js} +1 -1
- package/dist/{chunk-6LUYFHHN.cjs → chunk-EQ46F75O.cjs} +51 -51
- package/dist/{chunk-UKCJ43YL.cjs → chunk-ES3UEVUT.cjs} +130 -898
- package/dist/{chunk-UM3RPYC5.js → chunk-EVPZ5IKN.js} +1 -1
- package/dist/{chunk-XNQ5EFB4.cjs → chunk-EY22AY6R.cjs} +16 -16
- package/dist/chunk-FKUKJ3XA.cjs +347 -0
- package/dist/{chunk-YABNLNY7.js → chunk-GLMP22FT.js} +3 -3
- package/dist/{chunk-SUF6WRXR.cjs → chunk-GTELFJRE.cjs} +2 -2
- package/dist/{chunk-AY65VQSU.js → chunk-H3OEM3Q2.js} +1 -1
- package/dist/{chunk-4YWAEV4W.cjs → chunk-HDGBM7EA.cjs} +26 -26
- package/dist/{chunk-H5XX4KHB.js → chunk-HLOKB7WW.js} +5 -3
- package/dist/{chunk-QMI5HZWA.cjs → chunk-JCXMJUQO.cjs} +5 -5
- package/dist/{chunk-WPPJH6X4.cjs → chunk-LL3H5XUH.cjs} +6 -4
- package/dist/{chunk-4T44CJ5K.cjs → chunk-NA4UVVJ4.cjs} +15 -15
- package/dist/{chunk-Q6PA362P.js → chunk-NO5QQDHZ.js} +2 -2
- package/dist/{chunk-3YDQLQH2.cjs → chunk-PA3IMPPS.cjs} +81 -81
- package/dist/{chunk-WNAAWLZ5.js → chunk-QY4KUDMY.js} +2 -2
- package/dist/{chunk-AA34BA7G.js → chunk-QYZGBVNC.js} +30 -798
- package/dist/chunk-S6X2QRVU.cjs +769 -0
- package/dist/{chunk-6UPGM3JB.js → chunk-SET6KJOP.js} +2 -2
- package/dist/{chunk-GNK7SESQ.cjs → chunk-V7GWZIZK.cjs} +7 -4
- package/dist/{chunk-EYVVIZJ3.cjs → chunk-WTW7QRTS.cjs} +1 -1
- package/dist/{chunk-SSCL7QQ4.js → chunk-XDCFJEU7.js} +2 -2
- package/dist/{chunk-JGKCC5OF.cjs → chunk-YQ5C5BVK.cjs} +10 -9
- package/dist/{chunk-A5UCR2TO.js → chunk-YXKLVD56.js} +10 -9
- package/dist/{chunk-45XXVHVG.js → chunk-ZZGPYNS2.js} +1 -1
- package/dist/color/index.cjs +6 -2
- package/dist/color/index.d.cts +1 -0
- package/dist/color/index.d.ts +1 -0
- package/dist/color/index.js +28 -24
- package/dist/color/suggest.d.cts +12 -0
- package/dist/color/suggest.d.ts +12 -0
- package/dist/effects/index.cjs +37 -13
- package/dist/effects/index.js +29 -5
- package/dist/effects/ui.d.cts +20 -3
- package/dist/effects/ui.d.ts +20 -3
- package/dist/export/index.cjs +6 -5
- package/dist/export/index.js +5 -4
- package/dist/extensions/index.cjs +9 -8
- package/dist/extensions/index.js +8 -7
- package/dist/gradient/index.cjs +28 -26
- package/dist/gradient/index.js +7 -5
- package/dist/image-editor/index.cjs +641 -640
- package/dist/image-editor/index.js +7 -6
- package/dist/index.cjs +15 -14
- package/dist/index.js +9 -8
- package/dist/paint/index.cjs +2 -2
- package/dist/paint/index.js +1 -1
- package/dist/paint-editor/index.cjs +136 -135
- package/dist/paint-editor/index.js +8 -7
- package/dist/typography/accessibility.d.cts +44 -0
- package/dist/typography/accessibility.d.ts +44 -0
- package/dist/typography/catalog.d.cts +98 -0
- package/dist/typography/catalog.d.ts +98 -0
- package/dist/typography/index.cjs +1099 -0
- package/dist/typography/index.d.cts +16 -0
- package/dist/typography/index.d.ts +16 -0
- package/dist/typography/index.js +1099 -0
- package/dist/typography/metrics.d.cts +31 -0
- package/dist/typography/metrics.d.ts +31 -0
- package/dist/typography/picker.d.cts +132 -0
- package/dist/typography/picker.d.ts +132 -0
- package/dist/typography/registry.d.cts +66 -0
- package/dist/typography/registry.d.ts +66 -0
- package/dist/typography/scale.d.cts +62 -0
- package/dist/typography/scale.d.ts +62 -0
- package/dist/typography/segment.d.cts +26 -0
- package/dist/typography/segment.d.ts +26 -0
- package/dist/typography/stack.d.cts +26 -0
- package/dist/typography/stack.d.ts +26 -0
- package/dist/typography/tools.d.cts +34 -0
- package/dist/typography/tools.d.ts +34 -0
- package/dist/typography/types.d.cts +96 -0
- package/dist/typography/types.d.ts +96 -0
- package/dist/typography/weight.d.cts +13 -0
- package/dist/typography/weight.d.ts +13 -0
- package/dist/vector/index.cjs +951 -950
- package/dist/vector/index.js +6 -5
- package/dist/video-editor/index.cjs +5 -4
- package/dist/video-editor/index.js +4 -3
- package/package.json +13 -3
- package/skills/README.md +1 -0
- package/skills/pixerate-chart/SKILL.md +92 -9
- package/skills/pixerate-paint-editor/SKILL.md +0 -2
- package/skills/pixerate-typography/SKILL.md +91 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BUILTIN_BRUSHES
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YXKLVD56.js";
|
|
4
4
|
import {
|
|
5
5
|
parseProvenance
|
|
6
6
|
} from "./chunk-M6DNZNVY.js";
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
import {
|
|
52
52
|
oklabToRgb,
|
|
53
53
|
rgbToOklab
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-BQWGN5WH.js";
|
|
55
55
|
import {
|
|
56
56
|
hexToRgba,
|
|
57
57
|
normalizeTokenColor,
|
|
@@ -2358,12 +2358,15 @@ var WetMedium = (_class2 = class {
|
|
|
2358
2358
|
sample(rect, cov) {
|
|
2359
2359
|
const s = this.world.sample(this.laneId, rect, cov);
|
|
2360
2360
|
if (!(s.wet > 0) || !(s.weight > 0)) return null;
|
|
2361
|
-
const
|
|
2362
|
-
const
|
|
2361
|
+
const k0 = s.pigment[0] + s.settled[0];
|
|
2362
|
+
const k1 = s.pigment[1] + s.settled[1];
|
|
2363
|
+
const k2 = s.pigment[2] + s.settled[2];
|
|
2364
|
+
const k3 = s.pigment[3] + s.settled[3];
|
|
2365
|
+
const kmax = Math.max(k0, k1, k2);
|
|
2363
2366
|
if (!(kmax > 1e-9)) return null;
|
|
2364
2367
|
const f = SAMPLE_K / kmax;
|
|
2365
|
-
const rgb = pigmentColor(
|
|
2366
|
-
const density = Math.min(1, (
|
|
2368
|
+
const rgb = pigmentColor(k0 * f, k1 * f, k2 * f, k3 * f);
|
|
2369
|
+
const density = Math.min(1, (k0 + k1 + k2) / s.wet / 0.06);
|
|
2367
2370
|
return { rgb, contact: s.wet / s.weight * density };
|
|
2368
2371
|
}
|
|
2369
2372
|
deposit(rect, cov, dep, paint, _pigment, field = null) {
|
|
@@ -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 ??= Promise.resolve().then(() => _interopRequireWildcard(require("./brushstrokeRender-
|
|
77
|
+
loading ??= Promise.resolve().then(() => _interopRequireWildcard(require("./brushstrokeRender-VO4ZTWVA.cjs"))).catch((error) => {
|
|
78
78
|
loading = null;
|
|
79
79
|
throw error;
|
|
80
80
|
});
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
r2,
|
|
8
8
|
sameChartSelection,
|
|
9
9
|
summarizeChartSeries
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DTSTNRPH.js";
|
|
11
11
|
import {
|
|
12
12
|
CHART_TYPE_LABELS,
|
|
13
13
|
DEFAULT_CHART_PALETTE,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
parseChartValue,
|
|
28
28
|
shadeChartColor,
|
|
29
29
|
uniqueChartSeriesId
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-HLOKB7WW.js";
|
|
31
31
|
import {
|
|
32
32
|
parseCsv,
|
|
33
33
|
parseTsv
|
|
@@ -1457,8 +1457,8 @@ var BUILTIN_BRUSHES = [
|
|
|
1457
1457
|
engine: "wet",
|
|
1458
1458
|
tip: { size: 28, hardness: 0.6, spacing: 0.12, opacity: 1, flow: 1, smoothing: 0.25, pressureSize: true, pressureOpacity: true },
|
|
1459
1459
|
dynamics: { minSize: 0.35 },
|
|
1460
|
-
behavior: { pickup: 0.
|
|
1461
|
-
wet: { tool: "paint", water: 0.55, pigment: 0.5, body: 0 }
|
|
1460
|
+
behavior: { pickup: 0.55, mix: 0.5, mixing: "pigment" },
|
|
1461
|
+
wet: { tool: "paint", water: 0.55, pigment: 0.5, body: 0, rewet: 0.2 }
|
|
1462
1462
|
}),
|
|
1463
1463
|
builtin({
|
|
1464
1464
|
id: "watercolor-wash",
|
|
@@ -1467,8 +1467,8 @@ var BUILTIN_BRUSHES = [
|
|
|
1467
1467
|
engine: "wet",
|
|
1468
1468
|
rotation: "stroke",
|
|
1469
1469
|
tip: { size: 90, hardness: 0.35, spacing: 0.1, angle: 90, roundness: 0.45, opacity: 1, flow: 1, smoothing: 0.3, pressureSize: false, pressureOpacity: true },
|
|
1470
|
-
behavior: { pickup: 0.
|
|
1471
|
-
wet: { tool: "paint", water: 0.8, pigment: 0.45, body: 0 }
|
|
1470
|
+
behavior: { pickup: 0.45, mix: 0.45, mixing: "pigment" },
|
|
1471
|
+
wet: { tool: "paint", water: 0.8, pigment: 0.45, body: 0, rewet: 0.2 }
|
|
1472
1472
|
}),
|
|
1473
1473
|
builtin({
|
|
1474
1474
|
id: "gradient-wash",
|
|
@@ -1477,8 +1477,8 @@ var BUILTIN_BRUSHES = [
|
|
|
1477
1477
|
engine: "wet",
|
|
1478
1478
|
rotation: "stroke",
|
|
1479
1479
|
tip: { size: 80, hardness: 0.35, spacing: 0.1, angle: 90, roundness: 0.5, opacity: 1, flow: 1, smoothing: 0.3, pressureSize: false, pressureOpacity: true },
|
|
1480
|
-
behavior: { pickup: 0.
|
|
1481
|
-
wet: { tool: "paint", water: 0.8, pigment: 0.45, body: 0 },
|
|
1480
|
+
behavior: { pickup: 0.4, mix: 0.4, mixing: "pigment" },
|
|
1481
|
+
wet: { tool: "paint", water: 0.8, pigment: 0.45, body: 0, rewet: 0.2 },
|
|
1482
1482
|
// A graded wash: the paint colour runs into the second colour as the brush travels.
|
|
1483
1483
|
paint: { type: "gradient", stops: [{ offset: 0, color: "paint" }, { offset: 1, color: "secondary" }], space: "pigment", map: { by: "distance", length: 500, repeat: "mirror" } }
|
|
1484
1484
|
}),
|
|
@@ -1489,7 +1489,8 @@ var BUILTIN_BRUSHES = [
|
|
|
1489
1489
|
engine: "wet",
|
|
1490
1490
|
tip: { size: 7, hardness: 0.75, spacing: 0.1, opacity: 1, flow: 1, smoothing: 0.4, pressureSize: true, pressureOpacity: false },
|
|
1491
1491
|
dynamics: { minSize: 0.2 },
|
|
1492
|
-
|
|
1492
|
+
behavior: { pickup: 0.4, mix: 0.45, mixing: "pigment" },
|
|
1493
|
+
wet: { tool: "paint", water: 0.4, pigment: 0.7, body: 0, rewet: 0.2 }
|
|
1493
1494
|
}),
|
|
1494
1495
|
builtin({
|
|
1495
1496
|
id: "gouache",
|
|
@@ -1498,8 +1499,8 @@ var BUILTIN_BRUSHES = [
|
|
|
1498
1499
|
engine: "wet",
|
|
1499
1500
|
tip: { size: 26, hardness: 0.7, spacing: 0.1, opacity: 1, flow: 1, smoothing: 0.25, pressureSize: true, pressureOpacity: false },
|
|
1500
1501
|
dynamics: { minSize: 0.5 },
|
|
1501
|
-
behavior: { pickup: 0.
|
|
1502
|
-
wet: { tool: "paint", water: 0.35, pigment: 0.8, body: 1, medium: "gouache" }
|
|
1502
|
+
behavior: { pickup: 0.65, mix: 0.6, mixing: "pigment" },
|
|
1503
|
+
wet: { tool: "paint", water: 0.35, pigment: 0.8, body: 1, medium: "gouache", rewet: 0.3 }
|
|
1503
1504
|
}),
|
|
1504
1505
|
builtin({
|
|
1505
1506
|
id: "oil-round",
|
|
@@ -1457,8 +1457,8 @@ var BUILTIN_BRUSHES = [
|
|
|
1457
1457
|
engine: "wet",
|
|
1458
1458
|
tip: { size: 28, hardness: 0.6, spacing: 0.12, opacity: 1, flow: 1, smoothing: 0.25, pressureSize: true, pressureOpacity: true },
|
|
1459
1459
|
dynamics: { minSize: 0.35 },
|
|
1460
|
-
behavior: { pickup: 0.
|
|
1461
|
-
wet: { tool: "paint", water: 0.55, pigment: 0.5, body: 0 }
|
|
1460
|
+
behavior: { pickup: 0.55, mix: 0.5, mixing: "pigment" },
|
|
1461
|
+
wet: { tool: "paint", water: 0.55, pigment: 0.5, body: 0, rewet: 0.2 }
|
|
1462
1462
|
}),
|
|
1463
1463
|
builtin({
|
|
1464
1464
|
id: "watercolor-wash",
|
|
@@ -1467,8 +1467,8 @@ var BUILTIN_BRUSHES = [
|
|
|
1467
1467
|
engine: "wet",
|
|
1468
1468
|
rotation: "stroke",
|
|
1469
1469
|
tip: { size: 90, hardness: 0.35, spacing: 0.1, angle: 90, roundness: 0.45, opacity: 1, flow: 1, smoothing: 0.3, pressureSize: false, pressureOpacity: true },
|
|
1470
|
-
behavior: { pickup: 0.
|
|
1471
|
-
wet: { tool: "paint", water: 0.8, pigment: 0.45, body: 0 }
|
|
1470
|
+
behavior: { pickup: 0.45, mix: 0.45, mixing: "pigment" },
|
|
1471
|
+
wet: { tool: "paint", water: 0.8, pigment: 0.45, body: 0, rewet: 0.2 }
|
|
1472
1472
|
}),
|
|
1473
1473
|
builtin({
|
|
1474
1474
|
id: "gradient-wash",
|
|
@@ -1477,8 +1477,8 @@ var BUILTIN_BRUSHES = [
|
|
|
1477
1477
|
engine: "wet",
|
|
1478
1478
|
rotation: "stroke",
|
|
1479
1479
|
tip: { size: 80, hardness: 0.35, spacing: 0.1, angle: 90, roundness: 0.5, opacity: 1, flow: 1, smoothing: 0.3, pressureSize: false, pressureOpacity: true },
|
|
1480
|
-
behavior: { pickup: 0.
|
|
1481
|
-
wet: { tool: "paint", water: 0.8, pigment: 0.45, body: 0 },
|
|
1480
|
+
behavior: { pickup: 0.4, mix: 0.4, mixing: "pigment" },
|
|
1481
|
+
wet: { tool: "paint", water: 0.8, pigment: 0.45, body: 0, rewet: 0.2 },
|
|
1482
1482
|
// A graded wash: the paint colour runs into the second colour as the brush travels.
|
|
1483
1483
|
paint: { type: "gradient", stops: [{ offset: 0, color: "paint" }, { offset: 1, color: "secondary" }], space: "pigment", map: { by: "distance", length: 500, repeat: "mirror" } }
|
|
1484
1484
|
}),
|
|
@@ -1489,7 +1489,8 @@ var BUILTIN_BRUSHES = [
|
|
|
1489
1489
|
engine: "wet",
|
|
1490
1490
|
tip: { size: 7, hardness: 0.75, spacing: 0.1, opacity: 1, flow: 1, smoothing: 0.4, pressureSize: true, pressureOpacity: false },
|
|
1491
1491
|
dynamics: { minSize: 0.2 },
|
|
1492
|
-
|
|
1492
|
+
behavior: { pickup: 0.4, mix: 0.45, mixing: "pigment" },
|
|
1493
|
+
wet: { tool: "paint", water: 0.4, pigment: 0.7, body: 0, rewet: 0.2 }
|
|
1493
1494
|
}),
|
|
1494
1495
|
builtin({
|
|
1495
1496
|
id: "gouache",
|
|
@@ -1498,8 +1499,8 @@ var BUILTIN_BRUSHES = [
|
|
|
1498
1499
|
engine: "wet",
|
|
1499
1500
|
tip: { size: 26, hardness: 0.7, spacing: 0.1, opacity: 1, flow: 1, smoothing: 0.25, pressureSize: true, pressureOpacity: false },
|
|
1500
1501
|
dynamics: { minSize: 0.5 },
|
|
1501
|
-
behavior: { pickup: 0.
|
|
1502
|
-
wet: { tool: "paint", water: 0.35, pigment: 0.8, body: 1, medium: "gouache" }
|
|
1502
|
+
behavior: { pickup: 0.65, mix: 0.6, mixing: "pigment" },
|
|
1503
|
+
wet: { tool: "paint", water: 0.35, pigment: 0.8, body: 1, medium: "gouache", rewet: 0.3 }
|
|
1503
1504
|
}),
|
|
1504
1505
|
builtin({
|
|
1505
1506
|
id: "oil-round",
|
|
@@ -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-7LXCU7PD.js").catch((error) => {
|
|
78
78
|
loading = null;
|
|
79
79
|
throw error;
|
|
80
80
|
});
|
package/dist/color/index.cjs
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
+
var _chunkES3UEVUTcjs = require('../chunk-ES3UEVUT.cjs');
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
|
|
@@ -54,7 +55,9 @@
|
|
|
54
55
|
|
|
55
56
|
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
var _chunkS6X2QRVUcjs = require('../chunk-S6X2QRVU.cjs');
|
|
58
61
|
require('../chunk-IPJ3TEYR.cjs');
|
|
59
62
|
|
|
60
63
|
|
|
@@ -112,4 +115,5 @@ require('../chunk-IPJ3TEYR.cjs');
|
|
|
112
115
|
|
|
113
116
|
|
|
114
117
|
|
|
115
|
-
|
|
118
|
+
|
|
119
|
+
exports.DEFAULT_SCHEME_SURFACES = _chunkES3UEVUTcjs.DEFAULT_SCHEME_SURFACES; exports.HARMONY_KINDS = _chunkES3UEVUTcjs.HARMONY_KINDS; exports.NAMED_COLORS = _chunkS6X2QRVUcjs.NAMED_COLORS; exports.PICKER_HUE_BACKGROUND = _chunkES3UEVUTcjs.PICKER_HUE_BACKGROUND; exports.checkDualColorContrast = _chunkES3UEVUTcjs.checkDualColorContrast; exports.checkPaletteColors = _chunkES3UEVUTcjs.checkPaletteColors; exports.colorHarmony = _chunkES3UEVUTcjs.colorHarmony; exports.contrastLevel = _chunkS6X2QRVUcjs.contrastLevel; exports.contrastRatio = _chunkS6X2QRVUcjs.contrastRatio; exports.createColorToolProvider = _chunkES3UEVUTcjs.createColorToolProvider; exports.deltaEOK = _chunkS6X2QRVUcjs.deltaEOK; exports.deriveDualColor = _chunkES3UEVUTcjs.deriveDualColor; exports.displayP3ToLinearSrgb = _chunkS6X2QRVUcjs.displayP3ToLinearSrgb; exports.dualColorsToCss = _chunkES3UEVUTcjs.dualColorsToCss; exports.dualPickerView = _chunkES3UEVUTcjs.dualPickerView; exports.formatColor = _chunkS6X2QRVUcjs.formatColor; exports.formatDualColor = _chunkES3UEVUTcjs.formatDualColor; exports.formatHex = _chunkS6X2QRVUcjs.formatHex; exports.hslToRgb = _chunkS6X2QRVUcjs.hslToRgb; exports.hsvToRgb = _chunkS6X2QRVUcjs.hsvToRgb; exports.hueToWheel = _chunkES3UEVUTcjs.hueToWheel; exports.inSrgbGamut = _chunkS6X2QRVUcjs.inSrgbGamut; exports.isColor = _chunkS6X2QRVUcjs.isColor; exports.isDualColor = _chunkES3UEVUTcjs.isDualColor; exports.isSameInBothSchemes = _chunkES3UEVUTcjs.isSameInBothSchemes; exports.linearSrgbToDisplayP3 = _chunkS6X2QRVUcjs.linearSrgbToDisplayP3; exports.linearToSrgb = _chunkS6X2QRVUcjs.linearToSrgb; exports.mixColors = _chunkES3UEVUTcjs.mixColors; exports.normalizeColor = _chunkS6X2QRVUcjs.normalizeColor; exports.normalizeDualColor = _chunkES3UEVUTcjs.normalizeDualColor; exports.oklabToOklch = _chunkS6X2QRVUcjs.oklabToOklch; exports.oklabToRgb = _chunkS6X2QRVUcjs.oklabToRgb; exports.oklchToOklab = _chunkS6X2QRVUcjs.oklchToOklab; exports.parseColor = _chunkS6X2QRVUcjs.parseColor; exports.parseDualColor = _chunkES3UEVUTcjs.parseDualColor; exports.pickerAlphaBackground = _chunkES3UEVUTcjs.pickerAlphaBackground; exports.pickerAreaBackground = _chunkES3UEVUTcjs.pickerAreaBackground; exports.pickerKeyStep = _chunkES3UEVUTcjs.pickerKeyStep; exports.pickerStateFromAlpha = _chunkES3UEVUTcjs.pickerStateFromAlpha; exports.pickerStateFromArea = _chunkES3UEVUTcjs.pickerStateFromArea; exports.pickerStateFromColor = _chunkES3UEVUTcjs.pickerStateFromColor; exports.pickerStateFromHue = _chunkES3UEVUTcjs.pickerStateFromHue; exports.pickerStateToHex = _chunkES3UEVUTcjs.pickerStateToHex; exports.pushRecentColor = _chunkES3UEVUTcjs.pushRecentColor; exports.readableTextColor = _chunkS6X2QRVUcjs.readableTextColor; exports.relativeLuminance = _chunkS6X2QRVUcjs.relativeLuminance; exports.resolveColor = _chunkES3UEVUTcjs.resolveColor; exports.rgbToHsl = _chunkS6X2QRVUcjs.rgbToHsl; exports.rgbToHsv = _chunkS6X2QRVUcjs.rgbToHsv; exports.rgbToOklab = _chunkS6X2QRVUcjs.rgbToOklab; exports.setDualColorSide = _chunkES3UEVUTcjs.setDualColorSide; exports.simulateColorVision = _chunkES3UEVUTcjs.simulateColorVision; exports.srgbToLinear = _chunkS6X2QRVUcjs.srgbToLinear; exports.suggestAccessibleForeground = _chunkS6X2QRVUcjs.suggestAccessibleForeground; exports.toSrgbGamut = _chunkS6X2QRVUcjs.toSrgbGamut; exports.wheelToHue = _chunkES3UEVUTcjs.wheelToHue;
|
package/dist/color/index.d.cts
CHANGED
package/dist/color/index.d.ts
CHANGED
package/dist/color/index.js
CHANGED
|
@@ -1,38 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_SCHEME_SURFACES,
|
|
3
3
|
HARMONY_KINDS,
|
|
4
|
-
NAMED_COLORS,
|
|
5
4
|
PICKER_HUE_BACKGROUND,
|
|
6
5
|
checkDualColorContrast,
|
|
7
6
|
checkPaletteColors,
|
|
8
7
|
colorHarmony,
|
|
9
|
-
contrastLevel,
|
|
10
|
-
contrastRatio,
|
|
11
8
|
createColorToolProvider,
|
|
12
|
-
deltaEOK,
|
|
13
9
|
deriveDualColor,
|
|
14
|
-
displayP3ToLinearSrgb,
|
|
15
10
|
dualColorsToCss,
|
|
16
11
|
dualPickerView,
|
|
17
|
-
formatColor,
|
|
18
12
|
formatDualColor,
|
|
19
|
-
formatHex,
|
|
20
|
-
hslToRgb,
|
|
21
|
-
hsvToRgb,
|
|
22
13
|
hueToWheel,
|
|
23
|
-
inSrgbGamut,
|
|
24
|
-
isColor,
|
|
25
14
|
isDualColor,
|
|
26
15
|
isSameInBothSchemes,
|
|
27
|
-
linearSrgbToDisplayP3,
|
|
28
|
-
linearToSrgb,
|
|
29
16
|
mixColors,
|
|
30
|
-
normalizeColor,
|
|
31
17
|
normalizeDualColor,
|
|
32
|
-
oklabToOklch,
|
|
33
|
-
oklabToRgb,
|
|
34
|
-
oklchToOklab,
|
|
35
|
-
parseColor,
|
|
36
18
|
parseDualColor,
|
|
37
19
|
pickerAlphaBackground,
|
|
38
20
|
pickerAreaBackground,
|
|
@@ -43,18 +25,39 @@ import {
|
|
|
43
25
|
pickerStateFromHue,
|
|
44
26
|
pickerStateToHex,
|
|
45
27
|
pushRecentColor,
|
|
28
|
+
resolveColor,
|
|
29
|
+
setDualColorSide,
|
|
30
|
+
simulateColorVision,
|
|
31
|
+
wheelToHue
|
|
32
|
+
} from "../chunk-QYZGBVNC.js";
|
|
33
|
+
import {
|
|
34
|
+
NAMED_COLORS,
|
|
35
|
+
contrastLevel,
|
|
36
|
+
contrastRatio,
|
|
37
|
+
deltaEOK,
|
|
38
|
+
displayP3ToLinearSrgb,
|
|
39
|
+
formatColor,
|
|
40
|
+
formatHex,
|
|
41
|
+
hslToRgb,
|
|
42
|
+
hsvToRgb,
|
|
43
|
+
inSrgbGamut,
|
|
44
|
+
isColor,
|
|
45
|
+
linearSrgbToDisplayP3,
|
|
46
|
+
linearToSrgb,
|
|
47
|
+
normalizeColor,
|
|
48
|
+
oklabToOklch,
|
|
49
|
+
oklabToRgb,
|
|
50
|
+
oklchToOklab,
|
|
51
|
+
parseColor,
|
|
46
52
|
readableTextColor,
|
|
47
53
|
relativeLuminance,
|
|
48
|
-
resolveColor,
|
|
49
54
|
rgbToHsl,
|
|
50
55
|
rgbToHsv,
|
|
51
56
|
rgbToOklab,
|
|
52
|
-
setDualColorSide,
|
|
53
|
-
simulateColorVision,
|
|
54
57
|
srgbToLinear,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} from "../chunk-
|
|
58
|
+
suggestAccessibleForeground,
|
|
59
|
+
toSrgbGamut
|
|
60
|
+
} from "../chunk-4VU4CP7R.js";
|
|
58
61
|
import "../chunk-6ONMQ6WF.js";
|
|
59
62
|
export {
|
|
60
63
|
DEFAULT_SCHEME_SURFACES,
|
|
@@ -110,6 +113,7 @@ export {
|
|
|
110
113
|
setDualColorSide,
|
|
111
114
|
simulateColorVision,
|
|
112
115
|
srgbToLinear,
|
|
116
|
+
suggestAccessibleForeground,
|
|
113
117
|
toSrgbGamut,
|
|
114
118
|
wheelToHue
|
|
115
119
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accessible foreground suggestions: the nearest OKLCH lightness that meets WCAG 2 AA.
|
|
3
|
+
*/
|
|
4
|
+
import type { Rgba } from './types.cjs';
|
|
5
|
+
/**
|
|
6
|
+
* The foreground colour (as hex) closest in OKLCH lightness to `foreground` that meets WCAG 2 AA
|
|
7
|
+
* against `background`, keeping hue and chroma. `large` uses the 3:1 large-text threshold.
|
|
8
|
+
* `undefined` when no lightness passes (only possible for mid-grey backgrounds at extreme targets).
|
|
9
|
+
*/
|
|
10
|
+
export declare function suggestAccessibleForeground(foreground: Rgba, background: Rgba, options?: {
|
|
11
|
+
large?: boolean;
|
|
12
|
+
}): string | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accessible foreground suggestions: the nearest OKLCH lightness that meets WCAG 2 AA.
|
|
3
|
+
*/
|
|
4
|
+
import type { Rgba } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* The foreground colour (as hex) closest in OKLCH lightness to `foreground` that meets WCAG 2 AA
|
|
7
|
+
* against `background`, keeping hue and chroma. `large` uses the 3:1 large-text threshold.
|
|
8
|
+
* `undefined` when no lightness passes (only possible for mid-grey backgrounds at extreme targets).
|
|
9
|
+
*/
|
|
10
|
+
export declare function suggestAccessibleForeground(foreground: Rgba, background: Rgba, options?: {
|
|
11
|
+
large?: boolean;
|
|
12
|
+
}): string | undefined;
|
package/dist/effects/index.cjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
var _chunkFKUKJ3XAcjs = require('../chunk-FKUKJ3XA.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
3
6
|
var _chunk6DM3PUQDcjs = require('../chunk-6DM3PUQD.cjs');
|
|
4
7
|
|
|
5
8
|
|
|
@@ -583,13 +586,16 @@ var EFFECT_USE_LABELS = {
|
|
|
583
586
|
};
|
|
584
587
|
var HEX2 = /^#[0-9a-f]{6}([0-9a-f]{2})?$/i;
|
|
585
588
|
var typeOf = (s) => Array.isArray(s.type) ? s.type.find((t) => t !== "null") : s.type;
|
|
586
|
-
function
|
|
589
|
+
function isEffectFontControl(schema) {
|
|
590
|
+
return typeOf(schema) === "string" && (schema.format === "font" || schema["x-pixerate-control"] === "font");
|
|
591
|
+
}
|
|
592
|
+
function effectControlField(name, schema, fallback, options = {}) {
|
|
587
593
|
const base = { id: name, ...schema.title ? { label: schema.title } : {}, ...schema.description ? { description: schema.description } : {} };
|
|
588
594
|
const def = _nullishCoalesce(schema.default, () => ( fallback));
|
|
589
595
|
const type = typeOf(schema);
|
|
590
596
|
if (Array.isArray(schema.enum) && schema.enum.length) {
|
|
591
|
-
const
|
|
592
|
-
return { ...base, type: "choice", options, default: typeof def === "string" || typeof def === "number" ? def :
|
|
597
|
+
const options2 = schema.enum.filter((v) => typeof v === "string" || typeof v === "number");
|
|
598
|
+
return { ...base, type: "choice", options: options2, default: typeof def === "string" || typeof def === "number" ? def : options2[0], control: options2.length <= 4 ? "segmented" : "select" };
|
|
593
599
|
}
|
|
594
600
|
if (type === "number" || type === "integer") {
|
|
595
601
|
const min = _nullishCoalesce(schema.minimum, () => ( schema.exclusiveMinimum));
|
|
@@ -597,6 +603,13 @@ function effectControlField(name, schema, fallback) {
|
|
|
597
603
|
return { ...base, type: type === "integer" ? "int" : "number", default: typeof def === "number" ? def : _nullishCoalesce(min, () => ( 0)), ...min !== void 0 ? { min } : {}, ...max !== void 0 ? { max } : {}, ...schema.multipleOf ? { step: schema.multipleOf } : {} };
|
|
598
604
|
}
|
|
599
605
|
if (type === "boolean") return { ...base, type: "boolean", default: def === true };
|
|
606
|
+
if (isEffectFontControl(schema)) {
|
|
607
|
+
const fonts = _nullishCoalesce(options.fonts, () => ( _chunkFKUKJ3XAcjs.SYSTEM_FONT_CATALOG));
|
|
608
|
+
const opts = fonts.map((f) => ({ value: f.family, label: f.family, description: f.category }));
|
|
609
|
+
const current = typeof def === "string" && def ? def : _nullishCoalesce(_optionalChain([opts, 'access', _18 => _18[0], 'optionalAccess', _19 => _19.value]), () => ( "sans-serif"));
|
|
610
|
+
if (!opts.some((o) => o.value.toLowerCase() === current.toLowerCase())) opts.unshift({ value: current, label: current, description: "current" });
|
|
611
|
+
return { ...base, type: "choice", options: opts, default: opts.find((o) => o.value.toLowerCase() === current.toLowerCase()).value, control: "select" };
|
|
612
|
+
}
|
|
600
613
|
if (type === "string") {
|
|
601
614
|
if (typeof def === "string" && HEX2.test(def)) return { ...base, type: "color", alpha: def.length === 9, default: def };
|
|
602
615
|
return { ...base, type: "text", default: typeof def === "string" ? def : "", ...schema.maxLength ? { maxLength: schema.maxLength } : {} };
|
|
@@ -607,8 +620,17 @@ function effectControlField(name, schema, fallback) {
|
|
|
607
620
|
}
|
|
608
621
|
return null;
|
|
609
622
|
}
|
|
610
|
-
function effectParameterFields(description) {
|
|
611
|
-
return Object.entries(description.controls.properties).map(([name, schema]) => effectControlField(name, schema, description.defaults[name])).filter((f) => !!f);
|
|
623
|
+
function effectParameterFields(description, options = {}) {
|
|
624
|
+
return Object.entries(description.controls.properties).map(([name, schema]) => effectControlField(name, schema, description.defaults[name], options)).filter((f) => !!f);
|
|
625
|
+
}
|
|
626
|
+
function effectFontFamilies(description, values = {}) {
|
|
627
|
+
const out = [];
|
|
628
|
+
for (const [name, schema] of Object.entries(description.controls.properties)) {
|
|
629
|
+
if (!isEffectFontControl(schema)) continue;
|
|
630
|
+
const v = _nullishCoalesce(_nullishCoalesce(values[name], () => ( description.defaults[name])), () => ( schema.default));
|
|
631
|
+
if (typeof v === "string" && v && !out.includes(v)) out.push(v);
|
|
632
|
+
}
|
|
633
|
+
return out;
|
|
612
634
|
}
|
|
613
635
|
var effectFieldValue = (field, value) => value === void 0 || value === null || typeof value === "object" && !Array.isArray(value) ? field.default : value;
|
|
614
636
|
function effectSamplePicture(width, height, variant = 0) {
|
|
@@ -703,11 +725,11 @@ var EASING_SCHEMA = {
|
|
|
703
725
|
};
|
|
704
726
|
var NO_SESSION = "No effect authoring session is currently open. Open an effect using EffectProvider.openAuthoring() or in an authoring editor before calling effect authoring tools.";
|
|
705
727
|
function createEffectAuthoringToolProvider(host, options) {
|
|
706
|
-
const id = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
707
|
-
const namespace = _optionalChain([options, 'optionalAccess',
|
|
708
|
-
const title = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
709
|
-
const description = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
710
|
-
const skill = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
728
|
+
const id = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _20 => _20.id]), () => ( "effect-authoring"));
|
|
729
|
+
const namespace = _optionalChain([options, 'optionalAccess', _21 => _21.namespace]);
|
|
730
|
+
const title = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _22 => _22.title]), () => ( "Effect authoring"));
|
|
731
|
+
const description = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _23 => _23.description]), () => ( "Author shaders and procedural effects, inspect parameters, adjust values, and manage keyframe animations."));
|
|
732
|
+
const skill = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _24 => _24.skill]), () => ( "pixerate-effect-authoring"));
|
|
711
733
|
const requireSession = () => {
|
|
712
734
|
const s = host.session();
|
|
713
735
|
if (!s) throw new Error(NO_SESSION);
|
|
@@ -728,7 +750,7 @@ function createEffectAuthoringToolProvider(host, options) {
|
|
|
728
750
|
sourceLanguage: state.sourceLanguage,
|
|
729
751
|
controls: effectParameterFields(state.description),
|
|
730
752
|
values: state.values,
|
|
731
|
-
presets: _nullishCoalesce(_optionalChain([state, 'access',
|
|
753
|
+
presets: _nullishCoalesce(_optionalChain([state, 'access', _25 => _25.description, 'access', _26 => _26.presets, 'optionalAccess', _27 => _27.map, 'call', _28 => _28((p) => p.name)]), () => ( [])),
|
|
732
754
|
tracks: Object.entries(state.tracks).map(([control, track]) => ({
|
|
733
755
|
control,
|
|
734
756
|
keyframes: track.length
|
|
@@ -1029,7 +1051,7 @@ function createEffectAuthoringToolProvider(host, options) {
|
|
|
1029
1051
|
const tools = [
|
|
1030
1052
|
describeTool,
|
|
1031
1053
|
getSourceTool,
|
|
1032
|
-
..._optionalChain([session, 'optionalAccess',
|
|
1054
|
+
..._optionalChain([session, 'optionalAccess', _29 => _29.setSource]) ? [setSourceTool] : [],
|
|
1033
1055
|
setValuesTool,
|
|
1034
1056
|
resetValuesTool,
|
|
1035
1057
|
applyPresetTool,
|
|
@@ -1083,4 +1105,6 @@ function createEffectAuthoringToolProvider(host, options) {
|
|
|
1083
1105
|
|
|
1084
1106
|
|
|
1085
1107
|
|
|
1086
|
-
|
|
1108
|
+
|
|
1109
|
+
|
|
1110
|
+
exports.EFFECT_ERROR_CODES = _chunkRUZQMYXHcjs.EFFECT_ERROR_CODES; exports.EFFECT_KINDS = _chunkRUZQMYXHcjs.EFFECT_KINDS; exports.EFFECT_USES = _chunkRUZQMYXHcjs.EFFECT_USES; exports.EFFECT_USE_LABELS = EFFECT_USE_LABELS; exports.EffectControlError = _chunkRUZQMYXHcjs.EffectControlError; exports.EffectDisposedError = _chunkRUZQMYXHcjs.EffectDisposedError; exports.EffectError = _chunkRUZQMYXHcjs.EffectError; exports.EffectRendererPool = _chunkPY4GWSE2cjs.EffectRendererPool; exports.EffectUnsupportedError = _chunkRUZQMYXHcjs.EffectUnsupportedError; exports.EffectsSlot = _chunkRUZQMYXHcjs.EffectsSlot; exports.NoEffectsProviderError = _chunkRUZQMYXHcjs.NoEffectsProviderError; exports.UnknownEffectError = _chunkRUZQMYXHcjs.UnknownEffectError; exports.applyEffectMask = _chunkRUZQMYXHcjs.applyEffectMask; exports.checkEffectProvider = checkEffectProvider; exports.createEffectAuthoringSession = _chunk6DM3PUQDcjs.createEffectAuthoringSession; exports.createEffectAuthoringToolProvider = createEffectAuthoringToolProvider; exports.createEffectPixels = _chunkRUZQMYXHcjs.createEffectPixels; exports.createEffectToolProvider = _chunkRUZQMYXHcjs.createEffectToolProvider; exports.createFakeEffectProvider = createFakeEffectProvider; exports.effectControlField = effectControlField; exports.effectFieldValue = effectFieldValue; exports.effectFontFamilies = effectFontFamilies; exports.effectParameterFields = effectParameterFields; exports.effectSampleInputs = effectSampleInputs; exports.effectSamplePicture = effectSamplePicture; exports.effectValueErrors = _chunkRUZQMYXHcjs.effectValueErrors; exports.encodeEffectFloat = _chunkRUZQMYXHcjs.encodeEffectFloat; exports.groupEffectsByCategory = groupEffectsByCategory; exports.isEffectError = _chunkRUZQMYXHcjs.isEffectError; exports.isEffectFontControl = isEffectFontControl; exports.isEffectPixels = _chunkRUZQMYXHcjs.isEffectPixels; exports.linearToSrgb = _chunkRUZQMYXHcjs.linearToSrgb; exports.renderEffectThumbnail = renderEffectThumbnail; exports.resolveEffectValues = _chunkRUZQMYXHcjs.resolveEffectValues; exports.searchEffectSummaries = _chunkRUZQMYXHcjs.searchEffectSummaries; exports.srgbToLinear = _chunkRUZQMYXHcjs.srgbToLinear;
|
package/dist/effects/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SYSTEM_FONT_CATALOG
|
|
3
|
+
} from "../chunk-CJE5MOIS.js";
|
|
1
4
|
import {
|
|
2
5
|
createEffectAuthoringSession
|
|
3
6
|
} from "../chunk-ZGOHKS3X.js";
|
|
@@ -583,13 +586,16 @@ var EFFECT_USE_LABELS = {
|
|
|
583
586
|
};
|
|
584
587
|
var HEX2 = /^#[0-9a-f]{6}([0-9a-f]{2})?$/i;
|
|
585
588
|
var typeOf = (s) => Array.isArray(s.type) ? s.type.find((t) => t !== "null") : s.type;
|
|
586
|
-
function
|
|
589
|
+
function isEffectFontControl(schema) {
|
|
590
|
+
return typeOf(schema) === "string" && (schema.format === "font" || schema["x-pixerate-control"] === "font");
|
|
591
|
+
}
|
|
592
|
+
function effectControlField(name, schema, fallback, options = {}) {
|
|
587
593
|
const base = { id: name, ...schema.title ? { label: schema.title } : {}, ...schema.description ? { description: schema.description } : {} };
|
|
588
594
|
const def = schema.default ?? fallback;
|
|
589
595
|
const type = typeOf(schema);
|
|
590
596
|
if (Array.isArray(schema.enum) && schema.enum.length) {
|
|
591
|
-
const
|
|
592
|
-
return { ...base, type: "choice", options, default: typeof def === "string" || typeof def === "number" ? def :
|
|
597
|
+
const options2 = schema.enum.filter((v) => typeof v === "string" || typeof v === "number");
|
|
598
|
+
return { ...base, type: "choice", options: options2, default: typeof def === "string" || typeof def === "number" ? def : options2[0], control: options2.length <= 4 ? "segmented" : "select" };
|
|
593
599
|
}
|
|
594
600
|
if (type === "number" || type === "integer") {
|
|
595
601
|
const min = schema.minimum ?? schema.exclusiveMinimum;
|
|
@@ -597,6 +603,13 @@ function effectControlField(name, schema, fallback) {
|
|
|
597
603
|
return { ...base, type: type === "integer" ? "int" : "number", default: typeof def === "number" ? def : min ?? 0, ...min !== void 0 ? { min } : {}, ...max !== void 0 ? { max } : {}, ...schema.multipleOf ? { step: schema.multipleOf } : {} };
|
|
598
604
|
}
|
|
599
605
|
if (type === "boolean") return { ...base, type: "boolean", default: def === true };
|
|
606
|
+
if (isEffectFontControl(schema)) {
|
|
607
|
+
const fonts = options.fonts ?? SYSTEM_FONT_CATALOG;
|
|
608
|
+
const opts = fonts.map((f) => ({ value: f.family, label: f.family, description: f.category }));
|
|
609
|
+
const current = typeof def === "string" && def ? def : opts[0]?.value ?? "sans-serif";
|
|
610
|
+
if (!opts.some((o) => o.value.toLowerCase() === current.toLowerCase())) opts.unshift({ value: current, label: current, description: "current" });
|
|
611
|
+
return { ...base, type: "choice", options: opts, default: opts.find((o) => o.value.toLowerCase() === current.toLowerCase()).value, control: "select" };
|
|
612
|
+
}
|
|
600
613
|
if (type === "string") {
|
|
601
614
|
if (typeof def === "string" && HEX2.test(def)) return { ...base, type: "color", alpha: def.length === 9, default: def };
|
|
602
615
|
return { ...base, type: "text", default: typeof def === "string" ? def : "", ...schema.maxLength ? { maxLength: schema.maxLength } : {} };
|
|
@@ -607,8 +620,17 @@ function effectControlField(name, schema, fallback) {
|
|
|
607
620
|
}
|
|
608
621
|
return null;
|
|
609
622
|
}
|
|
610
|
-
function effectParameterFields(description) {
|
|
611
|
-
return Object.entries(description.controls.properties).map(([name, schema]) => effectControlField(name, schema, description.defaults[name])).filter((f) => !!f);
|
|
623
|
+
function effectParameterFields(description, options = {}) {
|
|
624
|
+
return Object.entries(description.controls.properties).map(([name, schema]) => effectControlField(name, schema, description.defaults[name], options)).filter((f) => !!f);
|
|
625
|
+
}
|
|
626
|
+
function effectFontFamilies(description, values = {}) {
|
|
627
|
+
const out = [];
|
|
628
|
+
for (const [name, schema] of Object.entries(description.controls.properties)) {
|
|
629
|
+
if (!isEffectFontControl(schema)) continue;
|
|
630
|
+
const v = values[name] ?? description.defaults[name] ?? schema.default;
|
|
631
|
+
if (typeof v === "string" && v && !out.includes(v)) out.push(v);
|
|
632
|
+
}
|
|
633
|
+
return out;
|
|
612
634
|
}
|
|
613
635
|
var effectFieldValue = (field, value) => value === void 0 || value === null || typeof value === "object" && !Array.isArray(value) ? field.default : value;
|
|
614
636
|
function effectSamplePicture(width, height, variant = 0) {
|
|
@@ -1070,6 +1092,7 @@ export {
|
|
|
1070
1092
|
createFakeEffectProvider,
|
|
1071
1093
|
effectControlField,
|
|
1072
1094
|
effectFieldValue,
|
|
1095
|
+
effectFontFamilies,
|
|
1073
1096
|
effectParameterFields,
|
|
1074
1097
|
effectSampleInputs,
|
|
1075
1098
|
effectSamplePicture,
|
|
@@ -1077,6 +1100,7 @@ export {
|
|
|
1077
1100
|
encodeEffectFloat,
|
|
1078
1101
|
groupEffectsByCategory,
|
|
1079
1102
|
isEffectError,
|
|
1103
|
+
isEffectFontControl,
|
|
1080
1104
|
isEffectPixels,
|
|
1081
1105
|
linearToSrgb,
|
|
1082
1106
|
renderEffectThumbnail,
|
package/dist/effects/ui.d.cts
CHANGED
|
@@ -5,17 +5,34 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { JsonSchema } from '../tools/schema.cjs';
|
|
7
7
|
import type { ParameterField, ParameterValue } from '../parameters/types.cjs';
|
|
8
|
+
import type { FontSummary } from '../typography/registry.cjs';
|
|
8
9
|
import type { EffectDescription, EffectPixels, EffectProvider, EffectSummary, EffectUse, EffectValue } from './types.cjs';
|
|
9
10
|
/** Names for the uses, for filters and badges. */
|
|
10
11
|
export declare const EFFECT_USE_LABELS: Readonly<Record<EffectUse, string>>;
|
|
12
|
+
/** Options for turning effect controls into fields. */
|
|
13
|
+
export interface EffectFieldOptions {
|
|
14
|
+
/** Families offered by font controls (default: the system font catalog). */
|
|
15
|
+
fonts?: readonly FontSummary[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Whether a control picks a font family: a string schema with `format: "font"` or
|
|
19
|
+
* `"x-pixerate-control": "font"`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isEffectFontControl(schema: JsonSchema): boolean;
|
|
11
22
|
/**
|
|
12
23
|
* One control as a parameter field: numbers and integers (sliders when bounded), switches,
|
|
13
|
-
* choices (`enum`),
|
|
24
|
+
* choices (`enum`), font families (`format: "font"`, a choice of `options.fonts`), colours
|
|
25
|
+
* (strings whose default is `#rrggbb`), vectors (2–4 numbers) and text.
|
|
14
26
|
* `null` for a control no field can edit (objects, long lists).
|
|
15
27
|
*/
|
|
16
|
-
export declare function effectControlField(name: string, schema: JsonSchema, fallback: EffectValue | undefined): ParameterField | null;
|
|
28
|
+
export declare function effectControlField(name: string, schema: JsonSchema, fallback: EffectValue | undefined, options?: EffectFieldOptions): ParameterField | null;
|
|
17
29
|
/** An effect's controls as parameter fields, in schema order (controls no field can edit are left out). */
|
|
18
|
-
export declare function effectParameterFields(description: Pick<EffectDescription, 'controls' | 'defaults'
|
|
30
|
+
export declare function effectParameterFields(description: Pick<EffectDescription, 'controls' | 'defaults'>, options?: EffectFieldOptions): ParameterField[];
|
|
31
|
+
/**
|
|
32
|
+
* The font families an effect's font controls use with these values (falling back to defaults),
|
|
33
|
+
* to load with `ensureFontsLoaded` before rendering a title preview.
|
|
34
|
+
*/
|
|
35
|
+
export declare function effectFontFamilies(description: Pick<EffectDescription, 'controls' | 'defaults'>, values?: Readonly<Record<string, unknown>>): string[];
|
|
19
36
|
/** A saved value as a field shows it (`ParameterValue`), or the field's default. */
|
|
20
37
|
export declare const effectFieldValue: (field: ParameterField, value: unknown) => ParameterValue;
|
|
21
38
|
/**
|
package/dist/effects/ui.d.ts
CHANGED
|
@@ -5,17 +5,34 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { JsonSchema } from '../tools/schema.js';
|
|
7
7
|
import type { ParameterField, ParameterValue } from '../parameters/types.js';
|
|
8
|
+
import type { FontSummary } from '../typography/registry.js';
|
|
8
9
|
import type { EffectDescription, EffectPixels, EffectProvider, EffectSummary, EffectUse, EffectValue } from './types.js';
|
|
9
10
|
/** Names for the uses, for filters and badges. */
|
|
10
11
|
export declare const EFFECT_USE_LABELS: Readonly<Record<EffectUse, string>>;
|
|
12
|
+
/** Options for turning effect controls into fields. */
|
|
13
|
+
export interface EffectFieldOptions {
|
|
14
|
+
/** Families offered by font controls (default: the system font catalog). */
|
|
15
|
+
fonts?: readonly FontSummary[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Whether a control picks a font family: a string schema with `format: "font"` or
|
|
19
|
+
* `"x-pixerate-control": "font"`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isEffectFontControl(schema: JsonSchema): boolean;
|
|
11
22
|
/**
|
|
12
23
|
* One control as a parameter field: numbers and integers (sliders when bounded), switches,
|
|
13
|
-
* choices (`enum`),
|
|
24
|
+
* choices (`enum`), font families (`format: "font"`, a choice of `options.fonts`), colours
|
|
25
|
+
* (strings whose default is `#rrggbb`), vectors (2–4 numbers) and text.
|
|
14
26
|
* `null` for a control no field can edit (objects, long lists).
|
|
15
27
|
*/
|
|
16
|
-
export declare function effectControlField(name: string, schema: JsonSchema, fallback: EffectValue | undefined): ParameterField | null;
|
|
28
|
+
export declare function effectControlField(name: string, schema: JsonSchema, fallback: EffectValue | undefined, options?: EffectFieldOptions): ParameterField | null;
|
|
17
29
|
/** An effect's controls as parameter fields, in schema order (controls no field can edit are left out). */
|
|
18
|
-
export declare function effectParameterFields(description: Pick<EffectDescription, 'controls' | 'defaults'
|
|
30
|
+
export declare function effectParameterFields(description: Pick<EffectDescription, 'controls' | 'defaults'>, options?: EffectFieldOptions): ParameterField[];
|
|
31
|
+
/**
|
|
32
|
+
* The font families an effect's font controls use with these values (falling back to defaults),
|
|
33
|
+
* to load with `ensureFontsLoaded` before rendering a title preview.
|
|
34
|
+
*/
|
|
35
|
+
export declare function effectFontFamilies(description: Pick<EffectDescription, 'controls' | 'defaults'>, values?: Readonly<Record<string, unknown>>): string[];
|
|
19
36
|
/** A saved value as a field shows it (`ParameterValue`), or the field's default. */
|
|
20
37
|
export declare const effectFieldValue: (field: ParameterField, value: unknown) => ParameterValue;
|
|
21
38
|
/**
|