@swr-data-lab/components 2.40.0 → 2.41.0
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.
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
<script lang="ts">import { dev } from '$app/environment';
|
|
2
|
-
|
|
2
|
+
import Row from './Row.svelte';
|
|
3
|
+
let { project, charts = [], baseUrl } = $props();
|
|
4
|
+
const groups = $derived(Array.from(new Set(charts.map((c) => c.group).filter((c) => typeof c === 'string'))));
|
|
5
|
+
const groupedCharts = $derived.by(() => {
|
|
6
|
+
let res = {};
|
|
7
|
+
groups.forEach((g) => (res[g] = charts.filter((el) => el.group === g)));
|
|
8
|
+
return res;
|
|
9
|
+
});
|
|
10
|
+
const ungroupedCharts = $derived(charts.filter((el) => !el.group));
|
|
3
11
|
</script>
|
|
4
12
|
|
|
5
13
|
<main>
|
|
@@ -9,23 +17,27 @@ let { project, charts, baseUrl } = $props();
|
|
|
9
17
|
<table>
|
|
10
18
|
<thead>
|
|
11
19
|
<tr>
|
|
20
|
+
{#if groups.length > 0}
|
|
21
|
+
<th>Group</th>
|
|
22
|
+
{/if}
|
|
12
23
|
<th>Title</th>
|
|
13
24
|
<th>Embed URL</th>
|
|
14
25
|
</tr>
|
|
15
26
|
</thead>
|
|
16
27
|
<tbody>
|
|
17
|
-
{#each
|
|
18
|
-
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
{#each Object.values(groupedCharts) as charts}
|
|
29
|
+
{#each charts as chart, i}
|
|
30
|
+
<Row {chart} group={i === 0} rowspan={groupedCharts[chart.group].length} {baseUrl}
|
|
31
|
+
></Row>
|
|
32
|
+
{/each}
|
|
33
|
+
{/each}
|
|
34
|
+
{#each ungroupedCharts as chart, i}
|
|
35
|
+
<Row
|
|
36
|
+
{chart}
|
|
37
|
+
{baseUrl}
|
|
38
|
+
group={groups.length > 0 && i === 0}
|
|
39
|
+
rowspan={ungroupedCharts.length === 1 ? 1 : 0}
|
|
40
|
+
></Row>
|
|
29
41
|
{/each}
|
|
30
42
|
</tbody>
|
|
31
43
|
</table>
|
|
@@ -69,60 +81,20 @@ h1 em {
|
|
|
69
81
|
}
|
|
70
82
|
|
|
71
83
|
table {
|
|
84
|
+
border: 1px solid var(--color-surfaceBorder);
|
|
72
85
|
border-collapse: collapse;
|
|
73
86
|
border-spacing: 0;
|
|
74
87
|
width: 100%;
|
|
75
|
-
border: 1px solid var(--color-surfaceBorder);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
a {
|
|
79
|
-
display: block;
|
|
80
|
-
color: inherit;
|
|
81
|
-
text-decoration: none;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
th,
|
|
85
|
-
td {
|
|
86
|
-
padding: 0 0.4em;
|
|
87
|
-
text-align: left;
|
|
88
|
-
border-right: 1px solid var(--color-surfaceBorder);
|
|
89
|
-
}
|
|
90
|
-
th:last-child,
|
|
91
|
-
td:last-child {
|
|
92
|
-
border-right: 0;
|
|
93
88
|
}
|
|
94
89
|
|
|
95
90
|
th {
|
|
91
|
+
text-align: left;
|
|
96
92
|
padding: 0.2em 0.4em;
|
|
97
93
|
border-right: 1px solid var(--color-textSecondary);
|
|
98
94
|
border-bottom: 1px solid var(--color-textSecondary);
|
|
99
95
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
border-bottom: 1px solid var(--color-surfaceBorder);
|
|
103
|
-
}
|
|
104
|
-
tr:last-child {
|
|
105
|
-
border-bottom: 0;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
input {
|
|
109
|
-
display: block;
|
|
110
|
-
font-family: monospace;
|
|
111
|
-
width: 100%;
|
|
112
|
-
padding: 0.35em 0;
|
|
113
|
-
font-size: 0.9rem;
|
|
114
|
-
background: var(--color-pageFill);
|
|
115
|
-
color: var(--color-textSecondary);
|
|
116
|
-
border: 0;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
a:hover,
|
|
120
|
-
a:focus-visible {
|
|
121
|
-
text-decoration: underline;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
a:last-child {
|
|
125
|
-
border-bottom: 0;
|
|
96
|
+
th:last-child {
|
|
97
|
+
border-right: 0;
|
|
126
98
|
}
|
|
127
99
|
|
|
128
100
|
.notes {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { dev } from '$app/environment';
|
|
3
|
+
const { chart, group = false, rowspan = 0, baseUrl } = $props();
|
|
4
|
+
|
|
5
|
+
const route = $derived(`/${chart.slug}`);
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<tr>
|
|
9
|
+
{#if group}
|
|
10
|
+
<td {rowspan}>{chart.group}</td>
|
|
11
|
+
{/if}
|
|
12
|
+
<td>
|
|
13
|
+
<a rel="external" href={dev ? route : `./${chart.slug}.html`}>
|
|
14
|
+
{chart.title}
|
|
15
|
+
</a>
|
|
16
|
+
</td>
|
|
17
|
+
<td>
|
|
18
|
+
<input type="text" value={`${baseUrl ?? ''}${route}.html`} />
|
|
19
|
+
</td>
|
|
20
|
+
</tr>
|
|
21
|
+
|
|
22
|
+
<style>
|
|
23
|
+
td {
|
|
24
|
+
padding: 0.15em 0.4em;
|
|
25
|
+
padding-bottom: 0;
|
|
26
|
+
line-height: 1.5;
|
|
27
|
+
text-align: left;
|
|
28
|
+
vertical-align: top;
|
|
29
|
+
border-right: 1px solid var(--color-surfaceBorder);
|
|
30
|
+
&:last-child {
|
|
31
|
+
border-right: 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
tr {
|
|
35
|
+
border-bottom: 1px solid var(--color-surfaceBorder);
|
|
36
|
+
&:last-child {
|
|
37
|
+
border-bottom: 0;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
a {
|
|
41
|
+
display: block;
|
|
42
|
+
color: inherit;
|
|
43
|
+
text-decoration: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
input {
|
|
47
|
+
display: block;
|
|
48
|
+
font-family: monospace;
|
|
49
|
+
width: 100%;
|
|
50
|
+
padding: 0.35em 0;
|
|
51
|
+
font-size: 0.9rem;
|
|
52
|
+
background: var(--color-pageFill);
|
|
53
|
+
color: var(--color-textSecondary);
|
|
54
|
+
border: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
a:hover,
|
|
58
|
+
a:focus-visible {
|
|
59
|
+
text-decoration: underline;
|
|
60
|
+
}
|
|
61
|
+
a:last-child {
|
|
62
|
+
border-bottom: 0;
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default Row;
|
|
2
|
+
type Row = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Row: import("svelte").Component<{
|
|
7
|
+
chart: any;
|
|
8
|
+
group?: boolean;
|
|
9
|
+
rowspan?: number;
|
|
10
|
+
baseUrl: any;
|
|
11
|
+
}, {}, "">;
|
|
12
|
+
type $$ComponentProps = {
|
|
13
|
+
chart: any;
|
|
14
|
+
group?: boolean;
|
|
15
|
+
rowspan?: number;
|
|
16
|
+
baseUrl: any;
|
|
17
|
+
};
|