@pixerate/editor 0.266.2 → 0.267.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 +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/animation-editor/controller.d.cts +8 -0
- package/dist/animation-editor/controller.d.ts +8 -0
- package/dist/animation-editor/effect-tools.d.cts +1 -1
- package/dist/animation-editor/effect-tools.d.ts +1 -1
- package/dist/animation-editor/index.cjs +172 -105
- package/dist/animation-editor/index.js +91 -24
- package/dist/brushes/index.cjs +59 -59
- package/dist/brushes/index.js +5 -5
- package/dist/brushes/profiles.d.cts +6 -1
- package/dist/brushes/profiles.d.ts +6 -1
- package/dist/{brushstrokeRender-FSUWXUZY.cjs → brushstrokeRender-L7JYRR2R.cjs} +16 -16
- package/dist/{brushstrokeRender-KD453OBX.js → brushstrokeRender-NLFPEBGI.js} +4 -4
- package/dist/canvas/brushTypes.d.cts +12 -0
- package/dist/canvas/brushTypes.d.ts +12 -0
- package/dist/canvas/brushstroke.d.cts +1 -1
- package/dist/canvas/brushstroke.d.ts +1 -1
- package/dist/canvas/drawController.d.cts +19 -4
- package/dist/canvas/drawController.d.ts +19 -4
- package/dist/canvas/index.cjs +144 -105
- package/dist/canvas/index.js +46 -7
- package/dist/{chunk-XORJ7UZO.cjs → chunk-3VHH6V67.cjs} +13 -12
- package/dist/{chunk-T2LDTEXK.js → chunk-4IDUYB45.js} +2217 -56
- package/dist/chunk-7UKFXXWL.js +802 -0
- package/dist/chunk-ADMRNWR7.js +340 -0
- package/dist/{chunk-CIJBSUM5.js → chunk-AGNUD5BI.js} +2 -2
- package/dist/{chunk-WLUVZKVD.cjs → chunk-DT4YQUGT.cjs} +32 -32
- package/dist/{chunk-DXYHQ2VN.js → chunk-EF7LZAXQ.js} +1 -1
- package/dist/chunk-EXB2EGBE.cjs +802 -0
- package/dist/{chunk-4ODRXQRW.js → chunk-EYSHTYLG.js} +1 -1
- package/dist/{chunk-R44Y3EFS.js → chunk-FGJHJIMN.js} +8 -336
- package/dist/{chunk-AQZQWXEU.cjs → chunk-G7NHE2VD.cjs} +35 -35
- package/dist/{chunk-XC6DPRYI.js → chunk-GSTSZPSR.js} +154 -949
- package/dist/{chunk-VRK322ZC.cjs → chunk-HIO6E7LC.cjs} +2 -2
- package/dist/{chunk-TOID45I2.cjs → chunk-J2TNIZ55.cjs} +1 -1
- package/dist/{chunk-YHDHFJUC.cjs → chunk-J5VQYK7T.cjs} +217 -1012
- package/dist/{chunk-3C33YTNN.js → chunk-JGWVZPT6.js} +2 -2
- package/dist/{chunk-ACFSFUQH.js → chunk-JL6YH5WD.js} +4 -0
- package/dist/{chunk-3SBLVGOM.cjs → chunk-LA5Y4ETA.cjs} +23 -23
- package/dist/{chunk-MVUQSK5J.cjs → chunk-LHPEG5AU.cjs} +107 -435
- package/dist/{chunk-DOZ6F2K2.js → chunk-NSETJI74.js} +3 -2
- package/dist/{chunk-XRXFVRGY.cjs → chunk-OKHKA43L.cjs} +2364 -203
- package/dist/{chunk-LK4SXL3V.js → chunk-OSEXT7JL.js} +1 -1
- package/dist/{chunk-PE6YJMQT.cjs → chunk-PFHJS4HE.cjs} +20 -19
- package/dist/{chunk-7KNW3WXZ.cjs → chunk-QEVLRLUN.cjs} +63 -0
- package/dist/{chunk-OTN6VB5S.cjs → chunk-RDFHWAHL.cjs} +5 -1
- package/dist/{chunk-6JL2D5SG.js → chunk-VE6UKYQ2.js} +3 -2
- package/dist/{chunk-RFJZGTHA.cjs → chunk-XVOP3CGQ.cjs} +9 -9
- package/dist/{chunk-EZOJBP4D.js → chunk-YIC6MAJ2.js} +1 -1
- package/dist/chunk-YZWM6ZIP.cjs +340 -0
- package/dist/{chunk-472INMWH.js → chunk-ZA7L5YJB.js} +63 -0
- package/dist/commands/builtins.d.cts +12 -1
- package/dist/commands/builtins.d.ts +12 -1
- package/dist/commands/index.cjs +2 -2
- package/dist/commands/index.js +1 -1
- package/dist/image-editor/controller.d.cts +1 -1
- package/dist/image-editor/controller.d.ts +1 -1
- package/dist/image-editor/index.cjs +837 -833
- package/dist/image-editor/index.js +105 -101
- package/dist/paint/index.cjs +5 -3
- package/dist/paint/index.js +46 -44
- package/dist/paint-editor/controller.d.cts +5 -3
- package/dist/paint-editor/controller.d.ts +5 -3
- package/dist/paint-editor/index.cjs +832 -2295
- package/dist/paint-editor/index.js +285 -1748
- package/dist/paint-editor/path-samples.d.cts +2 -0
- package/dist/paint-editor/path-samples.d.ts +2 -0
- package/dist/paint-editor/presence.d.cts +20 -1
- package/dist/paint-editor/presence.d.ts +20 -1
- package/dist/stickers/helpers.d.cts +2 -0
- package/dist/stickers/helpers.d.ts +2 -0
- package/dist/stickers/index.cjs +41 -35
- package/dist/stickers/index.js +22 -16
- package/dist/stickers/types.d.cts +4 -2
- package/dist/stickers/types.d.ts +4 -2
- package/dist/vector/backdrop.d.cts +13 -0
- package/dist/vector/backdrop.d.ts +13 -0
- package/dist/vector/brushstroke.d.cts +54 -7
- package/dist/vector/brushstroke.d.ts +54 -7
- package/dist/vector/brushstrokeMedia.d.cts +96 -0
- package/dist/vector/brushstrokeMedia.d.ts +96 -0
- package/dist/vector/controller.d.cts +17 -3
- package/dist/vector/controller.d.ts +17 -3
- package/dist/vector/index.cjs +1846 -1386
- package/dist/vector/index.d.cts +2 -0
- package/dist/vector/index.d.ts +2 -0
- package/dist/vector/index.js +517 -57
- package/dist/vector/render.d.cts +6 -0
- package/dist/vector/render.d.ts +6 -0
- package/dist/vector/types.d.cts +14 -0
- package/dist/vector/types.d.ts +14 -0
- package/package.json +1 -1
- package/skills/pixerate-animation-editor/SKILL.md +1 -0
- package/skills/pixerate-brushes/SKILL.md +2 -2
- package/skills/pixerate-brushes-design/SKILL.md +7 -4
- package/skills/pixerate-brushes-design/evals/port-to-vector.json +8 -8
- package/skills/pixerate-canvas/SKILL.md +11 -1
- package/skills/pixerate-image-editor/SKILL.md +19 -64
- package/skills/pixerate-image-editor/references/color-management.md +2 -1
- package/skills/pixerate-image-editor/references/free-transform.md +12 -0
- package/skills/pixerate-image-editor/references/layer-effects.md +10 -0
- package/skills/pixerate-image-editor/references/painting.md +17 -0
- package/skills/pixerate-image-editor/references/photoshop-files.md +1 -1
- package/skills/pixerate-image-editor/references/shapes-and-type.md +14 -0
- package/skills/pixerate-image-editor/references/smart-objects.md +10 -0
- package/skills/pixerate-paint-editor/SKILL.md +8 -4
- package/skills/pixerate-paint-editor/references/wet-media.md +9 -0
- package/skills/pixerate-vector/SKILL.md +16 -6
- package/skills/pixerate-vector/references/best-practices.md +1 -0
- package/skills/pixerate-vector/references/commands.md +19 -0
|
@@ -11,6 +11,8 @@ export interface PathSampleOptions {
|
|
|
11
11
|
spacing?: number;
|
|
12
12
|
/** Pressure along each subpath, spread evenly from its start to its end (default full pressure). */
|
|
13
13
|
pressure?: readonly number[];
|
|
14
|
+
/** Drawing speed in document pixels per millisecond; when set, gives each sample a time `t` in ms along its subpath. */
|
|
15
|
+
speed?: number;
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* Samples SVG path data (document pixels) into pen points, one array per subpath. Closed
|
|
@@ -11,6 +11,8 @@ export interface PathSampleOptions {
|
|
|
11
11
|
spacing?: number;
|
|
12
12
|
/** Pressure along each subpath, spread evenly from its start to its end (default full pressure). */
|
|
13
13
|
pressure?: readonly number[];
|
|
14
|
+
/** Drawing speed in document pixels per millisecond; when set, gives each sample a time `t` in ms along its subpath. */
|
|
15
|
+
speed?: number;
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* Samples SVG path data (document pixels) into pen points, one array per subpath. Closed
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { PresenceStore, type PresenceActor, type PresenceActorInfo, type PresenceClock, type PresenceState } from '../animation/presence.cjs';
|
|
2
|
+
import type { MixerLoad } from '../paint/mixer.cjs';
|
|
2
3
|
import type { RasterRect } from '../raster/surface.cjs';
|
|
3
|
-
import type
|
|
4
|
+
import { type FillLayerOptions, type PaintEditorController, type PaintStrokeInit, type ReplayOptions } from './controller.cjs';
|
|
4
5
|
import type { PenPoint } from './engine.cjs';
|
|
5
6
|
export type PaintPresenceActor = PresenceActor;
|
|
6
7
|
export type PaintPresenceState = PresenceState;
|
|
7
8
|
/** Cursor positions (document pixels) and notes of agents painting, for an overlay. */
|
|
8
9
|
export declare class PaintPresence extends PresenceStore {
|
|
9
10
|
}
|
|
11
|
+
/** Result of painting several strokes as one undo step (e.g. a path's subpaths). */
|
|
12
|
+
export interface PaintStrokesResult {
|
|
13
|
+
layerId: string;
|
|
14
|
+
bounds: RasterRect | null;
|
|
15
|
+
dabs: number;
|
|
16
|
+
strokeIds: string[];
|
|
17
|
+
mixerLoad?: MixerLoad;
|
|
18
|
+
wet?: boolean;
|
|
19
|
+
}
|
|
10
20
|
/** What an agent asks for. Each command that paints commits as one undo step. */
|
|
11
21
|
export type PaintAgentCommand = {
|
|
12
22
|
kind: 'stroke';
|
|
@@ -14,6 +24,13 @@ export type PaintAgentCommand = {
|
|
|
14
24
|
points: readonly PenPoint[];
|
|
15
25
|
};
|
|
16
26
|
note?: string;
|
|
27
|
+
} | {
|
|
28
|
+
kind: 'strokes';
|
|
29
|
+
strokes: ReadonlyArray<PaintStrokeInit & {
|
|
30
|
+
points: readonly PenPoint[];
|
|
31
|
+
}>;
|
|
32
|
+
label?: string;
|
|
33
|
+
note?: string;
|
|
17
34
|
} | {
|
|
18
35
|
kind: 'fill';
|
|
19
36
|
fill: FillLayerOptions;
|
|
@@ -85,4 +102,6 @@ export declare class PaintDirector {
|
|
|
85
102
|
private performOne;
|
|
86
103
|
/** Paints a stroke live: begins it, pushes its points frame by frame as the cursor reaches them, then ends it (one undo step). */
|
|
87
104
|
private stroke;
|
|
105
|
+
/** Paints several strokes live in turn and commits them as one undo step (e.g. a path's subpaths). */
|
|
106
|
+
private strokes;
|
|
88
107
|
}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { PresenceStore, type PresenceActor, type PresenceActorInfo, type PresenceClock, type PresenceState } from '../animation/presence.js';
|
|
2
|
+
import type { MixerLoad } from '../paint/mixer.js';
|
|
2
3
|
import type { RasterRect } from '../raster/surface.js';
|
|
3
|
-
import type
|
|
4
|
+
import { type FillLayerOptions, type PaintEditorController, type PaintStrokeInit, type ReplayOptions } from './controller.js';
|
|
4
5
|
import type { PenPoint } from './engine.js';
|
|
5
6
|
export type PaintPresenceActor = PresenceActor;
|
|
6
7
|
export type PaintPresenceState = PresenceState;
|
|
7
8
|
/** Cursor positions (document pixels) and notes of agents painting, for an overlay. */
|
|
8
9
|
export declare class PaintPresence extends PresenceStore {
|
|
9
10
|
}
|
|
11
|
+
/** Result of painting several strokes as one undo step (e.g. a path's subpaths). */
|
|
12
|
+
export interface PaintStrokesResult {
|
|
13
|
+
layerId: string;
|
|
14
|
+
bounds: RasterRect | null;
|
|
15
|
+
dabs: number;
|
|
16
|
+
strokeIds: string[];
|
|
17
|
+
mixerLoad?: MixerLoad;
|
|
18
|
+
wet?: boolean;
|
|
19
|
+
}
|
|
10
20
|
/** What an agent asks for. Each command that paints commits as one undo step. */
|
|
11
21
|
export type PaintAgentCommand = {
|
|
12
22
|
kind: 'stroke';
|
|
@@ -14,6 +24,13 @@ export type PaintAgentCommand = {
|
|
|
14
24
|
points: readonly PenPoint[];
|
|
15
25
|
};
|
|
16
26
|
note?: string;
|
|
27
|
+
} | {
|
|
28
|
+
kind: 'strokes';
|
|
29
|
+
strokes: ReadonlyArray<PaintStrokeInit & {
|
|
30
|
+
points: readonly PenPoint[];
|
|
31
|
+
}>;
|
|
32
|
+
label?: string;
|
|
33
|
+
note?: string;
|
|
17
34
|
} | {
|
|
18
35
|
kind: 'fill';
|
|
19
36
|
fill: FillLayerOptions;
|
|
@@ -85,4 +102,6 @@ export declare class PaintDirector {
|
|
|
85
102
|
private performOne;
|
|
86
103
|
/** Paints a stroke live: begins it, pushes its points frame by frame as the cursor reaches them, then ends it (one undo step). */
|
|
87
104
|
private stroke;
|
|
105
|
+
/** Paints several strokes live in turn and commits them as one undo step (e.g. a path's subpaths). */
|
|
106
|
+
private strokes;
|
|
88
107
|
}
|
|
@@ -31,6 +31,8 @@ export declare function stickerCollections(items: readonly StickerSummary[], nam
|
|
|
31
31
|
name: string;
|
|
32
32
|
description?: string;
|
|
33
33
|
}>): StickerCollection[];
|
|
34
|
+
/** Calls `provider.collections()` or `provider.listCollections()` when the provider defines either. */
|
|
35
|
+
export declare function providerCollections(provider: StickerProvider): ReturnType<NonNullable<StickerProvider['collections']>> | undefined;
|
|
34
36
|
/** A ref split into provider and id. A bare editor stamp (`"star"`) is `editor:star`; any other bare id is refused. */
|
|
35
37
|
export declare function parseStickerRef(ref: StickerRef): {
|
|
36
38
|
provider: string;
|
|
@@ -31,6 +31,8 @@ export declare function stickerCollections(items: readonly StickerSummary[], nam
|
|
|
31
31
|
name: string;
|
|
32
32
|
description?: string;
|
|
33
33
|
}>): StickerCollection[];
|
|
34
|
+
/** Calls `provider.collections()` or `provider.listCollections()` when the provider defines either. */
|
|
35
|
+
export declare function providerCollections(provider: StickerProvider): ReturnType<NonNullable<StickerProvider['collections']>> | undefined;
|
|
34
36
|
/** A ref split into provider and id. A bare editor stamp (`"star"`) is `editor:star`; any other bare id is refused. */
|
|
35
37
|
export declare function parseStickerRef(ref: StickerRef): {
|
|
36
38
|
provider: string;
|
package/dist/stickers/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk3VHH6V67cjs = require('../chunk-3VHH6V67.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ var _chunkXORJ7UZOcjs = require('../chunk-XORJ7UZO.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkPFHJS4HEcjs = require('../chunk-PFHJS4HE.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -32,7 +32,8 @@ var _chunkPE6YJMQTcjs = require('../chunk-PE6YJMQT.cjs');
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
var _chunkRDFHWAHLcjs = require('../chunk-RDFHWAHL.cjs');
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
var _chunkU67EN7GGcjs = require('../chunk-U67EN7GG.cjs');
|
|
@@ -114,21 +115,23 @@ function createFakeStickerProvider(options = {}) {
|
|
|
114
115
|
name: "Fake stickers",
|
|
115
116
|
version: "1",
|
|
116
117
|
capabilities: { supportsSearch: true, supportsSvg: true, supportsRaster: true, maxSize: 512 },
|
|
117
|
-
list: (o) =>
|
|
118
|
-
search: (q, o) =>
|
|
118
|
+
list: (o) => _chunkRDFHWAHLcjs.stickerPage.call(void 0, summaries, o),
|
|
119
|
+
search: (q, o) => _chunkRDFHWAHLcjs.stickerPage.call(void 0, summaries, o, q),
|
|
119
120
|
describe(id) {
|
|
120
121
|
const s = find(id);
|
|
121
122
|
if (!s) return void 0;
|
|
122
123
|
return { ...summaryOf(s), silhouette: s.shape === "badge" ? "M60 6A54 54 0 1 1 59.9 6Z" : "M10 10H110V110H10Z", colours: s.shape === "badge" ? [s.colours[0]] : [...s.colours] };
|
|
123
124
|
},
|
|
124
|
-
|
|
125
|
+
collections: () => _chunkRDFHWAHLcjs.stickerCollections.call(void 0, summaries, COLLECTIONS),
|
|
126
|
+
listCollections: () => _chunkRDFHWAHLcjs.stickerCollections.call(void 0, summaries, COLLECTIONS),
|
|
127
|
+
// the older name, kept for callers that use it
|
|
125
128
|
categories: () => [...new Set(CATALOGUE.map((s) => s.category))].map((c) => ({ id: c, name: c, count: CATALOGUE.filter((s) => s.category === c).length })),
|
|
126
129
|
async load(id, o = {}) {
|
|
127
130
|
if (options.loadDelayMs) await new Promise((r) => setTimeout(r, options.loadDelayMs));
|
|
128
131
|
const s = find(id);
|
|
129
132
|
if (!s) throw new (0, _chunkU67EN7GGcjs.StickerError)("unknown_sticker", `No fake sticker "${id}".`);
|
|
130
133
|
if (_optionalChain([options, 'access', _ => _.failIds, 'optionalAccess', _2 => _2.includes, 'call', _3 => _3(id)])) throw new (0, _chunkU67EN7GGcjs.StickerError)("load_failed", `The fake sticker "${id}" failed to load (failIds).`);
|
|
131
|
-
const variant =
|
|
134
|
+
const variant = _chunkRDFHWAHLcjs.checkStickerVariant.call(void 0, summaryOf(s), o.variant);
|
|
132
135
|
const fill = s.shape === "badge" && o.colour ? o.colour.toLowerCase() : s.colours[0];
|
|
133
136
|
if (o.format === "png") {
|
|
134
137
|
const size = _nullishCoalesce(o.size, () => ( 128));
|
|
@@ -147,22 +150,22 @@ function combineStickerProviders(providers, options = {}) {
|
|
|
147
150
|
if (dup) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `Two sticker providers have the id "${dup}"; give each a unique id.`);
|
|
148
151
|
const byId = new Map(providers.map((p) => [p.id, p]));
|
|
149
152
|
const owner = (ref) => {
|
|
150
|
-
const { provider, id } =
|
|
153
|
+
const { provider, id } = _chunkRDFHWAHLcjs.parseStickerRef.call(void 0, ref);
|
|
151
154
|
const p = byId.get(provider);
|
|
152
155
|
if (!p) throw new (0, _chunkU67EN7GGcjs.StickerError)("unknown_provider", `No sticker provider "${provider}"; the providers are ${ids.join(", ") || "none"}.`);
|
|
153
156
|
return { p, id };
|
|
154
157
|
};
|
|
155
158
|
const collectionOf = (p, c) => p.namespaced ? c : `${p.id}:${c}`;
|
|
156
|
-
const prefix = (p, s) => ({ ...s, id:
|
|
159
|
+
const prefix = (p, s) => ({ ...s, id: _chunkRDFHWAHLcjs.stickerRefOf.call(void 0, p, s.id), ...s.collection ? { collection: collectionOf(p, s.collection) } : {} });
|
|
157
160
|
const collectionOwner = (c) => {
|
|
158
161
|
const i = c.indexOf(":");
|
|
159
162
|
const p = i > 0 ? byId.get(c.slice(0, i)) : void 0;
|
|
160
|
-
if (!p) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `No collection "${c}"; collections here are "provider:collection" (
|
|
163
|
+
if (!p) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `No collection "${c}"; collections here are "provider:collection" (collections() lists them).`);
|
|
161
164
|
return { p, collection: p.namespaced ? c : c.slice(i + 1) };
|
|
162
165
|
};
|
|
163
166
|
const page = async (query, o = {}) => {
|
|
164
|
-
const { after, limit =
|
|
165
|
-
|
|
167
|
+
const { after, limit = _chunkRDFHWAHLcjs.DEFAULT_STICKER_PAGE, collection, ...filters } = o;
|
|
168
|
+
_chunkRDFHWAHLcjs.checkStickerSearchOptions.call(void 0, { limit });
|
|
166
169
|
const only = collection !== void 0 ? collectionOwner(collection) : null;
|
|
167
170
|
let i = 0;
|
|
168
171
|
let inner;
|
|
@@ -196,6 +199,11 @@ function combineStickerProviders(providers, options = {}) {
|
|
|
196
199
|
if (!next && items.length >= limit && i < providers.length) next = `${i}|`;
|
|
197
200
|
return { items, total, ...next ? { next } : {} };
|
|
198
201
|
};
|
|
202
|
+
const collections = async () => {
|
|
203
|
+
const out = [];
|
|
204
|
+
for (const p of providers) for (const c of await _asyncNullishCoalesce(await _chunkRDFHWAHLcjs.providerCollections.call(void 0, p), async () => ( []))) out.push({ ...c, id: collectionOf(p, c.id) });
|
|
205
|
+
return out;
|
|
206
|
+
};
|
|
199
207
|
return {
|
|
200
208
|
id: _nullishCoalesce(options.id, () => ( "stickers")),
|
|
201
209
|
name: _nullishCoalesce(options.name, () => ( providers.map((p) => p.name).join(" + "))),
|
|
@@ -232,11 +240,8 @@ function combineStickerProviders(providers, options = {}) {
|
|
|
232
240
|
}
|
|
233
241
|
return [...counts.values()];
|
|
234
242
|
},
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
for (const p of providers) for (const c of await _asyncNullishCoalesce(await _optionalChain([p, 'access', _8 => _8.listCollections, 'optionalCall', _9 => _9()]), async () => ( []))) out.push({ ...c, id: collectionOf(p, c.id) });
|
|
238
|
-
return out;
|
|
239
|
-
}
|
|
243
|
+
collections,
|
|
244
|
+
listCollections: collections
|
|
240
245
|
};
|
|
241
246
|
}
|
|
242
247
|
|
|
@@ -250,10 +255,10 @@ function checkSummary(s, provider, issues) {
|
|
|
250
255
|
if (typeof s.category !== "string" || !s.category) at("category is missing");
|
|
251
256
|
if (!(s.width > 0 && s.height > 0)) at(`width and height must be positive, got ${s.width} \xD7 ${s.height}`);
|
|
252
257
|
if (!Array.isArray(s.formats) || !s.formats.length || s.formats.some((f) => f !== "svg" && f !== "png")) at("formats must list svg and / or png");
|
|
253
|
-
if (_optionalChain([s, 'access',
|
|
254
|
-
if (_optionalChain([s, 'access',
|
|
258
|
+
if (_optionalChain([s, 'access', _8 => _8.formats, 'optionalAccess', _9 => _9.includes, 'call', _10 => _10("svg")]) && !provider.capabilities.supportsSvg) at("lists svg but capabilities.supportsSvg is false");
|
|
259
|
+
if (_optionalChain([s, 'access', _11 => _11.formats, 'optionalAccess', _12 => _12.includes, 'call', _13 => _13("png")]) && !provider.capabilities.supportsRaster) at("lists png but capabilities.supportsRaster is false");
|
|
255
260
|
if (!s.licence || typeof s.licence.name !== "string" || !s.licence.name) at("licence.name is missing (every sticker says how it may be used)");
|
|
256
|
-
if (typeof _optionalChain([s, 'access',
|
|
261
|
+
if (typeof _optionalChain([s, 'access', _14 => _14.licence, 'optionalAccess', _15 => _15.commercial]) !== "boolean") at("licence.commercial is not a boolean");
|
|
257
262
|
if (typeof s.tintable !== "boolean") at("tintable is not a boolean");
|
|
258
263
|
if (s.thumbnail !== void 0 && !/^(data:|https:)/.test(s.thumbnail)) at("thumbnail must be a data: or https: URL");
|
|
259
264
|
if (s.aiGenerated !== void 0 && typeof s.aiGenerated !== "boolean") at("aiGenerated must be a boolean when present");
|
|
@@ -263,7 +268,7 @@ function checkSummary(s, provider, issues) {
|
|
|
263
268
|
else if (!v.includes("light")) at("variants must include light (every sticker has its light art)");
|
|
264
269
|
}
|
|
265
270
|
if (s.collection !== void 0 && (typeof s.collection !== "string" || !s.collection)) at("collection must be a non-empty string when present");
|
|
266
|
-
if (s.collection !== void 0 && !provider.listCollections) at(`is in collection "${s.collection}" but the provider has no
|
|
271
|
+
if (s.collection !== void 0 && !provider.collections && !provider.listCollections) at(`is in collection "${s.collection}" but the provider has no collections()`);
|
|
267
272
|
}
|
|
268
273
|
async function checkStickerProvider(provider, options = {}) {
|
|
269
274
|
const issues = [];
|
|
@@ -272,8 +277,8 @@ async function checkStickerProvider(provider, options = {}) {
|
|
|
272
277
|
else if (provider.id.includes(":")) top('provider id contains ":"');
|
|
273
278
|
if (typeof provider.name !== "string" || !provider.name) top("provider has no name");
|
|
274
279
|
const caps = provider.capabilities;
|
|
275
|
-
for (const k of ["supportsSearch", "supportsSvg", "supportsRaster"]) if (typeof _optionalChain([caps, 'optionalAccess',
|
|
276
|
-
if (_optionalChain([caps, 'optionalAccess',
|
|
280
|
+
for (const k of ["supportsSearch", "supportsSvg", "supportsRaster"]) if (typeof _optionalChain([caps, 'optionalAccess', _16 => _16[k]]) !== "boolean") top(`capabilities.${k} is not a boolean`);
|
|
281
|
+
if (_optionalChain([caps, 'optionalAccess', _17 => _17.maxSize]) !== void 0 && !(caps.maxSize > 0)) top("capabilities.maxSize must be positive");
|
|
277
282
|
const all = [];
|
|
278
283
|
const ids = /* @__PURE__ */ new Set();
|
|
279
284
|
let after;
|
|
@@ -286,7 +291,7 @@ async function checkStickerProvider(provider, options = {}) {
|
|
|
286
291
|
top(`list() rejected: ${e.message}`);
|
|
287
292
|
break;
|
|
288
293
|
}
|
|
289
|
-
if (!Array.isArray(_optionalChain([page, 'optionalAccess',
|
|
294
|
+
if (!Array.isArray(_optionalChain([page, 'optionalAccess', _18 => _18.items])) || typeof page.total !== "number") {
|
|
290
295
|
top("list() did not return { items, total }");
|
|
291
296
|
break;
|
|
292
297
|
}
|
|
@@ -319,27 +324,27 @@ async function checkStickerProvider(provider, options = {}) {
|
|
|
319
324
|
const d = await provider.describe(first.id);
|
|
320
325
|
if (!d) top(`describe("${first.id}") returned nothing for a listed sticker`);
|
|
321
326
|
else if (d.id !== first.id) top(`describe("${first.id}") returned id "${d.id}"`);
|
|
322
|
-
if (_optionalChain([d, 'optionalAccess',
|
|
327
|
+
if (_optionalChain([d, 'optionalAccess', _19 => _19.colours, 'optionalAccess', _20 => _20.some, 'call', _21 => _21((c) => !HEX.test(c))])) top(`describe("${first.id}").colours must be #rrggbb`);
|
|
323
328
|
}
|
|
324
329
|
if (await provider.describe("__no_such_sticker__") !== void 0) top("describe of an unknown id returned a sticker");
|
|
325
|
-
if (provider.listCollections) {
|
|
330
|
+
if (provider.collections || provider.listCollections) {
|
|
326
331
|
try {
|
|
327
|
-
const collections = await
|
|
332
|
+
const collections = await _asyncNullishCoalesce(await _chunkRDFHWAHLcjs.providerCollections.call(void 0, provider), async () => ( []));
|
|
328
333
|
const known = /* @__PURE__ */ new Set();
|
|
329
334
|
for (const c of collections) {
|
|
330
|
-
if (typeof _optionalChain([c, 'optionalAccess',
|
|
331
|
-
top(`
|
|
335
|
+
if (typeof _optionalChain([c, 'optionalAccess', _22 => _22.id]) !== "string" || !c.id || typeof c.name !== "string" || !c.name || !(Number.isInteger(c.count) && c.count >= 0)) {
|
|
336
|
+
top(`collections() returned ${JSON.stringify(c)}; each needs id, name and a count`);
|
|
332
337
|
continue;
|
|
333
338
|
}
|
|
334
|
-
if (known.has(c.id)) top(`
|
|
339
|
+
if (known.has(c.id)) top(`collections() lists "${c.id}" twice`);
|
|
335
340
|
known.add(c.id);
|
|
336
341
|
const page = await provider.list({ collection: c.id, limit: 100 });
|
|
337
342
|
if (page.total !== c.count) top(`collection "${c.id}" says count ${c.count} but list({ collection }) has ${page.total}`);
|
|
338
343
|
if (page.items.some((x) => x.collection !== c.id)) top(`list({ collection: "${c.id}" }) returned stickers of other collections`);
|
|
339
344
|
}
|
|
340
|
-
for (const x of all) if (x.collection !== void 0 && !known.has(x.collection)) issues.push({ stickerId: x.id, message: `collection "${x.collection}" is not in
|
|
345
|
+
for (const x of all) if (x.collection !== void 0 && !known.has(x.collection)) issues.push({ stickerId: x.id, message: `collection "${x.collection}" is not in collections()` });
|
|
341
346
|
} catch (e) {
|
|
342
|
-
top(`
|
|
347
|
+
top(`collections() rejected: ${e.message}`);
|
|
343
348
|
}
|
|
344
349
|
}
|
|
345
350
|
let rejected = false;
|
|
@@ -360,7 +365,7 @@ async function checkStickerProvider(provider, options = {}) {
|
|
|
360
365
|
}
|
|
361
366
|
}
|
|
362
367
|
}
|
|
363
|
-
const dark = all.find((s) => _optionalChain([s, 'access',
|
|
368
|
+
const dark = all.find((s) => _optionalChain([s, 'access', _23 => _23.variants, 'optionalAccess', _24 => _24.includes, 'call', _25 => _25("dark")]));
|
|
364
369
|
if (dark) {
|
|
365
370
|
try {
|
|
366
371
|
await provider.load(dark.id, { format: dark.formats[0], variant: "dark", size: 32 });
|
|
@@ -368,7 +373,7 @@ async function checkStickerProvider(provider, options = {}) {
|
|
|
368
373
|
issues.push({ stickerId: dark.id, message: `load({ variant: "dark" }) rejected for a sticker that lists it: ${e.message}` });
|
|
369
374
|
}
|
|
370
375
|
}
|
|
371
|
-
const lightOnly = all.find((s) => !_optionalChain([s, 'access',
|
|
376
|
+
const lightOnly = all.find((s) => !_optionalChain([s, 'access', _26 => _26.variants, 'optionalAccess', _27 => _27.includes, 'call', _28 => _28("dark")]));
|
|
372
377
|
if (lightOnly) {
|
|
373
378
|
let refused = false;
|
|
374
379
|
try {
|
|
@@ -423,4 +428,5 @@ async function checkStickerProvider(provider, options = {}) {
|
|
|
423
428
|
|
|
424
429
|
|
|
425
430
|
|
|
426
|
-
|
|
431
|
+
|
|
432
|
+
exports.DEFAULT_STICKER_PAGE = _chunkRDFHWAHLcjs.DEFAULT_STICKER_PAGE; exports.EDITOR_STICKERS_ID = _chunkRDFHWAHLcjs.EDITOR_STICKERS_ID; exports.MAX_STICKER_PAGE = _chunkRDFHWAHLcjs.MAX_STICKER_PAGE; exports.STAMP_KINDS = _chunkRDFHWAHLcjs.STAMP_KINDS; exports.STICKER_VARIANTS = _chunkRDFHWAHLcjs.STICKER_VARIANTS; exports.StickerBrowser = _chunk3VHH6V67cjs.StickerBrowser; exports.StickerError = _chunkU67EN7GGcjs.StickerError; exports.StickersSlot = _chunkRDFHWAHLcjs.StickersSlot; exports.checkStickerProvider = checkStickerProvider; exports.checkStickerSearchOptions = _chunkRDFHWAHLcjs.checkStickerSearchOptions; exports.checkStickerVariant = _chunkRDFHWAHLcjs.checkStickerVariant; exports.closestStickerRefs = _chunkRDFHWAHLcjs.closestStickerRefs; exports.combineStickerProviders = combineStickerProviders; exports.createFakeStickerProvider = createFakeStickerProvider; exports.createInsertStickerTool = _chunkPFHJS4HEcjs.createInsertStickerTool; exports.createStickerToolProvider = _chunkPFHJS4HEcjs.createStickerToolProvider; exports.createStickerTools = _chunkPFHJS4HEcjs.createStickerTools; exports.describeStickerRef = _chunkPFHJS4HEcjs.describeStickerRef; exports.editorStampOf = _chunkRDFHWAHLcjs.editorStampOf; exports.editorStickers = _chunk3VHH6V67cjs.editorStickers; exports.insertSticker = _chunkPFHJS4HEcjs.insertSticker; exports.normalizeStickerRef = _chunkRDFHWAHLcjs.normalizeStickerRef; exports.parseStickerRef = _chunkRDFHWAHLcjs.parseStickerRef; exports.providerCollections = _chunkRDFHWAHLcjs.providerCollections; exports.stampCoverage = _chunkRDFHWAHLcjs.stampCoverage; exports.stampOutline = _chunk3VHH6V67cjs.stampOutline; exports.stampPixels = _chunk3VHH6V67cjs.stampPixels; exports.stickerCollections = _chunkRDFHWAHLcjs.stickerCollections; exports.stickerForAgent = _chunkPFHJS4HEcjs.stickerForAgent; exports.stickerIdFor = _chunkRDFHWAHLcjs.stickerIdFor; exports.stickerPage = _chunkRDFHWAHLcjs.stickerPage; exports.stickerRefOf = _chunkRDFHWAHLcjs.stickerRefOf; exports.stickerVariantFor = _chunkRDFHWAHLcjs.stickerVariantFor; exports.stickerVariantsOf = _chunkRDFHWAHLcjs.stickerVariantsOf;
|
package/dist/stickers/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
editorStickers,
|
|
4
4
|
stampOutline,
|
|
5
5
|
stampPixels
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-NSETJI74.js";
|
|
7
7
|
import {
|
|
8
8
|
createInsertStickerTool,
|
|
9
9
|
createStickerToolProvider,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
describeStickerRef,
|
|
12
12
|
insertSticker,
|
|
13
13
|
stickerForAgent
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-VE6UKYQ2.js";
|
|
15
15
|
import {
|
|
16
16
|
DEFAULT_STICKER_PAGE,
|
|
17
17
|
EDITOR_STICKERS_ID,
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
editorStampOf,
|
|
26
26
|
normalizeStickerRef,
|
|
27
27
|
parseStickerRef,
|
|
28
|
+
providerCollections,
|
|
28
29
|
stampCoverage,
|
|
29
30
|
stickerCollections,
|
|
30
31
|
stickerIdFor,
|
|
@@ -32,7 +33,7 @@ import {
|
|
|
32
33
|
stickerRefOf,
|
|
33
34
|
stickerVariantFor,
|
|
34
35
|
stickerVariantsOf
|
|
35
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-JL6YH5WD.js";
|
|
36
37
|
import {
|
|
37
38
|
StickerError
|
|
38
39
|
} from "../chunk-SZTI6EER.js";
|
|
@@ -121,7 +122,9 @@ function createFakeStickerProvider(options = {}) {
|
|
|
121
122
|
if (!s) return void 0;
|
|
122
123
|
return { ...summaryOf(s), silhouette: s.shape === "badge" ? "M60 6A54 54 0 1 1 59.9 6Z" : "M10 10H110V110H10Z", colours: s.shape === "badge" ? [s.colours[0]] : [...s.colours] };
|
|
123
124
|
},
|
|
125
|
+
collections: () => stickerCollections(summaries, COLLECTIONS),
|
|
124
126
|
listCollections: () => stickerCollections(summaries, COLLECTIONS),
|
|
127
|
+
// the older name, kept for callers that use it
|
|
125
128
|
categories: () => [...new Set(CATALOGUE.map((s) => s.category))].map((c) => ({ id: c, name: c, count: CATALOGUE.filter((s) => s.category === c).length })),
|
|
126
129
|
async load(id, o = {}) {
|
|
127
130
|
if (options.loadDelayMs) await new Promise((r) => setTimeout(r, options.loadDelayMs));
|
|
@@ -157,7 +160,7 @@ function combineStickerProviders(providers, options = {}) {
|
|
|
157
160
|
const collectionOwner = (c) => {
|
|
158
161
|
const i = c.indexOf(":");
|
|
159
162
|
const p = i > 0 ? byId.get(c.slice(0, i)) : void 0;
|
|
160
|
-
if (!p) throw new StickerError("invalid_argument", `No collection "${c}"; collections here are "provider:collection" (
|
|
163
|
+
if (!p) throw new StickerError("invalid_argument", `No collection "${c}"; collections here are "provider:collection" (collections() lists them).`);
|
|
161
164
|
return { p, collection: p.namespaced ? c : c.slice(i + 1) };
|
|
162
165
|
};
|
|
163
166
|
const page = async (query, o = {}) => {
|
|
@@ -196,6 +199,11 @@ function combineStickerProviders(providers, options = {}) {
|
|
|
196
199
|
if (!next && items.length >= limit && i < providers.length) next = `${i}|`;
|
|
197
200
|
return { items, total, ...next ? { next } : {} };
|
|
198
201
|
};
|
|
202
|
+
const collections = async () => {
|
|
203
|
+
const out = [];
|
|
204
|
+
for (const p of providers) for (const c of await providerCollections(p) ?? []) out.push({ ...c, id: collectionOf(p, c.id) });
|
|
205
|
+
return out;
|
|
206
|
+
};
|
|
199
207
|
return {
|
|
200
208
|
id: options.id ?? "stickers",
|
|
201
209
|
name: options.name ?? providers.map((p) => p.name).join(" + "),
|
|
@@ -232,11 +240,8 @@ function combineStickerProviders(providers, options = {}) {
|
|
|
232
240
|
}
|
|
233
241
|
return [...counts.values()];
|
|
234
242
|
},
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
for (const p of providers) for (const c of await p.listCollections?.() ?? []) out.push({ ...c, id: collectionOf(p, c.id) });
|
|
238
|
-
return out;
|
|
239
|
-
}
|
|
243
|
+
collections,
|
|
244
|
+
listCollections: collections
|
|
240
245
|
};
|
|
241
246
|
}
|
|
242
247
|
|
|
@@ -263,7 +268,7 @@ function checkSummary(s, provider, issues) {
|
|
|
263
268
|
else if (!v.includes("light")) at("variants must include light (every sticker has its light art)");
|
|
264
269
|
}
|
|
265
270
|
if (s.collection !== void 0 && (typeof s.collection !== "string" || !s.collection)) at("collection must be a non-empty string when present");
|
|
266
|
-
if (s.collection !== void 0 && !provider.listCollections) at(`is in collection "${s.collection}" but the provider has no
|
|
271
|
+
if (s.collection !== void 0 && !provider.collections && !provider.listCollections) at(`is in collection "${s.collection}" but the provider has no collections()`);
|
|
267
272
|
}
|
|
268
273
|
async function checkStickerProvider(provider, options = {}) {
|
|
269
274
|
const issues = [];
|
|
@@ -322,24 +327,24 @@ async function checkStickerProvider(provider, options = {}) {
|
|
|
322
327
|
if (d?.colours?.some((c) => !HEX.test(c))) top(`describe("${first.id}").colours must be #rrggbb`);
|
|
323
328
|
}
|
|
324
329
|
if (await provider.describe("__no_such_sticker__") !== void 0) top("describe of an unknown id returned a sticker");
|
|
325
|
-
if (provider.listCollections) {
|
|
330
|
+
if (provider.collections || provider.listCollections) {
|
|
326
331
|
try {
|
|
327
|
-
const collections = await provider
|
|
332
|
+
const collections = await providerCollections(provider) ?? [];
|
|
328
333
|
const known = /* @__PURE__ */ new Set();
|
|
329
334
|
for (const c of collections) {
|
|
330
335
|
if (typeof c?.id !== "string" || !c.id || typeof c.name !== "string" || !c.name || !(Number.isInteger(c.count) && c.count >= 0)) {
|
|
331
|
-
top(`
|
|
336
|
+
top(`collections() returned ${JSON.stringify(c)}; each needs id, name and a count`);
|
|
332
337
|
continue;
|
|
333
338
|
}
|
|
334
|
-
if (known.has(c.id)) top(`
|
|
339
|
+
if (known.has(c.id)) top(`collections() lists "${c.id}" twice`);
|
|
335
340
|
known.add(c.id);
|
|
336
341
|
const page = await provider.list({ collection: c.id, limit: 100 });
|
|
337
342
|
if (page.total !== c.count) top(`collection "${c.id}" says count ${c.count} but list({ collection }) has ${page.total}`);
|
|
338
343
|
if (page.items.some((x) => x.collection !== c.id)) top(`list({ collection: "${c.id}" }) returned stickers of other collections`);
|
|
339
344
|
}
|
|
340
|
-
for (const x of all) if (x.collection !== void 0 && !known.has(x.collection)) issues.push({ stickerId: x.id, message: `collection "${x.collection}" is not in
|
|
345
|
+
for (const x of all) if (x.collection !== void 0 && !known.has(x.collection)) issues.push({ stickerId: x.id, message: `collection "${x.collection}" is not in collections()` });
|
|
341
346
|
} catch (e) {
|
|
342
|
-
top(`
|
|
347
|
+
top(`collections() rejected: ${e.message}`);
|
|
343
348
|
}
|
|
344
349
|
}
|
|
345
350
|
let rejected = false;
|
|
@@ -413,6 +418,7 @@ export {
|
|
|
413
418
|
insertSticker,
|
|
414
419
|
normalizeStickerRef,
|
|
415
420
|
parseStickerRef,
|
|
421
|
+
providerCollections,
|
|
416
422
|
stampCoverage,
|
|
417
423
|
stampOutline,
|
|
418
424
|
stampPixels,
|
|
@@ -61,7 +61,7 @@ export interface StickerSummary {
|
|
|
61
61
|
* picker or brush can pick the dark one for a dark background without calling `describe` first.
|
|
62
62
|
*/
|
|
63
63
|
variants?: StickerVariant[];
|
|
64
|
-
/** The collection it belongs to (`
|
|
64
|
+
/** The collection it belongs to (`collections()`), when the provider groups its stickers. */
|
|
65
65
|
collection?: string;
|
|
66
66
|
}
|
|
67
67
|
/** Everything about one sticker. */
|
|
@@ -93,7 +93,7 @@ export interface StickerPage {
|
|
|
93
93
|
}
|
|
94
94
|
export interface StickerSearchOptions {
|
|
95
95
|
category?: string;
|
|
96
|
-
/** Only stickers of this collection (`
|
|
96
|
+
/** Only stickers of this collection (`collections()`). */
|
|
97
97
|
collection?: string;
|
|
98
98
|
/** Every tag must match. */
|
|
99
99
|
tags?: string[];
|
|
@@ -144,6 +144,8 @@ export interface StickerProvider {
|
|
|
144
144
|
count: number;
|
|
145
145
|
}>>;
|
|
146
146
|
/** Its collections with counts, when it groups its stickers. Ids stay unique across collections, so `load(id)` needs none. */
|
|
147
|
+
collections?(): MaybePromise<StickerCollection[]>;
|
|
148
|
+
/** The older name for `collections()`, still read when a provider has no `collections()`. */
|
|
147
149
|
listCollections?(): MaybePromise<StickerCollection[]>;
|
|
148
150
|
}
|
|
149
151
|
/** `provider:id`, the name of a sticker across providers. A bare editor stamp (`"star"`) means `editor:star`. */
|
package/dist/stickers/types.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export interface StickerSummary {
|
|
|
61
61
|
* picker or brush can pick the dark one for a dark background without calling `describe` first.
|
|
62
62
|
*/
|
|
63
63
|
variants?: StickerVariant[];
|
|
64
|
-
/** The collection it belongs to (`
|
|
64
|
+
/** The collection it belongs to (`collections()`), when the provider groups its stickers. */
|
|
65
65
|
collection?: string;
|
|
66
66
|
}
|
|
67
67
|
/** Everything about one sticker. */
|
|
@@ -93,7 +93,7 @@ export interface StickerPage {
|
|
|
93
93
|
}
|
|
94
94
|
export interface StickerSearchOptions {
|
|
95
95
|
category?: string;
|
|
96
|
-
/** Only stickers of this collection (`
|
|
96
|
+
/** Only stickers of this collection (`collections()`). */
|
|
97
97
|
collection?: string;
|
|
98
98
|
/** Every tag must match. */
|
|
99
99
|
tags?: string[];
|
|
@@ -144,6 +144,8 @@ export interface StickerProvider {
|
|
|
144
144
|
count: number;
|
|
145
145
|
}>>;
|
|
146
146
|
/** Its collections with counts, when it groups its stickers. Ids stay unique across collections, so `load(id)` needs none. */
|
|
147
|
+
collections?(): MaybePromise<StickerCollection[]>;
|
|
148
|
+
/** The older name for `collections()`, still read when a provider has no `collections()`. */
|
|
147
149
|
listCollections?(): MaybePromise<StickerCollection[]>;
|
|
148
150
|
}
|
|
149
151
|
/** `provider:id`, the name of a sticker across providers. A bare editor stamp (`"star"`) means `editor:star`. */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RasterRect } from '../raster/surface.cjs';
|
|
2
|
+
import { type VectorPaintDef } from './gradient.cjs';
|
|
3
|
+
import type { VectorRenderNode } from './render.cjs';
|
|
4
|
+
import type { VectorMatrix } from './types.cjs';
|
|
5
|
+
type M = VectorMatrix;
|
|
6
|
+
/** An SVG `transform` attribute (`matrix`, `translate`, `scale`, `rotate`, in order) as a matrix. */
|
|
7
|
+
export declare function parseVectorTransform(value: string | undefined): M;
|
|
8
|
+
/**
|
|
9
|
+
* The render data's `nodes` (document space) drawn over `rect` (pixels) through `toPixels`, the
|
|
10
|
+
* map from document space to those pixels: straight-alpha RGBA, `rect.width × rect.height`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function rasterizeVectorBackdrop(nodes: readonly VectorRenderNode[], defs: readonly VectorPaintDef[], toPixels: VectorMatrix, rect: RasterRect): Uint8ClampedArray;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RasterRect } from '../raster/surface.js';
|
|
2
|
+
import { type VectorPaintDef } from './gradient.js';
|
|
3
|
+
import type { VectorRenderNode } from './render.js';
|
|
4
|
+
import type { VectorMatrix } from './types.js';
|
|
5
|
+
type M = VectorMatrix;
|
|
6
|
+
/** An SVG `transform` attribute (`matrix`, `translate`, `scale`, `rotate`, in order) as a matrix. */
|
|
7
|
+
export declare function parseVectorTransform(value: string | undefined): M;
|
|
8
|
+
/**
|
|
9
|
+
* The render data's `nodes` (document space) drawn over `rect` (pixels) through `toPixels`, the
|
|
10
|
+
* map from document space to those pixels: straight-alpha RGBA, `rect.width × rect.height`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function rasterizeVectorBackdrop(nodes: readonly VectorRenderNode[], defs: readonly VectorPaintDef[], toPixels: VectorMatrix, rect: RasterRect): Uint8ClampedArray;
|
|
13
|
+
export {};
|