@blueprint-chart/lib 0.1.35 → 0.3.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/charts/motion.d.ts +9 -9
- package/dist/charts/plugins/plugin-host.d.ts +16 -0
- package/dist/charts/transition-cache.d.ts +11 -0
- package/dist/dsl/types.d.ts +24 -0
- package/dist/index.js +4110 -4121
- package/dist/transitions/frame-geometry.d.ts +53 -0
- package/dist/transitions/index.d.ts +3 -0
- package/dist/transitions/interpolate-path.d.ts +11 -0
- package/dist/transitions/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { SceneTransition } from './scene-transition';
|
|
2
|
+
/** Plot rectangle in chart-area coordinates: origin + inner size. */
|
|
3
|
+
export interface PlotRect {
|
|
4
|
+
left: number;
|
|
5
|
+
top: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
export interface FrameGeometryOptions {
|
|
10
|
+
/** The chart-area `<g>` whose `transform` carries the plot origin. */
|
|
11
|
+
group: SVGGElement;
|
|
12
|
+
/** The plot clip rect, if any (width/height interpolate with the plot size). */
|
|
13
|
+
clipRect: SVGRectElement | null;
|
|
14
|
+
from: PlotRect;
|
|
15
|
+
to: PlotRect;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Ease the plot frame geometry (chart-area group origin + clip size) from the
|
|
19
|
+
* prior scene's rect to the new one on the orchestrator's `bc-scene` clock.
|
|
20
|
+
*
|
|
21
|
+
* The new render has already placed the group/clip at the NEW geometry, so the
|
|
22
|
+
* tween first resets them to `from` and eases to `to`. The group `transform`
|
|
23
|
+
* uses the point-wise interpolator (d3's default string interp mangles it);
|
|
24
|
+
* clip width/height are numeric and use d3's default attr tween.
|
|
25
|
+
*
|
|
26
|
+
* Registers a buffered flush, so call it during `committing` (e.g. inside
|
|
27
|
+
* `SceneTransition.run`). On the snap path (duration 0 / reduced motion) the
|
|
28
|
+
* geometry is set directly to `to`.
|
|
29
|
+
*/
|
|
30
|
+
export interface PlotFrameOptions {
|
|
31
|
+
/** The chart's `<svg>` (used to find the clip rect by id). */
|
|
32
|
+
svg: SVGSVGElement;
|
|
33
|
+
/** The plot clip-path id (its `rect` size interpolates with the plot). */
|
|
34
|
+
clipId: string;
|
|
35
|
+
/** The chart-area `<g>` whose `transform` carries the plot origin. */
|
|
36
|
+
group: SVGGElement;
|
|
37
|
+
/** The prior scene's plot rect (from the transition cache), if any. */
|
|
38
|
+
from: PlotRect | undefined;
|
|
39
|
+
/** This render's plot rect. */
|
|
40
|
+
to: PlotRect;
|
|
41
|
+
/** Only ease when true (same-type transition with prior marks to tween from). */
|
|
42
|
+
active: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Renderer-facing wrapper over {@link tweenFrameGeometry}: resolves the clip
|
|
46
|
+
* rect from `svg`/`clipId` and eases from the cached prior plot rect to this
|
|
47
|
+
* render's rect. No-ops unless `active` and a prior rect exist. Using the cached
|
|
48
|
+
* prior rect (rather than reconstructing it from margins) keeps the `from`
|
|
49
|
+
* geometry exact even when a chart's plot height differs from its inner height
|
|
50
|
+
* (e.g. a category-label band) or carries clip inflation.
|
|
51
|
+
*/
|
|
52
|
+
export declare function tweenPlotFrame(orch: SceneTransition, opts: PlotFrameOptions): void;
|
|
53
|
+
export declare function tweenFrameGeometry(orch: SceneTransition, opts: FrameGeometryOptions): void;
|
|
@@ -2,6 +2,9 @@ export { SceneTransition, getSceneTransition } from './scene-transition';
|
|
|
2
2
|
export { BC_TRANSITION_NAME } from './types';
|
|
3
3
|
export type { CommitOptions } from './scene-transition';
|
|
4
4
|
export { featureJoin } from './feature-join';
|
|
5
|
+
export { interpolatePath } from './interpolate-path';
|
|
6
|
+
export { tweenFrameGeometry, tweenPlotFrame } from './frame-geometry';
|
|
7
|
+
export type { PlotRect, FrameGeometryOptions, PlotFrameOptions } from './frame-geometry';
|
|
5
8
|
export { roleScan, tagsCompatible, shouldEscalateToFade, ROLE_MATCH_THRESHOLD } from './role-matcher';
|
|
6
9
|
export { snapshotLiveAttrs } from './snapshot';
|
|
7
10
|
export type { TransitionMode, SceneTransitionState, FeatureRole, FeatureJoinConfig, AttrMap, AttrValue, } from './types';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interpolate two SVG path `d` strings point-wise.
|
|
3
|
+
*
|
|
4
|
+
* d3's default `interpolateString` pairs numbers by document order and
|
|
5
|
+
* fuses/garbles them when the two paths have different counts — observed
|
|
6
|
+
* producing ~1e11 coordinates during area resizes. This splits each path
|
|
7
|
+
* into a command skeleton + number list; when the skeletons match it
|
|
8
|
+
* interpolates the numbers pairwise, otherwise it hard-switches at the
|
|
9
|
+
* midpoint so a malformed blend is never emitted.
|
|
10
|
+
*/
|
|
11
|
+
export declare function interpolatePath(a: string, b: string): (t: number) => string;
|
|
@@ -17,7 +17,7 @@ export type SceneTransitionState = 'idle' | 'committing' | 'animating';
|
|
|
17
17
|
* `'axis-tick.value'`. The role-matcher (future plan) acts on this tag;
|
|
18
18
|
* v1 stores it without acting on it for cross-type.
|
|
19
19
|
*/
|
|
20
|
-
export type FeatureRole = 'mark-per-category' | 'mark-per-cell' | 'series-path' | 'axis-tick.value' | 'axis-tick.category' | 'value-label' | 'annotation.point' | 'annotation.range' | 'annotation.free';
|
|
20
|
+
export type FeatureRole = 'mark-per-category' | 'mark-per-cell' | 'series-path' | 'series-area' | 'series-line' | 'axis-tick.value' | 'axis-tick.category' | 'value-label' | 'annotation.point' | 'annotation.range' | 'annotation.free';
|
|
21
21
|
/** Subset of SVG / HTML attribute values we tween. */
|
|
22
22
|
export type AttrValue = string | number;
|
|
23
23
|
/** Map of attribute name → value. */
|