@pixerate/editor 0.88.0 → 0.89.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/THIRD_PARTY_NOTICES.md +8 -2
- package/dist/agent/index.cjs +28 -28
- package/dist/agent/index.js +3 -3
- package/dist/canvas/index.cjs +3 -3
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.js +16 -16
- package/dist/{chunk-TYOAJDFD.cjs → chunk-66IMF6OD.cjs} +3 -3
- package/dist/{chunk-TYOAJDFD.cjs.map → chunk-66IMF6OD.cjs.map} +1 -1
- package/dist/chunk-D4ZCU72J.js +604 -0
- package/dist/chunk-D4ZCU72J.js.map +1 -0
- package/dist/{chunk-IMSX4IVG.js → chunk-FWEO3HSL.js} +4 -4
- package/dist/chunk-H543GD6T.cjs +1696 -0
- package/dist/chunk-H543GD6T.cjs.map +1 -0
- package/dist/{chunk-ROXFP2LQ.cjs → chunk-HNDSPZ5T.cjs} +4 -4
- package/dist/{chunk-ROXFP2LQ.cjs.map → chunk-HNDSPZ5T.cjs.map} +1 -1
- package/dist/{chunk-MXF4DP2C.cjs → chunk-J3B45HTA.cjs} +74 -74
- package/dist/{chunk-MXF4DP2C.cjs.map → chunk-J3B45HTA.cjs.map} +1 -1
- package/dist/{chunk-GNO5PEMH.js → chunk-OK7T2LHK.js} +2 -2
- package/dist/chunk-P5TPUNBZ.js +1696 -0
- package/dist/chunk-P5TPUNBZ.js.map +1 -0
- package/dist/chunk-PDCITYBT.cjs +416 -0
- package/dist/chunk-PDCITYBT.cjs.map +1 -0
- package/dist/{chunk-RKJDBXTY.cjs → chunk-T4XWVPJK.cjs} +3 -3
- package/dist/{chunk-RKJDBXTY.cjs.map → chunk-T4XWVPJK.cjs.map} +1 -1
- package/dist/{chunk-ZQNDSUZO.js → chunk-UKI64KUD.js} +6 -6
- package/dist/{chunk-SVW2UNUC.js → chunk-WON34HKM.js} +2 -2
- package/dist/chunk-YLB2WVNA.js +416 -0
- package/dist/chunk-YLB2WVNA.js.map +1 -0
- package/dist/chunk-ZOOEX3WT.cjs +604 -0
- package/dist/chunk-ZOOEX3WT.cjs.map +1 -0
- package/dist/extensions/index.cjs +6 -6
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.js +5 -5
- package/dist/image-editor/index.cjs +4387 -690
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +1677 -590
- package/dist/image-editor/index.d.ts +1677 -590
- package/dist/image-editor/index.js +4273 -576
- package/dist/image-editor/index.js.map +1 -1
- package/dist/index.cjs +27 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -10
- package/dist/paint/index.cjs +38 -0
- package/dist/paint/index.cjs.map +1 -0
- package/dist/paint/index.d.cts +167 -0
- package/dist/paint/index.d.ts +167 -0
- package/dist/paint/index.js +38 -0
- package/dist/paint/index.js.map +1 -0
- package/dist/raster/index.cjs +121 -0
- package/dist/raster/index.cjs.map +1 -0
- package/dist/raster/index.d.cts +365 -0
- package/dist/raster/index.d.ts +365 -0
- package/dist/raster/index.js +121 -0
- package/dist/raster/index.js.map +1 -0
- package/dist/serializers/index.cjs +4 -4
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.js +3 -3
- package/dist/surface-fJhkmNQn.d.cts +181 -0
- package/dist/surface-fJhkmNQn.d.ts +181 -0
- package/package.json +13 -2
- package/skills/pixerate-image-editor/SKILL.md +111 -11
- /package/dist/{chunk-IMSX4IVG.js.map → chunk-FWEO3HSL.js.map} +0 -0
- /package/dist/{chunk-GNO5PEMH.js.map → chunk-OK7T2LHK.js.map} +0 -0
- /package/dist/{chunk-ZQNDSUZO.js.map → chunk-UKI64KUD.js.map} +0 -0
- /package/dist/{chunk-SVW2UNUC.js.map → chunk-WON34HKM.js.map} +0 -0
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { B as BlendMode, M as MaskSurface, P as PixelSurface, R as RasterRect, T as TiledSurface, h as TileKey } from '../surface-fJhkmNQn.js';
|
|
2
|
+
export { a as BLEND_MODES, b as BlendModeInfo, c as Rgb, d as Rgba, S as SurfaceDraft, e as TILE, f as TILE_SHIFT, g as Tile, i as blendChannel, j as blendImageData, k as blendLum, l as blendPixel, m as blendRgb, n as canvasCompositeOperation, o as collectTiles, p as contentBounds, q as emptySurface, r as fillRect, s as finishTile, t as isBlendMode, u as isSeparableBlendMode, v as normalizeBlendMode, w as packRgba, x as readPixel, y as readRegion, z as setLum, A as solidSurface, C as surfaceBytes, D as surfaceFromPixels, E as surfacesEqual, F as tileCoord, G as tileKey, H as tileRect, I as tilesInRect, J as translateSurface, K as uniformTile, L as writeRegion } from '../surface-fJhkmNQn.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A layer stack that is not specific to any editor: pixel layers on tiled surfaces, groups (with
|
|
6
|
+
* pass-through), raster masks with density and feather, clipping, locks, opacity, fill and blend
|
|
7
|
+
* modes, plus pure tree helpers. Editors extend these types with their own layer kinds (the image
|
|
8
|
+
* editor adds adjustment and annotation layers, filters and parametric masks).
|
|
9
|
+
*
|
|
10
|
+
* Layer objects are immutable: every change builds new objects along the path from the root to
|
|
11
|
+
* the changed layer and shares everything else.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Blend modes of a layer; groups also accept `pass-through`. */
|
|
15
|
+
type GroupBlendMode = BlendMode | 'pass-through';
|
|
16
|
+
interface LayerLocks {
|
|
17
|
+
/** Painting and filling are refused. */
|
|
18
|
+
pixels?: boolean;
|
|
19
|
+
/** Painting keeps each pixel's alpha. */
|
|
20
|
+
transparency?: boolean;
|
|
21
|
+
/** Moving (offset) is refused. */
|
|
22
|
+
position?: boolean;
|
|
23
|
+
/** Everything above, plus property changes and deletion. */
|
|
24
|
+
all?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A layer mask: 8-bit coverage (255 reveals, 0 hides) on a tiled surface, plus non-destructive
|
|
28
|
+
* density and feather. `source` is an editor-defined parametric mask (generated instead of
|
|
29
|
+
* painted; the compositor asks its profile for the coverage, and the surface is unused).
|
|
30
|
+
*/
|
|
31
|
+
interface RasterMask<Source = unknown> {
|
|
32
|
+
surface: MaskSurface;
|
|
33
|
+
/** Value outside the painted tiles (PSD's default colour); equals `surface.defaultValue`. */
|
|
34
|
+
defaultValue: 0 | 255;
|
|
35
|
+
/** 0..1 (missing = 1): at 0.5 hidden areas still show half. */
|
|
36
|
+
density?: number;
|
|
37
|
+
/** Gaussian σ in pixels (missing = 0). */
|
|
38
|
+
feather?: number;
|
|
39
|
+
/** `false` keeps the mask but ignores it. */
|
|
40
|
+
enabled?: boolean;
|
|
41
|
+
source?: Source;
|
|
42
|
+
}
|
|
43
|
+
interface RasterLayerBase {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
visible: boolean;
|
|
47
|
+
/** 0..1 */
|
|
48
|
+
opacity: number;
|
|
49
|
+
blend: BlendMode;
|
|
50
|
+
/** Clip to the nearest unclipped layer below (Photoshop's clipping mask). */
|
|
51
|
+
clipped?: boolean;
|
|
52
|
+
mask?: RasterMask;
|
|
53
|
+
locks?: LayerLocks;
|
|
54
|
+
}
|
|
55
|
+
interface RasterPixelLayer extends RasterLayerBase {
|
|
56
|
+
type: 'pixel';
|
|
57
|
+
/** Pixels in layer space; document position = layer position + `offset`. A mask moves with it. */
|
|
58
|
+
surface: PixelSurface;
|
|
59
|
+
/** Integer move without re-tiling. */
|
|
60
|
+
offset: {
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
};
|
|
64
|
+
/** 0..1, PSD "Fill" (missing = 1). */
|
|
65
|
+
fillOpacity?: number;
|
|
66
|
+
}
|
|
67
|
+
interface RasterGroupLayer<L = RasterLayer> extends Omit<RasterLayerBase, 'blend'> {
|
|
68
|
+
type: 'group';
|
|
69
|
+
blend: GroupBlendMode;
|
|
70
|
+
/** Bottom to top. */
|
|
71
|
+
children: L[];
|
|
72
|
+
/** UI only. */
|
|
73
|
+
collapsed?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/** The plain stack: pixel layers and groups. */
|
|
76
|
+
type RasterLayer = RasterPixelLayer | RasterGroupLayer<RasterLayer>;
|
|
77
|
+
/** What the tree helpers need of a layer: an id, a type, and `children` on groups. */
|
|
78
|
+
interface RasterNode {
|
|
79
|
+
id: string;
|
|
80
|
+
type: string;
|
|
81
|
+
}
|
|
82
|
+
/** The group members of a layer union. */
|
|
83
|
+
type GroupIn<T> = Extract<T, {
|
|
84
|
+
type: 'group';
|
|
85
|
+
}>;
|
|
86
|
+
interface LayerLocation<T extends RasterNode = RasterLayer> {
|
|
87
|
+
layer: T;
|
|
88
|
+
/** The containing group, or `null` at the top level. */
|
|
89
|
+
parent: GroupIn<T> | null;
|
|
90
|
+
/** Index within the parent's children (or the top-level list). */
|
|
91
|
+
index: number;
|
|
92
|
+
/** Ancestors from the top level down to the parent. */
|
|
93
|
+
path: GroupIn<T>[];
|
|
94
|
+
}
|
|
95
|
+
/** Every layer, depth first, bottom to top (a group comes before its children). */
|
|
96
|
+
declare function flattenLayers<T extends RasterNode>(layers: readonly T[]): T[];
|
|
97
|
+
declare function findLayer<T extends RasterNode>(layers: readonly T[], id: string): LayerLocation<T> | null;
|
|
98
|
+
/** Replaces the layer with `id` by `fn(layer)` (or removes it when `fn` returns `null`). */
|
|
99
|
+
declare function mapLayer<T extends RasterNode>(layers: readonly T[], id: string, fn: (layer: T) => T | null): T[];
|
|
100
|
+
/** Inserts `layer` into `parentId`'s children (or the top level) at `index` (default: top). */
|
|
101
|
+
declare function insertLayer<T extends RasterNode>(layers: readonly T[], layer: T, parentId: string | null, index?: number): T[];
|
|
102
|
+
declare function isLayerLocked(layer: {
|
|
103
|
+
locks?: LayerLocks;
|
|
104
|
+
}, what: keyof LayerLocks): boolean;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The per-tile layer compositor engine. Composites a layer stack (pixel layers and groups with
|
|
108
|
+
* masks, clipping, blend modes, opacity, fill and pass-through) tile by tile in document space,
|
|
109
|
+
* in pure TypeScript, so results are deterministic and testable in Node and Workers.
|
|
110
|
+
*
|
|
111
|
+
* Editors add their own layer kinds through a {@link CompositorProfile}: layers that filter
|
|
112
|
+
* what is below them (adjustment layers), content layers drawn by the editor (annotations),
|
|
113
|
+
* per-layer pixel filters, and parametric mask sources.
|
|
114
|
+
*
|
|
115
|
+
* Caches:
|
|
116
|
+
* - Each top-level *step* (a content layer and the layers clipped to it, a run of filter layers,
|
|
117
|
+
* a group) has a per-tile *signature*: its properties plus the identity of every surface tile
|
|
118
|
+
* it reads. A tile whose signatures are unchanged returns the cached result (same buffer
|
|
119
|
+
* object, so callers can skip uploading it).
|
|
120
|
+
* - A prefix cache keeps the accumulator *before* the step that changed last time (and, when the
|
|
121
|
+
* caller names it, before the active layer). Dragging a slider on layer k, or a stroke on layer
|
|
122
|
+
* k, recomposites from step k upwards only; `dirty` rectangles limit that to where it changed.
|
|
123
|
+
* - Spatial filters and feathered or parametric masks are computed once over the canvas and
|
|
124
|
+
* cached by the identity of their inputs.
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
/** What the compositor needs from its host besides the layers. */
|
|
128
|
+
interface RasterSources {
|
|
129
|
+
/** Canvas (document) size: spatial filters and mask feathering clamp at this rect. */
|
|
130
|
+
width: number;
|
|
131
|
+
height: number;
|
|
132
|
+
/** The pixels of a pixel layer (lets a host resolve layers whose pixels live elsewhere). */
|
|
133
|
+
surfaceOf?(layer: CompositorLayer): PixelSurface;
|
|
134
|
+
/** Changes whenever one of the host's callbacks would return something new for the same layers. */
|
|
135
|
+
version?: number | string;
|
|
136
|
+
}
|
|
137
|
+
/** The fields the engine reads; editor layer types are wider. */
|
|
138
|
+
interface CompositorLayer extends RasterNode {
|
|
139
|
+
visible: boolean;
|
|
140
|
+
opacity: number;
|
|
141
|
+
blend: string;
|
|
142
|
+
clipped?: boolean;
|
|
143
|
+
mask?: RasterMask;
|
|
144
|
+
/** Pixel layers. */
|
|
145
|
+
surface?: PixelSurface;
|
|
146
|
+
offset?: {
|
|
147
|
+
x: number;
|
|
148
|
+
y: number;
|
|
149
|
+
};
|
|
150
|
+
fillOpacity?: number;
|
|
151
|
+
/** Groups. */
|
|
152
|
+
children?: readonly CompositorLayer[];
|
|
153
|
+
}
|
|
154
|
+
/** A pixel layer's filters as the engine runs them. */
|
|
155
|
+
interface PixelFilterSpec {
|
|
156
|
+
/** Identifies the settings (part of the cache key). */
|
|
157
|
+
key: string;
|
|
158
|
+
/** Needs neighbouring pixels: runs once over the canvas instead of per tile. */
|
|
159
|
+
spatial: boolean;
|
|
160
|
+
/** Filters RGBA `data` (`width × height`) in place. */
|
|
161
|
+
apply(data: Uint8ClampedArray, width: number, height: number): void;
|
|
162
|
+
}
|
|
163
|
+
/** How an editor's own layer kinds composite. Every hook is optional. */
|
|
164
|
+
interface CompositorProfile<L extends CompositorLayer, S extends RasterSources> {
|
|
165
|
+
/** Layers that change what is below them; adjacent ones run as one step. */
|
|
166
|
+
isFilterLayer?(layer: L): boolean;
|
|
167
|
+
/** Applies a run of visible filter layers to `acc` (RGBA over `r`); `coverage` holds masked ones by id. */
|
|
168
|
+
applyFilterRun?(layers: L[], acc: Uint8ClampedArray, r: RasterRect, coverage: Map<string, Float32Array> | undefined, sources: S): void;
|
|
169
|
+
/** RGBA of a content layer that is neither a pixel layer nor a group, over `r`, or `null`. */
|
|
170
|
+
contentTile?(layer: L, r: RasterRect, sources: S): Uint8ClampedArray | null;
|
|
171
|
+
/** The blend mode a content layer draws with (default `layer.blend`). */
|
|
172
|
+
contentBlend?(layer: L): BlendMode;
|
|
173
|
+
/** Properties of a layer beyond the generic ones that change its pixels (part of its signature). */
|
|
174
|
+
layerKey?(layer: L): unknown;
|
|
175
|
+
/** Active filters of a pixel layer, or `null`. */
|
|
176
|
+
pixelFilters?(layer: L): PixelFilterSpec | null;
|
|
177
|
+
/** Canvas coverage (0..1, `width × height`) of a parametric mask source, or `null` to reveal all. */
|
|
178
|
+
maskSourcePlane?(source: unknown, width: number, height: number, sources: S): Float32Array | null;
|
|
179
|
+
}
|
|
180
|
+
interface CompositorOptions {
|
|
181
|
+
/** Upper bound for cached tile buffers (default 256 MiB). */
|
|
182
|
+
maxCacheBytes?: number;
|
|
183
|
+
}
|
|
184
|
+
interface CompositeCallOptions {
|
|
185
|
+
/**
|
|
186
|
+
* The layer about to be edited (the active layer): every tile composited in this call keeps a
|
|
187
|
+
* checkpoint below its step, so strokes and slider drags on it start there.
|
|
188
|
+
*/
|
|
189
|
+
checkpointLayerId?: string | null;
|
|
190
|
+
/**
|
|
191
|
+
* Where the layers changed since the previous call, when the caller knows (a stroke's dabs).
|
|
192
|
+
* Changed tiles are then recomposited only inside these rectangles. Changes outside them would
|
|
193
|
+
* be missed, so pass nothing when unsure.
|
|
194
|
+
*/
|
|
195
|
+
dirty?: RasterRect[];
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Blends straight-alpha `src` over `dst` (both RGBA) in place with `mode`, scaling the source
|
|
199
|
+
* alpha by `alpha` and, per pixel, by `coverage`. Same maths as `blendPixel`.
|
|
200
|
+
*/
|
|
201
|
+
declare function blendTile(dst: Uint8ClampedArray, src: ArrayLike<number>, mode: BlendMode, alpha: number, coverage: ArrayLike<number> | null): void;
|
|
202
|
+
/** Statistics of the last `composite` call (for benchmarks and tests). */
|
|
203
|
+
interface CompositeStats {
|
|
204
|
+
tiles: number;
|
|
205
|
+
/** Tiles returned straight from the cache. */
|
|
206
|
+
cached: number;
|
|
207
|
+
/** Steps actually run, summed over tiles. */
|
|
208
|
+
stepsRun: number;
|
|
209
|
+
}
|
|
210
|
+
declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S extends RasterSources = RasterSources> {
|
|
211
|
+
private readonly profile;
|
|
212
|
+
private readonly tiles;
|
|
213
|
+
private readonly maxCacheBytes;
|
|
214
|
+
private cacheBytes;
|
|
215
|
+
private stamp;
|
|
216
|
+
private sources;
|
|
217
|
+
private sourcesVersion;
|
|
218
|
+
private filteredCache;
|
|
219
|
+
private planeCache;
|
|
220
|
+
private planeIds;
|
|
221
|
+
private nextPlaneId;
|
|
222
|
+
private contentCache;
|
|
223
|
+
private readonly stepsCache;
|
|
224
|
+
private readonly propsKeyCache;
|
|
225
|
+
lastStats: CompositeStats;
|
|
226
|
+
private hint;
|
|
227
|
+
constructor(profile?: CompositorProfile<L, S>, options?: CompositorOptions);
|
|
228
|
+
/** Drops every cached tile and plane. */
|
|
229
|
+
clear(): void;
|
|
230
|
+
private setSources;
|
|
231
|
+
/** The composite of `layers` over `rect` as `rect.width × rect.height` RGBA (straight alpha). */
|
|
232
|
+
composite(layers: readonly L[], rect: RasterRect, sources: S, options?: CompositeCallOptions): Uint8ClampedArray;
|
|
233
|
+
/**
|
|
234
|
+
* Composites every tile intersecting `rect` and calls `onTile` with each tile's RGBA buffer
|
|
235
|
+
* (TILE × TILE). A tile whose inputs did not change since the last call returns the same buffer
|
|
236
|
+
* object; never mutate it.
|
|
237
|
+
*/
|
|
238
|
+
compositeTiles(layers: readonly L[], rect: RasterRect, sources: S, onTile: (tx: number, ty: number, data: Uint8ClampedArray, changed: boolean) => void, options?: CompositeCallOptions): void;
|
|
239
|
+
/** The composite of one tile (cached; do not mutate the result). */
|
|
240
|
+
tile(layers: readonly L[], tx: number, ty: number, sources: S): Uint8ClampedArray;
|
|
241
|
+
/**
|
|
242
|
+
* A layer's effective mask coverage (0..1, after density, feather or parametric evaluation)
|
|
243
|
+
* over `r` in document space, or `null` when it reveals all of `r`.
|
|
244
|
+
*/
|
|
245
|
+
maskCoverage(layer: L, r: RasterRect, sources: S): Float32Array | null;
|
|
246
|
+
private isFilter;
|
|
247
|
+
/**
|
|
248
|
+
* Groups a layer list into compositing steps: clipped layers join the nearest unclipped
|
|
249
|
+
* content or group layer below; consecutive unclipped filter layers form one run.
|
|
250
|
+
*/
|
|
251
|
+
private buildSteps;
|
|
252
|
+
/** The index of the top-level step that holds layer `id` (searching groups and clipped layers), or -1. */
|
|
253
|
+
private stepIndexOf;
|
|
254
|
+
/** Properties of a layer that change pixels, minus its surfaces (memoised per object). */
|
|
255
|
+
private propsKey;
|
|
256
|
+
private compositeTile;
|
|
257
|
+
private entryBytes;
|
|
258
|
+
private evict;
|
|
259
|
+
private stepSig;
|
|
260
|
+
private layerSig;
|
|
261
|
+
private groupSig;
|
|
262
|
+
private contentSig;
|
|
263
|
+
private maskRefs;
|
|
264
|
+
/**
|
|
265
|
+
* A pixel layer's pixels after spatial filters: the surface and the offset to apply. Layers
|
|
266
|
+
* with a spatial filter are filtered once over the canvas (in document space, offset 0).
|
|
267
|
+
*/
|
|
268
|
+
private layerPixels;
|
|
269
|
+
/** RGBA of a content layer over `r` (document space, inside one tile), or `null` when it has nothing there. */
|
|
270
|
+
private contentTile;
|
|
271
|
+
private planeKey;
|
|
272
|
+
/** Canvas-sized coverage of a feathered or parametric mask (cached). */
|
|
273
|
+
private planeFor;
|
|
274
|
+
private maskTile;
|
|
275
|
+
/** Runs one step onto `acc`; returns whether `acc` is still empty. */
|
|
276
|
+
private runStep;
|
|
277
|
+
private runSteps;
|
|
278
|
+
private contentBlend;
|
|
279
|
+
private blendOnto;
|
|
280
|
+
private applyClipped;
|
|
281
|
+
private applyFilterRun;
|
|
282
|
+
}
|
|
283
|
+
/** Tiles that differ between two surfaces (by tile identity), as tile keys. */
|
|
284
|
+
declare function changedTiles(a: TiledSurface, b: TiledSurface): TileKey[];
|
|
285
|
+
|
|
286
|
+
/** Above this σ a Gaussian is approximated by three box passes (cost independent of σ). */
|
|
287
|
+
declare const DIRECT_GAUSSIAN_MAX_SIGMA = 8;
|
|
288
|
+
/** How a blur treats pixels beyond the image: `zero`, or `clamp` (replicate the border). */
|
|
289
|
+
type BlurEdge = 'zero' | 'clamp';
|
|
290
|
+
type Edge = BlurEdge;
|
|
291
|
+
/**
|
|
292
|
+
* Separable Gaussian blur of a single-channel float image. `edge` `zero` treats pixels beyond
|
|
293
|
+
* the image as 0 (selection feather), `clamp` replicates the border (mask refinement). σ up to
|
|
294
|
+
* {@link DIRECT_GAUSSIAN_MAX_SIGMA} is convolved directly; wider blurs use three box passes, so
|
|
295
|
+
* the cost per pixel never grows with σ.
|
|
296
|
+
*/
|
|
297
|
+
declare function gaussianBlur(src: ArrayLike<number>, w: number, h: number, sigma: number, edge?: Edge): Float32Array;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Dependency-free, synchronous PNG encode / decode for layer pixels and masks, plus base64 and
|
|
301
|
+
* data-URL helpers. Canvas `toDataURL` is lossy for partly transparent pixels (it goes through
|
|
302
|
+
* premultiplied alpha), so layer assets use this codec and round-trip exactly.
|
|
303
|
+
*
|
|
304
|
+
* Encodes 8-bit greyscale (masks) or RGBA (layers). Decodes non-interlaced 1/2/4/8/16-bit
|
|
305
|
+
* greyscale, RGB, palette, grey + alpha and RGBA, always to 8-bit RGBA or grey.
|
|
306
|
+
*/
|
|
307
|
+
interface DecodedPng {
|
|
308
|
+
width: number;
|
|
309
|
+
height: number;
|
|
310
|
+
/** 4 for RGBA output, 1 for greyscale without alpha when `keepGray` was asked for. */
|
|
311
|
+
channels: 1 | 4;
|
|
312
|
+
data: Uint8ClampedArray;
|
|
313
|
+
}
|
|
314
|
+
/** PNG bytes for `width × height` pixels of 1 (grey) or 4 (RGBA) bytes each. */
|
|
315
|
+
declare function encodePng(width: number, height: number, data: ArrayLike<number>, channels?: 1 | 4): Uint8Array;
|
|
316
|
+
declare function isPng(bytes: Uint8Array): boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Decodes a PNG. Output is RGBA (4 channels) unless `keepGray` is set and the image is
|
|
319
|
+
* greyscale without alpha, in which case it is one byte per pixel.
|
|
320
|
+
*/
|
|
321
|
+
declare function decodePng(bytes: Uint8Array, options?: {
|
|
322
|
+
keepGray?: boolean;
|
|
323
|
+
maxPixels?: number;
|
|
324
|
+
}): DecodedPng;
|
|
325
|
+
declare function bytesToBase64(bytes: Uint8Array): string;
|
|
326
|
+
declare function base64ToBytes(text: string): Uint8Array;
|
|
327
|
+
/** The bytes and MIME type of a `data:` URL (base64 or percent-encoded). */
|
|
328
|
+
declare function parseDataUrl(url: string): {
|
|
329
|
+
mime: string;
|
|
330
|
+
bytes: Uint8Array;
|
|
331
|
+
} | null;
|
|
332
|
+
declare function pngDataUrl(width: number, height: number, data: ArrayLike<number>, channels?: 1 | 4): string;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Synchronous zlib (RFC 1950) and raw deflate (RFC 1951), dependency-free, for the image editor's
|
|
336
|
+
* layer PNGs and PSD ZIP channels. `CompressionStream` is asynchronous and not everywhere, and
|
|
337
|
+
* layer pixels must serialize inside the synchronous `toJSON()`.
|
|
338
|
+
*
|
|
339
|
+
* - `inflate` handles stored, fixed and dynamic blocks and refuses to produce more than
|
|
340
|
+
* `maxOutput` bytes (a decompression bomb guard).
|
|
341
|
+
* - `deflate` is a greedy LZ77 (hash chains, 32 KiB window) with one dynamic Huffman block per
|
|
342
|
+
* 64 Ki symbols. It favours simplicity over the last few percent of ratio.
|
|
343
|
+
*/
|
|
344
|
+
declare class ZlibError extends Error {
|
|
345
|
+
constructor(message: string);
|
|
346
|
+
}
|
|
347
|
+
/** Inflates raw deflate data (no zlib header). */
|
|
348
|
+
declare function inflateRaw(data: Uint8Array, options?: {
|
|
349
|
+
maxOutput?: number;
|
|
350
|
+
sizeHint?: number;
|
|
351
|
+
}): Uint8Array;
|
|
352
|
+
/** Adler-32 checksum (zlib trailer). */
|
|
353
|
+
declare function adler32(data: Uint8Array): number;
|
|
354
|
+
/** Inflates zlib data (header, deflate stream, Adler-32 trailer). */
|
|
355
|
+
declare function inflate(data: Uint8Array, options?: {
|
|
356
|
+
maxOutput?: number;
|
|
357
|
+
sizeHint?: number;
|
|
358
|
+
verify?: boolean;
|
|
359
|
+
}): Uint8Array;
|
|
360
|
+
/** Raw deflate (no zlib header). `level` 0 stores the data uncompressed. */
|
|
361
|
+
declare function deflateRaw(data: Uint8Array, level?: 0 | 1): Uint8Array;
|
|
362
|
+
/** zlib stream: header, raw deflate, Adler-32. */
|
|
363
|
+
declare function deflate(data: Uint8Array, level?: 0 | 1): Uint8Array;
|
|
364
|
+
|
|
365
|
+
export { BlendMode, type BlurEdge, type CompositeCallOptions, type CompositeStats, type CompositorLayer, type CompositorOptions, type CompositorProfile, DIRECT_GAUSSIAN_MAX_SIGMA, type DecodedPng, type GroupBlendMode, type GroupIn, type LayerLocation, type LayerLocks, MaskSurface, type PixelFilterSpec, PixelSurface, RasterCompositor, type RasterGroupLayer, type RasterLayer, type RasterLayerBase, type RasterMask, type RasterNode, type RasterPixelLayer, RasterRect, type RasterSources, TileKey, TiledSurface, ZlibError, adler32, base64ToBytes, blendTile, bytesToBase64, changedTiles, decodePng, deflate, deflateRaw, encodePng, findLayer, flattenLayers, gaussianBlur, inflate, inflateRaw, insertLayer, isLayerLocked, isPng, mapLayer, parseDataUrl, pngDataUrl };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DIRECT_GAUSSIAN_MAX_SIGMA,
|
|
3
|
+
RasterCompositor,
|
|
4
|
+
ZlibError,
|
|
5
|
+
adler32,
|
|
6
|
+
base64ToBytes,
|
|
7
|
+
blendTile,
|
|
8
|
+
bytesToBase64,
|
|
9
|
+
changedTiles,
|
|
10
|
+
decodePng,
|
|
11
|
+
deflate,
|
|
12
|
+
deflateRaw,
|
|
13
|
+
encodePng,
|
|
14
|
+
findLayer,
|
|
15
|
+
flattenLayers,
|
|
16
|
+
gaussianBlur,
|
|
17
|
+
inflate,
|
|
18
|
+
inflateRaw,
|
|
19
|
+
insertLayer,
|
|
20
|
+
isLayerLocked,
|
|
21
|
+
isPng,
|
|
22
|
+
mapLayer,
|
|
23
|
+
parseDataUrl,
|
|
24
|
+
pngDataUrl
|
|
25
|
+
} from "../chunk-P5TPUNBZ.js";
|
|
26
|
+
import {
|
|
27
|
+
BLEND_MODES,
|
|
28
|
+
SurfaceDraft,
|
|
29
|
+
TILE,
|
|
30
|
+
TILE_SHIFT,
|
|
31
|
+
TiledSurface,
|
|
32
|
+
blendChannel,
|
|
33
|
+
blendImageData,
|
|
34
|
+
blendLum,
|
|
35
|
+
blendPixel,
|
|
36
|
+
blendRgb,
|
|
37
|
+
canvasCompositeOperation,
|
|
38
|
+
collectTiles,
|
|
39
|
+
contentBounds,
|
|
40
|
+
emptySurface,
|
|
41
|
+
fillRect,
|
|
42
|
+
finishTile,
|
|
43
|
+
isBlendMode,
|
|
44
|
+
isSeparableBlendMode,
|
|
45
|
+
normalizeBlendMode,
|
|
46
|
+
packRgba,
|
|
47
|
+
readPixel,
|
|
48
|
+
readRegion,
|
|
49
|
+
setLum,
|
|
50
|
+
solidSurface,
|
|
51
|
+
surfaceBytes,
|
|
52
|
+
surfaceFromPixels,
|
|
53
|
+
surfacesEqual,
|
|
54
|
+
tileCoord,
|
|
55
|
+
tileKey,
|
|
56
|
+
tileRect,
|
|
57
|
+
tilesInRect,
|
|
58
|
+
translateSurface,
|
|
59
|
+
uniformTile,
|
|
60
|
+
writeRegion
|
|
61
|
+
} from "../chunk-D4ZCU72J.js";
|
|
62
|
+
export {
|
|
63
|
+
BLEND_MODES,
|
|
64
|
+
DIRECT_GAUSSIAN_MAX_SIGMA,
|
|
65
|
+
RasterCompositor,
|
|
66
|
+
SurfaceDraft,
|
|
67
|
+
TILE,
|
|
68
|
+
TILE_SHIFT,
|
|
69
|
+
TiledSurface,
|
|
70
|
+
ZlibError,
|
|
71
|
+
adler32,
|
|
72
|
+
base64ToBytes,
|
|
73
|
+
blendChannel,
|
|
74
|
+
blendImageData,
|
|
75
|
+
blendLum,
|
|
76
|
+
blendPixel,
|
|
77
|
+
blendRgb,
|
|
78
|
+
blendTile,
|
|
79
|
+
bytesToBase64,
|
|
80
|
+
canvasCompositeOperation,
|
|
81
|
+
changedTiles,
|
|
82
|
+
collectTiles,
|
|
83
|
+
contentBounds,
|
|
84
|
+
decodePng,
|
|
85
|
+
deflate,
|
|
86
|
+
deflateRaw,
|
|
87
|
+
emptySurface,
|
|
88
|
+
encodePng,
|
|
89
|
+
fillRect,
|
|
90
|
+
findLayer,
|
|
91
|
+
finishTile,
|
|
92
|
+
flattenLayers,
|
|
93
|
+
gaussianBlur,
|
|
94
|
+
inflate,
|
|
95
|
+
inflateRaw,
|
|
96
|
+
insertLayer,
|
|
97
|
+
isBlendMode,
|
|
98
|
+
isLayerLocked,
|
|
99
|
+
isPng,
|
|
100
|
+
isSeparableBlendMode,
|
|
101
|
+
mapLayer,
|
|
102
|
+
normalizeBlendMode,
|
|
103
|
+
packRgba,
|
|
104
|
+
parseDataUrl,
|
|
105
|
+
pngDataUrl,
|
|
106
|
+
readPixel,
|
|
107
|
+
readRegion,
|
|
108
|
+
setLum,
|
|
109
|
+
solidSurface,
|
|
110
|
+
surfaceBytes,
|
|
111
|
+
surfaceFromPixels,
|
|
112
|
+
surfacesEqual,
|
|
113
|
+
tileCoord,
|
|
114
|
+
tileKey,
|
|
115
|
+
tileRect,
|
|
116
|
+
tilesInRect,
|
|
117
|
+
translateSurface,
|
|
118
|
+
uniformTile,
|
|
119
|
+
writeRegion
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkHNDSPZ5Tcjs = require('../chunk-HNDSPZ5T.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -27,14 +27,14 @@ var _chunkROXFP2LQcjs = require('../chunk-ROXFP2LQ.cjs');
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
var
|
|
31
|
-
require('../chunk-IFHKKVXH.cjs');
|
|
30
|
+
var _chunk66IMF6ODcjs = require('../chunk-66IMF6OD.cjs');
|
|
32
31
|
|
|
33
32
|
|
|
34
33
|
|
|
35
34
|
|
|
36
35
|
|
|
37
36
|
var _chunkBVP3TSLHcjs = require('../chunk-BVP3TSLH.cjs');
|
|
37
|
+
require('../chunk-IFHKKVXH.cjs');
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
@@ -65,5 +65,5 @@ var _chunkBVP3TSLHcjs = require('../chunk-BVP3TSLH.cjs');
|
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
exports.MARKDOWN_MENTION_SPLIT_REGEX =
|
|
68
|
+
exports.MARKDOWN_MENTION_SPLIT_REGEX = _chunk66IMF6ODcjs.MARKDOWN_MENTION_SPLIT_REGEX; exports.MENTION_REGEX = _chunkBVP3TSLHcjs.MENTION_REGEX; exports.PIXERATE_DOCUMENT_MIME = _chunkHNDSPZ5Tcjs.PIXERATE_DOCUMENT_MIME; exports.escapeHtml = _chunk66IMF6ODcjs.escapeHtml; exports.extractMentions = _chunk66IMF6ODcjs.extractMentions; exports.extractMentionsFromDoc = _chunk66IMF6ODcjs.extractMentionsFromDoc; exports.findTextMentions = _chunkBVP3TSLHcjs.findTextMentions; exports.formatMentionText = _chunkBVP3TSLHcjs.formatMentionText; exports.getClipboardData = _chunkHNDSPZ5Tcjs.getClipboardData; exports.getEditorMarkdown = _chunk66IMF6ODcjs.getEditorMarkdown; exports.getEditorText = _chunk66IMF6ODcjs.getEditorText; exports.getSchemaSignature = _chunkHNDSPZ5Tcjs.getSchemaSignature; exports.htmlToPlainText = _chunk66IMF6ODcjs.htmlToPlainText; exports.markdownToTipTapHtml = _chunk66IMF6ODcjs.markdownToTipTapHtml; exports.parseMentionSegments = _chunk66IMF6ODcjs.parseMentionSegments; exports.parseRichClipboardPayload = _chunkHNDSPZ5Tcjs.parseRichClipboardPayload; exports.plainTextToParagraphHtml = _chunkHNDSPZ5Tcjs.plainTextToParagraphHtml; exports.plainTextToSlice = _chunk66IMF6ODcjs.plainTextToSlice; exports.plainTextToTipTapHtml = _chunk66IMF6ODcjs.plainTextToTipTapHtml; exports.preprocessMarkdownFileLinks = _chunk66IMF6ODcjs.preprocessMarkdownFileLinks; exports.preprocessMarkdownMentions = _chunk66IMF6ODcjs.preprocessMarkdownMentions; exports.readRichClipboard = _chunkHNDSPZ5Tcjs.readRichClipboard; exports.rtfToPlainText = _chunkHNDSPZ5Tcjs.rtfToPlainText; exports.sanitizeHtml = _chunk66IMF6ODcjs.sanitizeHtml; exports.sanitizeImportedHtml = _chunkHNDSPZ5Tcjs.sanitizeImportedHtml; exports.serializeRichClipboardPayload = _chunkHNDSPZ5Tcjs.serializeRichClipboardPayload; exports.setMentionRoleInText = _chunkBVP3TSLHcjs.setMentionRoleInText; exports.splitMarkdownMentionParts = _chunk66IMF6ODcjs.splitMarkdownMentionParts; exports.stripMarkdownCode = _chunk66IMF6ODcjs.stripMarkdownCode;
|
|
69
69
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/serializers/index.cjs"],"names":[],"mappings":"AAAA,0GAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/serializers/index.cjs"],"names":[],"mappings":"AAAA,0GAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,w9DAAC","file":"/home/runner/work/editor/editor/packages/core/dist/serializers/index.cjs"}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
rtfToPlainText,
|
|
10
10
|
sanitizeImportedHtml,
|
|
11
11
|
serializeRichClipboardPayload
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-WON34HKM.js";
|
|
13
13
|
import {
|
|
14
14
|
MARKDOWN_MENTION_SPLIT_REGEX,
|
|
15
15
|
escapeHtml,
|
|
@@ -27,14 +27,14 @@ import {
|
|
|
27
27
|
sanitizeHtml,
|
|
28
28
|
splitMarkdownMentionParts,
|
|
29
29
|
stripMarkdownCode
|
|
30
|
-
} from "../chunk-
|
|
31
|
-
import "../chunk-SWE3NPOU.js";
|
|
30
|
+
} from "../chunk-UKI64KUD.js";
|
|
32
31
|
import {
|
|
33
32
|
MENTION_REGEX,
|
|
34
33
|
findTextMentions,
|
|
35
34
|
formatMentionText,
|
|
36
35
|
setMentionRoleInText
|
|
37
36
|
} from "../chunk-O5RYH2PG.js";
|
|
37
|
+
import "../chunk-SWE3NPOU.js";
|
|
38
38
|
export {
|
|
39
39
|
MARKDOWN_MENTION_SPLIT_REGEX,
|
|
40
40
|
MENTION_REGEX,
|