@samizdata/mozaic 0.5.1 → 0.7.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.
Files changed (41) hide show
  1. package/README.md +21 -2
  2. package/cli/bin/mozaic.js +10 -0
  3. package/cli/src/args.js +32 -0
  4. package/cli/src/browser.js +93 -0
  5. package/cli/src/eject.js +47 -0
  6. package/cli/src/export.js +133 -0
  7. package/cli/src/main.js +80 -0
  8. package/cli/src/serve.js +54 -0
  9. package/dist/frame/Source.svelte +32 -3
  10. package/dist/frame/Source.svelte.d.ts +13 -4
  11. package/dist/frame/index.d.ts +1 -0
  12. package/dist/frame/types.d.ts +7 -0
  13. package/dist/frame/types.js +1 -0
  14. package/dist/recipes/ArrowChart.svelte +4 -3
  15. package/dist/recipes/ArrowChart.svelte.d.ts +3 -1
  16. package/dist/recipes/BarChart.svelte +4 -3
  17. package/dist/recipes/BarChart.svelte.d.ts +3 -1
  18. package/dist/recipes/BarDotChart.svelte +4 -3
  19. package/dist/recipes/BarDotChart.svelte.d.ts +3 -1
  20. package/dist/recipes/ColumnChart.svelte +4 -3
  21. package/dist/recipes/ColumnChart.svelte.d.ts +3 -1
  22. package/dist/recipes/LineChart.svelte +4 -3
  23. package/dist/recipes/LineChart.svelte.d.ts +3 -1
  24. package/dist/recipes/MosaicChart.svelte +4 -3
  25. package/dist/recipes/MosaicChart.svelte.d.ts +3 -1
  26. package/dist/recipes/PercentileChart.svelte +4 -3
  27. package/dist/recipes/PercentileChart.svelte.d.ts +3 -1
  28. package/dist/recipes/ScatterChart.svelte +4 -3
  29. package/dist/recipes/ScatterChart.svelte.d.ts +3 -1
  30. package/dist/recipes/StackedBarChart.svelte +4 -3
  31. package/dist/recipes/StackedBarChart.svelte.d.ts +3 -1
  32. package/package.json +14 -4
  33. package/src/lib/recipes/ArrowChart.svelte +4 -3
  34. package/src/lib/recipes/BarChart.svelte +4 -3
  35. package/src/lib/recipes/BarDotChart.svelte +4 -3
  36. package/src/lib/recipes/ColumnChart.svelte +4 -3
  37. package/src/lib/recipes/LineChart.svelte +4 -3
  38. package/src/lib/recipes/MosaicChart.svelte +4 -3
  39. package/src/lib/recipes/PercentileChart.svelte +4 -3
  40. package/src/lib/recipes/ScatterChart.svelte +4 -3
  41. package/src/lib/recipes/StackedBarChart.svelte +4 -3
@@ -1,4 +1,5 @@
1
1
  import type { Snippet } from 'svelte';
2
+ import { type SourceItem } from '../frame/index.js';
2
3
  import type { ChartEmbed } from '../embed/index.js';
3
4
  import { type PlotContext } from '../core/index.js';
4
5
  import { type LocaleCode } from '../locale/index.js';
@@ -15,7 +16,8 @@ declare function $$render<T>(): {
15
16
  title?: string;
16
17
  subtitle?: string;
17
18
  notes?: string;
18
- source?: string;
19
+ /** Plain text, or sources with optional links (see `<Source>`). */
20
+ source?: string | SourceItem[];
19
21
  alt?: string;
20
22
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
21
23
  embed?: ChartEmbed;
@@ -11,7 +11,7 @@ anything.
11
11
  import type { Snippet } from 'svelte';
12
12
  import { scaleBand, scaleLinear } from 'd3-scale';
13
13
  import { max, min } from 'd3-array';
14
- import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
14
+ import { Chart, Header, Title, Subtitle, Footer, Source, Notes, type SourceItem } from '../frame/index.js';
15
15
  import type { ChartEmbed } from '../embed/index.js';
16
16
  import { Plot, Svg, estimateTextWidth, scaled, type PlotContext } from '../core/index.js';
17
17
  import { Bars, Points } from '../marks/index.js';
@@ -38,7 +38,8 @@ anything.
38
38
  title?: string;
39
39
  subtitle?: string;
40
40
  notes?: string;
41
- source?: string;
41
+ /** Plain text, or sources with optional links (see `<Source>`). */
42
+ source?: string | SourceItem[];
42
43
  alt?: string;
43
44
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
44
45
  embed?: ChartEmbed;
@@ -178,7 +179,7 @@ anything.
178
179
  {#if notes || source}
179
180
  <Footer>
180
181
  {#if notes}<Notes>{notes}</Notes>{/if}
181
- {#if source}<Source>{source}</Source>{/if}
182
+ {#if source}<Source sources={source} />{/if}
182
183
  </Footer>
183
184
  {/if}
184
185
  </Chart>
@@ -1,4 +1,5 @@
1
1
  import type { Snippet } from 'svelte';
2
+ import { type SourceItem } from '../frame/index.js';
2
3
  import type { ChartEmbed } from '../embed/index.js';
3
4
  import { type PlotContext } from '../core/index.js';
4
5
  import { type LocaleCode } from '../locale/index.js';
@@ -21,7 +22,8 @@ declare function $$render<T>(): {
21
22
  title?: string;
22
23
  subtitle?: string;
23
24
  notes?: string;
24
- source?: string;
25
+ /** Plain text, or sources with optional links (see `<Source>`). */
26
+ source?: string | SourceItem[];
25
27
  alt?: string;
26
28
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
27
29
  embed?: ChartEmbed;
@@ -8,7 +8,7 @@ copies this file into your project.
8
8
  import type { Snippet } from 'svelte';
9
9
  import { scaleBand, scaleLinear } from 'd3-scale';
10
10
  import { max, min } from 'd3-array';
11
- import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
11
+ import { Chart, Header, Title, Subtitle, Footer, Source, Notes, type SourceItem } from '../frame/index.js';
12
12
  import type { ChartEmbed } from '../embed/index.js';
13
13
  import { Plot, Svg, Html, scaled, type PlotContext } from '../core/index.js';
14
14
  import { Bars, Rules } from '../marks/index.js';
@@ -29,7 +29,8 @@ copies this file into your project.
29
29
  title?: string;
30
30
  subtitle?: string;
31
31
  notes?: string;
32
- source?: string;
32
+ /** Plain text, or sources with optional links (see `<Source>`). */
33
+ source?: string | SourceItem[];
33
34
  alt?: string;
34
35
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
35
36
  embed?: ChartEmbed;
@@ -113,7 +114,7 @@ copies this file into your project.
113
114
  {#if notes || source}
114
115
  <Footer>
115
116
  {#if notes}<Notes>{notes}</Notes>{/if}
116
- {#if source}<Source>{source}</Source>{/if}
117
+ {#if source}<Source sources={source} />{/if}
117
118
  </Footer>
118
119
  {/if}
119
120
  </Chart>
@@ -1,4 +1,5 @@
1
1
  import type { Snippet } from 'svelte';
2
+ import { type SourceItem } from '../frame/index.js';
2
3
  import type { ChartEmbed } from '../embed/index.js';
3
4
  import { type PlotContext } from '../core/index.js';
4
5
  import { type LocaleCode } from '../locale/index.js';
@@ -16,7 +17,8 @@ declare function $$render<T>(): {
16
17
  title?: string;
17
18
  subtitle?: string;
18
19
  notes?: string;
19
- source?: string;
20
+ /** Plain text, or sources with optional links (see `<Source>`). */
21
+ source?: string | SourceItem[];
20
22
  alt?: string;
21
23
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
22
24
  embed?: ChartEmbed;
@@ -10,7 +10,7 @@ project.
10
10
  import { scaleLinear, scaleTime } from 'd3-scale';
11
11
  import { bisector, extent, max, min } from 'd3-array';
12
12
  import { curveMonotoneX } from 'd3-shape';
13
- import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
13
+ import { Chart, Header, Title, Subtitle, Footer, Source, Notes, type SourceItem } from '../frame/index.js';
14
14
  import type { ChartEmbed } from '../embed/index.js';
15
15
  import { Plot, Svg, Html, type PlotContext } from '../core/index.js';
16
16
  import { Line, LineEndLabels } from '../marks/index.js';
@@ -33,7 +33,8 @@ project.
33
33
  title?: string;
34
34
  subtitle?: string;
35
35
  notes?: string;
36
- source?: string;
36
+ /** Plain text, or sources with optional links (see `<Source>`). */
37
+ source?: string | SourceItem[];
37
38
  alt?: string;
38
39
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
39
40
  embed?: ChartEmbed;
@@ -153,7 +154,7 @@ project.
153
154
  {#if notes || source}
154
155
  <Footer>
155
156
  {#if notes}<Notes>{notes}</Notes>{/if}
156
- {#if source}<Source>{source}</Source>{/if}
157
+ {#if source}<Source sources={source} />{/if}
157
158
  </Footer>
158
159
  {/if}
159
160
  </Chart>
@@ -1,4 +1,5 @@
1
1
  import type { Snippet } from 'svelte';
2
+ import { type SourceItem } from '../frame/index.js';
2
3
  import type { ChartEmbed } from '../embed/index.js';
3
4
  import { type PlotContext } from '../core/index.js';
4
5
  import { type LocaleCode } from '../locale/index.js';
@@ -18,7 +19,8 @@ declare function $$render<S, P>(): {
18
19
  title?: string;
19
20
  subtitle?: string;
20
21
  notes?: string;
21
- source?: string;
22
+ /** Plain text, or sources with optional links (see `<Source>`). */
23
+ source?: string | SourceItem[];
22
24
  alt?: string;
23
25
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
24
26
  embed?: ChartEmbed;
@@ -13,7 +13,7 @@ project and change anything.
13
13
  import type { Snippet } from 'svelte';
14
14
  import { scaleLinear } from 'd3-scale';
15
15
  import { group, sum } from 'd3-array';
16
- import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
16
+ import { Chart, Header, Title, Subtitle, Footer, Source, Notes, type SourceItem } from '../frame/index.js';
17
17
  import type { ChartEmbed } from '../embed/index.js';
18
18
  import { Plot, Svg, estimateTextWidth, type PlotContext } from '../core/index.js';
19
19
  import { Rects } from '../marks/index.js';
@@ -51,7 +51,8 @@ project and change anything.
51
51
  title?: string;
52
52
  subtitle?: string;
53
53
  notes?: string;
54
- source?: string;
54
+ /** Plain text, or sources with optional links (see `<Source>`). */
55
+ source?: string | SourceItem[];
55
56
  alt?: string;
56
57
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
57
58
  embed?: ChartEmbed;
@@ -232,7 +233,7 @@ project and change anything.
232
233
  {#if notes || source}
233
234
  <Footer>
234
235
  {#if notes}<Notes>{notes}</Notes>{/if}
235
- {#if source}<Source>{source}</Source>{/if}
236
+ {#if source}<Source sources={source} />{/if}
236
237
  </Footer>
237
238
  {/if}
238
239
  </Chart>
@@ -1,4 +1,5 @@
1
1
  import type { Snippet } from 'svelte';
2
+ import { type SourceItem } from '../frame/index.js';
2
3
  import type { ChartEmbed } from '../embed/index.js';
3
4
  import { type PlotContext } from '../core/index.js';
4
5
  import { type LocaleCode } from '../locale/index.js';
@@ -35,7 +36,8 @@ declare function $$render<T>(): {
35
36
  title?: string;
36
37
  subtitle?: string;
37
38
  notes?: string;
38
- source?: string;
39
+ /** Plain text, or sources with optional links (see `<Source>`). */
40
+ source?: string | SourceItem[];
39
41
  alt?: string;
40
42
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
41
43
  embed?: ChartEmbed;
@@ -15,7 +15,7 @@ your project and change anything.
15
15
  import type { Snippet } from 'svelte';
16
16
  import { scaleBand, scaleLinear } from 'd3-scale';
17
17
  import { max, min } from 'd3-array';
18
- import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
18
+ import { Chart, Header, Title, Subtitle, Footer, Source, Notes, type SourceItem } from '../frame/index.js';
19
19
  import type { ChartEmbed } from '../embed/index.js';
20
20
  import { Plot, Svg, estimateTextWidth, type PlotContext } from '../core/index.js';
21
21
  import { AxisX, GridX, Legend } from '../guides/index.js';
@@ -68,7 +68,8 @@ your project and change anything.
68
68
  title?: string;
69
69
  subtitle?: string;
70
70
  notes?: string;
71
- source?: string;
71
+ /** Plain text, or sources with optional links (see `<Source>`). */
72
+ source?: string | SourceItem[];
72
73
  alt?: string;
73
74
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
74
75
  embed?: ChartEmbed;
@@ -343,7 +344,7 @@ your project and change anything.
343
344
  {#if notes || source}
344
345
  <Footer>
345
346
  {#if notes}<Notes>{notes}</Notes>{/if}
346
- {#if source}<Source>{source}</Source>{/if}
347
+ {#if source}<Source sources={source} />{/if}
347
348
  </Footer>
348
349
  {/if}
349
350
  </Chart>
@@ -1,4 +1,5 @@
1
1
  import type { Snippet } from 'svelte';
2
+ import { type SourceItem } from '../frame/index.js';
2
3
  import type { ChartEmbed } from '../embed/index.js';
3
4
  import { type PlotContext } from '../core/index.js';
4
5
  import { type PercentileRank } from '../transforms/index.js';
@@ -50,7 +51,8 @@ declare function $$render<T>(): {
50
51
  title?: string;
51
52
  subtitle?: string;
52
53
  notes?: string;
53
- source?: string;
54
+ /** Plain text, or sources with optional links (see `<Source>`). */
55
+ source?: string | SourceItem[];
54
56
  alt?: string;
55
57
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
56
58
  embed?: ChartEmbed;
@@ -8,7 +8,7 @@ copies this file into your project.
8
8
  import type { Snippet } from 'svelte';
9
9
  import { scaleLinear, scaleSqrt } from 'd3-scale';
10
10
  import { extent, max } from 'd3-array';
11
- import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
11
+ import { Chart, Header, Title, Subtitle, Footer, Source, Notes, type SourceItem } from '../frame/index.js';
12
12
  import type { ChartEmbed } from '../embed/index.js';
13
13
  import { Plot, Svg, Html, type PlotContext } from '../core/index.js';
14
14
  import { Points, Voronoi } from '../marks/index.js';
@@ -37,7 +37,8 @@ copies this file into your project.
37
37
  title?: string;
38
38
  subtitle?: string;
39
39
  notes?: string;
40
- source?: string;
40
+ /** Plain text, or sources with optional links (see `<Source>`). */
41
+ source?: string | SourceItem[];
41
42
  alt?: string;
42
43
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
43
44
  embed?: ChartEmbed;
@@ -161,7 +162,7 @@ copies this file into your project.
161
162
  {#if notes || source}
162
163
  <Footer>
163
164
  {#if notes}<Notes>{notes}</Notes>{/if}
164
- {#if source}<Source>{source}</Source>{/if}
165
+ {#if source}<Source sources={source} />{/if}
165
166
  </Footer>
166
167
  {/if}
167
168
  </Chart>
@@ -1,4 +1,5 @@
1
1
  import type { Snippet } from 'svelte';
2
+ import { type SourceItem } from '../frame/index.js';
2
3
  import type { ChartEmbed } from '../embed/index.js';
3
4
  import { type PlotContext } from '../core/index.js';
4
5
  import { type LocaleCode } from '../locale/index.js';
@@ -23,7 +24,8 @@ declare function $$render<T>(): {
23
24
  title?: string;
24
25
  subtitle?: string;
25
26
  notes?: string;
26
- source?: string;
27
+ /** Plain text, or sources with optional links (see `<Source>`). */
28
+ source?: string | SourceItem[];
27
29
  alt?: string;
28
30
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
29
31
  embed?: ChartEmbed;
@@ -13,7 +13,7 @@ your project and change anything.
13
13
  <script lang="ts" generics="T">
14
14
  import type { Snippet } from 'svelte';
15
15
  import { scaleBand, scaleLinear } from 'd3-scale';
16
- import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
16
+ import { Chart, Header, Title, Subtitle, Footer, Source, Notes, type SourceItem } from '../frame/index.js';
17
17
  import type { ChartEmbed } from '../embed/index.js';
18
18
  import { Plot, Svg, estimateTextWidth, scaled, type PlotContext } from '../core/index.js';
19
19
  import { Rects } from '../marks/index.js';
@@ -59,7 +59,8 @@ your project and change anything.
59
59
  title?: string;
60
60
  subtitle?: string;
61
61
  notes?: string;
62
- source?: string;
62
+ /** Plain text, or sources with optional links (see `<Source>`). */
63
+ source?: string | SourceItem[];
63
64
  alt?: string;
64
65
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
65
66
  embed?: ChartEmbed;
@@ -243,7 +244,7 @@ your project and change anything.
243
244
  {#if notes || source}
244
245
  <Footer>
245
246
  {#if notes}<Notes>{notes}</Notes>{/if}
246
- {#if source}<Source>{source}</Source>{/if}
247
+ {#if source}<Source sources={source} />{/if}
247
248
  </Footer>
248
249
  {/if}
249
250
  </Chart>
@@ -1,4 +1,5 @@
1
1
  import type { Snippet } from 'svelte';
2
+ import { type SourceItem } from '../frame/index.js';
2
3
  import type { ChartEmbed } from '../embed/index.js';
3
4
  import { type PlotContext } from '../core/index.js';
4
5
  import { type LocaleCode } from '../locale/index.js';
@@ -40,7 +41,8 @@ declare function $$render<T>(): {
40
41
  title?: string;
41
42
  subtitle?: string;
42
43
  notes?: string;
43
- source?: string;
44
+ /** Plain text, or sources with optional links (see `<Source>`). */
45
+ source?: string | SourceItem[];
44
46
  alt?: string;
45
47
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
46
48
  embed?: ChartEmbed;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@samizdata/mozaic",
3
- "version": "0.5.1",
4
- "description": "Chart components for the web and print, built on Svelte 5 and d3.",
3
+ "version": "0.7.0",
4
+ "description": "Chart components for the web and print, built on Svelte 5 and d3, and the mozaic CLI (export embeds to SVG, PDF and PNG; eject recipes).",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "author": "Nicu Calcea",
7
7
  "repository": {
@@ -12,9 +12,14 @@
12
12
  "homepage": "https://github.com/samizdata-co/mozaic#readme",
13
13
  "bugs": "https://github.com/samizdata-co/mozaic/issues",
14
14
  "type": "module",
15
+ "bin": {
16
+ "mozaic": "./cli/bin/mozaic.js"
17
+ },
15
18
  "files": [
16
19
  "dist",
17
20
  "src/lib/recipes",
21
+ "cli/bin",
22
+ "cli/src",
18
23
  "!dist/**/*.test.*",
19
24
  "!dist/**/*.spec.*"
20
25
  ],
@@ -107,7 +112,8 @@
107
112
  "d3-hierarchy": "^3.1.2",
108
113
  "d3-scale": "^4.0.2",
109
114
  "d3-shape": "^3.2.0",
110
- "d3-time-format": "^4.1.0"
115
+ "d3-time-format": "^4.1.0",
116
+ "playwright-core": "1.64.1"
111
117
  },
112
118
  "devDependencies": {
113
119
  "@sveltejs/adapter-auto": "^8.0.0",
@@ -124,6 +130,7 @@
124
130
  "@types/d3-shape": "^3.1.6",
125
131
  "@types/d3-time-format": "^4.0.3",
126
132
  "@types/geojson": "^7946.0.14",
133
+ "@types/node": "^24.0.0",
127
134
  "@vitest/coverage-v8": "^4.1.12",
128
135
  "d3-scale-chromatic": "^3.1.0",
129
136
  "linkedom": "^0.18.14",
@@ -144,10 +151,13 @@
144
151
  "#lib": "./src/lib/index.js",
145
152
  "#lib/*": "./src/lib/*"
146
153
  },
154
+ "engines": {
155
+ "node": ">=22.17"
156
+ },
147
157
  "scripts": {
148
158
  "dev": "vite dev",
149
159
  "package": "svelte-kit sync && svelte-package && publint",
150
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
160
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json && tsc -p cli/jsconfig.json",
151
161
  "test:unit": "vitest",
152
162
  "test": "vitest --run",
153
163
  "test:coverage": "vitest --run --coverage"
@@ -11,7 +11,7 @@ project and change anything.
11
11
  import type { Snippet } from 'svelte';
12
12
  import { scaleBand, scaleLinear } from 'd3-scale';
13
13
  import { max, min } from 'd3-array';
14
- import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
14
+ import { Chart, Header, Title, Subtitle, Footer, Source, Notes, type SourceItem } from '../frame/index.js';
15
15
  import type { ChartEmbed } from '../embed/index.js';
16
16
  import { Plot, Svg, estimateTextWidth, scaled, type PlotContext } from '../core/index.js';
17
17
  import { Arrows } from '../marks/index.js';
@@ -38,7 +38,8 @@ project and change anything.
38
38
  title?: string;
39
39
  subtitle?: string;
40
40
  notes?: string;
41
- source?: string;
41
+ /** Plain text, or sources with optional links (see `<Source>`). */
42
+ source?: string | SourceItem[];
42
43
  alt?: string;
43
44
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
44
45
  embed?: ChartEmbed;
@@ -215,7 +216,7 @@ project and change anything.
215
216
  {#if notes || source}
216
217
  <Footer>
217
218
  {#if notes}<Notes>{notes}</Notes>{/if}
218
- {#if source}<Source>{source}</Source>{/if}
219
+ {#if source}<Source sources={source} />{/if}
219
220
  </Footer>
220
221
  {/if}
221
222
  </Chart>
@@ -8,7 +8,7 @@ file into your project and change anything.
8
8
  import type { Snippet } from 'svelte';
9
9
  import { scaleBand, scaleLinear } from 'd3-scale';
10
10
  import { max, min } from 'd3-array';
11
- import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
11
+ import { Chart, Header, Title, Subtitle, Footer, Source, Notes, type SourceItem } from '../frame/index.js';
12
12
  import type { ChartEmbed } from '../embed/index.js';
13
13
  import { Plot, Svg, Html, estimateTextWidth, scaled, type PlotContext } from '../core/index.js';
14
14
  import { Bars, Rules, Text } from '../marks/index.js';
@@ -28,7 +28,8 @@ file into your project and change anything.
28
28
  title?: string;
29
29
  subtitle?: string;
30
30
  notes?: string;
31
- source?: string;
31
+ /** Plain text, or sources with optional links (see `<Source>`). */
32
+ source?: string | SourceItem[];
32
33
  alt?: string;
33
34
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
34
35
  embed?: ChartEmbed;
@@ -116,7 +117,7 @@ file into your project and change anything.
116
117
  {#if notes || source}
117
118
  <Footer>
118
119
  {#if notes}<Notes>{notes}</Notes>{/if}
119
- {#if source}<Source>{source}</Source>{/if}
120
+ {#if source}<Source sources={source} />{/if}
120
121
  </Footer>
121
122
  {/if}
122
123
  </Chart>
@@ -11,7 +11,7 @@ anything.
11
11
  import type { Snippet } from 'svelte';
12
12
  import { scaleBand, scaleLinear } from 'd3-scale';
13
13
  import { max, min } from 'd3-array';
14
- import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
14
+ import { Chart, Header, Title, Subtitle, Footer, Source, Notes, type SourceItem } from '../frame/index.js';
15
15
  import type { ChartEmbed } from '../embed/index.js';
16
16
  import { Plot, Svg, estimateTextWidth, scaled, type PlotContext } from '../core/index.js';
17
17
  import { Bars, Points } from '../marks/index.js';
@@ -38,7 +38,8 @@ anything.
38
38
  title?: string;
39
39
  subtitle?: string;
40
40
  notes?: string;
41
- source?: string;
41
+ /** Plain text, or sources with optional links (see `<Source>`). */
42
+ source?: string | SourceItem[];
42
43
  alt?: string;
43
44
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
44
45
  embed?: ChartEmbed;
@@ -178,7 +179,7 @@ anything.
178
179
  {#if notes || source}
179
180
  <Footer>
180
181
  {#if notes}<Notes>{notes}</Notes>{/if}
181
- {#if source}<Source>{source}</Source>{/if}
182
+ {#if source}<Source sources={source} />{/if}
182
183
  </Footer>
183
184
  {/if}
184
185
  </Chart>
@@ -8,7 +8,7 @@ copies this file into your project.
8
8
  import type { Snippet } from 'svelte';
9
9
  import { scaleBand, scaleLinear } from 'd3-scale';
10
10
  import { max, min } from 'd3-array';
11
- import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
11
+ import { Chart, Header, Title, Subtitle, Footer, Source, Notes, type SourceItem } from '../frame/index.js';
12
12
  import type { ChartEmbed } from '../embed/index.js';
13
13
  import { Plot, Svg, Html, scaled, type PlotContext } from '../core/index.js';
14
14
  import { Bars, Rules } from '../marks/index.js';
@@ -29,7 +29,8 @@ copies this file into your project.
29
29
  title?: string;
30
30
  subtitle?: string;
31
31
  notes?: string;
32
- source?: string;
32
+ /** Plain text, or sources with optional links (see `<Source>`). */
33
+ source?: string | SourceItem[];
33
34
  alt?: string;
34
35
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
35
36
  embed?: ChartEmbed;
@@ -113,7 +114,7 @@ copies this file into your project.
113
114
  {#if notes || source}
114
115
  <Footer>
115
116
  {#if notes}<Notes>{notes}</Notes>{/if}
116
- {#if source}<Source>{source}</Source>{/if}
117
+ {#if source}<Source sources={source} />{/if}
117
118
  </Footer>
118
119
  {/if}
119
120
  </Chart>
@@ -10,7 +10,7 @@ project.
10
10
  import { scaleLinear, scaleTime } from 'd3-scale';
11
11
  import { bisector, extent, max, min } from 'd3-array';
12
12
  import { curveMonotoneX } from 'd3-shape';
13
- import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
13
+ import { Chart, Header, Title, Subtitle, Footer, Source, Notes, type SourceItem } from '../frame/index.js';
14
14
  import type { ChartEmbed } from '../embed/index.js';
15
15
  import { Plot, Svg, Html, type PlotContext } from '../core/index.js';
16
16
  import { Line, LineEndLabels } from '../marks/index.js';
@@ -33,7 +33,8 @@ project.
33
33
  title?: string;
34
34
  subtitle?: string;
35
35
  notes?: string;
36
- source?: string;
36
+ /** Plain text, or sources with optional links (see `<Source>`). */
37
+ source?: string | SourceItem[];
37
38
  alt?: string;
38
39
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
39
40
  embed?: ChartEmbed;
@@ -153,7 +154,7 @@ project.
153
154
  {#if notes || source}
154
155
  <Footer>
155
156
  {#if notes}<Notes>{notes}</Notes>{/if}
156
- {#if source}<Source>{source}</Source>{/if}
157
+ {#if source}<Source sources={source} />{/if}
157
158
  </Footer>
158
159
  {/if}
159
160
  </Chart>
@@ -13,7 +13,7 @@ project and change anything.
13
13
  import type { Snippet } from 'svelte';
14
14
  import { scaleLinear } from 'd3-scale';
15
15
  import { group, sum } from 'd3-array';
16
- import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
16
+ import { Chart, Header, Title, Subtitle, Footer, Source, Notes, type SourceItem } from '../frame/index.js';
17
17
  import type { ChartEmbed } from '../embed/index.js';
18
18
  import { Plot, Svg, estimateTextWidth, type PlotContext } from '../core/index.js';
19
19
  import { Rects } from '../marks/index.js';
@@ -51,7 +51,8 @@ project and change anything.
51
51
  title?: string;
52
52
  subtitle?: string;
53
53
  notes?: string;
54
- source?: string;
54
+ /** Plain text, or sources with optional links (see `<Source>`). */
55
+ source?: string | SourceItem[];
55
56
  alt?: string;
56
57
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
57
58
  embed?: ChartEmbed;
@@ -232,7 +233,7 @@ project and change anything.
232
233
  {#if notes || source}
233
234
  <Footer>
234
235
  {#if notes}<Notes>{notes}</Notes>{/if}
235
- {#if source}<Source>{source}</Source>{/if}
236
+ {#if source}<Source sources={source} />{/if}
236
237
  </Footer>
237
238
  {/if}
238
239
  </Chart>
@@ -15,7 +15,7 @@ your project and change anything.
15
15
  import type { Snippet } from 'svelte';
16
16
  import { scaleBand, scaleLinear } from 'd3-scale';
17
17
  import { max, min } from 'd3-array';
18
- import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
18
+ import { Chart, Header, Title, Subtitle, Footer, Source, Notes, type SourceItem } from '../frame/index.js';
19
19
  import type { ChartEmbed } from '../embed/index.js';
20
20
  import { Plot, Svg, estimateTextWidth, type PlotContext } from '../core/index.js';
21
21
  import { AxisX, GridX, Legend } from '../guides/index.js';
@@ -68,7 +68,8 @@ your project and change anything.
68
68
  title?: string;
69
69
  subtitle?: string;
70
70
  notes?: string;
71
- source?: string;
71
+ /** Plain text, or sources with optional links (see `<Source>`). */
72
+ source?: string | SourceItem[];
72
73
  alt?: string;
73
74
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
74
75
  embed?: ChartEmbed;
@@ -343,7 +344,7 @@ your project and change anything.
343
344
  {#if notes || source}
344
345
  <Footer>
345
346
  {#if notes}<Notes>{notes}</Notes>{/if}
346
- {#if source}<Source>{source}</Source>{/if}
347
+ {#if source}<Source sources={source} />{/if}
347
348
  </Footer>
348
349
  {/if}
349
350
  </Chart>
@@ -8,7 +8,7 @@ copies this file into your project.
8
8
  import type { Snippet } from 'svelte';
9
9
  import { scaleLinear, scaleSqrt } from 'd3-scale';
10
10
  import { extent, max } from 'd3-array';
11
- import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
11
+ import { Chart, Header, Title, Subtitle, Footer, Source, Notes, type SourceItem } from '../frame/index.js';
12
12
  import type { ChartEmbed } from '../embed/index.js';
13
13
  import { Plot, Svg, Html, type PlotContext } from '../core/index.js';
14
14
  import { Points, Voronoi } from '../marks/index.js';
@@ -37,7 +37,8 @@ copies this file into your project.
37
37
  title?: string;
38
38
  subtitle?: string;
39
39
  notes?: string;
40
- source?: string;
40
+ /** Plain text, or sources with optional links (see `<Source>`). */
41
+ source?: string | SourceItem[];
41
42
  alt?: string;
42
43
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
43
44
  embed?: ChartEmbed;
@@ -161,7 +162,7 @@ copies this file into your project.
161
162
  {#if notes || source}
162
163
  <Footer>
163
164
  {#if notes}<Notes>{notes}</Notes>{/if}
164
- {#if source}<Source>{source}</Source>{/if}
165
+ {#if source}<Source sources={source} />{/if}
165
166
  </Footer>
166
167
  {/if}
167
168
  </Chart>
@@ -13,7 +13,7 @@ your project and change anything.
13
13
  <script lang="ts" generics="T">
14
14
  import type { Snippet } from 'svelte';
15
15
  import { scaleBand, scaleLinear } from 'd3-scale';
16
- import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
16
+ import { Chart, Header, Title, Subtitle, Footer, Source, Notes, type SourceItem } from '../frame/index.js';
17
17
  import type { ChartEmbed } from '../embed/index.js';
18
18
  import { Plot, Svg, estimateTextWidth, scaled, type PlotContext } from '../core/index.js';
19
19
  import { Rects } from '../marks/index.js';
@@ -59,7 +59,8 @@ your project and change anything.
59
59
  title?: string;
60
60
  subtitle?: string;
61
61
  notes?: string;
62
- source?: string;
62
+ /** Plain text, or sources with optional links (see `<Source>`). */
63
+ source?: string | SourceItem[];
63
64
  alt?: string;
64
65
  /** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
65
66
  embed?: ChartEmbed;
@@ -243,7 +244,7 @@ your project and change anything.
243
244
  {#if notes || source}
244
245
  <Footer>
245
246
  {#if notes}<Notes>{notes}</Notes>{/if}
246
- {#if source}<Source>{source}</Source>{/if}
247
+ {#if source}<Source sources={source} />{/if}
247
248
  </Footer>
248
249
  {/if}
249
250
  </Chart>