@pixerate/editor 0.248.0 → 0.249.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/README.md +1 -0
- package/dist/animation-editor/index.cjs +64 -61
- package/dist/animation-editor/index.js +8 -5
- package/dist/{brushstrokeRender-DTDPFBLC.cjs → brushstrokeRender-GCKK7V2I.cjs} +14 -11
- package/dist/{brushstrokeRender-QLCXROJK.js → brushstrokeRender-T3JZST44.js} +7 -4
- package/dist/canvas/index.cjs +8 -8
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-IBDU6EGZ.cjs → chunk-2SMMZDMG.cjs} +35 -35
- package/dist/{chunk-SC2RZ5EF.js → chunk-2VJAVXLI.js} +2 -2
- package/dist/{chunk-OLNIPTB3.cjs → chunk-2VX55NFM.cjs} +1 -320
- package/dist/chunk-3K6HWEXZ.cjs +92 -0
- package/dist/{chunk-UOOK7HTX.js → chunk-3PPJRMIG.js} +1 -1
- package/dist/chunk-4D6KP5BV.js +92 -0
- package/dist/chunk-5RH3VXAK.js +269 -0
- package/dist/{chunk-NZ3O3A5C.js → chunk-6BIDVPED.js} +1 -1
- package/dist/{chunk-2ONK3ERD.cjs → chunk-75K3W4D6.cjs} +20 -20
- package/dist/{chunk-7T7JWTVE.cjs → chunk-BOHDJJ2O.cjs} +8 -8
- package/dist/{chunk-2PBZBRP5.js → chunk-D5KGAO4Z.js} +10 -92
- package/dist/{chunk-5GLYUSNT.js → chunk-DOIU7VJG.js} +1 -1
- package/dist/{chunk-HB4ICNNA.cjs → chunk-DPYAO5U6.cjs} +42 -42
- package/dist/chunk-EJLRBS5Q.js +301 -0
- package/dist/{chunk-6G6ZDDDB.cjs → chunk-H4AOUUBE.cjs} +301 -149
- package/dist/{chunk-PQ3H2AAN.cjs → chunk-I7NJPHWV.cjs} +122 -204
- package/dist/{chunk-L6REDLNB.cjs → chunk-IOFVM3L3.cjs} +7 -7
- package/dist/{chunk-42TWUPNJ.js → chunk-IRSTHLQQ.js} +1 -320
- package/dist/{chunk-VNBUDVD4.js → chunk-J7T5QZ45.js} +226 -74
- package/dist/{chunk-VMROIWLL.cjs → chunk-KBYB7OWB.cjs} +3 -3
- package/dist/{chunk-TPWB4Y6L.cjs → chunk-KYX7NZ5V.cjs} +1 -1
- package/dist/chunk-LJRCU3BJ.cjs +301 -0
- package/dist/{chunk-WVS5KQDH.cjs → chunk-LP2MCSBE.cjs} +246 -244
- package/dist/{chunk-XNRBMYNB.js → chunk-O75V4ZS3.js} +1 -1
- package/dist/chunk-OTTT5N3K.js +322 -0
- package/dist/{chunk-Q2HA52V4.js → chunk-PZP2SZIZ.js} +2 -2
- package/dist/{chunk-ZFSLEOSQ.js → chunk-UBRJOIR5.js} +11 -9
- package/dist/chunk-W5M3J7PV.cjs +322 -0
- package/dist/{chunk-4P6H35HU.js → chunk-WA44NKPF.js} +2 -2
- package/dist/{chunk-XWTRATIM.cjs → chunk-WLJZZHUZ.cjs} +23 -23
- package/dist/{chunk-P3NIPIKS.js → chunk-WQCNC4DK.js} +1 -1
- package/dist/chunk-ZEYMKDYS.cjs +269 -0
- package/dist/image-editor/index.cjs +1055 -1050
- package/dist/image-editor/index.js +28 -23
- package/dist/paint/index.cjs +8 -5
- package/dist/paint/index.js +13 -10
- package/dist/paint-editor/controller.d.cts +37 -1
- package/dist/paint-editor/controller.d.ts +37 -1
- package/dist/paint-editor/index.cjs +745 -602
- package/dist/paint-editor/index.d.cts +3 -0
- package/dist/paint-editor/index.d.ts +3 -0
- package/dist/paint-editor/index.js +184 -41
- package/dist/paint-editor/sticker-art.d.cts +55 -0
- package/dist/paint-editor/sticker-art.d.ts +55 -0
- package/dist/paint-editor/stickers.d.cts +30 -17
- package/dist/paint-editor/stickers.d.ts +30 -17
- package/dist/paint-editor/stroke.d.cts +4 -0
- package/dist/paint-editor/stroke.d.ts +4 -0
- package/dist/paint-editor/ui.d.cts +10 -2
- package/dist/paint-editor/ui.d.ts +10 -2
- package/dist/raster/index.cjs +6 -4
- package/dist/raster/index.js +12 -10
- package/dist/stickers/browser.d.cts +48 -0
- package/dist/stickers/browser.d.ts +48 -0
- package/dist/stickers/combine.d.cts +10 -0
- package/dist/stickers/combine.d.ts +10 -0
- package/dist/stickers/conformance.d.cts +18 -0
- package/dist/stickers/conformance.d.ts +18 -0
- package/dist/stickers/editor.d.cts +14 -0
- package/dist/stickers/editor.d.ts +14 -0
- package/dist/stickers/errors.d.cts +6 -0
- package/dist/stickers/errors.d.ts +6 -0
- package/dist/stickers/fake.d.cts +16 -0
- package/dist/stickers/fake.d.ts +16 -0
- package/dist/stickers/helpers.d.cts +51 -0
- package/dist/stickers/helpers.d.ts +51 -0
- package/dist/stickers/index.cjs +331 -0
- package/dist/stickers/index.d.cts +16 -0
- package/dist/stickers/index.d.ts +16 -0
- package/dist/stickers/index.js +331 -0
- package/dist/stickers/stamps.d.cts +13 -0
- package/dist/stickers/stamps.d.ts +13 -0
- package/dist/stickers/tools.d.cts +25 -0
- package/dist/stickers/tools.d.ts +25 -0
- package/dist/stickers/types.d.cts +123 -0
- package/dist/stickers/types.d.ts +123 -0
- package/dist/vector/index.cjs +978 -975
- package/dist/vector/index.js +9 -6
- package/package.json +11 -1
- package/skills/README.md +1 -0
- package/skills/pixerate-paint-editor/SKILL.md +8 -5
- package/skills/pixerate-stickers/SKILL.md +45 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Art for stickers from a sticker provider (anything but the editor's own procedural stamps): the
|
|
3
|
+
* spray brush draws while a stroke is in progress, so it can't wait for a provider. Each sticker
|
|
4
|
+
* is loaded once, rasterised to RGBA and kept here; drawing reads it synchronously.
|
|
5
|
+
*
|
|
6
|
+
* PNG art (`data:` URLs) is decoded here, in any environment. SVG and `https:` images need a
|
|
7
|
+
* rasteriser: the browser's (`createImageBitmap` and `OffscreenCanvas`) by default, or the
|
|
8
|
+
* host's (`PaintEditorOptions.rasterizeSticker`).
|
|
9
|
+
*/
|
|
10
|
+
import type { StickerAsset, StickerProvider, StickerRef } from '../stickers/types.js';
|
|
11
|
+
/** Rasterised sticker art (straight RGBA) and whether to recolour it. */
|
|
12
|
+
export interface StickerArt {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
data: Uint8ClampedArray;
|
|
16
|
+
/** Flat art: drawn in the sticker's colour, keeping its alpha. */
|
|
17
|
+
tintable: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** The art for a ref, when it has loaded. */
|
|
20
|
+
export type StickerArtLookup = (ref: StickerRef) => StickerArt | undefined;
|
|
21
|
+
/** Turns a sticker asset into RGBA at about `size` px on its longest side. */
|
|
22
|
+
export type StickerRasterizer = (asset: StickerAsset, size: number) => Promise<{
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
data: Uint8ClampedArray;
|
|
26
|
+
}>;
|
|
27
|
+
/** Longest side sticker art is kept at (px); larger stickers are drawn from it, smoothly scaled. */
|
|
28
|
+
export declare const STICKER_ART_SIZE = 256;
|
|
29
|
+
/**
|
|
30
|
+
* Decodes PNG data URLs anywhere; draws SVG and other images with the browser's
|
|
31
|
+
* `createImageBitmap` and `OffscreenCanvas` when present, and otherwise refuses, naming the option
|
|
32
|
+
* that adds a rasteriser.
|
|
33
|
+
*/
|
|
34
|
+
export declare const defaultStickerRasterizer: StickerRasterizer;
|
|
35
|
+
/** Loaded sticker art by ref, with the state of each load. */
|
|
36
|
+
export declare class StickerArtCache {
|
|
37
|
+
private readonly entries;
|
|
38
|
+
/** The art for `ref` when it has loaded (editor stamps never need any). */
|
|
39
|
+
get: StickerArtLookup;
|
|
40
|
+
/** `ready`, `loading`, `failed` (with the reason) or `none` (never asked for). Editor stamps are always `ready`. */
|
|
41
|
+
status(ref: StickerRef): {
|
|
42
|
+
status: 'ready' | 'loading' | 'failed' | 'none';
|
|
43
|
+
error?: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Loads and rasterises `ref` from `provider` once (later calls share the load). Unknown refs
|
|
47
|
+
* reject with the closest known ones; failures are kept so they are reported, and retried on
|
|
48
|
+
* the next call.
|
|
49
|
+
*/
|
|
50
|
+
ensure(provider: StickerProvider, ref: StickerRef, rasterize: StickerRasterizer): Promise<StickerArt | null>;
|
|
51
|
+
/** Forgets every load (a new provider). */
|
|
52
|
+
clear(): void;
|
|
53
|
+
}
|
|
54
|
+
/** Bilinear RGBA sample of `art` at (x, y) in its pixels (straight alpha, colour weighted by alpha). */
|
|
55
|
+
export declare function sampleArt(art: StickerArt, x: number, y: number, out: number[]): number[];
|
|
@@ -14,13 +14,18 @@ import { TileMedium, type PaintTileTarget } from '../paint/exchange.cjs';
|
|
|
14
14
|
import { type PaintGradientSource } from '../paint/gradient-paint.cjs';
|
|
15
15
|
import type { PaintBrush } from './brushes.cjs';
|
|
16
16
|
import { type PenPoint, type StrokeCopy } from './engine.cjs';
|
|
17
|
+
import { type StampKind } from '../stickers/stamps.cjs';
|
|
18
|
+
import type { StickerRef } from '../stickers/types.cjs';
|
|
19
|
+
import { type StickerArtLookup } from './sticker-art.cjs';
|
|
20
|
+
export { STAMP_KINDS, stampCoverage, type StampKind } from '../stickers/stamps.cjs';
|
|
17
21
|
import { type EffectPaintPixels } from './effect-paint.cjs';
|
|
18
|
-
export type StampKind = 'dot' | 'star' | 'heart' | 'leaf' | 'flower' | 'confetti' | 'splat' | 'sparkle' | 'ring';
|
|
19
|
-
export declare const STAMP_KINDS: readonly StampKind[];
|
|
20
22
|
/** One sticker (document pixels). */
|
|
21
23
|
export interface Sticker {
|
|
22
24
|
id: string;
|
|
23
|
-
|
|
25
|
+
/** What it shows: a sticker ref (`provider:id`), e.g. `editor:star` or a host library's sticker. */
|
|
26
|
+
ref: StickerRef;
|
|
27
|
+
/** The editor stamp, when `ref` is one (`editor:star` → `star`); kept for documents and code that read it. */
|
|
28
|
+
stamp?: StampKind;
|
|
24
29
|
x: number;
|
|
25
30
|
y: number;
|
|
26
31
|
/** Diameter in pixels. */
|
|
@@ -36,8 +41,11 @@ export interface Sticker {
|
|
|
36
41
|
}
|
|
37
42
|
/** Sticker spray settings (each 0..1 unless noted). */
|
|
38
43
|
export interface StickerSettings {
|
|
39
|
-
/**
|
|
40
|
-
|
|
44
|
+
/**
|
|
45
|
+
* The stickers to spray (one picked at random per sticker): refs `provider:id`. A bare editor
|
|
46
|
+
* stamp (`"star"`) is read as `editor:star`.
|
|
47
|
+
*/
|
|
48
|
+
stamps: StickerRef[];
|
|
41
49
|
/** How closely stickers follow each other: about `density × 4` per tip diameter of travel (0.25 ≈ one per diameter). */
|
|
42
50
|
density: number;
|
|
43
51
|
/** Random size change. */
|
|
@@ -49,20 +57,21 @@ export interface StickerSettings {
|
|
|
49
57
|
/** Random colour change (hue and lightness). */
|
|
50
58
|
colorJitter: number;
|
|
51
59
|
}
|
|
60
|
+
/** At most this many stickers in a sticker brush. */
|
|
61
|
+
export declare const MAX_STICKER_STAMPS = 16;
|
|
52
62
|
export declare const DEFAULT_STICKER: Readonly<StickerSettings>;
|
|
53
63
|
export declare function normalizeStickerSettings(raw?: Partial<StickerSettings>, base?: StickerSettings): StickerSettings;
|
|
54
|
-
/**
|
|
55
|
-
* Coverage of a stamp at a point (u, v) of its unit square (−1..1, y down), 0..1, before shading.
|
|
56
|
-
* `t` is the sticker's seed for shapes with random parts (splat, confetti).
|
|
57
|
-
*/
|
|
58
|
-
export declare function stampCoverage(kind: StampKind, u: number, v: number, t: number): number;
|
|
59
64
|
/** The pixel rectangle a sticker covers. */
|
|
60
65
|
export declare function stickerRect(s: Sticker): RasterRect;
|
|
66
|
+
/** The editor stamp a sticker shows, or `null` for a provider's sticker. */
|
|
67
|
+
export declare function stickerStamp(s: Pick<Sticker, 'ref' | 'stamp'>): StampKind | null;
|
|
61
68
|
/**
|
|
62
|
-
* Draws one sticker through a `TileMedium` (straight source-over)
|
|
63
|
-
* little from the top left and given a fine seeded texture, in its colour and opacity.
|
|
69
|
+
* Draws one sticker through a `TileMedium` (straight source-over). An editor stamp: its coverage,
|
|
70
|
+
* lit a little from the top left and given a fine seeded texture, in its colour and opacity. A
|
|
71
|
+
* provider's sticker: its loaded art (`art`), fitted into the sticker's size and turned, in its
|
|
72
|
+
* own colours or, when tintable, in the sticker's colour; nothing until the art has loaded.
|
|
64
73
|
*/
|
|
65
|
-
export declare function drawSticker(medium: TileMedium, s: Sticker): RasterRect;
|
|
74
|
+
export declare function drawSticker(medium: TileMedium, s: Sticker, art?: StickerArtLookup): RasterRect;
|
|
66
75
|
export interface StickerSprayInit {
|
|
67
76
|
brush: PaintBrush;
|
|
68
77
|
target: PaintTileTarget;
|
|
@@ -79,12 +88,16 @@ export interface StickerSprayInit {
|
|
|
79
88
|
* stays recolourable); none lands where the effect is transparent.
|
|
80
89
|
*/
|
|
81
90
|
effect?: EffectPaintPixels | null;
|
|
91
|
+
/** Loaded art for provider stickers; stickers without art yet are skipped (see `skipped`). */
|
|
92
|
+
art?: StickerArtLookup;
|
|
82
93
|
}
|
|
83
94
|
/** A sticker-spray stroke: drops stickers along the path and draws them as it goes. */
|
|
84
95
|
export declare class StickerSpray {
|
|
85
96
|
readonly init: StickerSprayInit;
|
|
86
97
|
dabCount: number;
|
|
87
98
|
readonly stickers: Sticker[];
|
|
99
|
+
/** Refs the spray picked but could not draw because their art had not loaded. */
|
|
100
|
+
readonly skipped: Set<string>;
|
|
88
101
|
private readonly smoother;
|
|
89
102
|
private readonly walkers;
|
|
90
103
|
private readonly copies;
|
|
@@ -101,7 +114,7 @@ export declare class StickerSpray {
|
|
|
101
114
|
private colorAt;
|
|
102
115
|
}
|
|
103
116
|
/** A sticker list rendered over a transparent layer, through a tile target. */
|
|
104
|
-
export declare function renderStickers(stickers: readonly Sticker[], target: PaintTileTarget): void;
|
|
117
|
+
export declare function renderStickers(stickers: readonly Sticker[], target: PaintTileTarget, art?: StickerArtLookup): void;
|
|
105
118
|
/** Checks and rounds a sticker change; throws a sentence naming the bad field. */
|
|
106
119
|
export declare function normalizeStickerUpdate(u: Partial<Omit<Sticker, 'id'>>): Partial<Omit<Sticker, 'id'>>;
|
|
107
120
|
/**
|
|
@@ -110,6 +123,6 @@ export declare function normalizeStickerUpdate(u: Partial<Omit<Sticker, 'id'>>):
|
|
|
110
123
|
* drawn again, from the stickers that reach them; the rest are kept. The pixels are the same as a
|
|
111
124
|
* full redraw, since a tile depends only on the stickers over it.
|
|
112
125
|
*/
|
|
113
|
-
export declare function stickerSurface(stickers: readonly Sticker[], base?: TiledSurface, dirty?: readonly RasterRect[]): TiledSurface;
|
|
114
|
-
/** The top-most sticker under a point (document pixels), by its stamp's shape, or `null`. */
|
|
115
|
-
export declare function stickerAt(stickers: readonly Sticker[], x: number, y: number): Sticker | null;
|
|
126
|
+
export declare function stickerSurface(stickers: readonly Sticker[], base?: TiledSurface, dirty?: readonly RasterRect[], art?: StickerArtLookup): TiledSurface;
|
|
127
|
+
/** The top-most sticker under a point (document pixels), by its stamp's shape (or its art's alpha), or `null`. */
|
|
128
|
+
export declare function stickerAt(stickers: readonly Sticker[], x: number, y: number, art?: StickerArtLookup): Sticker | null;
|
|
@@ -14,13 +14,18 @@ import { TileMedium, type PaintTileTarget } from '../paint/exchange.js';
|
|
|
14
14
|
import { type PaintGradientSource } from '../paint/gradient-paint.js';
|
|
15
15
|
import type { PaintBrush } from './brushes.js';
|
|
16
16
|
import { type PenPoint, type StrokeCopy } from './engine.js';
|
|
17
|
+
import { type StampKind } from '../stickers/stamps.js';
|
|
18
|
+
import type { StickerRef } from '../stickers/types.js';
|
|
19
|
+
import { type StickerArtLookup } from './sticker-art.js';
|
|
20
|
+
export { STAMP_KINDS, stampCoverage, type StampKind } from '../stickers/stamps.js';
|
|
17
21
|
import { type EffectPaintPixels } from './effect-paint.js';
|
|
18
|
-
export type StampKind = 'dot' | 'star' | 'heart' | 'leaf' | 'flower' | 'confetti' | 'splat' | 'sparkle' | 'ring';
|
|
19
|
-
export declare const STAMP_KINDS: readonly StampKind[];
|
|
20
22
|
/** One sticker (document pixels). */
|
|
21
23
|
export interface Sticker {
|
|
22
24
|
id: string;
|
|
23
|
-
|
|
25
|
+
/** What it shows: a sticker ref (`provider:id`), e.g. `editor:star` or a host library's sticker. */
|
|
26
|
+
ref: StickerRef;
|
|
27
|
+
/** The editor stamp, when `ref` is one (`editor:star` → `star`); kept for documents and code that read it. */
|
|
28
|
+
stamp?: StampKind;
|
|
24
29
|
x: number;
|
|
25
30
|
y: number;
|
|
26
31
|
/** Diameter in pixels. */
|
|
@@ -36,8 +41,11 @@ export interface Sticker {
|
|
|
36
41
|
}
|
|
37
42
|
/** Sticker spray settings (each 0..1 unless noted). */
|
|
38
43
|
export interface StickerSettings {
|
|
39
|
-
/**
|
|
40
|
-
|
|
44
|
+
/**
|
|
45
|
+
* The stickers to spray (one picked at random per sticker): refs `provider:id`. A bare editor
|
|
46
|
+
* stamp (`"star"`) is read as `editor:star`.
|
|
47
|
+
*/
|
|
48
|
+
stamps: StickerRef[];
|
|
41
49
|
/** How closely stickers follow each other: about `density × 4` per tip diameter of travel (0.25 ≈ one per diameter). */
|
|
42
50
|
density: number;
|
|
43
51
|
/** Random size change. */
|
|
@@ -49,20 +57,21 @@ export interface StickerSettings {
|
|
|
49
57
|
/** Random colour change (hue and lightness). */
|
|
50
58
|
colorJitter: number;
|
|
51
59
|
}
|
|
60
|
+
/** At most this many stickers in a sticker brush. */
|
|
61
|
+
export declare const MAX_STICKER_STAMPS = 16;
|
|
52
62
|
export declare const DEFAULT_STICKER: Readonly<StickerSettings>;
|
|
53
63
|
export declare function normalizeStickerSettings(raw?: Partial<StickerSettings>, base?: StickerSettings): StickerSettings;
|
|
54
|
-
/**
|
|
55
|
-
* Coverage of a stamp at a point (u, v) of its unit square (−1..1, y down), 0..1, before shading.
|
|
56
|
-
* `t` is the sticker's seed for shapes with random parts (splat, confetti).
|
|
57
|
-
*/
|
|
58
|
-
export declare function stampCoverage(kind: StampKind, u: number, v: number, t: number): number;
|
|
59
64
|
/** The pixel rectangle a sticker covers. */
|
|
60
65
|
export declare function stickerRect(s: Sticker): RasterRect;
|
|
66
|
+
/** The editor stamp a sticker shows, or `null` for a provider's sticker. */
|
|
67
|
+
export declare function stickerStamp(s: Pick<Sticker, 'ref' | 'stamp'>): StampKind | null;
|
|
61
68
|
/**
|
|
62
|
-
* Draws one sticker through a `TileMedium` (straight source-over)
|
|
63
|
-
* little from the top left and given a fine seeded texture, in its colour and opacity.
|
|
69
|
+
* Draws one sticker through a `TileMedium` (straight source-over). An editor stamp: its coverage,
|
|
70
|
+
* lit a little from the top left and given a fine seeded texture, in its colour and opacity. A
|
|
71
|
+
* provider's sticker: its loaded art (`art`), fitted into the sticker's size and turned, in its
|
|
72
|
+
* own colours or, when tintable, in the sticker's colour; nothing until the art has loaded.
|
|
64
73
|
*/
|
|
65
|
-
export declare function drawSticker(medium: TileMedium, s: Sticker): RasterRect;
|
|
74
|
+
export declare function drawSticker(medium: TileMedium, s: Sticker, art?: StickerArtLookup): RasterRect;
|
|
66
75
|
export interface StickerSprayInit {
|
|
67
76
|
brush: PaintBrush;
|
|
68
77
|
target: PaintTileTarget;
|
|
@@ -79,12 +88,16 @@ export interface StickerSprayInit {
|
|
|
79
88
|
* stays recolourable); none lands where the effect is transparent.
|
|
80
89
|
*/
|
|
81
90
|
effect?: EffectPaintPixels | null;
|
|
91
|
+
/** Loaded art for provider stickers; stickers without art yet are skipped (see `skipped`). */
|
|
92
|
+
art?: StickerArtLookup;
|
|
82
93
|
}
|
|
83
94
|
/** A sticker-spray stroke: drops stickers along the path and draws them as it goes. */
|
|
84
95
|
export declare class StickerSpray {
|
|
85
96
|
readonly init: StickerSprayInit;
|
|
86
97
|
dabCount: number;
|
|
87
98
|
readonly stickers: Sticker[];
|
|
99
|
+
/** Refs the spray picked but could not draw because their art had not loaded. */
|
|
100
|
+
readonly skipped: Set<string>;
|
|
88
101
|
private readonly smoother;
|
|
89
102
|
private readonly walkers;
|
|
90
103
|
private readonly copies;
|
|
@@ -101,7 +114,7 @@ export declare class StickerSpray {
|
|
|
101
114
|
private colorAt;
|
|
102
115
|
}
|
|
103
116
|
/** A sticker list rendered over a transparent layer, through a tile target. */
|
|
104
|
-
export declare function renderStickers(stickers: readonly Sticker[], target: PaintTileTarget): void;
|
|
117
|
+
export declare function renderStickers(stickers: readonly Sticker[], target: PaintTileTarget, art?: StickerArtLookup): void;
|
|
105
118
|
/** Checks and rounds a sticker change; throws a sentence naming the bad field. */
|
|
106
119
|
export declare function normalizeStickerUpdate(u: Partial<Omit<Sticker, 'id'>>): Partial<Omit<Sticker, 'id'>>;
|
|
107
120
|
/**
|
|
@@ -110,6 +123,6 @@ export declare function normalizeStickerUpdate(u: Partial<Omit<Sticker, 'id'>>):
|
|
|
110
123
|
* drawn again, from the stickers that reach them; the rest are kept. The pixels are the same as a
|
|
111
124
|
* full redraw, since a tile depends only on the stickers over it.
|
|
112
125
|
*/
|
|
113
|
-
export declare function stickerSurface(stickers: readonly Sticker[], base?: TiledSurface, dirty?: readonly RasterRect[]): TiledSurface;
|
|
114
|
-
/** The top-most sticker under a point (document pixels), by its stamp's shape, or `null`. */
|
|
115
|
-
export declare function stickerAt(stickers: readonly Sticker[], x: number, y: number): Sticker | null;
|
|
126
|
+
export declare function stickerSurface(stickers: readonly Sticker[], base?: TiledSurface, dirty?: readonly RasterRect[], art?: StickerArtLookup): TiledSurface;
|
|
127
|
+
/** The top-most sticker under a point (document pixels), by its stamp's shape (or its art's alpha), or `null`. */
|
|
128
|
+
export declare function stickerAt(stickers: readonly Sticker[], x: number, y: number, art?: StickerArtLookup): Sticker | null;
|
|
@@ -20,6 +20,7 @@ import type { Affine } from './strokes.cjs';
|
|
|
20
20
|
import type { WetStrokeDriver } from './wet.cjs';
|
|
21
21
|
import { type ThickChannels } from './thick.cjs';
|
|
22
22
|
import { type Sticker } from './stickers.cjs';
|
|
23
|
+
import type { StickerArtLookup } from './sticker-art.cjs';
|
|
23
24
|
export interface StrokeSessionHost {
|
|
24
25
|
/** Shows the layer's live surface (no history); `rects` are where it changed. */
|
|
25
26
|
update(layerId: string, surface: TiledSurface, rects: RasterRect[]): void;
|
|
@@ -74,6 +75,7 @@ export interface StrokeSessionInit {
|
|
|
74
75
|
/** Sticker brushes: the next sticker number on the layer. */
|
|
75
76
|
sticker?: {
|
|
76
77
|
nextId: number;
|
|
78
|
+
art?: StickerArtLookup;
|
|
77
79
|
};
|
|
78
80
|
/** Gradient paint (resolved: concrete colours), or `null` for the one colour. Recorded with the stroke. */
|
|
79
81
|
paint?: PaintGradientSource | null;
|
|
@@ -104,6 +106,8 @@ export interface PaintStrokeResult {
|
|
|
104
106
|
mixerLoad?: MixerLoad;
|
|
105
107
|
/** Wet brushes: the paint is wet (it keeps moving until it dries; see dry_paint / advance_wet_paint). */
|
|
106
108
|
wet?: boolean;
|
|
109
|
+
/** Sticker brushes: refs the spray picked but skipped because their art had not loaded yet. */
|
|
110
|
+
skippedStickers?: string[];
|
|
107
111
|
}
|
|
108
112
|
export declare class PaintStrokeSession {
|
|
109
113
|
private readonly host;
|
|
@@ -20,6 +20,7 @@ import type { Affine } from './strokes.js';
|
|
|
20
20
|
import type { WetStrokeDriver } from './wet.js';
|
|
21
21
|
import { type ThickChannels } from './thick.js';
|
|
22
22
|
import { type Sticker } from './stickers.js';
|
|
23
|
+
import type { StickerArtLookup } from './sticker-art.js';
|
|
23
24
|
export interface StrokeSessionHost {
|
|
24
25
|
/** Shows the layer's live surface (no history); `rects` are where it changed. */
|
|
25
26
|
update(layerId: string, surface: TiledSurface, rects: RasterRect[]): void;
|
|
@@ -74,6 +75,7 @@ export interface StrokeSessionInit {
|
|
|
74
75
|
/** Sticker brushes: the next sticker number on the layer. */
|
|
75
76
|
sticker?: {
|
|
76
77
|
nextId: number;
|
|
78
|
+
art?: StickerArtLookup;
|
|
77
79
|
};
|
|
78
80
|
/** Gradient paint (resolved: concrete colours), or `null` for the one colour. Recorded with the stroke. */
|
|
79
81
|
paint?: PaintGradientSource | null;
|
|
@@ -104,6 +106,8 @@ export interface PaintStrokeResult {
|
|
|
104
106
|
mixerLoad?: MixerLoad;
|
|
105
107
|
/** Wet brushes: the paint is wet (it keeps moving until it dries; see dry_paint / advance_wet_paint). */
|
|
106
108
|
wet?: boolean;
|
|
109
|
+
/** Sticker brushes: refs the spray picked but skipped because their art had not loaded yet. */
|
|
110
|
+
skippedStickers?: string[];
|
|
107
111
|
}
|
|
108
112
|
export declare class PaintStrokeSession {
|
|
109
113
|
private readonly host;
|
|
@@ -16,7 +16,8 @@ import type { PenPoint } from './engine.cjs';
|
|
|
16
16
|
import { type Point2 } from './guides.cjs';
|
|
17
17
|
import { type StencilInput } from './stencils.cjs';
|
|
18
18
|
import { type DotRotation, type DotTextureOrder, type ParticleKind, type ParticleRender, type RibbonPairs } from './procedural.cjs';
|
|
19
|
-
import type
|
|
19
|
+
import { type StampKind } from './stickers.cjs';
|
|
20
|
+
import type { StickerRef } from '../stickers/types.cjs';
|
|
20
21
|
import type { WetEngineInfo, WetGpuMode } from './wet.cjs';
|
|
21
22
|
import { type PointerSample } from './input.cjs';
|
|
22
23
|
import { type ColorWheel } from './color.cjs';
|
|
@@ -195,7 +196,7 @@ export interface BrushEngineControls {
|
|
|
195
196
|
* (`particle.dotTextures` up to `MAX_DOT_TEXTURES` of `STAMP_KINDS`, `dotTextureOrder`, `dotRotation`).
|
|
196
197
|
*/
|
|
197
198
|
particleMenus?: boolean;
|
|
198
|
-
/** The sticker
|
|
199
|
+
/** The sticker picker for the brush's stickers (`sticker.stamps`, refs from the sticker library; `toggleStickerRef`). */
|
|
199
200
|
stickerStamps?: boolean;
|
|
200
201
|
/** Light paint: the "light follows pressure" toggle (`light.pressure`); the Light slider is in `sliders`. */
|
|
201
202
|
light?: boolean;
|
|
@@ -264,6 +265,13 @@ export declare const DOT_ROTATION_LABELS: Readonly<Record<DotRotation, string>>;
|
|
|
264
265
|
/** Labels of the sticker stamps. */
|
|
265
266
|
export declare const STAMP_LABELS: Readonly<Record<StampKind, string>>;
|
|
266
267
|
/** Toggles one stamp in a sticker brush's set (never leaving it empty). */
|
|
268
|
+
/**
|
|
269
|
+
* Toggles a sticker ref in a sticker brush's list (`sticker.stamps`): removes it when present (a
|
|
270
|
+
* brush keeps at least one), else adds it while there are fewer than `MAX_STICKER_STAMPS`.
|
|
271
|
+
*/
|
|
272
|
+
export declare function toggleStickerRef(refs: readonly StickerRef[], ref: StickerRef): StickerRef[];
|
|
273
|
+
/** A short label for a sticker ref: the editor stamp's name, else the id after the provider. */
|
|
274
|
+
export declare function stickerRefLabel(ref: StickerRef): string;
|
|
267
275
|
export declare function toggleStamp(stamps: readonly StampKind[], stamp: StampKind): StampKind[];
|
|
268
276
|
/**
|
|
269
277
|
* Toggles a textured-dot stamp (`particle.dotTextures`): removes it (every copy) when present,
|
|
@@ -16,7 +16,8 @@ import type { PenPoint } from './engine.js';
|
|
|
16
16
|
import { type Point2 } from './guides.js';
|
|
17
17
|
import { type StencilInput } from './stencils.js';
|
|
18
18
|
import { type DotRotation, type DotTextureOrder, type ParticleKind, type ParticleRender, type RibbonPairs } from './procedural.js';
|
|
19
|
-
import type
|
|
19
|
+
import { type StampKind } from './stickers.js';
|
|
20
|
+
import type { StickerRef } from '../stickers/types.js';
|
|
20
21
|
import type { WetEngineInfo, WetGpuMode } from './wet.js';
|
|
21
22
|
import { type PointerSample } from './input.js';
|
|
22
23
|
import { type ColorWheel } from './color.js';
|
|
@@ -195,7 +196,7 @@ export interface BrushEngineControls {
|
|
|
195
196
|
* (`particle.dotTextures` up to `MAX_DOT_TEXTURES` of `STAMP_KINDS`, `dotTextureOrder`, `dotRotation`).
|
|
196
197
|
*/
|
|
197
198
|
particleMenus?: boolean;
|
|
198
|
-
/** The sticker
|
|
199
|
+
/** The sticker picker for the brush's stickers (`sticker.stamps`, refs from the sticker library; `toggleStickerRef`). */
|
|
199
200
|
stickerStamps?: boolean;
|
|
200
201
|
/** Light paint: the "light follows pressure" toggle (`light.pressure`); the Light slider is in `sliders`. */
|
|
201
202
|
light?: boolean;
|
|
@@ -264,6 +265,13 @@ export declare const DOT_ROTATION_LABELS: Readonly<Record<DotRotation, string>>;
|
|
|
264
265
|
/** Labels of the sticker stamps. */
|
|
265
266
|
export declare const STAMP_LABELS: Readonly<Record<StampKind, string>>;
|
|
266
267
|
/** Toggles one stamp in a sticker brush's set (never leaving it empty). */
|
|
268
|
+
/**
|
|
269
|
+
* Toggles a sticker ref in a sticker brush's list (`sticker.stamps`): removes it when present (a
|
|
270
|
+
* brush keeps at least one), else adds it while there are fewer than `MAX_STICKER_STAMPS`.
|
|
271
|
+
*/
|
|
272
|
+
export declare function toggleStickerRef(refs: readonly StickerRef[], ref: StickerRef): StickerRef[];
|
|
273
|
+
/** A short label for a sticker ref: the editor stamp's name, else the id after the provider. */
|
|
274
|
+
export declare function stickerRefLabel(ref: StickerRef): string;
|
|
267
275
|
export declare function toggleStamp(stamps: readonly StampKind[], stamp: StampKind): StampKind[];
|
|
268
276
|
/**
|
|
269
277
|
* Toggles a textured-dot stamp (`particle.dotTextures`): removes it (every copy) when present,
|
package/dist/raster/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkBOHDJJ2Ocjs = require('../chunk-BOHDJJ2O.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -67,7 +67,7 @@ var _chunk7T7JWTVEcjs = require('../chunk-7T7JWTVE.cjs');
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
var
|
|
70
|
+
var _chunkDPYAO5U6cjs = require('../chunk-DPYAO5U6.cjs');
|
|
71
71
|
require('../chunk-QT26RHKK.cjs');
|
|
72
72
|
|
|
73
73
|
|
|
@@ -115,6 +115,7 @@ var _chunkK6PXS6DOcjs = require('../chunk-K6PXS6DO.cjs');
|
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
|
|
118
|
+
var _chunk2VX55NFMcjs = require('../chunk-2VX55NFM.cjs');
|
|
118
119
|
|
|
119
120
|
|
|
120
121
|
|
|
@@ -122,7 +123,8 @@ var _chunkK6PXS6DOcjs = require('../chunk-K6PXS6DO.cjs');
|
|
|
122
123
|
|
|
123
124
|
|
|
124
125
|
|
|
125
|
-
|
|
126
|
+
|
|
127
|
+
var _chunkW5M3J7PVcjs = require('../chunk-W5M3J7PV.cjs');
|
|
126
128
|
|
|
127
129
|
|
|
128
130
|
|
|
@@ -528,4 +530,4 @@ function drawSurfaceToViewport(ctx, surface, mapping, view, options) {
|
|
|
528
530
|
|
|
529
531
|
|
|
530
532
|
|
|
531
|
-
exports.BIT_DEPTHS =
|
|
533
|
+
exports.BIT_DEPTHS = _chunk2VX55NFMcjs.BIT_DEPTHS; exports.BLEND_MODES = _chunk2VX55NFMcjs.BLEND_MODES; exports.CURVE_LUT_SIZE = _chunkDPYAO5U6cjs.CURVE_LUT_SIZE; exports.DEFAULT_GLOBAL_LIGHT = _chunkDPYAO5U6cjs.DEFAULT_GLOBAL_LIGHT; exports.DIRECT_GAUSSIAN_MAX_SIGMA = _chunkK6PXS6DOcjs.DIRECT_GAUSSIAN_MAX_SIGMA; exports.DeepCompositor = _chunkDPYAO5U6cjs.DeepCompositor; exports.INTERPOLATIONS = _chunkDPYAO5U6cjs.INTERPOLATIONS; exports.LAYER_EFFECT_KINDS = _chunkDPYAO5U6cjs.LAYER_EFFECT_KINDS; exports.LAYER_EFFECT_MENU = _chunkBOHDJJ2Ocjs.LAYER_EFFECT_MENU; exports.LayerEffectError = _chunkDPYAO5U6cjs.LayerEffectError; exports.MAX_EFFECT_REACH = _chunkDPYAO5U6cjs.MAX_EFFECT_REACH; exports.MAX_TRANSFORM_PIXELS = _chunkDPYAO5U6cjs.MAX_TRANSFORM_PIXELS; exports.PAINTERLY_BLEND_MODES = _chunk2VX55NFMcjs.PAINTERLY_BLEND_MODES; exports.PatternPlacement = _chunkDPYAO5U6cjs.PatternPlacement; exports.PatternTile = _chunkDPYAO5U6cjs.PatternTile; exports.RasterCompositor = _chunkDPYAO5U6cjs.RasterCompositor; exports.SHADOW_AMBIENT = _chunk2VX55NFMcjs.SHADOW_AMBIENT; exports.STROKE_CHAMFER_MAX = _chunkDPYAO5U6cjs.STROKE_CHAMFER_MAX; exports.SurfaceDraft = _chunk474IQG74cjs.SurfaceDraft; exports.SurfaceViewportRenderer = SurfaceViewportRenderer; exports.TILE = _chunk474IQG74cjs.TILE; exports.TILE_SHIFT = _chunk474IQG74cjs.TILE_SHIFT; exports.TiledSurface = _chunk474IQG74cjs.TiledSurface; exports.TransformTooLargeError = _chunkDPYAO5U6cjs.TransformTooLargeError; exports.ZlibError = _chunkXFM3OCHUcjs.ZlibError; exports.activeEffectItems = _chunkDPYAO5U6cjs.activeEffectItems; exports.adler32 = _chunkXFM3OCHUcjs.adler32; exports.applyEdgeAmbient = _chunkDPYAO5U6cjs.applyEdgeAmbient; exports.base64ToBytes = _chunkW5M3J7PVcjs.base64ToBytes; exports.blendChannel = _chunk2VX55NFMcjs.blendChannel; exports.blendImageData = _chunk2VX55NFMcjs.blendImageData; exports.blendLum = _chunk2VX55NFMcjs.blendLum; exports.blendPixel = _chunk2VX55NFMcjs.blendPixel; exports.blendRgb = _chunk2VX55NFMcjs.blendRgb; exports.blendTile = _chunkDPYAO5U6cjs.blendTile; exports.buildEffectMaps = _chunkDPYAO5U6cjs.buildEffectMaps; exports.builtinPattern = _chunkDPYAO5U6cjs.builtinPattern; exports.builtinPatternIds = _chunkDPYAO5U6cjs.builtinPatternIds; exports.bytesToBase64 = _chunkW5M3J7PVcjs.bytesToBase64; exports.canvasCompositeOperation = _chunk2VX55NFMcjs.canvasCompositeOperation; exports.changedTiles = _chunkDPYAO5U6cjs.changedTiles; exports.collectTiles = _chunk474IQG74cjs.collectTiles; exports.compositeLayerEffects = _chunkDPYAO5U6cjs.compositeLayerEffects; exports.compositeSurfaceOver = _chunkDPYAO5U6cjs.compositeSurfaceOver; exports.contentBounds = _chunk474IQG74cjs.contentBounds; exports.contourLut = _chunkDPYAO5U6cjs.contourLut; exports.convertSurfaceDepth = _chunk2VX55NFMcjs.convertSurfaceDepth; exports.curveLut = _chunkDPYAO5U6cjs.curveLut; exports.decodePng = _chunkW5M3J7PVcjs.decodePng; exports.deepBytes = _chunk2VX55NFMcjs.deepBytes; exports.deepTile = _chunk2VX55NFMcjs.deepTile; exports.defaultEffectGradient = _chunkDPYAO5U6cjs.defaultEffectGradient; exports.defaultLayerEffect = _chunkDPYAO5U6cjs.defaultLayerEffect; exports.deflate = _chunkXFM3OCHUcjs.deflate; exports.deflateRaw = _chunkXFM3OCHUcjs.deflateRaw; exports.depthOf = _chunk2VX55NFMcjs.depthOf; exports.drawSurfaceToViewport = drawSurfaceToViewport; exports.effectColorHex = _chunkDPYAO5U6cjs.effectColorHex; exports.effectControlChange = _chunkBOHDJJ2Ocjs.effectControlChange; exports.effectFillColors = _chunkDPYAO5U6cjs.effectFillColors; exports.effectReach = _chunkDPYAO5U6cjs.effectReach; exports.effectsAreLocal = _chunkDPYAO5U6cjs.effectsAreLocal; exports.effectsFingerprint = _chunkDPYAO5U6cjs.effectsFingerprint; exports.effectsMargin = _chunkDPYAO5U6cjs.effectsMargin; exports.effectsScale = _chunkDPYAO5U6cjs.effectsScale; exports.emptySurface = _chunk474IQG74cjs.emptySurface; exports.encodePng = _chunkW5M3J7PVcjs.encodePng; exports.fillRect = _chunk474IQG74cjs.fillRect; exports.findLayer = _chunkDPYAO5U6cjs.findLayer; exports.finishTile = _chunk474IQG74cjs.finishTile; exports.flattenLayers = _chunkDPYAO5U6cjs.flattenLayers; exports.gaussianBlur = _chunkK6PXS6DOcjs.gaussianBlur; exports.gradientT = _chunkDPYAO5U6cjs.gradientT; exports.hasActiveEffects = _chunkDPYAO5U6cjs.hasActiveEffects; exports.hashNoise = _chunkDPYAO5U6cjs.hashNoise; exports.inflate = _chunkXFM3OCHUcjs.inflate; exports.inflateRaw = _chunkXFM3OCHUcjs.inflateRaw; exports.insertLayer = _chunkDPYAO5U6cjs.insertLayer; exports.isBitDepth = _chunk2VX55NFMcjs.isBitDepth; exports.isBlendMode = _chunk2VX55NFMcjs.isBlendMode; exports.isInterpolation = _chunkDPYAO5U6cjs.isInterpolation; exports.isLayerEffectKind = _chunkDPYAO5U6cjs.isLayerEffectKind; exports.isLayerLocked = _chunkDPYAO5U6cjs.isLayerLocked; exports.isPainterlyBlendMode = _chunk2VX55NFMcjs.isPainterlyBlendMode; exports.isPng = _chunkW5M3J7PVcjs.isPng; exports.isSeparableBlendMode = _chunk2VX55NFMcjs.isSeparableBlendMode; exports.keepDeepSamples = _chunk2VX55NFMcjs.keepDeepSamples; exports.keysWeight = _chunkDPYAO5U6cjs.keysWeight; exports.layerEffectControls = _chunkBOHDJJ2Ocjs.layerEffectControls; exports.layerEffectFields = _chunkDPYAO5U6cjs.layerEffectFields; exports.layerEffectLabel = _chunkDPYAO5U6cjs.layerEffectLabel; exports.layerEffectsBadge = _chunkBOHDJJ2Ocjs.layerEffectsBadge; exports.layerEffectsPanel = _chunkBOHDJJ2Ocjs.layerEffectsPanel; exports.mapLayer = _chunkDPYAO5U6cjs.mapLayer; exports.mergeLayerEffect = _chunkDPYAO5U6cjs.mergeLayerEffect; exports.mixPigment8 = _chunk2VX55NFMcjs.mixPigment8; exports.mixPigmentRgb = _chunk2VX55NFMcjs.mixPigmentRgb; exports.newEffectId = _chunkDPYAO5U6cjs.newEffectId; exports.normalizeBlendMode = _chunk2VX55NFMcjs.normalizeBlendMode; exports.normalizeLayerEffects = _chunkDPYAO5U6cjs.normalizeLayerEffects; exports.packRgba = _chunk474IQG74cjs.packRgba; exports.parseDataUrl = _chunkW5M3J7PVcjs.parseDataUrl; exports.parseEffectColor = _chunkDPYAO5U6cjs.parseEffectColor; exports.patchEffectMaps = _chunkDPYAO5U6cjs.patchEffectMaps; exports.pigment8 = _chunk2VX55NFMcjs.pigment8; exports.pngDataUrl = _chunkW5M3J7PVcjs.pngDataUrl; exports.proxyOf = _chunk2VX55NFMcjs.proxyOf; exports.readDeepRegion = _chunk2VX55NFMcjs.readDeepRegion; exports.readPixel = _chunk474IQG74cjs.readPixel; exports.readRegion = _chunk474IQG74cjs.readRegion; exports.reduceSurface = _chunkDPYAO5U6cjs.reduceSurface; exports.renderLayerEffects = _chunkDPYAO5U6cjs.renderLayerEffects; exports.scaleLayerEffect = _chunkDPYAO5U6cjs.scaleLayerEffect; exports.screenToWorld = screenToWorld; exports.setLum = _chunk2VX55NFMcjs.setLum; exports.solidSurface = _chunk474IQG74cjs.solidSurface; exports.srgbDecode = _chunk2VX55NFMcjs.srgbDecode; exports.srgbEncode = _chunk2VX55NFMcjs.srgbEncode; exports.standardBlendMode = _chunk2VX55NFMcjs.standardBlendMode; exports.surfaceBytes = _chunk474IQG74cjs.surfaceBytes; exports.surfaceDepth = _chunk2VX55NFMcjs.surfaceDepth; exports.surfaceFromDeepPixels = _chunk2VX55NFMcjs.surfaceFromDeepPixels; exports.surfaceFromPixels = _chunk474IQG74cjs.surfaceFromPixels; exports.surfaceMipLevel = surfaceMipLevel; exports.surfaceResolutionForZoom = surfaceResolutionForZoom; exports.surfaceToWorld = surfaceToWorld; exports.surfacesEqual = _chunk474IQG74cjs.surfacesEqual; exports.tileCoord = _chunk474IQG74cjs.tileCoord; exports.tileKey = _chunk474IQG74cjs.tileKey; exports.tileRect = _chunk474IQG74cjs.tileRect; exports.tileSamples = _chunk2VX55NFMcjs.tileSamples; exports.tileSamples16 = _chunk2VX55NFMcjs.tileSamples16; exports.tileSamples32 = _chunk2VX55NFMcjs.tileSamples32; exports.tilesInRect = _chunk474IQG74cjs.tilesInRect; exports.to16From32 = _chunk2VX55NFMcjs.to16From32; exports.to16From8 = _chunk2VX55NFMcjs.to16From8; exports.to32From16 = _chunk2VX55NFMcjs.to32From16; exports.to32From8 = _chunk2VX55NFMcjs.to32From8; exports.to8From16 = _chunk2VX55NFMcjs.to8From16; exports.to8From32 = _chunk2VX55NFMcjs.to8From32; exports.transformSurface = _chunkDPYAO5U6cjs.transformSurface; exports.transformedBounds = _chunkDPYAO5U6cjs.transformedBounds; exports.translateSurface = _chunk474IQG74cjs.translateSurface; exports.uniformTile = _chunk474IQG74cjs.uniformTile; exports.validateEffectGradient = _chunkDPYAO5U6cjs.validateEffectGradient; exports.validateLayerEffect = _chunkDPYAO5U6cjs.validateLayerEffect; exports.validateLayerEffects = _chunkDPYAO5U6cjs.validateLayerEffects; exports.visibleSurfaceRect = visibleSurfaceRect; exports.visibleWorldRect = visibleWorldRect; exports.warpSurface = _chunkDPYAO5U6cjs.warpSurface; exports.workingToSamples = _chunkDPYAO5U6cjs.workingToSamples; exports.worldRectToSurface = worldRectToSurface; exports.worldToSurface = worldToSurface; exports.writeDeepRegion = _chunk2VX55NFMcjs.writeDeepRegion; exports.writeRegion = _chunk474IQG74cjs.writeRegion;
|
package/dist/raster/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
layerEffectControls,
|
|
5
5
|
layerEffectsBadge,
|
|
6
6
|
layerEffectsPanel
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-2VJAVXLI.js";
|
|
8
8
|
import {
|
|
9
9
|
CURVE_LUT_SIZE,
|
|
10
10
|
DEFAULT_GLOBAL_LIGHT,
|
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
validateLayerEffects,
|
|
68
68
|
warpSurface,
|
|
69
69
|
workingToSamples
|
|
70
|
-
} from "../chunk-
|
|
70
|
+
} from "../chunk-3PPJRMIG.js";
|
|
71
71
|
import "../chunk-OHKOFKBY.js";
|
|
72
72
|
import {
|
|
73
73
|
DIRECT_GAUSSIAN_MAX_SIGMA,
|
|
@@ -78,32 +78,25 @@ import {
|
|
|
78
78
|
BLEND_MODES,
|
|
79
79
|
PAINTERLY_BLEND_MODES,
|
|
80
80
|
SHADOW_AMBIENT,
|
|
81
|
-
base64ToBytes,
|
|
82
81
|
blendChannel,
|
|
83
82
|
blendImageData,
|
|
84
83
|
blendLum,
|
|
85
84
|
blendPixel,
|
|
86
85
|
blendRgb,
|
|
87
|
-
bytesToBase64,
|
|
88
86
|
canvasCompositeOperation,
|
|
89
87
|
convertSurfaceDepth,
|
|
90
|
-
decodePng,
|
|
91
88
|
deepBytes,
|
|
92
89
|
deepTile,
|
|
93
90
|
depthOf,
|
|
94
|
-
encodePng,
|
|
95
91
|
isBitDepth,
|
|
96
92
|
isBlendMode,
|
|
97
93
|
isPainterlyBlendMode,
|
|
98
|
-
isPng,
|
|
99
94
|
isSeparableBlendMode,
|
|
100
95
|
keepDeepSamples,
|
|
101
96
|
mixPigment8,
|
|
102
97
|
mixPigmentRgb,
|
|
103
98
|
normalizeBlendMode,
|
|
104
|
-
parseDataUrl,
|
|
105
99
|
pigment8,
|
|
106
|
-
pngDataUrl,
|
|
107
100
|
proxyOf,
|
|
108
101
|
readDeepRegion,
|
|
109
102
|
setLum,
|
|
@@ -122,7 +115,16 @@ import {
|
|
|
122
115
|
to8From16,
|
|
123
116
|
to8From32,
|
|
124
117
|
writeDeepRegion
|
|
125
|
-
} from "../chunk-
|
|
118
|
+
} from "../chunk-IRSTHLQQ.js";
|
|
119
|
+
import {
|
|
120
|
+
base64ToBytes,
|
|
121
|
+
bytesToBase64,
|
|
122
|
+
decodePng,
|
|
123
|
+
encodePng,
|
|
124
|
+
isPng,
|
|
125
|
+
parseDataUrl,
|
|
126
|
+
pngDataUrl
|
|
127
|
+
} from "../chunk-OTTT5N3K.js";
|
|
126
128
|
import {
|
|
127
129
|
SurfaceDraft,
|
|
128
130
|
TILE,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `StickerBrowser`: the state behind a sticker picker, shared by the React and Svelte pickers. It
|
|
3
|
+
* searches or lists the provider a page at a time (search words, category), keeps the pages it
|
|
4
|
+
* has loaded and its categories, and tells listeners when anything changes. UI-agnostic.
|
|
5
|
+
*/
|
|
6
|
+
import type { StickerProvider, StickerRef, StickerSummary } from './types.cjs';
|
|
7
|
+
export interface StickerBrowserItem extends StickerSummary {
|
|
8
|
+
ref: StickerRef;
|
|
9
|
+
}
|
|
10
|
+
export interface StickerBrowserState {
|
|
11
|
+
query: string;
|
|
12
|
+
/** `''` for every category. */
|
|
13
|
+
category: string;
|
|
14
|
+
items: StickerBrowserItem[];
|
|
15
|
+
total: number;
|
|
16
|
+
/** More pages to load (`more()`). */
|
|
17
|
+
hasMore: boolean;
|
|
18
|
+
loading: boolean;
|
|
19
|
+
error: string | null;
|
|
20
|
+
categories: Array<{
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
count: number;
|
|
24
|
+
}>;
|
|
25
|
+
/** The provider's name. */
|
|
26
|
+
provider: string;
|
|
27
|
+
}
|
|
28
|
+
export declare class StickerBrowser {
|
|
29
|
+
private readonly provider;
|
|
30
|
+
private readonly pageSize;
|
|
31
|
+
private s;
|
|
32
|
+
private next;
|
|
33
|
+
private run;
|
|
34
|
+
private readonly listeners;
|
|
35
|
+
constructor(provider: () => StickerProvider, pageSize?: number);
|
|
36
|
+
get state(): StickerBrowserState;
|
|
37
|
+
subscribe(listener: () => void): () => void;
|
|
38
|
+
private set;
|
|
39
|
+
/** Loads the first page (and the categories) again, for the current provider. */
|
|
40
|
+
refresh(): Promise<void>;
|
|
41
|
+
/** Searches for `query` (words; `''` lists everything) from the first page. */
|
|
42
|
+
setQuery(query: string): Promise<void>;
|
|
43
|
+
/** Shows one category (`''` for all) from the first page. */
|
|
44
|
+
setCategory(category: string): Promise<void>;
|
|
45
|
+
/** Loads the next page onto the list. */
|
|
46
|
+
more(): Promise<void>;
|
|
47
|
+
private page;
|
|
48
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `StickerBrowser`: the state behind a sticker picker, shared by the React and Svelte pickers. It
|
|
3
|
+
* searches or lists the provider a page at a time (search words, category), keeps the pages it
|
|
4
|
+
* has loaded and its categories, and tells listeners when anything changes. UI-agnostic.
|
|
5
|
+
*/
|
|
6
|
+
import type { StickerProvider, StickerRef, StickerSummary } from './types.js';
|
|
7
|
+
export interface StickerBrowserItem extends StickerSummary {
|
|
8
|
+
ref: StickerRef;
|
|
9
|
+
}
|
|
10
|
+
export interface StickerBrowserState {
|
|
11
|
+
query: string;
|
|
12
|
+
/** `''` for every category. */
|
|
13
|
+
category: string;
|
|
14
|
+
items: StickerBrowserItem[];
|
|
15
|
+
total: number;
|
|
16
|
+
/** More pages to load (`more()`). */
|
|
17
|
+
hasMore: boolean;
|
|
18
|
+
loading: boolean;
|
|
19
|
+
error: string | null;
|
|
20
|
+
categories: Array<{
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
count: number;
|
|
24
|
+
}>;
|
|
25
|
+
/** The provider's name. */
|
|
26
|
+
provider: string;
|
|
27
|
+
}
|
|
28
|
+
export declare class StickerBrowser {
|
|
29
|
+
private readonly provider;
|
|
30
|
+
private readonly pageSize;
|
|
31
|
+
private s;
|
|
32
|
+
private next;
|
|
33
|
+
private run;
|
|
34
|
+
private readonly listeners;
|
|
35
|
+
constructor(provider: () => StickerProvider, pageSize?: number);
|
|
36
|
+
get state(): StickerBrowserState;
|
|
37
|
+
subscribe(listener: () => void): () => void;
|
|
38
|
+
private set;
|
|
39
|
+
/** Loads the first page (and the categories) again, for the current provider. */
|
|
40
|
+
refresh(): Promise<void>;
|
|
41
|
+
/** Searches for `query` (words; `''` lists everything) from the first page. */
|
|
42
|
+
setQuery(query: string): Promise<void>;
|
|
43
|
+
/** Shows one category (`''` for all) from the first page. */
|
|
44
|
+
setCategory(category: string): Promise<void>;
|
|
45
|
+
/** Loads the next page onto the list. */
|
|
46
|
+
more(): Promise<void>;
|
|
47
|
+
private page;
|
|
48
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StickerProvider } from './types.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* One provider over several, in order. Its ids are refs (`provider:id`, `namespaced`), so the
|
|
4
|
+
* same id from two libraries stays two stickers. Pages run through the providers in turn; the
|
|
5
|
+
* cursor is `<provider index>|<that provider's cursor>`. Capabilities are what any of them offers.
|
|
6
|
+
*/
|
|
7
|
+
export declare function combineStickerProviders(providers: readonly StickerProvider[], options?: {
|
|
8
|
+
id?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
}): StickerProvider;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StickerProvider } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* One provider over several, in order. Its ids are refs (`provider:id`, `namespaced`), so the
|
|
4
|
+
* same id from two libraries stays two stickers. Pages run through the providers in turn; the
|
|
5
|
+
* cursor is `<provider index>|<that provider's cursor>`. Capabilities are what any of them offers.
|
|
6
|
+
*/
|
|
7
|
+
export declare function combineStickerProviders(providers: readonly StickerProvider[], options?: {
|
|
8
|
+
id?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
}): StickerProvider;
|