@pixerate/editor 0.249.0 → 0.250.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 (69) hide show
  1. package/dist/animation-editor/index.cjs +114 -113
  2. package/dist/animation-editor/index.js +7 -6
  3. package/dist/{brushstrokeRender-T3JZST44.js → brushstrokeRender-2FHFLSEG.js} +4 -3
  4. package/dist/{brushstrokeRender-GCKK7V2I.cjs → brushstrokeRender-QGRXOKDA.cjs} +7 -6
  5. package/dist/canvas/index.cjs +71 -15
  6. package/dist/canvas/index.d.cts +1 -0
  7. package/dist/canvas/index.d.ts +1 -0
  8. package/dist/canvas/index.js +58 -2
  9. package/dist/canvas/stickers.d.cts +35 -0
  10. package/dist/canvas/stickers.d.ts +35 -0
  11. package/dist/{chunk-RXZL4NG5.js → chunk-226QDRO3.js} +1 -1
  12. package/dist/{chunk-UBRJOIR5.js → chunk-3TWOCSCY.js} +1 -1
  13. package/dist/{chunk-ZEYMKDYS.cjs → chunk-4JNWA3VT.cjs} +53 -20
  14. package/dist/{chunk-L3JFOTBQ.js → chunk-5E2Q7ZHI.js} +1 -1
  15. package/dist/{chunk-AU6MWQKZ.js → chunk-ABL7IWFZ.js} +1 -1
  16. package/dist/{chunk-LJRCU3BJ.cjs → chunk-ATK6ABN3.cjs} +15 -13
  17. package/dist/{chunk-H4AOUUBE.cjs → chunk-GT77U7QG.cjs} +18 -16
  18. package/dist/{chunk-GHCSC2WP.cjs → chunk-ISIO63Q5.cjs} +21 -15
  19. package/dist/{chunk-OFH6Q67U.js → chunk-JA57JIT5.js} +9 -3
  20. package/dist/{chunk-PZP2SZIZ.js → chunk-KDLBJ6QR.js} +1 -1
  21. package/dist/{chunk-LP2MCSBE.cjs → chunk-M2VKFE5L.cjs} +86 -86
  22. package/dist/{chunk-DOIU7VJG.js → chunk-NOHJP5TK.js} +1 -1
  23. package/dist/{chunk-O75V4ZS3.js → chunk-NTRAVM2I.js} +1 -1
  24. package/dist/{chunk-J7T5QZ45.js → chunk-OTEPAQJX.js} +4 -2
  25. package/dist/{chunk-QOBCBGGI.cjs → chunk-QKXO6JPP.cjs} +14 -14
  26. package/dist/{chunk-6BIDVPED.js → chunk-SMSGP2HQ.js} +1 -1
  27. package/dist/chunk-SZTI6EER.js +13 -0
  28. package/dist/{chunk-EJLRBS5Q.js → chunk-U4NUOKBT.js} +4 -2
  29. package/dist/chunk-U67EN7GG.cjs +13 -0
  30. package/dist/{chunk-5RH3VXAK.js → chunk-WKH5ZAUA.js} +45 -12
  31. package/dist/{chunk-IOFVM3L3.cjs → chunk-WPUXGDH4.cjs} +2 -2
  32. package/dist/{chunk-2SMMZDMG.cjs → chunk-X7WRL5ZZ.cjs} +35 -35
  33. package/dist/{chunk-WLJZZHUZ.cjs → chunk-YM6ZBTXG.cjs} +23 -23
  34. package/dist/{chunk-KYX7NZ5V.cjs → chunk-YW43M56C.cjs} +1 -1
  35. package/dist/{chunk-K5DS2JTA.cjs → chunk-Z3BRH4JK.cjs} +6 -6
  36. package/dist/{chunk-XNZFVYC2.cjs → chunk-ZBCT5MEA.cjs} +7 -7
  37. package/dist/effects/helpers.d.cts +6 -0
  38. package/dist/effects/helpers.d.ts +6 -0
  39. package/dist/effects/index.cjs +62 -60
  40. package/dist/effects/index.js +5 -3
  41. package/dist/effects/tools.d.cts +6 -0
  42. package/dist/effects/tools.d.ts +6 -0
  43. package/dist/image-editor/effects.d.cts +1 -1
  44. package/dist/image-editor/effects.d.ts +1 -1
  45. package/dist/image-editor/index.cjs +814 -791
  46. package/dist/image-editor/index.d.cts +1 -0
  47. package/dist/image-editor/index.d.ts +1 -0
  48. package/dist/image-editor/index.js +35 -12
  49. package/dist/image-editor/stickers.d.cts +9 -0
  50. package/dist/image-editor/stickers.d.ts +9 -0
  51. package/dist/paint-editor/index.cjs +165 -164
  52. package/dist/paint-editor/index.js +8 -7
  53. package/dist/stickers/index.cjs +22 -16
  54. package/dist/stickers/index.d.cts +1 -1
  55. package/dist/stickers/index.d.ts +1 -1
  56. package/dist/stickers/index.js +9 -3
  57. package/dist/stickers/tools.d.cts +57 -1
  58. package/dist/stickers/tools.d.ts +57 -1
  59. package/dist/vector/index.cjs +1003 -969
  60. package/dist/vector/index.d.cts +1 -0
  61. package/dist/vector/index.d.ts +1 -0
  62. package/dist/vector/index.js +40 -6
  63. package/dist/vector/stickers.d.cts +11 -0
  64. package/dist/vector/stickers.d.ts +11 -0
  65. package/dist/video-editor/index.cjs +344 -344
  66. package/dist/video-editor/index.js +4 -4
  67. package/package.json +1 -1
  68. package/skills/pixerate-image-editor/SKILL.md +1 -1
  69. package/skills/pixerate-stickers/SKILL.md +13 -1
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  StickerBrowser,
3
3
  editorStickers
4
- } from "../chunk-EJLRBS5Q.js";
4
+ } from "../chunk-U4NUOKBT.js";
5
5
  import {
6
6
  toVideoFfmpeg
7
- } from "../chunk-L3JFOTBQ.js";
7
+ } from "../chunk-5E2Q7ZHI.js";
8
8
  import {
9
9
  createLayerEffectTools,
10
10
  deserializeLayers,
@@ -12,7 +12,7 @@ import {
12
12
  resolveExternalAssets,
13
13
  serializeLayers,
14
14
  serializeLayersExternal
15
- } from "../chunk-UBRJOIR5.js";
15
+ } from "../chunk-3TWOCSCY.js";
16
16
  import "../chunk-3CI7FRMK.js";
17
17
  import "../chunk-ZNA3IQZF.js";
18
18
  import {
@@ -68,7 +68,7 @@ import {
68
68
  realPresenceClock,
69
69
  tweenPresenceCursor
70
70
  } from "../chunk-IVSWRVB4.js";
71
- import "../chunk-PZP2SZIZ.js";
71
+ import "../chunk-KDLBJ6QR.js";
72
72
  import {
73
73
  BRUSH_ID,
74
74
  BRUSH_ROTATIONS,
@@ -155,7 +155,7 @@ import {
155
155
  tiltToOrientation,
156
156
  toStrokePoint,
157
157
  usesPaintExchange
158
- } from "../chunk-J7T5QZ45.js";
158
+ } from "../chunk-OTEPAQJX.js";
159
159
  import {
160
160
  STAMP_KINDS,
161
161
  StickersSlot,
@@ -163,10 +163,11 @@ import {
163
163
  editorStampOf,
164
164
  normalizeStickerRef,
165
165
  stampCoverage
166
- } from "../chunk-5RH3VXAK.js";
166
+ } from "../chunk-WKH5ZAUA.js";
167
167
  import "../chunk-M6DNZNVY.js";
168
168
  import "../chunk-WEIK3UYB.js";
169
169
  import "../chunk-PWBZH3FK.js";
170
+ import "../chunk-SZTI6EER.js";
170
171
  import {
171
172
  EffectRendererPool
172
173
  } from "../chunk-EHLOCVWB.js";
@@ -175,7 +176,7 @@ import {
175
176
  EffectsSlot,
176
177
  createEffectToolProvider,
177
178
  resolveEffectValues
178
- } from "../chunk-OFH6Q67U.js";
179
+ } from "../chunk-JA57JIT5.js";
179
180
  import "../chunk-V2ZCJRDM.js";
180
181
  import {
181
182
  CoverageMap,
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkLJRCU3BJcjs = require('../chunk-LJRCU3BJ.cjs');
6
+ var _chunkATK6ABN3cjs = require('../chunk-ATK6ABN3.cjs');
7
7
 
8
8
 
9
9
 
@@ -24,7 +24,11 @@ var _chunkLJRCU3BJcjs = require('../chunk-LJRCU3BJ.cjs');
24
24
 
25
25
 
26
26
 
27
- var _chunkZEYMKDYScjs = require('../chunk-ZEYMKDYS.cjs');
27
+
28
+ var _chunk4JNWA3VTcjs = require('../chunk-4JNWA3VT.cjs');
29
+
30
+
31
+ var _chunkU67EN7GGcjs = require('../chunk-U67EN7GG.cjs');
28
32
  require('../chunk-3K6HWEXZ.cjs');
29
33
 
30
34
 
@@ -91,8 +95,8 @@ function createFakeStickerProvider(options = {}) {
91
95
  name: "Fake stickers",
92
96
  version: "1",
93
97
  capabilities: { supportsSearch: true, supportsSvg: true, supportsRaster: true, maxSize: 512 },
94
- list: (o) => _chunkZEYMKDYScjs.stickerPage.call(void 0, summaries, o),
95
- search: (q, o) => _chunkZEYMKDYScjs.stickerPage.call(void 0, summaries, o, q),
98
+ list: (o) => _chunk4JNWA3VTcjs.stickerPage.call(void 0, summaries, o),
99
+ search: (q, o) => _chunk4JNWA3VTcjs.stickerPage.call(void 0, summaries, o, q),
96
100
  describe(id) {
97
101
  const s = find(id);
98
102
  if (!s) return void 0;
@@ -102,12 +106,12 @@ function createFakeStickerProvider(options = {}) {
102
106
  async load(id, o = {}) {
103
107
  if (options.loadDelayMs) await new Promise((r) => setTimeout(r, options.loadDelayMs));
104
108
  const s = find(id);
105
- if (!s) throw new (0, _chunkZEYMKDYScjs.StickerError)("unknown_sticker", `No fake sticker "${id}".`);
106
- if (_optionalChain([options, 'access', _ => _.failIds, 'optionalAccess', _2 => _2.includes, 'call', _3 => _3(id)])) throw new (0, _chunkZEYMKDYScjs.StickerError)("load_failed", `The fake sticker "${id}" failed to load (failIds).`);
109
+ if (!s) throw new (0, _chunkU67EN7GGcjs.StickerError)("unknown_sticker", `No fake sticker "${id}".`);
110
+ if (_optionalChain([options, 'access', _ => _.failIds, 'optionalAccess', _2 => _2.includes, 'call', _3 => _3(id)])) throw new (0, _chunkU67EN7GGcjs.StickerError)("load_failed", `The fake sticker "${id}" failed to load (failIds).`);
107
111
  const fill = s.shape === "badge" && o.colour ? o.colour.toLowerCase() : s.colours[0];
108
112
  if (o.format === "png") {
109
113
  const size = _nullishCoalesce(o.size, () => ( 128));
110
- if (!(Number.isInteger(size) && size >= 8 && size <= 512)) throw new (0, _chunkZEYMKDYScjs.StickerError)("invalid_argument", `size must be 8..512 px, got ${size}.`);
114
+ if (!(Number.isInteger(size) && size >= 8 && size <= 512)) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `size must be 8..512 px, got ${size}.`);
111
115
  return { kind: "image", url: _chunkW5M3J7PVcjs.pngDataUrl.call(void 0, size, size, pixelsOf(s, size, fill)), width: size, height: size };
112
116
  }
113
117
  return { kind: "svg", svg: svgOf(s, fill) };
@@ -119,23 +123,23 @@ function createFakeStickerProvider(options = {}) {
119
123
  function combineStickerProviders(providers, options = {}) {
120
124
  const ids = providers.map((p) => p.id);
121
125
  const dup = ids.find((id, i) => ids.indexOf(id) !== i);
122
- if (dup) throw new (0, _chunkZEYMKDYScjs.StickerError)("invalid_argument", `Two sticker providers have the id "${dup}"; give each a unique id.`);
126
+ if (dup) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `Two sticker providers have the id "${dup}"; give each a unique id.`);
123
127
  const byId = new Map(providers.map((p) => [p.id, p]));
124
128
  const owner = (ref) => {
125
- const { provider, id } = _chunkZEYMKDYScjs.parseStickerRef.call(void 0, ref);
129
+ const { provider, id } = _chunk4JNWA3VTcjs.parseStickerRef.call(void 0, ref);
126
130
  const p = byId.get(provider);
127
- if (!p) throw new (0, _chunkZEYMKDYScjs.StickerError)("unknown_provider", `No sticker provider "${provider}"; the providers are ${ids.join(", ") || "none"}.`);
131
+ if (!p) throw new (0, _chunkU67EN7GGcjs.StickerError)("unknown_provider", `No sticker provider "${provider}"; the providers are ${ids.join(", ") || "none"}.`);
128
132
  return { p, id };
129
133
  };
130
- const prefix = (p, s) => ({ ...s, id: _chunkZEYMKDYScjs.stickerRefOf.call(void 0, p, s.id) });
134
+ const prefix = (p, s) => ({ ...s, id: _chunk4JNWA3VTcjs.stickerRefOf.call(void 0, p, s.id) });
131
135
  const page = async (query, o = {}) => {
132
- const { after, limit = _chunkZEYMKDYScjs.DEFAULT_STICKER_PAGE, ...filters } = o;
133
- _chunkZEYMKDYScjs.checkStickerSearchOptions.call(void 0, { limit });
136
+ const { after, limit = _chunk4JNWA3VTcjs.DEFAULT_STICKER_PAGE, ...filters } = o;
137
+ _chunk4JNWA3VTcjs.checkStickerSearchOptions.call(void 0, { limit });
134
138
  let i = 0;
135
139
  let inner;
136
140
  if (after !== void 0) {
137
141
  const m = /^(\d+)\|(.*)$/.exec(after);
138
- if (!m || Number(m[1]) >= providers.length) throw new (0, _chunkZEYMKDYScjs.StickerError)("invalid_argument", `after "${after}" is not a cursor from this provider; pass the next value of the previous page.`);
142
+ if (!m || Number(m[1]) >= providers.length) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `after "${after}" is not a cursor from this provider; pass the next value of the previous page.`);
139
143
  i = Number(m[1]);
140
144
  inner = m[2] || void 0;
141
145
  }
@@ -179,7 +183,7 @@ function combineStickerProviders(providers, options = {}) {
179
183
  return void 0;
180
184
  }
181
185
  const d = await o.p.describe(o.id);
182
- return d ? { ...d, id: _chunkZEYMKDYScjs.stickerRefOf.call(void 0, o.p, d.id) } : void 0;
186
+ return d ? { ...d, id: _chunk4JNWA3VTcjs.stickerRefOf.call(void 0, o.p, d.id) } : void 0;
183
187
  },
184
188
  async load(ref, o) {
185
189
  const { p, id } = owner(ref);
@@ -328,4 +332,6 @@ async function checkStickerProvider(provider, options = {}) {
328
332
 
329
333
 
330
334
 
331
- exports.DEFAULT_STICKER_PAGE = _chunkZEYMKDYScjs.DEFAULT_STICKER_PAGE; exports.EDITOR_STICKERS_ID = _chunkZEYMKDYScjs.EDITOR_STICKERS_ID; exports.MAX_STICKER_PAGE = _chunkZEYMKDYScjs.MAX_STICKER_PAGE; exports.STAMP_KINDS = _chunkZEYMKDYScjs.STAMP_KINDS; exports.StickerBrowser = _chunkLJRCU3BJcjs.StickerBrowser; exports.StickerError = _chunkZEYMKDYScjs.StickerError; exports.StickersSlot = _chunkZEYMKDYScjs.StickersSlot; exports.checkStickerProvider = checkStickerProvider; exports.checkStickerSearchOptions = _chunkZEYMKDYScjs.checkStickerSearchOptions; exports.closestStickerRefs = _chunkZEYMKDYScjs.closestStickerRefs; exports.combineStickerProviders = combineStickerProviders; exports.createFakeStickerProvider = createFakeStickerProvider; exports.createStickerToolProvider = _chunkZEYMKDYScjs.createStickerToolProvider; exports.createStickerTools = _chunkZEYMKDYScjs.createStickerTools; exports.describeStickerRef = _chunkZEYMKDYScjs.describeStickerRef; exports.editorStampOf = _chunkZEYMKDYScjs.editorStampOf; exports.editorStickers = _chunkLJRCU3BJcjs.editorStickers; exports.normalizeStickerRef = _chunkZEYMKDYScjs.normalizeStickerRef; exports.parseStickerRef = _chunkZEYMKDYScjs.parseStickerRef; exports.stampCoverage = _chunkZEYMKDYScjs.stampCoverage; exports.stampOutline = _chunkLJRCU3BJcjs.stampOutline; exports.stampPixels = _chunkLJRCU3BJcjs.stampPixels; exports.stickerForAgent = _chunkZEYMKDYScjs.stickerForAgent; exports.stickerIdFor = _chunkZEYMKDYScjs.stickerIdFor; exports.stickerPage = _chunkZEYMKDYScjs.stickerPage; exports.stickerRefOf = _chunkZEYMKDYScjs.stickerRefOf;
335
+
336
+
337
+ exports.DEFAULT_STICKER_PAGE = _chunk4JNWA3VTcjs.DEFAULT_STICKER_PAGE; exports.EDITOR_STICKERS_ID = _chunk4JNWA3VTcjs.EDITOR_STICKERS_ID; exports.MAX_STICKER_PAGE = _chunk4JNWA3VTcjs.MAX_STICKER_PAGE; exports.STAMP_KINDS = _chunk4JNWA3VTcjs.STAMP_KINDS; exports.StickerBrowser = _chunkATK6ABN3cjs.StickerBrowser; exports.StickerError = _chunkU67EN7GGcjs.StickerError; exports.StickersSlot = _chunk4JNWA3VTcjs.StickersSlot; exports.checkStickerProvider = checkStickerProvider; exports.checkStickerSearchOptions = _chunk4JNWA3VTcjs.checkStickerSearchOptions; exports.closestStickerRefs = _chunk4JNWA3VTcjs.closestStickerRefs; exports.combineStickerProviders = combineStickerProviders; exports.createFakeStickerProvider = createFakeStickerProvider; exports.createInsertStickerTool = _chunk4JNWA3VTcjs.createInsertStickerTool; exports.createStickerToolProvider = _chunk4JNWA3VTcjs.createStickerToolProvider; exports.createStickerTools = _chunk4JNWA3VTcjs.createStickerTools; exports.describeStickerRef = _chunk4JNWA3VTcjs.describeStickerRef; exports.editorStampOf = _chunk4JNWA3VTcjs.editorStampOf; exports.editorStickers = _chunkATK6ABN3cjs.editorStickers; exports.insertSticker = _chunk4JNWA3VTcjs.insertSticker; exports.normalizeStickerRef = _chunk4JNWA3VTcjs.normalizeStickerRef; exports.parseStickerRef = _chunk4JNWA3VTcjs.parseStickerRef; exports.stampCoverage = _chunk4JNWA3VTcjs.stampCoverage; exports.stampOutline = _chunkATK6ABN3cjs.stampOutline; exports.stampPixels = _chunkATK6ABN3cjs.stampPixels; exports.stickerForAgent = _chunk4JNWA3VTcjs.stickerForAgent; exports.stickerIdFor = _chunk4JNWA3VTcjs.stickerIdFor; exports.stickerPage = _chunk4JNWA3VTcjs.stickerPage; exports.stickerRefOf = _chunk4JNWA3VTcjs.stickerRefOf;
@@ -12,5 +12,5 @@ export { editorStickers, stampOutline, stampPixels } from './editor.cjs';
12
12
  export { createFakeStickerProvider, type FakeStickerProviderOptions } from './fake.cjs';
13
13
  export { combineStickerProviders } from './combine.cjs';
14
14
  export { checkStickerProvider, type StickerConformanceIssue, type StickerConformanceOptions } from './conformance.cjs';
15
- export { createStickerTools, createStickerToolProvider, describeStickerRef, stickerForAgent, type StickerToolsOptions } from './tools.cjs';
15
+ export { createInsertStickerTool, insertSticker, createStickerTools, createStickerToolProvider, describeStickerRef, stickerForAgent, type StickerInsertHost, type StickerPlacement, type StickerToolsOptions } from './tools.cjs';
16
16
  export { StickerBrowser, type StickerBrowserItem, type StickerBrowserState } from './browser.cjs';
@@ -12,5 +12,5 @@ export { editorStickers, stampOutline, stampPixels } from './editor.js';
12
12
  export { createFakeStickerProvider, type FakeStickerProviderOptions } from './fake.js';
13
13
  export { combineStickerProviders } from './combine.js';
14
14
  export { checkStickerProvider, type StickerConformanceIssue, type StickerConformanceOptions } from './conformance.js';
15
- export { createStickerTools, createStickerToolProvider, describeStickerRef, stickerForAgent, type StickerToolsOptions } from './tools.js';
15
+ export { createInsertStickerTool, insertSticker, createStickerTools, createStickerToolProvider, describeStickerRef, stickerForAgent, type StickerInsertHost, type StickerPlacement, type StickerToolsOptions } from './tools.js';
16
16
  export { StickerBrowser, type StickerBrowserItem, type StickerBrowserState } from './browser.js';
@@ -3,20 +3,21 @@ import {
3
3
  editorStickers,
4
4
  stampOutline,
5
5
  stampPixels
6
- } from "../chunk-EJLRBS5Q.js";
6
+ } from "../chunk-U4NUOKBT.js";
7
7
  import {
8
8
  DEFAULT_STICKER_PAGE,
9
9
  EDITOR_STICKERS_ID,
10
10
  MAX_STICKER_PAGE,
11
11
  STAMP_KINDS,
12
- StickerError,
13
12
  StickersSlot,
14
13
  checkStickerSearchOptions,
15
14
  closestStickerRefs,
15
+ createInsertStickerTool,
16
16
  createStickerToolProvider,
17
17
  createStickerTools,
18
18
  describeStickerRef,
19
19
  editorStampOf,
20
+ insertSticker,
20
21
  normalizeStickerRef,
21
22
  parseStickerRef,
22
23
  stampCoverage,
@@ -24,7 +25,10 @@ import {
24
25
  stickerIdFor,
25
26
  stickerPage,
26
27
  stickerRefOf
27
- } from "../chunk-5RH3VXAK.js";
28
+ } from "../chunk-WKH5ZAUA.js";
29
+ import {
30
+ StickerError
31
+ } from "../chunk-SZTI6EER.js";
28
32
  import "../chunk-4D6KP5BV.js";
29
33
  import {
30
34
  pngDataUrl
@@ -314,11 +318,13 @@ export {
314
318
  closestStickerRefs,
315
319
  combineStickerProviders,
316
320
  createFakeStickerProvider,
321
+ createInsertStickerTool,
317
322
  createStickerToolProvider,
318
323
  createStickerTools,
319
324
  describeStickerRef,
320
325
  editorStampOf,
321
326
  editorStickers,
327
+ insertSticker,
322
328
  normalizeStickerRef,
323
329
  parseStickerRef,
324
330
  stampCoverage,
@@ -4,7 +4,40 @@
4
4
  * stickers. Refusals name the valid choices.
5
5
  */
6
6
  import type { AgentTool, AgentToolProvider } from '../tools/registry.cjs';
7
- import type { StickerDescription, StickerProvider, StickerRef, StickerSummary } from './types.cjs';
7
+ import type { MaybePromise, StickerAsset, StickerDescription, StickerFormat, StickerProvider, StickerRef, StickerSummary } from './types.cjs';
8
+ /** Where and how big an inserted sticker goes, with its art. */
9
+ export interface StickerPlacement {
10
+ ref: StickerRef;
11
+ description: StickerDescription;
12
+ asset: StickerAsset;
13
+ /** Centre, in the editor's document units. */
14
+ x: number;
15
+ y: number;
16
+ /** Size of its box (the natural aspect kept). */
17
+ width: number;
18
+ height: number;
19
+ /** #rrggbb it was tinted to, when tintable and asked for. */
20
+ colour?: string;
21
+ }
22
+ /**
23
+ * An editor that can take an inserted sticker (`insert_sticker`): the vector editor (editable
24
+ * paths), the image editor (a pixel layer), the canvas (a shape node) or any other.
25
+ */
26
+ export interface StickerInsertHost {
27
+ /** What the editor calls the thing it makes ("group", "layer", "node"), for descriptions. */
28
+ noun: string;
29
+ /** The format it wants first (it gets the other when the sticker has only that). */
30
+ format: StickerFormat;
31
+ /** The default centre when the call gives none (the middle of the view or document). */
32
+ defaultCentre(): {
33
+ x: number;
34
+ y: number;
35
+ };
36
+ /** Adds the sticker as one undo step; returns what it made (its id at least) for later tools. */
37
+ insert(placement: StickerPlacement): MaybePromise<{
38
+ id: string;
39
+ } & Record<string, unknown>>;
40
+ }
8
41
  /** A summary as the tools return it: `ref` instead of the provider's id. */
9
42
  export declare function stickerForAgent(provider: StickerProvider, s: StickerSummary): Record<string, unknown>;
10
43
  /**
@@ -15,9 +48,32 @@ export declare function describeStickerRef(provider: StickerProvider, ref: Stick
15
48
  export interface StickerToolsOptions {
16
49
  /** The provider to use, read on every call (an editor's `StickersSlot`). */
17
50
  provider: () => StickerProvider;
51
+ /** With it, `insert_sticker` puts a sticker into this editor. */
52
+ insert?: StickerInsertHost;
18
53
  }
19
54
  /** `find_stickers` and `describe_sticker` over the provider `options.provider()` returns. */
20
55
  export declare function createStickerTools(options: StickerToolsOptions): AgentTool[];
56
+ /**
57
+ * Puts one sticker into an editor through its host (the panels and `insert_sticker` both use it):
58
+ * checks the ref, loads the art in the host's format, tinted when asked and tintable, and places
59
+ * it centred at (`x`, `y`) (default the host's centre), `width` wide (default its natural width).
60
+ * Returns what the host made, the ref, the size and the licence.
61
+ */
62
+ export declare function insertSticker(provider: StickerProvider, host: StickerInsertHost, options: {
63
+ ref: StickerRef;
64
+ x?: number;
65
+ y?: number;
66
+ width?: number;
67
+ color?: string;
68
+ }): Promise<{
69
+ id: string;
70
+ ref: StickerRef;
71
+ width: number;
72
+ height: number;
73
+ licence: StickerDescription['licence'];
74
+ } & Record<string, unknown>>;
75
+ /** `insert_sticker`: one sticker by ref into an editor, at a place and size, as one undo step. */
76
+ export declare function createInsertStickerTool(provider: () => StickerProvider, host: StickerInsertHost): AgentTool;
21
77
  /** The sticker library tools as a provider (id `stickers` by default). */
22
78
  export declare function createStickerToolProvider(options: StickerToolsOptions & {
23
79
  id?: string;
@@ -4,7 +4,40 @@
4
4
  * stickers. Refusals name the valid choices.
5
5
  */
6
6
  import type { AgentTool, AgentToolProvider } from '../tools/registry.js';
7
- import type { StickerDescription, StickerProvider, StickerRef, StickerSummary } from './types.js';
7
+ import type { MaybePromise, StickerAsset, StickerDescription, StickerFormat, StickerProvider, StickerRef, StickerSummary } from './types.js';
8
+ /** Where and how big an inserted sticker goes, with its art. */
9
+ export interface StickerPlacement {
10
+ ref: StickerRef;
11
+ description: StickerDescription;
12
+ asset: StickerAsset;
13
+ /** Centre, in the editor's document units. */
14
+ x: number;
15
+ y: number;
16
+ /** Size of its box (the natural aspect kept). */
17
+ width: number;
18
+ height: number;
19
+ /** #rrggbb it was tinted to, when tintable and asked for. */
20
+ colour?: string;
21
+ }
22
+ /**
23
+ * An editor that can take an inserted sticker (`insert_sticker`): the vector editor (editable
24
+ * paths), the image editor (a pixel layer), the canvas (a shape node) or any other.
25
+ */
26
+ export interface StickerInsertHost {
27
+ /** What the editor calls the thing it makes ("group", "layer", "node"), for descriptions. */
28
+ noun: string;
29
+ /** The format it wants first (it gets the other when the sticker has only that). */
30
+ format: StickerFormat;
31
+ /** The default centre when the call gives none (the middle of the view or document). */
32
+ defaultCentre(): {
33
+ x: number;
34
+ y: number;
35
+ };
36
+ /** Adds the sticker as one undo step; returns what it made (its id at least) for later tools. */
37
+ insert(placement: StickerPlacement): MaybePromise<{
38
+ id: string;
39
+ } & Record<string, unknown>>;
40
+ }
8
41
  /** A summary as the tools return it: `ref` instead of the provider's id. */
9
42
  export declare function stickerForAgent(provider: StickerProvider, s: StickerSummary): Record<string, unknown>;
10
43
  /**
@@ -15,9 +48,32 @@ export declare function describeStickerRef(provider: StickerProvider, ref: Stick
15
48
  export interface StickerToolsOptions {
16
49
  /** The provider to use, read on every call (an editor's `StickersSlot`). */
17
50
  provider: () => StickerProvider;
51
+ /** With it, `insert_sticker` puts a sticker into this editor. */
52
+ insert?: StickerInsertHost;
18
53
  }
19
54
  /** `find_stickers` and `describe_sticker` over the provider `options.provider()` returns. */
20
55
  export declare function createStickerTools(options: StickerToolsOptions): AgentTool[];
56
+ /**
57
+ * Puts one sticker into an editor through its host (the panels and `insert_sticker` both use it):
58
+ * checks the ref, loads the art in the host's format, tinted when asked and tintable, and places
59
+ * it centred at (`x`, `y`) (default the host's centre), `width` wide (default its natural width).
60
+ * Returns what the host made, the ref, the size and the licence.
61
+ */
62
+ export declare function insertSticker(provider: StickerProvider, host: StickerInsertHost, options: {
63
+ ref: StickerRef;
64
+ x?: number;
65
+ y?: number;
66
+ width?: number;
67
+ color?: string;
68
+ }): Promise<{
69
+ id: string;
70
+ ref: StickerRef;
71
+ width: number;
72
+ height: number;
73
+ licence: StickerDescription['licence'];
74
+ } & Record<string, unknown>>;
75
+ /** `insert_sticker`: one sticker by ref into an editor, at a place and size, as one undo step. */
76
+ export declare function createInsertStickerTool(provider: () => StickerProvider, host: StickerInsertHost): AgentTool;
21
77
  /** The sticker library tools as a provider (id `stickers` by default). */
22
78
  export declare function createStickerToolProvider(options: StickerToolsOptions & {
23
79
  id?: string;