layerchart 2.0.0-next.0 → 2.0.0-next.2
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/actions/movable.d.ts +28 -0
- package/dist/actions/movable.js +91 -0
- package/dist/components/AnnotationLine.svelte +155 -0
- package/dist/components/AnnotationLine.svelte.d.ts +28 -0
- package/dist/components/AnnotationPoint.svelte +121 -0
- package/dist/components/AnnotationPoint.svelte.d.ts +32 -0
- package/dist/components/AnnotationRange.svelte +147 -0
- package/dist/components/AnnotationRange.svelte.d.ts +40 -0
- package/dist/components/Arc.svelte +344 -151
- package/dist/components/Arc.svelte.d.ts +138 -0
- package/dist/components/Area.svelte +165 -149
- package/dist/components/Area.svelte.d.ts +45 -0
- package/dist/components/Axis.svelte +287 -174
- package/dist/components/Axis.svelte.d.ts +116 -0
- package/dist/components/Bar.svelte +163 -107
- package/dist/components/Bar.svelte.d.ts +48 -0
- package/dist/components/Bars.svelte +54 -68
- package/dist/components/Bars.svelte.d.ts +27 -0
- package/dist/components/Blur.svelte +31 -7
- package/dist/components/Blur.svelte.d.ts +23 -21
- package/dist/components/Bounds.svelte +49 -19
- package/dist/components/Bounds.svelte.d.ts +24 -50
- package/dist/components/BrushContext.svelte +296 -168
- package/dist/components/BrushContext.svelte.d.ts +97 -65
- package/dist/components/Calendar.svelte +116 -59
- package/dist/components/Calendar.svelte.d.ts +50 -31
- package/dist/components/Chart.svelte +1289 -398
- package/dist/components/Chart.svelte.d.ts +535 -410
- package/dist/components/ChartClipPath.svelte +37 -15
- package/dist/components/ChartClipPath.svelte.d.ts +21 -19
- package/dist/components/Circle.svelte +124 -85
- package/dist/components/Circle.svelte.d.ts +52 -0
- package/dist/components/CircleClipPath.svelte +76 -16
- package/dist/components/CircleClipPath.svelte.d.ts +46 -0
- package/dist/components/ClipPath.svelte +60 -15
- package/dist/components/ClipPath.svelte.d.ts +40 -27
- package/dist/components/ColorRamp.svelte +75 -9
- package/dist/components/ColorRamp.svelte.d.ts +37 -19
- package/dist/components/ComputedStyles.svelte +17 -5
- package/dist/components/ComputedStyles.svelte.d.ts +11 -19
- package/dist/components/Connector.svelte +149 -0
- package/dist/components/Connector.svelte.d.ts +51 -0
- package/dist/components/Dagre.svelte +211 -122
- package/dist/components/Dagre.svelte.d.ts +119 -56
- package/dist/components/ForceSimulation.svelte +215 -90
- package/dist/components/ForceSimulation.svelte.d.ts +82 -35
- package/dist/components/Frame.svelte +33 -13
- package/dist/components/Frame.svelte.d.ts +13 -17
- package/dist/components/GeoCircle.svelte +29 -16
- package/dist/components/GeoCircle.svelte.d.ts +22 -24
- package/dist/components/GeoContext.svelte +113 -72
- package/dist/components/GeoContext.svelte.d.ts +49 -41
- package/dist/components/GeoEdgeFade.svelte +47 -12
- package/dist/components/GeoEdgeFade.svelte.d.ts +17 -19
- package/dist/components/GeoPath.svelte +157 -127
- package/dist/components/GeoPath.svelte.d.ts +48 -36
- package/dist/components/GeoPoint.svelte +52 -20
- package/dist/components/GeoPoint.svelte.d.ts +25 -22
- package/dist/components/GeoSpline.svelte +75 -26
- package/dist/components/GeoSpline.svelte.d.ts +29 -20
- package/dist/components/GeoTile.svelte +100 -49
- package/dist/components/GeoTile.svelte.d.ts +38 -23
- package/dist/components/GeoVisible.svelte +17 -9
- package/dist/components/GeoVisible.svelte.d.ts +10 -18
- package/dist/components/Graticule.svelte +28 -13
- package/dist/components/Graticule.svelte.d.ts +11 -52
- package/dist/components/Grid.svelte +226 -114
- package/dist/components/Grid.svelte.d.ts +70 -0
- package/dist/components/Group.svelte +132 -105
- package/dist/components/Group.svelte.d.ts +53 -0
- package/dist/components/Highlight.svelte +409 -307
- package/dist/components/Highlight.svelte.d.ts +107 -0
- package/dist/components/Hull.svelte +96 -45
- package/dist/components/Hull.svelte.d.ts +40 -30
- package/dist/components/Labels.svelte +125 -46
- package/dist/components/Labels.svelte.d.ts +70 -27
- package/dist/components/Legend.svelte +374 -190
- package/dist/components/Legend.svelte.d.ts +95 -44
- package/dist/components/Line.svelte +163 -125
- package/dist/components/Line.svelte.d.ts +75 -0
- package/dist/components/LinearGradient.svelte +153 -78
- package/dist/components/LinearGradient.svelte.d.ts +66 -31
- package/dist/components/Link.svelte +160 -104
- package/dist/components/Link.svelte.d.ts +54 -0
- package/dist/components/Marker.svelte +100 -39
- package/dist/components/Marker.svelte.d.ts +59 -27
- package/dist/components/MarkerWrapper.svelte +35 -0
- package/dist/components/MarkerWrapper.svelte.d.ts +18 -0
- package/dist/components/MonthPath.svelte +65 -20
- package/dist/components/MonthPath.svelte.d.ts +23 -17
- package/dist/components/MotionPath.svelte +80 -24
- package/dist/components/MotionPath.svelte.d.ts +46 -27
- package/dist/components/Pack.svelte +53 -17
- package/dist/components/Pack.svelte.d.ts +42 -21
- package/dist/components/Partition.svelte +64 -22
- package/dist/components/Partition.svelte.d.ts +49 -26
- package/dist/components/Pattern.svelte +297 -11
- package/dist/components/Pattern.svelte.d.ts +103 -19
- package/dist/components/Pie.svelte +122 -76
- package/dist/components/Pie.svelte.d.ts +65 -51
- package/dist/components/Point.svelte +20 -9
- package/dist/components/Point.svelte.d.ts +16 -20
- package/dist/components/Points.svelte +148 -137
- package/dist/components/Points.svelte.d.ts +45 -34
- package/dist/components/RadialGradient.svelte +143 -70
- package/dist/components/RadialGradient.svelte.d.ts +69 -31
- package/dist/components/Rect.svelte +121 -102
- package/dist/components/Rect.svelte.d.ts +36 -0
- package/dist/components/RectClipPath.svelte +82 -18
- package/dist/components/RectClipPath.svelte.d.ts +55 -0
- package/dist/components/Rule.svelte +105 -62
- package/dist/components/Rule.svelte.d.ts +40 -19
- package/dist/components/Sankey.svelte +132 -55
- package/dist/components/Sankey.svelte.d.ts +61 -31
- package/dist/components/Spline.svelte +281 -218
- package/dist/components/Spline.svelte.d.ts +95 -0
- package/dist/components/Text.svelte +437 -176
- package/dist/components/Text.svelte.d.ts +130 -0
- package/dist/components/Threshold.svelte +48 -16
- package/dist/components/Threshold.svelte.d.ts +29 -31
- package/dist/components/TileImage.svelte +103 -30
- package/dist/components/TileImage.svelte.d.ts +48 -23
- package/dist/components/TransformContext.svelte +365 -171
- package/dist/components/TransformControls.svelte +50 -26
- package/dist/components/TransformControls.svelte.d.ts +27 -19
- package/dist/components/Tree.svelte +74 -33
- package/dist/components/Tree.svelte.d.ts +42 -30
- package/dist/components/Treemap.svelte +119 -42
- package/dist/components/Treemap.svelte.d.ts +75 -27
- package/dist/components/Voronoi.svelte +106 -75
- package/dist/components/Voronoi.svelte.d.ts +40 -41
- package/dist/components/charts/ArcChart.svelte +464 -0
- package/dist/components/charts/ArcChart.svelte.d.ts +90 -0
- package/dist/components/charts/AreaChart.svelte +450 -393
- package/dist/components/charts/AreaChart.svelte.d.ts +61 -0
- package/dist/components/charts/BarChart.svelte +454 -389
- package/dist/components/charts/BarChart.svelte.d.ts +76 -0
- package/dist/components/charts/ChartAnnotations.svelte +37 -0
- package/dist/components/charts/ChartAnnotations.svelte.d.ts +10 -0
- package/dist/components/charts/DefaultTooltip.svelte +60 -0
- package/dist/components/charts/DefaultTooltip.svelte.d.ts +10 -0
- package/dist/components/charts/LineChart.svelte +369 -314
- package/dist/components/charts/LineChart.svelte.d.ts +53 -0
- package/dist/components/charts/PieChart.svelte +458 -316
- package/dist/components/charts/PieChart.svelte.d.ts +137 -353
- package/dist/components/charts/ScatterChart.svelte +334 -296
- package/dist/components/charts/ScatterChart.svelte.d.ts +39 -0
- package/dist/components/charts/index.d.ts +8 -0
- package/dist/components/charts/index.js +7 -0
- package/dist/components/charts/types.d.ts +253 -0
- package/dist/components/charts/utils.svelte.d.ts +30 -0
- package/dist/components/charts/utils.svelte.js +55 -0
- package/dist/components/index.d.ts +76 -4
- package/dist/components/index.js +76 -5
- package/dist/components/layout/Canvas.svelte +321 -155
- package/dist/components/layout/Canvas.svelte.d.ts +104 -55
- package/dist/components/layout/Html.svelte +82 -42
- package/dist/components/layout/Html.svelte.d.ts +39 -28
- package/dist/components/layout/Layer.svelte +39 -0
- package/dist/components/layout/Layer.svelte.d.ts +17 -0
- package/dist/components/layout/Svg.svelte +122 -70
- package/dist/components/layout/Svg.svelte.d.ts +53 -34
- package/dist/components/layout/WebGL.svelte +135 -0
- package/dist/components/layout/WebGL.svelte.d.ts +50 -0
- package/dist/components/tooltip/Tooltip.svelte +246 -78
- package/dist/components/tooltip/Tooltip.svelte.d.ts +149 -31
- package/dist/components/tooltip/TooltipContext.svelte +409 -271
- package/dist/components/tooltip/TooltipContext.svelte.d.ts +86 -55
- package/dist/components/tooltip/TooltipHeader.svelte +100 -11
- package/dist/components/tooltip/TooltipHeader.svelte.d.ts +43 -23
- package/dist/components/tooltip/TooltipItem.svelte +167 -27
- package/dist/components/tooltip/TooltipItem.svelte.d.ts +63 -31
- package/dist/components/tooltip/TooltipList.svelte +22 -3
- package/dist/components/tooltip/TooltipList.svelte.d.ts +6 -17
- package/dist/components/tooltip/TooltipSeparator.svelte +27 -1
- package/dist/components/tooltip/TooltipSeparator.svelte.d.ts +6 -15
- package/dist/components/tooltip/index.d.ts +6 -0
- package/dist/components/tooltip/index.js +6 -0
- package/dist/components/tooltip/tooltipMetaContext.d.ts +79 -0
- package/dist/components/tooltip/tooltipMetaContext.js +139 -0
- package/dist/components/types.d.ts +1 -0
- package/dist/components/types.js +1 -0
- package/dist/docs/Blockquote.svelte.d.ts +18 -14
- package/dist/docs/Code.svelte.d.ts +26 -22
- package/dist/docs/ConnectorSweepMenuField.svelte +17 -0
- package/dist/docs/ConnectorSweepMenuField.svelte.d.ts +7 -0
- package/dist/docs/ConnectorTypeMenuField.svelte +17 -0
- package/dist/docs/ConnectorTypeMenuField.svelte.d.ts +7 -0
- package/dist/docs/CurveMenuField.svelte +14 -3
- package/dist/docs/CurveMenuField.svelte.d.ts +9 -18
- package/dist/docs/GeoDebug.svelte +47 -42
- package/dist/docs/GeoDebug.svelte.d.ts +4 -16
- package/dist/docs/Header1.svelte.d.ts +27 -16
- package/dist/docs/Json.svelte.d.ts +20 -16
- package/dist/docs/Layout.svelte.d.ts +18 -13
- package/dist/docs/Link.svelte.d.ts +33 -21
- package/dist/docs/PathDataMenuField.svelte +14 -10
- package/dist/docs/PathDataMenuField.svelte.d.ts +8 -18
- package/dist/docs/Preview.svelte +20 -7
- package/dist/docs/Preview.svelte.d.ts +12 -22
- package/dist/docs/TilesetField.svelte.d.ts +21 -17
- package/dist/docs/TransformDebug.svelte +5 -6
- package/dist/docs/TransformDebug.svelte.d.ts +18 -14
- package/dist/docs/ViewSourceButton.svelte.d.ts +21 -17
- package/dist/types/d3-shape-extentions.d.ts +7 -0
- package/dist/utils/afterTick.d.ts +5 -0
- package/dist/utils/afterTick.js +8 -0
- package/dist/utils/arcText.svelte.d.ts +57 -0
- package/dist/utils/arcText.svelte.js +262 -0
- package/dist/utils/array.d.ts +9 -1
- package/dist/utils/array.js +13 -0
- package/dist/utils/attributes.d.ts +29 -0
- package/dist/utils/attributes.js +40 -0
- package/dist/utils/canvas.js +47 -10
- package/dist/utils/chart.d.ts +78 -0
- package/dist/utils/chart.js +512 -0
- package/dist/utils/color.d.ts +1 -0
- package/dist/utils/color.js +8 -0
- package/dist/utils/common.d.ts +3 -5
- package/dist/utils/common.js +3 -2
- package/dist/utils/connectorUtils.d.ts +21 -0
- package/dist/utils/connectorUtils.js +111 -0
- package/dist/utils/createId.d.ts +7 -0
- package/dist/utils/createId.js +9 -0
- package/dist/utils/debug.d.ts +1 -0
- package/dist/utils/debug.js +84 -0
- package/dist/utils/filterObject.d.ts +9 -0
- package/dist/utils/filterObject.js +12 -0
- package/dist/utils/graph/dagre.d.ts +34 -0
- package/dist/utils/graph/dagre.js +78 -0
- package/dist/utils/graph/dagre.test.d.ts +1 -0
- package/dist/utils/{graph.test.js → graph/dagre.test.js} +19 -33
- package/dist/utils/graph/sankey.d.ts +28 -0
- package/dist/utils/{graph.js → graph/sankey.js} +13 -41
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.js +3 -1
- package/dist/utils/key.svelte.d.ts +3 -0
- package/dist/utils/key.svelte.js +11 -0
- package/dist/utils/legendPayload.d.ts +7 -0
- package/dist/utils/legendPayload.js +8 -0
- package/dist/utils/motion.svelte.d.ts +140 -0
- package/dist/utils/motion.svelte.js +180 -0
- package/dist/utils/motion.test.d.ts +1 -0
- package/dist/utils/motion.test.js +213 -0
- package/dist/utils/{rect.d.ts → rect.svelte.d.ts} +7 -4
- package/dist/utils/rect.svelte.js +105 -0
- package/dist/utils/scales.svelte.d.ts +90 -0
- package/dist/utils/{scales.js → scales.svelte.js} +100 -39
- package/dist/utils/stack.d.ts +2 -3
- package/dist/utils/stack.js +1 -1
- package/dist/utils/string.js +87 -0
- package/dist/utils/ticks.d.ts +8 -2
- package/dist/utils/ticks.js +28 -0
- package/dist/utils/ticks.test.d.ts +1 -0
- package/dist/utils/ticks.test.js +67 -0
- package/dist/utils/types.d.ts +81 -0
- package/package.json +25 -24
- package/dist/components/ChartContext.svelte +0 -295
- package/dist/components/ChartContext.svelte.d.ts +0 -139
- package/dist/components/TransformContext.svelte.d.ts +0 -158
- package/dist/stores/motionStore.d.ts +0 -30
- package/dist/stores/motionStore.js +0 -62
- package/dist/utils/graph.d.ts +0 -37
- package/dist/utils/rect.js +0 -107
- package/dist/utils/scales.d.ts +0 -66
- /package/dist/{utils/graph.test.d.ts → components/charts/types.js} +0 -0
|
@@ -1,63 +1,94 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
export declare const tooltipContextKey: unique symbol;
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { Without } from '../../utils/types.js';
|
|
4
3
|
type TooltipMode = 'bisect-x' | 'bisect-y' | 'band' | 'bisect-band' | 'bounds' | 'voronoi' | 'quadtree' | 'manual';
|
|
5
|
-
export type TooltipContextValue = {
|
|
4
|
+
export type TooltipContextValue<T = any> = {
|
|
6
5
|
x: number;
|
|
7
6
|
y: number;
|
|
8
|
-
data:
|
|
9
|
-
|
|
7
|
+
data: T | null;
|
|
8
|
+
payload: TooltipPayload[];
|
|
9
|
+
show(e: PointerEvent, tooltipData?: any, payload?: TooltipPayload): void;
|
|
10
10
|
hide(e?: PointerEvent): void;
|
|
11
11
|
mode: TooltipMode;
|
|
12
|
+
isHoveringTooltipArea: boolean;
|
|
13
|
+
isHoveringTooltipContent: boolean;
|
|
12
14
|
};
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
15
|
+
export declare function getTooltipContext<T = any>(): TooltipContextValue<T>;
|
|
16
|
+
type TooltipContextPropsWithoutHTML<T = any> = {
|
|
17
|
+
/**
|
|
18
|
+
* The tooltip interaction mode
|
|
19
|
+
* @default 'manual'
|
|
20
|
+
*/
|
|
21
|
+
mode?: TooltipMode;
|
|
22
|
+
/**
|
|
23
|
+
* Method to find tooltip data
|
|
24
|
+
* @default 'closest'
|
|
25
|
+
*/
|
|
26
|
+
findTooltipData?: 'closest' | 'left' | 'right';
|
|
27
|
+
/**
|
|
28
|
+
* Similar to d3-selection's raise, re-insert the e.target as the last child of its parent, so
|
|
29
|
+
* to be the top-most element
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
raiseTarget?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Lock tooltip (keep open, do not update on mouse movement). Allows for clicking on tooltip
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
locked?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* quadtree search radius
|
|
40
|
+
* @default Infinity
|
|
41
|
+
*/
|
|
42
|
+
radius?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Enable debug view (show hit targets, etc)
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
debug?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Click handler for the tooltip
|
|
50
|
+
* @default () => {}
|
|
51
|
+
*/
|
|
52
|
+
onclick?: (e: MouseEvent, { data }: {
|
|
53
|
+
data: any;
|
|
54
|
+
}) => any;
|
|
55
|
+
/**
|
|
56
|
+
* Exposed to allow binding in Chart
|
|
57
|
+
* @default { x: 0, y: 0, data: null, show: showTooltip, hide: hideTooltip, mode }
|
|
58
|
+
*/
|
|
59
|
+
tooltipContext?: TooltipContextValue<T>;
|
|
60
|
+
/**
|
|
61
|
+
* Delay in ms before hiding tooltip
|
|
62
|
+
* @default 0
|
|
63
|
+
*/
|
|
64
|
+
hideDelay?: number;
|
|
65
|
+
/**
|
|
66
|
+
* A reference to the tooltip container element.
|
|
67
|
+
*
|
|
68
|
+
* @bindable
|
|
69
|
+
*/
|
|
70
|
+
ref?: HTMLElement;
|
|
71
|
+
children?: Snippet<[{
|
|
72
|
+
tooltipContext: TooltipContextValue<T>;
|
|
73
|
+
}]>;
|
|
57
74
|
};
|
|
58
|
-
export type TooltipContextProps =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
75
|
+
export type TooltipContextProps<T = any> = TooltipContextPropsWithoutHTML<T> & Without<HTMLAttributes<HTMLElement>, TooltipContextPropsWithoutHTML<T>>;
|
|
76
|
+
import type { Snippet } from 'svelte';
|
|
77
|
+
import { type TooltipPayload } from './tooltipMetaContext.js';
|
|
78
|
+
declare class __sveltets_Render<TData = any> {
|
|
79
|
+
props(): TooltipContextProps<TData>;
|
|
80
|
+
events(): {};
|
|
81
|
+
slots(): {};
|
|
82
|
+
bindings(): "ref" | "tooltipContext";
|
|
83
|
+
exports(): {};
|
|
62
84
|
}
|
|
63
|
-
|
|
85
|
+
interface $$IsomorphicComponent {
|
|
86
|
+
new <TData = any>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TData>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TData>['props']>, ReturnType<__sveltets_Render<TData>['events']>, ReturnType<__sveltets_Render<TData>['slots']>> & {
|
|
87
|
+
$$bindings?: ReturnType<__sveltets_Render<TData>['bindings']>;
|
|
88
|
+
} & ReturnType<__sveltets_Render<TData>['exports']>;
|
|
89
|
+
<TData = any>(internal: unknown, props: ReturnType<__sveltets_Render<TData>['props']> & {}): ReturnType<__sveltets_Render<TData>['exports']>;
|
|
90
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
91
|
+
}
|
|
92
|
+
declare const TooltipContext: $$IsomorphicComponent;
|
|
93
|
+
type TooltipContext<TData = any> = InstanceType<typeof TooltipContext<TData>>;
|
|
94
|
+
export default TooltipContext;
|
|
@@ -1,30 +1,119 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { Without } from '../../utils/types.js';
|
|
5
|
+
|
|
6
|
+
export type TooltipHeaderPropsWithoutHTML = {
|
|
7
|
+
/**
|
|
8
|
+
* The value to display in the tooltip header when the `children`
|
|
9
|
+
* snippet is not provided.
|
|
10
|
+
*/
|
|
11
|
+
value?: any;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The format to use when displaying the value.
|
|
15
|
+
*/
|
|
16
|
+
format?: FormatType;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The color to use for the color dot.
|
|
20
|
+
*/
|
|
21
|
+
color?: string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Classes to apply to the parts of the tooltip header.
|
|
25
|
+
*/
|
|
26
|
+
classes?: {
|
|
27
|
+
root?: string;
|
|
28
|
+
color?: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Props to pass to the underlying elements rendered
|
|
33
|
+
*/
|
|
34
|
+
props?: {
|
|
35
|
+
root?: HTMLAttributes<HTMLElement>;
|
|
36
|
+
color?: HTMLAttributes<HTMLElement>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A reference to the tooltip header's outermost `<div>` tag.
|
|
41
|
+
*/
|
|
42
|
+
ref?: HTMLElement;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A reference to the tooltip header's color `<div>` tag.
|
|
46
|
+
*/
|
|
47
|
+
colorRef?: HTMLElement;
|
|
48
|
+
|
|
49
|
+
children?: Snippet;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type TooltipHeaderProps = TooltipHeaderPropsWithoutHTML &
|
|
53
|
+
Without<HTMLAttributes<HTMLElement>, TooltipHeaderPropsWithoutHTML>;
|
|
54
|
+
</script>
|
|
55
|
+
|
|
1
56
|
<script lang="ts">
|
|
2
57
|
import { format as formatUtil, type FormatType } from '@layerstack/utils';
|
|
3
58
|
import { cls } from '@layerstack/tailwind';
|
|
59
|
+
import { layerClass } from '../../utils/attributes.js';
|
|
4
60
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
61
|
+
let {
|
|
62
|
+
ref: refProp = $bindable(),
|
|
63
|
+
colorRef: colorRefProp = $bindable(),
|
|
64
|
+
value,
|
|
65
|
+
format,
|
|
66
|
+
color,
|
|
67
|
+
classes = {
|
|
68
|
+
root: '',
|
|
69
|
+
color: '',
|
|
70
|
+
},
|
|
71
|
+
props = {
|
|
72
|
+
root: {},
|
|
73
|
+
color: {},
|
|
74
|
+
},
|
|
75
|
+
class: className,
|
|
76
|
+
children,
|
|
77
|
+
...restProps
|
|
78
|
+
}: TooltipHeaderProps = $props();
|
|
8
79
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
80
|
+
let ref = $state<HTMLElement>();
|
|
81
|
+
let colorRef = $state<HTMLElement>();
|
|
82
|
+
|
|
83
|
+
$effect.pre(() => {
|
|
84
|
+
refProp = ref;
|
|
85
|
+
});
|
|
86
|
+
$effect.pre(() => {
|
|
87
|
+
colorRefProp = colorRef;
|
|
88
|
+
});
|
|
13
89
|
</script>
|
|
14
90
|
|
|
15
91
|
<div
|
|
16
92
|
class={cls(
|
|
17
|
-
'
|
|
93
|
+
layerClass('tooltip-header'),
|
|
18
94
|
'font-semibold whitespace-nowrap border-b mb-1 pb-1 flex items-center gap-2',
|
|
19
95
|
classes.root,
|
|
20
|
-
|
|
96
|
+
props.root?.class,
|
|
97
|
+
className
|
|
21
98
|
)}
|
|
99
|
+
{...restProps}
|
|
100
|
+
bind:this={ref}
|
|
22
101
|
>
|
|
23
102
|
{#if color}
|
|
24
103
|
<div
|
|
25
|
-
|
|
104
|
+
bind:this={colorRef}
|
|
105
|
+
class={cls(
|
|
106
|
+
layerClass('tooltip-header-color'),
|
|
107
|
+
'color',
|
|
108
|
+
'inline-block size-2 rounded-full bg-[var(--color)]',
|
|
109
|
+
classes.color
|
|
110
|
+
)}
|
|
26
111
|
style:--color={color}
|
|
27
112
|
></div>
|
|
28
113
|
{/if}
|
|
29
|
-
|
|
114
|
+
{#if children}
|
|
115
|
+
{@render children?.()}
|
|
116
|
+
{:else}
|
|
117
|
+
{format ? formatUtil(value, format) : value}
|
|
118
|
+
{/if}
|
|
30
119
|
</div>
|
|
@@ -1,26 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { Without } from '../../utils/types.js';
|
|
4
|
+
export type TooltipHeaderPropsWithoutHTML = {
|
|
5
|
+
/**
|
|
6
|
+
* The value to display in the tooltip header when the `children`
|
|
7
|
+
* snippet is not provided.
|
|
8
|
+
*/
|
|
9
|
+
value?: any;
|
|
10
|
+
/**
|
|
11
|
+
* The format to use when displaying the value.
|
|
12
|
+
*/
|
|
13
|
+
format?: FormatType;
|
|
14
|
+
/**
|
|
15
|
+
* The color to use for the color dot.
|
|
16
|
+
*/
|
|
17
|
+
color?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Classes to apply to the parts of the tooltip header.
|
|
20
|
+
*/
|
|
21
|
+
classes?: {
|
|
22
|
+
root?: string;
|
|
23
|
+
color?: string;
|
|
16
24
|
};
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Props to pass to the underlying elements rendered
|
|
27
|
+
*/
|
|
28
|
+
props?: {
|
|
29
|
+
root?: HTMLAttributes<HTMLElement>;
|
|
30
|
+
color?: HTMLAttributes<HTMLElement>;
|
|
19
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* A reference to the tooltip header's outermost `<div>` tag.
|
|
34
|
+
*/
|
|
35
|
+
ref?: HTMLElement;
|
|
36
|
+
/**
|
|
37
|
+
* A reference to the tooltip header's color `<div>` tag.
|
|
38
|
+
*/
|
|
39
|
+
colorRef?: HTMLElement;
|
|
40
|
+
children?: Snippet;
|
|
20
41
|
};
|
|
21
|
-
export type TooltipHeaderProps =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export {};
|
|
42
|
+
export type TooltipHeaderProps = TooltipHeaderPropsWithoutHTML & Without<HTMLAttributes<HTMLElement>, TooltipHeaderPropsWithoutHTML>;
|
|
43
|
+
import { type FormatType } from '@layerstack/utils';
|
|
44
|
+
declare const TooltipHeader: import("svelte").Component<TooltipHeaderProps, {}, "ref" | "colorRef">;
|
|
45
|
+
type TooltipHeader = ReturnType<typeof TooltipHeader>;
|
|
46
|
+
export default TooltipHeader;
|
|
@@ -1,45 +1,181 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { Without } from '../../utils/types.js';
|
|
4
|
+
|
|
5
|
+
export type TooltipItemPropsWithoutHTML = {
|
|
6
|
+
/**
|
|
7
|
+
* The label to display in the tooltip item.
|
|
8
|
+
*/
|
|
9
|
+
label?: string | number | null | undefined | Snippet;
|
|
10
|
+
/**
|
|
11
|
+
* Value to be formatted and displayed in absence of the
|
|
12
|
+
* default `children` snippet
|
|
13
|
+
*/
|
|
14
|
+
value?: any;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Format to use when displaying the value.
|
|
18
|
+
*/
|
|
19
|
+
format?: FormatType;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Alignment of the value.
|
|
23
|
+
*
|
|
24
|
+
* @default 'left'
|
|
25
|
+
*/
|
|
26
|
+
valueAlign?: 'left' | 'right' | 'center';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Color to use for the color dot.
|
|
30
|
+
*/
|
|
31
|
+
color?: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Classes to apply to the parts of the tooltip item.
|
|
35
|
+
*
|
|
36
|
+
* @default {}
|
|
37
|
+
*/
|
|
38
|
+
classes?: {
|
|
39
|
+
root?: string;
|
|
40
|
+
label?: string;
|
|
41
|
+
value?: string;
|
|
42
|
+
color?: string;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
props?: {
|
|
46
|
+
root?: HTMLAttributes<HTMLElement>;
|
|
47
|
+
label?: HTMLAttributes<HTMLElement>;
|
|
48
|
+
value?: HTMLAttributes<HTMLElement>;
|
|
49
|
+
color?: HTMLAttributes<HTMLElement>;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A reference to the tooltip item's outermost `<div>` tag.
|
|
54
|
+
*/
|
|
55
|
+
ref?: HTMLElement;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A reference to the tooltip item's label `<div>` tag.
|
|
59
|
+
*/
|
|
60
|
+
labelRef?: HTMLElement;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* A reference to the tooltip item's value `<div>` tag.
|
|
64
|
+
*/
|
|
65
|
+
valueRef?: HTMLElement;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* A reference to the tooltip item's color `<div>` tag.
|
|
69
|
+
*/
|
|
70
|
+
colorRef?: HTMLElement;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type TooltipItemProps = TooltipItemPropsWithoutHTML &
|
|
74
|
+
Without<HTMLAttributes<HTMLElement>, TooltipItemPropsWithoutHTML>;
|
|
75
|
+
</script>
|
|
76
|
+
|
|
1
77
|
<script lang="ts">
|
|
2
78
|
import { format as formatUtil, type FormatType } from '@layerstack/utils';
|
|
3
79
|
import { cls } from '@layerstack/tailwind';
|
|
80
|
+
import type { Snippet } from 'svelte';
|
|
81
|
+
import { layerClass } from '../../utils/attributes.js';
|
|
4
82
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
83
|
+
let {
|
|
84
|
+
ref: refProp = $bindable(),
|
|
85
|
+
labelRef: labelRefProp = $bindable(),
|
|
86
|
+
valueRef: valueRefProp = $bindable(),
|
|
87
|
+
colorRef: colorRefProp = $bindable(),
|
|
88
|
+
label,
|
|
89
|
+
value,
|
|
90
|
+
format,
|
|
91
|
+
valueAlign = 'left',
|
|
92
|
+
color,
|
|
93
|
+
classes = {
|
|
94
|
+
root: '',
|
|
95
|
+
label: '',
|
|
96
|
+
value: '',
|
|
97
|
+
color: '',
|
|
98
|
+
},
|
|
99
|
+
props = {
|
|
100
|
+
root: {},
|
|
101
|
+
label: {},
|
|
102
|
+
value: {},
|
|
103
|
+
color: {},
|
|
104
|
+
},
|
|
105
|
+
class: className,
|
|
106
|
+
children,
|
|
107
|
+
...restProps
|
|
108
|
+
}: TooltipItemProps = $props();
|
|
109
|
+
|
|
110
|
+
let ref = $state<HTMLElement>();
|
|
111
|
+
let labelRef = $state<HTMLElement>();
|
|
112
|
+
let valueRef = $state<HTMLElement>();
|
|
113
|
+
let colorRef = $state<HTMLElement>();
|
|
114
|
+
|
|
115
|
+
$effect.pre(() => {
|
|
116
|
+
refProp = ref;
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
$effect.pre(() => {
|
|
120
|
+
labelRefProp = labelRef;
|
|
121
|
+
});
|
|
122
|
+
$effect.pre(() => {
|
|
123
|
+
valueRefProp = valueRef;
|
|
124
|
+
});
|
|
125
|
+
$effect.pre(() => {
|
|
126
|
+
colorRefProp = colorRef;
|
|
127
|
+
});
|
|
22
128
|
</script>
|
|
23
129
|
|
|
24
130
|
<div
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
131
|
+
{...props.root}
|
|
132
|
+
class={cls(
|
|
133
|
+
layerClass('tooltip-item-root'),
|
|
134
|
+
'contents',
|
|
135
|
+
classes.root,
|
|
136
|
+
className,
|
|
137
|
+
props.root?.class
|
|
138
|
+
)}
|
|
139
|
+
{...restProps}
|
|
140
|
+
bind:this={ref}
|
|
30
141
|
>
|
|
31
|
-
<div
|
|
142
|
+
<div
|
|
143
|
+
{...props.label}
|
|
144
|
+
class={cls(
|
|
145
|
+
layerClass('tooltip-item-label'),
|
|
146
|
+
'label',
|
|
147
|
+
'flex items-center gap-2 whitespace-nowrap',
|
|
148
|
+
classes.label,
|
|
149
|
+
props.label?.class
|
|
150
|
+
)}
|
|
151
|
+
bind:this={labelRef}
|
|
152
|
+
>
|
|
32
153
|
{#if color}
|
|
33
154
|
<div
|
|
34
|
-
|
|
155
|
+
{...props.color}
|
|
156
|
+
class={cls(
|
|
157
|
+
layerClass('tooltip-item-color'),
|
|
158
|
+
'color',
|
|
159
|
+
'inline-block size-2 rounded-full bg-[var(--color)]',
|
|
160
|
+
classes.color,
|
|
161
|
+
props.color?.class
|
|
162
|
+
)}
|
|
35
163
|
style:--color={color}
|
|
164
|
+
bind:this={colorRef}
|
|
36
165
|
></div>
|
|
37
166
|
{/if}
|
|
38
|
-
|
|
167
|
+
{#if typeof label === 'function'}
|
|
168
|
+
{@render label()}
|
|
169
|
+
{:else}
|
|
170
|
+
{label}
|
|
171
|
+
{/if}
|
|
39
172
|
</div>
|
|
40
173
|
|
|
41
174
|
<div
|
|
175
|
+
bind:this={valueRef}
|
|
176
|
+
{...props.value}
|
|
42
177
|
class={cls(
|
|
178
|
+
layerClass('tooltip-item-value'),
|
|
43
179
|
'value',
|
|
44
180
|
'tabular-nums',
|
|
45
181
|
{
|
|
@@ -47,9 +183,13 @@
|
|
|
47
183
|
'text-center': valueAlign === 'center',
|
|
48
184
|
},
|
|
49
185
|
classes.value,
|
|
50
|
-
|
|
186
|
+
props.value?.class
|
|
51
187
|
)}
|
|
52
188
|
>
|
|
53
|
-
|
|
189
|
+
{#if children}
|
|
190
|
+
{@render children()}
|
|
191
|
+
{:else}
|
|
192
|
+
{format ? formatUtil(value, format) : value}
|
|
193
|
+
{/if}
|
|
54
194
|
</div>
|
|
55
195
|
</div>
|
|
@@ -1,34 +1,66 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { Without } from '../../utils/types.js';
|
|
3
|
+
export type TooltipItemPropsWithoutHTML = {
|
|
4
|
+
/**
|
|
5
|
+
* The label to display in the tooltip item.
|
|
6
|
+
*/
|
|
7
|
+
label?: string | number | null | undefined | Snippet;
|
|
8
|
+
/**
|
|
9
|
+
* Value to be formatted and displayed in absence of the
|
|
10
|
+
* default `children` snippet
|
|
11
|
+
*/
|
|
12
|
+
value?: any;
|
|
13
|
+
/**
|
|
14
|
+
* Format to use when displaying the value.
|
|
15
|
+
*/
|
|
16
|
+
format?: FormatType;
|
|
17
|
+
/**
|
|
18
|
+
* Alignment of the value.
|
|
19
|
+
*
|
|
20
|
+
* @default 'left'
|
|
21
|
+
*/
|
|
22
|
+
valueAlign?: 'left' | 'right' | 'center';
|
|
23
|
+
/**
|
|
24
|
+
* Color to use for the color dot.
|
|
25
|
+
*/
|
|
26
|
+
color?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Classes to apply to the parts of the tooltip item.
|
|
29
|
+
*
|
|
30
|
+
* @default {}
|
|
31
|
+
*/
|
|
32
|
+
classes?: {
|
|
33
|
+
root?: string;
|
|
34
|
+
label?: string;
|
|
35
|
+
value?: string;
|
|
36
|
+
color?: string;
|
|
23
37
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
38
|
+
props?: {
|
|
39
|
+
root?: HTMLAttributes<HTMLElement>;
|
|
40
|
+
label?: HTMLAttributes<HTMLElement>;
|
|
41
|
+
value?: HTMLAttributes<HTMLElement>;
|
|
42
|
+
color?: HTMLAttributes<HTMLElement>;
|
|
27
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* A reference to the tooltip item's outermost `<div>` tag.
|
|
46
|
+
*/
|
|
47
|
+
ref?: HTMLElement;
|
|
48
|
+
/**
|
|
49
|
+
* A reference to the tooltip item's label `<div>` tag.
|
|
50
|
+
*/
|
|
51
|
+
labelRef?: HTMLElement;
|
|
52
|
+
/**
|
|
53
|
+
* A reference to the tooltip item's value `<div>` tag.
|
|
54
|
+
*/
|
|
55
|
+
valueRef?: HTMLElement;
|
|
56
|
+
/**
|
|
57
|
+
* A reference to the tooltip item's color `<div>` tag.
|
|
58
|
+
*/
|
|
59
|
+
colorRef?: HTMLElement;
|
|
28
60
|
};
|
|
29
|
-
export type TooltipItemProps =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
export
|
|
61
|
+
export type TooltipItemProps = TooltipItemPropsWithoutHTML & Without<HTMLAttributes<HTMLElement>, TooltipItemPropsWithoutHTML>;
|
|
62
|
+
import { type FormatType } from '@layerstack/utils';
|
|
63
|
+
import type { Snippet } from 'svelte';
|
|
64
|
+
declare const TooltipItem: import("svelte").Component<TooltipItemProps, {}, "ref" | "colorRef" | "labelRef" | "valueRef">;
|
|
65
|
+
type TooltipItem = ReturnType<typeof TooltipItem>;
|
|
66
|
+
export default TooltipItem;
|