@elucim/core 0.3.0 → 0.4.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/README.md +3 -0
- package/dist/__tests__/captureFrame.test.d.ts +2 -0
- package/dist/__tests__/captureFrame.test.d.ts.map +1 -0
- package/dist/components/Player.d.ts +17 -1
- package/dist/components/Player.d.ts.map +1 -1
- package/dist/components/Scene.d.ts +2 -1
- package/dist/components/Scene.d.ts.map +1 -1
- package/dist/export/captureFrame.d.ts +23 -0
- package/dist/export/captureFrame.d.ts.map +1 -0
- package/dist/export/index.d.ts +2 -0
- package/dist/export/index.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1708 -1666
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,6 +52,8 @@ function MyAnimation() {
|
|
|
52
52
|
| `Player` | Interactive player with controls, scrubber, play/pause, keyboard shortcuts |
|
|
53
53
|
| `Scene` | Raw SVG scene for embedding in custom playback systems |
|
|
54
54
|
| `Sequence` | Time-offset wrapper — schedule children to appear at specific frames |
|
|
55
|
+
| `captureFrame` | Single-frame capture to PNG/JPEG |
|
|
56
|
+
| `PlayerRef` | Imperative handle type for Player (getSvgElement, play, pause, seek) |
|
|
55
57
|
|
|
56
58
|
### 📐 Primitives
|
|
57
59
|
|
|
@@ -62,6 +64,7 @@ function MyAnimation() {
|
|
|
62
64
|
| `Line` | Line segment |
|
|
63
65
|
| `Arrow` | Line with arrowhead |
|
|
64
66
|
| `Polygon` | Arbitrary polygon from point arrays |
|
|
67
|
+
| `BezierCurve` | Quadratic and cubic Bezier curves with draw animation support |
|
|
65
68
|
| `Text` | SVG text element |
|
|
66
69
|
| `Image` | Embed images (PNG, JPEG, SVG, WebP, GIF) with `borderRadius`, `clipShape`, and transform support |
|
|
67
70
|
| `Group` | Composable container that applies shared transforms, animations, and z-index sorting to children |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captureFrame.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/captureFrame.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
import { SceneProps } from './Scene';
|
|
3
|
+
export interface PlayerRef {
|
|
4
|
+
/** Get the underlying SVG element */
|
|
5
|
+
getSvgElement(): SVGSVGElement | null;
|
|
6
|
+
/** Seek to a specific frame */
|
|
7
|
+
seekToFrame(frame: number): void;
|
|
8
|
+
/** Get total frames count */
|
|
9
|
+
getTotalFrames(): number;
|
|
10
|
+
/** Start playback */
|
|
11
|
+
play(): void;
|
|
12
|
+
/** Pause playback */
|
|
13
|
+
pause(): void;
|
|
14
|
+
/** Whether currently playing */
|
|
15
|
+
isPlaying(): boolean;
|
|
16
|
+
}
|
|
2
17
|
export interface PlayerProps extends Omit<SceneProps, 'frame' | 'autoPlay'> {
|
|
3
18
|
/** Show controls bar. Default: true */
|
|
4
19
|
controls?: boolean;
|
|
@@ -15,6 +30,7 @@ export interface PlayerProps extends Omit<SceneProps, 'frame' | 'autoPlay'> {
|
|
|
15
30
|
}
|
|
16
31
|
/**
|
|
17
32
|
* Interactive player component with scrub bar, play/pause, and keyboard controls.
|
|
33
|
+
* Forwards ref as PlayerRef with imperative methods.
|
|
18
34
|
*/
|
|
19
|
-
export declare
|
|
35
|
+
export declare const Player: React.ForwardRefExoticComponent<PlayerProps & React.RefAttributes<PlayerRef>>;
|
|
20
36
|
//# sourceMappingURL=Player.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Player.d.ts","sourceRoot":"","sources":["../../src/components/Player.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Player.d.ts","sourceRoot":"","sources":["../../src/components/Player.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoF,MAAM,OAAO,CAAC;AACzG,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAGjD,MAAM,WAAW,SAAS;IACxB,qCAAqC;IACrC,aAAa,IAAI,aAAa,GAAG,IAAI,CAAC;IACtC,+BAA+B;IAC/B,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,6BAA6B;IAC7B,cAAc,IAAI,MAAM,CAAC;IACzB,qBAAqB;IACrB,IAAI,IAAI,IAAI,CAAC;IACb,qBAAqB;IACrB,KAAK,IAAI,IAAI,CAAC;IACd,gCAAgC;IAChC,SAAS,IAAI,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,CAAC;IACzE,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mCAAmC;IACnC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yEAAyE;IACzE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,wEAAwE;IACxE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,+EA6LjB,CAAC"}
|
|
@@ -27,6 +27,7 @@ export interface SceneProps {
|
|
|
27
27
|
/**
|
|
28
28
|
* Root composition component.
|
|
29
29
|
* Provides frame clock and dimensions to all children via context.
|
|
30
|
+
* Forwards ref to the inner SVG element.
|
|
30
31
|
*/
|
|
31
|
-
export declare
|
|
32
|
+
export declare const Scene: React.ForwardRefExoticComponent<SceneProps & React.RefAttributes<SVGSVGElement>>;
|
|
32
33
|
//# sourceMappingURL=Scene.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../../src/components/Scene.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../../src/components/Scene.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+D,MAAM,OAAO,CAAC;AAKpF,MAAM,WAAW,UAAU;IACzB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yBAAyB;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED;;;;GAIG;AACH,eAAO,MAAM,KAAK,kFA+FhB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface CaptureFrameOptions {
|
|
2
|
+
/** Output width in pixels. Default: SVG viewBox width */
|
|
3
|
+
width?: number;
|
|
4
|
+
/** Output height in pixels. Default: SVG viewBox height */
|
|
5
|
+
height?: number;
|
|
6
|
+
/** Image format. Default: 'png' */
|
|
7
|
+
format?: 'png' | 'jpeg';
|
|
8
|
+
/** JPEG quality 0–1. Default: 0.92 */
|
|
9
|
+
quality?: number;
|
|
10
|
+
/** Device pixel ratio for retina output. Default: 2 */
|
|
11
|
+
scale?: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Capture a single frame of an Elucim scene as a PNG or JPEG Blob.
|
|
15
|
+
*
|
|
16
|
+
* @param svgElement The mounted SVG element to capture
|
|
17
|
+
* @param frame Target frame index
|
|
18
|
+
* @param renderFrame Callback that advances the scene to the given frame
|
|
19
|
+
* (e.g. a React state setter: `(f) => setFrame(f)`)
|
|
20
|
+
* @param options Output size, format, quality, and scale
|
|
21
|
+
*/
|
|
22
|
+
export declare function captureFrame(svgElement: SVGSVGElement, frame: number, renderFrame: (frame: number) => void, options?: CaptureFrameOptions): Promise<Blob>;
|
|
23
|
+
//# sourceMappingURL=captureFrame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captureFrame.d.ts","sourceRoot":"","sources":["../../src/export/captureFrame.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACxB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAcD;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,aAAa,EACzB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EACpC,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
|
package/dist/export/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { exportAnimation, exportWithMediaRecorder, svgToCanvas, downloadBlob } from './videoExport';
|
|
2
2
|
export type { ExportOptions } from './videoExport';
|
|
3
|
+
export { captureFrame } from './captureFrame';
|
|
4
|
+
export type { CaptureFrameOptions } from './captureFrame';
|
|
3
5
|
export { useExport } from './useExport';
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/export/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACpG,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/export/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACpG,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Scene, type SceneProps } from './components/Scene';
|
|
2
2
|
export { Sequence, type SequenceProps } from './components/Sequence';
|
|
3
|
-
export { Player, type PlayerProps } from './components/Player';
|
|
3
|
+
export { Player, type PlayerProps, type PlayerRef } from './components/Player';
|
|
4
4
|
export { Presentation, type PresentationProps, Slide, type SlideProps, usePresentationContext, useInsidePresentation, type TransitionType, } from './components/Presentation';
|
|
5
5
|
export { useCurrentFrame } from './hooks/useCurrentFrame';
|
|
6
6
|
export { interpolate, type InterpolateOptions } from './hooks/interpolate';
|
|
@@ -30,5 +30,5 @@ export { Draw, type DrawProps, Write, type WriteProps } from './animations/DrawW
|
|
|
30
30
|
export { Transform, type TransformProps, Morph, type MorphProps } from './animations/Transform';
|
|
31
31
|
export { Parallel, Stagger, type StaggerProps } from './animations/Groups';
|
|
32
32
|
export { Timeline, type TimelineAction, type PlayOptions } from './animations/Timeline';
|
|
33
|
-
export { exportAnimation, exportWithMediaRecorder, svgToCanvas, downloadBlob, useExport, type ExportOptions, } from './export';
|
|
33
|
+
export { exportAnimation, exportWithMediaRecorder, svgToCanvas, downloadBlob, useExport, captureFrame, type ExportOptions, type CaptureFrameOptions, } from './export';
|
|
34
34
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,YAAY,EAAE,KAAK,iBAAiB,EACpC,KAAK,EAAE,KAAK,UAAU,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,cAAc,GACpB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG3E,OAAO,EAAE,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAGtE,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAA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