@pixerate/editor 0.126.0 → 0.128.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 +2 -2
- package/dist/agent/index.d.cts +3 -3
- package/dist/agent/index.d.ts +3 -3
- package/dist/agent/index.js +1 -1
- package/dist/animation/index.d.cts +2 -3
- package/dist/animation/index.d.ts +2 -3
- package/dist/animation-editor/index.cjs +63 -63
- package/dist/animation-editor/index.cjs.map +1 -1
- package/dist/animation-editor/index.d.cts +7 -9
- package/dist/animation-editor/index.d.ts +7 -9
- package/dist/animation-editor/index.js +10 -10
- package/dist/{arrange-BlfgJ_wt.d.ts → arrange-BUREmgD9.d.ts} +1 -1
- package/dist/{arrange-CD6Gh-pd.d.cts → arrange-CKXK_hf7.d.cts} +1 -1
- package/dist/{bezier-CWv6LQal.d.ts → bezier-CvgQiYRg.d.cts} +23 -3
- package/dist/{bezier-CBzKKDjl.d.cts → bezier-DP4NnJp3.d.ts} +23 -3
- package/dist/{brushTypes-IG7ZZjIN.d.cts → brushTypes-C7N3EBK7.d.cts} +56 -1
- package/dist/{brushTypes-IG7ZZjIN.d.ts → brushTypes-C7N3EBK7.d.ts} +56 -1
- package/dist/{brushstrokeRender-EELTV7U4.cjs → brushstrokeRender-JNHVEUFG.cjs} +29 -10
- package/dist/brushstrokeRender-JNHVEUFG.cjs.map +1 -0
- package/dist/{brushstrokeRender-LRV7GXGD.js → brushstrokeRender-SII6MG4R.js} +25 -6
- package/dist/brushstrokeRender-SII6MG4R.js.map +1 -0
- package/dist/{builtins-DMIsnNst.d.cts → builtins-Cc-bH-3U.d.cts} +3 -2
- package/dist/{builtins-B5-ipm5u.d.ts → builtins-ZU1GJnUA.d.ts} +3 -2
- package/dist/canvas/index.cjs +435 -38
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +206 -16
- package/dist/canvas/index.d.ts +206 -16
- package/dist/canvas/index.js +408 -11
- package/dist/canvas/index.js.map +1 -1
- package/dist/{chunk-MPQAO33O.js → chunk-A6KHMKI4.js} +3 -3
- package/dist/{chunk-V5YGPRCZ.cjs → chunk-BEGEWQHD.cjs} +41 -41
- package/dist/{chunk-V5YGPRCZ.cjs.map → chunk-BEGEWQHD.cjs.map} +1 -1
- package/dist/{chunk-N3FVUOZD.cjs → chunk-BJTCSLF6.cjs} +7 -7
- package/dist/{chunk-N3FVUOZD.cjs.map → chunk-BJTCSLF6.cjs.map} +1 -1
- package/dist/{chunk-7LQO6OHH.cjs → chunk-DDSO4HS7.cjs} +9 -5
- package/dist/chunk-DDSO4HS7.cjs.map +1 -0
- package/dist/{chunk-AKU2KQ47.cjs → chunk-DFSZO2B5.cjs} +70 -3
- package/dist/chunk-DFSZO2B5.cjs.map +1 -0
- package/dist/{chunk-WUDPFWAN.js → chunk-F7Q2NE2Y.js} +3 -3
- package/dist/{chunk-GUZ47CJM.cjs → chunk-IZ4WRXZA.cjs} +1 -1
- package/dist/{chunk-GUZ47CJM.cjs.map → chunk-IZ4WRXZA.cjs.map} +1 -1
- package/dist/{chunk-GLWZXQ4Q.js → chunk-KHNZ6MOU.js} +1 -1
- package/dist/chunk-KHNZ6MOU.js.map +1 -0
- package/dist/{chunk-GCJWMEYW.cjs → chunk-KSJLDRHK.cjs} +46 -46
- package/dist/{chunk-GCJWMEYW.cjs.map → chunk-KSJLDRHK.cjs.map} +1 -1
- package/dist/{chunk-2SDGZAJR.js → chunk-LSXXAJG3.js} +70 -3
- package/dist/chunk-LSXXAJG3.js.map +1 -0
- package/dist/{chunk-QQKTOA4U.cjs → chunk-ORE334I6.cjs} +132 -132
- package/dist/{chunk-QQKTOA4U.cjs.map → chunk-ORE334I6.cjs.map} +1 -1
- package/dist/{chunk-X6KTSFAE.js → chunk-Q4NBEVV5.js} +2 -2
- package/dist/{chunk-FPRIUR4T.js → chunk-ROZFX4QI.js} +3 -3
- package/dist/{chunk-J67OLQUQ.js → chunk-SVYE5HIM.js} +7 -3
- package/dist/chunk-SVYE5HIM.js.map +1 -0
- package/dist/{chunk-O5RVCDEC.cjs → chunk-XLUYXUBD.cjs} +88 -88
- package/dist/{chunk-O5RVCDEC.cjs.map → chunk-XLUYXUBD.cjs.map} +1 -1
- package/dist/{chunk-FG274FYT.js → chunk-YGJIER2R.js} +2 -2
- package/dist/commands/index.cjs +2 -2
- package/dist/commands/index.d.cts +3 -3
- package/dist/commands/index.d.ts +3 -3
- package/dist/commands/index.js +1 -1
- package/dist/effects/index.d.cts +6 -38
- package/dist/effects/index.d.ts +6 -38
- package/dist/evaluate-BbCeF6pt.d.ts +114 -0
- package/dist/evaluate-BsxYieLN.d.cts +114 -0
- package/dist/{export-Bp7ji2r4.d.cts → export-BkYQvV56.d.cts} +4 -4
- package/dist/{export-DVl4fWy5.d.cts → export-Cbr9IqpJ.d.cts} +1 -1
- package/dist/{export-C1s4eolZ.d.ts → export-ClPKUB-v.d.ts} +1 -1
- package/dist/{export-DAyPY94f.d.ts → export-DHrFJ8r_.d.ts} +4 -4
- package/dist/{helpers-i95Ob6Vi.d.cts → helpers-C5aAd44p.d.cts} +67 -4
- package/dist/{helpers-BBLlekuM.d.ts → helpers-CPWcK504.d.ts} +67 -4
- package/dist/image-editor/index.cjs +606 -606
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +12 -14
- package/dist/image-editor/index.d.ts +12 -14
- package/dist/image-editor/index.js +4 -4
- package/dist/{opentype-D80AVmMu.d.cts → opentype-BOewaGQx.d.cts} +1 -1
- package/dist/{opentype-14PDI5D2.d.ts → opentype-sQrF3Ry1.d.ts} +1 -1
- package/dist/paint/index.d.cts +2 -2
- package/dist/paint/index.d.ts +2 -2
- package/dist/paint-editor/index.cjs +9 -9
- package/dist/paint-editor/index.cjs.map +1 -1
- package/dist/paint-editor/index.d.cts +9 -11
- package/dist/paint-editor/index.d.ts +9 -11
- package/dist/paint-editor/index.js +4 -4
- package/dist/{pathfinder-DjISxkUv.d.ts → pathfinder-BwJx0_zM.d.ts} +2 -2
- package/dist/{pathfinder-C0UoFypx.d.cts → pathfinder-CnkW7zLI.d.cts} +2 -2
- package/dist/{player-cGLrngL_.d.ts → player-BK2kKbfd.d.ts} +1 -1
- package/dist/{player-CBtEoU2x.d.cts → player-CmbY3218.d.cts} +1 -1
- package/dist/pool-C7GtrL34.d.cts +34 -0
- package/dist/pool-CTrtciaN.d.ts +34 -0
- package/dist/{rand-CfinE-1c.d.cts → rand-DTXAssW1.d.cts} +4 -4
- package/dist/{rand-DtazXGOB.d.ts → rand-pQQ2sJTk.d.ts} +4 -4
- package/dist/{svg-DJKriJ4A.d.ts → svg-C4LlFnEw.d.cts} +2 -3
- package/dist/{svg-BkRL-fZJ.d.cts → svg-CUzZa0EO.d.ts} +2 -3
- package/dist/{tools-CM8Oe8F3.d.ts → tools-AugT22z3.d.ts} +1 -1
- package/dist/{tools-DZCv2kX1.d.cts → tools-BpCmUNxb.d.cts} +1 -1
- package/dist/vector/index.cjs +918 -918
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +11 -13
- package/dist/vector/index.d.ts +11 -13
- package/dist/vector/index.js +11 -11
- package/dist/video-editor/index.d.cts +6 -8
- package/dist/video-editor/index.d.ts +6 -8
- package/dist/{warp-k_PdtXOG.d.ts → warp-CIsO617e.d.ts} +1 -1
- package/dist/{warp-CH9MM435.d.cts → warp-D62N_5VK.d.cts} +1 -1
- package/package.json +1 -1
- package/skills/pixerate-canvas/SKILL.md +30 -2
- package/dist/behavior-Ymbld6jL.d.cts +0 -60
- package/dist/behavior-Ymbld6jL.d.ts +0 -60
- package/dist/brushstrokeRender-EELTV7U4.cjs.map +0 -1
- package/dist/brushstrokeRender-LRV7GXGD.js.map +0 -1
- package/dist/chunk-2SDGZAJR.js.map +0 -1
- package/dist/chunk-7LQO6OHH.cjs.map +0 -1
- package/dist/chunk-AKU2KQ47.cjs.map +0 -1
- package/dist/chunk-GLWZXQ4Q.js.map +0 -1
- package/dist/chunk-J67OLQUQ.js.map +0 -1
- package/dist/evaluate-2S3vSPLy.d.cts +0 -55
- package/dist/evaluate-CfmT6xA3.d.ts +0 -55
- package/dist/gradient-KDfCvhuj.d.cts +0 -66
- package/dist/gradient-KDfCvhuj.d.ts +0 -66
- /package/dist/{chunk-MPQAO33O.js.map → chunk-A6KHMKI4.js.map} +0 -0
- /package/dist/{chunk-WUDPFWAN.js.map → chunk-F7Q2NE2Y.js.map} +0 -0
- /package/dist/{chunk-X6KTSFAE.js.map → chunk-Q4NBEVV5.js.map} +0 -0
- /package/dist/{chunk-FPRIUR4T.js.map → chunk-ROZFX4QI.js.map} +0 -0
- /package/dist/{chunk-FG274FYT.js.map → chunk-YGJIER2R.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/canvas/brushstroke.ts"],"sourcesContent":["/**\n * Brushed freehand strokes: a path shape with a `brush` keeps its path (selection, editing, eraser\n * hit-testing, grouping and export work as for any path) and is drawn with the paint engine's\n * dry brushstroke renderer instead of an SVG stroke. The renderer, the paint presets and the colour\n * parser live in a separate chunk, loaded the first time a brushed stroke is drawn, so canvases\n * without brushes never load the paint engine.\n */\nimport { brushstrokeScaleBucket } from '../paint/brushstroke-scale.js';\nimport { parseSvgPath, type PathShape, type ShapeDescription, type ShapeSize } from './shapeGeometry.js';\nimport type { Point } from './types.js';\nimport type { CanvasBrush, CanvasBrushPreset, CanvasBrushstroke } from './brushTypes.js';\n\nexport type { CanvasBrush, CanvasBrushPreset, CanvasBrushSettings, CanvasBrushstroke } from './brushTypes.js';\n\nexport { brushstrokeScaleBucket };\n\n/** A brushed stroke's image, placed in the path's coordinates (the shape's view box). */\nexport interface CanvasBrushstrokeImage {\n\t/** PNG data URL. */\n\thref: string;\n\tx: number;\n\ty: number;\n\twidth: number;\n\theight: number;\n\t/** Image pixels per path unit. */\n\tscale: number;\n}\n\n/** A path shape with a brush. */\nexport type BrushedPathShape = PathShape & { brush: CanvasBrushstroke };\n\n/** Whether a shape is a brushed stroke. */\nexport function isBrushedShape(shape: ShapeDescription | null | undefined): shape is BrushedPathShape {\n\treturn !!shape && shape.kind === 'path' && !!shape.brush && typeof shape.brush === 'object' && shape.brush.brush != null;\n}\n\n/**\n * The open polyline of a path's first subpath, in path coordinates: lines kept, curves sampled\n * every `step` units or so. Brushed strokes are drawn along it.\n */\nexport function pathDataToPolyline(d: string, step = 2): Point[] {\n\tconst out: Point[] = [];\n\tlet x = 0;\n\tlet y = 0;\n\tlet started = false;\n\tconst push = (px: number, py: number) => {\n\t\tconst last = out[out.length - 1];\n\t\tif (!last || last[0] !== px || last[1] !== py) out.push([px, py]);\n\t};\n\tfor (const c of parseSvgPath(d)) {\n\t\tif (c.type === 'M') {\n\t\t\tif (started) break;\n\t\t\tstarted = true;\n\t\t\tx = c.x;\n\t\t\ty = c.y;\n\t\t\tpush(x, y);\n\t\t} else if (c.type === 'Z') {\n\t\t\tif (out.length) push(out[0][0], out[0][1]);\n\t\t\tbreak;\n\t\t} else if (c.type === 'C' || c.type === 'Q') {\n\t\t\tconst pts = c.type === 'C' ? [[x, y], [c.x1, c.y1], [c.x2, c.y2], [c.x, c.y]] : [[x, y], [c.x1, c.y1], [c.x, c.y]];\n\t\t\tlet hull = 0;\n\t\t\tfor (let i = 1; i < pts.length; i++) hull += Math.hypot(pts[i][0] - pts[i - 1][0], pts[i][1] - pts[i - 1][1]);\n\t\t\tconst n = Math.max(1, Math.min(256, Math.ceil(hull / Math.max(0.25, step))));\n\t\t\tfor (let k = 1; k <= n; k++) {\n\t\t\t\tconst t = k / n;\n\t\t\t\tconst u = 1 - t;\n\t\t\t\tif (c.type === 'C') {\n\t\t\t\t\tpush(\n\t\t\t\t\t\tu * u * u * x + 3 * u * u * t * c.x1 + 3 * u * t * t * c.x2 + t * t * t * c.x,\n\t\t\t\t\t\tu * u * u * y + 3 * u * u * t * c.y1 + 3 * u * t * t * c.y2 + t * t * t * c.y\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tpush(u * u * x + 2 * u * t * c.x1 + t * t * c.x, u * u * y + 2 * u * t * c.y1 + t * t * c.y);\n\t\t\t\t}\n\t\t\t}\n\t\t\tx = c.x;\n\t\t\ty = c.y;\n\t\t} else {\n\t\t\t// Lines, and arcs as their chords (freehand paths have none).\n\t\t\tx = c.x;\n\t\t\ty = c.y;\n\t\t\tpush(x, y);\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n * Resamples per-point values into `count` values spread evenly along the polyline's length (the\n * profile a brushed stroke stores). Values are rounded to three decimals.\n */\nexport function profileAlongPolyline(points: readonly Point[], values: readonly number[], count = 32): number[] {\n\tconst n = Math.min(points.length, values.length);\n\tif (n === 0) return [];\n\tif (n === 1) return [round3(values[0])];\n\tconst lengths = [0];\n\tfor (let i = 1; i < n; i++) lengths.push(lengths[i - 1] + Math.hypot(points[i][0] - points[i - 1][0], points[i][1] - points[i - 1][1]));\n\tconst total = lengths[n - 1];\n\tconst m = Math.max(2, Math.min(count, n));\n\tconst out: number[] = [];\n\tlet j = 0;\n\tfor (let k = 0; k < m; k++) {\n\t\tconst at = total > 0 ? (total * k) / (m - 1) : 0;\n\t\twhile (j < n - 2 && lengths[j + 1] < at) j++;\n\t\tconst span = lengths[j + 1] - lengths[j];\n\t\tconst f = span > 0 ? Math.min(1, Math.max(0, (at - lengths[j]) / span)) : 0;\n\t\tout.push(round3(values[j] + (values[j + 1] - values[j]) * f));\n\t}\n\treturn out;\n}\n\nconst round3 = (v: number) => Math.round(v * 1000) / 1000;\n\n// ---------------------------------------------------------------------------\n// The lazily loaded renderer\n// ---------------------------------------------------------------------------\n\n/** The renderer chunk (`./brushstrokeRender.ts`). */\nexport interface CanvasBrushstrokeRenderer {\n\tlistCanvasBrushes(): CanvasBrushPreset[];\n\t/** Throws for an unknown or non-dry brush; the result is the paint engine's brush. */\n\tresolveCanvasBrush(brush: CanvasBrush, width: number): unknown;\n\trenderShapeBrushstrokeNow(shape: BrushedPathShape, scale: number): CanvasBrushstrokeImage | null;\n\tbrushedShapeSvgNow(shape: BrushedPathShape, size: ShapeSize, scale: number): string;\n}\n\nlet loading: Promise<CanvasBrushstrokeRenderer> | null = null;\n\n/**\n * Loads the brushstroke renderer (the paint engine's dry brushes, the paint presets and a CSS\n * colour parser). Called for you by the functions below; call it early to warm up.\n */\nexport function loadCanvasBrushstrokeRenderer(): Promise<CanvasBrushstrokeRenderer> {\n\tloading ??= (import('./brushstrokeRender.js') as Promise<CanvasBrushstrokeRenderer>).catch((error) => {\n\t\tloading = null;\n\t\tthrow error;\n\t});\n\treturn loading;\n}\n\n/** The dry paint presets a freehand stroke can use (wet, mixer, blender, smudge and eraser presets are left out). */\nexport async function listCanvasBrushes(): Promise<CanvasBrushPreset[]> {\n\treturn (await loadCanvasBrushstrokeRenderer()).listCanvasBrushes();\n}\n\n/**\n * Checks a brush: an unknown preset id, a wet (or other non-dry) preset, or settings that are not\n * an object throw an error saying which presets can be used.\n */\nexport async function validateCanvasBrush(brush: CanvasBrush): Promise<void> {\n\t(await loadCanvasBrushstrokeRenderer()).resolveCanvasBrush(brush, 1);\n}\n\nexport interface RenderShapeBrushstrokeOptions {\n\t/** Image pixels per path unit; pass `brushstrokeScaleBucket(zoom × node scale, devicePixelRatio)` (default 1). */\n\tscale?: number;\n}\n\n/**\n * Renders a brushed path shape to a cached PNG placed in path coordinates, or null for a shape\n * without a brush or an empty path. Throws for an unknown or non-dry brush.\n */\nexport async function renderShapeBrushstroke(shape: ShapeDescription, options: RenderShapeBrushstrokeOptions = {}): Promise<CanvasBrushstrokeImage | null> {\n\tif (!isBrushedShape(shape)) return null;\n\treturn (await loadCanvasBrushstrokeRenderer()).renderShapeBrushstrokeNow(shape, options.scale ?? 1);\n}\n\n/**\n * The brushed stroke as a standalone SVG document of `size` (the node box), with the image\n * embedded as a PNG data URL: what an SVG export writes for the node. Shapes without a brush give\n * null (export them as paths).\n */\nexport async function getBrushedShapeSvg(shape: ShapeDescription, size: ShapeSize, options: RenderShapeBrushstrokeOptions = {}): Promise<string | null> {\n\tif (!isBrushedShape(shape)) return null;\n\treturn (await loadCanvasBrushstrokeRenderer()).brushedShapeSvgNow(shape, size, options.scale ?? 2);\n}\n"],"mappings":";;;;;AAgCO,SAAS,eAAe,OAAuE;AACrG,SAAO,CAAC,CAAC,SAAS,MAAM,SAAS,UAAU,CAAC,CAAC,MAAM,SAAS,OAAO,MAAM,UAAU,YAAY,MAAM,MAAM,SAAS;AACrH;AAMO,SAAS,mBAAmB,GAAW,OAAO,GAAY;AAChE,QAAM,MAAe,CAAC;AACtB,MAAI,IAAI;AACR,MAAI,IAAI;AACR,MAAI,UAAU;AACd,QAAM,OAAO,CAAC,IAAY,OAAe;AACxC,UAAM,OAAO,IAAI,IAAI,SAAS,CAAC;AAC/B,QAAI,CAAC,QAAQ,KAAK,CAAC,MAAM,MAAM,KAAK,CAAC,MAAM,GAAI,KAAI,KAAK,CAAC,IAAI,EAAE,CAAC;AAAA,EACjE;AACA,aAAW,KAAK,aAAa,CAAC,GAAG;AAChC,QAAI,EAAE,SAAS,KAAK;AACnB,UAAI,QAAS;AACb,gBAAU;AACV,UAAI,EAAE;AACN,UAAI,EAAE;AACN,WAAK,GAAG,CAAC;AAAA,IACV,WAAW,EAAE,SAAS,KAAK;AAC1B,UAAI,IAAI,OAAQ,MAAK,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;AACzC;AAAA,IACD,WAAW,EAAE,SAAS,OAAO,EAAE,SAAS,KAAK;AAC5C,YAAM,MAAM,EAAE,SAAS,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;AACjH,UAAI,OAAO;AACX,eAAS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mBAAmB,OAAO,CAAC;AACpE;AAWA,eAAsB,uBAAuB,OAAyB,UAAyC,CAAC,GAA2C;AAC1J,MAAI,CAAC,eAAe,KAAK,EAAG,QAAO;AACnC,UAAQ,MAAM,8BAA8B,GAAG,0BAA0B,OAAO,QAAQ,SAAS,CAAC;AACnG;AAOA,eAAsB,mBAAmB,OAAyB,MAAiB,UAAyC,CAAC,GAA2B;AACvJ,MAAI,CAAC,eAAe,KAAK,EAAG,QAAO;AACnC,UAAQ,MAAM,8BAA8B,GAAG,mBAAmB,OAAO,MAAM,QAAQ,SAAS,CAAC;AAClG;","names":[]}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { b as AnimationEasing } from './easing-lM0Xo9Ni.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Keyframe tracks, independent of what they animate: each track is a list of keyframes
|
|
5
|
-
* `{ time (ms), value, easing }`, where the easing governs the segment *leaving* the keyframe
|
|
6
|
-
* (filmcraft / After Effects convention).
|
|
7
|
-
*/
|
|
8
|
-
/** Keyframe times closer than this (ms) are the same time. */
|
|
9
|
-
declare const ANIMATION_TIME_EPSILON = 0.000001;
|
|
10
|
-
/** A keyframe value: a number, or a CSS colour for colour properties. */
|
|
11
|
-
type AnimationValue = number | string;
|
|
12
|
-
interface AnimationKeyframe {
|
|
13
|
-
/** Time in milliseconds from the start of the timeline. */
|
|
14
|
-
time: number;
|
|
15
|
-
value: AnimationValue;
|
|
16
|
-
/** Easing of the segment from this keyframe to the next (default `linear`). */
|
|
17
|
-
easing?: AnimationEasing;
|
|
18
|
-
}
|
|
19
|
-
interface AnimationTrack {
|
|
20
|
-
keyframes: AnimationKeyframe[];
|
|
21
|
-
/** Disabled tracks keep their keyframes but do not animate (default `true`). */
|
|
22
|
-
enabled?: boolean;
|
|
23
|
-
}
|
|
24
|
-
/** How a track's values interpolate: numbers linearly, colours in OKLab. */
|
|
25
|
-
type AnimationValueType = 'number' | 'color';
|
|
26
|
-
/** Whether `value` is a well-formed keyframe. */
|
|
27
|
-
declare function isAnimationKeyframe(value: unknown): value is AnimationKeyframe;
|
|
28
|
-
/**
|
|
29
|
-
* Keyframes sorted by time, invalid entries dropped and duplicate times merged (the *later*
|
|
30
|
-
* entry in the array wins, so appending a keyframe replaces one at the same time). Cached per
|
|
31
|
-
* array (revalidated by element identity), so evaluating every frame does not re-sort; treat
|
|
32
|
-
* keyframe objects as immutable.
|
|
33
|
-
*/
|
|
34
|
-
declare function normalizeKeyframes(keyframes: readonly AnimationKeyframe[] | undefined | null): AnimationKeyframe[];
|
|
35
|
-
|
|
36
|
-
/** How time past the end of the timeline maps back into it. */
|
|
37
|
-
type AnimationLoopMode = 'none' | 'loop' | 'ping-pong';
|
|
38
|
-
/**
|
|
39
|
-
* Interpolates between two keyframe values: numbers linearly, colours in OKLab (premultiplied
|
|
40
|
-
* alpha). Mismatched or unreadable values hold `from` until `t` reaches 1.
|
|
41
|
-
*/
|
|
42
|
-
declare function interpolateAnimationValue(from: AnimationValue, to: AnimationValue, t: number, type?: AnimationValueType): AnimationValue;
|
|
43
|
-
/**
|
|
44
|
-
* A track's value at `time`. Before the first keyframe it holds the first value, after the
|
|
45
|
-
* last the last value. Keyframes may be unsorted or share times (see `normalizeKeyframes`).
|
|
46
|
-
* Returns `undefined` for a track without valid keyframes.
|
|
47
|
-
*/
|
|
48
|
-
declare function evaluateTrack(track: AnimationTrack | readonly AnimationKeyframe[] | undefined | null, time: number, type?: AnimationValueType): AnimationValue | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* Maps a running time onto the timeline `[0, duration]`: clamped (`none`), wrapped (`loop`)
|
|
51
|
-
* or bounced (`ping-pong`).
|
|
52
|
-
*/
|
|
53
|
-
declare function wrapAnimationTime(time: number, duration: number, loop?: AnimationLoopMode): number;
|
|
54
|
-
|
|
55
|
-
export { ANIMATION_TIME_EPSILON as A, type AnimationKeyframe as a, type AnimationLoopMode as b, type AnimationTrack as c, type AnimationValue as d, type AnimationValueType as e, evaluateTrack as f, isAnimationKeyframe as g, interpolateAnimationValue as i, normalizeKeyframes as n, wrapAnimationTime as w };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { b as AnimationEasing } from './easing-lM0Xo9Ni.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Keyframe tracks, independent of what they animate: each track is a list of keyframes
|
|
5
|
-
* `{ time (ms), value, easing }`, where the easing governs the segment *leaving* the keyframe
|
|
6
|
-
* (filmcraft / After Effects convention).
|
|
7
|
-
*/
|
|
8
|
-
/** Keyframe times closer than this (ms) are the same time. */
|
|
9
|
-
declare const ANIMATION_TIME_EPSILON = 0.000001;
|
|
10
|
-
/** A keyframe value: a number, or a CSS colour for colour properties. */
|
|
11
|
-
type AnimationValue = number | string;
|
|
12
|
-
interface AnimationKeyframe {
|
|
13
|
-
/** Time in milliseconds from the start of the timeline. */
|
|
14
|
-
time: number;
|
|
15
|
-
value: AnimationValue;
|
|
16
|
-
/** Easing of the segment from this keyframe to the next (default `linear`). */
|
|
17
|
-
easing?: AnimationEasing;
|
|
18
|
-
}
|
|
19
|
-
interface AnimationTrack {
|
|
20
|
-
keyframes: AnimationKeyframe[];
|
|
21
|
-
/** Disabled tracks keep their keyframes but do not animate (default `true`). */
|
|
22
|
-
enabled?: boolean;
|
|
23
|
-
}
|
|
24
|
-
/** How a track's values interpolate: numbers linearly, colours in OKLab. */
|
|
25
|
-
type AnimationValueType = 'number' | 'color';
|
|
26
|
-
/** Whether `value` is a well-formed keyframe. */
|
|
27
|
-
declare function isAnimationKeyframe(value: unknown): value is AnimationKeyframe;
|
|
28
|
-
/**
|
|
29
|
-
* Keyframes sorted by time, invalid entries dropped and duplicate times merged (the *later*
|
|
30
|
-
* entry in the array wins, so appending a keyframe replaces one at the same time). Cached per
|
|
31
|
-
* array (revalidated by element identity), so evaluating every frame does not re-sort; treat
|
|
32
|
-
* keyframe objects as immutable.
|
|
33
|
-
*/
|
|
34
|
-
declare function normalizeKeyframes(keyframes: readonly AnimationKeyframe[] | undefined | null): AnimationKeyframe[];
|
|
35
|
-
|
|
36
|
-
/** How time past the end of the timeline maps back into it. */
|
|
37
|
-
type AnimationLoopMode = 'none' | 'loop' | 'ping-pong';
|
|
38
|
-
/**
|
|
39
|
-
* Interpolates between two keyframe values: numbers linearly, colours in OKLab (premultiplied
|
|
40
|
-
* alpha). Mismatched or unreadable values hold `from` until `t` reaches 1.
|
|
41
|
-
*/
|
|
42
|
-
declare function interpolateAnimationValue(from: AnimationValue, to: AnimationValue, t: number, type?: AnimationValueType): AnimationValue;
|
|
43
|
-
/**
|
|
44
|
-
* A track's value at `time`. Before the first keyframe it holds the first value, after the
|
|
45
|
-
* last the last value. Keyframes may be unsorted or share times (see `normalizeKeyframes`).
|
|
46
|
-
* Returns `undefined` for a track without valid keyframes.
|
|
47
|
-
*/
|
|
48
|
-
declare function evaluateTrack(track: AnimationTrack | readonly AnimationKeyframe[] | undefined | null, time: number, type?: AnimationValueType): AnimationValue | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* Maps a running time onto the timeline `[0, duration]`: clamped (`none`), wrapped (`loop`)
|
|
51
|
-
* or bounced (`ping-pong`).
|
|
52
|
-
*/
|
|
53
|
-
declare function wrapAnimationTime(time: number, duration: number, loop?: AnimationLoopMode): number;
|
|
54
|
-
|
|
55
|
-
export { ANIMATION_TIME_EPSILON as A, type AnimationKeyframe as a, type AnimationLoopMode as b, type AnimationTrack as c, type AnimationValue as d, type AnimationValueType as e, evaluateTrack as f, isAnimationKeyframe as g, interpolateAnimationValue as i, normalizeKeyframes as n, wrapAnimationTime as w };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Canvas gradient models, parsing, presets, and SVG defs generation.
|
|
3
|
-
* Supports linear and radial gradients for shape fills, strokes, and freehand drawing.
|
|
4
|
-
*/
|
|
5
|
-
interface GradientStop {
|
|
6
|
-
offset: number;
|
|
7
|
-
color: string;
|
|
8
|
-
opacity?: number;
|
|
9
|
-
}
|
|
10
|
-
interface CanvasLinearGradient {
|
|
11
|
-
type: 'linear';
|
|
12
|
-
angle?: number;
|
|
13
|
-
stops: GradientStop[];
|
|
14
|
-
}
|
|
15
|
-
interface CanvasRadialGradient {
|
|
16
|
-
type: 'radial';
|
|
17
|
-
cx?: number;
|
|
18
|
-
cy?: number;
|
|
19
|
-
r?: number;
|
|
20
|
-
stops: GradientStop[];
|
|
21
|
-
}
|
|
22
|
-
type CanvasGradientDef = CanvasLinearGradient | CanvasRadialGradient;
|
|
23
|
-
interface SvgGradientStop {
|
|
24
|
-
offset: string;
|
|
25
|
-
stopColor: string;
|
|
26
|
-
stopOpacity?: number;
|
|
27
|
-
}
|
|
28
|
-
interface SvgGradientDef {
|
|
29
|
-
id: string;
|
|
30
|
-
type: 'linear' | 'radial';
|
|
31
|
-
attrs: Record<string, string | number>;
|
|
32
|
-
stops: SvgGradientStop[];
|
|
33
|
-
}
|
|
34
|
-
declare const PIXERATE_BRAND_GRADIENT: CanvasLinearGradient;
|
|
35
|
-
declare const CANVAS_GRADIENT_PRESETS: Record<string, CanvasLinearGradient>;
|
|
36
|
-
/** Whether an arbitrary value matches a CanvasGradientDef object. */
|
|
37
|
-
declare function isCanvasGradient(value: unknown): value is CanvasGradientDef;
|
|
38
|
-
/**
|
|
39
|
-
* Parses CSS linear-gradient or radial-gradient strings into CanvasGradientDef.
|
|
40
|
-
* Supports forms like:
|
|
41
|
-
* - linear-gradient(90deg, #ff0000 0%, #0000ff 100%)
|
|
42
|
-
* - linear-gradient(to right, red, blue)
|
|
43
|
-
* - radial-gradient(circle, red 0%, blue 100%)
|
|
44
|
-
*/
|
|
45
|
-
declare function parseCssGradient(css: string): CanvasGradientDef | null;
|
|
46
|
-
/**
|
|
47
|
-
* Resolves a paint value (which could be a CSS color, preset name, CSS gradient string, or CanvasGradientDef)
|
|
48
|
-
* into either a CanvasGradientDef (if gradient) or null (if solid color or invalid).
|
|
49
|
-
*/
|
|
50
|
-
declare function resolveCanvasGradient(value: unknown): CanvasGradientDef | null;
|
|
51
|
-
/**
|
|
52
|
-
* Converts degrees clockwise (CSS angle: 0 = top, 90 = right, 180 = bottom, 270 = left)
|
|
53
|
-
* to SVG linearGradient vector coordinates (x1, y1, x2, y2) normalized [0, 1].
|
|
54
|
-
*/
|
|
55
|
-
declare function angleToSvgLinearCoords(angleDeg?: number): {
|
|
56
|
-
x1: number;
|
|
57
|
-
y1: number;
|
|
58
|
-
x2: number;
|
|
59
|
-
y2: number;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Converts a CanvasGradientDef to an SvgGradientDef descriptor ready for rendering `<linearGradient>` / `<radialGradient>`.
|
|
63
|
-
*/
|
|
64
|
-
declare function gradientToSvgDef(gradient: CanvasGradientDef, id: string): SvgGradientDef;
|
|
65
|
-
|
|
66
|
-
export { type CanvasGradientDef as C, type GradientStop as G, PIXERATE_BRAND_GRADIENT as P, type SvgGradientDef as S, CANVAS_GRADIENT_PRESETS as a, type CanvasLinearGradient as b, type CanvasRadialGradient as c, type SvgGradientStop as d, angleToSvgLinearCoords as e, gradientToSvgDef as g, isCanvasGradient as i, parseCssGradient as p, resolveCanvasGradient as r };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Canvas gradient models, parsing, presets, and SVG defs generation.
|
|
3
|
-
* Supports linear and radial gradients for shape fills, strokes, and freehand drawing.
|
|
4
|
-
*/
|
|
5
|
-
interface GradientStop {
|
|
6
|
-
offset: number;
|
|
7
|
-
color: string;
|
|
8
|
-
opacity?: number;
|
|
9
|
-
}
|
|
10
|
-
interface CanvasLinearGradient {
|
|
11
|
-
type: 'linear';
|
|
12
|
-
angle?: number;
|
|
13
|
-
stops: GradientStop[];
|
|
14
|
-
}
|
|
15
|
-
interface CanvasRadialGradient {
|
|
16
|
-
type: 'radial';
|
|
17
|
-
cx?: number;
|
|
18
|
-
cy?: number;
|
|
19
|
-
r?: number;
|
|
20
|
-
stops: GradientStop[];
|
|
21
|
-
}
|
|
22
|
-
type CanvasGradientDef = CanvasLinearGradient | CanvasRadialGradient;
|
|
23
|
-
interface SvgGradientStop {
|
|
24
|
-
offset: string;
|
|
25
|
-
stopColor: string;
|
|
26
|
-
stopOpacity?: number;
|
|
27
|
-
}
|
|
28
|
-
interface SvgGradientDef {
|
|
29
|
-
id: string;
|
|
30
|
-
type: 'linear' | 'radial';
|
|
31
|
-
attrs: Record<string, string | number>;
|
|
32
|
-
stops: SvgGradientStop[];
|
|
33
|
-
}
|
|
34
|
-
declare const PIXERATE_BRAND_GRADIENT: CanvasLinearGradient;
|
|
35
|
-
declare const CANVAS_GRADIENT_PRESETS: Record<string, CanvasLinearGradient>;
|
|
36
|
-
/** Whether an arbitrary value matches a CanvasGradientDef object. */
|
|
37
|
-
declare function isCanvasGradient(value: unknown): value is CanvasGradientDef;
|
|
38
|
-
/**
|
|
39
|
-
* Parses CSS linear-gradient or radial-gradient strings into CanvasGradientDef.
|
|
40
|
-
* Supports forms like:
|
|
41
|
-
* - linear-gradient(90deg, #ff0000 0%, #0000ff 100%)
|
|
42
|
-
* - linear-gradient(to right, red, blue)
|
|
43
|
-
* - radial-gradient(circle, red 0%, blue 100%)
|
|
44
|
-
*/
|
|
45
|
-
declare function parseCssGradient(css: string): CanvasGradientDef | null;
|
|
46
|
-
/**
|
|
47
|
-
* Resolves a paint value (which could be a CSS color, preset name, CSS gradient string, or CanvasGradientDef)
|
|
48
|
-
* into either a CanvasGradientDef (if gradient) or null (if solid color or invalid).
|
|
49
|
-
*/
|
|
50
|
-
declare function resolveCanvasGradient(value: unknown): CanvasGradientDef | null;
|
|
51
|
-
/**
|
|
52
|
-
* Converts degrees clockwise (CSS angle: 0 = top, 90 = right, 180 = bottom, 270 = left)
|
|
53
|
-
* to SVG linearGradient vector coordinates (x1, y1, x2, y2) normalized [0, 1].
|
|
54
|
-
*/
|
|
55
|
-
declare function angleToSvgLinearCoords(angleDeg?: number): {
|
|
56
|
-
x1: number;
|
|
57
|
-
y1: number;
|
|
58
|
-
x2: number;
|
|
59
|
-
y2: number;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Converts a CanvasGradientDef to an SvgGradientDef descriptor ready for rendering `<linearGradient>` / `<radialGradient>`.
|
|
63
|
-
*/
|
|
64
|
-
declare function gradientToSvgDef(gradient: CanvasGradientDef, id: string): SvgGradientDef;
|
|
65
|
-
|
|
66
|
-
export { type CanvasGradientDef as C, type GradientStop as G, PIXERATE_BRAND_GRADIENT as P, type SvgGradientDef as S, CANVAS_GRADIENT_PRESETS as a, type CanvasLinearGradient as b, type CanvasRadialGradient as c, type SvgGradientStop as d, angleToSvgLinearCoords as e, gradientToSvgDef as g, isCanvasGradient as i, parseCssGradient as p, resolveCanvasGradient as r };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|