svelteplot 0.5.0 → 0.5.1

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.
@@ -207,6 +207,7 @@
207
207
  const yDomainCount = $derived(
208
208
  isOneDimensional && explicitScales.has('x') ? 1 : preScales.y.domain.length
209
209
  );
210
+
210
211
  // compute the (automatic) height based on various factors:
211
212
  // - if the plot used a projection and the projection requires an aspect ratio,
212
213
  // we use it, but adjust for the facet counts
@@ -215,34 +216,34 @@
215
216
  // - for one-dimensional scales using the x scale we set a fixed height
216
217
  // - for y band-scales we use the number of items in the y domain
217
218
  const height = $derived(
218
- maybeNumber(plotOptions.height) === null || plotOptions.height === 'auto'
219
- ? Math.round(
220
- preScales.projection && preScales.projection.aspectRatio
221
- ? ((plotWidth * preScales.projection.aspectRatio) / xFacetCount) *
222
- yFacetCount +
219
+ typeof plotOptions.height === 'function'
220
+ ? plotOptions.height(plotWidth)
221
+ : maybeNumber(plotOptions.height) === null || plotOptions.height === 'auto'
222
+ ? Math.round(
223
+ preScales.projection && preScales.projection.aspectRatio
224
+ ? ((plotWidth * preScales.projection.aspectRatio) / xFacetCount) *
225
+ yFacetCount +
226
+ plotOptions.marginTop +
227
+ plotOptions.marginBottom
228
+ : plotOptions.aspectRatio
229
+ ? heightFromAspect(
230
+ preScales.x,
231
+ preScales.y,
232
+ plotOptions.aspectRatio,
233
+ plotWidth,
234
+ plotOptions.marginTop,
235
+ plotOptions.marginBottom
236
+ )
237
+ : ((isOneDimensional && explicitScales.has('x')) || !explicitMarks.length
238
+ ? yFacetCount * DEFAULTS.bandScaleHeight
239
+ : preScales.y.type === 'band'
240
+ ? yFacetCount * yDomainCount * DEFAULTS.bandScaleHeight
241
+ : preScales.y.type === 'point'
242
+ ? yFacetCount * yDomainCount * DEFAULTS.pointScaleHeight
243
+ : DEFAULTS.height) +
223
244
  plotOptions.marginTop +
224
245
  plotOptions.marginBottom
225
- : plotOptions.aspectRatio
226
- ? heightFromAspect(
227
- preScales.x,
228
- preScales.y,
229
- plotOptions.aspectRatio,
230
- plotWidth,
231
- plotOptions.marginTop,
232
- plotOptions.marginBottom
233
- )
234
- : ((isOneDimensional && explicitScales.has('x')) || !explicitMarks.length
235
- ? yFacetCount * DEFAULTS.bandScaleHeight
236
- : preScales.y.type === 'band'
237
- ? yFacetCount * yDomainCount * DEFAULTS.bandScaleHeight
238
- : preScales.y.type === 'point'
239
- ? yFacetCount * yDomainCount * DEFAULTS.pointScaleHeight
240
- : DEFAULTS.height) +
241
- plotOptions.marginTop +
242
- plotOptions.marginBottom
243
- )
244
- : typeof plotOptions.height === 'function'
245
- ? plotOptions.height(plotWidth)
246
+ )
246
247
  : maybeNumber(plotOptions.height)
247
248
  );
248
249
 
@@ -216,7 +216,7 @@
216
216
  markerEnd={args.markerEnd}
217
217
  marker={args.marker}
218
218
  strokeWidth={args.strokeWidth}
219
- datum={lineData[0]}
219
+ datum={lineData[0].datum}
220
220
  d={pathString}
221
221
  dInv={text ? linePath(lineData.toReversed()) : null}
222
222
  color={lineData[0].stroke || 'currentColor'}
@@ -225,7 +225,7 @@
225
225
  text={text ? resolveProp(text, lineData[0]) : null}
226
226
  startOffset={resolveProp(
227
227
  args.textStartOffset,
228
- lineData[0],
228
+ lineData[0].datum,
229
229
  '50%'
230
230
  )}
231
231
  {textStyle}
@@ -152,7 +152,7 @@
152
152
  </script>
153
153
 
154
154
  <g class="axis-x">
155
- {#each positionedTicks as tick, t (t)}
155
+ {#each positionedTicks as tick, t (tick[RAW_VALUE])}
156
156
  {#if testFilter(tick, options) && !tick.hidden}
157
157
  {@const tickClass_ = resolveProp(tickClass, tick)}
158
158
  {@const tickFontSize_ = +resolveProp(tickFontSize, tick, 10)}
@@ -154,7 +154,7 @@
154
154
  </script>
155
155
 
156
156
  <g class="axis-y">
157
- {#each positionedTicks as tick, t (t)}
157
+ {#each positionedTicks as tick, t (tick[RAW_VALUE])}
158
158
  {#if testFilter(tick, options) && !tick.hidden}
159
159
  {@const tickClass_ = resolveProp(tickClass, tick)}
160
160
  {@const [textStyle, textClass] = resolveStyles(
@@ -0,0 +1,63 @@
1
+ <script lang="ts">
2
+ import { resolve } from '$app/paths';
3
+ let {
4
+ paths,
5
+ pages
6
+ }: {
7
+ paths: Record<string, string[]>;
8
+ pages: Record<
9
+ string,
10
+ {
11
+ title: string;
12
+ description?: string;
13
+ sortKey?: number;
14
+ transforms?: string[];
15
+ }
16
+ >;
17
+ } = $props();
18
+
19
+ function sortPages(a: string, b: string) {
20
+ const sortA = pages[a].sortKey ?? 10;
21
+ const sortB = pages[b].sortKey ?? 10;
22
+ return sortA - sortB;
23
+ }
24
+ </script>
25
+
26
+ <div class="column-container">
27
+ {#each Object.entries(paths).sort( (a, b) => a[0].localeCompare(b[0]) ) as [group, groupPages] (group)}
28
+ <div>
29
+ <h3>
30
+ <a href={resolve(`/examples/${group}`)}
31
+ >{pages[groupPages.find((p) => p.endsWith('/_index.svelte'))]?.title ??
32
+ group}</a>
33
+ </h3>
34
+ <ul>
35
+ {#each groupPages
36
+ .sort(sortPages)
37
+ .filter((p) => !p.endsWith('/_index.svelte')) as page (page)}
38
+ <li>
39
+ <a href={resolve(page.replace('./', './examples/').replace('.svelte', ''))}
40
+ >{pages[page].title}</a>
41
+ </li>
42
+ {/each}
43
+ </ul>
44
+ </div>
45
+ {/each}
46
+ </div>
47
+
48
+ <style>
49
+ .column-container {
50
+ columns: 2;
51
+ column-gap: 1rem;
52
+ column-fill: balance;
53
+ > div {
54
+ padding-top: 1em;
55
+ break-before: column;
56
+ break-inside: avoid-column;
57
+ }
58
+ h3 {
59
+ break-before: avoid-column;
60
+ text-transform: capitalize;
61
+ }
62
+ }
63
+ </style>
@@ -0,0 +1,12 @@
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 ExamplesPageList: import("svelte").Component<$$ComponentProps, {}, "">;
11
+ type ExamplesPageList = ReturnType<typeof ExamplesPageList>;
12
+ export default ExamplesPageList;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteplot",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "license": "ISC",
5
5
  "author": {
6
6
  "name": "Gregor Aisch",
@@ -39,7 +39,7 @@
39
39
  "@sveltejs/adapter-auto": "^6.1.1",
40
40
  "@sveltejs/adapter-static": "^3.0.10",
41
41
  "@sveltejs/eslint-config": "^8.3.4",
42
- "@sveltejs/kit": "^2.44.0",
42
+ "@sveltejs/kit": "^2.47.3",
43
43
  "@sveltejs/package": "^2.5.4",
44
44
  "@sveltejs/vite-plugin-svelte": "5.1.1",
45
45
  "@sveltepress/theme-default": "^6.0.4",
@@ -61,34 +61,34 @@
61
61
  "@types/geojson": "^7946.0.16",
62
62
  "@types/topojson": "^3.2.6",
63
63
  "@types/topojson-client": "^3.1.5",
64
- "@typescript-eslint/eslint-plugin": "^8.45.0",
65
- "@typescript-eslint/parser": "^8.45.0",
64
+ "@typescript-eslint/eslint-plugin": "^8.46.2",
65
+ "@typescript-eslint/parser": "^8.46.2",
66
66
  "csstype": "^3.1.3",
67
67
  "d3-dsv": "^3.0.1",
68
68
  "d3-fetch": "^3.0.1",
69
69
  "d3-force": "^3.0.0",
70
- "eslint": "^9.37.0",
70
+ "eslint": "^9.38.0",
71
71
  "eslint-config-prettier": "^10.1.8",
72
- "eslint-plugin-svelte": "3.12.4",
72
+ "eslint-plugin-svelte": "3.12.5",
73
73
  "jsdom": "^26.1.0",
74
74
  "prettier": "^3.6.2",
75
75
  "prettier-plugin-svelte": "^3.4.0",
76
- "puppeteer": "^24.23.0",
76
+ "puppeteer": "^24.26.1",
77
77
  "remark-code-extra": "^1.0.1",
78
78
  "remark-code-frontmatter": "^1.0.0",
79
79
  "resize-observer-polyfill": "^1.5.1",
80
80
  "sass": "^1.93.2",
81
- "svelte-check": "^4.3.2",
82
- "svelte-eslint-parser": "1.3.3",
83
- "svelte-highlight": "^7.8.4",
81
+ "svelte-check": "^4.3.3",
82
+ "svelte-eslint-parser": "1.4.0",
83
+ "svelte-highlight": "^7.9.0",
84
84
  "svg-path-parser": "^1.1.0",
85
85
  "topojson-client": "^3.1.0",
86
86
  "ts-essentials": "^10.1.1",
87
87
  "tslib": "^2.8.1",
88
- "typedoc": "^0.28.13",
88
+ "typedoc": "^0.28.14",
89
89
  "typedoc-plugin-markdown": "^4.9.0",
90
90
  "typescript": "^5.9.3",
91
- "vite": "^6.3.6",
91
+ "vite": "^6.4.1",
92
92
  "vitest": "^3.2.4",
93
93
  "vitest-matchmedia-mock": "^2.0.3",
94
94
  "yoctocolors": "^2.1.2"
@@ -108,11 +108,11 @@
108
108
  "d3-scale-chromatic": "^3.1.0",
109
109
  "d3-shape": "^3.2.0",
110
110
  "d3-time": "^3.1.0",
111
- "es-toolkit": "^1.39.10",
111
+ "es-toolkit": "^1.41.0",
112
112
  "fast-equals": "^5.3.2",
113
113
  "interval-tree-1d": "^1.0.4",
114
114
  "merge-deep": "^3.0.3",
115
- "svelte": "5.39.8"
115
+ "svelte": "5.41.3"
116
116
  },
117
117
  "scripts": {
118
118
  "dev": "vite dev",