manim-web 0.25.0 → 0.27.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/text/index.d.ts +2 -0
- package/dist/animation/text/index.d.ts.map +1 -0
- package/dist/animation/text/kineticTypography.d.ts +144 -0
- package/dist/animation/text/kineticTypography.d.ts.map +1 -0
- package/dist/audio/MidiInput.d.ts +159 -0
- package/dist/audio/MidiInput.d.ts.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/integrations/notebook.d.ts +117 -0
- package/dist/integrations/notebook.d.ts.map +1 -0
- package/dist/integrations/notebook.js +60 -0
- package/dist/integrations/react.js +16 -16
- package/dist/integrations/vue.js +13 -13
- package/dist/manim-web.browser.js +9638 -7586
- package/dist/mobjects/graphing/AreaChart.d.ts +101 -0
- package/dist/mobjects/graphing/AreaChart.d.ts.map +1 -0
- package/dist/mobjects/graphing/CalendarHeatmap.d.ts +111 -0
- package/dist/mobjects/graphing/CalendarHeatmap.d.ts.map +1 -0
- package/dist/mobjects/graphing/ChordDiagram.d.ts +122 -0
- package/dist/mobjects/graphing/ChordDiagram.d.ts.map +1 -0
- package/dist/mobjects/graphing/GanttChart.d.ts +179 -0
- package/dist/mobjects/graphing/GanttChart.d.ts.map +1 -0
- package/dist/mobjects/graphing/RadarChart.d.ts +135 -0
- package/dist/mobjects/graphing/RadarChart.d.ts.map +1 -0
- package/dist/mobjects/graphing/StackedBarChart.d.ts +131 -0
- package/dist/mobjects/graphing/StackedBarChart.d.ts.map +1 -0
- package/dist/mobjects/graphing/StepChart.d.ts +90 -0
- package/dist/mobjects/graphing/StepChart.d.ts.map +1 -0
- package/dist/mobjects/graphing/Treemap.d.ts +100 -0
- package/dist/mobjects/graphing/Treemap.d.ts.map +1 -0
- package/dist/mobjects/graphing/WaterfallChart.d.ts +164 -0
- package/dist/mobjects/graphing/WaterfallChart.d.ts.map +1 -0
- package/dist/mobjects/graphing/chartColors.d.ts +18 -0
- package/dist/mobjects/graphing/chartColors.d.ts.map +1 -0
- package/dist/mobjects/graphing/chordLayout.d.ts +89 -0
- package/dist/mobjects/graphing/chordLayout.d.ts.map +1 -0
- package/dist/mobjects/graphing/ganttLayout.d.ts +36 -0
- package/dist/mobjects/graphing/ganttLayout.d.ts.map +1 -0
- package/dist/mobjects/graphing/index.d.ts +12 -0
- package/dist/mobjects/graphing/index.d.ts.map +1 -1
- package/dist/mobjects/graphing/treemapLayout.d.ts +83 -0
- package/dist/mobjects/graphing/treemapLayout.d.ts.map +1 -0
- package/dist/{src-Dq6hmMfV.js → src-C3q2JQb_.js} +4054 -2002
- package/package.json +6 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default color cycle shared by the multi-series charts (stacked/grouped bars,
|
|
3
|
+
* area charts, step charts). Matches the Manim palette used by BarChart.
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_SERIES_COLORS: readonly string[];
|
|
6
|
+
/**
|
|
7
|
+
* Pick a color for series `index`, cycling through `colors`.
|
|
8
|
+
*
|
|
9
|
+
* Falls back to the default palette when `colors` is empty. A negative index
|
|
10
|
+
* wraps the same way a positive index does.
|
|
11
|
+
*/
|
|
12
|
+
export declare function cycleColor(colors: readonly string[], index: number): string;
|
|
13
|
+
/**
|
|
14
|
+
* Normalize a color option (single color or array) into a color array.
|
|
15
|
+
* An empty or missing option yields the default series palette.
|
|
16
|
+
*/
|
|
17
|
+
export declare function toColorList(colors: string | readonly string[] | undefined): string[];
|
|
18
|
+
//# sourceMappingURL=chartColors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chartColors.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/chartColors.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EASlD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAI3E;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAIpF"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chord diagram layout.
|
|
3
|
+
*
|
|
4
|
+
* The layout turns a square flow matrix into arcs around a circle (one arc per
|
|
5
|
+
* group, sized by the group's total flow) and ribbons between the arcs (one
|
|
6
|
+
* ribbon per non-zero pair of groups, sized by the flow). The functions here
|
|
7
|
+
* are pure. The {@link ChordDiagram} mobject renders the result.
|
|
8
|
+
*/
|
|
9
|
+
/** A directed flow from one group to another, used as link-list input. */
|
|
10
|
+
export interface ChordFlow {
|
|
11
|
+
/** Source group index. */
|
|
12
|
+
source: number;
|
|
13
|
+
/** Target group index. */
|
|
14
|
+
target: number;
|
|
15
|
+
/** Flow magnitude. */
|
|
16
|
+
value: number;
|
|
17
|
+
}
|
|
18
|
+
/** The arc placement for one group. */
|
|
19
|
+
export interface ChordGroupArc {
|
|
20
|
+
/** Group index. */
|
|
21
|
+
index: number;
|
|
22
|
+
/** Start angle of the arc, in radians. */
|
|
23
|
+
startAngle: number;
|
|
24
|
+
/** End angle of the arc, in radians. */
|
|
25
|
+
endAngle: number;
|
|
26
|
+
/** Total flow of the group (sum of its matrix row). */
|
|
27
|
+
value: number;
|
|
28
|
+
}
|
|
29
|
+
/** The placement of one ribbon between two groups. */
|
|
30
|
+
export interface ChordRibbonSpan {
|
|
31
|
+
/** Source group index. */
|
|
32
|
+
source: number;
|
|
33
|
+
/** Target group index. */
|
|
34
|
+
target: number;
|
|
35
|
+
/** Flow on the source side (`matrix[source][target]`). */
|
|
36
|
+
sourceValue: number;
|
|
37
|
+
/** Flow on the target side (`matrix[target][source]`). */
|
|
38
|
+
targetValue: number;
|
|
39
|
+
/** Start angle of the source span, in radians. */
|
|
40
|
+
sourceStart: number;
|
|
41
|
+
/** End angle of the source span, in radians. */
|
|
42
|
+
sourceEnd: number;
|
|
43
|
+
/** Start angle of the target span, in radians. */
|
|
44
|
+
targetStart: number;
|
|
45
|
+
/** End angle of the target span, in radians. */
|
|
46
|
+
targetEnd: number;
|
|
47
|
+
}
|
|
48
|
+
/** The full chord layout. */
|
|
49
|
+
export interface ChordLayout {
|
|
50
|
+
/** One arc per group, in group order. */
|
|
51
|
+
groups: ChordGroupArc[];
|
|
52
|
+
/** One ribbon per non-zero flow pair. */
|
|
53
|
+
ribbons: ChordRibbonSpan[];
|
|
54
|
+
/** Sum of all matrix entries. */
|
|
55
|
+
total: number;
|
|
56
|
+
}
|
|
57
|
+
/** Tunable angles for {@link computeChordLayout}. */
|
|
58
|
+
export interface ChordLayoutOptions {
|
|
59
|
+
/** Angular gap between adjacent groups, in radians. Default: 0.05. */
|
|
60
|
+
gap?: number;
|
|
61
|
+
/** Angle of the first group's start edge, in radians. Default: Math.PI / 2. */
|
|
62
|
+
startAngle?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Build a square, non-negative matrix from a link list.
|
|
66
|
+
*
|
|
67
|
+
* @param flows - Directed flows between group indices.
|
|
68
|
+
* @param groupCount - Number of groups (matrix size).
|
|
69
|
+
* @returns A `groupCount x groupCount` matrix of non-negative flows.
|
|
70
|
+
*/
|
|
71
|
+
export declare function chordMatrixFromFlows(flows: ChordFlow[], groupCount: number): number[][];
|
|
72
|
+
/**
|
|
73
|
+
* Compute the arcs and ribbons of a chord diagram.
|
|
74
|
+
*
|
|
75
|
+
* Group `i`'s arc angle is proportional to the sum of row `i`. The cell
|
|
76
|
+
* `matrix[i][j]` is a sub-span on arc `i`; a ribbon joins the span `(i, j)` on
|
|
77
|
+
* arc `i` to the span `(j, i)` on arc `j`. One ribbon is produced per unordered
|
|
78
|
+
* pair whose combined flow is positive, including a self-ribbon when the
|
|
79
|
+
* diagonal is positive.
|
|
80
|
+
*
|
|
81
|
+
* The function never throws. An empty matrix returns empty arrays, and an
|
|
82
|
+
* all-zero matrix returns zero-angle arcs and no ribbons.
|
|
83
|
+
*
|
|
84
|
+
* @param matrix - The square flow matrix.
|
|
85
|
+
* @param options - Gap and start angle.
|
|
86
|
+
* @returns The computed layout.
|
|
87
|
+
*/
|
|
88
|
+
export declare function computeChordLayout(matrix: number[][], options?: ChordLayoutOptions): ChordLayout;
|
|
89
|
+
//# sourceMappingURL=chordLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chordLayout.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/chordLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,0EAA0E;AAC1E,MAAM,WAAW,SAAS;IACxB,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,uCAAuC;AACvC,MAAM,WAAW,aAAa;IAC5B,mBAAmB;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,sDAAsD;AACtD,MAAM,WAAW,eAAe;IAC9B,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,WAAW,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,WAAW,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,6BAA6B;AAC7B,MAAM,WAAW,WAAW;IAC1B,yCAAyC;IACzC,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,yCAAyC;IACzC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qDAAqD;AACrD,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAUvF;AAcD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EAAE,EAAE,EAClB,OAAO,GAAE,kBAAuB,GAC/B,WAAW,CAuDb"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { GanttTask, GanttTimeValue } from './GanttChart';
|
|
2
|
+
/** One resolved task, ready to render. */
|
|
3
|
+
export interface GanttTaskSpec {
|
|
4
|
+
/** Task name. */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Start time as a number. */
|
|
7
|
+
startValue: number;
|
|
8
|
+
/** End time as a number. */
|
|
9
|
+
endValue: number;
|
|
10
|
+
/** Index of the row the task sits on. */
|
|
11
|
+
rowIndex: number;
|
|
12
|
+
/** Resolved bar color. */
|
|
13
|
+
color: string;
|
|
14
|
+
/** Names of the tasks this task depends on. */
|
|
15
|
+
dependencies: string[];
|
|
16
|
+
}
|
|
17
|
+
/** The resolved specs plus the distinct row keys, in row order. */
|
|
18
|
+
export interface GanttLayout {
|
|
19
|
+
/** One spec per task, in task order. */
|
|
20
|
+
specs: GanttTaskSpec[];
|
|
21
|
+
/** Distinct row keys, in first-appearance (top-to-bottom) order. */
|
|
22
|
+
rowKeys: string[];
|
|
23
|
+
}
|
|
24
|
+
/** Read a time value as a number. A Date is read through getTime(). */
|
|
25
|
+
export declare function toTimeNumber(value: GanttTimeValue): number;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve tasks into render specs and the ordered list of rows.
|
|
28
|
+
*
|
|
29
|
+
* The row key of a task is its `row`, or its name when `row` is absent, so a
|
|
30
|
+
* task without a row key gets its own row. Colors come from the task's own
|
|
31
|
+
* color, or the palette cycled by row index.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveGanttLayout(tasks: GanttTask[], palette: string[]): GanttLayout;
|
|
34
|
+
/** Time range as [min start, max end] across all specs. */
|
|
35
|
+
export declare function ganttTimeRange(specs: GanttTaskSpec[]): [number, number];
|
|
36
|
+
//# sourceMappingURL=ganttLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ganttLayout.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/ganttLayout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9D,0CAA0C;AAC1C,MAAM,WAAW,aAAa;IAC5B,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,mEAAmE;AACnE,MAAM,WAAW,WAAW;IAC1B,wCAAwC;IACxC,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,oEAAoE;IACpE,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAE1D;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,WAAW,CAwBrF;AAED,2DAA2D;AAC3D,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAWvE"}
|
|
@@ -25,8 +25,20 @@ export { FourierSeries, type FourierSeriesOptions } from './FourierSeries';
|
|
|
25
25
|
export { ComplexPlane, type ComplexPlaneOptions, type Complex } from './ComplexPlane';
|
|
26
26
|
export { PolarPlane, type PolarPlaneOptions } from './ComplexPlane';
|
|
27
27
|
export { BarChart, type BarChartOptions } from './BarChart';
|
|
28
|
+
export { DEFAULT_SERIES_COLORS, cycleColor, toColorList } from './chartColors';
|
|
29
|
+
export { StackedBarChart, type StackedBarChartOptions, type BarChartMode } from './StackedBarChart';
|
|
30
|
+
export { AreaChart, type AreaChartOptions } from './AreaChart';
|
|
31
|
+
export { StepChart, type StepChartOptions, type StepMode } from './StepChart';
|
|
32
|
+
export { CalendarHeatmap, GITHUB_GREENS, type CalendarHeatmapOptions, type CalendarDatum, type CellPosition, } from './CalendarHeatmap';
|
|
28
33
|
export { CandlestickChart, type CandlestickChartOptions, type OHLC } from './CandlestickChart';
|
|
34
|
+
export { RadarChart, type RadarChartOptions } from './RadarChart';
|
|
35
|
+
export { WaterfallChart, type WaterfallChartOptions } from './WaterfallChart';
|
|
36
|
+
export { GanttChart, type GanttChartOptions, type GanttTask, type GanttTimeValue, } from './GanttChart';
|
|
29
37
|
export { PieChart, type PieChartOptions, DonutChart, type DonutChartOptions, computeSliceGeometry, type SliceGeometry, type LabelPosition, } from './PieChart';
|
|
38
|
+
export { Treemap, type TreemapOptions, type TreemapColorBy } from './Treemap';
|
|
39
|
+
export { computeTreemapLayout, squarify, treemapNodeValue, type TreemapNode, type TreemapRect, type TreemapTile, } from './treemapLayout';
|
|
40
|
+
export { ChordDiagram, ChordArc, ChordRibbon, type ChordDiagramOptions } from './ChordDiagram';
|
|
41
|
+
export { computeChordLayout, chordMatrixFromFlows, type ChordFlow, type ChordGroupArc, type ChordRibbonSpan, type ChordLayout, type ChordLayoutOptions, } from './chordLayout';
|
|
30
42
|
export { mean, stdDev, quantile, iqr, histogramBins, kde, silvermanBandwidth, boxSummary, extent, niceAxisRange, type HistogramBin, type HistogramBinsOptions, type KdeOptions, type BoxSummary, } from './stats';
|
|
31
43
|
export { Histogram, type HistogramOptions } from './Histogram';
|
|
32
44
|
export { ScatterPlot, type ScatterPlotOptions } from './ScatterPlot';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,UAAU,EACV,KAAK,iBAAiB,EACtB,YAAY,EACZ,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGhD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGtF,OAAO,EAAE,KAAK,2BAA2B,EAAE,KAAK,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAGjG,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAG/F,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAG3E,OAAO,EAAE,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGpF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EA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B,EACvB,KAAK,uBAAuB,GAC7B,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Squarified treemap layout.
|
|
3
|
+
*
|
|
4
|
+
* The layout maps a value hierarchy to nested rectangles. A node's area is
|
|
5
|
+
* proportional to its value, and the children of a node tile the node's
|
|
6
|
+
* rectangle without gaps or overlap. The squarify strategy keeps each tile's
|
|
7
|
+
* aspect ratio near 1.
|
|
8
|
+
*
|
|
9
|
+
* The functions here are pure. The {@link Treemap} mobject renders the result.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* One node in the input hierarchy.
|
|
13
|
+
*
|
|
14
|
+
* A leaf sets `value`. An internal node sets `children`; its value is the sum
|
|
15
|
+
* of its children, so an explicit `value` on an internal node is ignored.
|
|
16
|
+
* Negative values are clamped to 0, because an area cannot be negative.
|
|
17
|
+
*/
|
|
18
|
+
export interface TreemapNode {
|
|
19
|
+
/** Display name of the node. */
|
|
20
|
+
name: string;
|
|
21
|
+
/** Value of a leaf node. Ignored when `children` is present. */
|
|
22
|
+
value?: number;
|
|
23
|
+
/** Child nodes. Present on internal nodes. */
|
|
24
|
+
children?: TreemapNode[];
|
|
25
|
+
}
|
|
26
|
+
/** An axis-aligned rectangle. `(x, y)` is the lower-left (minimum) corner. */
|
|
27
|
+
export interface TreemapRect {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
}
|
|
33
|
+
/** The computed placement of one node in the hierarchy. */
|
|
34
|
+
export interface TreemapTile {
|
|
35
|
+
/** Index path from the root. The root itself has an empty path. */
|
|
36
|
+
path: number[];
|
|
37
|
+
/** Node name. */
|
|
38
|
+
name: string;
|
|
39
|
+
/** Resolved value (sum of descendants for an internal node). */
|
|
40
|
+
value: number;
|
|
41
|
+
/** Depth in the tree. The root is depth 0. */
|
|
42
|
+
depth: number;
|
|
43
|
+
/** The node's rectangle. */
|
|
44
|
+
rect: TreemapRect;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Resolve the value of a node.
|
|
48
|
+
*
|
|
49
|
+
* A leaf returns its own value, clamped to be non-negative. An internal node
|
|
50
|
+
* returns the sum of its children's resolved values.
|
|
51
|
+
*
|
|
52
|
+
* @param node - The node to measure.
|
|
53
|
+
* @returns The non-negative value of the node.
|
|
54
|
+
*/
|
|
55
|
+
export declare function treemapNodeValue(node: TreemapNode): number;
|
|
56
|
+
/**
|
|
57
|
+
* Partition `region` into one rectangle per area, in input order.
|
|
58
|
+
*
|
|
59
|
+
* The areas must already be scaled so their sum equals the region area. The
|
|
60
|
+
* result tiles the region exactly (no gaps, no overlap) when the areas are
|
|
61
|
+
* positive. A zero area yields a zero-size rectangle at the current corner.
|
|
62
|
+
*
|
|
63
|
+
* @param areas - Target areas, best supplied in descending order.
|
|
64
|
+
* @param region - The rectangle to fill.
|
|
65
|
+
* @returns One rectangle per area, aligned to the `areas` index.
|
|
66
|
+
*/
|
|
67
|
+
export declare function squarify(areas: number[], region: TreemapRect): TreemapRect[];
|
|
68
|
+
/**
|
|
69
|
+
* Compute the full treemap layout for a hierarchy.
|
|
70
|
+
*
|
|
71
|
+
* The root fills `region`. Each internal node's children tile the node's
|
|
72
|
+
* rectangle, inset by `padding` so a parent border stays visible. With
|
|
73
|
+
* `padding` 0 the leaves partition the region exactly.
|
|
74
|
+
*
|
|
75
|
+
* The function never throws. An empty hierarchy still returns the root tile.
|
|
76
|
+
*
|
|
77
|
+
* @param root - The root node.
|
|
78
|
+
* @param region - The rectangle the root fills.
|
|
79
|
+
* @param padding - Inset applied before laying out each node's children.
|
|
80
|
+
* @returns Tiles in pre-order (root first), one per node.
|
|
81
|
+
*/
|
|
82
|
+
export declare function computeTreemapLayout(root: TreemapNode, region: TreemapRect, padding?: number): TreemapTile[];
|
|
83
|
+
//# sourceMappingURL=treemapLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"treemapLayout.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graphing/treemapLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;CAC1B;AAED,8EAA8E;AAC9E,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,2DAA2D;AAC3D,MAAM,WAAW,WAAW;IAC1B,mEAAmE;IACnE,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,IAAI,EAAE,WAAW,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAK1D;AAgCD;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,WAAW,GAAG,WAAW,EAAE,CA8C5E;AAqDD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,WAAW,EACnB,OAAO,SAAI,GACV,WAAW,EAAE,CAOf"}
|