@pixerate/editor 0.249.0 → 0.251.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/agent/index.cjs +40 -41
- package/dist/agent/index.js +9 -10
- package/dist/animation/index.cjs +6 -7
- package/dist/animation/index.js +5 -6
- package/dist/animation-editor/index.cjs +124 -123
- package/dist/animation-editor/index.js +15 -14
- package/dist/brushes/index.cjs +1406 -0
- package/dist/brushes/index.d.cts +12 -0
- package/dist/brushes/index.d.ts +12 -0
- package/dist/brushes/index.js +1406 -0
- package/dist/brushes/migrate.d.cts +17 -0
- package/dist/brushes/migrate.d.ts +17 -0
- package/dist/brushes/normalize.d.cts +15 -0
- package/dist/brushes/normalize.d.ts +15 -0
- package/dist/brushes/presets.d.cts +12 -0
- package/dist/brushes/presets.d.ts +12 -0
- package/dist/brushes/resolve.d.cts +56 -0
- package/dist/brushes/resolve.d.ts +56 -0
- package/dist/brushes/schema.d.cts +29 -0
- package/dist/brushes/schema.d.ts +29 -0
- package/dist/brushes/types.d.cts +323 -0
- package/dist/brushes/types.d.ts +323 -0
- package/dist/{brushstrokeRender-T3JZST44.js → brushstrokeRender-5PYSKZIJ.js} +9 -8
- package/dist/{brushstrokeRender-GCKK7V2I.cjs → brushstrokeRender-7FLLSQEC.cjs} +15 -14
- package/dist/canvas/index.cjs +120 -65
- package/dist/canvas/index.d.cts +1 -0
- package/dist/canvas/index.d.ts +1 -0
- package/dist/canvas/index.js +88 -33
- package/dist/canvas/stickers.d.cts +35 -0
- package/dist/canvas/stickers.d.ts +35 -0
- package/dist/chart/index.cjs +159 -160
- package/dist/chart/index.js +9 -10
- package/dist/{chunk-RXZL4NG5.js → chunk-226QDRO3.js} +1 -1
- package/dist/{chunk-DOIU7VJG.js → chunk-2ZJ4DT3M.js} +1 -1
- package/dist/{chunk-XZNU4DUX.cjs → chunk-3NS5C7FB.cjs} +76 -76
- package/dist/{chunk-UTI5IITZ.cjs → chunk-4ZC5QJE2.cjs} +3 -3
- package/dist/{chunk-L3JFOTBQ.js → chunk-5E2Q7ZHI.js} +1 -1
- package/dist/{chunk-6BIDVPED.js → chunk-5JNA6LLY.js} +1 -1
- package/dist/{chunk-RD7RX52G.cjs → chunk-5UEFBM2M.cjs} +207 -18
- package/dist/{chunk-WA44NKPF.js → chunk-62Z5WLRA.js} +1 -1
- package/dist/{chunk-BVRRIW7F.js → chunk-6GRUVGKU.js} +3 -3
- package/dist/{chunk-QARCM66V.js → chunk-6ZZKRH7R.js} +3 -3
- package/dist/{chunk-BP6KSGVD.js → chunk-7272D3K2.js} +4 -6
- package/dist/{chunk-O75V4ZS3.js → chunk-7P6VF3FG.js} +2 -2
- package/dist/{chunk-AU6MWQKZ.js → chunk-ABL7IWFZ.js} +1 -1
- package/dist/{chunk-5RH3VXAK.js → chunk-APX63ILU.js} +4 -100
- package/dist/{chunk-W7L4HUT2.cjs → chunk-CJ6TBL2N.cjs} +16 -16
- package/dist/{chunk-7PT4RJL5.cjs → chunk-EUIDTZNQ.cjs} +111 -113
- package/dist/{chunk-CXXXAZ7H.js → chunk-F6R67I3A.js} +1 -1
- package/dist/{chunk-I7NJPHWV.cjs → chunk-FQPUF2W2.cjs} +35 -606
- package/dist/{chunk-D5KGAO4Z.js → chunk-GCVFEPJG.js} +2 -573
- package/dist/{chunk-LEQKZGQI.js → chunk-GOBOCZZI.js} +1 -1
- package/dist/{chunk-PZP2SZIZ.js → chunk-GYMMNCFT.js} +3 -3
- package/dist/{chunk-NUTMINJZ.cjs → chunk-H7ET2ISK.cjs} +52 -52
- package/dist/chunk-HS6QDWDF.cjs +1029 -0
- package/dist/{chunk-T7KQEMAE.cjs → chunk-HUAISCUX.cjs} +18 -18
- package/dist/{chunk-YGQVCQTG.js → chunk-ILP77UD6.js} +1 -1
- package/dist/{chunk-GHCSC2WP.cjs → chunk-ISIO63Q5.cjs} +21 -15
- package/dist/{chunk-S6OT6CTS.cjs → chunk-IWEVV63O.cjs} +31 -33
- package/dist/{chunk-OFH6Q67U.js → chunk-JA57JIT5.js} +9 -3
- package/dist/{chunk-LP2MCSBE.cjs → chunk-JFHBXNR2.cjs} +88 -88
- package/dist/{chunk-IOFVM3L3.cjs → chunk-JPEHXIB5.cjs} +10 -10
- package/dist/chunk-JSDND7DF.cjs +173 -0
- package/dist/{chunk-36ZTV7WO.js → chunk-L6Y7TSQ4.js} +1 -1
- package/dist/{chunk-KYX7NZ5V.cjs → chunk-LFMKWGFL.cjs} +1 -1
- package/dist/{chunk-V6DT2CDH.js → chunk-M2TPMYJE.js} +1 -1
- package/dist/{chunk-LJZRHVZV.cjs → chunk-M5GLQQWG.cjs} +2 -2
- package/dist/{chunk-JEGJP4OW.js → chunk-MHLU6GRJ.js} +196 -7
- package/dist/{chunk-KMPM5JM5.js → chunk-MONXNVZK.js} +4 -6
- package/dist/chunk-MTKY6K3Q.js +1029 -0
- package/dist/{chunk-MOW3JMNG.cjs → chunk-N76AMOKE.cjs} +42 -42
- package/dist/{chunk-75K3W4D6.cjs → chunk-NKGB64CW.cjs} +16 -16
- package/dist/{chunk-SGPIVHJB.js → chunk-P3K2JCJA.js} +3 -3
- package/dist/chunk-PXDIAYB6.cjs +594 -0
- package/dist/{chunk-UBRJOIR5.js → chunk-QC3OXRE4.js} +9 -9
- package/dist/{chunk-QOBCBGGI.cjs → chunk-QKXO6JPP.cjs} +14 -14
- package/dist/{chunk-WLJZZHUZ.cjs → chunk-QLSGTCYT.cjs} +23 -23
- package/dist/{chunk-7YW7T5TJ.js → chunk-RHPSE2YR.js} +2 -2
- package/dist/{chunk-44BMJJVA.cjs → chunk-RUONPPMC.cjs} +8 -8
- package/dist/{chunk-LJRCU3BJ.cjs → chunk-SABJMH6M.cjs} +150 -15
- package/dist/{chunk-XWOLPNBW.cjs → chunk-SOSBOS5T.cjs} +22 -22
- package/dist/chunk-SZTI6EER.js +13 -0
- package/dist/{chunk-PPFJHTW5.cjs → chunk-TFF2GTGN.cjs} +22 -24
- package/dist/{chunk-2SMMZDMG.cjs → chunk-TLOGFIIV.cjs} +37 -37
- package/dist/chunk-TXFWZ5ZJ.js +594 -0
- package/dist/chunk-U67EN7GG.cjs +13 -0
- package/dist/{chunk-GXAK6Q5J.js → chunk-UFEDHACQ.js} +2 -2
- package/dist/{chunk-GA4EU4P3.cjs → chunk-UXETV2NC.cjs} +4 -4
- package/dist/{chunk-N4DFDI73.js → chunk-WKMUBATU.js} +1 -1
- package/dist/{chunk-3R5P3DVY.cjs → chunk-WRZ6C4TU.cjs} +6 -6
- package/dist/{chunk-EJLRBS5Q.js → chunk-WZOGDKCQ.js} +137 -2
- package/dist/{chunk-6ADHGQ73.js → chunk-YBAPT7NL.js} +2 -4
- package/dist/{chunk-K5DS2JTA.cjs → chunk-Z3BRH4JK.cjs} +6 -6
- package/dist/{chunk-XNZFVYC2.cjs → chunk-ZBCT5MEA.cjs} +7 -7
- package/dist/color/index.cjs +4 -6
- package/dist/color/index.js +7 -9
- 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/export/index.cjs +7 -8
- package/dist/export/index.js +6 -7
- package/dist/extensions/index.cjs +10 -11
- package/dist/extensions/index.js +9 -10
- package/dist/gradient/index.cjs +33 -34
- package/dist/gradient/index.js +4 -5
- package/dist/image-editor/effects.d.cts +1 -1
- package/dist/image-editor/effects.d.ts +1 -1
- package/dist/image-editor/index.cjs +887 -863
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +69 -45
- package/dist/image-editor/stickers.d.cts +9 -0
- package/dist/image-editor/stickers.d.ts +9 -0
- package/dist/index.cjs +16 -17
- package/dist/index.js +10 -11
- package/dist/paint/index.cjs +6 -4
- package/dist/paint/index.js +21 -19
- package/dist/paint-editor/brushes.d.cts +1 -2
- package/dist/paint-editor/brushes.d.ts +1 -2
- package/dist/paint-editor/index.cjs +2199 -699
- package/dist/paint-editor/index.js +1577 -77
- package/dist/paint-editor/mark-settings.d.cts +104 -0
- package/dist/paint-editor/mark-settings.d.ts +104 -0
- package/dist/paint-editor/procedural.d.cts +2 -75
- package/dist/paint-editor/procedural.d.ts +2 -75
- package/dist/paint-editor/stickers.d.cts +1 -22
- package/dist/paint-editor/stickers.d.ts +1 -22
- package/dist/raster/index.cjs +2 -2
- package/dist/raster/index.js +9 -9
- 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 +14 -8
- package/dist/stickers/tools.d.cts +57 -1
- package/dist/stickers/tools.d.ts +57 -1
- package/dist/tokens/index.cjs +3 -4
- package/dist/tokens/index.js +2 -3
- package/dist/typography/index.cjs +7 -8
- package/dist/typography/index.js +2 -3
- package/dist/vector/index.cjs +1011 -977
- package/dist/vector/index.d.cts +1 -0
- package/dist/vector/index.d.ts +1 -0
- package/dist/vector/index.js +47 -13
- package/dist/vector/stickers.d.cts +11 -0
- package/dist/vector/stickers.d.ts +11 -0
- package/dist/video-editor/index.cjs +349 -350
- package/dist/video-editor/index.js +9 -10
- package/package.json +11 -1
- package/skills/pixerate-image-editor/SKILL.md +1 -1
- package/skills/pixerate-stickers/SKILL.md +13 -1
- package/dist/chunk-7AHBW2CQ.cjs +0 -200
- package/dist/chunk-F67XMVDI.js +0 -200
- package/dist/chunk-H4AOUUBE.cjs +0 -2635
- package/dist/chunk-J7T5QZ45.js +0 -2635
- package/dist/chunk-ZEYMKDYS.cjs +0 -269
package/dist/canvas/index.d.cts
CHANGED
package/dist/canvas/index.d.ts
CHANGED
package/dist/canvas/index.js
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
brushstrokeSeed,
|
|
3
|
-
getBrushedShapeSvg,
|
|
4
|
-
isBrushedShape,
|
|
5
|
-
listCanvasBrushes,
|
|
6
|
-
loadCanvasBrushstrokeRenderer,
|
|
7
|
-
pathDataToPolyline,
|
|
8
|
-
profileAlongPolyline,
|
|
9
|
-
renderCanvasBrushSwatch,
|
|
10
|
-
renderShapeBrushstroke,
|
|
11
|
-
validateCanvasBrush,
|
|
12
|
-
validateCanvasBrushPaint
|
|
13
|
-
} from "../chunk-6BIDVPED.js";
|
|
14
|
-
import {
|
|
15
|
-
PATHFINDER_OPERATIONS,
|
|
16
|
-
PlanarMap,
|
|
17
|
-
contourEnclosesArea,
|
|
18
|
-
cutOutPiece,
|
|
19
|
-
hatchPath,
|
|
20
|
-
interiorPoint,
|
|
21
|
-
pathfinder
|
|
22
|
-
} from "../chunk-65MDXWA7.js";
|
|
23
1
|
import {
|
|
24
2
|
ARCH_METRICS,
|
|
25
3
|
GANTT_METRICS,
|
|
@@ -54,13 +32,35 @@ import {
|
|
|
54
32
|
textWidth,
|
|
55
33
|
timelineGeometry
|
|
56
34
|
} from "../chunk-DKNEQX7T.js";
|
|
35
|
+
import {
|
|
36
|
+
brushstrokeSeed,
|
|
37
|
+
getBrushedShapeSvg,
|
|
38
|
+
isBrushedShape,
|
|
39
|
+
listCanvasBrushes,
|
|
40
|
+
loadCanvasBrushstrokeRenderer,
|
|
41
|
+
pathDataToPolyline,
|
|
42
|
+
profileAlongPolyline,
|
|
43
|
+
renderCanvasBrushSwatch,
|
|
44
|
+
renderShapeBrushstroke,
|
|
45
|
+
validateCanvasBrush,
|
|
46
|
+
validateCanvasBrushPaint
|
|
47
|
+
} from "../chunk-5JNA6LLY.js";
|
|
48
|
+
import {
|
|
49
|
+
PATHFINDER_OPERATIONS,
|
|
50
|
+
PlanarMap,
|
|
51
|
+
contourEnclosesArea,
|
|
52
|
+
cutOutPiece,
|
|
53
|
+
hatchPath,
|
|
54
|
+
interiorPoint,
|
|
55
|
+
pathfinder
|
|
56
|
+
} from "../chunk-65MDXWA7.js";
|
|
57
57
|
import {
|
|
58
58
|
TokenError,
|
|
59
59
|
getTokenCollection,
|
|
60
60
|
getTokenVariable,
|
|
61
61
|
isTokenInScope,
|
|
62
62
|
resolveToken
|
|
63
|
-
} from "../chunk-
|
|
63
|
+
} from "../chunk-ILP77UD6.js";
|
|
64
64
|
import {
|
|
65
65
|
DEFAULT_NODE_HEIGHT,
|
|
66
66
|
DEFAULT_NODE_WIDTH,
|
|
@@ -121,11 +121,11 @@ import {
|
|
|
121
121
|
} from "../chunk-5ED73EC6.js";
|
|
122
122
|
import {
|
|
123
123
|
layoutChart
|
|
124
|
-
} from "../chunk-
|
|
124
|
+
} from "../chunk-WKMUBATU.js";
|
|
125
|
+
import "../chunk-O6OGNDND.js";
|
|
125
126
|
import {
|
|
126
127
|
createChartSpec
|
|
127
|
-
} from "../chunk-
|
|
128
|
-
import "../chunk-O6OGNDND.js";
|
|
128
|
+
} from "../chunk-6ZZKRH7R.js";
|
|
129
129
|
import "../chunk-II2WIF5Z.js";
|
|
130
130
|
import {
|
|
131
131
|
PathOpsError,
|
|
@@ -212,6 +212,9 @@ import {
|
|
|
212
212
|
shapeToPolygon,
|
|
213
213
|
simplifyRing
|
|
214
214
|
} from "../chunk-PWBZH3FK.js";
|
|
215
|
+
import {
|
|
216
|
+
StickerError
|
|
217
|
+
} from "../chunk-SZTI6EER.js";
|
|
215
218
|
import {
|
|
216
219
|
EffectRendererPool
|
|
217
220
|
} from "../chunk-EHLOCVWB.js";
|
|
@@ -220,7 +223,7 @@ import {
|
|
|
220
223
|
EffectsSlot,
|
|
221
224
|
createEffectToolProvider,
|
|
222
225
|
resolveEffectValues
|
|
223
|
-
} from "../chunk-
|
|
226
|
+
} from "../chunk-JA57JIT5.js";
|
|
224
227
|
import "../chunk-V2ZCJRDM.js";
|
|
225
228
|
import {
|
|
226
229
|
brushstrokeScaleBucket
|
|
@@ -241,7 +244,7 @@ import {
|
|
|
241
244
|
pageHidden,
|
|
242
245
|
realClock,
|
|
243
246
|
wrapAnimationTime
|
|
244
|
-
} from "../chunk-
|
|
247
|
+
} from "../chunk-F6R67I3A.js";
|
|
245
248
|
import {
|
|
246
249
|
ANIMATION_EASING_LABELS,
|
|
247
250
|
ANIMATION_EASING_PRESETS,
|
|
@@ -266,14 +269,13 @@ import {
|
|
|
266
269
|
oklabToRgb,
|
|
267
270
|
parseOklab,
|
|
268
271
|
rgbToOklab
|
|
269
|
-
} from "../chunk-
|
|
272
|
+
} from "../chunk-M2TPMYJE.js";
|
|
270
273
|
import {
|
|
271
274
|
normalizeTokenColor
|
|
272
275
|
} from "../chunk-2WPNAGHI.js";
|
|
273
|
-
import "../chunk-
|
|
274
|
-
import "../chunk-
|
|
275
|
-
import "../chunk-
|
|
276
|
-
import "../chunk-F67XMVDI.js";
|
|
276
|
+
import "../chunk-7272D3K2.js";
|
|
277
|
+
import "../chunk-YBAPT7NL.js";
|
|
278
|
+
import "../chunk-MHLU6GRJ.js";
|
|
277
279
|
import "../chunk-6ONMQ6WF.js";
|
|
278
280
|
|
|
279
281
|
// src/canvas/trajectory.ts
|
|
@@ -12650,6 +12652,57 @@ function createCanvasProposalToolProvider(proposals, options = {}) {
|
|
|
12650
12652
|
tools: [proposeTool, listTool, acceptTool, rejectTool]
|
|
12651
12653
|
};
|
|
12652
12654
|
}
|
|
12655
|
+
|
|
12656
|
+
// src/canvas/stickers.ts
|
|
12657
|
+
function stickerCanvasNode(placement, id) {
|
|
12658
|
+
const { description, asset } = placement;
|
|
12659
|
+
const silhouette = (asset.kind === "svg" ? asset.silhouette : void 0) ?? description.silhouette;
|
|
12660
|
+
if (!silhouette) throw new StickerError("unsupported_format", `"${placement.ref}" has no outline (silhouette); the canvas places stickers by their outline. Pick one whose describe_sticker lists a silhouette.`);
|
|
12661
|
+
const fill = placement.colour ?? description.colours?.[0] ?? "#1f2937";
|
|
12662
|
+
const shape = { kind: "path", d: silhouette, viewBox: [0, 0, description.width, description.height], fillRule: "evenodd", fill };
|
|
12663
|
+
const sticker = { ref: placement.ref, licence: description.licence };
|
|
12664
|
+
return {
|
|
12665
|
+
id,
|
|
12666
|
+
type: SHAPE_NODE_TYPE,
|
|
12667
|
+
position: { x: placement.x - placement.width / 2, y: placement.y - placement.height / 2 },
|
|
12668
|
+
width: placement.width,
|
|
12669
|
+
height: placement.height,
|
|
12670
|
+
data: { label: description.name, [SHAPE_DATA_KEY]: shape, sticker }
|
|
12671
|
+
};
|
|
12672
|
+
}
|
|
12673
|
+
function createCanvasStickerHost(options) {
|
|
12674
|
+
let n3 = 0;
|
|
12675
|
+
const newId = () => {
|
|
12676
|
+
if (options.createId) return options.createId();
|
|
12677
|
+
const taken = new Set(options.getNodes().map((x) => x.id));
|
|
12678
|
+
let id;
|
|
12679
|
+
do
|
|
12680
|
+
id = `sticker-${++n3}`;
|
|
12681
|
+
while (taken.has(id));
|
|
12682
|
+
return id;
|
|
12683
|
+
};
|
|
12684
|
+
return {
|
|
12685
|
+
noun: "shape node",
|
|
12686
|
+
format: "svg",
|
|
12687
|
+
defaultCentre: () => {
|
|
12688
|
+
if (options.defaultCentre) return options.defaultCentre();
|
|
12689
|
+
const nodes = options.getNodes();
|
|
12690
|
+
if (!nodes.length) return { x: 0, y: 0 };
|
|
12691
|
+
const xs = nodes.flatMap((x) => [x.position.x, x.position.x + (x.width ?? 0)]);
|
|
12692
|
+
const ys = nodes.flatMap((x) => [x.position.y, x.position.y + (x.height ?? 0)]);
|
|
12693
|
+
return { x: (Math.min(...xs) + Math.max(...xs)) / 2, y: (Math.min(...ys) + Math.max(...ys)) / 2 };
|
|
12694
|
+
},
|
|
12695
|
+
insert(placement) {
|
|
12696
|
+
const node = stickerCanvasNode(placement, newId());
|
|
12697
|
+
const before = options.getNodes();
|
|
12698
|
+
const next = [...before, node];
|
|
12699
|
+
const label = `Insert ${placement.description.name}`;
|
|
12700
|
+
if (options.history) options.history.execute({ name: label, execute: () => options.setNodes(next), undo: () => options.setNodes(before), redo: () => options.setNodes(next) });
|
|
12701
|
+
else options.setNodes(next);
|
|
12702
|
+
return { id: node.id };
|
|
12703
|
+
}
|
|
12704
|
+
};
|
|
12705
|
+
}
|
|
12653
12706
|
export {
|
|
12654
12707
|
ANIMATABLE_PROPERTIES,
|
|
12655
12708
|
ANIMATION_DATA_KEY,
|
|
@@ -12806,6 +12859,7 @@ export {
|
|
|
12806
12859
|
createCanvasProposalToolProvider,
|
|
12807
12860
|
createCanvasProposals,
|
|
12808
12861
|
createCanvasScenesStore,
|
|
12862
|
+
createCanvasStickerHost,
|
|
12809
12863
|
createDefaultStrokeStyle,
|
|
12810
12864
|
createFanOutTrajectory,
|
|
12811
12865
|
createGuideIndex,
|
|
@@ -13135,6 +13189,7 @@ export {
|
|
|
13135
13189
|
splitSegment,
|
|
13136
13190
|
springAt,
|
|
13137
13191
|
springSettleMs,
|
|
13192
|
+
stickerCanvasNode,
|
|
13138
13193
|
streamedDiagramText,
|
|
13139
13194
|
streamlinePoints,
|
|
13140
13195
|
strikeGesture,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stickers on the canvas: `insert_sticker` (see `@pixerate/editor/stickers`) adds a shape node
|
|
3
|
+
* whose path is the sticker's outline (`silhouette`), filled in its colour (the tint, or its
|
|
4
|
+
* dominant colour), so it resizes, recolours and combines like any shape. The canvas has no image
|
|
5
|
+
* nodes, so multi-colour art is reduced to its outline in one colour; `data.sticker` keeps the ref
|
|
6
|
+
* and licence.
|
|
7
|
+
*/
|
|
8
|
+
import type { Command } from '../history/types.cjs';
|
|
9
|
+
import type { StickerLicence, StickerRef } from '../stickers/types.cjs';
|
|
10
|
+
import type { StickerInsertHost, StickerPlacement } from '../stickers/tools.cjs';
|
|
11
|
+
import type { CanvasNode } from './types.cjs';
|
|
12
|
+
/** What a sticker node remembers: where it came from. */
|
|
13
|
+
export interface CanvasStickerData {
|
|
14
|
+
ref: StickerRef;
|
|
15
|
+
licence: StickerLicence;
|
|
16
|
+
}
|
|
17
|
+
export interface CanvasStickerHostOptions<TNode extends CanvasNode = CanvasNode> {
|
|
18
|
+
getNodes: () => TNode[];
|
|
19
|
+
setNodes: (nodes: TNode[]) => void;
|
|
20
|
+
/** When set, every insertion is one undoable command. */
|
|
21
|
+
history?: {
|
|
22
|
+
execute(command: Command): void;
|
|
23
|
+
};
|
|
24
|
+
/** New node ids (default `sticker-<n>`, skipping ids in use). */
|
|
25
|
+
createId?: () => string;
|
|
26
|
+
/** The default centre (default the middle of the nodes' bounds, or 0, 0). */
|
|
27
|
+
defaultCentre?: () => {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** The shape node for a placed sticker (top-left at its box), or a refusal naming what is missing. */
|
|
33
|
+
export declare function stickerCanvasNode(placement: StickerPlacement, id: string): CanvasNode;
|
|
34
|
+
/** `insert_sticker` for a canvas: a shape node from the sticker's outline, one undo step. */
|
|
35
|
+
export declare function createCanvasStickerHost<TNode extends CanvasNode = CanvasNode>(options: CanvasStickerHostOptions<TNode>): StickerInsertHost;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stickers on the canvas: `insert_sticker` (see `@pixerate/editor/stickers`) adds a shape node
|
|
3
|
+
* whose path is the sticker's outline (`silhouette`), filled in its colour (the tint, or its
|
|
4
|
+
* dominant colour), so it resizes, recolours and combines like any shape. The canvas has no image
|
|
5
|
+
* nodes, so multi-colour art is reduced to its outline in one colour; `data.sticker` keeps the ref
|
|
6
|
+
* and licence.
|
|
7
|
+
*/
|
|
8
|
+
import type { Command } from '../history/types.js';
|
|
9
|
+
import type { StickerLicence, StickerRef } from '../stickers/types.js';
|
|
10
|
+
import type { StickerInsertHost, StickerPlacement } from '../stickers/tools.js';
|
|
11
|
+
import type { CanvasNode } from './types.js';
|
|
12
|
+
/** What a sticker node remembers: where it came from. */
|
|
13
|
+
export interface CanvasStickerData {
|
|
14
|
+
ref: StickerRef;
|
|
15
|
+
licence: StickerLicence;
|
|
16
|
+
}
|
|
17
|
+
export interface CanvasStickerHostOptions<TNode extends CanvasNode = CanvasNode> {
|
|
18
|
+
getNodes: () => TNode[];
|
|
19
|
+
setNodes: (nodes: TNode[]) => void;
|
|
20
|
+
/** When set, every insertion is one undoable command. */
|
|
21
|
+
history?: {
|
|
22
|
+
execute(command: Command): void;
|
|
23
|
+
};
|
|
24
|
+
/** New node ids (default `sticker-<n>`, skipping ids in use). */
|
|
25
|
+
createId?: () => string;
|
|
26
|
+
/** The default centre (default the middle of the nodes' bounds, or 0, 0). */
|
|
27
|
+
defaultCentre?: () => {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** The shape node for a placed sticker (top-left at its box), or a refusal naming what is missing. */
|
|
33
|
+
export declare function stickerCanvasNode(placement: StickerPlacement, id: string): CanvasNode;
|
|
34
|
+
/** `insert_sticker` for a canvas: a shape node from the sticker's outline, one undo step. */
|
|
35
|
+
export declare function createCanvasStickerHost<TNode extends CanvasNode = CanvasNode>(options: CanvasStickerHostOptions<TNode>): StickerInsertHost;
|