@pixerate/editor 0.266.2 → 0.268.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 +175 -108
- package/dist/animation-editor/index.js +94 -27
- package/dist/brushes/index.cjs +201 -75
- package/dist/brushes/index.d.cts +4 -3
- package/dist/brushes/index.d.ts +4 -3
- package/dist/brushes/index.js +138 -12
- package/dist/brushes/library.d.cts +27 -1
- package/dist/brushes/library.d.ts +27 -1
- package/dist/brushes/profiles.d.cts +10 -1
- package/dist/brushes/profiles.d.ts +10 -1
- package/dist/brushes/schema.d.cts +4 -0
- package/dist/brushes/schema.d.ts +4 -0
- package/dist/brushes/sources.d.cts +114 -0
- package/dist/brushes/sources.d.ts +114 -0
- package/dist/brushes/types.d.cts +37 -5
- package/dist/brushes/types.d.ts +37 -5
- package/dist/brushes/ui.d.cts +40 -4
- package/dist/brushes/ui.d.ts +40 -4
- package/dist/{brushstrokeRender-KD453OBX.js → brushstrokeRender-A727TTNQ.js} +7 -7
- package/dist/{brushstrokeRender-FSUWXUZY.cjs → brushstrokeRender-WR2N5HHY.cjs} +23 -23
- 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-TOID45I2.cjs → chunk-2WOGXEDX.cjs} +1 -1
- package/dist/{chunk-XORJ7UZO.cjs → chunk-3VHH6V67.cjs} +13 -12
- package/dist/{chunk-3C33YTNN.js → chunk-3XDSNIGF.js} +73 -6
- package/dist/chunk-62MFUHSI.cjs +802 -0
- package/dist/{chunk-R44Y3EFS.js → chunk-74ODPZLX.js} +17 -345
- package/dist/{chunk-GCVFEPJG.js → chunk-ACTHSQOI.js} +182 -0
- package/dist/chunk-ADMRNWR7.js +340 -0
- package/dist/{chunk-MVUQSK5J.cjs → chunk-B3G7BKUV.cjs} +111 -439
- package/dist/{chunk-DXYHQ2VN.js → chunk-BAZMCFVL.js} +1 -1
- package/dist/{chunk-VRK322ZC.cjs → chunk-BPJSI4NT.cjs} +2 -2
- package/dist/{chunk-RFJZGTHA.cjs → chunk-EU2ZZA6L.cjs} +400 -69
- package/dist/{chunk-XC6DPRYI.js → chunk-GSTSZPSR.js} +154 -949
- package/dist/{chunk-EZOJBP4D.js → chunk-HFY5LG5J.js} +1 -1
- package/dist/chunk-HVO6XCI4.js +802 -0
- package/dist/{chunk-YHDHFJUC.cjs → chunk-J5VQYK7T.cjs} +217 -1012
- package/dist/{chunk-XRXFVRGY.cjs → chunk-JBB3GDBB.cjs} +2483 -208
- package/dist/{chunk-ACFSFUQH.js → chunk-JL6YH5WD.js} +4 -0
- package/dist/{chunk-CIJBSUM5.js → chunk-KZI3YWKW.js} +353 -22
- package/dist/{chunk-4ODRXQRW.js → chunk-LETF75CA.js} +1 -1
- package/dist/{chunk-FQPUF2W2.cjs → chunk-NIBFKXMD.cjs} +217 -35
- package/dist/{chunk-AQZQWXEU.cjs → chunk-NPWWSCWT.cjs} +35 -35
- package/dist/{chunk-DOZ6F2K2.js → chunk-NSETJI74.js} +3 -2
- package/dist/{chunk-PE6YJMQT.cjs → chunk-PFHJS4HE.cjs} +20 -19
- package/dist/{chunk-7KNW3WXZ.cjs → chunk-QEVLRLUN.cjs} +63 -0
- package/dist/{chunk-LK4SXL3V.js → chunk-QNY7BDFP.js} +1 -1
- package/dist/{chunk-OTN6VB5S.cjs → chunk-RDFHWAHL.cjs} +5 -1
- package/dist/{chunk-PXDIAYB6.cjs → chunk-STLTOISW.cjs} +34 -214
- package/dist/{chunk-T2LDTEXK.js → chunk-UVTO3D4E.js} +2333 -58
- package/dist/{chunk-6JL2D5SG.js → chunk-VE6UKYQ2.js} +3 -2
- package/dist/{chunk-TXFWZ5ZJ.js → chunk-W6JDUXP3.js} +4 -184
- package/dist/{chunk-3SBLVGOM.cjs → chunk-YOVXQHA3.cjs} +23 -23
- package/dist/{chunk-WLUVZKVD.cjs → chunk-YXP6X3SY.cjs} +103 -36
- 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 +868 -864
- package/dist/image-editor/index.js +123 -119
- package/dist/paint/index.cjs +8 -6
- package/dist/paint/index.js +56 -54
- package/dist/paint-editor/brush-library-tools.d.cts +12 -2
- package/dist/paint-editor/brush-library-tools.d.ts +12 -2
- package/dist/paint-editor/brush-model.d.cts +29 -1
- package/dist/paint-editor/brush-model.d.ts +29 -1
- package/dist/paint-editor/brush-source-art.d.cts +32 -0
- package/dist/paint-editor/brush-source-art.d.ts +32 -0
- package/dist/paint-editor/controller.d.cts +11 -4
- package/dist/paint-editor/controller.d.ts +11 -4
- package/dist/paint-editor/dab-stroke.d.cts +2 -0
- package/dist/paint-editor/dab-stroke.d.ts +2 -0
- package/dist/paint-editor/engine.d.cts +11 -2
- package/dist/paint-editor/engine.d.ts +11 -2
- package/dist/paint-editor/index.cjs +967 -2335
- package/dist/paint-editor/index.d.cts +3 -1
- package/dist/paint-editor/index.d.ts +3 -1
- package/dist/paint-editor/index.js +394 -1762
- 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/paint-editor/stamp-tip.d.cts +8 -5
- package/dist/paint-editor/stamp-tip.d.ts +8 -5
- package/dist/paint-editor/thumbnails.d.cts +6 -0
- package/dist/paint-editor/thumbnails.d.ts +6 -0
- package/dist/paint-editor/tip-grain.d.cts +34 -0
- package/dist/paint-editor/tip-grain.d.ts +34 -0
- package/dist/raster/index.cjs +2 -2
- package/dist/raster/index.js +9 -9
- 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 +1850 -1390
- package/dist/vector/index.d.cts +2 -0
- package/dist/vector/index.d.ts +2 -0
- package/dist/vector/index.js +520 -60
- 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 +37 -10
- package/skills/pixerate-brushes-design/SKILL.md +15 -5
- 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 +14 -4
- package/skills/pixerate-paint-editor/references/brush-facets.md +3 -1
- package/skills/pixerate-paint-editor/references/wet-media.md +9 -0
- package/skills/pixerate-paint-sketch-to-finish/SKILL.md +1 -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
|
}
|
|
@@ -10,11 +10,12 @@ import type { StickerArtLookup } from './sticker-art.cjs';
|
|
|
10
10
|
/** Coverage 0..1 of a stamp at (u, v) of its unit square (−1..1, y down); `seed` varies shapes with random parts. */
|
|
11
11
|
export type StampSampler = (u: number, v: number, seed: number) => number;
|
|
12
12
|
/**
|
|
13
|
-
* The sampler of a stamp ref: an editor stamp's coverage, or the alpha of a sticker's
|
|
14
|
-
* (bilinear, centred in the unit square, aspect kept). `null` when the art is
|
|
15
|
-
* ref is not a sticker): the caller paints the round tip instead.
|
|
13
|
+
* The sampler of a stamp ref: an editor stamp's coverage, or the alpha of a sticker's or an image
|
|
14
|
+
* source's loaded art (bilinear, centred in the unit square, aspect kept). `null` when the art is
|
|
15
|
+
* not loaded (or the ref is not a sticker): the caller paints the round tip instead. `hardness`
|
|
16
|
+
* below 1 softens an image source's edges.
|
|
16
17
|
*/
|
|
17
|
-
export declare function stampSampler(ref: string, art?: StickerArtLookup): StampSampler | null;
|
|
18
|
+
export declare function stampSampler(ref: string, art?: StickerArtLookup, hardness?: number): StampSampler | null;
|
|
18
19
|
/** A dab of a stamp tip: centre, radius (px), roundness squashing it across, angle (radians, counter-clockwise) and flow. */
|
|
19
20
|
export interface StampDab {
|
|
20
21
|
x: number;
|
|
@@ -23,6 +24,8 @@ export interface StampDab {
|
|
|
23
24
|
roundness: number;
|
|
24
25
|
angle: number;
|
|
25
26
|
alpha: number;
|
|
27
|
+
/** Mirrored across the tip's x axis (bit 1) and y axis (bit 2). */
|
|
28
|
+
flip?: number;
|
|
26
29
|
}
|
|
27
30
|
/** The pixel rectangle a stamp dab can touch. */
|
|
28
31
|
export declare function stampDabRect(d: StampDab): CropBox;
|
|
@@ -32,7 +35,7 @@ export declare function stampDabRect(d: StampDab): CropBox;
|
|
|
32
35
|
* Small dabs are supersampled.
|
|
33
36
|
*/
|
|
34
37
|
export declare function rasterizeStampDab(d: StampDab, sample: StampSampler, seed: number, rect: CropBox, out: Float32Array): void;
|
|
35
|
-
/** The sticker refs a brush lays that need loaded art (provider stickers; editor stamps need none). */
|
|
38
|
+
/** The sticker refs a brush lays that need loaded art (provider stickers; editor stamps and image sources need none). */
|
|
36
39
|
export declare function brushStickerRefs(brush: {
|
|
37
40
|
engine: string;
|
|
38
41
|
stamp: string | null;
|
|
@@ -10,11 +10,12 @@ import type { StickerArtLookup } from './sticker-art.js';
|
|
|
10
10
|
/** Coverage 0..1 of a stamp at (u, v) of its unit square (−1..1, y down); `seed` varies shapes with random parts. */
|
|
11
11
|
export type StampSampler = (u: number, v: number, seed: number) => number;
|
|
12
12
|
/**
|
|
13
|
-
* The sampler of a stamp ref: an editor stamp's coverage, or the alpha of a sticker's
|
|
14
|
-
* (bilinear, centred in the unit square, aspect kept). `null` when the art is
|
|
15
|
-
* ref is not a sticker): the caller paints the round tip instead.
|
|
13
|
+
* The sampler of a stamp ref: an editor stamp's coverage, or the alpha of a sticker's or an image
|
|
14
|
+
* source's loaded art (bilinear, centred in the unit square, aspect kept). `null` when the art is
|
|
15
|
+
* not loaded (or the ref is not a sticker): the caller paints the round tip instead. `hardness`
|
|
16
|
+
* below 1 softens an image source's edges.
|
|
16
17
|
*/
|
|
17
|
-
export declare function stampSampler(ref: string, art?: StickerArtLookup): StampSampler | null;
|
|
18
|
+
export declare function stampSampler(ref: string, art?: StickerArtLookup, hardness?: number): StampSampler | null;
|
|
18
19
|
/** A dab of a stamp tip: centre, radius (px), roundness squashing it across, angle (radians, counter-clockwise) and flow. */
|
|
19
20
|
export interface StampDab {
|
|
20
21
|
x: number;
|
|
@@ -23,6 +24,8 @@ export interface StampDab {
|
|
|
23
24
|
roundness: number;
|
|
24
25
|
angle: number;
|
|
25
26
|
alpha: number;
|
|
27
|
+
/** Mirrored across the tip's x axis (bit 1) and y axis (bit 2). */
|
|
28
|
+
flip?: number;
|
|
26
29
|
}
|
|
27
30
|
/** The pixel rectangle a stamp dab can touch. */
|
|
28
31
|
export declare function stampDabRect(d: StampDab): CropBox;
|
|
@@ -32,7 +35,7 @@ export declare function stampDabRect(d: StampDab): CropBox;
|
|
|
32
35
|
* Small dabs are supersampled.
|
|
33
36
|
*/
|
|
34
37
|
export declare function rasterizeStampDab(d: StampDab, sample: StampSampler, seed: number, rect: CropBox, out: Float32Array): void;
|
|
35
|
-
/** The sticker refs a brush lays that need loaded art (provider stickers; editor stamps need none). */
|
|
38
|
+
/** The sticker refs a brush lays that need loaded art (provider stickers; editor stamps and image sources need none). */
|
|
36
39
|
export declare function brushStickerRefs(brush: {
|
|
37
40
|
engine: string;
|
|
38
41
|
stamp: string | null;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { type PaintBrush } from './brushes.cjs';
|
|
7
7
|
import type { PenPoint } from './engine.cjs';
|
|
8
8
|
import { type PaperSettings } from './paper.cjs';
|
|
9
|
+
import type { StickerArtLookup } from './sticker-art.cjs';
|
|
9
10
|
export interface BrushThumbnail {
|
|
10
11
|
width: number;
|
|
11
12
|
height: number;
|
|
@@ -14,9 +15,14 @@ export interface BrushThumbnail {
|
|
|
14
15
|
}
|
|
15
16
|
/** The test stroke's samples for a `width × height` thumbnail. */
|
|
16
17
|
export declare function thumbnailStroke(width: number, height: number): PenPoint[];
|
|
18
|
+
/**
|
|
19
|
+
* A sample stroke with `brush` on `paper`. `stampArt` draws stamp tips of stickers and image
|
|
20
|
+
* sources, and image tip grain (without it they paint round, and without the grain).
|
|
21
|
+
*/
|
|
17
22
|
export declare function renderBrushThumbnail(brush: PaintBrush, options: {
|
|
18
23
|
paper: PaperSettings;
|
|
19
24
|
width?: number;
|
|
20
25
|
height?: number;
|
|
21
26
|
color: string;
|
|
27
|
+
stampArt?: StickerArtLookup;
|
|
22
28
|
}): BrushThumbnail;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { type PaintBrush } from './brushes.js';
|
|
7
7
|
import type { PenPoint } from './engine.js';
|
|
8
8
|
import { type PaperSettings } from './paper.js';
|
|
9
|
+
import type { StickerArtLookup } from './sticker-art.js';
|
|
9
10
|
export interface BrushThumbnail {
|
|
10
11
|
width: number;
|
|
11
12
|
height: number;
|
|
@@ -14,9 +15,14 @@ export interface BrushThumbnail {
|
|
|
14
15
|
}
|
|
15
16
|
/** The test stroke's samples for a `width × height` thumbnail. */
|
|
16
17
|
export declare function thumbnailStroke(width: number, height: number): PenPoint[];
|
|
18
|
+
/**
|
|
19
|
+
* A sample stroke with `brush` on `paper`. `stampArt` draws stamp tips of stickers and image
|
|
20
|
+
* sources, and image tip grain (without it they paint round, and without the grain).
|
|
21
|
+
*/
|
|
17
22
|
export declare function renderBrushThumbnail(brush: PaintBrush, options: {
|
|
18
23
|
paper: PaperSettings;
|
|
19
24
|
width?: number;
|
|
20
25
|
height?: number;
|
|
21
26
|
color: string;
|
|
27
|
+
stampArt?: StickerArtLookup;
|
|
22
28
|
}): BrushThumbnail;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tip grain: texture inside each dab (Procreate's grain source), separate from the paper's grain.
|
|
3
|
+
* The texture is a built-in grain pattern or an image source (`source:<id>`, light parts are
|
|
4
|
+
* peaks), tiled. `texturised` grain stays put on the canvas; `moving` grain is read in the tip's
|
|
5
|
+
* own frame, offset by the distance travelled, so it rolls along the stroke and turns with the tip.
|
|
6
|
+
*
|
|
7
|
+
* A dab's coverage is multiplied by `1 − depth × (1 − height)`. Everything is a function of the
|
|
8
|
+
* dab (position, angle, travel), so replays and repaints at another scale lay the same grain.
|
|
9
|
+
*/
|
|
10
|
+
import type { RasterRect } from '../raster/surface.cjs';
|
|
11
|
+
import type { TipGrainSettings } from './brush-model.cjs';
|
|
12
|
+
import type { StickerArtLookup } from './sticker-art.cjs';
|
|
13
|
+
/** What the grain needs of a dab. */
|
|
14
|
+
export interface TipGrainDab {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
/** Radians, counter-clockwise with y up. */
|
|
18
|
+
angle: number;
|
|
19
|
+
/** Path length travelled to the dab (px). */
|
|
20
|
+
travel: number;
|
|
21
|
+
}
|
|
22
|
+
/** A brush's tip grain, ready to apply to dabs. */
|
|
23
|
+
export declare class TipGrain {
|
|
24
|
+
private readonly field;
|
|
25
|
+
private readonly settings;
|
|
26
|
+
private constructor();
|
|
27
|
+
/**
|
|
28
|
+
* The grain for `settings`, or `null` when there is none to apply: no depth, or an image source
|
|
29
|
+
* whose art is not loaded (the dabs then paint without it).
|
|
30
|
+
*/
|
|
31
|
+
static create(settings: TipGrainSettings | undefined, art?: StickerArtLookup): TipGrain | null;
|
|
32
|
+
/** Multiplies the dab's coverage `vals` (over `rect`) by the grain. */
|
|
33
|
+
apply(vals: Float32Array, rect: RasterRect, d: TipGrainDab): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tip grain: texture inside each dab (Procreate's grain source), separate from the paper's grain.
|
|
3
|
+
* The texture is a built-in grain pattern or an image source (`source:<id>`, light parts are
|
|
4
|
+
* peaks), tiled. `texturised` grain stays put on the canvas; `moving` grain is read in the tip's
|
|
5
|
+
* own frame, offset by the distance travelled, so it rolls along the stroke and turns with the tip.
|
|
6
|
+
*
|
|
7
|
+
* A dab's coverage is multiplied by `1 − depth × (1 − height)`. Everything is a function of the
|
|
8
|
+
* dab (position, angle, travel), so replays and repaints at another scale lay the same grain.
|
|
9
|
+
*/
|
|
10
|
+
import type { RasterRect } from '../raster/surface.js';
|
|
11
|
+
import type { TipGrainSettings } from './brush-model.js';
|
|
12
|
+
import type { StickerArtLookup } from './sticker-art.js';
|
|
13
|
+
/** What the grain needs of a dab. */
|
|
14
|
+
export interface TipGrainDab {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
/** Radians, counter-clockwise with y up. */
|
|
18
|
+
angle: number;
|
|
19
|
+
/** Path length travelled to the dab (px). */
|
|
20
|
+
travel: number;
|
|
21
|
+
}
|
|
22
|
+
/** A brush's tip grain, ready to apply to dabs. */
|
|
23
|
+
export declare class TipGrain {
|
|
24
|
+
private readonly field;
|
|
25
|
+
private readonly settings;
|
|
26
|
+
private constructor();
|
|
27
|
+
/**
|
|
28
|
+
* The grain for `settings`, or `null` when there is none to apply: no depth, or an image source
|
|
29
|
+
* whose art is not loaded (the dabs then paint without it).
|
|
30
|
+
*/
|
|
31
|
+
static create(settings: TipGrainSettings | undefined, art?: StickerArtLookup): TipGrain | null;
|
|
32
|
+
/** Multiplies the dab's coverage `vals` (over `rect`) by the grain. */
|
|
33
|
+
apply(vals: Float32Array, rect: RasterRect, d: TipGrainDab): void;
|
|
34
|
+
}
|
package/dist/raster/index.cjs
CHANGED
|
@@ -79,7 +79,6 @@ var _chunkK6PXS6DOcjs = require('../chunk-K6PXS6DO.cjs');
|
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
var _chunkW5M3J7PVcjs = require('../chunk-W5M3J7PV.cjs');
|
|
83
82
|
|
|
84
83
|
|
|
85
84
|
|
|
@@ -114,6 +113,7 @@ var _chunkW5M3J7PVcjs = require('../chunk-W5M3J7PV.cjs');
|
|
|
114
113
|
|
|
115
114
|
|
|
116
115
|
|
|
116
|
+
var _chunk2VX55NFMcjs = require('../chunk-2VX55NFM.cjs');
|
|
117
117
|
|
|
118
118
|
|
|
119
119
|
|
|
@@ -122,7 +122,7 @@ var _chunkW5M3J7PVcjs = require('../chunk-W5M3J7PV.cjs');
|
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
|
|
125
|
-
var
|
|
125
|
+
var _chunkW5M3J7PVcjs = require('../chunk-W5M3J7PV.cjs');
|
|
126
126
|
|
|
127
127
|
|
|
128
128
|
|
package/dist/raster/index.js
CHANGED
|
@@ -71,15 +71,6 @@ import {
|
|
|
71
71
|
DIRECT_GAUSSIAN_MAX_SIGMA,
|
|
72
72
|
gaussianBlur
|
|
73
73
|
} from "../chunk-ZIF4UJJ6.js";
|
|
74
|
-
import {
|
|
75
|
-
base64ToBytes,
|
|
76
|
-
bytesToBase64,
|
|
77
|
-
decodePng,
|
|
78
|
-
encodePng,
|
|
79
|
-
isPng,
|
|
80
|
-
parseDataUrl,
|
|
81
|
-
pngDataUrl
|
|
82
|
-
} from "../chunk-OTTT5N3K.js";
|
|
83
74
|
import {
|
|
84
75
|
BIT_DEPTHS,
|
|
85
76
|
BLEND_MODES,
|
|
@@ -123,6 +114,15 @@ import {
|
|
|
123
114
|
to8From32,
|
|
124
115
|
writeDeepRegion
|
|
125
116
|
} from "../chunk-IRSTHLQQ.js";
|
|
117
|
+
import {
|
|
118
|
+
base64ToBytes,
|
|
119
|
+
bytesToBase64,
|
|
120
|
+
decodePng,
|
|
121
|
+
encodePng,
|
|
122
|
+
isPng,
|
|
123
|
+
parseDataUrl,
|
|
124
|
+
pngDataUrl
|
|
125
|
+
} from "../chunk-OTTT5N3K.js";
|
|
126
126
|
import {
|
|
127
127
|
SurfaceDraft,
|
|
128
128
|
TILE,
|
|
@@ -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;
|