manim-web 0.24.0 → 0.26.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 (55) hide show
  1. package/dist/export/SlideDeckExporter.d.ts +210 -0
  2. package/dist/export/SlideDeckExporter.d.ts.map +1 -0
  3. package/dist/export/index.d.ts +1 -0
  4. package/dist/export/index.d.ts.map +1 -1
  5. package/dist/html2canvas-DECPJJGt.js +4025 -0
  6. package/dist/index.d.ts +6 -4
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.es-BiZp4vgJ.js +5753 -0
  9. package/dist/index.js +3 -3
  10. package/dist/integrations/react.js +17 -17
  11. package/dist/integrations/vue.js +16 -16
  12. package/dist/jspdf.es.min-CvMJL6nS.js +18228 -0
  13. package/dist/manim-web.browser.js +3854 -1651
  14. package/dist/mobjects/graph/ForceDirectedLayout.d.ts +65 -0
  15. package/dist/mobjects/graph/ForceDirectedLayout.d.ts.map +1 -0
  16. package/dist/mobjects/graph/GenericGraph.d.ts +11 -0
  17. package/dist/mobjects/graph/GenericGraph.d.ts.map +1 -1
  18. package/dist/mobjects/graph/SankeyDiagram.d.ts +122 -0
  19. package/dist/mobjects/graph/SankeyDiagram.d.ts.map +1 -0
  20. package/dist/mobjects/graph/index.d.ts +4 -1
  21. package/dist/mobjects/graph/index.d.ts.map +1 -1
  22. package/dist/mobjects/graph/layoutAlgorithms.d.ts +54 -0
  23. package/dist/mobjects/graph/layoutAlgorithms.d.ts.map +1 -1
  24. package/dist/mobjects/graph/sankeyLayout.d.ts +97 -0
  25. package/dist/mobjects/graph/sankeyLayout.d.ts.map +1 -0
  26. package/dist/mobjects/graphing/AreaChart.d.ts +101 -0
  27. package/dist/mobjects/graphing/AreaChart.d.ts.map +1 -0
  28. package/dist/mobjects/graphing/CalendarHeatmap.d.ts +111 -0
  29. package/dist/mobjects/graphing/CalendarHeatmap.d.ts.map +1 -0
  30. package/dist/mobjects/graphing/ChordDiagram.d.ts +122 -0
  31. package/dist/mobjects/graphing/ChordDiagram.d.ts.map +1 -0
  32. package/dist/mobjects/graphing/DomainColoring.d.ts +114 -0
  33. package/dist/mobjects/graphing/DomainColoring.d.ts.map +1 -0
  34. package/dist/mobjects/graphing/RadarChart.d.ts +135 -0
  35. package/dist/mobjects/graphing/RadarChart.d.ts.map +1 -0
  36. package/dist/mobjects/graphing/StackedBarChart.d.ts +131 -0
  37. package/dist/mobjects/graphing/StackedBarChart.d.ts.map +1 -0
  38. package/dist/mobjects/graphing/StepChart.d.ts +90 -0
  39. package/dist/mobjects/graphing/StepChart.d.ts.map +1 -0
  40. package/dist/mobjects/graphing/Treemap.d.ts +100 -0
  41. package/dist/mobjects/graphing/Treemap.d.ts.map +1 -0
  42. package/dist/mobjects/graphing/WaterfallChart.d.ts +164 -0
  43. package/dist/mobjects/graphing/WaterfallChart.d.ts.map +1 -0
  44. package/dist/mobjects/graphing/chartColors.d.ts +18 -0
  45. package/dist/mobjects/graphing/chartColors.d.ts.map +1 -0
  46. package/dist/mobjects/graphing/chordLayout.d.ts +89 -0
  47. package/dist/mobjects/graphing/chordLayout.d.ts.map +1 -0
  48. package/dist/mobjects/graphing/index.d.ts +12 -0
  49. package/dist/mobjects/graphing/index.d.ts.map +1 -1
  50. package/dist/mobjects/graphing/treemapLayout.d.ts +83 -0
  51. package/dist/mobjects/graphing/treemapLayout.d.ts.map +1 -0
  52. package/dist/purify.es-MUrypqLF.js +864 -0
  53. package/dist/{src-DRH8XOAP.js → src-B2lipHn1.js} +3836 -1633
  54. package/dist/typeof-CcP5rTWg.js +11 -0
  55. package/package.json +2 -1
@@ -0,0 +1,65 @@
1
+ import { Animation, AnimationOptions } from '../../animation/Animation';
2
+ import { Vector3Tuple } from '../../core/Mobject';
3
+ import { GenericGraph } from './GenericGraph';
4
+ import { VertexId } from './graphTypes';
5
+ /**
6
+ * Options for the ForceDirectedLayout animation.
7
+ */
8
+ export interface ForceDirectedLayoutOptions extends AnimationOptions {
9
+ /** Number of simulation steps to run. Default: 50. */
10
+ iterations?: number;
11
+ /** Cooling factor applied to the temperature each step. Default: 0.95. */
12
+ cooling?: number;
13
+ /** Layout scale. It sets the force constant and the initial temperature. Default: 2. */
14
+ scale?: number;
15
+ /** Layout center. Default: [0, 0, 0]. */
16
+ center?: Vector3Tuple;
17
+ /** Explicit initial positions. They override the random or seeded start. */
18
+ initialPositions?: Map<VertexId, Vector3Tuple>;
19
+ /** Seed for the random initial positions. Omit to start from the current positions. */
20
+ seed?: number;
21
+ }
22
+ export declare class ForceDirectedLayout extends Animation {
23
+ private _graph;
24
+ private _iterations;
25
+ private _cooling;
26
+ private _scale;
27
+ private _center;
28
+ private _seed?;
29
+ private _initialPositions?;
30
+ private _vertices;
31
+ private _edges;
32
+ /** One positions snapshot per step (length = iterations + 1). */
33
+ private _trajectory;
34
+ constructor(graph: GenericGraph, options?: ForceDirectedLayoutOptions);
35
+ /**
36
+ * Snapshot the graph and build the full simulation trajectory once.
37
+ */
38
+ begin(): void;
39
+ /**
40
+ * Build the trajectory from the initial positions to the settled layout.
41
+ * Each entry is the positions after one more step.
42
+ */
43
+ private _computeTrajectory;
44
+ /** Resolve the starting positions from the options or the graph. */
45
+ private _resolveInitialPositions;
46
+ /**
47
+ * Move the graph's vertices to the simulation state for `alpha`.
48
+ * It interpolates between the two nearest trajectory snapshots, so the motion
49
+ * is smooth. `alpha` 0 is the initial layout and `alpha` 1 is the settled one.
50
+ */
51
+ interpolate(alpha: number): void;
52
+ /**
53
+ * Get the settled layout (the last trajectory snapshot).
54
+ * The map is empty until `begin()` runs.
55
+ */
56
+ getSettledPositions(): Map<VertexId, Vector3Tuple>;
57
+ }
58
+ /**
59
+ * Factory for a ForceDirectedLayout animation.
60
+ * @param graph - The graph to relax.
61
+ * @param options - Animation and simulation options.
62
+ * @returns A new ForceDirectedLayout animation.
63
+ */
64
+ export declare function forceDirectedLayout(graph: GenericGraph, options?: ForceDirectedLayoutOptions): ForceDirectedLayout;
65
+ //# sourceMappingURL=For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I,IAAI;IAOtB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAuB1B,oEAAoE;IACpE,OAAO,CAAC,wBAAwB;IA4BhC;;;;OAIG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAsBhC;;;OAGG;IACH,mBAAmB,IAAI,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC;CAUnD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,YAAY,EACnB,OAAO,CAAC,EAAE,0BAA0B,GACnC,mBAAmB,CAErB"}
@@ -1,6 +1,7 @@
1
1
  import { Mobject, Vector3Tuple } from '../../core/Mobject';
2
2
  import { Dot } from '../geometry/Dot';
3
3
  import { VertexId, EdgeTuple, LayoutType, VertexStyleOptions, EdgeStyleOptions, VertexConfig, EdgeConfig, LayoutConfig, GenericGraphOptions } from './graphTypes';
4
+ import { ForceDirectedLayout, ForceDirectedLayoutOptions } from './ForceDirectedLayout';
4
5
  import { Text } from '../text/Text';
5
6
  /**
6
7
  * GenericGraph - Base class for graph visualization
@@ -172,6 +173,16 @@ export declare class GenericGraph extends Mobject {
172
173
  * Get all vertex positions
173
174
  */
174
175
  getPositions(): Map<VertexId, Vector3Tuple>;
176
+ /**
177
+ * Build an animation that relaxes the graph with a live spring
178
+ * (force-directed) simulation. The vertices move step by step over the
179
+ * animation's run time, so the graph visibly settles.
180
+ *
181
+ * The scale, center, and iterations default to this graph's layout config.
182
+ * @param options - Animation and simulation options.
183
+ * @returns A ForceDirectedLayout animation.
184
+ */
185
+ animateSpringLayout(options?: ForceDirectedLayoutOptions): ForceDirectedLayout;
175
186
  /**
176
187
  * Set the color of a specific vertex
177
188
  */
@@ -1 +1 @@
1
- {"version":3,"file":"GenericGraph.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graph/GenericGraph.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,O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0,0 +1,122 @@
1
+ import { VGroup } from '../../core/VGroup';
2
+ import { VMobject } from '../../core/VMobject';
3
+ import { Rectangle } from '../geometry/Rectangle';
4
+ import { LinkLayout, SankeyLinkInput, SankeyNodeInput, SankeyOrientation } from './sankeyLayout';
5
+ /** How a link derives its color from its endpoints. */
6
+ export type SankeyLinkColorMode = 'source' | 'target' | 'blend';
7
+ /** A span (top and bottom y) along a node edge. */
8
+ export interface SankeySpan {
9
+ top: number;
10
+ bottom: number;
11
+ }
12
+ /**
13
+ * Options for {@link SankeyDiagram}.
14
+ */
15
+ export interface SankeyDiagramOptions {
16
+ /** Nodes keyed by id. */
17
+ nodes: SankeyNodeInput[];
18
+ /** Directed flows between nodes. */
19
+ links: SankeyLinkInput[];
20
+ /** Node thickness along the flow axis. Default: 0.3 */
21
+ nodeWidth?: number;
22
+ /** Gap between stacked nodes in one column. Default: 0.4 */
23
+ nodePadding?: number;
24
+ /** Distance between adjacent columns. Default: 3 */
25
+ layerSpacing?: number;
26
+ /** Target length of the tallest column. Default: 4 */
27
+ height?: number;
28
+ /** Minimum node length along the stacking axis. Default: 0.05 */
29
+ minNodeLength?: number;
30
+ /** Flow direction. Default: 'horizontal' */
31
+ orientation?: SankeyOrientation;
32
+ /** Whether to render node labels. Default: true */
33
+ showLabels?: boolean;
34
+ /** Label font size. Default: 24 */
35
+ labelFontSize?: number;
36
+ /** Gap between a node and its label. Default: 0.15 */
37
+ labelBuff?: number;
38
+ /** Node fill opacity. Default: 1 */
39
+ nodeFillOpacity?: number;
40
+ /** Link (ribbon) fill opacity. Default: 0.5 */
41
+ linkOpacity?: number;
42
+ /** How a link colors itself from its endpoints. Default: 'source' */
43
+ linkColorMode?: SankeyLinkColorMode;
44
+ }
45
+ /**
46
+ * A node rectangle inside a {@link SankeyDiagram}.
47
+ */
48
+ export declare class SankeyNode extends Rectangle {
49
+ /** Node identifier. */
50
+ readonly id: string;
51
+ /** Column index (0 = left-most for a horizontal diagram). */
52
+ readonly layer: number;
53
+ /** `max(incoming total, outgoing total)`. */
54
+ readonly throughput: number;
55
+ constructor(options: ConstructorParameters<typeof Rectangle>[0] & {
56
+ id: string;
57
+ layer: number;
58
+ throughput: number;
59
+ });
60
+ }
61
+ /**
62
+ * A flow ribbon inside a {@link SankeyDiagram}.
63
+ *
64
+ * The ribbon is a closed filled VMobject built from two cubic-bezier edges (a
65
+ * top and a bottom S-curve) joined by the straight source and target spans. Its
66
+ * thickness is proportional to {@link value}.
67
+ */
68
+ export declare class SankeyLink extends VMobject {
69
+ /** Source node id. */
70
+ readonly source: string;
71
+ /** Target node id. */
72
+ readonly target: string;
73
+ /** Flow magnitude. */
74
+ readonly value: number;
75
+ private readonly _width;
76
+ private readonly _sourceSpan;
77
+ private readonly _targetSpan;
78
+ constructor(layout: LinkLayout, orientation: SankeyOrientation, color: string, fillOpacity: number);
79
+ /** Ribbon thickness (proportional to {@link value}). */
80
+ getLinkWidth(): number;
81
+ /** Span occupied on the source node's edge, in horizontal layout space. */
82
+ getSourceSpan(): SankeySpan;
83
+ /** Span occupied on the target node's edge, in horizontal layout space. */
84
+ getTargetSpan(): SankeySpan;
85
+ }
86
+ /**
87
+ * SankeyDiagram - a layered flow diagram of nodes and proportional-width links.
88
+ *
89
+ * Nodes are placed in columns from sources to sinks. Each link is a filled
90
+ * cubic-bezier ribbon whose thickness is proportional to its value, stacked
91
+ * along each node's edge so sibling links do not overlap. A node with unequal
92
+ * incoming and outgoing totals is sized by the larger of the two.
93
+ *
94
+ * @example
95
+ * ```typescript
96
+ * const sankey = new SankeyDiagram({
97
+ * nodes: [{ id: 'a' }, { id: 'b' }, { id: 'c' }],
98
+ * links: [
99
+ * { source: 'a', target: 'b', value: 3 },
100
+ * { source: 'a', target: 'c', value: 1 },
101
+ * ],
102
+ * });
103
+ * ```
104
+ */
105
+ export declare class SankeyDiagram extends VGroup {
106
+ private readonly _nodes;
107
+ private readonly _links;
108
+ private readonly _nodeById;
109
+ constructor(options: SankeyDiagramOptions);
110
+ private _linkColor;
111
+ private _makeLabel;
112
+ /** All node rectangles, in input order. */
113
+ getNodes(): SankeyNode[];
114
+ /** All link ribbons, in input order. */
115
+ getLinks(): SankeyLink[];
116
+ /** The node with the given id, or `undefined`. */
117
+ getNode(id: string): SankeyNode | undefined;
118
+ /** The link at the given index, or `undefined`. */
119
+ getLink(index: number): SankeyLink | undefined;
120
+ copy(): SankeyDiagram;
121
+ }
122
+ //# sourceMappingURL=SankeyDiagram.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SankeyDiagram.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graph/SankeyDiagram.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EAGL,KAAK,UAAU,EAGf,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACvB,MAAM,gBAAgB,CAAC;AAKxB,uDAAuD;AACvD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEhE,mDAAmD;AACnD,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,yBAAyB;IACzB,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,oCAAoC;IACpC,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,aAAa,CAA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,MAAM;IAkBrB,wDAAwD;IACxD,YAAY,IAAI,MAAM;IAItB,2EAA2E;IAC3E,aAAa,IAAI,UAAU;IAI3B,2EAA2E;IAC3E,aAAa,IAAI,UAAU;CAG5B;AAkDD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,aAAc,SAAQ,MAAM;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiC;gBAE/C,OAAO,EAAE,oBAAoB;IA8EzC,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,UAAU;IAkBlB,2CAA2C;IAC3C,QAAQ,IAAI,UAAU,EAAE;IAIxB,wCAAwC;IACxC,QAAQ,IAAI,UAAU,EAAE;IAIxB,kDAAkD;IAClD,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAI3C,mDAAmD;IACnD,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIrC,IAAI,IAAI,aAAa;CAK/B"}
@@ -6,9 +6,12 @@
6
6
  * with various layout algorithms.
7
7
  */
8
8
  export type { VertexId, EdgeTuple, LayoutType, VertexStyleOptions, EdgeStyleOptions, VertexConfig, EdgeConfig, LayoutConfig, GenericGraphOptions, DiGraphOptions, } from './graphTypes';
9
- export { computeLayout, computeCircularLayout } from './layoutAlgorithms';
9
+ export { computeLayout, computeCircularLayout, springLayoutStep, randomSpringPositions, springForceConstant, DEFAULT_SPRING_COOLING, type SpringPoint, type SpringStepParams, type SpringStepResult, } from './layoutAlgorithms';
10
+ export { ForceDirectedLayout, forceDirectedLayout, type ForceDirectedLayoutOptions, } from './ForceDirectedLayout';
10
11
  export { GenericGraph } from './GenericGraph';
11
12
  export { Graph } from './Graph';
12
13
  export { DiGraph } from './DiGraph';
13
14
  export { completeGraph, cycleGraph, pathGraph, starGraph, binaryTree, gridGraph, bipartiteGraph, } from './graphFactories';
15
+ export { SankeyDiagram, SankeyNode, SankeyLink, type SankeyDiagramOptions, type SankeyLinkColorMode, type SankeySpan, } from './SankeyDiagram';
16
+ export { computeSankeyLayout, orientPoint, type SankeyNodeInput, type SankeyLinkInput, type SankeyOrientation, type SankeyLayoutOptions, type NodeLayout, type LinkLayout, type SankeyLayout, } from './sankeyLayout';
14
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graph/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACV,QAAQ,EACR,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,cAAc,GACf,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAG1E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EACL,aAAa,EACb,UAAU,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,cAAc,GACf,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graph/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACV,QAAQ,EACR,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,cAAc,GACf,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,0BAA0B,GAChC,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EACL,aAAa,EACb,UAAU,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,cAAc,GACf,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,aAAa,EACb,UAAU,EACV,UAAU,EACV,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,UAAU,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,YAAY,GAClB,MAAM,gBAAgB,CAAC"}
@@ -8,4 +8,58 @@ export declare function computeLayout(vertices: VertexId[], edges: EdgeTuple[],
8
8
  * Circular layout: vertices equally spaced on a circle
9
9
  */
10
10
  export declare function computeCircularLayout(vertices: VertexId[], positions: Map<VertexId, Vector3Tuple>, scale: number, center: Vector3Tuple): void;
11
+ /**
12
+ * A 2D point used by the spring (force-directed) simulation.
13
+ */
14
+ export interface SpringPoint {
15
+ x: number;
16
+ y: number;
17
+ }
18
+ /**
19
+ * Parameters for a single Fruchterman-Reingold step.
20
+ */
21
+ export interface SpringStepParams {
22
+ /** Optimal edge length (the `k` constant in Fruchterman-Reingold). */
23
+ k: number;
24
+ /** Current temperature. It limits the maximum displacement per step. */
25
+ temperature: number;
26
+ /** Cooling factor applied to the temperature after the step. Default: 0.95. */
27
+ cooling?: number;
28
+ }
29
+ /**
30
+ * Result of a single spring step: the next positions and the cooled temperature.
31
+ */
32
+ export interface SpringStepResult {
33
+ /** The positions after the step. */
34
+ positions: Map<VertexId, SpringPoint>;
35
+ /** The temperature after cooling. */
36
+ temperature: number;
37
+ }
38
+ /** Default cooling factor for the spring (force-directed) simulation. */
39
+ export declare const DEFAULT_SPRING_COOLING = 0.95;
40
+ /**
41
+ * Compute the Fruchterman-Reingold force constant `k` for `n` vertices.
42
+ * It is the optimal distance between two vertices for the given `scale`.
43
+ */
44
+ export declare function springForceConstant(n: number, scale: number): number;
45
+ /**
46
+ * Create the initial spring positions for the vertices.
47
+ *
48
+ * Each vertex gets a position inside a box of side `scale * 2` around `center`.
49
+ * Pass a deterministic `random` function (0..1) for a repeatable layout.
50
+ */
51
+ export declare function randomSpringPositions(vertices: VertexId[], scale: number, center: Vector3Tuple, random?: () => number): Map<VertexId, SpringPoint>;
52
+ /**
53
+ * Advance the spring (force-directed) simulation by one step.
54
+ *
55
+ * This is one Fruchterman-Reingold iteration. It computes repulsive forces
56
+ * between every pair of vertices and attractive forces along the edges. Then it
57
+ * moves each vertex by its net force, limited by the temperature. It returns a
58
+ * new positions map and the cooled temperature, so the caller holds the state.
59
+ *
60
+ * The function is pure. It reads `positions` and returns new positions. It does
61
+ * not change the input. Run it `iterations` times to reproduce
62
+ * `computeSpringLayout`.
63
+ */
64
+ export declare function springLayoutStep(vertices: VertexId[], edges: EdgeTuple[], positions: Map<VertexId, SpringPoint>, params: SpringStepParams): SpringStepResult;
11
65
  //# sourceMappingURL=layoutAlgorithms.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"layoutAlgorithms.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graph/layoutAlgorithms.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,c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AAgB;IAC/B,sEAAsE;IACtE,CAAC,EAAE,MAAM,CAAC;IACV,wEAAwE;IACxE,WAAW,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oCAAoC;IACpC,SAAS,EAAE,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACtC,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,yEAAyE;AACzE,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAGpE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,QAAQ,EAAE,EACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,YAAY,EACpB,MAAM,GAAE,MAAM,MAAoB,GACjC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAS5B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,EAAE,EACpB,KAAK,EAAE,SAAS,EAAE,EAClB,SAAS,EAAE,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,EACrC,MAAM,EAAE,gBAAgB,GACvB,gBAAgB,CAgElB"}
@@ -0,0 +1,97 @@
1
+ import { Vector3Tuple } from '../../core/Mobject';
2
+ /**
3
+ * A node in a {@link SankeyDiagram}.
4
+ *
5
+ * `layer` fixes the column (0 = left-most for a horizontal diagram). When it is
6
+ * omitted for every node, the layout derives columns from the link direction.
7
+ */
8
+ export interface SankeyNodeInput {
9
+ /** Unique node identifier, referenced by links. */
10
+ id: string;
11
+ /** Optional display label. Falls back to `id` when labels are shown. */
12
+ label?: string;
13
+ /** Optional explicit column index. */
14
+ layer?: number;
15
+ /** Optional CSS color for the node (and, by default, its outgoing links). */
16
+ color?: string;
17
+ }
18
+ /**
19
+ * A directed flow between two nodes. `value` sets the link (ribbon) thickness.
20
+ */
21
+ export interface SankeyLinkInput {
22
+ /** Source node id. */
23
+ source: string;
24
+ /** Target node id. */
25
+ target: string;
26
+ /** Flow magnitude. The ribbon thickness is proportional to this value. */
27
+ value: number;
28
+ }
29
+ /** Flow direction of the diagram. */
30
+ export type SankeyOrientation = 'horizontal' | 'vertical';
31
+ /** Tunable sizes used by {@link computeSankeyLayout}. */
32
+ export interface SankeyLayoutOptions {
33
+ /** Node thickness along the flow axis. */
34
+ nodeWidth: number;
35
+ /** Gap between stacked nodes in one column. */
36
+ nodePadding: number;
37
+ /** Distance between adjacent column centers. */
38
+ layerSpacing: number;
39
+ /** Target length of the tallest column (sum of its node lengths). */
40
+ height: number;
41
+ /** Minimum node length along the stacking axis. */
42
+ minNodeLength: number;
43
+ }
44
+ /** Computed geometry for one node, in horizontal (flow along +x) space. */
45
+ export interface NodeLayout {
46
+ id: string;
47
+ layer: number;
48
+ /** Center x of the node. */
49
+ x: number;
50
+ /** Top edge y (the larger y value). */
51
+ yTop: number;
52
+ /** Bottom edge y (the smaller y value). */
53
+ yBottom: number;
54
+ /** Node length along the stacking axis (`yTop - yBottom`). */
55
+ length: number;
56
+ /** `max(incoming total, outgoing total)`. */
57
+ throughput: number;
58
+ }
59
+ /** Computed geometry for one link, in horizontal (flow along +x) space. */
60
+ export interface LinkLayout {
61
+ index: number;
62
+ source: string;
63
+ target: string;
64
+ value: number;
65
+ /** Ribbon thickness. */
66
+ width: number;
67
+ /** Right edge x of the source node. */
68
+ sourceX: number;
69
+ sourceYTop: number;
70
+ sourceYBottom: number;
71
+ /** Left edge x of the target node. */
72
+ targetX: number;
73
+ targetYTop: number;
74
+ targetYBottom: number;
75
+ }
76
+ /** Full layout result. */
77
+ export interface SankeyLayout {
78
+ nodes: NodeLayout[];
79
+ links: LinkLayout[];
80
+ }
81
+ /**
82
+ * Map a horizontal-space point to the requested orientation.
83
+ *
84
+ * Horizontal keeps the point. Vertical rotates it so columns run top to bottom,
85
+ * by the map `(x, y) -> (y, -x)`.
86
+ */
87
+ export declare function orientPoint(point: Vector3Tuple, orientation: SankeyOrientation): Vector3Tuple;
88
+ /**
89
+ * Compute a layered left-to-right Sankey layout in horizontal space.
90
+ *
91
+ * The caller maps the result to the final orientation with {@link orientPoint}.
92
+ * Node lengths and link widths share one scale, so a link width is proportional
93
+ * to its value. A node with unequal in and out totals is sized by the larger of
94
+ * the two. The function never throws for empty, single, or unlinked input.
95
+ */
96
+ export declare function computeSankeyLayout(nodes: SankeyNodeInput[], links: SankeyLinkInput[], options: SankeyLayoutOptions): SankeyLayout;
97
+ //# sourceMappingURL=sankeyLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sankeyLayout.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graph/sankeyLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,mDAAmD;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qCAAqC;AACrC,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,UAAU,CAAC;AAE1D,yDAAyD;AACzD,MAAM,WAAW,mBAAmB;IAClC,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CA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GAC3B,YAAY,CA6Id"}
@@ -0,0 +1,101 @@
1
+ import { Group } from '../../core/Group';
2
+ import { VGroup } from '../../core/VGroup';
3
+ import { Polygon } from '../geometry/Polygon';
4
+ import { Axes } from './Axes';
5
+ /** Options for creating an AreaChart. */
6
+ export interface AreaChartOptions {
7
+ /** Y-values as [series][point]. A flat array is treated as a single series. */
8
+ values: number[][] | number[];
9
+ /** Shared x-values, one per point. Default: indices 0, 1, 2, ... */
10
+ xValues?: number[];
11
+ /** Stack the series so each area rests on the sum below it. Default: false */
12
+ stacked?: boolean;
13
+ /** Baseline each (unstacked) area fills down to. Default: 0 */
14
+ baseline?: number;
15
+ /** Series colors for fills and lines. Single color or array. Default: Manim palette */
16
+ seriesColors?: string | string[];
17
+ /** Series names for the legend. Default: [] */
18
+ seriesNames?: string[];
19
+ /** Fill opacity for the areas. Default: 0.4 */
20
+ fillOpacity?: number;
21
+ /** Stroke width for the top line. Default: 3 */
22
+ lineWidth?: number;
23
+ /** An existing Axes to plot onto. When omitted, one is built from the data. */
24
+ axes?: Axes;
25
+ /** X-axis range override as [min, max] or [min, max, step]. */
26
+ xRange?: [number, number] | [number, number, number];
27
+ /** Y-axis range override as [min, max] or [min, max, step]. */
28
+ yRange?: [number, number] | [number, number, number];
29
+ /** Visual length of the x-axis when auto-building axes. Default: 8 */
30
+ xLength?: number;
31
+ /** Visual length of the y-axis when auto-building axes. Default: 6 */
32
+ yLength?: number;
33
+ /** Color for the axes when auto-building. Default: white */
34
+ axisColor?: string;
35
+ }
36
+ /** The two mobjects that draw one series of an AreaChart. */
37
+ interface SeriesParts {
38
+ /** The filled area from the top line down to the band below. */
39
+ area: Polygon;
40
+ /** The top boundary line. */
41
+ line: Polygon;
42
+ }
43
+ /**
44
+ * AreaChart - one or more series drawn as filled areas under a line.
45
+ *
46
+ * Each series becomes a semi-transparent fill from its line down to the
47
+ * baseline, plus the line itself. When `stacked` is set, each area rests on
48
+ * the cumulative sum of the series below it.
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * const chart = new AreaChart({
53
+ * values: [[1, 3, 2, 5], [2, 1, 4, 3]],
54
+ * stacked: true,
55
+ * seriesNames: ['A', 'B'],
56
+ * });
57
+ * ```
58
+ */
59
+ export declare class AreaChart extends Group {
60
+ /** The coordinate system the areas are plotted on. */
61
+ axes: Axes;
62
+ /** The filled areas, one per series. */
63
+ areas: VGroup;
64
+ /** The top boundary lines, one per series. */
65
+ lines: VGroup;
66
+ protected _values: number[][];
67
+ protected _x: number[];
68
+ protected _stacked: boolean;
69
+ protected _baseline: number;
70
+ protected _colors: string[];
71
+ protected _fillOpacity: number;
72
+ protected _lineWidth: number;
73
+ protected _parts: SeriesParts[];
74
+ constructor(options: AreaChartOptions);
75
+ private _normalize;
76
+ /** The cumulative baseline below series `s` at point index `i`. */
77
+ private _bandBelow;
78
+ /** The top value of series `s` at point index `i`. */
79
+ private _bandTop;
80
+ private _buildAxes;
81
+ private _createSeries;
82
+ /** The coordinate system. */
83
+ getAxes(): Axes;
84
+ /** The number of series. */
85
+ getNumSeries(): number;
86
+ /** The filled area polygon of series `s`. */
87
+ getArea(s: number): Polygon | undefined;
88
+ /** The top boundary line of series `s`. */
89
+ getLine(s: number): Polygon | undefined;
90
+ /** The area and line of series `s` grouped together. */
91
+ getSeries(s: number): VGroup;
92
+ /** The data-space baseline value an unstacked area fills down to. */
93
+ getBaseline(): number;
94
+ /** The top data value of series `s` at each x (cumulative when stacked). */
95
+ getTopValues(s: number): number[];
96
+ /** The baseline data value below series `s` at each x (cumulative when stacked). */
97
+ getBottomValues(s: number): number[];
98
+ copy(): AreaChart;
99
+ }
100
+ export {};
101
+ //# sourceMappingURL=AreaChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AreaChart.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/AreaChart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MA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AI,SAAS;CAa3B"}
@@ -0,0 +1,111 @@
1
+ import { Group } from '../../core/Group';
2
+ import { VGroup } from '../../core/VGroup';
3
+ import { Rectangle } from '../geometry/Rectangle';
4
+ /** GitHub-style green contribution palette (light to dark). */
5
+ export declare const GITHUB_GREENS: readonly string[];
6
+ /** One dated value for a CalendarHeatmap. */
7
+ export interface CalendarDatum {
8
+ /** The day, as a 'YYYY-MM-DD' string or a Date. */
9
+ date: string | Date;
10
+ /** The value that colors the day. */
11
+ value: number;
12
+ }
13
+ /** The grid position of a day cell. */
14
+ export interface CellPosition {
15
+ /** Column index (week offset from the start). */
16
+ week: number;
17
+ /** Row index (0..6), the weekday within the chart's week layout. */
18
+ weekday: number;
19
+ }
20
+ /** Options for creating a CalendarHeatmap. */
21
+ export interface CalendarHeatmapOptions {
22
+ /** The dated values. */
23
+ data: CalendarDatum[];
24
+ /** First day shown. Default: the earliest date in the data. */
25
+ startDate?: string | Date;
26
+ /** Last day shown. Default: the latest date in the data. */
27
+ endDate?: string | Date;
28
+ /** Side length of a day cell. Default: 0.3 */
29
+ cellSize?: number;
30
+ /** Gap between cells. Default: 0.06 */
31
+ cellGap?: number;
32
+ /** Color palette mapped across the value domain. Default: GitHub greens */
33
+ palette?: readonly string[];
34
+ /** Value domain [min, max] mapped across the palette. Auto-computed if omitted. */
35
+ domain?: [number, number];
36
+ /** Blend the palette in perceptually-uniform Oklab space. Default: false */
37
+ useOklab?: boolean;
38
+ /** First weekday of a column: 0 = Sunday (GitHub), 1 = Monday. Default: 0 */
39
+ weekStartsOn?: 0 | 1;
40
+ /** Color for days with no datum. Default: '#ebedf0' */
41
+ emptyColor?: string;
42
+ /** Draw month labels above the grid. Default: true */
43
+ showMonthLabels?: boolean;
44
+ /** Font size for month labels. Default: 16 */
45
+ monthLabelFontSize?: number;
46
+ /** Color for labels. Default: white */
47
+ labelColor?: string;
48
+ }
49
+ /**
50
+ * CalendarHeatmap - a GitHub-style grid of day cells colored by value.
51
+ *
52
+ * Weeks run as columns and weekdays as rows. Each day is a colored square;
53
+ * days with a value are colored through the palette, and days with no datum
54
+ * take the empty color. Month labels sit above the columns where a month
55
+ * begins.
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * const cal = new CalendarHeatmap({
60
+ * data: [
61
+ * { date: '2024-01-01', value: 3 },
62
+ * { date: '2024-01-02', value: 7 },
63
+ * ],
64
+ * });
65
+ * ```
66
+ */
67
+ export declare class CalendarHeatmap extends Group {
68
+ /** The day cells. */
69
+ cells: VGroup;
70
+ /** The month labels. */
71
+ monthLabels: VGroup;
72
+ protected _cellSize: number;
73
+ protected _cellGap: number;
74
+ protected _palette: readonly string[];
75
+ protected _domain: [number, number];
76
+ protected _useOklab: boolean;
77
+ protected _weekStartsOn: 0 | 1;
78
+ protected _emptyColor: string;
79
+ protected _labelColor: string;
80
+ protected _values: Map<string, number>;
81
+ protected _startTs: number;
82
+ protected _endTs: number;
83
+ /** Cell rectangle by day key. */
84
+ protected _cellByKey: Map<string, Rectangle>;
85
+ /** Grid position by day key. */
86
+ protected _posByKey: Map<string, CellPosition>;
87
+ constructor(options: CalendarHeatmapOptions);
88
+ private _autoDomain;
89
+ /** The first column's start day, snapped back to the week's first weekday. */
90
+ private _resolveBounds;
91
+ /** The weekday row (0..6) of a day, honoring weekStartsOn. */
92
+ private _weekdayOf;
93
+ /** The grid position of a day timestamp. */
94
+ private _positionOf;
95
+ /** The cell center in local space for a grid position. */
96
+ private _centerOf;
97
+ private _createCells;
98
+ private _createMonthLabels;
99
+ /** The value domain [min, max] mapped across the palette. */
100
+ getDomain(): [number, number];
101
+ /** The number of day cells drawn. */
102
+ getNumCells(): number;
103
+ /** The cell rectangle for a date, or undefined when outside the range. */
104
+ getCell(date: string | Date): Rectangle | undefined;
105
+ /** The grid position (week, weekday) of a date. */
106
+ cellPosition(date: string | Date): CellPosition;
107
+ /** The color the map assigns to a value. */
108
+ colorForValue(value: number): string;
109
+ copy(): CalendarHeatmap;
110
+ }
111
+ //# sourceMappingURL=CalendarHeatmap.d.ts.map