@pixerate/editor 0.258.0 → 0.260.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.
Files changed (78) hide show
  1. package/dist/agent/index.cjs +2 -2
  2. package/dist/agent/index.js +1 -1
  3. package/dist/animation-editor/index.cjs +61 -59
  4. package/dist/animation-editor/index.js +5 -3
  5. package/dist/brushes/contract.d.cts +24 -0
  6. package/dist/brushes/contract.d.ts +24 -0
  7. package/dist/brushes/index.cjs +146 -31
  8. package/dist/brushes/index.d.cts +1 -0
  9. package/dist/brushes/index.d.ts +1 -0
  10. package/dist/brushes/index.js +121 -6
  11. package/dist/{brushstrokeRender-JI4W6F2G.js → brushstrokeRender-25Q5BEY6.js} +17 -7
  12. package/dist/{brushstrokeRender-MQ6PSDM5.cjs → brushstrokeRender-N6UPZSQS.cjs} +31 -21
  13. package/dist/canvas/brushTypes.d.cts +5 -0
  14. package/dist/canvas/brushTypes.d.ts +5 -0
  15. package/dist/canvas/drawController.d.cts +15 -1
  16. package/dist/canvas/drawController.d.ts +15 -1
  17. package/dist/canvas/index.cjs +136 -102
  18. package/dist/canvas/index.js +35 -1
  19. package/dist/{chunk-3PPJRMIG.js → chunk-3O47TPGX.js} +197 -18
  20. package/dist/{chunk-5Q5MLXAD.cjs → chunk-3TQW5MPW.cjs} +23 -23
  21. package/dist/{chunk-JBBJE76O.cjs → chunk-3ZRNK3RO.cjs} +1138 -85
  22. package/dist/{chunk-YSGW7VV4.cjs → chunk-43NT242D.cjs} +1401 -228
  23. package/dist/{chunk-SMTUQWGY.js → chunk-5IW65VQ6.js} +1 -1
  24. package/dist/{chunk-YQ4PQTBB.js → chunk-6NZL24W4.js} +9 -1
  25. package/dist/{chunk-O3ZVZSNJ.cjs → chunk-7AUQ2UJ3.cjs} +137 -129
  26. package/dist/{chunk-4M4E3N6X.js → chunk-CQVTGBQI.js} +1 -1
  27. package/dist/{chunk-SSFMWJDK.js → chunk-D4TE5JNW.js} +1192 -19
  28. package/dist/{chunk-AORZ5M5C.js → chunk-EHALWBBD.js} +1 -1
  29. package/dist/{chunk-6WCQ35GI.cjs → chunk-NHA26O5X.cjs} +2 -2
  30. package/dist/{chunk-DPYAO5U6.cjs → chunk-PVJMTLPJ.cjs} +197 -18
  31. package/dist/{chunk-MQGQTKVW.cjs → chunk-PYTJBVW5.cjs} +29 -29
  32. package/dist/{chunk-IXQZHCOF.js → chunk-QAR2N7HZ.js} +1 -1
  33. package/dist/{chunk-5P4JEOIV.js → chunk-TMDDMJCR.js} +2 -2
  34. package/dist/{chunk-RSIKDWOP.cjs → chunk-TZOX7KWV.cjs} +15 -15
  35. package/dist/{chunk-IPUTIUGQ.cjs → chunk-UVZ7RQOE.cjs} +1 -1
  36. package/dist/{chunk-A7GJ6BXI.js → chunk-WJ4WQJCC.js} +1062 -9
  37. package/dist/{chunk-ICTPLVSR.js → chunk-X2EXYY4J.js} +1 -1
  38. package/dist/{chunk-WQCNC4DK.js → chunk-XC6DPRYI.js} +695 -4
  39. package/dist/{chunk-KBYB7OWB.cjs → chunk-YHDHFJUC.cjs} +776 -85
  40. package/dist/{chunk-P3PZ63M3.cjs → chunk-YLUIFXSL.cjs} +35 -35
  41. package/dist/commands/index.cjs +2 -2
  42. package/dist/commands/index.js +1 -1
  43. package/dist/image-editor/index.cjs +1385 -2484
  44. package/dist/image-editor/index.js +139 -1238
  45. package/dist/image-editor/selection-worker.cjs +3 -4
  46. package/dist/image-editor/selection-worker.js +1 -2
  47. package/dist/paint/index.cjs +3 -5
  48. package/dist/paint/index.js +40 -42
  49. package/dist/paint-editor/contract.d.cts +29 -0
  50. package/dist/paint-editor/contract.d.ts +29 -0
  51. package/dist/paint-editor/dab-stroke.d.cts +5 -0
  52. package/dist/paint-editor/dab-stroke.d.ts +5 -0
  53. package/dist/paint-editor/index.cjs +402 -258
  54. package/dist/paint-editor/index.d.cts +1 -0
  55. package/dist/paint-editor/index.d.ts +1 -0
  56. package/dist/paint-editor/index.js +197 -53
  57. package/dist/paint-editor/stamp-tip.d.cts +17 -0
  58. package/dist/paint-editor/stamp-tip.d.ts +17 -0
  59. package/dist/paint-editor/ui.d.cts +21 -1
  60. package/dist/paint-editor/ui.d.ts +21 -1
  61. package/dist/raster/index.cjs +2 -4
  62. package/dist/raster/index.js +6 -8
  63. package/dist/vector/brushstroke.d.cts +6 -0
  64. package/dist/vector/brushstroke.d.ts +6 -0
  65. package/dist/vector/controller.d.cts +11 -2
  66. package/dist/vector/controller.d.ts +11 -2
  67. package/dist/vector/index.cjs +990 -973
  68. package/dist/vector/index.js +28 -11
  69. package/package.json +1 -1
  70. package/skills/pixerate-brushes/SKILL.md +1 -1
  71. package/skills/pixerate-canvas/SKILL.md +3 -1
  72. package/skills/pixerate-vector/SKILL.md +2 -2
  73. package/dist/chunk-2VJAVXLI.js +0 -192
  74. package/dist/chunk-62Z5WLRA.js +0 -700
  75. package/dist/chunk-BOHDJJ2O.cjs +0 -192
  76. package/dist/chunk-NKGB64CW.cjs +0 -700
  77. package/dist/chunk-SS53NNZO.cjs +0 -1066
  78. package/dist/chunk-ZNA3IQZF.js +0 -1066
@@ -1,9 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkIPUTIUGQcjs = require('./chunk-IPUTIUGQ.cjs');
4
-
5
-
6
- var _chunkA2IS7EHEcjs = require('./chunk-A2IS7EHE.cjs');
3
+ var _chunkUVZ7RQOEcjs = require('./chunk-UVZ7RQOE.cjs');
7
4
 
8
5
 
9
6
 
@@ -14,13 +11,16 @@ var _chunkA2IS7EHEcjs = require('./chunk-A2IS7EHE.cjs');
14
11
 
15
12
 
16
13
 
17
- var _chunkRSIKDWOPcjs = require('./chunk-RSIKDWOP.cjs');
14
+ var _chunkTZOX7KWVcjs = require('./chunk-TZOX7KWV.cjs');
18
15
  require('./chunk-JSDND7DF.cjs');
19
16
 
20
17
 
21
18
 
22
19
 
23
20
  var _chunkNM3G4VQTcjs = require('./chunk-NM3G4VQT.cjs');
21
+
22
+
23
+ var _chunkA2IS7EHEcjs = require('./chunk-A2IS7EHE.cjs');
24
24
  require('./chunk-U67EN7GG.cjs');
25
25
  require('./chunk-WOFXZ3XU.cjs');
26
26
 
@@ -38,27 +38,37 @@ require('./chunk-2VX55NFM.cjs');
38
38
  require('./chunk-474IQG74.cjs');
39
39
  require('./chunk-XFM3OCHU.cjs');
40
40
 
41
+
42
+ var _chunkMLLTWAXHcjs = require('./chunk-MLLTWAXH.cjs');
43
+ require('./chunk-SXQHWXEL.cjs');
44
+ require('./chunk-5UEFBM2M.cjs');
45
+ require('./chunk-IPJ3TEYR.cjs');
46
+
41
47
  // src/canvas/brushstrokeRender.ts
42
- var PRESETS = _chunkRSIKDWOPcjs.listPresets.call(void 0, _chunkRSIKDWOPcjs.CANVAS_PROFILE).map((spec) => _chunkRSIKDWOPcjs.BUILTIN_BRUSHES.find((b) => b.id === spec.id));
48
+ var PRESETS = _chunkTZOX7KWVcjs.listPresets.call(void 0, _chunkTZOX7KWVcjs.CANVAS_PROFILE).map((spec) => _chunkTZOX7KWVcjs.BUILTIN_BRUSHES.find((b) => b.id === spec.id));
43
49
  var presetIds = () => PRESETS.map((b) => b.id).join(", ");
44
- var refusal = (brush) => _chunkRSIKDWOPcjs.checkBrush.call(void 0, brush, _chunkRSIKDWOPcjs.CANVAS_PROFILE).issues.filter((i) => i.severity === "error").map((i) => `${i.reason} ${i.fix}`).join(" ");
50
+ var refusal = (brush) => _chunkTZOX7KWVcjs.checkBrush.call(void 0, brush, _chunkTZOX7KWVcjs.CANVAS_PROFILE).issues.filter((i) => i.severity === "error").map((i) => `${i.reason} ${i.fix}`).join(" ");
45
51
  function readCanvasBrushSpec(spec) {
46
52
  let brush;
47
53
  try {
48
- brush = _chunkRSIKDWOPcjs.normalizeBrushSpec.call(void 0, spec);
54
+ brush = _chunkTZOX7KWVcjs.normalizeBrushSpec.call(void 0, spec);
49
55
  } catch (e) {
50
56
  throw new Error(`Not a brush: ${e.message}`);
51
57
  }
52
- if (!_chunkRSIKDWOPcjs.checkBrush.call(void 0, brush, _chunkRSIKDWOPcjs.CANVAS_PROFILE).ok) throw new Error(`Brush '${brush.id}' (${brush.name}) can't brush a canvas stroke: ${refusal(brush)}`);
58
+ if (!_chunkTZOX7KWVcjs.checkBrush.call(void 0, brush, _chunkTZOX7KWVcjs.CANVAS_PROFILE).ok) throw new Error(`Brush '${brush.id}' (${brush.name}) can't brush a canvas stroke: ${refusal(brush)}`);
53
59
  return brush;
54
60
  }
55
61
  function listCanvasBrushes(user = []) {
56
- const out = PRESETS.map((b) => ({ id: b.id, name: b.name, category: b.category, size: b.tip.size, builtin: true }));
62
+ const colourOf = (spec) => {
63
+ const d = _optionalChain([spec, 'access', _2 => _2.colour, 'optionalAccess', _3 => _3.default]);
64
+ return typeof d === "string" || _chunkMLLTWAXHcjs.isDualColor.call(void 0, d) ? { defaultColor: d } : {};
65
+ };
66
+ const out = PRESETS.map((b) => ({ id: b.id, name: b.name, category: b.category, size: b.tip.size, builtin: true, ...colourOf(_chunkTZOX7KWVcjs.BRUSH_PRESETS.find((p) => p.id === b.id)) }));
57
67
  for (const raw of user) {
58
68
  try {
59
69
  const brush = readCanvasBrushSpec(raw);
60
70
  if (out.some((b) => b.id === brush.id)) continue;
61
- out.push({ id: brush.id, name: brush.name, category: _chunkRSIKDWOPcjs.resolveCategory.call(void 0, brush), size: _chunkRSIKDWOPcjs.resolveBrush.call(void 0, brush).tip.size, builtin: false, spec: brush });
71
+ out.push({ id: brush.id, name: brush.name, category: _chunkTZOX7KWVcjs.resolveCategory.call(void 0, brush), size: _chunkTZOX7KWVcjs.resolveBrush.call(void 0, brush).tip.size, builtin: false, spec: brush, ...colourOf(brush) });
62
72
  } catch (e2) {
63
73
  }
64
74
  }
@@ -69,15 +79,15 @@ function resolveCanvasBrush(brush, width, spec) {
69
79
  const sized = (b) => given === void 0 ? b : { ...b, tip: { ...b.tip, size: given } };
70
80
  if (typeof brush === "string") {
71
81
  if (spec !== void 0 && spec !== null) {
72
- const saved = _chunkRSIKDWOPcjs.resolveBrush.call(void 0, readCanvasBrushSpec(spec));
82
+ const saved = _chunkTZOX7KWVcjs.resolveBrush.call(void 0, readCanvasBrushSpec(spec));
73
83
  if (!_chunkPXDIAYB6cjs.isBrushstrokeBrush.call(void 0, saved)) throw new Error(`Brush '${saved.id}' (${saved.name}) can't brush a canvas stroke: it is not a dry dab brush.`);
74
84
  return sized(saved);
75
85
  }
76
86
  const preset = PRESETS.find((b) => b.id === brush);
77
87
  if (preset) return sized(preset);
78
- const other = _chunkRSIKDWOPcjs.BRUSH_PRESETS.find((b) => b.id === brush);
88
+ const other = _chunkTZOX7KWVcjs.BRUSH_PRESETS.find((b) => b.id === brush);
79
89
  if (other) throw new Error(`Brush '${brush}' (${other.name}) can't brush a canvas stroke: ${refusal(other)} Use one of: ${presetIds()}, or a saved brush the canvas can paint.`);
80
- throw new Error(`Unknown brush '${brush}'. ${_chunkRSIKDWOPcjs.closest.call(void 0, brush, PRESETS.map((b) => b.id))}Use one of the dry presets (${presetIds()}), a saved brush from the brush library, or tip settings ({ hardness, spacing, flow, \u2026 }).`);
90
+ throw new Error(`Unknown brush '${brush}'. ${_chunkTZOX7KWVcjs.closest.call(void 0, brush, PRESETS.map((b) => b.id))}Use one of the dry presets (${presetIds()}), a saved brush from the brush library, or tip settings ({ hardness, spacing, flow, \u2026 }).`);
81
91
  }
82
92
  if (!brush || typeof brush !== "object" || Array.isArray(brush)) {
83
93
  throw new Error("A brush is a preset or saved brush id (see listCanvasBrushes / canvas.listBrushes) or an object of tip settings.");
@@ -101,7 +111,7 @@ function shapePaint(shape) {
101
111
  }
102
112
  function strokeColor(shape) {
103
113
  const gradient = _chunkNM3G4VQTcjs.resolveCanvasGradient.call(void 0, _nullishCoalesce(shape.strokeGradient, () => ( shape.stroke)));
104
- const css = gradient ? _nullishCoalesce(_optionalChain([gradient, 'access', _2 => _2.stops, 'access', _3 => _3[0], 'optionalAccess', _4 => _4.color]), () => ( "#000")) : typeof shape.stroke === "string" && shape.stroke !== "none" ? shape.stroke : "#000";
114
+ const css = gradient ? _nullishCoalesce(_optionalChain([gradient, 'access', _4 => _4.stops, 'access', _5 => _5[0], 'optionalAccess', _6 => _6.color]), () => ( "#000")) : typeof shape.stroke === "string" && shape.stroke !== "none" ? shape.stroke : "#000";
105
115
  const parsed = _nullishCoalesce(_chunkA2IS7EHEcjs.parseCssColor.call(void 0, css), () => ( { hex: "#000000", alpha: 1 }));
106
116
  const n = parseInt(parsed.hex.slice(1), 16);
107
117
  return [n >> 16 & 255, n >> 8 & 255, n & 255, Math.round(parsed.alpha * 255)];
@@ -113,14 +123,14 @@ function renderShapeBrushstrokeNow(shape, scale, place = {}) {
113
123
  const textured = typeof seed === "number" && Number.isFinite(seed);
114
124
  const size = _nullishCoalesce(shape.brush.size, () => ( (textured ? void 0 : _nullishCoalesce(shape.strokeWidth, () => ( 3)))));
115
125
  const brush = resolveCanvasBrush(shape.brush.brush, size, shape.brush.spec);
116
- const points = _chunkIPUTIUGQcjs.pathDataToPolyline.call(void 0, shape.d);
126
+ const points = _chunkUVZ7RQOEcjs.pathDataToPolyline.call(void 0, shape.d);
117
127
  if (!points.length) return null;
118
128
  const { pressure, tiltX, tiltY } = shape.brush;
119
129
  const input = {
120
130
  points: points.map(([x, y]) => ({ x, y })),
121
- ..._optionalChain([pressure, 'optionalAccess', _5 => _5.length]) ? { pressure } : {},
122
- ..._optionalChain([tiltX, 'optionalAccess', _6 => _6.length]) ? { tiltX } : {},
123
- ..._optionalChain([tiltY, 'optionalAccess', _7 => _7.length]) ? { tiltY } : {}
131
+ ..._optionalChain([pressure, 'optionalAccess', _7 => _7.length]) ? { pressure } : {},
132
+ ..._optionalChain([tiltX, 'optionalAccess', _8 => _8.length]) ? { tiltX } : {},
133
+ ..._optionalChain([tiltY, 'optionalAccess', _9 => _9.length]) ? { tiltY } : {}
124
134
  };
125
135
  const paint = shapePaint(shape);
126
136
  const character = textured ? {
@@ -128,7 +138,7 @@ function renderShapeBrushstrokeNow(shape, scale, place = {}) {
128
138
  seed,
129
139
  ...shape.brush.paper !== void 0 ? { paper: shape.brush.paper } : {},
130
140
  // Whole canvas units: the grain stays put, and tiny drags do not re-render.
131
- origin: { x: Math.round(_nullishCoalesce(_optionalChain([place, 'access', _8 => _8.origin, 'optionalAccess', _9 => _9.x]), () => ( 0))), y: Math.round(_nullishCoalesce(_optionalChain([place, 'access', _10 => _10.origin, 'optionalAccess', _11 => _11.y]), () => ( 0))) },
141
+ origin: { x: Math.round(_nullishCoalesce(_optionalChain([place, 'access', _10 => _10.origin, 'optionalAccess', _11 => _11.x]), () => ( 0))), y: Math.round(_nullishCoalesce(_optionalChain([place, 'access', _12 => _12.origin, 'optionalAccess', _13 => _13.y]), () => ( 0))) },
132
142
  unit: place.unit && place.unit > 0 ? Math.round(place.unit * 1e3) / 1e3 : 1
133
143
  }
134
144
  } : {};
@@ -163,7 +173,7 @@ function brushSwatchNow(brush, options, spec) {
163
173
  { kind: "path", d, stroke: _nullishCoalesce(options.color, () => ( "#1f2937")), strokeWidth: size, brush: { brush, ...spec ? { spec } : {}, seed: 7, size, pressure: [0.35, 1, 0.5] } },
164
174
  options.scale && options.scale > 0 ? options.scale : 2
165
175
  );
166
- return _nullishCoalesce(_optionalChain([image, 'optionalAccess', _12 => _12.href]), () => ( ""));
176
+ return _nullishCoalesce(_optionalChain([image, 'optionalAccess', _14 => _14.href]), () => ( ""));
167
177
  }
168
178
 
169
179
 
@@ -145,6 +145,11 @@ export interface CanvasBrushPreset {
145
145
  builtin?: boolean;
146
146
  /** A saved brush's facets: set `brushSpec` to it with `brush` when picking it. */
147
147
  spec?: CanvasBrushSpec;
148
+ /** The brush's solid default colour, or its light / dark pair: what picking it makes the stroke colour (`selectBrush`). */
149
+ defaultColor?: string | {
150
+ light: string;
151
+ dark: string;
152
+ };
148
153
  /** The preset's own tip diameter in canvas units: a new brushed stroke's default size. */
149
154
  size: number;
150
155
  }
@@ -145,6 +145,11 @@ export interface CanvasBrushPreset {
145
145
  builtin?: boolean;
146
146
  /** A saved brush's facets: set `brushSpec` to it with `brush` when picking it. */
147
147
  spec?: CanvasBrushSpec;
148
+ /** The brush's solid default colour, or its light / dark pair: what picking it makes the stroke colour (`selectBrush`). */
149
+ defaultColor?: string | {
150
+ light: string;
151
+ dark: string;
152
+ };
148
153
  /** The preset's own tip diameter in canvas units: a new brushed stroke's default size. */
149
154
  size: number;
150
155
  }
@@ -7,6 +7,7 @@ import type { CanvasNode, Point } from './types.cjs';
7
7
  import { type FreehandDrawOptions, type FreehandPenSample, type FreehandStroke, type FreehandStrokeStyle, type FreehandTool } from './freehand.cjs';
8
8
  import { type CanvasBrush } from './brushstroke.cjs';
9
9
  import type { BrushLibrary } from '../brushes/library.cjs';
10
+ import type { CanvasBrushPreset } from './brushTypes.cjs';
10
11
  /** A stroke drawn by code or an agent (`drawStroke`). */
11
12
  export interface DrawStrokeInput {
12
13
  /** Points in canvas (flow) coordinates, at least one. */
@@ -42,6 +43,8 @@ export interface CanvasDrawControllerOptions<TNode extends CanvasNode = CanvasNo
42
43
  * profile decides which). Share one with the paint editor so a brush saved there draws here.
43
44
  */
44
45
  brushLibrary?: Pick<BrushLibrary, 'list' | 'get' | 'isBuiltin'>;
46
+ /** The host's colour scheme (default light): a brush's light / dark default colour resolves to its side. */
47
+ colorScheme?: 'light' | 'dark';
45
48
  getNodes: () => TNode[];
46
49
  setNodes: (nodes: TNode[]) => void;
47
50
  history?: ArrangeHistoryTarget;
@@ -75,7 +78,18 @@ export declare function createCanvasDrawController<TNode extends CanvasNode = Ca
75
78
  height: number;
76
79
  } | undefined;
77
80
  /** The presets and saved brushes (of `brushLibrary`) a stroke can be brushed with (loads the paint engine). */
78
- listBrushes: () => Promise<import("./brushTypes.cjs").CanvasBrushPreset[]>;
81
+ listBrushes: () => Promise<CanvasBrushPreset[]>;
82
+ /**
83
+ * A brush picker's choice: brushes the pen and highlighter with `id` (`null`: a plain vector
84
+ * stroke) at the brush's own size, embedding a saved brush, and makes its default colour
85
+ * (resolved for the colour scheme) the stroke colour unless `keepColour`. Throws for a brush
86
+ * the canvas can't paint. Resolves with the brush chosen.
87
+ */
88
+ selectBrush(id: string | null, choice?: {
89
+ keepColour?: boolean;
90
+ }): Promise<CanvasBrushPreset | null>;
91
+ /** The host's colour scheme, for brushes' light / dark default colours. */
92
+ setColorScheme(scheme: "light" | "dark"): void;
79
93
  /** The saved brush to embed for a brush id (undefined for presets and tip settings); for a brush picker. */
80
94
  brushSpec: (brush: CanvasBrush) => Promise<import("./brushTypes.cjs").CanvasBrushSpec | undefined>;
81
95
  };
@@ -7,6 +7,7 @@ import type { CanvasNode, Point } from './types.js';
7
7
  import { type FreehandDrawOptions, type FreehandPenSample, type FreehandStroke, type FreehandStrokeStyle, type FreehandTool } from './freehand.js';
8
8
  import { type CanvasBrush } from './brushstroke.js';
9
9
  import type { BrushLibrary } from '../brushes/library.js';
10
+ import type { CanvasBrushPreset } from './brushTypes.js';
10
11
  /** A stroke drawn by code or an agent (`drawStroke`). */
11
12
  export interface DrawStrokeInput {
12
13
  /** Points in canvas (flow) coordinates, at least one. */
@@ -42,6 +43,8 @@ export interface CanvasDrawControllerOptions<TNode extends CanvasNode = CanvasNo
42
43
  * profile decides which). Share one with the paint editor so a brush saved there draws here.
43
44
  */
44
45
  brushLibrary?: Pick<BrushLibrary, 'list' | 'get' | 'isBuiltin'>;
46
+ /** The host's colour scheme (default light): a brush's light / dark default colour resolves to its side. */
47
+ colorScheme?: 'light' | 'dark';
45
48
  getNodes: () => TNode[];
46
49
  setNodes: (nodes: TNode[]) => void;
47
50
  history?: ArrangeHistoryTarget;
@@ -75,7 +78,18 @@ export declare function createCanvasDrawController<TNode extends CanvasNode = Ca
75
78
  height: number;
76
79
  } | undefined;
77
80
  /** The presets and saved brushes (of `brushLibrary`) a stroke can be brushed with (loads the paint engine). */
78
- listBrushes: () => Promise<import("./brushTypes.js").CanvasBrushPreset[]>;
81
+ listBrushes: () => Promise<CanvasBrushPreset[]>;
82
+ /**
83
+ * A brush picker's choice: brushes the pen and highlighter with `id` (`null`: a plain vector
84
+ * stroke) at the brush's own size, embedding a saved brush, and makes its default colour
85
+ * (resolved for the colour scheme) the stroke colour unless `keepColour`. Throws for a brush
86
+ * the canvas can't paint. Resolves with the brush chosen.
87
+ */
88
+ selectBrush(id: string | null, choice?: {
89
+ keepColour?: boolean;
90
+ }): Promise<CanvasBrushPreset | null>;
91
+ /** The host's colour scheme, for brushes' light / dark default colours. */
92
+ setColorScheme(scheme: "light" | "dark"): void;
79
93
  /** The saved brush to embed for a brush id (undefined for presets and tip settings); for a brush picker. */
80
94
  brushSpec: (brush: CanvasBrush) => Promise<import("./brushTypes.js").CanvasBrushSpec | undefined>;
81
95
  };