@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
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gradients from sampled colours: `simplifyGradientStops` reduces a noisy run of colours (pixels
|
|
3
|
+
* read along a line from a photo, a paint stroke or a shape) to the few stops that reproduce it
|
|
4
|
+
* within a perceptual tolerance, and `sampleGradientFromLine` reads those colours from any pixel
|
|
5
|
+
* reader and returns a linear gradient.
|
|
6
|
+
*
|
|
7
|
+
* Distances are Euclidean in OKLab (ΔE OK, about 0.02 is a just-noticeable step), against the
|
|
8
|
+
* OKLab interpolation the returned gradients use, so what is measured is what is drawn.
|
|
9
|
+
*/
|
|
10
|
+
import type { Gradient, GradientStop } from './types.cjs';
|
|
11
|
+
export interface SimplifyGradientStopsOptions {
|
|
12
|
+
/** Largest perceptual error left between the samples and the stops, in OKLab ΔE (default 0.06). */
|
|
13
|
+
tolerance?: number;
|
|
14
|
+
/** Fewest stops to return (default 2, at least 2). */
|
|
15
|
+
minStops?: number;
|
|
16
|
+
/** Most stops to return (default 5, at least `minStops`). */
|
|
17
|
+
maxStops?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Samples on each side averaged into each one before fitting, to ignore grain, JPEG noise and
|
|
20
|
+
* brush texture (default 2; 0 fits the raw samples).
|
|
21
|
+
*/
|
|
22
|
+
smoothing?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface RawGradientSample {
|
|
25
|
+
/** Position along the line, 0..1. */
|
|
26
|
+
offset: number;
|
|
27
|
+
/** Any CSS colour, or RGBA bytes `[r, g, b, a]` (0..255). */
|
|
28
|
+
color: string | readonly [number, number, number, number];
|
|
29
|
+
}
|
|
30
|
+
export interface SimplifiedGradientStops {
|
|
31
|
+
stops: GradientStop[];
|
|
32
|
+
/** The largest OKLab distance left between a (smoothed) sample and the stops. */
|
|
33
|
+
maxError: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Like `simplifyGradientStops`, with the largest error left. Throws a sentence when the input
|
|
37
|
+
* can't make a gradient (fewer than two readable samples, or options out of range).
|
|
38
|
+
*/
|
|
39
|
+
export declare function fitGradientStops(samples: readonly RawGradientSample[], options?: SimplifyGradientStopsOptions): SimplifiedGradientStops;
|
|
40
|
+
/**
|
|
41
|
+
* Reduces colours sampled along a line (offsets 0..1) to a minimal set of gradient stops. The
|
|
42
|
+
* first and last stops sit at 0 and 1; stops are added where the colour turns most until every
|
|
43
|
+
* sample is within `tolerance` (OKLab ΔE) of the OKLab blend between its stops, or `maxStops` is
|
|
44
|
+
* reached. Samples that can't be read (a bad colour string) are skipped. Throws when fewer than two
|
|
45
|
+
* samples can be read.
|
|
46
|
+
*/
|
|
47
|
+
export declare function simplifyGradientStops(samples: readonly RawGradientSample[], options?: SimplifyGradientStopsOptions): GradientStop[];
|
|
48
|
+
export interface LineSamplingOptions extends SimplifyGradientStopsOptions {
|
|
49
|
+
/** Colours read along the line, ends included (default 32, 2..1024). */
|
|
50
|
+
sampleCount?: number;
|
|
51
|
+
/** Snap the line's angle to multiples of this many degrees (e.g. 15, for Shift), keeping its length. */
|
|
52
|
+
snapStep?: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Reads colours along the line from `start` to `end` with `readPixel` (which returns a CSS colour,
|
|
56
|
+
* RGBA bytes, or null where there is nothing to read) and returns a linear gradient (OKLab
|
|
57
|
+
* interpolation) whose angle is the line's (CSS degrees) and whose stops are the simplified
|
|
58
|
+
* colours, offsets measured along the line. Returns null when fewer than two points could be read.
|
|
59
|
+
*/
|
|
60
|
+
export declare function sampleGradientFromLine(readPixel: (point: {
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
}) => string | readonly [number, number, number, number] | null, start: {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
}, end: {
|
|
67
|
+
x: number;
|
|
68
|
+
y: number;
|
|
69
|
+
}, options?: LineSamplingOptions): Gradient | null;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gradients from sampled colours: `simplifyGradientStops` reduces a noisy run of colours (pixels
|
|
3
|
+
* read along a line from a photo, a paint stroke or a shape) to the few stops that reproduce it
|
|
4
|
+
* within a perceptual tolerance, and `sampleGradientFromLine` reads those colours from any pixel
|
|
5
|
+
* reader and returns a linear gradient.
|
|
6
|
+
*
|
|
7
|
+
* Distances are Euclidean in OKLab (ΔE OK, about 0.02 is a just-noticeable step), against the
|
|
8
|
+
* OKLab interpolation the returned gradients use, so what is measured is what is drawn.
|
|
9
|
+
*/
|
|
10
|
+
import type { Gradient, GradientStop } from './types.js';
|
|
11
|
+
export interface SimplifyGradientStopsOptions {
|
|
12
|
+
/** Largest perceptual error left between the samples and the stops, in OKLab ΔE (default 0.06). */
|
|
13
|
+
tolerance?: number;
|
|
14
|
+
/** Fewest stops to return (default 2, at least 2). */
|
|
15
|
+
minStops?: number;
|
|
16
|
+
/** Most stops to return (default 5, at least `minStops`). */
|
|
17
|
+
maxStops?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Samples on each side averaged into each one before fitting, to ignore grain, JPEG noise and
|
|
20
|
+
* brush texture (default 2; 0 fits the raw samples).
|
|
21
|
+
*/
|
|
22
|
+
smoothing?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface RawGradientSample {
|
|
25
|
+
/** Position along the line, 0..1. */
|
|
26
|
+
offset: number;
|
|
27
|
+
/** Any CSS colour, or RGBA bytes `[r, g, b, a]` (0..255). */
|
|
28
|
+
color: string | readonly [number, number, number, number];
|
|
29
|
+
}
|
|
30
|
+
export interface SimplifiedGradientStops {
|
|
31
|
+
stops: GradientStop[];
|
|
32
|
+
/** The largest OKLab distance left between a (smoothed) sample and the stops. */
|
|
33
|
+
maxError: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Like `simplifyGradientStops`, with the largest error left. Throws a sentence when the input
|
|
37
|
+
* can't make a gradient (fewer than two readable samples, or options out of range).
|
|
38
|
+
*/
|
|
39
|
+
export declare function fitGradientStops(samples: readonly RawGradientSample[], options?: SimplifyGradientStopsOptions): SimplifiedGradientStops;
|
|
40
|
+
/**
|
|
41
|
+
* Reduces colours sampled along a line (offsets 0..1) to a minimal set of gradient stops. The
|
|
42
|
+
* first and last stops sit at 0 and 1; stops are added where the colour turns most until every
|
|
43
|
+
* sample is within `tolerance` (OKLab ΔE) of the OKLab blend between its stops, or `maxStops` is
|
|
44
|
+
* reached. Samples that can't be read (a bad colour string) are skipped. Throws when fewer than two
|
|
45
|
+
* samples can be read.
|
|
46
|
+
*/
|
|
47
|
+
export declare function simplifyGradientStops(samples: readonly RawGradientSample[], options?: SimplifyGradientStopsOptions): GradientStop[];
|
|
48
|
+
export interface LineSamplingOptions extends SimplifyGradientStopsOptions {
|
|
49
|
+
/** Colours read along the line, ends included (default 32, 2..1024). */
|
|
50
|
+
sampleCount?: number;
|
|
51
|
+
/** Snap the line's angle to multiples of this many degrees (e.g. 15, for Shift), keeping its length. */
|
|
52
|
+
snapStep?: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Reads colours along the line from `start` to `end` with `readPixel` (which returns a CSS colour,
|
|
56
|
+
* RGBA bytes, or null where there is nothing to read) and returns a linear gradient (OKLab
|
|
57
|
+
* interpolation) whose angle is the line's (CSS degrees) and whose stops are the simplified
|
|
58
|
+
* colours, offsets measured along the line. Returns null when fewer than two points could be read.
|
|
59
|
+
*/
|
|
60
|
+
export declare function sampleGradientFromLine(readPixel: (point: {
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
}) => string | readonly [number, number, number, number] | null, start: {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
}, end: {
|
|
67
|
+
x: number;
|
|
68
|
+
y: number;
|
|
69
|
+
}, options?: LineSamplingOptions): Gradient | null;
|