manim-web 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation/transform/TransformMatchingCode.d.ts +108 -0
- package/dist/animation/transform/TransformMatchingCode.d.ts.map +1 -0
- package/dist/animation/transform/index.d.ts +1 -0
- package/dist/animation/transform/index.d.ts.map +1 -1
- package/dist/audio/Voiceover.d.ts +95 -0
- package/dist/audio/Voiceover.d.ts.map +1 -0
- package/dist/audio/VoiceoverScene.d.ts +28 -0
- package/dist/audio/VoiceoverScene.d.ts.map +1 -0
- package/dist/audio/bookmarks.d.ts +40 -0
- package/dist/audio/bookmarks.d.ts.map +1 -0
- package/dist/audio/speechSynthesizer.d.ts +95 -0
- package/dist/audio/speechSynthesizer.d.ts.map +1 -0
- package/dist/core/Mobject.d.ts +31 -0
- package/dist/core/Mobject.d.ts.map +1 -1
- package/dist/core/Scene.d.ts +9 -0
- package/dist/core/Scene.d.ts.map +1 -1
- package/dist/index.d.ts +12 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/integrations/react.js +17 -17
- package/dist/integrations/vue.js +16 -16
- package/dist/interaction/MovablePoint.d.ts +127 -0
- package/dist/interaction/MovablePoint.d.ts.map +1 -0
- package/dist/interaction/Slider.d.ts +125 -0
- package/dist/interaction/Slider.d.ts.map +1 -0
- package/dist/interaction/index.d.ts +2 -0
- package/dist/interaction/index.d.ts.map +1 -1
- package/dist/lib-Bh3UXyYs.js +302 -0
- package/dist/manim-web.browser.js +7107 -5848
- package/dist/mobjects/image/AnimatedImageMobject.d.ts +141 -0
- package/dist/mobjects/image/AnimatedImageMobject.d.ts.map +1 -0
- package/dist/mobjects/image/gifDecoder.d.ts +46 -0
- package/dist/mobjects/image/gifDecoder.d.ts.map +1 -0
- package/dist/mobjects/svg/SVGMobject.d.ts +29 -0
- package/dist/mobjects/svg/SVGMobject.d.ts.map +1 -1
- package/dist/mobjects/svg/index.d.ts +3 -1
- package/dist/mobjects/svg/index.d.ts.map +1 -1
- package/dist/mobjects/svg/svgFill.d.ts +42 -0
- package/dist/mobjects/svg/svgFill.d.ts.map +1 -0
- package/dist/mobjects/svg/svgGradients.d.ts +68 -0
- package/dist/mobjects/svg/svgGradients.d.ts.map +1 -0
- package/dist/mobjects/svg/svgImage.d.ts +9 -0
- package/dist/mobjects/svg/svgImage.d.ts.map +1 -0
- package/dist/mobjects/svg/svgLoader.d.ts +35 -0
- package/dist/mobjects/svg/svgLoader.d.ts.map +1 -0
- package/dist/mobjects/svg/svgText.d.ts +15 -0
- package/dist/mobjects/svg/svgText.d.ts.map +1 -0
- package/dist/mobjects/text/Code.d.ts +23 -1
- package/dist/mobjects/text/Code.d.ts.map +1 -1
- package/dist/mobjects/text/CodeTokenLayout.d.ts +44 -0
- package/dist/mobjects/text/CodeTokenLayout.d.ts.map +1 -0
- package/dist/mobjects/text/index.d.ts +1 -0
- package/dist/mobjects/text/index.d.ts.map +1 -1
- package/dist/rate-functions/customEase.d.ts +39 -0
- package/dist/rate-functions/customEase.d.ts.map +1 -0
- package/dist/rate-functions/index.d.ts +4 -0
- package/dist/rate-functions/index.d.ts.map +1 -1
- package/dist/rate-functions/spring.d.ts +38 -0
- package/dist/rate-functions/spring.d.ts.map +1 -0
- package/dist/rendering/blendModes.d.ts +38 -0
- package/dist/rendering/blendModes.d.ts.map +1 -0
- package/dist/rolldown-runtime-CWhphoD1.js +23 -0
- package/dist/{src-C817VR8M.js → src-BcBBUMTP.js} +8676 -7417
- package/dist/utils/ThemeManager.d.ts +79 -0
- package/dist/utils/ThemeManager.d.ts.map +1 -0
- 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;IACnB,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IACh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AAO,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,5 +1,6 @@
|
|
|
1
1
|
import { VMobject } from '../../core/VMobject';
|
|
2
2
|
import { VGroup } from '../../core/VGroup';
|
|
3
|
+
import { SvgFetcher } from './svgLoader';
|
|
3
4
|
/**
|
|
4
5
|
* SVGMobject options
|
|
5
6
|
*/
|
|
@@ -21,6 +22,14 @@ export interface SVGMobjectOptions {
|
|
|
21
22
|
/** Center position */
|
|
22
23
|
center?: [number, number, number];
|
|
23
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Options for {@link SVGMobject.fromUrl}. Same as {@link SVGMobjectOptions}
|
|
27
|
+
* (minus `svgString`, which is fetched) plus an injectable fetcher.
|
|
28
|
+
*/
|
|
29
|
+
export type SVGMobjectFromUrlOptions = Omit<SVGMobjectOptions, 'svgString'> & {
|
|
30
|
+
/** Fetch implementation. Defaults to `globalThis.fetch`. */
|
|
31
|
+
fetcher?: SvgFetcher;
|
|
32
|
+
};
|
|
24
33
|
/**
|
|
25
34
|
* VMobjectFromSVGPath options
|
|
26
35
|
*/
|
|
@@ -49,7 +58,27 @@ export declare class VMobjectFromSVGPath extends VMobject {
|
|
|
49
58
|
*/
|
|
50
59
|
export declare class SVGMobject extends VGroup {
|
|
51
60
|
private _svgString;
|
|
61
|
+
private _loadError;
|
|
52
62
|
constructor(options?: SVGMobjectOptions);
|
|
63
|
+
/**
|
|
64
|
+
* Fetch an SVG from a URL and parse it through the standard string path.
|
|
65
|
+
*
|
|
66
|
+
* The fetcher is injected (default `globalThis.fetch`) so tests can mock it.
|
|
67
|
+
* A fetch or parse failure does not throw: it returns an empty SVGMobject
|
|
68
|
+
* whose {@link getLoadError} reports the error.
|
|
69
|
+
*
|
|
70
|
+
* @param url - The SVG resource URL.
|
|
71
|
+
* @param options - Standard SVGMobject options plus an optional `fetcher`.
|
|
72
|
+
* @returns A promise resolving to the parsed (or empty, on error) SVGMobject.
|
|
73
|
+
*/
|
|
74
|
+
static fromUrl(url: string, options?: SVGMobjectFromUrlOptions): Promise<SVGMobject>;
|
|
75
|
+
/**
|
|
76
|
+
* The error captured while loading or parsing, or null when none occurred.
|
|
77
|
+
*
|
|
78
|
+
* Set by {@link fromUrl} on a fetch failure and by the parser when the input
|
|
79
|
+
* has no `<svg>` root.
|
|
80
|
+
*/
|
|
81
|
+
getLoadError(): Error | null;
|
|
53
82
|
private _parseSVG;
|
|
54
83
|
/**
|
|
55
84
|
* Get all subpaths as individual VMobjects.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SVGMobject.d.ts","sourceRoot":"","sources":["../../../src/mobjects/svg/SVGMobject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAQ3C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,MAAM,CAAC,EAAE,CAAC,MA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AAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAocD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,QAAQ;IAC/C,OAAO,CAAC,SAAS,CAAS;gBAEd,OAAO,EAAE,0BAA0B;IAqBtC,IAAI,IAAI,mBAAmB;CAWrC;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,MAAM;IACpC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAsB;gBAE5B,OAAO,GAAE,iBAAsB;IAqC3C;;;;;;;;;;OAUG;WACU,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAAC,UAAU,CAAC;IAa9F;;;;;OAKG;IACH,YAAY,IAAI,KAAK,GAAG,IAAI;IAI5B,OAAO,CAAC,SAAS;IAmPjB;;OAEG;IACH,WAAW,IAAI,QAAQ,EAAE;IAIhB,IAAI,IAAI,UAAU;CAO5B;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,WAAW,CAAC,GAC7C,UAAU,CAEZ"}
|
|
@@ -6,5 +6,7 @@
|
|
|
6
6
|
* of the manimweb rendering pipeline.
|
|
7
7
|
*/
|
|
8
8
|
export { Brace, BraceBetweenPoints, ArcBrace, BraceLabel, BraceText, type BraceOptions, type BraceBetweenPointsOptions, type ArcBraceOptions, type BraceLabelOptions, } from './Brace';
|
|
9
|
-
export { SVGMobject, svgMobject, VMobjectFromSVGPath, type SVGMobjectOptions, type VMobjectFromSVGPathOptions, } from './SVGMobject';
|
|
9
|
+
export { SVGMobject, svgMobject, VMobjectFromSVGPath, type SVGMobjectOptions, type VMobjectFromSVGPathOptions, type SVGMobjectFromUrlOptions, } from './SVGMobject';
|
|
10
|
+
export { GradientVMobject, type GradientVMobjectOptions, type SvgGradient, type SvgGradientStop, type SvgGradientType, } from './svgGradients';
|
|
11
|
+
export { type SvgFetcher, type SvgFetchResponse } from './svgLoader';
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mobjects/svg/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,KAAK,EACL,kBAAkB,EAClB,QAAQ,EACR,UAAU,EACV,SAAS,EACT,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC9B,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,0BAA0B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mobjects/svg/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,KAAK,EACL,kBAAkB,EAClB,QAAQ,EACR,UAAU,EACV,SAAS,EACT,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC9B,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,GAC9B,MAAM,cAAc,CAAC;AAItB,OAAO,EACL,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { VMobject } from '../../core/VMobject';
|
|
2
|
+
import { SvgGradient } from './svgGradients';
|
|
3
|
+
/**
|
|
4
|
+
* Create a flat-styled VMobject from Bezier control points.
|
|
5
|
+
*
|
|
6
|
+
* @param points3D - Bezier control points in 3D.
|
|
7
|
+
* @param color - Stroke color.
|
|
8
|
+
* @param strokeWidth - Stroke width.
|
|
9
|
+
* @param fillColor - Optional fill color.
|
|
10
|
+
* @param fillOpacity - Fill opacity (default 0).
|
|
11
|
+
*/
|
|
12
|
+
export declare function createStyledVMobject(points3D: [number, number, number][], color: string, strokeWidth: number, fillColor?: string, fillOpacity?: number): VMobject;
|
|
13
|
+
/** Options describing how to style one SVG shape's fill. */
|
|
14
|
+
export interface FilledVMobjectOptions {
|
|
15
|
+
/** Bezier control points in 3D. */
|
|
16
|
+
points3D: [number, number, number][];
|
|
17
|
+
/** Resolved stroke color. */
|
|
18
|
+
strokeColor: string;
|
|
19
|
+
/** Resolved stroke width. */
|
|
20
|
+
strokeWidth: number;
|
|
21
|
+
/** The raw `fill` attribute from the element (may be null). */
|
|
22
|
+
rawFill: string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Fallback fill used when the element has no `fill` attribute. `<path>` falls
|
|
25
|
+
* back to the SVGMobject default fill; other shapes pass undefined to match
|
|
26
|
+
* their original behavior.
|
|
27
|
+
*/
|
|
28
|
+
fallbackFill?: string;
|
|
29
|
+
/** Default fill opacity for a filled shape. */
|
|
30
|
+
defaultFillOpacity?: number;
|
|
31
|
+
/** Gradient definitions for resolving `url(#id)` fills. */
|
|
32
|
+
defs: Map<string, SvgGradient>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Build a VMobject for a fill-bearing SVG shape, applying a gradient fill when
|
|
36
|
+
* the `fill` is a resolvable `url(#id)` reference and a flat fill otherwise.
|
|
37
|
+
*
|
|
38
|
+
* The flat-fill branch reproduces the original per-shape logic exactly, so
|
|
39
|
+
* non-gradient shapes are unaffected.
|
|
40
|
+
*/
|
|
41
|
+
export declare function makeFilledVMobject(options: FilledVMobjectOptions): VMobject;
|
|
42
|
+
//# sourceMappingURL=svgFill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svgFill.d.ts","sourceRoot":"","sources":["../../../src/mobjects/svg/svgFill.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAyC,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEzF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EACpC,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,GACnB,QAAQ,CAUV;AAED,4DAA4D;AAC5D,MAAM,WAAW,qBAAqB;IACpC,mCAAmC;IACnC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACrC,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,2DAA2D;IAC3D,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,qBAAqB,GAAG,QAAQ,CAqB3E"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { VMobject } from '../../core/VMobject';
|
|
2
|
+
/** Gradient geometry kind parsed from an SVG definition. */
|
|
3
|
+
export type SvgGradientType = 'linear' | 'radial';
|
|
4
|
+
/** One color stop of an SVG gradient. */
|
|
5
|
+
export interface SvgGradientStop {
|
|
6
|
+
/** Position along the gradient, clamped to [0, 1]. */
|
|
7
|
+
offset: number;
|
|
8
|
+
/** Stop color as a CSS color string (default black). */
|
|
9
|
+
color: string;
|
|
10
|
+
/** Stop opacity in [0, 1] (default 1). */
|
|
11
|
+
opacity: number;
|
|
12
|
+
}
|
|
13
|
+
/** Parsed SVG gradient definition. */
|
|
14
|
+
export interface SvgGradient {
|
|
15
|
+
/** The gradient `id` used by `url(#id)` references. */
|
|
16
|
+
id: string;
|
|
17
|
+
/** Gradient kind. Radial is approximated as a linear stop sequence. */
|
|
18
|
+
type: SvgGradientType;
|
|
19
|
+
/** Ordered color stops. */
|
|
20
|
+
stops: SvgGradientStop[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Collect every `<linearGradient>`/`<radialGradient>` definition in an SVG,
|
|
24
|
+
* keyed by its `id`. Gradients without an `id` or without stops are skipped.
|
|
25
|
+
*
|
|
26
|
+
* @param svg - The parsed `<svg>` root element.
|
|
27
|
+
* @returns A map from gradient id to its parsed definition.
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseGradientDefs(svg: Element): Map<string, SvgGradient>;
|
|
30
|
+
/**
|
|
31
|
+
* Resolve a `fill="url(#id)"` reference to its gradient definition.
|
|
32
|
+
*
|
|
33
|
+
* @param fillAttr - The raw fill attribute value.
|
|
34
|
+
* @param defs - Gradient definitions from {@link parseGradientDefs}.
|
|
35
|
+
* @returns The matching gradient, or undefined when the fill is not a gradient
|
|
36
|
+
* reference or the id is unknown.
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveGradientFill(fillAttr: string | null | undefined, defs: Map<string, SvgGradient>): SvgGradient | undefined;
|
|
39
|
+
/** Options for {@link GradientVMobject}. */
|
|
40
|
+
export interface GradientVMobjectOptions {
|
|
41
|
+
/** The resolved gradient applied as this object's fill. */
|
|
42
|
+
gradient: SvgGradient;
|
|
43
|
+
/** Bezier control points in 3D. */
|
|
44
|
+
points3D: [number, number, number][];
|
|
45
|
+
/** Stroke color (default WHITE). */
|
|
46
|
+
strokeColor?: string;
|
|
47
|
+
/** Stroke width (default DEFAULT_STROKE_WIDTH). */
|
|
48
|
+
strokeWidth?: number;
|
|
49
|
+
/** Fill opacity (default 0.5). */
|
|
50
|
+
fillOpacity?: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A VMobject whose fill comes from an SVG gradient.
|
|
54
|
+
*
|
|
55
|
+
* The flat `fillColor` is the first (offset-0) stop, so it renders correctly in
|
|
56
|
+
* the single-fill pipeline. {@link gradientColors} holds the full resampled
|
|
57
|
+
* palette (via {@link colorGradient}) for consumers that render or animate the
|
|
58
|
+
* gradient, and {@link gradient} keeps the original parsed stops.
|
|
59
|
+
*/
|
|
60
|
+
export declare class GradientVMobject extends VMobject {
|
|
61
|
+
/** The parsed gradient definition applied as fill. */
|
|
62
|
+
readonly gradient: SvgGradient;
|
|
63
|
+
/** Evenly spaced palette of the gradient stops (via {@link colorGradient}). */
|
|
64
|
+
readonly gradientColors: string[];
|
|
65
|
+
constructor(options: GradientVMobjectOptions);
|
|
66
|
+
copy(): GradientVMobject;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=svgGradients.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svgGradients.d.ts","sourceRoot":"","sources":["../../../src/mobjects/svg/svgGradients.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAK/C,4DAA4D;AAC5D,MAAM,MAAM,eAAe,GAAG,QAA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,IAAI,gBAAgB;CAWlC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ImageMobject } from '../image';
|
|
2
|
+
/**
|
|
3
|
+
* Build one {@link ImageMobject} per `<image>` element that has an href.
|
|
4
|
+
*
|
|
5
|
+
* @param svg - The parsed `<svg>` root element.
|
|
6
|
+
* @returns Image mobjects, in document order. Elements without an href are skipped.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildSvgImageMobjects(svg: Element): ImageMobject[];
|
|
9
|
+
//# sourceMappingURL=svgImage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svgImage.d.ts","sourceRoot":"","sources":["../../../src/mobjects/svg/svgImage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAcxC;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,EAAE,CAwBlE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL loading for SVGMobject (best-manim enhancement).
|
|
3
|
+
*
|
|
4
|
+
* `SVGMobject.fromUrl` fetches SVG text and parses it through the existing
|
|
5
|
+
* string path. The fetcher is injected (default `globalThis.fetch`) so tests
|
|
6
|
+
* can supply a mock and never touch the network.
|
|
7
|
+
*/
|
|
8
|
+
/** Minimal response shape `fromUrl` needs — satisfied by the DOM `Response`. */
|
|
9
|
+
export interface SvgFetchResponse {
|
|
10
|
+
/** Whether the HTTP status is in the 2xx range. */
|
|
11
|
+
ok: boolean;
|
|
12
|
+
/** HTTP status code. */
|
|
13
|
+
status: number;
|
|
14
|
+
/** Resolve to the response body as text. */
|
|
15
|
+
text(): Promise<string>;
|
|
16
|
+
}
|
|
17
|
+
/** A function that fetches a URL, compatible with `globalThis.fetch`. */
|
|
18
|
+
export type SvgFetcher = (url: string) => Promise<SvgFetchResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Default fetcher: delegates to `globalThis.fetch`.
|
|
21
|
+
*
|
|
22
|
+
* Rejects with a clear error when no global fetch exists, so the caller can
|
|
23
|
+
* record it via `getLoadError()` instead of throwing a cryptic ReferenceError.
|
|
24
|
+
*/
|
|
25
|
+
export declare const defaultSvgFetcher: SvgFetcher;
|
|
26
|
+
/**
|
|
27
|
+
* Fetch SVG text from a URL using the injected fetcher.
|
|
28
|
+
*
|
|
29
|
+
* @param url - The SVG resource URL.
|
|
30
|
+
* @param fetcher - The fetch implementation (defaults to {@link defaultSvgFetcher}).
|
|
31
|
+
* @returns The response body as text.
|
|
32
|
+
* @throws When the fetch rejects or the response status is not ok.
|
|
33
|
+
*/
|
|
34
|
+
export declare function fetchSvgText(url: string, fetcher?: SvgFetcher): Promise<string>;
|
|
35
|
+
//# sourceMappingURL=svgLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svgLoader.d.ts","sourceRoot":"","sources":["../../../src/mobjects/svg/svgLoader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gFAAgF;AAChF,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,EAAE,EAAE,OAAO,CAAC;IACZ,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB;AAED,yEAAyE;AACzE,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEpE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,UAO/B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,UAA8B,GACtC,OAAO,CAAC,MAAM,CAAC,CAMjB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Text } from '../text/Text';
|
|
2
|
+
/** Default styling for `<text>` elements that omit their own. */
|
|
3
|
+
export interface SvgTextDefaults {
|
|
4
|
+
/** Fill color used when the element has no usable `fill`. */
|
|
5
|
+
color: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Build one {@link Text} mobject per `<text>` element in the SVG.
|
|
9
|
+
*
|
|
10
|
+
* @param svg - The parsed `<svg>` root element.
|
|
11
|
+
* @param defaults - Fallback styling (currently the default fill color).
|
|
12
|
+
* @returns Text mobjects, in document order. Empty `<text>` nodes are skipped.
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildSvgTextMobjects(svg: Element, defaults: SvgTextDefaults): Text[];
|
|
15
|
+
//# sourceMappingURL=svgText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svgText.d.ts","sourceRoot":"","sources":["../../../src/mobjects/svg/svgText.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,iEAAiE;AACjE,MAAM,WAAW,eAAe;IAC9B,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;CACf;AASD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,GAAG,IAAI,EAAE,CA2BpF"}
|
|
@@ -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,CAAC;AAClD,OAAO,EACL,KAAK,KAAK,EACV,KAAK,eAAe,EAGrB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"Code.d.ts","sourceRoot":"","sources":["../../../src/mobjects/text/Code.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAA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;cACgB,oBAAoB,IAAI,IAAI;IAY/C;;OAEG;IACM,SAAS,IAAI,YAAY;IAIzB,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,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mobjects/text/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGhD,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAG9F,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAG9E,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/D,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAG1F,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAG/F,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG7F,OAAO,EAAE,YAAY,EAAE,K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,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,KAAK,EACV,KAAK,SAAS,EACd,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG/E,OAAO,EACL,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,WAAW,EACX,KAAK,kBAAkB,GACxB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACzB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { RateFunction } from './index';
|
|
2
|
+
/**
|
|
3
|
+
* Create a CSS cubic-bezier easing.
|
|
4
|
+
*
|
|
5
|
+
* Control points are P0 = (0, 0), P1 = (x1, y1), P2 = (x2, y2), P3 = (1, 1).
|
|
6
|
+
* x1 and x2 are clamped to [0, 1] so the x axis stays monotonic, as CSS
|
|
7
|
+
* requires. y1 and y2 are free, so the curve may overshoot.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const ease = cubicBezier(0.25, 0.1, 0.25, 1);
|
|
11
|
+
* ease(0); // 0
|
|
12
|
+
* ease(1); // 1
|
|
13
|
+
*/
|
|
14
|
+
export declare const cubicBezier: (x1: number, y1: number, x2: number, y2: number) => RateFunction;
|
|
15
|
+
/** CSS `ease`: slow start, fast middle, slow end. */
|
|
16
|
+
export declare const ease: RateFunction;
|
|
17
|
+
/** CSS `ease-in`: slow start. */
|
|
18
|
+
export declare const easeInBezier: RateFunction;
|
|
19
|
+
/** CSS `ease-out`: slow end. */
|
|
20
|
+
export declare const easeOutBezier: RateFunction;
|
|
21
|
+
/** CSS `ease-in-out`: slow start and end. */
|
|
22
|
+
export declare const easeInOutBezier: RateFunction;
|
|
23
|
+
/** Where a step jumps: at the start or the end of each interval. */
|
|
24
|
+
export type StepPosition = 'start' | 'end';
|
|
25
|
+
/**
|
|
26
|
+
* Create a CSS steps() timing function with n steps.
|
|
27
|
+
*
|
|
28
|
+
* - 'end' (default) holds then jumps at the end of each interval.
|
|
29
|
+
* - 'start' jumps at the start of each interval.
|
|
30
|
+
*
|
|
31
|
+
* Both start at 0 at t = 0 and reach 1 at t = 1.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* const quantized = steps(4);
|
|
35
|
+
* quantized(0); // 0
|
|
36
|
+
* quantized(1); // 1
|
|
37
|
+
*/
|
|
38
|
+
export declare const steps: (n: number, position?: StepPosition) => RateFunction;
|
|
39
|
+
//# sourceMappingURL=customEase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customEase.d.ts","sourceRoot":"","sources":["../../src/rate-functions/customEase.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA+D5C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,GAAI,IAAI,MAAM,EAAE,IAAI,MAAM,EAAE,IAAI,MAAM,EAAE,IAAI,MAAM,KAAG,YAa5E,CAAC;AAIF,qDAAqD;AACrD,eAAO,MAAM,IAAI,EAAE,YAA8C,CAAC;AAElE,iCAAiC;AACjC,eAAO,MAAM,YAAY,EAAE,YAAyC,CAAC;AAErE,gCAAgC;AAChC,eAAO,MAAM,aAAa,EAAE,YAAyC,CAAC;AAEtE,6CAA6C;AAC7C,eAAO,MAAM,eAAe,EAAE,YAA4C,CAAC;AAI3E,oEAAoE;AACpE,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,EAAE,WAAU,YAAoB,KAAG,YAOjE,CAAC"}
|