File tree Expand file tree Collapse file tree 5 files changed +36
-6
lines changed Expand file tree Collapse file tree 5 files changed +36
-6
lines changed Original file line number Diff line number Diff line change 7
7
BaseMarkProps ,
8
8
' fill' | ' stroke' | ' fillOpacity' | ' strokeOpacity'
9
9
> &
10
+ LinkableMarkProps &
10
11
Omit <
11
12
BaseRectMarkProps ,
12
13
' inset' | ' insetLeft' | ' insetRight' | ' insetTop' | ' insetBottom'
27
28
<script lang =" ts" >
28
29
import Mark from ' ../Mark.svelte' ;
29
30
import { getContext } from ' svelte' ;
30
- import type { PlotContext , BaseRectMarkProps } from ' ../types.js' ;
31
+ import type { PlotContext , BaseRectMarkProps , LinkableMarkProps } from ' ../types.js' ;
31
32
import type { BaseMarkProps } from ' ../types.js' ;
32
33
import RectPath from ' ./helpers/RectPath.svelte' ;
33
34
Original file line number Diff line number Diff line change 2
2
Geo mark with Sphere geometry object -->
3
3
4
4
<script module lang =" ts" >
5
- import { type BaseMarkProps } from ' $lib/types.js' ;
6
- export type SphereMarkProps = BaseMarkProps ;
5
+ import { type BaseMarkProps , type LinkableMarkProps } from ' $lib/types.js' ;
6
+ export type SphereMarkProps = BaseMarkProps & LinkableMarkProps ;
7
7
</script >
8
8
9
9
<script lang =" ts" >
Original file line number Diff line number Diff line change 8
8
const rel = $derived (resolveProp (options .rel , datum, null ));
9
9
const type = $derived (resolveProp (options .type , datum, null ));
10
10
const download = $derived (resolveProp (options .download , datum, null ));
11
+
12
+ // filter data attributes from options
13
+ const dataAttributes = $derived (
14
+ Object .fromEntries (
15
+ Object .entries (options).filter (([key ]) => key .startsWith (' data-sveltekit-' ))
16
+ )
17
+ );
11
18
</script >
12
19
13
20
{#if href }
20
27
{rel }
21
28
{type }
22
29
{download }
30
+ {...dataAttributes }
23
31
aria-label =" link"
24
32
xmlns =" http://www.w3.org/2000/svg" >
25
33
{@render children ?.()}
Original file line number Diff line number Diff line change @@ -657,6 +657,8 @@ export type LinkableMarkProps = {
657
657
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download
658
658
*/
659
659
download : ConstantAccessor < boolean > ;
660
+ // allow data-sveltekit-* attributes on the link element, e.g. data-sveltekit-reload
661
+ [ key : `data-sveltekit-${string } `] : string | boolean ;
660
662
} ;
661
663
662
664
export type BaseMarkProps = Partial < {
Original file line number Diff line number Diff line change 7
7
<script >
8
8
import { Plot , BarX } from ' svelteplot' ;
9
9
import { page } from ' $app/state' ;
10
+ const data = [
11
+ {
12
+ url: ' /marks/line' ,
13
+ label: ' Line' ,
14
+ value: 5
15
+ },
16
+ {
17
+ url: ' /marks/bar' ,
18
+ label: ' Bar' ,
19
+ value: 3
20
+ },
21
+ {
22
+ url: ' /marks/dot' ,
23
+ label: ' Dot' ,
24
+ value: 4
25
+ }
26
+ ];
10
27
</script >
11
28
12
29
<Plot >
13
30
<BarX
14
- data ={[1 , 2 , 3 , 4 , 5 ]}
15
- href ={(d ) => ` #/${d } ` }
16
- target =" _blank" />
31
+ {data }
32
+ x =" value"
33
+ y =" label"
34
+ data-sveltekit-noscroll
35
+ href =" url" />
17
36
</Plot >
You can’t perform that action at this time.
0 commit comments