layerchart 2.0.0-next.3 → 2.0.0-next.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/components/AnnotationPoint.svelte +16 -9
  2. package/dist/components/AnnotationRange.svelte +3 -3
  3. package/dist/components/Arc.svelte +2 -2
  4. package/dist/components/Axis.svelte +83 -29
  5. package/dist/components/Axis.svelte.d.ts +13 -3
  6. package/dist/components/Bar.svelte +12 -8
  7. package/dist/components/Blur.svelte +5 -3
  8. package/dist/components/Blur.svelte.d.ts +2 -5
  9. package/dist/components/BrushContext.svelte +1 -1
  10. package/dist/components/Calendar.svelte +10 -6
  11. package/dist/components/Calendar.svelte.d.ts +2 -1
  12. package/dist/components/Chart.svelte +39 -3
  13. package/dist/components/Chart.svelte.d.ts +11 -0
  14. package/dist/components/Connector.svelte +2 -2
  15. package/dist/components/Connector.svelte.d.ts +1 -1
  16. package/dist/components/Ellipse.svelte +187 -0
  17. package/dist/components/Ellipse.svelte.d.ts +64 -0
  18. package/dist/components/ForceSimulation.svelte +184 -50
  19. package/dist/components/ForceSimulation.svelte.d.ts +88 -21
  20. package/dist/components/GeoPath.svelte +12 -5
  21. package/dist/components/GeoPoint.svelte +1 -2
  22. package/dist/components/GeoSpline.svelte +4 -4
  23. package/dist/components/GeoSpline.svelte.d.ts +1 -1
  24. package/dist/components/Group.svelte +2 -2
  25. package/dist/components/Highlight.svelte +9 -6
  26. package/dist/components/Hull.svelte +1 -1
  27. package/dist/components/Labels.svelte +3 -2
  28. package/dist/components/Labels.svelte.d.ts +2 -2
  29. package/dist/components/Legend.svelte +19 -12
  30. package/dist/components/Legend.svelte.d.ts +5 -5
  31. package/dist/components/MonthPath.svelte +14 -11
  32. package/dist/components/MonthPath.svelte.d.ts +4 -3
  33. package/dist/components/Polygon.svelte +285 -0
  34. package/dist/components/Polygon.svelte.d.ts +115 -0
  35. package/dist/components/RadialGradient.svelte +1 -3
  36. package/dist/components/Spline.svelte +30 -18
  37. package/dist/components/Spline.svelte.d.ts +12 -4
  38. package/dist/components/Text.svelte +62 -60
  39. package/dist/components/Text.svelte.d.ts +6 -0
  40. package/dist/components/TransformControls.svelte +16 -20
  41. package/dist/components/Treemap.svelte +63 -26
  42. package/dist/components/Treemap.svelte.d.ts +11 -11
  43. package/dist/components/Voronoi.svelte +51 -33
  44. package/dist/components/Voronoi.svelte.d.ts +3 -1
  45. package/dist/components/charts/ArcChart.svelte +5 -3
  46. package/dist/components/charts/AreaChart.svelte +11 -11
  47. package/dist/components/charts/BarChart.svelte +72 -53
  48. package/dist/components/charts/DefaultTooltip.svelte +1 -1
  49. package/dist/components/charts/LineChart.svelte +10 -6
  50. package/dist/components/charts/PieChart.svelte +5 -3
  51. package/dist/components/charts/ScatterChart.svelte +2 -3
  52. package/dist/components/charts/utils.svelte.d.ts +2 -2
  53. package/dist/components/charts/utils.svelte.js +5 -1
  54. package/dist/components/index.d.ts +4 -0
  55. package/dist/components/index.js +5 -1
  56. package/dist/components/layout/Canvas.svelte +67 -49
  57. package/dist/components/layout/Canvas.svelte.d.ts +6 -0
  58. package/dist/components/layout/Layer.svelte +6 -4
  59. package/dist/components/layout/Layer.svelte.d.ts +6 -4
  60. package/dist/components/tooltip/Tooltip.svelte +14 -7
  61. package/dist/components/tooltip/TooltipContext.svelte +136 -43
  62. package/dist/components/tooltip/TooltipContext.svelte.d.ts +3 -3
  63. package/dist/components/tooltip/TooltipHeader.svelte +5 -4
  64. package/dist/components/tooltip/TooltipHeader.svelte.d.ts +3 -3
  65. package/dist/components/tooltip/TooltipItem.svelte +5 -4
  66. package/dist/components/tooltip/TooltipItem.svelte.d.ts +3 -3
  67. package/dist/components/tooltip/TooltipList.svelte +1 -1
  68. package/dist/components/tooltip/tooltipMetaContext.d.ts +2 -2
  69. package/dist/docs/Blockquote.svelte +6 -4
  70. package/dist/docs/Blockquote.svelte.d.ts +4 -19
  71. package/dist/docs/Code.svelte +20 -12
  72. package/dist/docs/Code.svelte.d.ts +9 -23
  73. package/dist/docs/Header1.svelte +4 -2
  74. package/dist/docs/Header1.svelte.d.ts +4 -28
  75. package/dist/docs/Json.svelte +11 -3
  76. package/dist/docs/Json.svelte.d.ts +9 -21
  77. package/dist/docs/Layout.svelte +10 -7
  78. package/dist/docs/Layout.svelte.d.ts +4 -19
  79. package/dist/docs/Link.svelte +7 -3
  80. package/dist/docs/Link.svelte.d.ts +4 -38
  81. package/dist/docs/Preview.svelte +6 -3
  82. package/dist/docs/TilesetField.svelte +20 -19
  83. package/dist/docs/TilesetField.svelte.d.ts +5 -22
  84. package/dist/docs/ViewSourceButton.svelte +9 -6
  85. package/dist/docs/ViewSourceButton.svelte.d.ts +7 -21
  86. package/dist/utils/arcText.svelte.js +4 -4
  87. package/dist/utils/array.d.ts +11 -0
  88. package/dist/utils/array.js +23 -0
  89. package/dist/utils/array.test.d.ts +1 -0
  90. package/dist/utils/array.test.js +200 -0
  91. package/dist/utils/canvas.d.ts +77 -0
  92. package/dist/utils/canvas.js +105 -41
  93. package/dist/utils/genData.d.ts +14 -0
  94. package/dist/utils/genData.js +24 -6
  95. package/dist/utils/index.d.ts +1 -0
  96. package/dist/utils/index.js +1 -0
  97. package/dist/utils/path.d.ts +10 -0
  98. package/dist/utils/path.js +30 -0
  99. package/dist/utils/rect.svelte.d.ts +2 -2
  100. package/dist/utils/rect.svelte.js +69 -1
  101. package/dist/utils/scales.svelte.d.ts +3 -2
  102. package/dist/utils/scales.svelte.js +7 -3
  103. package/dist/utils/shape.d.ts +43 -0
  104. package/dist/utils/shape.js +59 -0
  105. package/dist/utils/string.d.ts +49 -0
  106. package/dist/utils/string.js +4 -2
  107. package/dist/utils/ticks.d.ts +15 -4
  108. package/dist/utils/ticks.js +144 -158
  109. package/dist/utils/ticks.test.js +11 -16
  110. package/dist/utils/treemap.d.ts +1 -1
  111. package/package.json +27 -25
  112. package/dist/utils/object.js +0 -2
@@ -0,0 +1,285 @@
1
+ <script lang="ts" module>
2
+ import type { CommonStyleProps, Without } from '../utils/types.js';
3
+
4
+ export type PolygonPropsWithoutHTML = {
5
+ /**
6
+ * The center x position of the polygon.
7
+ *
8
+ * @default 0
9
+ */
10
+ cx?: number;
11
+
12
+ /**
13
+ * The initial center x position of the polygon.
14
+ *
15
+ * @default cx
16
+ */
17
+ initialCx?: number;
18
+
19
+ /**
20
+ * The center y position of the polygon.
21
+ *
22
+ * @default 0
23
+ */
24
+ cy?: number;
25
+
26
+ /**
27
+ * The initial center y position of the polygon.
28
+ *
29
+ * @default cy
30
+ */
31
+ initialCy?: number;
32
+
33
+ /**
34
+ * The radius of the polygon.
35
+ *
36
+ * @default 1
37
+ */
38
+ r?: number;
39
+
40
+ /**
41
+ * The initial radius of the polygon.
42
+ *
43
+ * @default r
44
+ */
45
+ initialR?: number;
46
+
47
+ /**
48
+ * The number of points or explicit points to create the polygon.
49
+ *
50
+ * @default 4
51
+ */
52
+ points?: number | { x: number; y: number }[];
53
+
54
+ /**
55
+ * The radius of the curve for rounded corners.
56
+ *
57
+ * @default 0
58
+ */
59
+ cornerRadius?: number;
60
+
61
+ /**
62
+ * The rotation of the polygon.
63
+ *
64
+ * @default 0
65
+ */
66
+ rotate?: number;
67
+
68
+ /**
69
+ * The percent to inset the odd points of the star (<1 inset, >1 outset)
70
+ *
71
+ * @default 0
72
+ */
73
+ inset?: number;
74
+
75
+ /**
76
+ * The horizontal stretch factor of the polygon.
77
+ *
78
+ * @default 1
79
+ */
80
+ scaleX?: number;
81
+
82
+ /**
83
+ * The vertical stretch factor of the polygon.
84
+ *
85
+ * @default 1
86
+ */
87
+ scaleY?: number;
88
+
89
+ /**
90
+ * The skew angle in degrees along the X axis.
91
+ *
92
+ * @default 0
93
+ */
94
+ skewX?: number;
95
+
96
+ /**
97
+ * The skew angle in degrees along the Y axis.
98
+ *
99
+ * @default 0
100
+ */
101
+ skewY?: number;
102
+
103
+ /**
104
+ * The tilt factor for x-coordinates.
105
+ *
106
+ * @default 1
107
+ */
108
+ tiltX?: number;
109
+
110
+ /**
111
+ * The tilt factor for y-coordinates.
112
+ *
113
+ * @default 1
114
+ */
115
+ tiltY?: number;
116
+
117
+ /**
118
+ * A bindable reference to the `<path>` element
119
+ *
120
+ * @bindable
121
+ */
122
+ ref?: SVGPathElement;
123
+
124
+ motion?: MotionProp;
125
+ } & CommonStyleProps;
126
+
127
+ export type PolygonProps = PolygonPropsWithoutHTML &
128
+ Without<SVGAttributes<Element>, PolygonPropsWithoutHTML>;
129
+ </script>
130
+
131
+ <script lang="ts">
132
+ import type { SVGAttributes } from 'svelte/elements';
133
+ import { cls } from '@layerstack/tailwind';
134
+ import { merge } from 'lodash-es';
135
+ import { interpolatePath } from 'd3-interpolate-path';
136
+
137
+ import { getRenderContext } from './Chart.svelte';
138
+ import {
139
+ createMotion,
140
+ extractTweenConfig,
141
+ type MotionProp,
142
+ type ResolvedMotion,
143
+ } from '../utils/motion.svelte.js';
144
+ import { registerCanvasComponent } from './layout/Canvas.svelte';
145
+ import { renderPathData, type ComputedStylesOptions } from '../utils/canvas.js';
146
+ import { createKey } from '../utils/key.svelte.js';
147
+ import { layerClass } from '../utils/attributes.js';
148
+ import { polygon } from '../utils/shape.js';
149
+ import { roundedPolygonPath } from '../utils/path.js';
150
+
151
+ let {
152
+ cx = 0,
153
+ initialCx: initialCxProp,
154
+ cy = 0,
155
+ initialCy: initialCyProp,
156
+ r = 1,
157
+ initialR: initialRProp,
158
+ points = 4,
159
+ cornerRadius = 0,
160
+ rotate = 0,
161
+ inset = 0,
162
+ scaleX = 1,
163
+ scaleY = 1,
164
+ skewX = 0,
165
+ skewY = 0,
166
+ tiltX = 0,
167
+ tiltY = 0,
168
+ motion,
169
+ fill,
170
+ fillOpacity,
171
+ stroke,
172
+ strokeWidth,
173
+ opacity,
174
+ class: className,
175
+ ref: refProp = $bindable(),
176
+ ...restProps
177
+ }: PolygonProps = $props();
178
+
179
+ let ref = $state<SVGPathElement>();
180
+
181
+ $effect.pre(() => {
182
+ refProp = ref;
183
+ });
184
+
185
+ const initialCx = initialCxProp ?? cx;
186
+ const initialCy = initialCyProp ?? cy;
187
+ const initialR = initialRProp ?? r;
188
+
189
+ const motionCx = createMotion(initialCx, () => cx, motion);
190
+ const motionCy = createMotion(initialCy, () => cy, motion);
191
+ const motionR = createMotion(initialR, () => r, motion);
192
+
193
+ let polygonPoints = $derived(
194
+ typeof points === 'number'
195
+ ? polygon({
196
+ cx: motionCx.current,
197
+ cy: motionCy.current,
198
+ count: points,
199
+ radius: motionR.current,
200
+ rotate,
201
+ inset,
202
+ scaleX,
203
+ scaleY,
204
+ skewX,
205
+ skewY,
206
+ tiltX,
207
+ tiltY,
208
+ })
209
+ : points
210
+ );
211
+ let d = $derived(roundedPolygonPath(polygonPoints, cornerRadius));
212
+
213
+ const extractedTween = extractTweenConfig(motion);
214
+
215
+ const tweenedOptions: ResolvedMotion | undefined = extractedTween
216
+ ? {
217
+ type: extractedTween.type,
218
+ options: { interpolate: interpolatePath, ...extractedTween.options },
219
+ }
220
+ : undefined;
221
+
222
+ const tweenedState = createMotion(null, () => d, tweenedOptions);
223
+
224
+ const renderCtx = getRenderContext();
225
+
226
+ function render(
227
+ ctx: CanvasRenderingContext2D,
228
+ styleOverrides: ComputedStylesOptions | undefined
229
+ ) {
230
+ renderPathData(
231
+ ctx,
232
+ tweenedState.current,
233
+ styleOverrides
234
+ ? merge({ styles: { strokeWidth } }, styleOverrides)
235
+ : {
236
+ styles: { fill, fillOpacity, stroke, strokeWidth, opacity },
237
+ classes: cls(layerClass('polygon'), fill == null && 'fill-surface-content', className),
238
+ }
239
+ );
240
+ }
241
+
242
+ // TODO: Use objectId to work around Svelte 4 reactivity issue (even when memoizing gradients)
243
+ const fillKey = createKey(() => fill);
244
+ const strokeKey = createKey(() => stroke);
245
+
246
+ if (renderCtx === 'canvas') {
247
+ registerCanvasComponent({
248
+ name: 'Polygon',
249
+ render,
250
+ events: {
251
+ click: restProps.onclick,
252
+ pointerenter: restProps.onpointerenter,
253
+ pointermove: restProps.onpointermove,
254
+ pointerleave: restProps.onpointerleave,
255
+ pointerdown: restProps.onpointerdown,
256
+ pointerover: restProps.onpointerover,
257
+ pointerout: restProps.onpointerout,
258
+ touchmove: restProps.ontouchmove,
259
+ },
260
+ deps: () => [
261
+ fillKey.current,
262
+ fillOpacity,
263
+ strokeKey.current,
264
+ strokeWidth,
265
+ opacity,
266
+ className,
267
+ tweenedState.current,
268
+ ],
269
+ });
270
+ }
271
+ </script>
272
+
273
+ {#if renderCtx === 'svg'}
274
+ <path
275
+ d={tweenedState.current}
276
+ {fill}
277
+ fill-opacity={fillOpacity}
278
+ {stroke}
279
+ stroke-width={strokeWidth}
280
+ {opacity}
281
+ class={cls(layerClass('polygon'), fill == null && 'fill-surface-content', className)}
282
+ {...restProps}
283
+ bind:this={ref}
284
+ />
285
+ {/if}
@@ -0,0 +1,115 @@
1
+ import type { CommonStyleProps, Without } from '../utils/types.js';
2
+ export type PolygonPropsWithoutHTML = {
3
+ /**
4
+ * The center x position of the polygon.
5
+ *
6
+ * @default 0
7
+ */
8
+ cx?: number;
9
+ /**
10
+ * The initial center x position of the polygon.
11
+ *
12
+ * @default cx
13
+ */
14
+ initialCx?: number;
15
+ /**
16
+ * The center y position of the polygon.
17
+ *
18
+ * @default 0
19
+ */
20
+ cy?: number;
21
+ /**
22
+ * The initial center y position of the polygon.
23
+ *
24
+ * @default cy
25
+ */
26
+ initialCy?: number;
27
+ /**
28
+ * The radius of the polygon.
29
+ *
30
+ * @default 1
31
+ */
32
+ r?: number;
33
+ /**
34
+ * The initial radius of the polygon.
35
+ *
36
+ * @default r
37
+ */
38
+ initialR?: number;
39
+ /**
40
+ * The number of points or explicit points to create the polygon.
41
+ *
42
+ * @default 4
43
+ */
44
+ points?: number | {
45
+ x: number;
46
+ y: number;
47
+ }[];
48
+ /**
49
+ * The radius of the curve for rounded corners.
50
+ *
51
+ * @default 0
52
+ */
53
+ cornerRadius?: number;
54
+ /**
55
+ * The rotation of the polygon.
56
+ *
57
+ * @default 0
58
+ */
59
+ rotate?: number;
60
+ /**
61
+ * The percent to inset the odd points of the star (<1 inset, >1 outset)
62
+ *
63
+ * @default 0
64
+ */
65
+ inset?: number;
66
+ /**
67
+ * The horizontal stretch factor of the polygon.
68
+ *
69
+ * @default 1
70
+ */
71
+ scaleX?: number;
72
+ /**
73
+ * The vertical stretch factor of the polygon.
74
+ *
75
+ * @default 1
76
+ */
77
+ scaleY?: number;
78
+ /**
79
+ * The skew angle in degrees along the X axis.
80
+ *
81
+ * @default 0
82
+ */
83
+ skewX?: number;
84
+ /**
85
+ * The skew angle in degrees along the Y axis.
86
+ *
87
+ * @default 0
88
+ */
89
+ skewY?: number;
90
+ /**
91
+ * The tilt factor for x-coordinates.
92
+ *
93
+ * @default 1
94
+ */
95
+ tiltX?: number;
96
+ /**
97
+ * The tilt factor for y-coordinates.
98
+ *
99
+ * @default 1
100
+ */
101
+ tiltY?: number;
102
+ /**
103
+ * A bindable reference to the `<path>` element
104
+ *
105
+ * @bindable
106
+ */
107
+ ref?: SVGPathElement;
108
+ motion?: MotionProp;
109
+ } & CommonStyleProps;
110
+ export type PolygonProps = PolygonPropsWithoutHTML & Without<SVGAttributes<Element>, PolygonPropsWithoutHTML>;
111
+ import type { SVGAttributes } from 'svelte/elements';
112
+ import { type MotionProp } from '../utils/motion.svelte.js';
113
+ declare const Polygon: import("svelte").Component<PolygonProps, {}, "ref">;
114
+ type Polygon = ReturnType<typeof Polygon>;
115
+ export default Polygon;
@@ -102,6 +102,7 @@
102
102
  fx = cx,
103
103
  fy = cy,
104
104
  r = '50%',
105
+ // fr = '0%'; // TODO: Svelte / Typescript does not know `<radialRadiant fr="...">`
105
106
  spreadMethod = 'pad',
106
107
  transform = undefined,
107
108
  units = 'objectBoundingBox',
@@ -111,9 +112,6 @@
111
112
  ...restProps
112
113
  }: RadialGradientProps = $props();
113
114
 
114
- // TODO: Svelte / Typescript does not know `<radialRadiant fr="...">`
115
- // export let fr = '0%';
116
-
117
115
  const ctx = getChartContext();
118
116
 
119
117
  const renderCtx = getRenderContext();
@@ -87,23 +87,23 @@
87
87
  /**
88
88
  * Add additional content at the start of the line.
89
89
  *
90
- * Receives `{ point: DOMPoint }` as a snippet prop.
90
+ * Receives `{ point: DOMPoint; value: { x: number; y: number } }` as a snippet prop.
91
91
  */
92
- startContent?: Snippet<[{ point: DOMPoint }]>;
92
+ startContent?: Snippet<[{ point: DOMPoint; value: { x: number; y: number } }]>;
93
93
 
94
94
  /**
95
95
  * Add additional content at the end of the line.
96
96
  *
97
- * Receives `{ point: DOMPoint }` as a snippet prop.
97
+ * Receives `{ point: DOMPoint; value: { x: number; y: number } }` as a snippet prop.
98
98
  */
99
- endContent?: Snippet<[{ point: DOMPoint }]>;
99
+ endContent?: Snippet<[{ point: DOMPoint; value: { x: number; y: number } }]>;
100
100
 
101
101
  /**
102
102
  * A reference to the `<path>` element.
103
103
  *
104
104
  * @bindable
105
105
  */
106
- splineRef?: SVGPathElement;
106
+ pathRef?: SVGPathElement;
107
107
 
108
108
  motion?: MotionProp;
109
109
  } & CommonStyleProps;
@@ -159,14 +159,14 @@
159
159
  startContent,
160
160
  endContent,
161
161
  opacity,
162
- splineRef: splineRefProp = $bindable(),
162
+ pathRef: pathRefProp = $bindable(),
163
163
  ...restProps
164
164
  }: SplineProps = $props();
165
165
 
166
- let splineRef = $state<SVGPathElement>();
166
+ let pathRef = $state<SVGPathElement>();
167
167
 
168
168
  $effect.pre(() => {
169
- splineRefProp = splineRef;
169
+ pathRefProp = pathRef;
170
170
  });
171
171
 
172
172
  const markerStart = $derived(markerStartProp ?? marker);
@@ -331,8 +331,8 @@
331
331
  easing: typeof draw === 'object' && draw.easing ? draw.easing : cubicInOut,
332
332
  interpolate() {
333
333
  return (t: number) => {
334
- const totalLength = splineRef?.getTotalLength() ?? 0;
335
- const point = splineRef?.getPointAtLength(totalLength * t);
334
+ const totalLength = pathRef?.getTotalLength() ?? 0;
335
+ const point = pathRef?.getPointAtLength(totalLength * t);
336
336
  return point;
337
337
  };
338
338
  },
@@ -343,16 +343,16 @@
343
343
  $effect(() => {
344
344
  if (!startContent && !endContent) return;
345
345
  d;
346
- if (!splineRef || !splineRef.getTotalLength()) return;
347
- startPoint = splineRef.getPointAtLength(0);
348
- const totalLength = splineRef.getTotalLength();
349
- endPoint.target = splineRef.getPointAtLength(totalLength);
346
+ if (!pathRef || !pathRef.getTotalLength()) return;
347
+ startPoint = pathRef.getPointAtLength(0);
348
+ const totalLength = pathRef.getTotalLength();
349
+ endPoint.target = pathRef.getPointAtLength(totalLength);
350
350
  });
351
351
 
352
352
  $effect(() => {
353
353
  if (!draw) return;
354
- [tweenedState.current];
355
354
  // Anytime the path data changes, redraw
355
+ [pathData, data, ctx.data];
356
356
  key = Symbol();
357
357
  });
358
358
  </script>
@@ -377,7 +377,7 @@
377
377
  marker-mid={markerMidId ? `url(#${markerMidId})` : undefined}
378
378
  marker-end={markerEndId ? `url(#${markerEndId})` : undefined}
379
379
  in:drawTransition|global={typeof draw === 'object' ? draw : undefined}
380
- bind:this={splineRef}
380
+ bind:this={pathRef}
381
381
  />
382
382
  <MarkerWrapper id={markerStartId} marker={markerStart} />
383
383
  <MarkerWrapper id={markerMidId} marker={markerMid} />
@@ -385,13 +385,25 @@
385
385
 
386
386
  {#if startContent && startPoint}
387
387
  <Group x={startPoint.x} y={startPoint.y} class={layerClass('spline-g-start')}>
388
- {@render startContent({ point: startPoint })}
388
+ {@render startContent({
389
+ point: startPoint,
390
+ value: {
391
+ x: ctx.xScale?.invert?.(startPoint.x),
392
+ y: ctx.yScale?.invert?.(startPoint.y),
393
+ },
394
+ })}
389
395
  </Group>
390
396
  {/if}
391
397
 
392
398
  {#if endContent && endPoint.current}
393
399
  <Group x={endPoint.current.x} y={endPoint.current.y} class={layerClass('spline-g-end')}>
394
- {@render endContent({ point: endPoint.current })}
400
+ {@render endContent({
401
+ point: endPoint.current,
402
+ value: {
403
+ x: ctx.xScale?.invert?.(endPoint.current.x),
404
+ y: ctx.yScale?.invert?.(endPoint.current.y),
405
+ },
406
+ })}
395
407
  </Group>
396
408
  {/if}
397
409
  {/key}
@@ -67,29 +67,37 @@ export type SplinePropsWithoutHTML = {
67
67
  /**
68
68
  * Add additional content at the start of the line.
69
69
  *
70
- * Receives `{ point: DOMPoint }` as a snippet prop.
70
+ * Receives `{ point: DOMPoint; value: { x: number; y: number } }` as a snippet prop.
71
71
  */
72
72
  startContent?: Snippet<[{
73
73
  point: DOMPoint;
74
+ value: {
75
+ x: number;
76
+ y: number;
77
+ };
74
78
  }]>;
75
79
  /**
76
80
  * Add additional content at the end of the line.
77
81
  *
78
- * Receives `{ point: DOMPoint }` as a snippet prop.
82
+ * Receives `{ point: DOMPoint; value: { x: number; y: number } }` as a snippet prop.
79
83
  */
80
84
  endContent?: Snippet<[{
81
85
  point: DOMPoint;
86
+ value: {
87
+ x: number;
88
+ y: number;
89
+ };
82
90
  }]>;
83
91
  /**
84
92
  * A reference to the `<path>` element.
85
93
  *
86
94
  * @bindable
87
95
  */
88
- splineRef?: SVGPathElement;
96
+ pathRef?: SVGPathElement;
89
97
  motion?: MotionProp;
90
98
  } & CommonStyleProps;
91
99
  export type SplineProps = SplinePropsWithoutHTML & Without<SVGAttributes<SVGPathElement>, SplinePropsWithoutHTML>;
92
100
  import { draw as _drawTransition } from 'svelte/transition';
93
- declare const Spline: import("svelte").Component<SplineProps, {}, "splineRef">;
101
+ declare const Spline: import("svelte").Component<SplineProps, {}, "pathRef">;
94
102
  type Spline = ReturnType<typeof Spline>;
95
103
  export default Spline;