@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.
- package/dist/animation-editor/index.cjs +114 -113
- package/dist/animation-editor/index.js +7 -6
- package/dist/{brushstrokeRender-T3JZST44.js → brushstrokeRender-2FHFLSEG.js} +4 -3
- package/dist/{brushstrokeRender-GCKK7V2I.cjs → brushstrokeRender-QGRXOKDA.cjs} +7 -6
- package/dist/canvas/index.cjs +71 -15
- package/dist/canvas/index.d.cts +1 -0
- package/dist/canvas/index.d.ts +1 -0
- package/dist/canvas/index.js +58 -2
- package/dist/canvas/stickers.d.cts +35 -0
- package/dist/canvas/stickers.d.ts +35 -0
- package/dist/{chunk-RXZL4NG5.js → chunk-226QDRO3.js} +1 -1
- package/dist/{chunk-UBRJOIR5.js → chunk-3TWOCSCY.js} +1 -1
- package/dist/{chunk-ZEYMKDYS.cjs → chunk-4JNWA3VT.cjs} +53 -20
- package/dist/{chunk-L3JFOTBQ.js → chunk-5E2Q7ZHI.js} +1 -1
- package/dist/{chunk-AU6MWQKZ.js → chunk-ABL7IWFZ.js} +1 -1
- package/dist/{chunk-LJRCU3BJ.cjs → chunk-ATK6ABN3.cjs} +15 -13
- package/dist/{chunk-H4AOUUBE.cjs → chunk-GT77U7QG.cjs} +18 -16
- package/dist/{chunk-GHCSC2WP.cjs → chunk-ISIO63Q5.cjs} +21 -15
- package/dist/{chunk-OFH6Q67U.js → chunk-JA57JIT5.js} +9 -3
- package/dist/{chunk-PZP2SZIZ.js → chunk-KDLBJ6QR.js} +1 -1
- package/dist/{chunk-LP2MCSBE.cjs → chunk-M2VKFE5L.cjs} +86 -86
- package/dist/{chunk-DOIU7VJG.js → chunk-NOHJP5TK.js} +1 -1
- package/dist/{chunk-O75V4ZS3.js → chunk-NTRAVM2I.js} +1 -1
- package/dist/{chunk-J7T5QZ45.js → chunk-OTEPAQJX.js} +4 -2
- package/dist/{chunk-QOBCBGGI.cjs → chunk-QKXO6JPP.cjs} +14 -14
- package/dist/{chunk-6BIDVPED.js → chunk-SMSGP2HQ.js} +1 -1
- package/dist/chunk-SZTI6EER.js +13 -0
- package/dist/{chunk-EJLRBS5Q.js → chunk-U4NUOKBT.js} +4 -2
- package/dist/chunk-U67EN7GG.cjs +13 -0
- package/dist/{chunk-5RH3VXAK.js → chunk-WKH5ZAUA.js} +45 -12
- package/dist/{chunk-IOFVM3L3.cjs → chunk-WPUXGDH4.cjs} +2 -2
- package/dist/{chunk-2SMMZDMG.cjs → chunk-X7WRL5ZZ.cjs} +35 -35
- package/dist/{chunk-WLJZZHUZ.cjs → chunk-YM6ZBTXG.cjs} +23 -23
- package/dist/{chunk-KYX7NZ5V.cjs → chunk-YW43M56C.cjs} +1 -1
- package/dist/{chunk-K5DS2JTA.cjs → chunk-Z3BRH4JK.cjs} +6 -6
- package/dist/{chunk-XNZFVYC2.cjs → chunk-ZBCT5MEA.cjs} +7 -7
- package/dist/effects/helpers.d.cts +6 -0
- package/dist/effects/helpers.d.ts +6 -0
- package/dist/effects/index.cjs +62 -60
- package/dist/effects/index.js +5 -3
- package/dist/effects/tools.d.cts +6 -0
- package/dist/effects/tools.d.ts +6 -0
- package/dist/image-editor/effects.d.cts +1 -1
- package/dist/image-editor/effects.d.ts +1 -1
- package/dist/image-editor/index.cjs +814 -791
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +35 -12
- package/dist/image-editor/stickers.d.cts +9 -0
- package/dist/image-editor/stickers.d.ts +9 -0
- package/dist/paint-editor/index.cjs +165 -164
- package/dist/paint-editor/index.js +8 -7
- package/dist/stickers/index.cjs +22 -16
- package/dist/stickers/index.d.cts +1 -1
- package/dist/stickers/index.d.ts +1 -1
- package/dist/stickers/index.js +9 -3
- package/dist/stickers/tools.d.cts +57 -1
- package/dist/stickers/tools.d.ts +57 -1
- package/dist/vector/index.cjs +1003 -969
- package/dist/vector/index.d.cts +1 -0
- package/dist/vector/index.d.ts +1 -0
- package/dist/vector/index.js +40 -6
- package/dist/vector/stickers.d.cts +11 -0
- package/dist/vector/stickers.d.ts +11 -0
- package/dist/video-editor/index.cjs +344 -344
- package/dist/video-editor/index.js +4 -4
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +1 -1
- package/skills/pixerate-stickers/SKILL.md +13 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StickerBrowser,
|
|
3
3
|
editorStickers
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-U4NUOKBT.js";
|
|
5
5
|
import {
|
|
6
6
|
toVideoFfmpeg
|
|
7
|
-
} from "../chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
179
|
+
} from "../chunk-JA57JIT5.js";
|
|
179
180
|
import "../chunk-V2ZCJRDM.js";
|
|
180
181
|
import {
|
|
181
182
|
CoverageMap,
|
package/dist/stickers/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
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
|
-
|
|
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) =>
|
|
95
|
-
search: (q, o) =>
|
|
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,
|
|
106
|
-
if (_optionalChain([options, 'access', _ => _.failIds, 'optionalAccess', _2 => _2.includes, 'call', _3 => _3(id)])) throw new (0,
|
|
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,
|
|
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,
|
|
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 } =
|
|
129
|
+
const { provider, id } = _chunk4JNWA3VTcjs.parseStickerRef.call(void 0, ref);
|
|
126
130
|
const p = byId.get(provider);
|
|
127
|
-
if (!p) throw new (0,
|
|
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:
|
|
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 =
|
|
133
|
-
|
|
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,
|
|
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:
|
|
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
|
-
|
|
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';
|
package/dist/stickers/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/stickers/index.js
CHANGED
|
@@ -3,20 +3,21 @@ import {
|
|
|
3
3
|
editorStickers,
|
|
4
4
|
stampOutline,
|
|
5
5
|
stampPixels
|
|
6
|
-
} from "../chunk-
|
|
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-
|
|
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;
|
package/dist/stickers/tools.d.ts
CHANGED
|
@@ -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;
|