svelteplot 0.10.1 → 0.10.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/LICENSE.md +1 -1
- package/dist/marks/AreaY.svelte +1 -0
- package/dist/marks/AreaY.svelte.d.ts +110 -0
- package/dist/marks/BollingerX.svelte.d.ts +2 -2
- package/dist/marks/BollingerY.svelte.d.ts +2 -2
- package/dist/marks/BoxY.svelte.d.ts +2 -2
- package/dist/marks/Brush.svelte.d.ts +2 -2
- package/dist/marks/CustomMark.svelte.d.ts +2 -2
- package/dist/marks/DifferenceY.svelte.d.ts +2 -2
- package/dist/transforms/interval.d.ts +18 -18
- package/dist/transforms/normalize.d.ts +34 -0
- package/dist/transforms/select.d.ts +182 -182
- package/dist/transforms/sort.d.ts +30 -30
- package/dist/transforms/window.d.ts +54 -54
- package/package.json +12 -4
- package/dist/ui/Checkbox.svelte +0 -14
- package/dist/ui/Checkbox.svelte.d.ts +0 -13
- package/dist/ui/ExamplesGrid.svelte +0 -81
- package/dist/ui/ExamplesGrid.svelte.d.ts +0 -11
- package/dist/ui/ExamplesPageList.svelte +0 -63
- package/dist/ui/ExamplesPageList.svelte.d.ts +0 -12
- package/dist/ui/ExamplesPagePreview.svelte +0 -145
- package/dist/ui/ExamplesPagePreview.svelte.d.ts +0 -12
- package/dist/ui/RadioInput.svelte +0 -27
- package/dist/ui/RadioInput.svelte.d.ts +0 -9
- package/dist/ui/Select.svelte +0 -27
- package/dist/ui/Select.svelte.d.ts +0 -9
- package/dist/ui/Slider.svelte +0 -47
- package/dist/ui/Slider.svelte.d.ts +0 -11
- package/dist/ui/Spiral.svelte +0 -35
- package/dist/ui/Spiral.svelte.d.ts +0 -15
- package/dist/ui/index.d.ts +0 -4
- package/dist/ui/index.js +0 -4
- package/dist/ui/isDark.svelte.d.ts +0 -6
- package/dist/ui/isDark.svelte.js +0 -10
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { resolve } from '$app/paths';
|
|
3
|
-
import { useDark } from './isDark.svelte';
|
|
4
|
-
|
|
5
|
-
const exampleImages = import.meta.glob('../../snapshots/*/*.png', {
|
|
6
|
-
eager: true,
|
|
7
|
-
query: {
|
|
8
|
-
enhanced: true,
|
|
9
|
-
w: 440
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
let {
|
|
14
|
-
paths,
|
|
15
|
-
pages
|
|
16
|
-
}: {
|
|
17
|
-
paths: Record<string, string[]>;
|
|
18
|
-
pages: Record<
|
|
19
|
-
string,
|
|
20
|
-
{
|
|
21
|
-
title: string;
|
|
22
|
-
description?: string;
|
|
23
|
-
sortKey?: number;
|
|
24
|
-
transforms?: string[];
|
|
25
|
-
}
|
|
26
|
-
>;
|
|
27
|
-
} = $props();
|
|
28
|
-
|
|
29
|
-
const ds = useDark();
|
|
30
|
-
|
|
31
|
-
function sortPages(a: string, b: string) {
|
|
32
|
-
const sortA = pages[a].sortKey ?? 10;
|
|
33
|
-
const sortB = pages[b].sortKey ?? 10;
|
|
34
|
-
return sortA - sortB;
|
|
35
|
-
}
|
|
36
|
-
</script>
|
|
37
|
-
|
|
38
|
-
<div class="column-container">
|
|
39
|
-
{#each Object.entries(paths).sort( (a, b) => a[0].localeCompare(b[0]) ) as [group, groupPages] (group)}
|
|
40
|
-
<div>
|
|
41
|
-
<h2 id={group}>
|
|
42
|
-
<a href={resolve(`/examples/${group}`)}
|
|
43
|
-
>{pages[groupPages.find((p) => p.endsWith('/_index.svelte'))]?.title ??
|
|
44
|
-
group}</a>
|
|
45
|
-
</h2>
|
|
46
|
-
<div class="example-grid">
|
|
47
|
-
{#each groupPages
|
|
48
|
-
.sort(sortPages)
|
|
49
|
-
.filter((p) => !p.endsWith('/_index.svelte')) as page (page)}
|
|
50
|
-
{@const imageKey = `../../snapshots/${page
|
|
51
|
-
.replace('./', '')
|
|
52
|
-
.replace('.svelte', ds.isDark ? '.dark.png' : '.png')}`}
|
|
53
|
-
<a
|
|
54
|
-
animate:slide
|
|
55
|
-
href={resolve(page.replace('./', './examples/').replace('.svelte', ''))}
|
|
56
|
-
><div>
|
|
57
|
-
{#if exampleImages[imageKey]}
|
|
58
|
-
<enhanced:img
|
|
59
|
-
title={pages[page].title}
|
|
60
|
-
src={exampleImages[imageKey].default}
|
|
61
|
-
alt={pages[page].title} />
|
|
62
|
-
{/if}
|
|
63
|
-
<div class="title">{pages[page].title}</div>
|
|
64
|
-
</div></a>
|
|
65
|
-
{/each}
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
{/each}
|
|
69
|
-
</div>
|
|
70
|
-
|
|
71
|
-
<style>
|
|
72
|
-
:global(.content) h2 {
|
|
73
|
-
margin-top: 1rem !important;
|
|
74
|
-
margin-bottom: 1rem;
|
|
75
|
-
text-transform: capitalize;
|
|
76
|
-
border: 0;
|
|
77
|
-
a {
|
|
78
|
-
text-decoration: none;
|
|
79
|
-
color: inherit;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.column-container {
|
|
84
|
-
container-type: inline-size;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.example-grid {
|
|
88
|
-
--example-grid-columns: 5;
|
|
89
|
-
|
|
90
|
-
/* width: 100%; */
|
|
91
|
-
display: grid;
|
|
92
|
-
/* overflow-x: clip; */
|
|
93
|
-
grid-template-columns: repeat(var(--example-grid-columns), 1fr);
|
|
94
|
-
grid-auto-rows: 1fr;
|
|
95
|
-
gap: 1.25rem;
|
|
96
|
-
|
|
97
|
-
a {
|
|
98
|
-
text-decoration: none;
|
|
99
|
-
color: inherit;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.title {
|
|
103
|
-
font-size: 0.75rem;
|
|
104
|
-
opacity: 0.8;
|
|
105
|
-
line-height: 1.2;
|
|
106
|
-
text-decoration: none;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
@container (max-width: 800px) {
|
|
111
|
-
.example-grid {
|
|
112
|
-
--example-grid-columns: 4;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
@container (max-width: 600px) {
|
|
116
|
-
.example-grid {
|
|
117
|
-
--example-grid-columns: 3;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
@container (max-width: 500px) {
|
|
121
|
-
.example-grid {
|
|
122
|
-
--example-grid-columns: 2;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.example-grid :global(img) {
|
|
127
|
-
height: auto !important;
|
|
128
|
-
aspect-ratio: 4 / 3;
|
|
129
|
-
object-fit: cover;
|
|
130
|
-
width: 100%;
|
|
131
|
-
height: auto;
|
|
132
|
-
|
|
133
|
-
position: relative;
|
|
134
|
-
transition: transform 0.05s ease-out;
|
|
135
|
-
&:hover {
|
|
136
|
-
transform: scale(1.5);
|
|
137
|
-
object-fit: contain;
|
|
138
|
-
z-index: 1;
|
|
139
|
-
|
|
140
|
-
background: fixed var(--svelteplot-bg);
|
|
141
|
-
|
|
142
|
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
</style>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
type $$ComponentProps = {
|
|
2
|
-
paths: Record<string, string[]>;
|
|
3
|
-
pages: Record<string, {
|
|
4
|
-
title: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
sortKey?: number;
|
|
7
|
-
transforms?: string[];
|
|
8
|
-
}>;
|
|
9
|
-
};
|
|
10
|
-
declare const ExamplesPagePreview: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
11
|
-
type ExamplesPagePreview = ReturnType<typeof ExamplesPagePreview>;
|
|
12
|
-
export default ExamplesPagePreview;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
let {
|
|
3
|
-
label = '',
|
|
4
|
-
value = $bindable(),
|
|
5
|
-
options,
|
|
6
|
-
format = (d) => d
|
|
7
|
-
}: {
|
|
8
|
-
label?: string;
|
|
9
|
-
value: string | number | undefined;
|
|
10
|
-
options: any[];
|
|
11
|
-
format?: (d: any) => string;
|
|
12
|
-
} = $props();
|
|
13
|
-
|
|
14
|
-
const randomId = (Math.random() * 1e7).toString(32);
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<div style="display:inline-block">
|
|
18
|
-
{#if label}
|
|
19
|
-
<label for={randomId}>{label}:</label>
|
|
20
|
-
{/if}
|
|
21
|
-
{#each options as p (p)}
|
|
22
|
-
<label>
|
|
23
|
-
<input type="radio" id={randomId} bind:group={value} value={p} />
|
|
24
|
-
{format(p)}
|
|
25
|
-
</label>
|
|
26
|
-
{/each}
|
|
27
|
-
</div>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
type $$ComponentProps = {
|
|
2
|
-
label?: string;
|
|
3
|
-
value: string | number | undefined;
|
|
4
|
-
options: any[];
|
|
5
|
-
format?: (d: any) => string;
|
|
6
|
-
};
|
|
7
|
-
declare const RadioInput: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
8
|
-
type RadioInput = ReturnType<typeof RadioInput>;
|
|
9
|
-
export default RadioInput;
|
package/dist/ui/Select.svelte
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
let {
|
|
3
|
-
label = '',
|
|
4
|
-
value = $bindable(),
|
|
5
|
-
options,
|
|
6
|
-
format = (d) => d
|
|
7
|
-
}: {
|
|
8
|
-
label?: string;
|
|
9
|
-
value: string | number | undefined;
|
|
10
|
-
options: any[];
|
|
11
|
-
format?: (d: any) => string;
|
|
12
|
-
} = $props();
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<label
|
|
16
|
-
>{label || ''}
|
|
17
|
-
<select bind:value>
|
|
18
|
-
{#each options as p (p)}
|
|
19
|
-
<option value={p}>{format(p)}</option>
|
|
20
|
-
{/each}
|
|
21
|
-
</select></label>
|
|
22
|
-
|
|
23
|
-
<style>
|
|
24
|
-
label {
|
|
25
|
-
margin-right: 1em;
|
|
26
|
-
}
|
|
27
|
-
</style>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
type $$ComponentProps = {
|
|
2
|
-
label?: string;
|
|
3
|
-
value: string | number | undefined;
|
|
4
|
-
options: any[];
|
|
5
|
-
format?: (d: any) => string;
|
|
6
|
-
};
|
|
7
|
-
declare const Select: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
8
|
-
type Select = ReturnType<typeof Select>;
|
|
9
|
-
export default Select;
|
package/dist/ui/Slider.svelte
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
let {
|
|
3
|
-
label,
|
|
4
|
-
value = $bindable(),
|
|
5
|
-
min = 0,
|
|
6
|
-
max = 100,
|
|
7
|
-
step = 1,
|
|
8
|
-
type = 'range'
|
|
9
|
-
}: {
|
|
10
|
-
label: string;
|
|
11
|
-
type?: 'range' | 'number';
|
|
12
|
-
value: number;
|
|
13
|
-
min?: number;
|
|
14
|
-
max?: number;
|
|
15
|
-
step?: number;
|
|
16
|
-
} = $props();
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<label>
|
|
20
|
-
<span>{label}:</span>
|
|
21
|
-
{#if type === 'range'}
|
|
22
|
-
<input type="range" bind:value {min} {max} {step} />
|
|
23
|
-
<span class="value">({value})</span>{:else}
|
|
24
|
-
<input
|
|
25
|
-
type="number"
|
|
26
|
-
style:width={`${`${Math.max(Math.abs(min), Math.abs(max))}`.length}rem`}
|
|
27
|
-
bind:value
|
|
28
|
-
{min}
|
|
29
|
-
{max}
|
|
30
|
-
{step} />
|
|
31
|
-
{/if}
|
|
32
|
-
</label>
|
|
33
|
-
|
|
34
|
-
<style>
|
|
35
|
-
label {
|
|
36
|
-
display: inline-flex;
|
|
37
|
-
gap: 1ex;
|
|
38
|
-
margin-right: 1em;
|
|
39
|
-
}
|
|
40
|
-
.value {
|
|
41
|
-
opacity: 0.5;
|
|
42
|
-
}
|
|
43
|
-
input {
|
|
44
|
-
accent-color: var(--svp-accent);
|
|
45
|
-
width: 15ex;
|
|
46
|
-
}
|
|
47
|
-
</style>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type $$ComponentProps = {
|
|
2
|
-
label: string;
|
|
3
|
-
type?: 'range' | 'number';
|
|
4
|
-
value: number;
|
|
5
|
-
min?: number;
|
|
6
|
-
max?: number;
|
|
7
|
-
step?: number;
|
|
8
|
-
};
|
|
9
|
-
declare const Slider: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
10
|
-
type Slider = ReturnType<typeof Slider>;
|
|
11
|
-
export default Slider;
|
package/dist/ui/Spiral.svelte
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { usePlot } from '../hooks/usePlot.svelte';
|
|
3
|
-
|
|
4
|
-
let { numTurns = 4, finalRadius = 10, duration = 2, ...restProps } = $props();
|
|
5
|
-
|
|
6
|
-
const plot = usePlot();
|
|
7
|
-
|
|
8
|
-
const pathD = $derived.by(() => {
|
|
9
|
-
const numPoints = 100;
|
|
10
|
-
const k = finalRadius / (2 * Math.PI * numTurns);
|
|
11
|
-
const angleStep = (2 * Math.PI * numTurns) / numPoints;
|
|
12
|
-
|
|
13
|
-
const points = [];
|
|
14
|
-
for (let i = 0; i <= numPoints; i++) {
|
|
15
|
-
const t = i * angleStep;
|
|
16
|
-
const r = k * t;
|
|
17
|
-
const x = r * Math.cos(t);
|
|
18
|
-
const y = r * Math.sin(t);
|
|
19
|
-
points.push([x, y]);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
let d = `M ${points[0][0].toFixed(2)},${points[0][1].toFixed(2)} `;
|
|
23
|
-
for (let i = 1; i < points.length; i++) {
|
|
24
|
-
d += `L ${points[i][0].toFixed(2)},${points[i][1].toFixed(2)} `;
|
|
25
|
-
}
|
|
26
|
-
return d.trim();
|
|
27
|
-
});
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<path
|
|
31
|
-
d={pathD}
|
|
32
|
-
style:animation-duration="{duration}s"
|
|
33
|
-
stroke="currentColor"
|
|
34
|
-
fill="none"
|
|
35
|
-
{...restProps} />
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export default Spiral;
|
|
2
|
-
type Spiral = {
|
|
3
|
-
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
-
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
-
};
|
|
6
|
-
declare const Spiral: import("svelte").Component<{
|
|
7
|
-
numTurns?: number;
|
|
8
|
-
finalRadius?: number;
|
|
9
|
-
duration?: number;
|
|
10
|
-
} & Record<string, any>, {}, "">;
|
|
11
|
-
type $$ComponentProps = {
|
|
12
|
-
numTurns?: number;
|
|
13
|
-
finalRadius?: number;
|
|
14
|
-
duration?: number;
|
|
15
|
-
} & Record<string, any>;
|
package/dist/ui/index.d.ts
DELETED
package/dist/ui/index.js
DELETED