layerchart 2.0.0-next.36 → 2.0.0-next.38
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/components/Axis.svelte.d.ts +10 -3
- package/dist/components/Chart.svelte.d.ts +10 -3
- package/dist/components/ForceSimulation.svelte.d.ts +10 -3
- package/dist/components/Group.svelte.d.ts +10 -3
- package/dist/components/Labels.svelte.d.ts +10 -3
- package/dist/components/Pack.svelte.d.ts +10 -3
- package/dist/components/Partition.svelte.d.ts +10 -3
- package/dist/components/Points.svelte +0 -2
- package/dist/components/Tree.svelte.d.ts +10 -3
- package/dist/components/Treemap.svelte.d.ts +10 -3
- package/dist/components/charts/ArcChart.svelte +0 -1
- package/dist/components/charts/ArcChart.svelte.d.ts +10 -3
- package/dist/components/charts/AreaChart.svelte.d.ts +10 -3
- package/dist/components/charts/BarChart.svelte.d.ts +10 -3
- package/dist/components/charts/LineChart.svelte.d.ts +10 -3
- package/dist/components/charts/PieChart.svelte.d.ts +10 -3
- package/dist/components/charts/ScatterChart.svelte.d.ts +10 -3
- package/dist/components/tooltip/Tooltip.svelte.d.ts +10 -3
- package/dist/components/tooltip/TooltipContext.svelte.d.ts +10 -3
- package/dist/docs/Code.svelte +66 -32
- package/dist/docs/Code.svelte.d.ts +5 -6
- package/dist/docs/Preview.svelte +17 -21
- package/dist/docs/Preview.svelte.d.ts +5 -6
- package/dist/docs/ViewSourceButton.svelte +1 -1
- package/dist/utils/graph/dagre.d.ts +4 -4
- package/dist/utils/graph/dagre.js +5 -7
- package/dist/utils/scales.svelte.js +3 -3
- package/dist/utils/stack.js +1 -1
- package/package.json +22 -26
|
@@ -108,10 +108,17 @@ import Rule from './Rule.svelte';
|
|
|
108
108
|
import Text from './Text.svelte';
|
|
109
109
|
import { type MotionProp } from '../utils/motion.svelte.js';
|
|
110
110
|
import { type TicksConfig } from '../utils/ticks.js';
|
|
111
|
+
declare function $$render<T extends Transition = Transition>(): {
|
|
112
|
+
props: AxisProps<T>;
|
|
113
|
+
exports: {};
|
|
114
|
+
bindings: "";
|
|
115
|
+
slots: {};
|
|
116
|
+
events: {};
|
|
117
|
+
};
|
|
111
118
|
declare class __sveltets_Render<T extends Transition = Transition> {
|
|
112
|
-
props():
|
|
113
|
-
events():
|
|
114
|
-
slots():
|
|
119
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
120
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
121
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
115
122
|
bindings(): "";
|
|
116
123
|
exports(): {};
|
|
117
124
|
}
|
|
@@ -532,10 +532,17 @@ export type ChartPropsWithoutHTML<T, XScale extends AnyScale = AnyScale, YScale
|
|
|
532
532
|
ondragend?: ComponentProps<typeof TransformContext>['ondragend'];
|
|
533
533
|
onTransform?: ComponentProps<typeof TransformContext>['onTransform'];
|
|
534
534
|
};
|
|
535
|
+
declare function $$render<TData = any, XScale extends AnyScale = AnyScale, YScale extends AnyScale = AnyScale>(): {
|
|
536
|
+
props: ChartPropsWithoutHTML<TData, XScale, YScale>;
|
|
537
|
+
exports: {};
|
|
538
|
+
bindings: "ref" | "context";
|
|
539
|
+
slots: {};
|
|
540
|
+
events: {};
|
|
541
|
+
};
|
|
535
542
|
declare class __sveltets_Render<TData = any, XScale extends AnyScale = AnyScale, YScale extends AnyScale = AnyScale> {
|
|
536
|
-
props():
|
|
537
|
-
events():
|
|
538
|
-
slots():
|
|
543
|
+
props(): ReturnType<typeof $$render<TData, XScale, YScale>>['props'];
|
|
544
|
+
events(): ReturnType<typeof $$render<TData, XScale, YScale>>['events'];
|
|
545
|
+
slots(): ReturnType<typeof $$render<TData, XScale, YScale>>['slots'];
|
|
539
546
|
bindings(): "ref" | "context";
|
|
540
547
|
exports(): {};
|
|
541
548
|
}
|
|
@@ -132,10 +132,17 @@ export type ForceSimulationProps<NodeDatum extends SimulationNodeDatum, LinkDatu
|
|
|
132
132
|
}
|
|
133
133
|
]>;
|
|
134
134
|
};
|
|
135
|
+
declare function $$render<NodeDatum extends SimulationNodeDatum, LinkDatum extends SimulationLinkDatum<NodeDatum> | undefined>(): {
|
|
136
|
+
props: ForceSimulationProps<NodeDatum, LinkDatum>;
|
|
137
|
+
exports: {};
|
|
138
|
+
bindings: "alpha";
|
|
139
|
+
slots: {};
|
|
140
|
+
events: {};
|
|
141
|
+
};
|
|
135
142
|
declare class __sveltets_Render<NodeDatum extends SimulationNodeDatum, LinkDatum extends SimulationLinkDatum<NodeDatum> | undefined> {
|
|
136
|
-
props():
|
|
137
|
-
events():
|
|
138
|
-
slots():
|
|
143
|
+
props(): ReturnType<typeof $$render<NodeDatum, LinkDatum>>['props'];
|
|
144
|
+
events(): ReturnType<typeof $$render<NodeDatum, LinkDatum>>['events'];
|
|
145
|
+
slots(): ReturnType<typeof $$render<NodeDatum, LinkDatum>>['slots'];
|
|
139
146
|
bindings(): "alpha";
|
|
140
147
|
exports(): {};
|
|
141
148
|
}
|
|
@@ -62,10 +62,17 @@ export type GroupPropsWithoutHTML<In extends Transition = Transition> = {
|
|
|
62
62
|
transitionInParams?: TransitionParams<In>;
|
|
63
63
|
};
|
|
64
64
|
export type GroupProps = GroupPropsWithoutHTML & Without<HTMLAttributes<Element>, GroupPropsWithoutHTML>;
|
|
65
|
+
declare function $$render<T extends Transition = Transition>(): {
|
|
66
|
+
props: GroupProps;
|
|
67
|
+
exports: {};
|
|
68
|
+
bindings: "ref";
|
|
69
|
+
slots: {};
|
|
70
|
+
events: {};
|
|
71
|
+
};
|
|
65
72
|
declare class __sveltets_Render<T extends Transition = Transition> {
|
|
66
|
-
props():
|
|
67
|
-
events():
|
|
68
|
-
slots():
|
|
73
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
74
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
75
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
69
76
|
bindings(): "ref";
|
|
70
77
|
exports(): {};
|
|
71
78
|
}
|
|
@@ -56,10 +56,17 @@ export type LabelsPropsWithoutHTML<T = any> = {
|
|
|
56
56
|
}]>;
|
|
57
57
|
};
|
|
58
58
|
export type LabelsProps<T = any> = LabelsPropsWithoutHTML<T> & Without<TextProps, LabelsPropsWithoutHTML<T>>;
|
|
59
|
+
declare function $$render<TData = any>(): {
|
|
60
|
+
props: LabelsProps<TData>;
|
|
61
|
+
exports: {};
|
|
62
|
+
bindings: "";
|
|
63
|
+
slots: {};
|
|
64
|
+
events: {};
|
|
65
|
+
};
|
|
59
66
|
declare class __sveltets_Render<TData = any> {
|
|
60
|
-
props():
|
|
61
|
-
events():
|
|
62
|
-
slots():
|
|
67
|
+
props(): ReturnType<typeof $$render<TData>>['props'];
|
|
68
|
+
events(): ReturnType<typeof $$render<TData>>['events'];
|
|
69
|
+
slots(): ReturnType<typeof $$render<TData>>['slots'];
|
|
63
70
|
bindings(): "";
|
|
64
71
|
exports(): {};
|
|
65
72
|
}
|
|
@@ -25,10 +25,17 @@ export type PackProps<T> = {
|
|
|
25
25
|
nodes: HierarchyCircularNode<T>[];
|
|
26
26
|
}]>;
|
|
27
27
|
};
|
|
28
|
+
declare function $$render<T>(): {
|
|
29
|
+
props: PackProps<T>;
|
|
30
|
+
exports: {};
|
|
31
|
+
bindings: "nodes";
|
|
32
|
+
slots: {};
|
|
33
|
+
events: {};
|
|
34
|
+
};
|
|
28
35
|
declare class __sveltets_Render<T> {
|
|
29
|
-
props():
|
|
30
|
-
events():
|
|
31
|
-
slots():
|
|
36
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
37
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
38
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
32
39
|
bindings(): "nodes";
|
|
33
40
|
exports(): {};
|
|
34
41
|
}
|
|
@@ -32,10 +32,17 @@ export type PartitionProps<T> = {
|
|
|
32
32
|
nodes: HierarchyRectangularNode<T>[];
|
|
33
33
|
}]>;
|
|
34
34
|
};
|
|
35
|
+
declare function $$render<T>(): {
|
|
36
|
+
props: PartitionProps<T>;
|
|
37
|
+
exports: {};
|
|
38
|
+
bindings: "nodes";
|
|
39
|
+
slots: {};
|
|
40
|
+
events: {};
|
|
41
|
+
};
|
|
35
42
|
declare class __sveltets_Render<T> {
|
|
36
|
-
props():
|
|
37
|
-
events():
|
|
38
|
-
slots():
|
|
43
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
44
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
45
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
39
46
|
bindings(): "nodes";
|
|
40
47
|
exports(): {};
|
|
41
48
|
}
|
|
@@ -45,11 +45,9 @@
|
|
|
45
45
|
</script>
|
|
46
46
|
|
|
47
47
|
<script lang="ts">
|
|
48
|
-
import { extent } from 'd3-array';
|
|
49
48
|
import { pointRadial } from 'd3-shape';
|
|
50
49
|
|
|
51
50
|
import Circle, { type CircleProps } from './Circle.svelte';
|
|
52
|
-
import Link from './Link.svelte';
|
|
53
51
|
import { isScaleBand, type AnyScale } from '../utils/scales.svelte.js';
|
|
54
52
|
import { accessor, type Accessor } from '../utils/common.js';
|
|
55
53
|
import { getChartContext } from './Chart.svelte';
|
|
@@ -25,10 +25,17 @@ export type TreeProps<T> = {
|
|
|
25
25
|
};
|
|
26
26
|
import { type HierarchyPointNode, type HierarchyPointLink, type HierarchyNode } from 'd3-hierarchy';
|
|
27
27
|
import type { Snippet } from 'svelte';
|
|
28
|
+
declare function $$render<T>(): {
|
|
29
|
+
props: TreeProps<T>;
|
|
30
|
+
exports: {};
|
|
31
|
+
bindings: "";
|
|
32
|
+
slots: {};
|
|
33
|
+
events: {};
|
|
34
|
+
};
|
|
28
35
|
declare class __sveltets_Render<T> {
|
|
29
|
-
props():
|
|
30
|
-
events():
|
|
31
|
-
slots():
|
|
36
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
37
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
38
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
32
39
|
bindings(): "";
|
|
33
40
|
exports(): {};
|
|
34
41
|
}
|
|
@@ -58,10 +58,17 @@ export type TreemapProps<T> = {
|
|
|
58
58
|
};
|
|
59
59
|
import { treemapSquarify, type HierarchyNode, type HierarchyRectangularNode } from 'd3-hierarchy';
|
|
60
60
|
import type { Snippet } from 'svelte';
|
|
61
|
+
declare function $$render<T>(): {
|
|
62
|
+
props: TreemapProps<T>;
|
|
63
|
+
exports: {};
|
|
64
|
+
bindings: "";
|
|
65
|
+
slots: {};
|
|
66
|
+
events: {};
|
|
67
|
+
};
|
|
61
68
|
declare class __sveltets_Render<T> {
|
|
62
|
-
props():
|
|
63
|
-
events():
|
|
64
|
-
slots():
|
|
69
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
70
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
71
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
65
72
|
bindings(): "";
|
|
66
73
|
exports(): {};
|
|
67
74
|
}
|
|
@@ -71,10 +71,17 @@ import Arc, { type ArcPropsWithoutHTML } from '../Arc.svelte';
|
|
|
71
71
|
import Group from '../Group.svelte';
|
|
72
72
|
import { type Accessor } from '../../utils/common.js';
|
|
73
73
|
import type { SeriesData, SimplifiedChartProps, SimplifiedChartPropsObject, SimplifiedChartSnippet } from './types.js';
|
|
74
|
+
declare function $$render<TData>(): {
|
|
75
|
+
props: ArcChartProps<TData>;
|
|
76
|
+
exports: {};
|
|
77
|
+
bindings: "context";
|
|
78
|
+
slots: {};
|
|
79
|
+
events: {};
|
|
80
|
+
};
|
|
74
81
|
declare class __sveltets_Render<TData> {
|
|
75
|
-
props():
|
|
76
|
-
events():
|
|
77
|
-
slots():
|
|
82
|
+
props(): ReturnType<typeof $$render<TData>>['props'];
|
|
83
|
+
events(): ReturnType<typeof $$render<TData>>['events'];
|
|
84
|
+
slots(): ReturnType<typeof $$render<TData>>['slots'];
|
|
78
85
|
bindings(): "context";
|
|
79
86
|
exports(): {};
|
|
80
87
|
}
|
|
@@ -42,10 +42,17 @@ import Labels from '../Labels.svelte';
|
|
|
42
42
|
import Points from '../Points.svelte';
|
|
43
43
|
import Rule from '../Rule.svelte';
|
|
44
44
|
import type { SeriesData, SimplifiedChartProps, SimplifiedChartPropsObject } from './types.js';
|
|
45
|
+
declare function $$render<TData>(): {
|
|
46
|
+
props: AreaChartProps<TData>;
|
|
47
|
+
exports: {};
|
|
48
|
+
bindings: "context";
|
|
49
|
+
slots: {};
|
|
50
|
+
events: {};
|
|
51
|
+
};
|
|
45
52
|
declare class __sveltets_Render<TData> {
|
|
46
|
-
props():
|
|
47
|
-
events():
|
|
48
|
-
slots():
|
|
53
|
+
props(): ReturnType<typeof $$render<TData>>['props'];
|
|
54
|
+
events(): ReturnType<typeof $$render<TData>>['events'];
|
|
55
|
+
slots(): ReturnType<typeof $$render<TData>>['slots'];
|
|
49
56
|
bindings(): "context";
|
|
50
57
|
exports(): {};
|
|
51
58
|
}
|
|
@@ -57,10 +57,17 @@ import Highlight from '../Highlight.svelte';
|
|
|
57
57
|
import Labels from '../Labels.svelte';
|
|
58
58
|
import Rule from '../Rule.svelte';
|
|
59
59
|
import type { SeriesData, SimplifiedChartProps, SimplifiedChartPropsObject } from './types.js';
|
|
60
|
+
declare function $$render<TData>(): {
|
|
61
|
+
props: BarChartProps<TData>;
|
|
62
|
+
exports: {};
|
|
63
|
+
bindings: "context";
|
|
64
|
+
slots: {};
|
|
65
|
+
events: {};
|
|
66
|
+
};
|
|
60
67
|
declare class __sveltets_Render<TData> {
|
|
61
|
-
props():
|
|
62
|
-
events():
|
|
63
|
-
slots():
|
|
68
|
+
props(): ReturnType<typeof $$render<TData>>['props'];
|
|
69
|
+
events(): ReturnType<typeof $$render<TData>>['events'];
|
|
70
|
+
slots(): ReturnType<typeof $$render<TData>>['slots'];
|
|
64
71
|
bindings(): "context";
|
|
65
72
|
exports(): {};
|
|
66
73
|
}
|
|
@@ -34,10 +34,17 @@ import Points from '../Points.svelte';
|
|
|
34
34
|
import Rule from '../Rule.svelte';
|
|
35
35
|
import Spline from '../Spline.svelte';
|
|
36
36
|
import type { SeriesData, SimplifiedChartProps, SimplifiedChartPropsObject, SimplifiedChartSnippet } from './types.js';
|
|
37
|
+
declare function $$render<TData>(): {
|
|
38
|
+
props: LineChartProps<TData>;
|
|
39
|
+
exports: {};
|
|
40
|
+
bindings: "context";
|
|
41
|
+
slots: {};
|
|
42
|
+
events: {};
|
|
43
|
+
};
|
|
37
44
|
declare class __sveltets_Render<TData> {
|
|
38
|
-
props():
|
|
39
|
-
events():
|
|
40
|
-
slots():
|
|
45
|
+
props(): ReturnType<typeof $$render<TData>>['props'];
|
|
46
|
+
events(): ReturnType<typeof $$render<TData>>['events'];
|
|
47
|
+
slots(): ReturnType<typeof $$render<TData>>['slots'];
|
|
41
48
|
bindings(): "context";
|
|
42
49
|
exports(): {};
|
|
43
50
|
}
|
|
@@ -126,10 +126,17 @@ import Group from '../Group.svelte';
|
|
|
126
126
|
import Pie from '../Pie.svelte';
|
|
127
127
|
import { type Accessor } from '../../utils/common.js';
|
|
128
128
|
import type { SeriesData, SimplifiedChartProps, SimplifiedChartPropsObject, SimplifiedChartSnippet } from './types.js';
|
|
129
|
+
declare function $$render<TData>(): {
|
|
130
|
+
props: PieChartProps<TData>;
|
|
131
|
+
exports: {};
|
|
132
|
+
bindings: "context";
|
|
133
|
+
slots: {};
|
|
134
|
+
events: {};
|
|
135
|
+
};
|
|
129
136
|
declare class __sveltets_Render<TData> {
|
|
130
|
-
props():
|
|
131
|
-
events():
|
|
132
|
-
slots():
|
|
137
|
+
props(): ReturnType<typeof $$render<TData>>['props'];
|
|
138
|
+
events(): ReturnType<typeof $$render<TData>>['events'];
|
|
139
|
+
slots(): ReturnType<typeof $$render<TData>>['slots'];
|
|
133
140
|
bindings(): "context";
|
|
134
141
|
exports(): {};
|
|
135
142
|
}
|
|
@@ -20,10 +20,17 @@ import Highlight from '../Highlight.svelte';
|
|
|
20
20
|
import Labels from '../Labels.svelte';
|
|
21
21
|
import Points from '../Points.svelte';
|
|
22
22
|
import Rule from '../Rule.svelte';
|
|
23
|
+
declare function $$render<TData>(): {
|
|
24
|
+
props: ScatterChartProps<TData>;
|
|
25
|
+
exports: {};
|
|
26
|
+
bindings: "context";
|
|
27
|
+
slots: {};
|
|
28
|
+
events: {};
|
|
29
|
+
};
|
|
23
30
|
declare class __sveltets_Render<TData> {
|
|
24
|
-
props():
|
|
25
|
-
events():
|
|
26
|
-
slots():
|
|
31
|
+
props(): ReturnType<typeof $$render<TData>>['props'];
|
|
32
|
+
events(): ReturnType<typeof $$render<TData>>['events'];
|
|
33
|
+
slots(): ReturnType<typeof $$render<TData>>['slots'];
|
|
27
34
|
bindings(): "context";
|
|
28
35
|
exports(): {};
|
|
29
36
|
}
|
|
@@ -134,10 +134,17 @@ export type TooltipProps<T = any> = TooltipPropsWithoutHTML<T> & Without<HTMLAtt
|
|
|
134
134
|
import { type ChartContextValue } from '../Chart.svelte';
|
|
135
135
|
import { type MotionProp } from '../../utils/motion.svelte.js';
|
|
136
136
|
import { type Snippet } from 'svelte';
|
|
137
|
+
declare function $$render<T = any>(): {
|
|
138
|
+
props: TooltipProps<T>;
|
|
139
|
+
exports: {};
|
|
140
|
+
bindings: "rootRef";
|
|
141
|
+
slots: {};
|
|
142
|
+
events: {};
|
|
143
|
+
};
|
|
137
144
|
declare class __sveltets_Render<T = any> {
|
|
138
|
-
props():
|
|
139
|
-
events():
|
|
140
|
-
slots():
|
|
145
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
146
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
147
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
141
148
|
bindings(): "rootRef";
|
|
142
149
|
exports(): {};
|
|
143
150
|
}
|
|
@@ -75,10 +75,17 @@ type TooltipContextPropsWithoutHTML<T = any> = {
|
|
|
75
75
|
export type TooltipContextProps<T = any> = TooltipContextPropsWithoutHTML<T> & Without<HTMLAttributes<HTMLElement>, TooltipContextPropsWithoutHTML<T>>;
|
|
76
76
|
import type { Snippet } from 'svelte';
|
|
77
77
|
import { type TooltipPayload } from './tooltipMetaContext.js';
|
|
78
|
+
declare function $$render<TData = any>(): {
|
|
79
|
+
props: TooltipContextProps<TData>;
|
|
80
|
+
exports: {};
|
|
81
|
+
bindings: "ref" | "tooltipContext";
|
|
82
|
+
slots: {};
|
|
83
|
+
events: {};
|
|
84
|
+
};
|
|
78
85
|
declare class __sveltets_Render<TData = any> {
|
|
79
|
-
props():
|
|
80
|
-
events():
|
|
81
|
-
slots():
|
|
86
|
+
props(): ReturnType<typeof $$render<TData>>['props'];
|
|
87
|
+
events(): ReturnType<typeof $$render<TData>>['events'];
|
|
88
|
+
slots(): ReturnType<typeof $$render<TData>>['slots'];
|
|
82
89
|
bindings(): "ref" | "tooltipContext";
|
|
83
90
|
exports(): {};
|
|
84
91
|
}
|
package/dist/docs/Code.svelte
CHANGED
|
@@ -1,46 +1,80 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { createHighlighter } from 'shiki';
|
|
3
|
+
|
|
4
|
+
const highlighter = createHighlighter({
|
|
5
|
+
themes: ['github-light-default', 'github-dark-default'],
|
|
6
|
+
langs: ['svelte', 'javascript', 'ts', 'typescript', 'json', 'sh'],
|
|
7
|
+
});
|
|
8
|
+
</script>
|
|
9
|
+
|
|
1
10
|
<script lang="ts">
|
|
2
|
-
import Prism from 'prismjs';
|
|
3
|
-
import 'prism-svelte';
|
|
4
11
|
import { CopyButton } from 'svelte-ux';
|
|
5
12
|
import { cls } from '@layerstack/tailwind';
|
|
13
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
source?: string | null;
|
|
17
|
+
language?: string;
|
|
18
|
+
classes?: { root?: string; pre?: string; code?: string };
|
|
19
|
+
}
|
|
6
20
|
|
|
7
|
-
|
|
21
|
+
let {
|
|
8
22
|
source = null,
|
|
9
23
|
language = 'svelte',
|
|
10
|
-
highlightedSource = source
|
|
11
|
-
? Prism.highlight(source, Prism.languages[language] ?? Prism.languages.text, language)
|
|
12
|
-
: '',
|
|
13
24
|
classes = {},
|
|
14
25
|
class: className,
|
|
15
|
-
}:
|
|
16
|
-
source: string | null;
|
|
17
|
-
language?: string;
|
|
18
|
-
highlightedSource?: string;
|
|
19
|
-
classes?: {
|
|
20
|
-
root?: string;
|
|
21
|
-
pre?: string;
|
|
22
|
-
code?: string;
|
|
23
|
-
};
|
|
24
|
-
class?: string;
|
|
25
|
-
} = $props();
|
|
26
|
+
}: Props & HTMLAttributes<HTMLDivElement> = $props();
|
|
26
27
|
</script>
|
|
27
28
|
|
|
28
|
-
<div
|
|
29
|
+
<div
|
|
30
|
+
class={cls(
|
|
31
|
+
'Code',
|
|
32
|
+
'relative bg-surface-200 dark:bg-surface-300 p-4 overflow-auto not-prose',
|
|
33
|
+
classes.root,
|
|
34
|
+
className
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
29
37
|
{#if source}
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
<pre class={cls('whitespace-normal overflow-auto', classes.pre)}>
|
|
39
|
+
<code class={cls('text-xs', classes.code)}>
|
|
40
|
+
{#await highlighter}
|
|
41
|
+
<div>Loading...</div>
|
|
42
|
+
{:then h}
|
|
43
|
+
{@html h.codeToHtml(source, {
|
|
44
|
+
lang: language,
|
|
45
|
+
themes: {
|
|
46
|
+
light: 'github-light-default',
|
|
47
|
+
dark: 'github-dark-default',
|
|
48
|
+
},
|
|
49
|
+
})}
|
|
50
|
+
{:catch error}
|
|
51
|
+
<div class="text-red-500">Error loading code highlighting: {error.message}</div>
|
|
52
|
+
{/await}
|
|
53
|
+
|
|
54
|
+
</code>
|
|
55
|
+
</pre>
|
|
56
|
+
|
|
57
|
+
<div class="absolute top-0 right-0 p-2 z-10">
|
|
58
|
+
<CopyButton
|
|
59
|
+
value={source ?? ''}
|
|
60
|
+
class="text-surface-content/70 hover:bg-surface-100/20 py-1 backdrop-blur-md"
|
|
61
|
+
size="sm"
|
|
62
|
+
/>
|
|
44
63
|
</div>
|
|
45
64
|
{/if}
|
|
46
65
|
</div>
|
|
66
|
+
|
|
67
|
+
<style>
|
|
68
|
+
:global(.shiki) {
|
|
69
|
+
background-color: transparent !important;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:global(html.dark .shiki),
|
|
73
|
+
:global(html.dark .shiki span) {
|
|
74
|
+
color: var(--shiki-dark) !important;
|
|
75
|
+
/* background-color: var(--shiki-dark-bg) !important; */
|
|
76
|
+
font-style: var(--shiki-dark-font-style) !important;
|
|
77
|
+
font-weight: var(--shiki-dark-font-weight) !important;
|
|
78
|
+
text-decoration: var(--shiki-dark-text-decoration) !important;
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import '
|
|
2
|
-
|
|
3
|
-
source
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
interface Props {
|
|
3
|
+
source?: string | null;
|
|
4
4
|
language?: string;
|
|
5
|
-
highlightedSource?: string;
|
|
6
5
|
classes?: {
|
|
7
6
|
root?: string;
|
|
8
7
|
pre?: string;
|
|
9
8
|
code?: string;
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
}
|
|
11
|
+
type $$ComponentProps = Props & HTMLAttributes<HTMLDivElement>;
|
|
13
12
|
declare const Code: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
14
13
|
type Code = ReturnType<typeof Code>;
|
|
15
14
|
export default Code;
|
package/dist/docs/Preview.svelte
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { slide } from 'svelte/transition';
|
|
3
|
-
// TODO: No longer copy from svelte-ux after prismjs is migrated to ESM (commonjs causes issue with Vite from another library)
|
|
4
|
-
import Prism from 'prismjs';
|
|
5
|
-
import 'prism-svelte';
|
|
6
|
-
|
|
7
3
|
import LucideCode from '~icons/lucide/code';
|
|
8
4
|
import LucideTable from '~icons/lucide/table';
|
|
9
5
|
|
|
@@ -12,25 +8,25 @@
|
|
|
12
8
|
|
|
13
9
|
import Code from './Code.svelte';
|
|
14
10
|
import Json from './Json.svelte';
|
|
11
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
15
12
|
import type { Snippet } from 'svelte';
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
data,
|
|
20
|
-
language = 'svelte',
|
|
21
|
-
highlightedCode = code ? Prism.highlight(code, Prism.languages.svelte, language) : '',
|
|
22
|
-
showCode = false,
|
|
23
|
-
class: className,
|
|
24
|
-
children,
|
|
25
|
-
}: {
|
|
14
|
+
interface Props {
|
|
15
|
+
children: Snippet;
|
|
26
16
|
code?: string;
|
|
27
17
|
data?: any;
|
|
28
18
|
language?: string;
|
|
29
|
-
highlightedCode?: string;
|
|
30
19
|
showCode?: boolean;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let {
|
|
23
|
+
children,
|
|
24
|
+
code = undefined,
|
|
25
|
+
data = undefined,
|
|
26
|
+
language = 'svelte',
|
|
27
|
+
showCode = false,
|
|
28
|
+
class: className,
|
|
29
|
+
}: Props & HTMLAttributes<HTMLDivElement> = $props();
|
|
34
30
|
|
|
35
31
|
/**
|
|
36
32
|
* Custom JSON replacer (to use with JSON.stringify()) to convert `Date` instances to `new Date()`
|
|
@@ -56,14 +52,14 @@
|
|
|
56
52
|
}
|
|
57
53
|
</script>
|
|
58
54
|
|
|
59
|
-
<div class={cls('Preview border rounded
|
|
55
|
+
<div class={cls('Preview border rounded bg-surface-100', className)}>
|
|
60
56
|
<div class="p-4">
|
|
61
|
-
{@render children
|
|
57
|
+
{@render children()}
|
|
62
58
|
</div>
|
|
63
59
|
|
|
64
60
|
{#if code && showCode}
|
|
65
|
-
<div transition:slide class="
|
|
66
|
-
<Code source={code}
|
|
61
|
+
<div transition:slide class="border-t">
|
|
62
|
+
<Code source={code} {language} />
|
|
67
63
|
</div>
|
|
68
64
|
{/if}
|
|
69
65
|
</div>
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
3
|
+
interface Props {
|
|
4
|
+
children: Snippet;
|
|
4
5
|
code?: string;
|
|
5
6
|
data?: any;
|
|
6
7
|
language?: string;
|
|
7
|
-
highlightedCode?: string;
|
|
8
8
|
showCode?: boolean;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
9
|
+
}
|
|
10
|
+
type $$ComponentProps = Props & HTMLAttributes<HTMLDivElement>;
|
|
12
11
|
declare const Preview: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
13
12
|
type Preview = ReturnType<typeof Preview>;
|
|
14
13
|
export default Preview;
|
|
@@ -25,10 +25,10 @@ export declare function dagreGraph(data: DagreProps['data'], { nodes, nodeId, ed
|
|
|
25
25
|
filterNodes?: DagreProps['filterNodes'];
|
|
26
26
|
}): dagre.graphlib.Graph<{}>;
|
|
27
27
|
/**
|
|
28
|
-
* Get all upstream predecessors for dagre nodeId
|
|
28
|
+
* Get all upstream predecessors ids for dagre nodeId
|
|
29
29
|
*/
|
|
30
|
-
export declare function dagreAncestors(graph: dagre.graphlib.Graph, nodeId: string, maxDepth?: number, currentDepth?: number):
|
|
30
|
+
export declare function dagreAncestors(graph: dagre.graphlib.Graph, nodeId: string, maxDepth?: number, currentDepth?: number): string[];
|
|
31
31
|
/**
|
|
32
|
-
* Get all downstream descendants for dagre nodeId
|
|
32
|
+
* Get all downstream descendants ids for dagre nodeId
|
|
33
33
|
*/
|
|
34
|
-
export declare function dagreDescendants(graph: dagre.graphlib.Graph, nodeId: string, maxDepth?: number, currentDepth?: number):
|
|
34
|
+
export declare function dagreDescendants(graph: dagre.graphlib.Graph, nodeId: string, maxDepth?: number, currentDepth?: number): string[];
|
|
@@ -49,7 +49,7 @@ export function dagreGraph(data, { nodes = (d) => d.nodes, nodeId = (d) => d.id,
|
|
|
49
49
|
return g;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
* Get all upstream predecessors for dagre nodeId
|
|
52
|
+
* Get all upstream predecessors ids for dagre nodeId
|
|
53
53
|
*/
|
|
54
54
|
export function dagreAncestors(graph, nodeId, maxDepth = Infinity, currentDepth = 0) {
|
|
55
55
|
if (currentDepth === maxDepth) {
|
|
@@ -58,21 +58,19 @@ export function dagreAncestors(graph, nodeId, maxDepth = Infinity, currentDepth
|
|
|
58
58
|
const predecessors = graph.predecessors(nodeId) ?? [];
|
|
59
59
|
return [
|
|
60
60
|
...predecessors,
|
|
61
|
-
// @ts-expect-error: Types from dagre appear incorrect
|
|
62
61
|
...predecessors.flatMap((pId) => dagreAncestors(graph, pId, maxDepth, currentDepth + 1)),
|
|
63
62
|
];
|
|
64
63
|
}
|
|
65
64
|
/**
|
|
66
|
-
* Get all downstream descendants for dagre nodeId
|
|
65
|
+
* Get all downstream descendants ids for dagre nodeId
|
|
67
66
|
*/
|
|
68
67
|
export function dagreDescendants(graph, nodeId, maxDepth = Infinity, currentDepth = 0) {
|
|
69
68
|
if (currentDepth === maxDepth) {
|
|
70
69
|
return [];
|
|
71
70
|
}
|
|
72
|
-
const
|
|
71
|
+
const successors = graph.successors(nodeId) ?? [];
|
|
73
72
|
return [
|
|
74
|
-
...
|
|
75
|
-
|
|
76
|
-
...predecessors.flatMap((pId) => dagreDescendants(graph, pId, maxDepth, currentDepth + 1)),
|
|
73
|
+
...successors,
|
|
74
|
+
...successors.flatMap((pId) => dagreDescendants(graph, pId, maxDepth, currentDepth + 1)),
|
|
77
75
|
];
|
|
78
76
|
}
|
|
@@ -97,9 +97,9 @@ export function createScale(scale, domain, range, context) {
|
|
|
97
97
|
*/
|
|
98
98
|
export function autoScale(domain, data, propAccessor) {
|
|
99
99
|
let values = null;
|
|
100
|
-
if (domain && domain.length > 0) {
|
|
101
|
-
// Determine based on domain values
|
|
102
|
-
values = domain;
|
|
100
|
+
if (domain && domain.length > 0 && domain.some((d) => d != null)) {
|
|
101
|
+
// Determine based on non-null domain values
|
|
102
|
+
values = domain.filter((d) => d != null);
|
|
103
103
|
}
|
|
104
104
|
else if (data && data.length > 0 && propAccessor) {
|
|
105
105
|
// Determine based on data values
|
package/dist/utils/stack.js
CHANGED
|
@@ -91,7 +91,7 @@ export function stackOffsetSeparated(series, order) {
|
|
|
91
91
|
return;
|
|
92
92
|
// Standard series
|
|
93
93
|
for (var i = 1, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) {
|
|
94
|
-
(s0 = s1), (s1 = series[order[i]]);
|
|
94
|
+
((s0 = s1), (s1 = series[order[i]]));
|
|
95
95
|
// @ts-expect-error
|
|
96
96
|
let base = max(s0, (d) => d[1]) + gap; // here is where you calculate the maximum of the previous layer
|
|
97
97
|
for (var j = 0; j < m; ++j) {
|
package/package.json
CHANGED
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
"author": "Sean Lynch <techniq35@gmail.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "techniq/layerchart",
|
|
7
|
-
"version": "2.0.0-next.
|
|
7
|
+
"version": "2.0.0-next.38",
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@changesets/cli": "^2.29.
|
|
10
|
-
"@iconify-json/lucide": "^1.2.
|
|
9
|
+
"@changesets/cli": "^2.29.6",
|
|
10
|
+
"@iconify-json/lucide": "^1.2.62",
|
|
11
11
|
"@rollup/plugin-dsv": "^3.0.5",
|
|
12
|
-
"@sveltejs/adapter-cloudflare": "^7.
|
|
13
|
-
"@sveltejs/kit": "^2.
|
|
14
|
-
"@sveltejs/package": "^2.
|
|
15
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
12
|
+
"@sveltejs/adapter-cloudflare": "^7.2.1",
|
|
13
|
+
"@sveltejs/kit": "^2.31.1",
|
|
14
|
+
"@sveltejs/package": "^2.4.1",
|
|
15
|
+
"@sveltejs/vite-plugin-svelte": "^6.1.2",
|
|
16
16
|
"@svitejs/changesets-changelog-github-compact": "^1.2.0",
|
|
17
17
|
"@tailwindcss/typography": "^0.5.16",
|
|
18
|
-
"@tailwindcss/vite": "^4.1.
|
|
18
|
+
"@tailwindcss/vite": "^4.1.12",
|
|
19
19
|
"@types/d3": "^7.4.3",
|
|
20
20
|
"@types/d3-array": "^3.2.1",
|
|
21
21
|
"@types/d3-color": "^3.1.3",
|
|
@@ -35,43 +35,39 @@
|
|
|
35
35
|
"@types/d3-shape": "^3.1.7",
|
|
36
36
|
"@types/d3-time": "^3.0.4",
|
|
37
37
|
"@types/lodash-es": "^4.17.12",
|
|
38
|
-
"@types/prismjs": "^1.26.5",
|
|
39
38
|
"@types/shapefile": "^0.6.4",
|
|
40
39
|
"@types/topojson-client": "^3.1.5",
|
|
41
40
|
"@types/topojson-simplify": "^3.0.3",
|
|
42
41
|
"@types/topojson-specification": "^1.0.5",
|
|
43
|
-
"marked": "^15.0.12",
|
|
44
42
|
"mdsvex": "^0.12.3",
|
|
45
|
-
"posthog-js": "^1.
|
|
46
|
-
"prettier": "^3.
|
|
43
|
+
"posthog-js": "^1.260.1",
|
|
44
|
+
"prettier": "^3.6.2",
|
|
47
45
|
"prettier-plugin-svelte": "^3.4.0",
|
|
48
|
-
"prism-svelte": "^0.5.0",
|
|
49
|
-
"prism-themes": "^1.9.0",
|
|
50
|
-
"prismjs": "^1.30.0",
|
|
51
46
|
"rehype-slug": "^6.0.0",
|
|
52
47
|
"rollup-plugin-visualizer": "^6.0.3",
|
|
53
48
|
"shapefile": "^0.6.6",
|
|
49
|
+
"shiki": "^3.9.2",
|
|
54
50
|
"solar-calculator": "^0.3.0",
|
|
55
|
-
"svelte": "5.
|
|
56
|
-
"svelte-check": "^4.
|
|
51
|
+
"svelte": "^5.38.2",
|
|
52
|
+
"svelte-check": "^4.3.1",
|
|
57
53
|
"svelte-json-tree": "^2.2.0",
|
|
58
54
|
"svelte-ux": "2.0.0-next.17",
|
|
59
|
-
"svelte2tsx": "^0.7.
|
|
60
|
-
"tailwindcss": "^4.1.
|
|
55
|
+
"svelte2tsx": "^0.7.42",
|
|
56
|
+
"tailwindcss": "^4.1.12",
|
|
61
57
|
"topojson-client": "^3.1.0",
|
|
62
58
|
"topojson-simplify": "^3.0.3",
|
|
63
59
|
"tslib": "^2.8.1",
|
|
64
|
-
"typescript": "^5.
|
|
60
|
+
"typescript": "^5.9.2",
|
|
65
61
|
"unist-util-visit": "^5.0.0",
|
|
66
|
-
"unplugin-icons": "^22.
|
|
62
|
+
"unplugin-icons": "^22.2.0",
|
|
67
63
|
"us-atlas": "^3.0.1",
|
|
68
|
-
"vite": "^
|
|
69
|
-
"vite-plugin-devtools-json": "^0.
|
|
70
|
-
"vitest": "^3.2.
|
|
64
|
+
"vite": "^7.1.2",
|
|
65
|
+
"vite-plugin-devtools-json": "^1.0.0",
|
|
66
|
+
"vitest": "^3.2.4"
|
|
71
67
|
},
|
|
72
68
|
"type": "module",
|
|
73
69
|
"dependencies": {
|
|
74
|
-
"@dagrejs/dagre": "^1.1.
|
|
70
|
+
"@dagrejs/dagre": "^1.1.5",
|
|
75
71
|
"@layerstack/svelte-actions": "1.0.1-next.14",
|
|
76
72
|
"@layerstack/svelte-state": "0.1.0-next.19",
|
|
77
73
|
"@layerstack/tailwind": "2.0.0-next.17",
|
|
@@ -97,7 +93,7 @@
|
|
|
97
93
|
"d3-time": "^3.1.0",
|
|
98
94
|
"lodash-es": "^4.17.21",
|
|
99
95
|
"memoize": "^10.1.0",
|
|
100
|
-
"runed": "^0.
|
|
96
|
+
"runed": "^0.31.1"
|
|
101
97
|
},
|
|
102
98
|
"peerDependencies": {
|
|
103
99
|
"svelte": "^5.0.0"
|