@motionscript/charts 0.1.0-alpha.5 → 0.1.0-alpha.7
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/CHANGELOG.md +40 -0
- package/README.md +30 -16
- package/dist/bar-chart/bar-chart.d.ts +133 -242
- package/dist/bar-chart/bar-chart.d.ts.map +1 -1
- package/dist/bar-chart/bar-chart.js +378 -569
- package/dist/bar-chart/bar-chart.js.map +1 -1
- package/dist/bar-chart/category-axis.d.ts +35 -41
- package/dist/bar-chart/category-axis.d.ts.map +1 -1
- package/dist/bar-chart/category-axis.js +93 -115
- package/dist/bar-chart/category-axis.js.map +1 -1
- package/dist/bar-chart/chart-bars.d.ts +50 -70
- package/dist/bar-chart/chart-bars.d.ts.map +1 -1
- package/dist/bar-chart/chart-bars.js +156 -210
- package/dist/bar-chart/chart-bars.js.map +1 -1
- package/dist/bar-chart/index.d.ts +2 -2
- package/dist/bar-chart/index.d.ts.map +1 -1
- package/dist/bar-chart/index.js +1 -1
- package/dist/bar-chart/index.js.map +1 -1
- package/dist/bar-chart/shared.d.ts +3 -3
- package/dist/bar-chart/shared.d.ts.map +1 -1
- package/dist/bar-chart/shared.js +3 -3
- package/dist/bar-chart/shared.js.map +1 -1
- package/dist/browser/chunks/chunk-XROBIRQK.js +2 -0
- package/dist/browser/chunks/chunk-XROBIRQK.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/browser/kit.js +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/engine.d.ts +8 -6
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +8 -6
- package/dist/engine.js.map +1 -1
- package/dist/kit/cartesian.d.ts +44 -0
- package/dist/kit/cartesian.d.ts.map +1 -0
- package/dist/kit/cartesian.js +59 -0
- package/dist/kit/cartesian.js.map +1 -0
- package/dist/kit/chart-border.d.ts +10 -11
- package/dist/kit/chart-border.d.ts.map +1 -1
- package/dist/kit/chart-border.js +15 -32
- package/dist/kit/chart-border.js.map +1 -1
- package/dist/kit/chart-canvas.d.ts +32 -21
- package/dist/kit/chart-canvas.d.ts.map +1 -1
- package/dist/kit/chart-canvas.js +33 -90
- package/dist/kit/chart-canvas.js.map +1 -1
- package/dist/kit/chart-legend.d.ts +123 -64
- package/dist/kit/chart-legend.d.ts.map +1 -1
- package/dist/kit/chart-legend.js +129 -154
- package/dist/kit/chart-legend.js.map +1 -1
- package/dist/kit/entries.d.ts +17 -0
- package/dist/kit/entries.d.ts.map +1 -0
- package/dist/kit/entries.js +19 -0
- package/dist/kit/entries.js.map +1 -0
- package/dist/kit/motion.d.ts +48 -0
- package/dist/kit/motion.d.ts.map +1 -0
- package/dist/kit/motion.js +63 -0
- package/dist/kit/motion.js.map +1 -0
- package/dist/kit/paints.d.ts +10 -0
- package/dist/kit/paints.d.ts.map +1 -0
- package/dist/kit/paints.js +12 -0
- package/dist/kit/paints.js.map +1 -0
- package/dist/kit/shared.d.ts +31 -3
- package/dist/kit/shared.d.ts.map +1 -1
- package/dist/kit/shared.js +42 -3
- package/dist/kit/shared.js.map +1 -1
- package/dist/kit/vertical-axis.d.ts +48 -61
- package/dist/kit/vertical-axis.d.ts.map +1 -1
- package/dist/kit/vertical-axis.js +97 -132
- package/dist/kit/vertical-axis.js.map +1 -1
- package/dist/line-chart/chart-line.d.ts +60 -77
- package/dist/line-chart/chart-line.d.ts.map +1 -1
- package/dist/line-chart/chart-line.js +100 -121
- package/dist/line-chart/chart-line.js.map +1 -1
- package/dist/line-chart/chart-region.d.ts +32 -33
- package/dist/line-chart/chart-region.d.ts.map +1 -1
- package/dist/line-chart/chart-region.js +31 -65
- package/dist/line-chart/chart-region.js.map +1 -1
- package/dist/line-chart/horizontal-axis.d.ts +58 -64
- package/dist/line-chart/horizontal-axis.d.ts.map +1 -1
- package/dist/line-chart/horizontal-axis.js +94 -123
- package/dist/line-chart/horizontal-axis.js.map +1 -1
- package/dist/line-chart/index.d.ts +2 -2
- package/dist/line-chart/index.d.ts.map +1 -1
- package/dist/line-chart/index.js +1 -1
- package/dist/line-chart/index.js.map +1 -1
- package/dist/line-chart/line-chart.d.ts +156 -319
- package/dist/line-chart/line-chart.d.ts.map +1 -1
- package/dist/line-chart/line-chart.js +403 -663
- package/dist/line-chart/line-chart.js.map +1 -1
- package/dist/line-chart/shared.d.ts +3 -3
- package/dist/line-chart/shared.d.ts.map +1 -1
- package/dist/line-chart/shared.js +3 -3
- package/dist/line-chart/shared.js.map +1 -1
- package/dist/nodes.d.ts +6 -9
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js +7 -9
- package/dist/nodes.js.map +1 -1
- package/dist/pie-chart/index.d.ts +2 -2
- package/dist/pie-chart/index.d.ts.map +1 -1
- package/dist/pie-chart/index.js +1 -1
- package/dist/pie-chart/index.js.map +1 -1
- package/dist/pie-chart/pie-chart.d.ts +108 -132
- package/dist/pie-chart/pie-chart.d.ts.map +1 -1
- package/dist/pie-chart/pie-chart.js +200 -271
- package/dist/pie-chart/pie-chart.js.map +1 -1
- package/dist/pie-chart/pie-legend.d.ts +84 -31
- package/dist/pie-chart/pie-legend.d.ts.map +1 -1
- package/dist/pie-chart/pie-legend.js +93 -107
- package/dist/pie-chart/pie-legend.js.map +1 -1
- package/dist/pie-chart/pie-ring.d.ts +160 -131
- package/dist/pie-chart/pie-ring.d.ts.map +1 -1
- package/dist/pie-chart/pie-ring.js +333 -391
- package/dist/pie-chart/pie-ring.js.map +1 -1
- package/dist/pie-chart/shared.d.ts +2 -2
- package/dist/pie-chart/shared.d.ts.map +1 -1
- package/dist/pie-chart/shared.js +2 -2
- package/dist/pie-chart/shared.js.map +1 -1
- package/package.json +4 -4
- package/src/bar-chart/bar-chart.ts +415 -701
- package/src/bar-chart/category-axis.ts +95 -110
- package/src/bar-chart/chart-bars.ts +178 -200
- package/src/bar-chart/index.ts +2 -2
- package/src/bar-chart/shared.ts +3 -3
- package/src/engine.ts +8 -6
- package/src/kit/cartesian.ts +81 -0
- package/src/kit/chart-border.ts +22 -33
- package/src/kit/chart-canvas.ts +44 -79
- package/src/kit/chart-legend.ts +173 -189
- package/src/kit/entries.ts +20 -0
- package/src/kit/motion.ts +90 -0
- package/src/kit/paints.ts +15 -0
- package/src/kit/shared.ts +52 -3
- package/src/kit/vertical-axis.ts +110 -140
- package/src/line-chart/chart-line.ts +102 -154
- package/src/line-chart/chart-region.ts +35 -80
- package/src/line-chart/horizontal-axis.ts +101 -152
- package/src/line-chart/index.ts +2 -2
- package/src/line-chart/line-chart.ts +449 -825
- package/src/line-chart/shared.ts +3 -3
- package/src/nodes.ts +8 -10
- package/src/pie-chart/index.ts +2 -2
- package/src/pie-chart/pie-chart.ts +221 -311
- package/src/pie-chart/pie-legend.ts +124 -114
- package/src/pie-chart/pie-ring.ts +386 -473
- package/src/pie-chart/shared.ts +2 -2
- package/dist/browser/chunks/chunk-5ZPBV6BU.js +0 -2
- package/dist/browser/chunks/chunk-5ZPBV6BU.js.map +0 -7
|
@@ -1,21 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type NodeOf, type Node2D } from "@motionscript/sdk";
|
|
2
|
+
import { type Arrival } from "../kit/motion.js";
|
|
2
3
|
import { type AxisConfig, type Range } from "../kit/shared.js";
|
|
3
|
-
import { type Seekable } from "@motionscript/sdk/component";
|
|
4
|
-
export interface HorizontalAxisProps extends Node2DProps {
|
|
5
|
-
/** `[min, max]` of the horizontal scale the markers are positioned within. */
|
|
6
|
-
range: Range;
|
|
7
|
-
/** Tick values (in data units) to draw along the axis. */
|
|
8
|
-
markers: number[];
|
|
9
|
-
/** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */
|
|
10
|
-
axis: AxisConfig;
|
|
11
|
-
/**
|
|
12
|
-
* Caption drawn centred in the gutter beneath the marker row. Empty string
|
|
13
|
-
* (the default) hides it.
|
|
14
|
-
*/
|
|
15
|
-
label: string;
|
|
16
|
-
}
|
|
17
|
-
/** How a tick value is captioned — see {@link HorizontalAxis.labelFor}. */
|
|
18
|
-
export type MarkerLabel = (value: number) => string;
|
|
19
4
|
/**
|
|
20
5
|
* The horizontal axis of a {@link LineChart}: a **row of {@link Text} nodes**,
|
|
21
6
|
* one per marker value, running left-to-right. Pure layout — the mirror of the
|
|
@@ -26,60 +11,69 @@ export type MarkerLabel = (value: number) => string;
|
|
|
26
11
|
* `2026-03` sits three months along, not three slots along. That is what keeps
|
|
27
12
|
* it distinct from a bar chart's bottom axis, which centres a caption on each
|
|
28
13
|
* slot and has no scale at all — the two only look alike. What the values are
|
|
29
|
-
* captioned *as* is the chart's to decide
|
|
14
|
+
* captioned *as* is the chart's to decide, in `captions`.
|
|
30
15
|
*
|
|
31
|
-
*
|
|
16
|
+
* `enter` staggers the markers in **left-to-right**: each starts lifted a
|
|
32
17
|
* little above its slot and transparent, then fades and slides down into place.
|
|
33
18
|
*/
|
|
34
|
-
export declare
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
axis
|
|
38
|
-
|
|
19
|
+
export declare const HorizontalAxis: import("@motionscript/sdk").Component<"horizontalAxis", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
20
|
+
/** `[min, max]` of the horizontal scale the markers are positioned within. */
|
|
21
|
+
readonly range: import("@motionscript/sdk").Type<Range, Range, false>;
|
|
22
|
+
/** Tick values (in data units) to draw along the axis. */
|
|
23
|
+
readonly markers: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
39
24
|
/**
|
|
40
|
-
* How
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* A plain field rather than a `@property`, because it is a **policy, not a
|
|
45
|
-
* value**: there is nothing to tween between two formatters, and a signal
|
|
46
|
-
* holding a function is a signal every `set`/`to` on this node would have to
|
|
47
|
-
* know not to touch. Read inside each marker's `text` binding, so replacing it
|
|
48
|
-
* before the first frame is enough — which is when the chart does it.
|
|
25
|
+
* How each marker is captioned, one per entry of `markers` and in its order.
|
|
26
|
+
* Empty (the default), or short, captions a marker with its bare numeric
|
|
27
|
+
* reading; a chart whose x column names months or categories writes those.
|
|
49
28
|
*/
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
29
|
+
readonly captions: import("@motionscript/sdk").Type<string[], string[], false>;
|
|
30
|
+
/** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */
|
|
31
|
+
readonly axis: import("@motionscript/sdk").Type<AxisConfig, AxisConfig, false>;
|
|
32
|
+
/** Caption drawn centred in the gutter beneath the marker row; empty (the default) hides it. */
|
|
33
|
+
readonly label: "";
|
|
34
|
+
readonly arrivals: import("@motionscript/sdk").Type<Readonly<Record<string, Arrival>>, Readonly<Record<string, Arrival>>, false>;
|
|
35
|
+
}>, {
|
|
36
|
+
readonly enter: {
|
|
37
|
+
readonly stagger: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
38
|
+
readonly slide: import("@motionscript/sdk").Type<number, number, false>;
|
|
39
|
+
};
|
|
40
|
+
}, null, Node2D<import("@motionscript/core").Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
41
|
+
/** `[min, max]` of the horizontal scale the markers are positioned within. */
|
|
42
|
+
readonly range: import("@motionscript/sdk").Type<Range, Range, false>;
|
|
43
|
+
/** Tick values (in data units) to draw along the axis. */
|
|
44
|
+
readonly markers: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
61
45
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
46
|
+
* How each marker is captioned, one per entry of `markers` and in its order.
|
|
47
|
+
* Empty (the default), or short, captions a marker with its bare numeric
|
|
48
|
+
* reading; a chart whose x column names months or categories writes those.
|
|
64
49
|
*/
|
|
65
|
-
|
|
50
|
+
readonly captions: import("@motionscript/sdk").Type<string[], string[], false>;
|
|
51
|
+
/** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */
|
|
52
|
+
readonly axis: import("@motionscript/sdk").Type<AxisConfig, AxisConfig, false>;
|
|
53
|
+
/** Caption drawn centred in the gutter beneath the marker row; empty (the default) hides it. */
|
|
54
|
+
readonly label: "";
|
|
55
|
+
readonly arrivals: import("@motionscript/sdk").Type<Readonly<Record<string, Arrival>>, Readonly<Record<string, Arrival>>, false>;
|
|
56
|
+
}>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
57
|
+
/** `[min, max]` of the horizontal scale the markers are positioned within. */
|
|
58
|
+
readonly range: import("@motionscript/sdk").Type<Range, Range, false>;
|
|
59
|
+
/** Tick values (in data units) to draw along the axis. */
|
|
60
|
+
readonly markers: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
66
61
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* `i * step` per marker — but expressed as `wait` inside a generator they only
|
|
71
|
-
* existed while it ran, so knowing what the axis looked like partway through
|
|
72
|
-
* meant running it from zero. Placed explicitly, the same stagger can be asked
|
|
73
|
-
* for a time, which is what lets a chart scene scrub in constant time.
|
|
74
|
-
*
|
|
75
|
-
* `duration` is the **whole** entrance — see {@link VerticalAxis.enter} and
|
|
76
|
-
* {@link enterBudget}.
|
|
62
|
+
* How each marker is captioned, one per entry of `markers` and in its order.
|
|
63
|
+
* Empty (the default), or short, captions a marker with its bare numeric
|
|
64
|
+
* reading; a chart whose x column names months or categories writes those.
|
|
77
65
|
*/
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
66
|
+
readonly captions: import("@motionscript/sdk").Type<string[], string[], false>;
|
|
67
|
+
/** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */
|
|
68
|
+
readonly axis: import("@motionscript/sdk").Type<AxisConfig, AxisConfig, false>;
|
|
69
|
+
/** Caption drawn centred in the gutter beneath the marker row; empty (the default) hides it. */
|
|
70
|
+
readonly label: "";
|
|
71
|
+
readonly arrivals: import("@motionscript/sdk").Type<Readonly<Record<string, Arrival>>, Readonly<Record<string, Arrival>>, false>;
|
|
72
|
+
}>, {
|
|
73
|
+
readonly enter: {
|
|
74
|
+
readonly stagger: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
75
|
+
readonly slide: import("@motionscript/sdk").Type<number, number, false>;
|
|
76
|
+
};
|
|
77
|
+
}, Node2D<import("@motionscript/core").Node2DProps>>>>;
|
|
78
|
+
export type HorizontalAxis = NodeOf<typeof HorizontalAxis>;
|
|
85
79
|
//# sourceMappingURL=horizontal-axis.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"horizontal-axis.d.ts","sourceRoot":"","sources":["../../src/line-chart/horizontal-axis.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"horizontal-axis.d.ts","sourceRoot":"","sources":["../../src/line-chart/horizontal-axis.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,MAAM,EACX,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAA8D,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AAMvB;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc;IAGvB,8EAA8E;;IAE9E,0DAA0D;;IAE1D;;;;OAIG;;IAEH,oFAAoF;;IAEpF,gGAAgG;;;;;;;;;IAZhG,8EAA8E;;IAE9E,0DAA0D;;IAE1D;;;;OAIG;;IAEH,oFAAoF;;IAEpF,gGAAgG;;;;IAZhG,8EAA8E;;IAE9E,0DAA0D;;IAE1D;;;;OAIG;;IAEH,oFAAoF;;IAEpF,gGAAgG;;;;;;;;sDA8FlG,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
import { command, Node2D, Rect, Text, easeOut, property, insetsOps, textOps, } from "@motionscript/sdk";
|
|
8
|
-
import { DEFAULT_X_AXIS, enterBudget, formatMarker, } from "../kit/shared.js";
|
|
9
|
-
import { at, compose } from "@motionscript/sdk/component";
|
|
1
|
+
import { Rect, Text, Types, component2d, insetsOps, textOps, } from "@motionscript/sdk";
|
|
2
|
+
import { asParts, fresh } from "../kit/entries.js";
|
|
3
|
+
import { armed, arrival, arrivalOf, arrivalsEntry, beats, frameEase } from "../kit/motion.js";
|
|
4
|
+
import { DEFAULT_X_AXIS, enterBudget, } from "../kit/shared.js";
|
|
5
|
+
import { markerCaption } from "../kit/vertical-axis.js";
|
|
10
6
|
/** How far a marker starts above its slot when it enters, in px. */
|
|
11
7
|
const SLIDE = 24;
|
|
12
8
|
/**
|
|
@@ -19,57 +15,57 @@ const SLIDE = 24;
|
|
|
19
15
|
* `2026-03` sits three months along, not three slots along. That is what keeps
|
|
20
16
|
* it distinct from a bar chart's bottom axis, which centres a caption on each
|
|
21
17
|
* slot and has no scale at all — the two only look alike. What the values are
|
|
22
|
-
* captioned *as* is the chart's to decide
|
|
18
|
+
* captioned *as* is the chart's to decide, in `captions`.
|
|
23
19
|
*
|
|
24
|
-
*
|
|
20
|
+
* `enter` staggers the markers in **left-to-right**: each starts lifted a
|
|
25
21
|
* little above its slot and transparent, then fades and slides down into place.
|
|
26
22
|
*/
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
23
|
+
export const HorizontalAxis = component2d({
|
|
24
|
+
key: "horizontalAxis",
|
|
25
|
+
state: {
|
|
26
|
+
/** `[min, max]` of the horizontal scale the markers are positioned within. */
|
|
27
|
+
range: fresh(() => [0, 1]),
|
|
28
|
+
/** Tick values (in data units) to draw along the axis. */
|
|
29
|
+
markers: fresh(() => []),
|
|
30
|
+
/**
|
|
31
|
+
* How each marker is captioned, one per entry of `markers` and in its order.
|
|
32
|
+
* Empty (the default), or short, captions a marker with its bare numeric
|
|
33
|
+
* reading; a chart whose x column names months or categories writes those.
|
|
34
|
+
*/
|
|
35
|
+
captions: fresh(() => []),
|
|
36
|
+
/** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */
|
|
37
|
+
axis: Types.custom(DEFAULT_X_AXIS),
|
|
38
|
+
/** Caption drawn centred in the gutter beneath the marker row; empty (the default) hides it. */
|
|
39
|
+
label: "",
|
|
40
|
+
arrivals: arrivalsEntry(),
|
|
41
|
+
},
|
|
42
|
+
// A plain node filled its parent; one made of its markers would hug them.
|
|
43
|
+
defaults: { width: "fill", height: "fill" },
|
|
44
|
+
children: (state) => {
|
|
45
|
+
const tickPad = insetsOps.resolve(state.axis.tickPadding).top;
|
|
46
|
+
const titlePad = insetsOps.resolve(state.axis.titlePadding).top;
|
|
47
|
+
const column = [];
|
|
48
|
+
// The column's parent is the axis: its box is what the markers are placed in.
|
|
49
|
+
const box = () => column[0]?.parent?.layoutBounds ?? { width: 0, height: 0 };
|
|
50
|
+
/** The live tick values, left → right — re-read every frame, not snapshotted. */
|
|
51
|
+
const sorted = () => [...state.markers].sort((a, b) => a - b);
|
|
52
|
+
/** Tick `i`'s fraction across the live `range`, 0 at the left edge. */
|
|
53
|
+
const fracAt = (value) => {
|
|
54
|
+
if (value === undefined)
|
|
55
|
+
return 0;
|
|
56
|
+
const [min, max] = state.range;
|
|
57
|
+
return max <= min ? 0 : (value - min) / (max - min);
|
|
58
|
+
};
|
|
59
|
+
const markers = state.markers.map((_, i) => {
|
|
64
60
|
const marker = new Text({
|
|
65
|
-
...textOps.styleProps(
|
|
61
|
+
...textOps.styleProps(state.axis.labelStyle),
|
|
66
62
|
text: () => {
|
|
67
|
-
const
|
|
68
|
-
return
|
|
63
|
+
const value = sorted()[i];
|
|
64
|
+
return value === undefined ? "" : markerCaption(state, value);
|
|
69
65
|
},
|
|
70
66
|
x: () => {
|
|
71
|
-
const width =
|
|
72
|
-
const centred = (
|
|
67
|
+
const width = box().width;
|
|
68
|
+
const centred = (fracAt(sorted()[i]) - 0.5) * width;
|
|
73
69
|
// Held inside the axis's right edge, which is also the *chart's*: the
|
|
74
70
|
// last marker is centred on the last grid line, so half of `2026-06`
|
|
75
71
|
// — or of `3300` — would be drawn outside the node's box and outside
|
|
@@ -79,80 +75,55 @@ export class HorizontalAxis extends Node2D {
|
|
|
79
75
|
const limit = width / 2 - marker.layoutBounds.width / 2;
|
|
80
76
|
return Math.min(centred, limit);
|
|
81
77
|
},
|
|
78
|
+
opacity: () => arrivalOf(state.arrivals, i).opacity,
|
|
79
|
+
y: () => arrivalOf(state.arrivals, i).shift,
|
|
82
80
|
});
|
|
83
81
|
return marker;
|
|
84
82
|
});
|
|
85
83
|
const children = [
|
|
86
|
-
new Rect({
|
|
87
|
-
width: "fill",
|
|
88
|
-
height: "hug",
|
|
89
|
-
padding: { top: tickPad },
|
|
90
|
-
children: this.markerNodes,
|
|
91
|
-
}),
|
|
84
|
+
new Rect({ width: "fill", height: "hug", padding: { top: tickPad }, children: markers }),
|
|
92
85
|
];
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
...textOps.styleProps(
|
|
96
|
-
text:
|
|
97
|
-
|
|
98
|
-
|
|
86
|
+
if (state.label !== "") {
|
|
87
|
+
children.push(new Text({
|
|
88
|
+
...textOps.styleProps(state.axis.titleStyle),
|
|
89
|
+
text: state.label,
|
|
90
|
+
opacity: () => arrivalOf(state.arrivals, "label").opacity,
|
|
91
|
+
y: () => arrivalOf(state.arrivals, "label").shift,
|
|
92
|
+
}));
|
|
99
93
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return compose([
|
|
136
|
-
...markers,
|
|
137
|
-
...(this.labelNode
|
|
138
|
-
? [at(lastMarkerEnds, this.labelNode.to({ data: { opacity: 1, y: 0 }, duration: caption, easing }))]
|
|
139
|
-
: []),
|
|
140
|
-
]);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
__decorate([
|
|
144
|
-
property({ default: () => [0, 1] })
|
|
145
|
-
], HorizontalAxis.prototype, "range", void 0);
|
|
146
|
-
__decorate([
|
|
147
|
-
property({ default: () => [] })
|
|
148
|
-
], HorizontalAxis.prototype, "markers", void 0);
|
|
149
|
-
__decorate([
|
|
150
|
-
property({ default: DEFAULT_X_AXIS })
|
|
151
|
-
], HorizontalAxis.prototype, "axis", void 0);
|
|
152
|
-
__decorate([
|
|
153
|
-
property({ default: "" })
|
|
154
|
-
], HorizontalAxis.prototype, "label", void 0);
|
|
155
|
-
__decorate([
|
|
156
|
-
command()
|
|
157
|
-
], HorizontalAxis.prototype, "enter", null);
|
|
94
|
+
column.push(new Rect({ flow: "vertical", gap: titlePad, height: "hug", width: "fill", children }));
|
|
95
|
+
return asParts(column);
|
|
96
|
+
},
|
|
97
|
+
commands: {
|
|
98
|
+
/**
|
|
99
|
+
* Stagger the markers in left to right, then slide the caption in after
|
|
100
|
+
* them. Its first frame arms them all: lifted by `slide` and transparent.
|
|
101
|
+
*
|
|
102
|
+
* The timeline's duration is the **whole** entrance — see
|
|
103
|
+
* `VerticalAxis.enter` and {@link enterBudget}.
|
|
104
|
+
*/
|
|
105
|
+
enter: {
|
|
106
|
+
args: {
|
|
107
|
+
stagger: Types.custom(undefined),
|
|
108
|
+
slide: Types.number(SLIDE),
|
|
109
|
+
},
|
|
110
|
+
run: (timeline, state) => {
|
|
111
|
+
const { stagger, slide } = timeline.args;
|
|
112
|
+
const count = state.markers.length;
|
|
113
|
+
const captioned = state.label !== "";
|
|
114
|
+
const from = { opacity: 0, shift: slide };
|
|
115
|
+
const keys = [...state.markers.keys(), ...(captioned ? ["label"] : [])];
|
|
116
|
+
const arm = timeline.animate(() => ({ arrivals: armed(keys, from) }));
|
|
117
|
+
if (count === 0)
|
|
118
|
+
return arm;
|
|
119
|
+
const { step, per, caption } = enterBudget(timeline.duration, count, captioned, stagger);
|
|
120
|
+
const ease = frameEase(timeline);
|
|
121
|
+
// Left marker leads: the row is already left → right.
|
|
122
|
+
const markers = state.markers.map((_, i) => ({ at: i * step, duration: per, piece: arrival(timeline, i, from, ease) }));
|
|
123
|
+
const label = captioned ? [{ at: (count - 1) * step + per, duration: caption, piece: arrival(timeline, "label", from, ease) }] : [];
|
|
124
|
+
return timeline.together([arm, beats(timeline, [...markers, ...label])]);
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
});
|
|
158
129
|
//# sourceMappingURL=horizontal-axis.js.map
|
|
@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AAC,CAAC,CAAC;gBACpG,CAAC,CAAC,EAAE,CAAC;SACR,CAAC,CAAC;IACL,CAAC;CACF;AA9IuD;IAArD,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAU,EAAE,CAAC;6CAAsB;AACd;IAApD,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAc,EAAE,CAAC;+CAA2B;AACxB;IAA9C,QAAQ,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;4CAA0B;AAC7B;IAAlC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;6CAAuB;AA6GjD;IADC,OAAO,EAAE;2CA8BT","sourcesContent":["import {\r\n command,\r\n Node2D,\r\n Rect,\r\n Text,\r\n easeOut,\r\n property,\r\n insetsOps,\r\n textOps,\r\n type CommandArgs,\r\n type NodeConfig,\r\n type Node2DProps,\r\n} from \"@motionscript/sdk\";\r\n\r\nimport {\r\n DEFAULT_X_AXIS,\r\n enterBudget,\r\n formatMarker,\r\n type AxisConfig,\r\n type Range,\r\n} from \"../kit/shared\";\r\nimport { at, compose, type Seekable } from \"@motionscript/sdk/component\"\r\n\r\nexport interface HorizontalAxisProps extends Node2DProps {\r\n /** `[min, max]` of the horizontal scale the markers are positioned within. */\r\n range: Range;\r\n /** Tick values (in data units) to draw along the axis. */\r\n markers: number[];\r\n /** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */\r\n axis: AxisConfig;\r\n /**\r\n * Caption drawn centred in the gutter beneath the marker row. Empty string\r\n * (the default) hides it.\r\n */\r\n label: string;\r\n}\r\n\r\n/** How far a marker starts above its slot when it enters, in px. */\r\nconst SLIDE = 24;\r\n\r\n/** How a tick value is captioned — see {@link HorizontalAxis.labelFor}. */\r\nexport type MarkerLabel = (value: number) => string;\r\n\r\n/**\r\n * The horizontal axis of a {@link LineChart}: a **row of {@link Text} nodes**,\r\n * one per marker value, running left-to-right. Pure layout — the mirror of the\r\n * kit's `VerticalAxis`, including its bound (not snapshotted) marker text and\r\n * positions, and its landed resting state.\r\n *\r\n * Markers are always placed **by value** across the range, whatever they say:\r\n * `2026-03` sits three months along, not three slots along. That is what keeps\r\n * it distinct from a bar chart's bottom axis, which centres a caption on each\r\n * slot and has no scale at all — the two only look alike. What the values are\r\n * captioned *as* is the chart's to decide; see {@link labelFor}.\r\n *\r\n * {@link enter} staggers the markers in **left-to-right**: each starts lifted a\r\n * little above its slot and transparent, then fades and slides down into place.\r\n */\r\nexport class HorizontalAxis extends Node2D<HorizontalAxisProps> {\r\n @property({ default: () => [0, 1] as Range }) declare range: Range;\r\n @property({ default: () => [] as number[] }) declare markers: number[];\r\n @property({ default: DEFAULT_X_AXIS }) declare axis: AxisConfig;\r\n @property({ default: \"\" }) declare label: string;\r\n\r\n /**\r\n * How a tick value is captioned. Defaults to the numeric formatting the\r\n * vertical axis uses; a chart whose x column names months or categories\r\n * replaces it (see `x-scale.ts`).\r\n *\r\n * A plain field rather than a `@property`, because it is a **policy, not a\r\n * value**: there is nothing to tween between two formatters, and a signal\r\n * holding a function is a signal every `set`/`to` on this node would have to\r\n * know not to touch. Read inside each marker's `text` binding, so replacing it\r\n * before the first frame is enough — which is when the chart does it.\r\n */\r\n labelFor: MarkerLabel = formatMarker;\r\n\r\n /** One text node per marker, ordered left → right, for the staggered enter. */\r\n private markerNodes: Text[] = [];\r\n /** The caption node, or null when `label` is empty. */\r\n private labelNode: Text | null = null;\r\n\r\n /** The live tick values, left → right — re-read every frame, not snapshotted. */\r\n private get sortedMarkers(): number[] {\r\n return [...this.markers].sort((a, b) => a - b);\r\n }\r\n\r\n private valueAt(index: number): number | undefined {\r\n return this.sortedMarkers[index];\r\n }\r\n\r\n /** Tick `i`'s fraction across the live `range`, 0 at the left edge. */\r\n private fracAt(index: number): number {\r\n const v = this.valueAt(index);\r\n if (v === undefined) return 0;\r\n const [min, max] = this.range;\r\n return max <= min ? 0 : (v - min) / (max - min);\r\n }\r\n\r\n constructor(props?: NodeConfig<HorizontalAxis, HorizontalAxisProps>) {\r\n super(props);\r\n\r\n const tickPad = insetsOps.resolve(this.axis.tickPadding).top;\r\n const titlePad = insetsOps.resolve(this.axis.titlePadding).top;\r\n\r\n this.markerNodes = this.markers.map((_, i) => {\r\n const marker: Text = new Text({\r\n ...textOps.styleProps(this.axis.labelStyle),\r\n text: () => {\r\n const v = this.valueAt(i);\r\n return v === undefined ? \"\" : this.labelFor(v);\r\n },\r\n x: () => {\r\n const width = this.layoutBounds.width;\r\n const centred = (this.fracAt(i) - 0.5) * width;\r\n // Held inside the axis's right edge, which is also the *chart's*: the\r\n // last marker is centred on the last grid line, so half of `2026-06`\r\n // — or of `3300` — would be drawn outside the node's box and outside\r\n // the rectangle the editor draws around it. Only the right edge is\r\n // held, because the left one has the vertical axis's whole gutter\r\n // beyond it, and a marker overhanging into that is inside the chart.\r\n const limit = width / 2 - marker.layoutBounds.width / 2;\r\n return Math.min(centred, limit);\r\n },\r\n });\r\n return marker;\r\n });\r\n\r\n const children: Node2D[] = [\r\n new Rect({\r\n width: \"fill\",\r\n height: \"hug\",\r\n padding: { top: tickPad },\r\n children: this.markerNodes,\r\n }),\r\n ];\r\n if (this.label !== \"\") {\r\n this.labelNode = new Text({\r\n ...textOps.styleProps(this.axis.titleStyle),\r\n text: this.label,\r\n });\r\n children.push(this.labelNode);\r\n }\r\n\r\n this.add(\r\n new Rect({ flow: \"vertical\", gap: titlePad, height: \"hug\", width: \"fill\", children }),\r\n );\r\n }\r\n\r\n /**\r\n * Primes every marker (and the caption) at its pre-entrance state: lifted\r\n * above its slot and transparent. Idempotent — see {@link VerticalAxis.arm}.\r\n */\r\n arm(slide = SLIDE): void {\r\n for (const marker of this.markerNodes) marker.set({ opacity: 0, y: slide });\r\n this.labelNode?.set({ opacity: 0, y: slide });\r\n }\r\n\r\n /**\r\n * Stagger the markers in left to right, then slide the caption in after them.\r\n *\r\n * A {@link Seekable} rather than a generator. The offsets were always static —\r\n * `i * step` per marker — but expressed as `wait` inside a generator they only\r\n * existed while it ran, so knowing what the axis looked like partway through\r\n * meant running it from zero. Placed explicitly, the same stagger can be asked\r\n * for a time, which is what lets a chart scene scrub in constant time.\r\n *\r\n * `duration` is the **whole** entrance — see {@link VerticalAxis.enter} and\r\n * {@link enterBudget}.\r\n */\r\n @command()\r\n enter(\r\n args: CommandArgs<{ stagger?: number; slide?: number }> & { duration: number },\r\n ): Seekable {\r\n const { stagger, slide = SLIDE } = args.data ?? {};\r\n const duration = args.duration;\r\n const easing = args.easing ?? easeOut();\r\n const nodes = this.markerNodes;\r\n if (nodes.length === 0) return compose([]);\r\n const { step, per, caption } = enterBudget(\r\n duration,\r\n nodes.length,\r\n this.labelNode !== null,\r\n stagger,\r\n );\r\n\r\n this.arm(slide);\r\n\r\n // Left marker leads: markerNodes is already left → right.\r\n const markers = nodes.map((node, i) =>\r\n at(i * step, node.to({ data: { opacity: 1, y: 0 }, duration: per, easing })),\r\n );\r\n const lastMarkerEnds = nodes.length === 0 ? 0 : (nodes.length - 1) * step + per;\r\n\r\n return compose([\r\n ...markers,\r\n ...(this.labelNode\r\n ? [at(lastMarkerEnds, this.labelNode.to({ data: { opacity: 1, y: 0 }, duration: caption, easing }))]\r\n : []),\r\n ]);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"horizontal-axis.js","sourceRoot":"","sources":["../../src/line-chart/horizontal-axis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,WAAW,EACX,SAAS,EACT,OAAO,GAGR,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAgB,MAAM,eAAe,CAAC;AACzG,OAAO,EACL,cAAc,EACd,WAAW,GAGZ,MAAM,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AC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBACxH,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpI,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3E,CAAC;SACF;KACF;CACF,CAAC,CAAC","sourcesContent":["import {\r\n Rect,\r\n Text,\r\n Types,\r\n component2d,\r\n insetsOps,\r\n textOps,\r\n type NodeOf,\r\n type Node2D,\r\n} from \"@motionscript/sdk\";\r\n\r\nimport { asParts, fresh } from \"../kit/entries\";\r\nimport { armed, arrival, arrivalOf, arrivalsEntry, beats, frameEase, type Arrival } from \"../kit/motion\";\r\nimport {\r\n DEFAULT_X_AXIS,\r\n enterBudget,\r\n type AxisConfig,\r\n type Range,\r\n} from \"../kit/shared\";\r\nimport { markerCaption } from \"../kit/vertical-axis\";\r\n\r\n/** How far a marker starts above its slot when it enters, in px. */\r\nconst SLIDE = 24;\r\n\r\n/**\r\n * The horizontal axis of a {@link LineChart}: a **row of {@link Text} nodes**,\r\n * one per marker value, running left-to-right. Pure layout — the mirror of the\r\n * kit's `VerticalAxis`, including its bound (not snapshotted) marker text and\r\n * positions, and its landed resting state.\r\n *\r\n * Markers are always placed **by value** across the range, whatever they say:\r\n * `2026-03` sits three months along, not three slots along. That is what keeps\r\n * it distinct from a bar chart's bottom axis, which centres a caption on each\r\n * slot and has no scale at all — the two only look alike. What the values are\r\n * captioned *as* is the chart's to decide, in `captions`.\r\n *\r\n * `enter` staggers the markers in **left-to-right**: each starts lifted a\r\n * little above its slot and transparent, then fades and slides down into place.\r\n */\r\nexport const HorizontalAxis = component2d({\r\n key: \"horizontalAxis\",\r\n state: {\r\n /** `[min, max]` of the horizontal scale the markers are positioned within. */\r\n range: fresh<Range>(() => [0, 1]),\r\n /** Tick values (in data units) to draw along the axis. */\r\n markers: fresh<number[]>(() => []),\r\n /**\r\n * How each marker is captioned, one per entry of `markers` and in its order.\r\n * Empty (the default), or short, captions a marker with its bare numeric\r\n * reading; a chart whose x column names months or categories writes those.\r\n */\r\n captions: fresh<string[]>(() => []),\r\n /** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */\r\n axis: Types.custom<AxisConfig>(DEFAULT_X_AXIS),\r\n /** Caption drawn centred in the gutter beneath the marker row; empty (the default) hides it. */\r\n label: \"\",\r\n arrivals: arrivalsEntry(),\r\n },\r\n // A plain node filled its parent; one made of its markers would hug them.\r\n defaults: { width: \"fill\", height: \"fill\" },\r\n children: (state) => {\r\n const tickPad = insetsOps.resolve(state.axis.tickPadding).top;\r\n const titlePad = insetsOps.resolve(state.axis.titlePadding).top;\r\n\r\n const column: Node2D[] = [];\r\n // The column's parent is the axis: its box is what the markers are placed in.\r\n const box = () => (column[0]?.parent as Node2D | null | undefined)?.layoutBounds ?? { width: 0, height: 0 };\r\n /** The live tick values, left → right — re-read every frame, not snapshotted. */\r\n const sorted = () => [...state.markers].sort((a, b) => a - b);\r\n /** Tick `i`'s fraction across the live `range`, 0 at the left edge. */\r\n const fracAt = (value: number | undefined) => {\r\n if (value === undefined) return 0;\r\n const [min, max] = state.range;\r\n return max <= min ? 0 : (value - min) / (max - min);\r\n };\r\n\r\n const markers = state.markers.map((_, i) => {\r\n const marker: Node2D = new Text({\r\n ...textOps.styleProps(state.axis.labelStyle),\r\n text: () => {\r\n const value = sorted()[i];\r\n return value === undefined ? \"\" : markerCaption(state, value);\r\n },\r\n x: () => {\r\n const width = box().width;\r\n const centred = (fracAt(sorted()[i]) - 0.5) * width;\r\n // Held inside the axis's right edge, which is also the *chart's*: the\r\n // last marker is centred on the last grid line, so half of `2026-06`\r\n // — or of `3300` — would be drawn outside the node's box and outside\r\n // the rectangle the editor draws around it. Only the right edge is\r\n // held, because the left one has the vertical axis's whole gutter\r\n // beyond it, and a marker overhanging into that is inside the chart.\r\n const limit = width / 2 - marker.layoutBounds.width / 2;\r\n return Math.min(centred, limit);\r\n },\r\n opacity: () => arrivalOf(state.arrivals, i).opacity,\r\n y: () => arrivalOf(state.arrivals, i).shift,\r\n });\r\n return marker;\r\n });\r\n\r\n const children: Node2D[] = [\r\n new Rect({ width: \"fill\", height: \"hug\", padding: { top: tickPad }, children: markers }),\r\n ];\r\n if (state.label !== \"\") {\r\n children.push(\r\n new Text({\r\n ...textOps.styleProps(state.axis.titleStyle),\r\n text: state.label,\r\n opacity: () => arrivalOf(state.arrivals, \"label\").opacity,\r\n y: () => arrivalOf(state.arrivals, \"label\").shift,\r\n }),\r\n );\r\n }\r\n\r\n column.push(new Rect({ flow: \"vertical\", gap: titlePad, height: \"hug\", width: \"fill\", children }));\r\n return asParts(column);\r\n },\r\n commands: {\r\n /**\r\n * Stagger the markers in left to right, then slide the caption in after\r\n * them. Its first frame arms them all: lifted by `slide` and transparent.\r\n *\r\n * The timeline's duration is the **whole** entrance — see\r\n * `VerticalAxis.enter` and {@link enterBudget}.\r\n */\r\n enter: {\r\n args: {\r\n stagger: Types.custom<number | undefined>(undefined),\r\n slide: Types.number(SLIDE),\r\n },\r\n run: (timeline, state) => {\r\n const { stagger, slide } = timeline.args;\r\n const count = state.markers.length;\r\n const captioned = state.label !== \"\";\r\n const from: Arrival = { opacity: 0, shift: slide };\r\n const keys = [...state.markers.keys(), ...(captioned ? [\"label\"] : [])];\r\n const arm = timeline.animate(() => ({ arrivals: armed(keys, from) }));\r\n if (count === 0) return arm;\r\n const { step, per, caption } = enterBudget(timeline.duration, count, captioned, stagger);\r\n const ease = frameEase(timeline);\r\n // Left marker leads: the row is already left → right.\r\n const markers = state.markers.map((_, i) => ({ at: i * step, duration: per, piece: arrival(timeline, i, from, ease) }));\r\n const label = captioned ? [{ at: (count - 1) * step + per, duration: caption, piece: arrival(timeline, \"label\", from, ease) }] : [];\r\n return timeline.together([arm, beats(timeline, [...markers, ...label])]);\r\n },\r\n },\r\n },\r\n});\r\n\r\nexport type HorizontalAxis = NodeOf<typeof HorizontalAxis>;\r\n"]}
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* that is *not* here comes from the kit and stays a dependency — see
|
|
11
11
|
* `../engine.ts` for why that line is where it is.
|
|
12
12
|
*/
|
|
13
|
-
export { LineChart } from "./line-chart.js";
|
|
14
|
-
export type { LineChartProps } from "./line-chart.js";
|
|
13
|
+
export { LineChart, lineChartDomains } from "./line-chart.js";
|
|
14
|
+
export type { LineChartDomains, LineChartProps, LineChartValues } from "./line-chart.js";
|
|
15
15
|
export { ChartRegion } from "./chart-region.js";
|
|
16
16
|
export { ChartLine } from "./chart-line.js";
|
|
17
17
|
export { HorizontalAxis } from "./horizontal-axis.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/line-chart/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/line-chart/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC1D,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,OAAO,GACR,MAAM,UAAU,CAAA;AACjB,YAAY,EACV,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,YAAY,GACb,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACtE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA"}
|
package/dist/line-chart/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* that is *not* here comes from the kit and stays a dependency — see
|
|
11
11
|
* `../engine.ts` for why that line is where it is.
|
|
12
12
|
*/
|
|
13
|
-
export { LineChart } from "./line-chart.js";
|
|
13
|
+
export { LineChart, lineChartDomains } from "./line-chart.js";
|
|
14
14
|
export { ChartRegion } from "./chart-region.js";
|
|
15
15
|
export { ChartLine } from "./chart-line.js";
|
|
16
16
|
export { HorizontalAxis } from "./horizontal-axis.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/line-chart/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/line-chart/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,OAAO,GACR,MAAM,UAAU,CAAA;AASjB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA","sourcesContent":["/**\r\n * The line chart: a cartesian plot with a traced polyline, spotlit regions and\r\n * a staggered entrance.\r\n *\r\n * {@link LineChart} composes the parts below plus the shared ones in the kit\r\n * (the plot panel, the value axis, the legend); each part is exported too, so\r\n * another node type can reuse one on its own.\r\n *\r\n * These files are what `ms add line-chart` copies. Everything they reach for\r\n * that is *not* here comes from the kit and stays a dependency — see\r\n * `../engine.ts` for why that line is where it is.\r\n */\r\nexport { LineChart, lineChartDomains } from \"./line-chart\"\r\nexport type { LineChartDomains, LineChartProps, LineChartValues } from \"./line-chart\"\r\nexport { ChartRegion } from \"./chart-region\"\r\nexport { ChartLine } from \"./chart-line\"\r\nexport { HorizontalAxis } from \"./horizontal-axis\"\r\nexport {\r\n DEFAULT_CHART_THEME,\r\n EMPTY_REGION_BOX,\r\n clipPolylineToBox,\r\n hasRegion,\r\n lerpChartTheme,\r\n resolveChartTheme,\r\n resolveRegionBox,\r\n resolveYScale,\r\n seriesPoints,\r\n yExtent,\r\n} from \"./shared\"\r\nexport type {\r\n ChartConfig,\r\n ChartTheme,\r\n LineSeries,\r\n PlotRegion,\r\n RegionBox,\r\n RegionConfig,\r\n} from \"./shared\"\r\nexport { formatInstant, parseInstant, resolveXScale } from \"./x-scale\"\r\nexport type { XScale, XScaleKind } from \"./x-scale\"\r\n"]}
|