manim-web 0.12.0 → 0.14.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 (63) hide show
  1. package/README.md +35 -19
  2. package/dist/animation/transform/MovementTransforms.d.ts.map +1 -1
  3. package/dist/animation/transform/TransformMatchingCode.d.ts +108 -0
  4. package/dist/animation/transform/TransformMatchingCode.d.ts.map +1 -0
  5. package/dist/animation/transform/index.d.ts +1 -0
  6. package/dist/animation/transform/index.d.ts.map +1 -1
  7. package/dist/export/chooseExporter.d.ts +19 -0
  8. package/dist/export/chooseExporter.d.ts.map +1 -0
  9. package/dist/export/index.d.ts +1 -0
  10. package/dist/export/index.d.ts.map +1 -1
  11. package/dist/index.d.ts +8 -3
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +3 -3
  14. package/dist/integrations/react.js +17 -17
  15. package/dist/integrations/vue.js +16 -16
  16. package/dist/interaction/DynamicMatrix.d.ts +164 -0
  17. package/dist/interaction/DynamicMatrix.d.ts.map +1 -0
  18. package/dist/interaction/index.d.ts +1 -0
  19. package/dist/interaction/index.d.ts.map +1 -1
  20. package/dist/lib-Bh3UXyYs.js +302 -0
  21. package/dist/manim-web.browser.js +7080 -5939
  22. package/dist/mobjects/image/AnimatedImageMobject.d.ts +141 -0
  23. package/dist/mobjects/image/AnimatedImageMobject.d.ts.map +1 -0
  24. package/dist/mobjects/image/gifDecoder.d.ts +46 -0
  25. package/dist/mobjects/image/gifDecoder.d.ts.map +1 -0
  26. package/dist/mobjects/text/Code.d.ts +23 -1
  27. package/dist/mobjects/text/Code.d.ts.map +1 -1
  28. package/dist/mobjects/text/CodeTokenLayout.d.ts +44 -0
  29. package/dist/mobjects/text/CodeTokenLayout.d.ts.map +1 -0
  30. package/dist/mobjects/text/index.d.ts +1 -0
  31. package/dist/mobjects/text/index.d.ts.map +1 -1
  32. package/dist/mobjects/three-d/Line3D.d.ts.map +1 -1
  33. package/dist/player/ExportSettingsUI.d.ts +82 -0
  34. package/dist/player/ExportSettingsUI.d.ts.map +1 -0
  35. package/dist/player/Player.d.ts +50 -2
  36. package/dist/player/Player.d.ts.map +1 -1
  37. package/dist/player/PlayerUI.d.ts +15 -1
  38. package/dist/player/PlayerUI.d.ts.map +1 -1
  39. package/dist/player/SlideInteractionRenderer.d.ts +32 -0
  40. package/dist/player/SlideInteractionRenderer.d.ts.map +1 -0
  41. package/dist/player/index.d.ts +1 -0
  42. package/dist/player/index.d.ts.map +1 -1
  43. package/dist/rate-functions/customEase.d.ts +39 -0
  44. package/dist/rate-functions/customEase.d.ts.map +1 -0
  45. package/dist/rate-functions/index.d.ts +4 -0
  46. package/dist/rate-functions/index.d.ts.map +1 -1
  47. package/dist/rate-functions/spring.d.ts +38 -0
  48. package/dist/rate-functions/spring.d.ts.map +1 -0
  49. package/dist/rolldown-runtime-CWhphoD1.js +23 -0
  50. package/dist/serialization/defaults.d.ts +13 -0
  51. package/dist/serialization/defaults.d.ts.map +1 -0
  52. package/dist/serialization/index.d.ts +15 -0
  53. package/dist/serialization/index.d.ts.map +1 -0
  54. package/dist/serialization/props.d.ts +16 -0
  55. package/dist/serialization/props.d.ts.map +1 -0
  56. package/dist/serialization/registry.d.ts +17 -0
  57. package/dist/serialization/registry.d.ts.map +1 -0
  58. package/dist/serialization/serialize.d.ts +24 -0
  59. package/dist/serialization/serialize.d.ts.map +1 -0
  60. package/dist/serialization/types.d.ts +70 -0
  61. package/dist/serialization/types.d.ts.map +1 -0
  62. package/dist/{src-BQF5-SG7.js → src-BLA8Tb0K.js} +7256 -6115
  63. package/package.json +8 -1
@@ -0,0 +1,141 @@
1
+ import { Vector3Tuple } from '../../core/Mobject';
2
+ import { TexturedMobject } from '../../core/TexturedMobject';
3
+ import { GifDecoder } from './gifDecoder';
4
+ import * as THREE from 'three';
5
+ export type { DecodedGif, DecodedGifFrame, GifDecoder } from './gifDecoder';
6
+ /**
7
+ * Options for creating an {@link AnimatedImageMobject}.
8
+ */
9
+ export interface AnimatedImageMobjectOptions {
10
+ /** GIF source: URL or base64 data URI. Required. */
11
+ source: string;
12
+ /** Loop back to the first frame after the last. Default: true */
13
+ loop?: boolean;
14
+ /** Start playing as soon as the GIF decodes. Default: false */
15
+ autoplay?: boolean;
16
+ /** Override the GIF frame rate (frames per second). Default: use GIF delays */
17
+ fps?: number;
18
+ /** Width of the image in scene units. Default: auto from aspect ratio */
19
+ width?: number;
20
+ /** Height of the image in scene units. Default: auto from aspect ratio */
21
+ height?: number;
22
+ /** If both width and height given, fit inside the box preserving aspect. Default: true */
23
+ scaleToFit?: boolean;
24
+ /** Center position [x, y, z]. Default: [0, 0, 0] */
25
+ center?: Vector3Tuple;
26
+ /** Opacity from 0 to 1. Default: 1 */
27
+ opacity?: number;
28
+ /** Render both sides of the plane. Default: false */
29
+ doubleSided?: boolean;
30
+ }
31
+ /**
32
+ * Inject a GIF decoder, replacing the lazy-loaded `gifuct-js` decoder. Pass
33
+ * `null` to restore the default. Tests use this to decode a mock GIF with no
34
+ * network or `gifuct-js` dependency.
35
+ */
36
+ export declare function setGifDecoder(decoder: GifDecoder | null): void;
37
+ /**
38
+ * AnimatedImageMobject - play an animated GIF as a movable, scalable mobject.
39
+ *
40
+ * The GIF is decoded to RGBA frames (see {@link gifDecoder}) and each frame is
41
+ * drawn through a `THREE.DataTexture` on a `THREE.PlaneGeometry`, mirroring how
42
+ * `ImageMobject` draws a still image. It therefore participates in the standard
43
+ * mobject transforms, z-index/depth, opacity, and `scene.add`. During play an
44
+ * updater advances the frame by elapsed time; call {@link syncToTime} on scrub
45
+ * or seek so the displayed frame follows the scene time.
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * const gif = new AnimatedImageMobject({ source: 'spin.gif', width: 4, loop: true });
50
+ * scene.add(gif);
51
+ * await gif.waitForLoad();
52
+ * gif.play();
53
+ * ```
54
+ */
55
+ export declare class AnimatedImageMobject extends TexturedMobject {
56
+ protected _source: string;
57
+ protected _loop: boolean;
58
+ protected _autoplay: boolean;
59
+ protected _fps: number | undefined;
60
+ protected _width: number | undefined;
61
+ protected _height: number | undefined;
62
+ protected _scaleToFit: boolean;
63
+ protected _centerPoint: Vector3Tuple;
64
+ protected _doubleSided: boolean;
65
+ protected _frames: Uint8ClampedArray[];
66
+ protected _frameDurations: number[];
67
+ protected _frameTextures: (THREE.DataTexture | null)[];
68
+ protected _totalDurationMs: number;
69
+ protected _currentFrame: number;
70
+ protected _accumulatorMs: number;
71
+ protected _playing: boolean;
72
+ protected _texture: THREE.DataTexture | null;
73
+ protected _loaded: boolean;
74
+ protected _loadError: Error | null;
75
+ protected _naturalWidth: number;
76
+ protected _naturalHeight: number;
77
+ private _mesh;
78
+ private _loadPromise;
79
+ private _loadResolve;
80
+ private _loadReject;
81
+ constructor(options: AnimatedImageMobjectOptions);
82
+ /** Decode the GIF, then ingest its frames. Node/SSR-safe: never throws. */
83
+ private _startLoad;
84
+ /** Store decoded frames, compute durations, and show the first frame. */
85
+ private _ingest;
86
+ /** Record a load error and reject the ready promise once. */
87
+ private _failLoad;
88
+ /** Advance playback by `deltaMs`, honouring per-frame delays and loop. */
89
+ private _advance;
90
+ /** Build (or reuse) the texture for `index` and show it. */
91
+ private _setFrame;
92
+ /** Create an upright RGBA DataTexture from a full-canvas frame buffer. */
93
+ private _createFrameTexture;
94
+ /** Promise that resolves once the GIF decodes and rejects on decode error. */
95
+ waitForLoad(): Promise<void>;
96
+ /** The captured load error, or null when no error occurred. */
97
+ getLoadError(): Error | null;
98
+ /** Whether the GIF has decoded and the first frame is ready. */
99
+ isLoaded(): boolean;
100
+ /** The GIF source URL or data URI. */
101
+ getSource(): string;
102
+ /** Number of decoded frames (0 until the GIF loads). */
103
+ get frameCount(): number;
104
+ /** Index of the frame currently displayed. */
105
+ get currentFrame(): number;
106
+ /** Total play time of one loop, in seconds (0 until loaded). */
107
+ get duration(): number;
108
+ /** Whether playback is currently running. */
109
+ isPlaying(): boolean;
110
+ /** Start or resume playback. */
111
+ play(): this;
112
+ /** Pause playback on the current frame. */
113
+ pause(): this;
114
+ /** Jump to a frame index, clamped to [0, frameCount - 1]. */
115
+ seek(frame: number): this;
116
+ /** Enable or disable looping. */
117
+ setLoop(loop: boolean): this;
118
+ /**
119
+ * Follow the Player clock: show the frame at `sceneTime` seconds. Use this on
120
+ * scrub and seek so the displayed frame tracks the timeline position.
121
+ */
122
+ syncToTime(sceneTime: number): this;
123
+ /** Display dimensions from width/height options and the natural size. */
124
+ private _calculateDimensions;
125
+ protected _createThreeObject(): THREE.Object3D;
126
+ getDisplayMeshLength(): number;
127
+ getDisplayMeshes(): THREE.Mesh[];
128
+ applyTextureFrom(other: TexturedMobject): void;
129
+ applyVisualSize(width: number, height: number): void;
130
+ applyContentFrom(other: TexturedMobject): void;
131
+ protected _updateGeometry(): void;
132
+ protected _syncMaterialToThree(): void;
133
+ getBoundingBox(): {
134
+ width: number;
135
+ height: number;
136
+ depth: number;
137
+ };
138
+ copy(): AnimatedImageMobject;
139
+ dispose(): void;
140
+ }
141
+ //# sourceMappingURL=AnimatedImageMobject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimatedImageMobject.d.ts","sourceRoot":"","sources":["../../../src/mobjects/image/AnimatedImageMobject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAsC,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAEnF,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACn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;IAQzB,iCAAiC;IACjC,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAK5B;;;OAGG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAwBnC,yEAAyE;IACzE,OAAO,CAAC,oBAAoB;IAuB5B,SAAS,CAAC,kBAAkB,IAAI,KAAK,CAAC,QAAQ;IAoBrC,oBAAoB,IAAI,MAAM;IAI9B,gBAAgB,IAAI,KAAK,CAAC,IAAI,EAAE;IAWzC,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;IAuB9C,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAOpD,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;IAO9C,SAAS,CAAC,eAAe,IAAI,IAAI;cAad,oBAAoB,IAAI,IAAI;IAYtC,cAAc,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IASlE,IAAI,IAAI,oBAAoB;IAoB5B,OAAO,IAAI,IAAI;CAUzB"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * GIF decoding seam for {@link AnimatedImageMobject}.
3
+ *
4
+ * The browser decodes a multi-frame GIF to an array of fully composited RGBA
5
+ * frames plus per-frame delays. Decoding is done with the small, well
6
+ * maintained `gifuct-js` library, which is LAZY-LOADED through a dynamic
7
+ * `import()`. The static module graph never references `gifuct-js`, so the base
8
+ * bundle stays small and SSR / Node never pull the decoder in for users who do
9
+ * not touch animated GIFs. The dynamic import specifier is a literal, so
10
+ * bundlers emit a separate chunk and static analysers (knip) still see the
11
+ * dependency as used.
12
+ *
13
+ * Tests inject a mock decoder through `AnimatedImageMobject.setGifDecoder`,
14
+ * which bypasses the dynamic import and the network entirely.
15
+ */
16
+ /** One decoded GIF frame: a full-canvas RGBA buffer and its display delay. */
17
+ export interface DecodedGifFrame {
18
+ /** Row-major RGBA pixels for the whole canvas (length = width * height * 4). */
19
+ data: Uint8ClampedArray;
20
+ /** How long this frame stays on screen, in milliseconds. */
21
+ delay: number;
22
+ }
23
+ /** A decoded animated GIF: canvas size and the composited frames. */
24
+ export interface DecodedGif {
25
+ /** Canvas width in pixels. */
26
+ width: number;
27
+ /** Canvas height in pixels. */
28
+ height: number;
29
+ /** Composited frames in play order. */
30
+ frames: DecodedGifFrame[];
31
+ }
32
+ /**
33
+ * A function that decodes a GIF source (URL or data URI) to {@link DecodedGif}.
34
+ * This is the dependency-injection seam: tests set a mock decoder so the real
35
+ * `gifuct-js` decoder and the network are never used.
36
+ */
37
+ export type GifDecoder = (source: string) => Promise<DecodedGif>;
38
+ /**
39
+ * Default browser GIF decoder: fetch the bytes, then decode with `gifuct-js`.
40
+ *
41
+ * Node/SSR-safe: it refuses when there is no DOM instead of throwing at import
42
+ * time. The decode itself is pure data work, but requiring a browser keeps this
43
+ * a browser-only feature and makes the Node path fail fast and deterministically.
44
+ */
45
+ export declare const defaultGifDecoder: GifDecoder;
46
+ //# sourceMappingURL=gifDecoder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gifDecoder.d.ts","sourceRoot":"","sources":["../../../src/mobjects/image/gifDecoder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC9B,gFAAgF;IAChF,IAAI,EAAE,iBAAiB,CAAC;IACxB,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AAuFjE;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,EAAE,UAkB/B,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { VMobject } from '../../core/VMobject';
2
2
  import { Vector3Tuple } from '../../core/Mobject';
3
- import { Token, CodeColorScheme } from './CodeHighlighting';
3
+ import { Token, TokenType, CodeColorScheme } from './CodeHighlighting';
4
+ import { CodeToken } from './CodeTokenLayout';
4
5
  import * as THREE from 'three';
5
6
  export { type Token, type TokenType, type CodeColorScheme, DEFAULT_COLOR_SCHEME, MONOKAI_COLOR_SCHEME, } from './CodeHighlighting';
6
7
  /**
@@ -142,6 +143,27 @@ export declare class Code extends VMobject {
142
143
  position: Vector3Tuple;
143
144
  tokens: Token[];
144
145
  } | null;
146
+ /**
147
+ * Get a flat list of tokens with their world-space positions.
148
+ *
149
+ * The positions come from the same layout as the rendered block, computed
150
+ * without a 2D canvas so this also works in a headless environment.
151
+ * `TransformMatchingCode` uses this to match unchanged tokens between two
152
+ * Code blocks and animate only the difference.
153
+ *
154
+ * @returns One {@link CodeToken} per token, in reading order.
155
+ */
156
+ getCodeTokens(): CodeToken[];
157
+ /**
158
+ * Build a standalone Code mobject that renders a single token, styled like
159
+ * this block. The token keeps its syntax color, has no line numbers and no
160
+ * background. `TransformMatchingCode` uses this to animate single tokens.
161
+ *
162
+ * @param text - The token text.
163
+ * @param type - The syntax type that selects the color.
164
+ * @returns A new single-token Code mobject.
165
+ */
166
+ makeTokenMobject(text: string, type: TokenType): Code;
145
167
  /**
146
168
  * Highlight a range of lines with a background color
147
169
  * @param startLine - Starting line number (1-based)
@@ -1 +1 @@
1
- {"version":3,"file":"Code.d.ts","sourceRoot":"","sources":["../../../src/mobjects/text/Code.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB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AIzB,IAAI,IAAI,IAAI;IAkBrB;;OAEG;IACM,OAAO,IAAI,IAAI;CAWzB"}
@@ -0,0 +1,44 @@
1
+ import { Vector3Tuple } from '../../core/Mobject';
2
+ import { Token, TokenType } from './CodeHighlighting';
3
+ /**
4
+ * A single token of a Code block with its position.
5
+ */
6
+ export interface CodeToken {
7
+ /** The token text. */
8
+ text: string;
9
+ /** The syntax type of the token. */
10
+ type: TokenType;
11
+ /** Zero-based index of the line that holds the token. */
12
+ line: number;
13
+ /** Zero-based index of the token within its line. */
14
+ tokenIndex: number;
15
+ /** World-space position of the left edge of the token. */
16
+ position: Vector3Tuple;
17
+ }
18
+ /**
19
+ * Inputs for {@link computeCodeTokens}. These mirror the Code mobject fields.
20
+ */
21
+ export interface CodeTokenLayoutParams {
22
+ /** Parsed lines (tabs already expanded to spaces). */
23
+ lines: string[];
24
+ /** Tokens for each line. */
25
+ tokenizedLines: Token[][];
26
+ /** Font size in pixels. */
27
+ fontSize: number;
28
+ /** Line height multiplier. */
29
+ lineHeight: number;
30
+ /** Background padding in pixels. */
31
+ backgroundPadding: number;
32
+ /** Whether line numbers take horizontal space. */
33
+ lineNumbers: boolean;
34
+ /** World-space position (center) of the Code block. */
35
+ position: Vector3Tuple;
36
+ }
37
+ /**
38
+ * Compute the flat list of tokens with world-space positions.
39
+ *
40
+ * @param params - The Code block layout inputs.
41
+ * @returns One {@link CodeToken} per token, in reading order.
42
+ */
43
+ export declare function computeCodeTokens(params: CodeTokenLayoutParams): CodeToken[];
44
+ //# sourceMappingURL=CodeTokenLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeTokenLayout.d.ts","sourceRoot":"","sources":["../../../src/mobjects/text/CodeTokenLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAWtD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,IAAI,EAAE,SAAS,CAAC;IAChB,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,sDAAsD;IACtD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,4BAA4B;IAC5B,cAAc,EAAE,KAAK,EAAE,EAAE,CAAC;IAC1B,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kDAAkD;IAClD,WAAW,EAAE,OAAO,CAAC;IACrB,uDAAuD;IACvD,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,qBAAqB,GAAG,SAAS,EAAE,CAiD5E"}
@@ -21,6 +21,7 @@ export { renderTypstToSVG, preloadTypst, isTypstLoaded, setTypstCompiler, type T
21
21
  export { DecimalNumber, Integer, type DecimalNumberOptions } from './DecimalNumber';
22
22
  export { Variable, type VariableOptions } from './Variable';
23
23
  export { Code, type CodeOptions, type CodeColorScheme, type Token, type TokenType, DEFAULT_COLOR_SCHEME, MONOKAI_COLOR_SCHEME, } from './Code';
24
+ export { type CodeToken, type CodeTokenLayoutParams } from './CodeTokenLayout';
24
25
  export { SingleStringMathTex, type SingleStringMathTexOptions, MathTexPart, type MathTexPartOptions, } from './MathTexParts';
25
26
  export { BulletedList, Title, MarkdownText, type BulletedListOptions, type TitleOptions, type MarkdownTextOptions, } from './TextExtensions';
26
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3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,IAAI;IASjC,OAAO,CAAC,eAAe;IAWvB,gBAAgB;IACP,gBAAgB,CACvB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM,GAClB,IAAI;IASP,QAAQ,IAAI,YAAY;IAIxB,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAMnC,MAAM,IAAI,YAAY;IAItB,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAMjC,YAAY,IAAI,MAAM;IAItB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKjC,SAAS,IAAI,MAAM;IAOnB,YAAY,IAAI,YAAY;IAY5B,WAAW,IAAI,YAAY;IAQ3B,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,YAAY;IAQhC,IAAI,IAAI,MAAM;CAWxB"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * ExportSettingsUI - opt-in export options for the PlayerUI export menu.
3
+ *
4
+ * Lets the user choose frame rate, output resolution and quality before
5
+ * exporting, instead of subclassing Player/PlayerUI. The panel is pure DOM and
6
+ * lives in this sibling file so PlayerUI.ts stays within its line budget.
7
+ */
8
+ /** Concrete, resolved export settings handed to the exporter. */
9
+ export interface ExportSettings {
10
+ /** Frames per second. */
11
+ fps: number;
12
+ /** Output width in pixels. */
13
+ width: number;
14
+ /** Output height in pixels. */
15
+ height: number;
16
+ /** 0-1; higher is better quality (maps to a higher video bitrate). */
17
+ quality: number;
18
+ }
19
+ /** A named output resolution. `null` width/height means "use the current size". */
20
+ export interface ResolutionPreset {
21
+ id: string;
22
+ label: string;
23
+ width: number | null;
24
+ height: number | null;
25
+ }
26
+ /** A named quality level mapped to a 0-1 value. */
27
+ export interface QualityPreset {
28
+ id: string;
29
+ label: string;
30
+ value: number;
31
+ }
32
+ /** The player's current output size and frame rate, used for defaults. */
33
+ export interface ExportDefaults {
34
+ width: number;
35
+ height: number;
36
+ fps: number;
37
+ }
38
+ /** Selectable output resolutions. The first entry tracks the current size. */
39
+ export declare const RESOLUTION_PRESETS: ResolutionPreset[];
40
+ /** Selectable frame rates. */
41
+ export declare const FPS_PRESETS: number[];
42
+ /** Selectable quality levels. */
43
+ export declare const QUALITY_PRESETS: QualityPreset[];
44
+ /**
45
+ * Convert a 0-1 quality to a WebCodecs bitrate in bits per second.
46
+ * @param quality - Quality from 0 to 1 (clamped).
47
+ * @returns The target bitrate.
48
+ */
49
+ export declare function qualityToBitrate(quality: number): number;
50
+ /**
51
+ * Resolve a resolution preset id to concrete pixel dimensions.
52
+ * An unknown id, or the "current" preset, resolves to the current size.
53
+ * @param presetId - The preset id.
54
+ * @param currentWidth - The current output width.
55
+ * @param currentHeight - The current output height.
56
+ * @returns The resolved width and height.
57
+ */
58
+ export declare function resolveResolution(presetId: string, currentWidth: number, currentHeight: number): {
59
+ width: number;
60
+ height: number;
61
+ };
62
+ /**
63
+ * The settings panel shown inside the export menu when `exportControls` is on.
64
+ * Renders fps, resolution and quality selectors and resolves the current choice
65
+ * to concrete {@link ExportSettings} on demand.
66
+ */
67
+ export declare class ExportSettingsPanel {
68
+ private _element;
69
+ private _fpsSelect;
70
+ private _resolutionSelect;
71
+ private _qualitySelect;
72
+ private _defaults;
73
+ constructor(defaults: ExportDefaults);
74
+ /** The panel's root element, to insert into the export menu. */
75
+ get element(): HTMLElement;
76
+ /** Resolve the current selection to concrete export settings. */
77
+ getSettings(): ExportSettings;
78
+ /** Snap an arbitrary fps to the closest available preset. */
79
+ private _nearestFps;
80
+ private _buildSelect;
81
+ }
82
+ //# sourceMappingURL=ExportSettingsUI.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExportSettingsUI.d.ts","sourceRoot":"","sources":["../../src/player/ExportSettingsUI.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,yBAAyB;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,8BAA8B;IAC9B,KAAK,EAAE,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EtB,QAAQ,EAAE,cAAc;IA8BpC,gEAAgE;IAChE,IAAI,OAAO,IAAI,WAAW,CAEzB;IAED,iEAAiE;IACjE,WAAW,IAAI,cAAc;IAW7B,6DAA6D;IAC7D,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,YAAY;CAiDrB"}
@@ -1,6 +1,7 @@
1
1
  import { Scene, SceneOptions } from '../core/Scene';
2
2
  import { MasterTimeline } from '../animation/MasterTimeline';
3
3
  import { RecordingScene } from './RecordingScene';
4
+ import { ExportSettings } from './ExportSettingsUI';
4
5
  export interface PlayerOptions extends SceneOptions {
5
6
  /** Auto-hide controls after this many ms. 0 = never. Default 2500. */
6
7
  autoHideMs?: number;
@@ -10,6 +11,18 @@ export interface PlayerOptions extends SceneOptions {
10
11
  loop?: boolean;
11
12
  /** Slides mode: arrows play/pause at slide boundaries like a presentation. Default false. */
12
13
  slidesMode?: boolean;
14
+ /**
15
+ * Keep the scene interactive while paused. When true, a Draggable,
16
+ * Clickable or Hoverable object responds on a paused slide: a pointer event
17
+ * triggers one scene render without advancing the timeline. Default false,
18
+ * so normal slides keep their cheap paused behavior (no extra renders).
19
+ */
20
+ interactiveSlides?: boolean;
21
+ /**
22
+ * Show an fps/resolution/quality panel in the export menu, so viewers can
23
+ * pick export settings without subclassing the Player. Default false.
24
+ */
25
+ exportControls?: boolean;
13
26
  }
14
27
  export declare class Player {
15
28
  private _scene;
@@ -24,6 +37,11 @@ export declare class Player {
24
37
  private _loop;
25
38
  private _autoPlay;
26
39
  private _slidesMode;
40
+ private _interactiveSlides;
41
+ /** Idle-render path that keeps a paused slide interactive. Null when off. */
42
+ private _slideInteraction;
43
+ private _exportControls;
44
+ private _exportFps;
27
45
  /**
28
46
  * Index of the slide that slidesMode playback should stop (or loop / advance)
29
47
  * at when its endTime is reached. -1 means no target armed.
@@ -39,6 +57,11 @@ export declare class Player {
39
57
  private _origHeight;
40
58
  private _onFullscreenChange;
41
59
  constructor(container: HTMLElement, options?: PlayerOptions);
60
+ /**
61
+ * Attach the idle-render path. Renders happen only while the Player is
62
+ * paused (not playing), so this never fights the active render loop.
63
+ */
64
+ private _enableSlideInteraction;
42
65
  /**
43
66
  * Define the animation sequence. The callback receives a recording proxy
44
67
  * that captures all play()/wait() calls to build the master timeline.
@@ -90,8 +113,33 @@ export declare class Player {
90
113
  setPlaybackRate(rate: number): void;
91
114
  /** Enable or disable slides (presentation) mode at runtime. */
92
115
  setSlidesMode(enabled: boolean): void;
93
- /** Export the animation in the given format (gif, webm, mp4). */
94
- exportAs(format: string): Promise<void>;
116
+ /** Whether the scene stays interactive while paused on a slide. */
117
+ get interactiveSlides(): boolean;
118
+ /**
119
+ * Enable or disable interactive slides at runtime. When enabled, a paused
120
+ * slide renders on pointer interaction (drag/click/hover) without advancing
121
+ * the timeline. When disabled, the idle-render path is removed.
122
+ */
123
+ setInteractiveSlides(enabled: boolean): void;
124
+ /**
125
+ * Export the animation in the given format (gif, webm, mp4).
126
+ *
127
+ * For video (webm/mp4) the frame-accurate {@link WebCodecsExporter} is used
128
+ * when the browser supports it; otherwise it falls back to the MediaRecorder
129
+ * VideoExporter via `Scene.export`. GIF always uses `Scene.export`.
130
+ *
131
+ * @param format - Output format: `gif`, `webm` or `mp4`.
132
+ * @param settings - Optional fps/resolution/quality from the export panel.
133
+ * When omitted, the exporter keeps its format defaults.
134
+ */
135
+ exportAs(format: string, settings?: ExportSettings): Promise<void>;
136
+ /** Run a frame-accurate WebCodecs video export and download the result. */
137
+ private _exportWithWebCodecs;
138
+ /**
139
+ * Build `Scene.export` options. With no `settings`, only the base options are
140
+ * set so each format keeps its own defaults (e.g. GIF fps 30, quality 10).
141
+ */
142
+ private _buildSceneExportOptions;
95
143
  /** Toggle browser fullscreen on the player container. */
96
144
  toggleFullscreen(): void;
97
145
  /** Clean up all resources. */
@@ -1 +1 @@
1
- {"version":3,"file":"Player.d.ts","sourceRoot":"","sources":["../../src/player/Player.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;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;OAGG;IACH,OAAO,CAAC,wBAAwB;IAsBhC,yDAAyD;IACzD,gBAAgB,IAAI,IAAI;IAmBxB,8BAA8B;IAC9B,OAAO,IAAI,IAAI;IAcf,OAAO,CAAC,UAAU;IA4GlB,OAAO,CAAC,SAAS;CAMlB"}
@@ -1,4 +1,5 @@
1
1
  import { MasterTimeline } from '../animation/MasterTimeline';
2
+ import { ExportSettings, ExportDefaults } from './ExportSettingsUI';
2
3
  export interface PlayerUICallbacks {
3
4
  onPlayPause: () => void;
4
5
  onSeek: (time: number) => void;
@@ -6,12 +7,23 @@ export interface PlayerUICallbacks {
6
7
  onNext: () => void;
7
8
  onSpeedChange: (rate: number) => void;
8
9
  onFullscreen: () => void;
9
- onExport: (format: string) => void;
10
+ /**
11
+ * Export in the given format. When the export settings panel is enabled
12
+ * (`exportControls`), the chosen fps/resolution/quality are passed too.
13
+ */
14
+ onExport: (format: string, settings?: ExportSettings) => void;
10
15
  onSlidesToggle: (enabled: boolean) => void;
16
+ /** Current output size and frame rate, used to seed the settings panel. */
17
+ getExportDefaults?: () => ExportDefaults;
11
18
  }
12
19
  export interface PlayerUIOptions {
13
20
  /** Auto-hide controls after this many ms of inactivity. 0 = never hide. Default 2500. */
14
21
  autoHideMs?: number;
22
+ /**
23
+ * Show an fps/resolution/quality panel in the export menu. Default false, so
24
+ * the export menu is unchanged unless opted in.
25
+ */
26
+ exportControls?: boolean;
15
27
  }
16
28
  export declare class PlayerUI {
17
29
  private _container;
@@ -33,6 +45,8 @@ export declare class PlayerUI {
33
45
  private _exportBtnWrapper;
34
46
  private _callbacks;
35
47
  private _autoHideMs;
48
+ private _exportControls;
49
+ private _exportPanel;
36
50
  private _hideTimeout;
37
51
  private _isVisible;
38
52
  private _isDragging;
@@ -1 +1 @@
1
- {"version":3,"file":"PlayerUI.d.ts","sourceRoot":"","sources":["../../src/player/PlayerUI.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,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ACjD,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAahD,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,oBAAoB;IAa5B,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,cAAc;IAetB,iBAAiB,CAAC,OAAO,EAAE,MAAM,MAAM,GAAG,IAAI;IAa9C,4DAA4D;IAC5D,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IA2BhC,OAAO,IAAI,IAAI;CAShB"}
@@ -0,0 +1,32 @@
1
+ import { Scene } from '../core/Scene';
2
+ export declare class SlideInteractionRenderer {
3
+ private _target;
4
+ private _scene;
5
+ private _isIdle;
6
+ private _onEvent;
7
+ private _attached;
8
+ private _renderScheduled;
9
+ private _renderCount;
10
+ /**
11
+ * @param target - Element that pointer events bubble to (the Player
12
+ * container). The canvas is a child of this element, so canvas events reach
13
+ * it. The container exists even for a headless Scene, where `getCanvas()`
14
+ * throws.
15
+ * @param scene - The scene to render.
16
+ * @param isIdle - Returns true when the Player is paused (no render loop
17
+ * running). A render is requested only then; during playback the Player
18
+ * loop already draws every frame.
19
+ */
20
+ constructor(target: HTMLElement, scene: Scene, isIdle: () => boolean);
21
+ /** Whether listeners are currently attached. */
22
+ get isAttached(): boolean;
23
+ /** Number of idle renders performed. Exposed for tests and introspection. */
24
+ get renderCount(): number;
25
+ /** Start listening for pointer events. Idempotent. */
26
+ attach(): void;
27
+ /** Stop listening and drop any pending render. */
28
+ dispose(): void;
29
+ private _handleEvent;
30
+ private _scheduleRender;
31
+ }
32
+ //# sourceMappingURL=SlideInteractionRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SlideInteractionRenderer.d.ts","sourceRoot":"","sources":["../../src/player/SlideInteractionRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAgBtC,qBAAa,wBAAwB;IACnC,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,gBAAgB,CAAkB;IAC1C,OAAO,CAAC,YAAY,CAAa;IAEjC;;;;;;;;;OASG;gBACS,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO;IAOpE,gDAAgD;IAChD,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,6EAA6E;IAC7E,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,sDAAsD;IACtD,MAAM,IAAI,IAAI;IAQd,kDAAkD;IAClD,OAAO,IAAI,IAAI;IASf,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,eAAe;CAYxB"}
@@ -1,4 +1,5 @@
1
1
  export { Player, type PlayerOptions } from './Player';
2
2
  export { PlayerUI, type PlayerUIOptions, type PlayerUICallbacks } from './PlayerUI';
3
3
  export { PlayerController, type PlayerControllerCallbacks } from './PlayerController';
4
+ export { ExportSettingsPanel, resolveResolution, qualityToBitrate, RESOLUTION_PRESETS, FPS_PRESETS, QUALITY_PRESETS, type ExportSettings, type ResolutionPreset, type QualityPreset, type ExportDefaults, } from './ExportSettingsUI';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/player/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,KAAK,yBAAyB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/player/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,KAAK,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,cAAc,GACpB,MAAM,oBAAoB,CAAC"}