@pixerate/editor 0.279.0 → 0.280.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.
@@ -42,7 +42,7 @@ import {
42
42
  resolveExternalAssets,
43
43
  serializeLayers,
44
44
  serializeLayersExternal
45
- } from "../chunk-FNIWHSLI.js";
45
+ } from "../chunk-NJDEKU5D.js";
46
46
  import "../chunk-ADMRNWR7.js";
47
47
  import "../chunk-WJ4WQJCC.js";
48
48
  import {
@@ -125,7 +125,7 @@ import {
125
125
  wetPaperInput,
126
126
  wetPigmentOf,
127
127
  withStrokePath
128
- } from "../chunk-HHX7ST6Z.js";
128
+ } from "../chunk-YOM76H2V.js";
129
129
  import {
130
130
  BRUSH_ID,
131
131
  BRUSH_PRESETS,
@@ -250,7 +250,7 @@ import {
250
250
  normalizeWetParams,
251
251
  pigmentOf,
252
252
  wetSupport
253
- } from "../chunk-CTHWXW5M.js";
253
+ } from "../chunk-V6LQND7D.js";
254
254
  import "../chunk-J23JOHPR.js";
255
255
  import {
256
256
  CoverageMap,
@@ -4,6 +4,7 @@ import type { VectorBooleanOperation } from './types.cjs';
4
4
  import { type VectorEffect } from './types.cjs';
5
5
  import { type VectorBlendMode, type VectorFilter, type VectorPaintLayer, type VectorStrokeLayer } from './types.cjs';
6
6
  import { type VectorMaskSummary } from './mask.cjs';
7
+ import { type VectorTracePixels } from './trace.cjs';
7
8
  import { type VectorLens, type VectorSymmetry } from './types.cjs';
8
9
  import { type VectorConnector } from './types.cjs';
9
10
  import { type VectorFrame, type VectorResizing } from './types.cjs';
@@ -14,7 +15,31 @@ export interface VectorCommandOptions {
14
15
  group?: string;
15
16
  /** Command scope. Omit for global commands. */
16
17
  scope?: string;
18
+ /**
19
+ * Loads an image that `vector.traceImage` and the stylise commands (`vector.mosaicImage`, …)
20
+ * are given by reference instead of as a PNG data URL: an http(s) or asset URL, or a host id
21
+ * such as a canvas node's. Agents can name an image but cannot write out its bytes, so without
22
+ * this they can only trace PNGs they produced themselves. Return `null` when there is no such
23
+ * image; throw (or reject) with a sentence when it cannot be loaded. `maxPixels` is the most the
24
+ * commands trace: scale larger images down to fit.
25
+ */
26
+ resolveImage?: VectorImageResolver;
27
+ /**
28
+ * What `resolveImage` accepts, for the `image` argument's description (default "an image
29
+ * URL"), e.g. "the id of an image node on the canvas, or an http(s) URL".
30
+ */
31
+ imageReferences?: string;
17
32
  }
33
+ /** An image a host loaded for a reference: RGBA pixels, or a PNG (data URL or bytes). */
34
+ export type VectorResolvedImage = {
35
+ image: VectorTracePixels;
36
+ } | {
37
+ png: string | Uint8Array;
38
+ };
39
+ /** See `VectorCommandOptions.resolveImage`. */
40
+ export type VectorImageResolver = (ref: string, options: {
41
+ maxPixels: number;
42
+ }) => VectorResolvedImage | null | undefined | Promise<VectorResolvedImage | null | undefined>;
18
43
  /** A node as listed for agents. */
19
44
  export interface VectorNodeListing {
20
45
  id: string;
@@ -4,6 +4,7 @@ import type { VectorBooleanOperation } from './types.js';
4
4
  import { type VectorEffect } from './types.js';
5
5
  import { type VectorBlendMode, type VectorFilter, type VectorPaintLayer, type VectorStrokeLayer } from './types.js';
6
6
  import { type VectorMaskSummary } from './mask.js';
7
+ import { type VectorTracePixels } from './trace.js';
7
8
  import { type VectorLens, type VectorSymmetry } from './types.js';
8
9
  import { type VectorConnector } from './types.js';
9
10
  import { type VectorFrame, type VectorResizing } from './types.js';
@@ -14,7 +15,31 @@ export interface VectorCommandOptions {
14
15
  group?: string;
15
16
  /** Command scope. Omit for global commands. */
16
17
  scope?: string;
18
+ /**
19
+ * Loads an image that `vector.traceImage` and the stylise commands (`vector.mosaicImage`, …)
20
+ * are given by reference instead of as a PNG data URL: an http(s) or asset URL, or a host id
21
+ * such as a canvas node's. Agents can name an image but cannot write out its bytes, so without
22
+ * this they can only trace PNGs they produced themselves. Return `null` when there is no such
23
+ * image; throw (or reject) with a sentence when it cannot be loaded. `maxPixels` is the most the
24
+ * commands trace: scale larger images down to fit.
25
+ */
26
+ resolveImage?: VectorImageResolver;
27
+ /**
28
+ * What `resolveImage` accepts, for the `image` argument's description (default "an image
29
+ * URL"), e.g. "the id of an image node on the canvas, or an http(s) URL".
30
+ */
31
+ imageReferences?: string;
17
32
  }
33
+ /** An image a host loaded for a reference: RGBA pixels, or a PNG (data URL or bytes). */
34
+ export type VectorResolvedImage = {
35
+ image: VectorTracePixels;
36
+ } | {
37
+ png: string | Uint8Array;
38
+ };
39
+ /** See `VectorCommandOptions.resolveImage`. */
40
+ export type VectorImageResolver = (ref: string, options: {
41
+ maxPixels: number;
42
+ }) => VectorResolvedImage | null | undefined | Promise<VectorResolvedImage | null | undefined>;
18
43
  /** A node as listed for agents. */
19
44
  export interface VectorNodeListing {
20
45
  id: string;