@samizdata/mozaic 0.8.0 → 0.9.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,6 +1,8 @@
1
1
  <!--
2
2
  @component
3
- Notes, sources and credits below the plot, with the house wordmark on the right.
3
+ Notes, sources and credits below the plot. Each takes the full width, except the `Source` line,
4
+ which shares its row with the house logo on the right. Without a `Source`, the logo sits below
5
+ the rest, on the right.
4
6
  -->
5
7
  <script lang="ts">
6
8
  import type { Snippet } from 'svelte';
@@ -14,26 +16,35 @@ Notes, sources and credits below the plot, with the house wordmark on the right.
14
16
  </script>
15
17
 
16
18
  <footer class="mz-footer {className}">
17
- <div class="mz-footer-text">
18
- {@render children?.()}
19
- </div>
19
+ {@render children?.()}
20
20
  {#if logo}<Logo />{/if}
21
21
  </footer>
22
22
 
23
23
  <style>
24
24
  .mz-footer {
25
- display: flex;
26
- align-items: flex-end;
27
- justify-content: space-between;
28
- gap: 1rem;
25
+ display: grid;
26
+ grid-template-columns: minmax(0, 1fr) auto;
27
+ /* Dense, so the logo (last in the markup) goes back up to the free cell beside the source. */
28
+ grid-auto-flow: row dense;
29
+ align-items: center;
30
+ column-gap: 1rem;
31
+ row-gap: 0.25rem;
29
32
  font-size: var(--mz-size-small);
30
33
  line-height: 1.4;
31
34
  color: var(--mz-color-muted);
32
35
  }
33
- .mz-footer-text {
34
- display: flex;
35
- flex-direction: column;
36
- gap: 0.25rem;
37
- min-width: 0;
36
+ .mz-footer > :global(*) {
37
+ grid-column: 1 / -1;
38
+ }
39
+ .mz-footer > :global(.mz-source) {
40
+ grid-column: 1;
41
+ }
42
+ .mz-footer > :global(.mz-logo) {
43
+ grid-column: 2;
44
+ justify-self: end;
45
+ }
46
+ /* No taller than one and a half lines of footer text, whatever height the style gives the mark. */
47
+ .mz-footer > :global(.mz-logo .mz-logo-mark) {
48
+ max-height: 1.5lh;
38
49
  }
39
50
  </style>
@@ -4,7 +4,11 @@ type $$ComponentProps = {
4
4
  class?: string;
5
5
  children?: Snippet;
6
6
  };
7
- /** Notes, sources and credits below the plot, with the house wordmark on the right. */
7
+ /**
8
+ * Notes, sources and credits below the plot. Each takes the full width, except the `Source` line,
9
+ * which shares its row with the house logo on the right. Without a `Source`, the logo sits below
10
+ * the rest, on the right.
11
+ */
8
12
  declare const Footer: import("svelte").Component<$$ComponentProps, {}, "">;
9
13
  type Footer = ReturnType<typeof Footer>;
10
14
  export default Footer;
@@ -1,6 +1,7 @@
1
1
  <!--
2
2
  @component
3
- "Note: …", with the label in the chart's language. Set `plural` for several notes.
3
+ "Note: …", with the label in the chart's language. Set `plural` for several notes. Renders
4
+ nothing when the content is empty (`<Notes>{t.notes}</Notes>` with no `notes` string).
4
5
  -->
5
6
  <script lang="ts">
6
7
  import type { Snippet } from 'svelte';
@@ -13,13 +14,16 @@
13
14
 
14
15
  <p class="mz-notes">
15
16
  <span class="mz-label">{plural ? chart.locale.strings.notes : chart.locale.strings.note}:</span>
16
- {@render children?.()}
17
+ <span class="mz-notes-body">{@render children?.()}</span>
17
18
  </p>
18
19
 
19
20
  <style>
20
21
  .mz-notes {
21
22
  margin: 0;
22
23
  }
24
+ .mz-notes:has(> .mz-notes-body:empty) {
25
+ display: none;
26
+ }
23
27
  .mz-label {
24
28
  font-family: var(--mz-font-label);
25
29
  font-weight: var(--mz-weight-label);
@@ -3,7 +3,10 @@ type $$ComponentProps = {
3
3
  plural?: boolean;
4
4
  children?: Snippet;
5
5
  };
6
- /** "Note: …", with the label in the chart's language. Set `plural` for several notes. */
6
+ /**
7
+ * "Note: …", with the label in the chart's language. Set `plural` for several notes. Renders
8
+ * nothing when the content is empty (`<Notes>{t.notes}</Notes>` with no `notes` string).
9
+ */
7
10
  declare const Notes: import("svelte").Component<$$ComponentProps, {}, "">;
8
11
  type Notes = ReturnType<typeof Notes>;
9
12
  export default Notes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samizdata/mozaic",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
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",