@gravitee/graphene-charts 3.17.0 → 3.18.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 (38) hide show
  1. package/USAGE_GUIDE.md +71 -1
  2. package/dist/base/ChartBrush/ChartBrush.d.ts +47 -0
  3. package/dist/base/ChartBrush/ChartBrush.d.ts.map +1 -0
  4. package/dist/base/ChartBrush/index.d.ts +3 -0
  5. package/dist/base/ChartBrush/index.d.ts.map +1 -0
  6. package/dist/charts/AreaChart/AreaChart.d.ts +8 -1
  7. package/dist/charts/AreaChart/AreaChart.d.ts.map +1 -1
  8. package/dist/charts/LineChart/LineChart.d.ts +7 -1
  9. package/dist/charts/LineChart/LineChart.d.ts.map +1 -1
  10. package/dist/dashboard-grid/DashboardGrid.d.ts.map +1 -1
  11. package/dist/dashboard-grid/DashboardWidget.d.ts.map +1 -1
  12. package/dist/dashboard-grid/index.js +42 -31
  13. package/dist/index.d.ts +2 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +1684 -1632
  16. package/dist/lineage/index.js +12 -12
  17. package/dist/primitives/CartesianChart.d.ts.map +1 -1
  18. package/dist/primitives/ChartBrushOverlay.d.ts +24 -0
  19. package/dist/primitives/ChartBrushOverlay.d.ts.map +1 -0
  20. package/dist/primitives/ChartSlots.d.ts +17 -2
  21. package/dist/primitives/ChartSlots.d.ts.map +1 -1
  22. package/dist/primitives/ReferenceLine.d.ts.map +1 -1
  23. package/dist/primitives/cartesianGeometry.d.ts +98 -0
  24. package/dist/primitives/cartesianGeometry.d.ts.map +1 -0
  25. package/dist/primitives/chartBadge.d.ts +13 -0
  26. package/dist/primitives/chartBadge.d.ts.map +1 -0
  27. package/dist/primitives/index.d.ts +2 -1
  28. package/dist/primitives/index.d.ts.map +1 -1
  29. package/dist/primitives/useChartBrush.d.ts +51 -0
  30. package/dist/primitives/useChartBrush.d.ts.map +1 -0
  31. package/dist/primitives/useDevWarning.d.ts +21 -0
  32. package/dist/primitives/useDevWarning.d.ts.map +1 -0
  33. package/dist/{primitives-DxLTufiI.js → primitives-BvnyBVmf.js} +525 -252
  34. package/dist/series/AreaSeries.d.ts +9 -1
  35. package/dist/series/AreaSeries.d.ts.map +1 -1
  36. package/dist/series/LineSeries.d.ts +8 -1
  37. package/dist/series/LineSeries.d.ts.map +1 -1
  38. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "../utils-CvSeRmfY.js";
2
- import { l as t, n, o as r } from "../primitives-DxLTufiI.js";
2
+ import { n as t, o as n, u as r } from "../primitives-BvnyBVmf.js";
3
3
  import { t as i } from "../surface-CnPuQgns.js";
4
4
  import { Badge as a } from "@gravitee/graphene-core";
5
5
  import { Fragment as o, useCallback as s, useEffect as c, useId as l, useMemo as u, useRef as d, useState as f } from "react";
@@ -149,13 +149,13 @@ function k({ data: t }) {
149
149
  }
150
150
  //#endregion
151
151
  //#region src/lineage/LineageSkeleton.tsx
152
- function ce({ className: t, nodes: r = 4 }) {
152
+ function ce({ className: n, nodes: r = 4 }) {
153
153
  return /* @__PURE__ */ m("div", {
154
154
  role: "img",
155
155
  "aria-label": "Loading lineage graph",
156
156
  "aria-busy": "true",
157
- className: e("flex h-full w-full items-center justify-center gap-3 overflow-hidden bg-background p-8", t),
158
- children: Array.from({ length: r }).map((e, t) => /* @__PURE__ */ h(o, { children: [/* @__PURE__ */ m(n, { className: "h-[72px] w-full max-w-[200px] min-w-0 flex-1 rounded-lg" }), t < r - 1 && /* @__PURE__ */ m(n, { className: "h-px w-8 shrink-0 rounded-none" })] }, t))
157
+ className: e("flex h-full w-full items-center justify-center gap-3 overflow-hidden bg-background p-8", n),
158
+ children: Array.from({ length: r }).map((e, n) => /* @__PURE__ */ h(o, { children: [/* @__PURE__ */ m(t, { className: "h-[72px] w-full max-w-[200px] min-w-0 flex-1 rounded-lg" }), n < r - 1 && /* @__PURE__ */ m(t, { className: "h-px w-8 shrink-0 rounded-none" })] }, n))
159
159
  });
160
160
  }
161
161
  //#endregion
@@ -353,12 +353,12 @@ function Se({ containerRef: e }) {
353
353
  })
354
354
  }) : null;
355
355
  }
356
- function F({ nodes: n, edges: i, nodeTypes: a, edgeTypes: o, layout: p = ge, className: _, children: ee, fitView: y = !0, pannable: S = !1, zoomable: w = !1, showControls: ne = !1, fullscreenable: T = !1, state: se, ariaLabel: E = "Lineage graph", edgeAnimation: D = "none", highlightConnections: O = !0, highlightMode: k = "neighbors", showLegend: le = !1, showMinimap: de = !1, selectedNodeId: A, defaultSelectedNodeId: pe, onNodeSelect: j, onNodeHover: M, onNodeLeave: N }) {
357
- let { fitView: P, getNodes: F, setCenter: I } = oe(), L = d(null), Ce = ie(), we = l(), [R, Te] = f(!1), [Ee, De] = f(null), [z, B] = f(null), V = s((e) => `${we}-${e}`, [we]), H = u(() => n.map((e) => e.id), [n]), U = u(() => {
356
+ function F({ nodes: t, edges: i, nodeTypes: a, edgeTypes: o, layout: p = ge, className: _, children: ee, fitView: y = !0, pannable: S = !1, zoomable: w = !1, showControls: ne = !1, fullscreenable: T = !1, state: se, ariaLabel: E = "Lineage graph", edgeAnimation: D = "none", highlightConnections: O = !0, highlightMode: k = "neighbors", showLegend: le = !1, showMinimap: de = !1, selectedNodeId: A, defaultSelectedNodeId: pe, onNodeSelect: j, onNodeHover: M, onNodeLeave: N }) {
357
+ let { fitView: P, getNodes: F, setCenter: I } = oe(), L = d(null), Ce = ie(), we = l(), [R, Te] = f(!1), [Ee, De] = f(null), [z, B] = f(null), V = s((e) => `${we}-${e}`, [we]), H = u(() => t.map((e) => e.id), [t]), U = u(() => {
358
358
  let e = /* @__PURE__ */ new Map();
359
- for (let t of n) e.set(t.id, t);
359
+ for (let n of t) e.set(n.id, n);
360
360
  return e;
361
- }, [n]), W = A !== void 0, [Oe, ke] = f(pe ?? null), G = (W ? A : Oe) ?? null, K = s((e) => {
361
+ }, [t]), W = A !== void 0, [Oe, ke] = f(pe ?? null), G = (W ? A : Oe) ?? null, K = s((e) => {
362
362
  W || ke(e), j?.(e ? U.get(e) ?? null : null);
363
363
  }, [
364
364
  W,
@@ -370,7 +370,7 @@ function F({ nodes: n, edges: i, nodeTypes: a, edgeTypes: o, layout: p = ge, cla
370
370
  }), [a]), Me = u(() => ({
371
371
  ...ve,
372
372
  ...o
373
- }), [o]), Y = u(() => n.map((e) => ({
373
+ }), [o]), Y = u(() => t.map((e) => ({
374
374
  id: e.id,
375
375
  type: e.type ?? "base",
376
376
  data: e.data,
@@ -378,7 +378,7 @@ function F({ nodes: n, edges: i, nodeTypes: a, edgeTypes: o, layout: p = ge, cla
378
378
  x: 0,
379
379
  y: 0
380
380
  }
381
- })), [n]), X = u(() => {
381
+ })), [t]), X = u(() => {
382
382
  let e = xe(i);
383
383
  return i.map((t) => {
384
384
  let n = t.status ?? "healthy";
@@ -540,7 +540,7 @@ function F({ nodes: n, edges: i, nodeTypes: a, edgeTypes: o, layout: p = ge, cla
540
540
  $,
541
541
  z,
542
542
  K
543
- ]), Ge = t(se, n.length);
543
+ ]), Ge = r(se, t.length);
544
544
  return Ge === "ready" ? /* @__PURE__ */ m("div", {
545
545
  ref: L,
546
546
  className: e("relative h-full w-full bg-background outline-none focus-visible:ring-2 focus-visible:ring-ring", _),
@@ -614,7 +614,7 @@ function F({ nodes: n, edges: i, nodeTypes: a, edgeTypes: o, layout: p = ge, cla
614
614
  className: e("relative h-full w-full bg-background", _),
615
615
  role: "img",
616
616
  "aria-label": E,
617
- children: Ge === "loading" ? /* @__PURE__ */ m(ce, { className: "h-full w-full" }) : /* @__PURE__ */ m(r, { ariaLabel: E })
617
+ children: Ge === "loading" ? /* @__PURE__ */ m(ce, { className: "h-full w-full" }) : /* @__PURE__ */ m(n, { ariaLabel: E })
618
618
  });
619
619
  }
620
620
  function I(e) {
@@ -1 +1 @@
1
- {"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../src/primitives/CartesianChart.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CA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EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC9F,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,iHAAiH;IACjH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AA4DD,iBAAS,cAAc,CAAC,EACtB,KAAK,EACL,SAAS,EACT,IAAI,EACJ,MAAM,EACN,eAAe,EACf,iBAAiB,EACjB,MAAM,EACN,SAAS,EACT,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,GAAG,QAAQ,EACZ,EAAE,mBAAmB,qBAiCrB;AAojBD,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { CartesianLayout, CategoryCenters } from './cartesianGeometry';
2
+ import { ChartBrushDraft } from './useChartBrush';
3
+ export interface ChartBrushOverlayProps {
4
+ readonly draft: ChartBrushDraft;
5
+ readonly centers: CategoryCenters;
6
+ /** Plot length along the category axis. */
7
+ readonly extent: number;
8
+ /** Plot length across it. */
9
+ readonly crossExtent: number;
10
+ readonly layout: CartesianLayout;
11
+ readonly label: string;
12
+ }
13
+ /**
14
+ * The band a `ChartBrush` gesture draws. The chart renders it last inside its
15
+ * plot group, so it paints above every series wherever the consumer wrote the
16
+ * marker. Selection is `--primary` — the sanctioned "active selection" use of
17
+ * Solaris — and the rest of the plot is washed with `--background`; both
18
+ * tokens flip with the theme, so there is no dark-mode rule here. Edges are
19
+ * solid: dashed lines belong to `ReferenceLine`'s threshold vocabulary. A
20
+ * draft narrower than `minCategories` keeps only its edges and label, so the
21
+ * chart shows a measurement rather than a selection it will not commit.
22
+ */
23
+ export declare function ChartBrushOverlay({ draft, centers, extent, crossExtent, layout, label }: ChartBrushOverlayProps): import("react").JSX.Element;
24
+ //# sourceMappingURL=ChartBrushOverlay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartBrushOverlay.d.ts","sourceRoot":"","sources":["../../src/primitives/ChartBrushOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAgBvD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,2CAA2C;IAC3C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,6BAA6B;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,sBAAsB,+BAoD/G"}
@@ -1,3 +1,4 @@
1
+ import { ChartBrushRange } from '../base/ChartBrush';
1
2
  import * as React from 'react';
2
3
  /**
3
4
  * Slot payload registered by `<ChartTooltip>`. `content` is the element
@@ -15,16 +16,30 @@ export interface LegendSlot {
15
16
  content: React.ReactElement;
16
17
  verticalAlign: 'top' | 'bottom';
17
18
  }
19
+ /**
20
+ * Slot payload registered by `<ChartBrush>`. The chart owns the gesture and
21
+ * the overlay; it reads the latest registration at pointer time, so inline
22
+ * callbacks re-registering on every consumer render are fine.
23
+ */
24
+ export interface BrushSlot {
25
+ onBrushEnd: (range: ChartBrushRange) => void;
26
+ onBrushChange?: (range: ChartBrushRange) => void;
27
+ onBrushCancel?: () => void;
28
+ disabled: boolean;
29
+ minCategories: number;
30
+ }
18
31
  interface ChartSlotsState {
19
32
  tooltip: TooltipSlot | null;
20
33
  legend: LegendSlot | null;
34
+ brush: BrushSlot | null;
21
35
  }
22
36
  interface ChartSlotsContextValue extends ChartSlotsState {
23
37
  setTooltip: (slot: TooltipSlot | null) => void;
24
38
  setLegend: (slot: LegendSlot | null) => void;
39
+ setBrush: (slot: BrushSlot | null) => void;
25
40
  }
26
41
  /**
27
- * Reads the slots registered by `<ChartTooltip>` / `<ChartLegend>` for the
42
+ * Reads the slots registered by `<ChartTooltip>` / `<ChartLegend>` / `<ChartBrush>` for the
28
43
  * nearest enclosing chart. Returns an inert fallback when used outside of
29
44
  * a chart so the slot components themselves never throw (they just render
30
45
  * nothing, matching `<ChartTooltip>`'s documented "marker that renders
@@ -35,7 +50,7 @@ export interface ChartSlotsProviderProps {
35
50
  children: React.ReactNode;
36
51
  }
37
52
  /**
38
- * Wraps a chart's render tree so that `<ChartTooltip>` and `<ChartLegend>`
53
+ * Wraps a chart's render tree so that `<ChartTooltip>`, `<ChartLegend>` and `<ChartBrush>`
39
54
  * markers can register their content via a `useLayoutEffect` regardless of
40
55
  * how deeply they are nested (arbitrary fragments, HOCs, conditional
41
56
  * rendering, …). Charts consume the registered slots via `useChartSlots`.
@@ -1 +1 @@
1
- {"version":3,"file":"ChartSlots.d.ts","sourceRoot":"","sources":["../../src/primitives/ChartSlots.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC;IAC5B,aAAa,EAAE,KAAK,GAAG,QAAQ,CAAC;CACjC;AAED,UAAU,eAAe;IACvB,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,UAAU,GA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AAC,EACD,CAAC,EACD,MAAM,EACN,MAAuB,EACvB,eAAe,EACf,WAAiB,EACjB,KAAK,EACL,aAAqB,EACrB,KAAa,GACd,EAAE,kBAAkB,4BAoHpB"}
1
+ {"version":3,"file":"ReferenceLine.d.ts","sourceRoot":"","sources":["../../src/primitives/ReferenceLine.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,CAAC,CAAC,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,sFAAsF;IACtF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,aAAa,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAC3C;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAiCD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,EAC5B,CAAC,EACD,CAAC,EACD,MAAM,EACN,MAAuB,EACvB,eAAe,EACf,WAAiB,EACjB,KAAK,EACL,aAAqB,EACrB,KAAa,GACd,EAAE,kBAAkB,4BA6GpB"}
@@ -0,0 +1,98 @@
1
+ import { CategoryScale } from './CartesianContext';
2
+ /**
3
+ * Pure geometry along the category axis of a cartesian chart.
4
+ *
5
+ * Everything here works on plain numbers — pixel offsets from the plot origin
6
+ * and category indices — so it can be unit-tested without a DOM or a live
7
+ * scale. The chart resolves its scale to `CategoryCenters` once per layout and
8
+ * hands them in; hover and the brush then share one notion of "which category is
9
+ * under this pixel".
10
+ */
11
+ /** Pixel offset of every category centre along the category axis, in data order. */
12
+ export type CategoryCenters = readonly number[];
13
+ /** The two layouts a cartesian chart can take. */
14
+ export type CartesianLayout = 'vertical' | 'horizontal';
15
+ /**
16
+ * Centre of every category along the category axis, in the order of `categories`.
17
+ * On a band scale the centre sits half a bandwidth into the band; on a point
18
+ * scale (bandwidth 0) it is the point itself. Duplicated categories keep their
19
+ * slot in `categories` so indices stay aligned with the data array.
20
+ */
21
+ export declare function categoryCenters(categories: readonly string[], scale: CategoryScale): number[];
22
+ /**
23
+ * Offset of a pointer along the category axis, relative to the plot origin:
24
+ * `x` in vertical layout, `y` in horizontal layout. `plotRect` is the bounding
25
+ * rect of the plot area and `margin` the inset of the plot inside it.
26
+ */
27
+ export declare function plotAxisPosition(point: {
28
+ readonly clientX: number;
29
+ readonly clientY: number;
30
+ }, plotRect: {
31
+ readonly left: number;
32
+ readonly top: number;
33
+ }, margin: {
34
+ readonly left: number;
35
+ readonly top: number;
36
+ }, layout: CartesianLayout): number;
37
+ /** Clamps a position into the plot extent `[0, extent]`. */
38
+ export declare function clampToExtent(position: number, extent: number): number;
39
+ /**
40
+ * Index of the category whose centre is nearest to `position`, or `-1` when
41
+ * there is none. Positions beyond the plot resolve to the outermost category,
42
+ * and an exact tie keeps the earlier one — the scan the chart has always used
43
+ * for hover, kept as is.
44
+ */
45
+ export declare function nearestCategoryIndex(position: number, centers: CategoryCenters): number;
46
+ /** An inclusive range of category indices, ordered so `startIndex <= endIndex`. */
47
+ export interface CategoryRange {
48
+ readonly startIndex: number;
49
+ readonly endIndex: number;
50
+ }
51
+ /** Pixel bounds of a slot or a band along the category axis. */
52
+ export interface AxisBounds {
53
+ readonly start: number;
54
+ readonly end: number;
55
+ }
56
+ /** Orders two category indices into a `CategoryRange`, whichever way they were dragged. */
57
+ export declare function normalizeRange(a: number, b: number): CategoryRange;
58
+ export declare function sameRange(a: CategoryRange, b: CategoryRange): boolean;
59
+ /** Number of categories a range covers. */
60
+ export declare function rangeSize(range: CategoryRange): number;
61
+ /**
62
+ * Bounds of the slot a category owns: from the midpoint to its previous
63
+ * neighbour to the midpoint to its next one, the outermost slots running to
64
+ * the plot edges. This is exactly the region the nearest-centre scan resolves
65
+ * to that category, so a band snapped to slot edges covers the categories it
66
+ * reports — on band and point scales alike.
67
+ */
68
+ export declare function categorySlotBounds(index: number, centers: CategoryCenters, extent: number): AxisBounds;
69
+ /** Bounds of the band covering every slot from `range.startIndex` to `range.endIndex`. */
70
+ export declare function rangeSlotBounds(range: CategoryRange, centers: CategoryCenters, extent: number): AxisBounds;
71
+ /** Whether the pointer travelled far enough from `origin` for a press to count as a drag. */
72
+ export declare function exceedsDragThreshold(origin: number, position: number, threshold: number): boolean;
73
+ /**
74
+ * At or below this many readings a curve is mostly interpolation: the marks
75
+ * carry the data and the line between them is a guess. Above it the shape is
76
+ * the information and marks only add noise.
77
+ */
78
+ export declare const SPARSE_POINT_COUNT = 4;
79
+ /** How a series decides whether to draw a mark at each of its readings. */
80
+ export type PointMarkerMode = boolean | 'auto';
81
+ /**
82
+ * Whether a series should mark its readings.
83
+ *
84
+ * A series with fewer than two readings has **no line to draw**: d3 emits a
85
+ * zero-length path, which paints at most whatever the line cap leaks. The mark
86
+ * is then the only thing standing for the data, so it wins even over an
87
+ * explicit `false` — an empty plot holding a reading is worse than a mark the
88
+ * caller did not ask for.
89
+ *
90
+ * Past that, `'auto'` counts readings rather than measuring the gap between
91
+ * them. Pixel spacing looks more faithful to the eye, and single charts that
92
+ * resize are where the libraries that use it live; but a dashboard puts the
93
+ * same series in tiles of different widths, and a rule read off the width makes
94
+ * two widgets showing one day disagree about whether that day has marks. The
95
+ * count does not move when the tile does.
96
+ */
97
+ export declare function shouldMarkPoints(mode: PointMarkerMode, definedPoints: number): boolean;
98
+ //# sourceMappingURL=cartesianGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cartesianGeometry.d.ts","sourceRoot":"","sources":["../../src/primitives/cartesianGeometry.ts"],"names":[],"mappings":"AAAA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AAC3F,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,aAAa,CAElE;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,GAAG,OAAO,CAErE;AAED,2CAA2C;AAC3C,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAEtD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAItG;AAED,0FAA0F;AAC1F,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAK1G;AAED,6FAA6F;AAC7F,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAEjG;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC,2EAA2E;AAC3E,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,CAAC;AAE/C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAItF"}
@@ -0,0 +1,13 @@
1
+ import type * as React from 'react';
2
+ /**
3
+ * The in-chart badge vocabulary shared by `ReferenceLine` labels and the
4
+ * `ChartBrush` range label, so the two annotations read as one system. The
5
+ * badge is rendered in a `foreignObject`, which needs a width up front — hence
6
+ * the estimate, sized for the 10 px label face.
7
+ */
8
+ export declare const CHART_BADGE_HEIGHT = 20;
9
+ export declare const CHART_BADGE_CLASS = "inline-flex items-center rounded-md border px-1.5 py-0.5 text-[10px] leading-none font-medium";
10
+ export declare function estimateChartBadgeWidth(charCount: number): number;
11
+ /** Text and border in `color`, on a 10 % tint of it over the page surface — flips with the theme. */
12
+ export declare function chartBadgeStyle(color: string): React.CSSProperties;
13
+ //# sourceMappingURL=chartBadge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chartBadge.d.ts","sourceRoot":"","sources":["../../src/primitives/chartBadge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC;;;;;GAKG;AAEH,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAKrC,eAAO,MAAM,iBAAiB,kGACmE,CAAC;AAElG,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED,qGAAqG;AACrG,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CAMlE"}
@@ -16,8 +16,9 @@ export type { CategoryAxisProps, ValueAxisProps } from './Axis';
16
16
  export { roundedRectPath } from './roundedRect';
17
17
  export type { CornerRadii } from './roundedRect';
18
18
  export { ChartSlotsProvider, useChartSlots } from './ChartSlots';
19
- export type { ChartSlotsProviderProps, LegendSlot, TooltipSlot } from './ChartSlots';
19
+ export type { BrushSlot, ChartSlotsProviderProps, LegendSlot, TooltipSlot } from './ChartSlots';
20
20
  export { useResolvedCssLength } from './useResolvedCssLength';
21
+ export { findDuplicateCategories, useDevWarning } from './useDevWarning';
21
22
  export { CartesianChart } from './CartesianChart';
22
23
  export type { CartesianChartProps, CartesianDataPoint } from './CartesianChart';
23
24
  export { CartesianContext, useCartesianContext } from './CartesianContext';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/primitives/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D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AuB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { BrushSlot } from './ChartSlots';
2
+ import { CartesianLayout, CategoryCenters, CategoryRange } from './cartesianGeometry';
3
+ import * as React from 'react';
4
+ /** Pixels a press must travel before it stops being a click. */
5
+ export declare const BRUSH_DRAG_THRESHOLD = 4;
6
+ export interface ChartBrushDraft {
7
+ readonly range: CategoryRange;
8
+ /** Narrower than `minCategories`: drawn as a measurement, cancelled on release. */
9
+ readonly tooNarrow: boolean;
10
+ }
11
+ export interface UseChartBrushOptions {
12
+ readonly slot: BrushSlot | null;
13
+ readonly centers: CategoryCenters;
14
+ /** Length of the plot along the category axis. */
15
+ readonly extent: number;
16
+ readonly layout: CartesianLayout;
17
+ /** Inset of the plot inside the plot area. */
18
+ readonly margin: {
19
+ readonly left: number;
20
+ readonly top: number;
21
+ };
22
+ readonly plotRef: React.RefObject<HTMLDivElement | null>;
23
+ /** Fired once when a press turns into a drag, so the chart can drop its hover state. */
24
+ readonly onDragStart: () => void;
25
+ /** Identity of the category sequence; a change mid-drag cancels the gesture. */
26
+ readonly categoryKey: string;
27
+ }
28
+ export interface ChartBrushPointerHandlers {
29
+ readonly onPointerDown: (event: React.PointerEvent<HTMLDivElement>) => void;
30
+ readonly onPointerMove: (event: React.PointerEvent<HTMLDivElement>) => void;
31
+ readonly onPointerUp: (event: React.PointerEvent<HTMLDivElement>) => void;
32
+ readonly onPointerCancel: (event: React.PointerEvent<HTMLDivElement>) => void;
33
+ readonly onLostPointerCapture: (event: React.PointerEvent<HTMLDivElement>) => void;
34
+ }
35
+ export interface ChartBrushApi {
36
+ /** A brush is registered and enabled: the plot takes the gesture. */
37
+ readonly active: boolean;
38
+ /** The band being drawn, or null between gestures. */
39
+ readonly draft: ChartBrushDraft | null;
40
+ /** True while a drag is in flight — hover stands down. */
41
+ readonly isDragging: () => boolean;
42
+ readonly handlers: ChartBrushPointerHandlers;
43
+ }
44
+ /**
45
+ * The pointer state machine behind `<ChartBrush>`. Lives in the chart
46
+ * renderer, next to hover, and keeps its draft in local state: only the
47
+ * overlay reads it, so a drag never touches `CartesianContext` and never
48
+ * re-renders the series.
49
+ */
50
+ export declare function useChartBrush(options: UseChartBrushOptions): ChartBrushApi;
51
+ //# sourceMappingURL=useChartBrush.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useChartBrush.d.ts","sourceRoot":"","sources":["../../src/primitives/useChart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AAW,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC1E,QAAQ,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC9E,QAAQ,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CACpF;AAED,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IACvC,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,EAAE,MAAM,OAAO,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;CAC9C;AAyCD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CA8I1E"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Warns once, in development only, about a misuse the chart can detect but not
3
+ * fix. Pass `null` when there is nothing to say.
4
+ *
5
+ * The warning fires from an effect rather than the render body so it survives
6
+ * re-renders without repeating: a chart whose consumer re-renders on every
7
+ * pointer move would otherwise fill the console. The latch is keyed on the
8
+ * message, so a different problem still gets through and the same problem
9
+ * stays quiet.
10
+ *
11
+ * `import.meta.env.DEV` is replaced at build time, so nothing here survives
12
+ * into a production bundle.
13
+ */
14
+ export declare function useDevWarning(message: string | null): void;
15
+ /**
16
+ * Lists the categories that appear more than once, in first-seen order.
17
+ * Empty when every category is unique, which is the case the caller wants to
18
+ * pay nothing for.
19
+ */
20
+ export declare function findDuplicateCategories(categories: readonly string[]): string[];
21
+ //# sourceMappingURL=useDevWarning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDevWarning.d.ts","sourceRoot":"","sources":["../../src/primitives/useDevWarning.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAS1D;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAQ/E"}