layerchart 2.0.0-next.1 → 2.0.0-next.3
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 +143 -0
- package/dist/components/AnnotationLine.svelte.d.ts +30 -0
- package/dist/components/AnnotationPoint.svelte +119 -0
- package/dist/components/AnnotationPoint.svelte.d.ts +34 -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 +283 -180
- package/dist/components/Axis.svelte.d.ts +117 -0
- package/dist/components/Bar.svelte +166 -107
- package/dist/components/Bar.svelte.d.ts +51 -0
- package/dist/components/Bars.svelte +56 -67
- package/dist/components/Bars.svelte.d.ts +27 -0
- package/dist/components/Blur.svelte +42 -12
- 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 +71 -21
- 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 +49 -13
- 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 +30 -14
- package/dist/components/Graticule.svelte.d.ts +11 -52
- package/dist/components/Grid.svelte +230 -117
- package/dist/components/Grid.svelte.d.ts +71 -0
- package/dist/components/Group.svelte +173 -106
- package/dist/components/Group.svelte.d.ts +81 -0
- package/dist/components/Highlight.svelte +410 -308
- package/dist/components/Highlight.svelte.d.ts +107 -0
- package/dist/components/Hull.svelte +97 -46
- package/dist/components/Hull.svelte.d.ts +40 -30
- package/dist/components/Labels.svelte +127 -47
- 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 +107 -63
- 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 +108 -76
- 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 +21 -19
- 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,13 +1,32 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { cls } from '@layerstack/tailwind';
|
|
3
|
+
import { layerClass } from '../../utils/attributes.js';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref: refProp = $bindable(),
|
|
8
|
+
class: className,
|
|
9
|
+
children,
|
|
10
|
+
...restProps
|
|
11
|
+
}: HTMLAttributes<HTMLElement> & {
|
|
12
|
+
ref?: HTMLElement;
|
|
13
|
+
} = $props();
|
|
14
|
+
|
|
15
|
+
let ref = $state<HTMLElement>();
|
|
16
|
+
|
|
17
|
+
$effect.pre(() => {
|
|
18
|
+
refProp = ref;
|
|
19
|
+
});
|
|
3
20
|
</script>
|
|
4
21
|
|
|
5
22
|
<div
|
|
23
|
+
bind:this={ref}
|
|
6
24
|
class={cls(
|
|
7
|
-
'
|
|
25
|
+
layerClass('tooltip-list'),
|
|
8
26
|
'grid grid-cols-[1fr_auto] gap-x-2 gap-y-1 items-center',
|
|
9
|
-
|
|
27
|
+
className
|
|
10
28
|
)}
|
|
29
|
+
{...restProps}
|
|
11
30
|
>
|
|
12
|
-
|
|
31
|
+
{@render children?.()}
|
|
13
32
|
</div>
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
[x: string]: any;
|
|
5
|
-
};
|
|
6
|
-
events: {
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
};
|
|
9
|
-
slots: {
|
|
10
|
-
default: {};
|
|
11
|
-
};
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
type $$ComponentProps = HTMLAttributes<HTMLElement> & {
|
|
3
|
+
ref?: HTMLElement;
|
|
12
4
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export
|
|
16
|
-
export default class TooltipList extends SvelteComponentTyped<TooltipListProps, TooltipListEvents, TooltipListSlots> {
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
5
|
+
declare const TooltipList: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
6
|
+
type TooltipList = ReturnType<typeof TooltipList>;
|
|
7
|
+
export default TooltipList;
|
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { cls } from '@layerstack/tailwind';
|
|
3
|
+
import { layerClass } from '../../utils/attributes.js';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref: refProp = $bindable(),
|
|
8
|
+
class: className,
|
|
9
|
+
children,
|
|
10
|
+
...restProps
|
|
11
|
+
}: HTMLAttributes<HTMLElement> & {
|
|
12
|
+
ref?: HTMLElement;
|
|
13
|
+
} = $props();
|
|
14
|
+
|
|
15
|
+
let ref = $state<HTMLElement>();
|
|
16
|
+
$effect.pre(() => {
|
|
17
|
+
refProp = ref;
|
|
18
|
+
});
|
|
3
19
|
</script>
|
|
4
20
|
|
|
5
|
-
<div
|
|
21
|
+
<div
|
|
22
|
+
bind:this={ref}
|
|
23
|
+
class={cls(
|
|
24
|
+
layerClass('tooltip-separator'),
|
|
25
|
+
'rounded-sm bg-surface-content/20 my-1 col-span-full h-px',
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...restProps}
|
|
29
|
+
>
|
|
30
|
+
{@render children?.()}
|
|
31
|
+
</div>
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
[x: string]: any;
|
|
5
|
-
};
|
|
6
|
-
events: {
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
};
|
|
9
|
-
slots: {};
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
type $$ComponentProps = HTMLAttributes<HTMLElement> & {
|
|
3
|
+
ref?: HTMLElement;
|
|
10
4
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
export default class TooltipSeparator extends SvelteComponentTyped<TooltipSeparatorProps, TooltipSeparatorEvents, TooltipSeparatorSlots> {
|
|
15
|
-
}
|
|
16
|
-
export {};
|
|
5
|
+
declare const TooltipSeparator: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
6
|
+
type TooltipSeparator = ReturnType<typeof TooltipSeparator>;
|
|
7
|
+
export default TooltipSeparator;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export { default as Context } from './TooltipContext.svelte';
|
|
2
|
+
export * from './TooltipContext.svelte';
|
|
2
3
|
export { default as Header } from './TooltipHeader.svelte';
|
|
4
|
+
export * from './TooltipHeader.svelte';
|
|
3
5
|
export { default as Item } from './TooltipItem.svelte';
|
|
6
|
+
export * from './TooltipItem.svelte';
|
|
4
7
|
export { default as List } from './TooltipList.svelte';
|
|
8
|
+
export * from './TooltipList.svelte';
|
|
5
9
|
export { default as Separator } from './TooltipSeparator.svelte';
|
|
10
|
+
export * from './TooltipSeparator.svelte';
|
|
6
11
|
export { default as Root } from './Tooltip.svelte';
|
|
12
|
+
export * from './Tooltip.svelte';
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export { default as Context } from './TooltipContext.svelte';
|
|
2
|
+
export * from './TooltipContext.svelte';
|
|
2
3
|
export { default as Header } from './TooltipHeader.svelte';
|
|
4
|
+
export * from './TooltipHeader.svelte';
|
|
3
5
|
export { default as Item } from './TooltipItem.svelte';
|
|
6
|
+
export * from './TooltipItem.svelte';
|
|
4
7
|
export { default as List } from './TooltipList.svelte';
|
|
8
|
+
export * from './TooltipList.svelte';
|
|
5
9
|
export { default as Separator } from './TooltipSeparator.svelte';
|
|
10
|
+
export * from './TooltipSeparator.svelte';
|
|
6
11
|
export { default as Root } from './Tooltip.svelte';
|
|
12
|
+
export * from './Tooltip.svelte';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type Accessor } from '../../utils/common.js';
|
|
2
|
+
import type { SeriesData } from '../charts/index.js';
|
|
3
|
+
import type { ChartContextValue } from '../Chart.svelte';
|
|
4
|
+
import { type FormatType } from '@layerstack/utils';
|
|
5
|
+
export type SimplifiedChartType = 'bar' | 'area' | 'line' | 'pie' | 'scatter';
|
|
6
|
+
export type BarTooltipMetaContextValue = {
|
|
7
|
+
type: 'bar';
|
|
8
|
+
orientation: 'horizontal' | 'vertical';
|
|
9
|
+
stackSeries: boolean;
|
|
10
|
+
visibleSeries: SeriesData<any, any>[];
|
|
11
|
+
};
|
|
12
|
+
export type AreaTooltipMetaContextValue = {
|
|
13
|
+
type: 'area';
|
|
14
|
+
stackSeries: boolean;
|
|
15
|
+
visibleSeries: SeriesData<any, any>[];
|
|
16
|
+
};
|
|
17
|
+
export type LineTooltipMetaContextValue = {
|
|
18
|
+
type: 'line';
|
|
19
|
+
visibleSeries: SeriesData<any, any>[];
|
|
20
|
+
};
|
|
21
|
+
export type PieTooltipMetaContextValue = {
|
|
22
|
+
type: 'pie';
|
|
23
|
+
visibleSeries: SeriesData<any, any>[];
|
|
24
|
+
key: Accessor<any>;
|
|
25
|
+
label: Accessor<any>;
|
|
26
|
+
value: Accessor<any>;
|
|
27
|
+
color: Accessor<any>;
|
|
28
|
+
};
|
|
29
|
+
export type ArcTooltipMetaContextValue = {
|
|
30
|
+
type: 'arc';
|
|
31
|
+
visibleSeries: SeriesData<any, any>[];
|
|
32
|
+
key: Accessor<any>;
|
|
33
|
+
label: Accessor<any>;
|
|
34
|
+
value: Accessor<any>;
|
|
35
|
+
color: Accessor<any>;
|
|
36
|
+
};
|
|
37
|
+
export type ScatterTooltipMetaContextValue = {
|
|
38
|
+
type: 'scatter';
|
|
39
|
+
visibleSeries: SeriesData<any, any>[];
|
|
40
|
+
};
|
|
41
|
+
export type TooltipMetaContextValue = BarTooltipMetaContextValue | AreaTooltipMetaContextValue | LineTooltipMetaContextValue | PieTooltipMetaContextValue | ScatterTooltipMetaContextValue | ArcTooltipMetaContextValue;
|
|
42
|
+
export type TooltipPayload = {
|
|
43
|
+
color?: string;
|
|
44
|
+
name?: string;
|
|
45
|
+
key: string;
|
|
46
|
+
label?: string;
|
|
47
|
+
value?: any;
|
|
48
|
+
keyAccessor?: Accessor<any>;
|
|
49
|
+
valueAccessor?: Accessor<any>;
|
|
50
|
+
labelAccessor?: Accessor<any>;
|
|
51
|
+
colorAccessor?: Accessor<any>;
|
|
52
|
+
chartType?: SimplifiedChartType;
|
|
53
|
+
payload: any;
|
|
54
|
+
rawSeriesData?: SeriesData<any, any>;
|
|
55
|
+
formatter?: FormatType;
|
|
56
|
+
};
|
|
57
|
+
type BasePayloadHandlerProps = {
|
|
58
|
+
ctx: ChartContextValue;
|
|
59
|
+
data: any;
|
|
60
|
+
};
|
|
61
|
+
export declare function handleScatterTooltipPayload({ ctx, data, metaCtx, }: BasePayloadHandlerProps & {
|
|
62
|
+
metaCtx: ScatterTooltipMetaContextValue;
|
|
63
|
+
}): TooltipPayload[];
|
|
64
|
+
/**
|
|
65
|
+
* Retrieves the current tooltip meta context value, or null if not set.
|
|
66
|
+
*/
|
|
67
|
+
export declare function getTooltipMetaContext(): TooltipMetaContextValue | null;
|
|
68
|
+
/**
|
|
69
|
+
* Sets the tooltip meta context value, used to provide additional payload data to the tooltip.
|
|
70
|
+
* This is typically set by the various simplified chart components, such as BarChart, AreaChart,
|
|
71
|
+
* etc.
|
|
72
|
+
*/
|
|
73
|
+
export declare function setTooltipMetaContext(v: TooltipMetaContextValue | null): TooltipMetaContextValue | null;
|
|
74
|
+
export declare function getTooltipPayload({ ctx, tooltipData, metaCtx, }: {
|
|
75
|
+
ctx: ChartContextValue;
|
|
76
|
+
tooltipData: any;
|
|
77
|
+
metaCtx: TooltipMetaContextValue | null;
|
|
78
|
+
}): TooltipPayload[];
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// Additional meta data that can be set by the various simplified chart components
|
|
2
|
+
// to provide additional payload data to the tooltip for ease of composition.
|
|
3
|
+
import { accessor, findRelatedData } from '../../utils/common.js';
|
|
4
|
+
import { asAny } from '../../utils/types.js';
|
|
5
|
+
import { format } from '@layerstack/utils';
|
|
6
|
+
import { Context } from 'runed';
|
|
7
|
+
function handleBarTooltipPayload({ ctx, data, metaCtx, }) {
|
|
8
|
+
const seriesItems = metaCtx.stackSeries
|
|
9
|
+
? [...metaCtx.visibleSeries].reverse()
|
|
10
|
+
: metaCtx.visibleSeries;
|
|
11
|
+
const payload = seriesItems.map((s) => {
|
|
12
|
+
const seriesTooltipData = s.data ? findRelatedData(s.data, data, ctx.x) : data;
|
|
13
|
+
const valueAccessor = accessor(s.value ?? (s.data ? ctx.y : s.key));
|
|
14
|
+
const label = metaCtx.orientation === 'vertical' ? ctx.x(data) : ctx.y(data);
|
|
15
|
+
const name = s.label ?? (s.key !== 'default' ? s.key : 'value');
|
|
16
|
+
const value = seriesTooltipData ? valueAccessor(seriesTooltipData) : undefined;
|
|
17
|
+
const color = s.color ?? ctx.cScale?.(ctx.c(data));
|
|
18
|
+
return {
|
|
19
|
+
...s.data,
|
|
20
|
+
chartType: 'bar',
|
|
21
|
+
color,
|
|
22
|
+
label,
|
|
23
|
+
name,
|
|
24
|
+
value,
|
|
25
|
+
valueAccessor,
|
|
26
|
+
key: s.key,
|
|
27
|
+
payload: data,
|
|
28
|
+
rawSeriesData: s,
|
|
29
|
+
formatter: format,
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
return payload;
|
|
33
|
+
}
|
|
34
|
+
function handleAreaTooltipPayload({ ctx, data, metaCtx, }) {
|
|
35
|
+
const seriesItems = metaCtx.stackSeries
|
|
36
|
+
? [...metaCtx.visibleSeries].reverse()
|
|
37
|
+
: metaCtx.visibleSeries;
|
|
38
|
+
const payload = seriesItems.map((s) => {
|
|
39
|
+
const seriesTooltipData = s.data ? findRelatedData(s.data, data, ctx.x) : data;
|
|
40
|
+
const valueAccessor = accessor(s.value ?? (s.data ? asAny(ctx.y) : s.key));
|
|
41
|
+
const label = ctx.x(data);
|
|
42
|
+
const name = s.label ?? (s.key !== 'default' ? s.key : 'value');
|
|
43
|
+
const value = seriesTooltipData ? valueAccessor(seriesTooltipData) : undefined;
|
|
44
|
+
const color = s.color ?? ctx.cScale?.(ctx.c(data));
|
|
45
|
+
return {
|
|
46
|
+
...s.data,
|
|
47
|
+
chartType: 'area',
|
|
48
|
+
color,
|
|
49
|
+
label,
|
|
50
|
+
name,
|
|
51
|
+
value,
|
|
52
|
+
valueAccessor,
|
|
53
|
+
key: s.key,
|
|
54
|
+
payload: data,
|
|
55
|
+
rawSeriesData: s,
|
|
56
|
+
formatter: format,
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
return payload;
|
|
60
|
+
}
|
|
61
|
+
function handleLineTooltipPayload({ ctx, data, metaCtx, }) {
|
|
62
|
+
return metaCtx.visibleSeries.map((s) => {
|
|
63
|
+
const seriesTooltipData = s.data ? findRelatedData(s.data, data, ctx.x) : data;
|
|
64
|
+
const label = ctx.x(data);
|
|
65
|
+
const valueAccessor = accessor(s.value ?? (s.data ? asAny(ctx.y) : s.key));
|
|
66
|
+
const name = s.label ?? (s.key !== 'default' ? s.key : 'value');
|
|
67
|
+
const value = seriesTooltipData ? valueAccessor(seriesTooltipData) : undefined;
|
|
68
|
+
const color = s.color ?? ctx.cScale?.(ctx.c(data));
|
|
69
|
+
return {
|
|
70
|
+
...s.data,
|
|
71
|
+
chartType: 'line',
|
|
72
|
+
color,
|
|
73
|
+
label,
|
|
74
|
+
name,
|
|
75
|
+
value,
|
|
76
|
+
valueAccessor,
|
|
77
|
+
key: s.key,
|
|
78
|
+
payload: data,
|
|
79
|
+
rawSeriesData: s,
|
|
80
|
+
formatter: format,
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function handlePieOrArcTooltipPayload({ ctx, data, metaCtx, }) {
|
|
85
|
+
const keyAccessor = accessor(metaCtx.key);
|
|
86
|
+
const labelAccessor = accessor(metaCtx.label);
|
|
87
|
+
const valueAccessor = accessor(metaCtx.value);
|
|
88
|
+
const colorAccessor = accessor(metaCtx.color);
|
|
89
|
+
return [
|
|
90
|
+
{
|
|
91
|
+
key: keyAccessor(data),
|
|
92
|
+
label: labelAccessor(data) || keyAccessor(data),
|
|
93
|
+
value: valueAccessor(data),
|
|
94
|
+
color: colorAccessor(data) ?? ctx.cScale?.(ctx.c(data)),
|
|
95
|
+
payload: data,
|
|
96
|
+
chartType: 'pie',
|
|
97
|
+
labelAccessor,
|
|
98
|
+
keyAccessor,
|
|
99
|
+
valueAccessor,
|
|
100
|
+
colorAccessor,
|
|
101
|
+
},
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
export function handleScatterTooltipPayload({ ctx, data, metaCtx, }) {
|
|
105
|
+
// TODO: implement scatter tooltip payload handling
|
|
106
|
+
return [{ payload: data, key: '' }];
|
|
107
|
+
}
|
|
108
|
+
const _TooltipMetaContext = new Context('TooltipMetaContext');
|
|
109
|
+
/**
|
|
110
|
+
* Retrieves the current tooltip meta context value, or null if not set.
|
|
111
|
+
*/
|
|
112
|
+
export function getTooltipMetaContext() {
|
|
113
|
+
return _TooltipMetaContext.getOr(null);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Sets the tooltip meta context value, used to provide additional payload data to the tooltip.
|
|
117
|
+
* This is typically set by the various simplified chart components, such as BarChart, AreaChart,
|
|
118
|
+
* etc.
|
|
119
|
+
*/
|
|
120
|
+
export function setTooltipMetaContext(v) {
|
|
121
|
+
return _TooltipMetaContext.set(v);
|
|
122
|
+
}
|
|
123
|
+
export function getTooltipPayload({ ctx, tooltipData, metaCtx, }) {
|
|
124
|
+
if (!metaCtx)
|
|
125
|
+
return [{ payload: tooltipData, key: '' }];
|
|
126
|
+
switch (metaCtx.type) {
|
|
127
|
+
case 'bar':
|
|
128
|
+
return handleBarTooltipPayload({ ctx, data: tooltipData, metaCtx });
|
|
129
|
+
case 'area':
|
|
130
|
+
return handleAreaTooltipPayload({ ctx, data: tooltipData, metaCtx });
|
|
131
|
+
case 'line':
|
|
132
|
+
return handleLineTooltipPayload({ ctx, data: tooltipData, metaCtx });
|
|
133
|
+
case 'pie':
|
|
134
|
+
case 'arc':
|
|
135
|
+
return handlePieOrArcTooltipPayload({ ctx, data: tooltipData, metaCtx });
|
|
136
|
+
case 'scatter':
|
|
137
|
+
return handleScatterTooltipPayload({ ctx, data: tooltipData, metaCtx });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Placement = 'top-left' | 'top' | 'top-right' | 'left' | 'center' | 'right' | 'bottom-left' | 'bottom' | 'bottom-right';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
6
11
|
};
|
|
7
|
-
|
|
8
|
-
default: {};
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export type BlockquoteProps = typeof __propDef.props;
|
|
12
|
-
export type BlockquoteEvents = typeof __propDef.events;
|
|
13
|
-
export type BlockquoteSlots = typeof __propDef.slots;
|
|
14
|
-
export default class Blockquote extends SvelteComponentTyped<BlockquoteProps, BlockquoteEvents, BlockquoteSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
15
13
|
}
|
|
16
|
-
|
|
14
|
+
declare const Blockquote: $$__sveltets_2_IsomorphicComponent<any, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {
|
|
17
|
+
default: {};
|
|
18
|
+
}, {}, string>;
|
|
19
|
+
type Blockquote = InstanceType<typeof Blockquote>;
|
|
20
|
+
export default Blockquote;
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
1
|
import 'prism-svelte';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} | undefined;
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
14
12
|
};
|
|
15
|
-
|
|
16
|
-
[evt: string]: CustomEvent<any>;
|
|
17
|
-
};
|
|
18
|
-
slots: {};
|
|
19
|
-
};
|
|
20
|
-
export type CodeProps = typeof __propDef.props;
|
|
21
|
-
export type CodeEvents = typeof __propDef.events;
|
|
22
|
-
export type CodeSlots = typeof __propDef.slots;
|
|
23
|
-
export default class Code extends SvelteComponentTyped<CodeProps, CodeEvents, CodeSlots> {
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
24
14
|
}
|
|
25
|
-
|
|
15
|
+
declare const Code: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
source?: string | null | undefined;
|
|
18
|
+
language?: string | undefined;
|
|
19
|
+
highlightedSource?: string | undefined;
|
|
20
|
+
classes?: {
|
|
21
|
+
root?: string;
|
|
22
|
+
pre?: string;
|
|
23
|
+
code?: string;
|
|
24
|
+
} | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
[evt: string]: CustomEvent<any>;
|
|
27
|
+
}, {}, {}, string>;
|
|
28
|
+
type Code = InstanceType<typeof Code>;
|
|
29
|
+
export default Code;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { MenuField } from 'svelte-ux';
|
|
3
|
+
import type { ConnectorSweep } from '../utils/connectorUtils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
value = $bindable('horizontal-vertical'),
|
|
7
|
+
}: {
|
|
8
|
+
value?: ConnectorSweep;
|
|
9
|
+
} = $props();
|
|
10
|
+
|
|
11
|
+
const options = ['horizontal-vertical', 'vertical-horizontal', 'none'].map((type) => ({
|
|
12
|
+
label: type,
|
|
13
|
+
value: type,
|
|
14
|
+
}));
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<MenuField label="Connector Sweep" {options} bind:value stepper classes={{ menuIcon: 'hidden' }} />
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ConnectorSweep } from '../utils/connectorUtils.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
value?: ConnectorSweep;
|
|
4
|
+
};
|
|
5
|
+
declare const ConnectorSweepMenuField: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
6
|
+
type ConnectorSweepMenuField = ReturnType<typeof ConnectorSweepMenuField>;
|
|
7
|
+
export default ConnectorSweepMenuField;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { MenuField } from 'svelte-ux';
|
|
3
|
+
import type { ConnectorType } from '../utils/connectorUtils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
value = $bindable('rounded'),
|
|
7
|
+
}: {
|
|
8
|
+
value?: ConnectorType;
|
|
9
|
+
} = $props();
|
|
10
|
+
|
|
11
|
+
const options = ['straight', 'square', 'beveled', 'rounded', 'd3'].map((type) => ({
|
|
12
|
+
label: type,
|
|
13
|
+
value: type,
|
|
14
|
+
}));
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<MenuField label="Connector Type" {options} bind:value stepper classes={{ menuIcon: 'hidden' }} />
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ConnectorType } from '../utils/connectorUtils.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
value?: ConnectorType;
|
|
4
|
+
};
|
|
5
|
+
declare const ConnectorTypeMenuField: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
6
|
+
type ConnectorTypeMenuField = ReturnType<typeof ConnectorTypeMenuField>;
|
|
7
|
+
export default ConnectorTypeMenuField;
|
|
@@ -3,9 +3,20 @@
|
|
|
3
3
|
|
|
4
4
|
import { MenuField } from 'svelte-ux';
|
|
5
5
|
import { entries } from '@layerstack/utils';
|
|
6
|
+
import type { ComponentProps } from 'svelte';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
let {
|
|
9
|
+
value = $bindable(),
|
|
10
|
+
showOpenClosed = false,
|
|
11
|
+
...restProps
|
|
12
|
+
}: {
|
|
13
|
+
value?: any;
|
|
14
|
+
showOpenClosed?: boolean;
|
|
15
|
+
} & ComponentProps<MenuField> = $props();
|
|
16
|
+
|
|
17
|
+
if (value === undefined) {
|
|
18
|
+
value = d3shapes['curveLinear'];
|
|
19
|
+
}
|
|
9
20
|
|
|
10
21
|
const options = entries(d3shapes)
|
|
11
22
|
.filter(([key]) => {
|
|
@@ -29,5 +40,5 @@
|
|
|
29
40
|
bind:value
|
|
30
41
|
stepper
|
|
31
42
|
classes={{ menuIcon: 'hidden' }}
|
|
32
|
-
{
|
|
43
|
+
{...restProps}
|
|
33
44
|
/>
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
slots: {};
|
|
12
|
-
};
|
|
13
|
-
export type CurveMenuFieldProps = typeof __propDef.props;
|
|
14
|
-
export type CurveMenuFieldEvents = typeof __propDef.events;
|
|
15
|
-
export type CurveMenuFieldSlots = typeof __propDef.slots;
|
|
16
|
-
export default class CurveMenuField extends SvelteComponentTyped<CurveMenuFieldProps, CurveMenuFieldEvents, CurveMenuFieldSlots> {
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
1
|
+
import { MenuField } from 'svelte-ux';
|
|
2
|
+
import type { ComponentProps } from 'svelte';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
value?: any;
|
|
5
|
+
showOpenClosed?: boolean;
|
|
6
|
+
} & ComponentProps<MenuField>;
|
|
7
|
+
declare const CurveMenuField: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
8
|
+
type CurveMenuField = ReturnType<typeof CurveMenuField>;
|
|
9
|
+
export default CurveMenuField;
|