manim-web 0.13.0 → 0.15.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 +35 -19
- package/dist/animation/transform/MovementTransforms.d.ts.map +1 -1
- package/dist/export/chooseExporter.d.ts +19 -0
- package/dist/export/chooseExporter.d.ts.map +1 -0
- package/dist/export/index.d.ts +1 -0
- package/dist/export/index.d.ts.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/integrations/react.js +16 -16
- package/dist/integrations/vue.js +13 -13
- package/dist/interaction/DynamicMatrix.d.ts +164 -0
- package/dist/interaction/DynamicMatrix.d.ts.map +1 -0
- package/dist/interaction/index.d.ts +1 -0
- package/dist/interaction/index.d.ts.map +1 -1
- package/dist/manim-web.browser.js +1499 -624
- package/dist/mobjects/geo/ChoroplethMap.d.ts +72 -0
- package/dist/mobjects/geo/ChoroplethMap.d.ts.map +1 -0
- package/dist/mobjects/geo/Globe.d.ts +122 -0
- package/dist/mobjects/geo/Globe.d.ts.map +1 -0
- package/dist/mobjects/geo/colorScale.d.ts +45 -0
- package/dist/mobjects/geo/colorScale.d.ts.map +1 -0
- package/dist/mobjects/geo/geojson.d.ts +54 -0
- package/dist/mobjects/geo/geojson.d.ts.map +1 -0
- package/dist/mobjects/geo/index.d.ts +13 -0
- package/dist/mobjects/geo/index.d.ts.map +1 -0
- package/dist/mobjects/geo/projections.d.ts +53 -0
- package/dist/mobjects/geo/projections.d.ts.map +1 -0
- package/dist/mobjects/three-d/Line3D.d.ts.map +1 -1
- package/dist/player/ExportSettingsUI.d.ts +82 -0
- package/dist/player/ExportSettingsUI.d.ts.map +1 -0
- package/dist/player/Player.d.ts +50 -2
- package/dist/player/Player.d.ts.map +1 -1
- package/dist/player/PlayerUI.d.ts +15 -1
- package/dist/player/PlayerUI.d.ts.map +1 -1
- package/dist/player/SlideInteractionRenderer.d.ts +32 -0
- package/dist/player/SlideInteractionRenderer.d.ts.map +1 -0
- package/dist/player/index.d.ts +1 -0
- package/dist/player/index.d.ts.map +1 -1
- package/dist/rate-functions/spring.d.ts.map +1 -1
- package/dist/serialization/defaults.d.ts +13 -0
- package/dist/serialization/defaults.d.ts.map +1 -0
- package/dist/serialization/index.d.ts +15 -0
- package/dist/serialization/index.d.ts.map +1 -0
- package/dist/serialization/props.d.ts +16 -0
- package/dist/serialization/props.d.ts.map +1 -0
- package/dist/serialization/registry.d.ts +17 -0
- package/dist/serialization/registry.d.ts.map +1 -0
- package/dist/serialization/serialize.d.ts +24 -0
- package/dist/serialization/serialize.d.ts.map +1 -0
- package/dist/serialization/types.d.ts +70 -0
- package/dist/serialization/types.d.ts.map +1 -0
- package/dist/{src-BcBBUMTP.js → src-Da4luuzD.js} +1481 -606
- package/dist/test-setup/TestMobject.d.ts +23 -0
- package/dist/test-setup/TestMobject.d.ts.map +1 -0
- package/dist/utils/axis.d.ts +0 -1
- package/dist/utils/axis.d.ts.map +1 -1
- package/package.json +3 -1
|
@@ -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"}
|
package/dist/player/index.d.ts
CHANGED
|
@@ -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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spring.d.ts","sourceRoot":"","sources":["../../src/rate-functions/spring.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"spring.d.ts","sourceRoot":"","sources":["../../src/rate-functions/spring.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAgFD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM,GAAI,UAAS,aAAkB,KAAG,YAapD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default serializers for the common mobjects.
|
|
3
|
+
*
|
|
4
|
+
* Each serializer captures only the type-specific, constructor-relevant
|
|
5
|
+
* (unscaled) props. The framework (`serialize.ts`) captures transform, style,
|
|
6
|
+
* and children generically, so these never repeat them. Reading an unscaled
|
|
7
|
+
* base value (e.g. `_radius`, not `getRadius()`) keeps scale in the transform
|
|
8
|
+
* only, which is what makes serialize→deserialize→serialize stable.
|
|
9
|
+
*
|
|
10
|
+
* Registering runs once as an import side effect from the folder entry point.
|
|
11
|
+
*/
|
|
12
|
+
export declare function registerDefaultSerializers(): void;
|
|
13
|
+
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/serialization/defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAsDH,wBAAgB,0BAA0B,IAAI,IAAI,CAuHjD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scene serialization (best-manim).
|
|
3
|
+
*
|
|
4
|
+
* Serialize a scene or a single mobject to a plain, JSON-safe document, store
|
|
5
|
+
* or deep-link it, and reload it in another session. The format is open: new
|
|
6
|
+
* mobject types register their own serializer, so the schema grows without a
|
|
7
|
+
* central union to edit.
|
|
8
|
+
*
|
|
9
|
+
* Importing this module registers the default serializers (common geometry,
|
|
10
|
+
* groups, and text) as a side effect.
|
|
11
|
+
*/
|
|
12
|
+
export { serializeScene, deserializeScene, serializeMobject, deserializeMobject, } from './serialize';
|
|
13
|
+
export { registerSerializableMobject, unregisterSerializableMobject, getSerializer, getSerializableTypes, } from './registry';
|
|
14
|
+
export type { SerializedScene, SerializedMobject, SerializedTransform, SerializedStyle, MobjectSerializer, SceneLike, ContainerLike, Vec3, } from './types';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/serialization/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,EAC7B,aAAa,EACb,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,IAAI,GACL,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Vec3 } from './types';
|
|
2
|
+
/** Read a number, or `fallback` when the value is not a finite number. */
|
|
3
|
+
export declare function readNumber(value: unknown, fallback: number): number;
|
|
4
|
+
/** Read a string, or `fallback` when the value is not a string. */
|
|
5
|
+
export declare function readString(value: unknown, fallback: string): string;
|
|
6
|
+
/** Read a boolean, or `fallback` when the value is not a boolean. */
|
|
7
|
+
export declare function readBoolean(value: unknown, fallback: boolean): boolean;
|
|
8
|
+
/** Read an optional string: a string, or `undefined`. */
|
|
9
|
+
export declare function readOptionalString(value: unknown): string | undefined;
|
|
10
|
+
/** Read a `[x, y, z]` triple, or `fallback` when the value is not one. */
|
|
11
|
+
export declare function readVec3(value: unknown, fallback: Vec3): Vec3;
|
|
12
|
+
/** Read an array of `[x, y, z]` triples, dropping any malformed entries. */
|
|
13
|
+
export declare function readVec3Array(value: unknown): Vec3[];
|
|
14
|
+
/** True when `value` is a non-null, non-array object (a props/record bag). */
|
|
15
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
16
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/serialization/props.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,0EAA0E;AAC1E,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,mEAAmE;AACnE,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAEtE;AAED,yDAAyD;AACzD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAErE;AAWD,0EAA0E;AAC1E,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,GAAG,IAAI,CAE7D;AAED,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,EAAE,CAOpD;AAED,8EAA8E;AAC9E,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Mobject } from '../core/Mobject';
|
|
2
|
+
import { MobjectSerializer } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Register a serializer for a mobject type.
|
|
5
|
+
*
|
|
6
|
+
* @param name - The type name, which must match the mobject's class name
|
|
7
|
+
* (`mobject.constructor.name`) so instances can be looked up at capture time.
|
|
8
|
+
* @param serializer - The serialize/deserialize pair for this type.
|
|
9
|
+
*/
|
|
10
|
+
export declare function registerSerializableMobject<T extends Mobject>(name: string, serializer: MobjectSerializer<T>): void;
|
|
11
|
+
/** Remove a registration. Mainly for tests and hot-swapping. */
|
|
12
|
+
export declare function unregisterSerializableMobject(name: string): void;
|
|
13
|
+
/** Look up a serializer by type name, or `undefined` when none is registered. */
|
|
14
|
+
export declare function getSerializer(name: string): MobjectSerializer | undefined;
|
|
15
|
+
/** The names of every registered type, sorted for stable output. */
|
|
16
|
+
export declare function getSerializableTypes(): string[];
|
|
17
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/serialization/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAIjD;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,OAAO,EAC3D,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAC/B,IAAI,CAIN;AAED,gEAAgE;AAChE,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEhE;AAED,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAEzE;AAED,oEAAoE;AACpE,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Mobject } from '../core/Mobject';
|
|
2
|
+
import { ContainerLike, SceneLike, SerializedMobject, SerializedScene } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Capture a single mobject (and its submobject tree) as a JSON-safe object.
|
|
5
|
+
*
|
|
6
|
+
* An unregistered type is captured with `unknown: true` and empty `props`, so
|
|
7
|
+
* the document still records its position in the tree for debugging, while a
|
|
8
|
+
* restore skips it.
|
|
9
|
+
*/
|
|
10
|
+
export declare function serializeMobject(mob: Mobject): SerializedMobject;
|
|
11
|
+
/**
|
|
12
|
+
* Reconstruct a single mobject from a serialized node, or `null` when the type
|
|
13
|
+
* is unknown (unregistered or marked `unknown`). Known children are attached;
|
|
14
|
+
* unknown children are dropped.
|
|
15
|
+
*/
|
|
16
|
+
export declare function deserializeMobject(json: unknown): Mobject | null;
|
|
17
|
+
/** Capture a whole scene (its top-level mobjects) as a JSON document. */
|
|
18
|
+
export declare function serializeScene(scene: SceneLike): SerializedScene;
|
|
19
|
+
/**
|
|
20
|
+
* Reconstruct the mobjects of a document and add each one to `container`.
|
|
21
|
+
* Returns the created top-level mobjects. A malformed document yields `[]`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function deserializeScene(json: unknown, container: ContainerLike): Mobject[];
|
|
24
|
+
//# sourceMappingURL=serialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/serialization/serialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,eAAe,EAGrB,MAAM,SAAS,CAAC;AAmDjB;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,iBAAiB,CAYhE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAqBhE;AAED,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,eAAe,CAIhE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,GAAG,OAAO,EAAE,CAWnF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Mobject } from '../core/Mobject';
|
|
2
|
+
/** A plain, JSON-safe triple. */
|
|
3
|
+
export type Vec3 = [number, number, number];
|
|
4
|
+
/** Position, rotation (Euler XYZ, radians), and scale of a mobject. */
|
|
5
|
+
export interface SerializedTransform {
|
|
6
|
+
position: Vec3;
|
|
7
|
+
rotation: Vec3;
|
|
8
|
+
scale: Vec3;
|
|
9
|
+
}
|
|
10
|
+
/** Stroke and fill of a mobject. Only defined fields are written. */
|
|
11
|
+
export interface SerializedStyle {
|
|
12
|
+
strokeColor?: string;
|
|
13
|
+
fillColor?: string;
|
|
14
|
+
strokeOpacity?: number;
|
|
15
|
+
fillOpacity?: number;
|
|
16
|
+
strokeWidth?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* One serialized mobject.
|
|
20
|
+
*
|
|
21
|
+
* `props` is `Record<string, unknown>` on purpose: each registered type owns
|
|
22
|
+
* the shape of its own props and narrows them on restore, so the schema stays
|
|
23
|
+
* open for new types without a central union to edit.
|
|
24
|
+
*/
|
|
25
|
+
export interface SerializedMobject {
|
|
26
|
+
/** Registered type name (its class name), e.g. `Circle`. */
|
|
27
|
+
type: string;
|
|
28
|
+
/** Constructor-relevant, unscaled properties for this type. */
|
|
29
|
+
props: Record<string, unknown>;
|
|
30
|
+
/** Position/rotation/scale, applied after construction. */
|
|
31
|
+
transform: SerializedTransform;
|
|
32
|
+
/** Stroke/fill, applied after construction. */
|
|
33
|
+
style: SerializedStyle;
|
|
34
|
+
/** Submobject tree. */
|
|
35
|
+
children: SerializedMobject[];
|
|
36
|
+
/**
|
|
37
|
+
* Present and `true` when the type had no registered serializer at capture
|
|
38
|
+
* time. Such a node is skipped (not reconstructed) on restore.
|
|
39
|
+
*/
|
|
40
|
+
unknown?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/** Current document version. Bump when the schema changes incompatibly. */
|
|
43
|
+
export declare const SCENE_FORMAT = "manim-web-scene";
|
|
44
|
+
export declare const SCENE_VERSION = 1;
|
|
45
|
+
/** A full serialized scene document. */
|
|
46
|
+
export interface SerializedScene {
|
|
47
|
+
format: typeof SCENE_FORMAT;
|
|
48
|
+
version: number;
|
|
49
|
+
mobjects: SerializedMobject[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A pair of functions that convert between a concrete mobject and its `props`.
|
|
53
|
+
*
|
|
54
|
+
* `serialize` returns only the type-specific, constructor-relevant props. The
|
|
55
|
+
* transform, style, and children are captured generically by the framework, so
|
|
56
|
+
* a serializer never repeats them.
|
|
57
|
+
*/
|
|
58
|
+
export interface MobjectSerializer<T extends Mobject = Mobject> {
|
|
59
|
+
serialize: (mobject: T) => Record<string, unknown>;
|
|
60
|
+
deserialize: (props: Record<string, unknown>) => T;
|
|
61
|
+
}
|
|
62
|
+
/** Anything the framework can read top-level mobjects from (e.g. a Scene). */
|
|
63
|
+
export interface SceneLike {
|
|
64
|
+
mobjects: Iterable<Mobject>;
|
|
65
|
+
}
|
|
66
|
+
/** Anything the framework can add reconstructed mobjects to (e.g. a Scene). */
|
|
67
|
+
export interface ContainerLike {
|
|
68
|
+
add: (...mobjects: Mobject[]) => unknown;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/serialization/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,iCAAiC;AACjC,MAAM,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE5C,uEAAuE;AACvE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,IAAI,CAAC;IACf,QAAQ,EAAE,IAAI,CAAC;IACf,KAAK,EAAE,IAAI,CAAC;CACb;AAED,qEAAqE;AACrE,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,2DAA2D;IAC3D,SAAS,EAAE,mBAAmB,CAAC;IAC/B,+CAA+C;IAC/C,KAAK,EAAE,eAAe,CAAC;IACvB,uBAAuB;IACvB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,2EAA2E;AAC3E,eAAO,MAAM,YAAY,oBAAoB,CAAC;AAC9C,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,wCAAwC;AACxC,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,OAAO,YAAY,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO;IAC5D,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnD,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACpD;AAED,8EAA8E;AAC9E,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;CAC7B;AAED,+EAA+E;AAC/E,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,CAAC,GAAG,QAAQ,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;CAC1C"}
|