@samizdata/mozaic 0.12.0 → 0.12.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.
package/README.md CHANGED
@@ -40,7 +40,7 @@ pnpm add @samizdata/mozaic d3-scale d3-array d3-shape
40
40
  | `@samizdata/mozaic/locale` | `createLocale` (`en`, `ro`, `ru`) |
41
41
  | `@samizdata/mozaic/embed` | `Embed`, `useEmbedParams`, `embedCode`, `hostScript`, `observeHeight` |
42
42
  | `@samizdata/mozaic/export` | `figureToSvg`, `downloadSvg`, `downloadPng`, `figureToPng` |
43
- | `@samizdata/mozaic/recipes` | `BarChart`, `ColumnChart`, `LineChart`, `ScatterChart`, `ArrowChart`, `BarDotChart`, `StackedBarChart`, `MosaicChart`, `PercentileChart` |
43
+ | `@samizdata/mozaic/recipes` | `BarChart`, `ColumnChart`, `LineChart`, `ScatterChart`, `ArrowChart`, `BarDotChart`, `StackedBarChart`, `MosaicChart`, `PercentileChart`, `StripChart` |
44
44
 
45
45
  ## CLI
46
46
 
@@ -132,7 +132,8 @@ file into your project and change anything.
132
132
  const barColor = (d: T) => color?.(d) ?? theme.palettes.categorical[0];
133
133
  /** White on dark bars, the text colour on light ones. */
134
134
  const inkOn = (d: T) => (contrastRatio(barColor(d), '#ffffff') >= 4.5 ? '#ffffff' : 'var(--mz-color-text)');
135
- let hovered = $state<T | null>(null);
135
+ // Raw, not a proxy: marks compare the hovered row with each datum by identity.
136
+ let hovered = $state.raw<T | null>(null);
136
137
  </script>
137
138
 
138
139
  <Chart {style} {locale} {medium} {width} {alt} {embed}>
@@ -74,7 +74,8 @@ copies this file into your project.
74
74
  .domain([Math.min(0, min(data, value) ?? 0), Math.max(0, max(data, value) ?? 1)])
75
75
  .nice()
76
76
  );
77
- let hovered = $state<T | null>(null);
77
+ // Raw, not a proxy: marks compare the hovered row with each datum by identity.
78
+ let hovered = $state.raw<T | null>(null);
78
79
  </script>
79
80
 
80
81
  <Chart {style} {locale} {medium} {width} {alt} {embed}>
@@ -187,7 +187,8 @@ copies this file into your project.
187
187
  : basePadding;
188
188
  };
189
189
  const withUnit = (s: string, unit?: string) => (unit ? `${s} ${unit}` : s);
190
- let hovered = $state<T | null>(null);
190
+ // Raw, not a proxy: marks compare the hovered row with each datum by identity.
191
+ let hovered = $state.raw<T | null>(null);
191
192
  </script>
192
193
 
193
194
  <Chart {style} {locale} {medium} {width} {alt} {embed}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samizdata/mozaic",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
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",
@@ -132,7 +132,8 @@ file into your project and change anything.
132
132
  const barColor = (d: T) => color?.(d) ?? theme.palettes.categorical[0];
133
133
  /** White on dark bars, the text colour on light ones. */
134
134
  const inkOn = (d: T) => (contrastRatio(barColor(d), '#ffffff') >= 4.5 ? '#ffffff' : 'var(--mz-color-text)');
135
- let hovered = $state<T | null>(null);
135
+ // Raw, not a proxy: marks compare the hovered row with each datum by identity.
136
+ let hovered = $state.raw<T | null>(null);
136
137
  </script>
137
138
 
138
139
  <Chart {style} {locale} {medium} {width} {alt} {embed}>
@@ -74,7 +74,8 @@ copies this file into your project.
74
74
  .domain([Math.min(0, min(data, value) ?? 0), Math.max(0, max(data, value) ?? 1)])
75
75
  .nice()
76
76
  );
77
- let hovered = $state<T | null>(null);
77
+ // Raw, not a proxy: marks compare the hovered row with each datum by identity.
78
+ let hovered = $state.raw<T | null>(null);
78
79
  </script>
79
80
 
80
81
  <Chart {style} {locale} {medium} {width} {alt} {embed}>
@@ -187,7 +187,8 @@ copies this file into your project.
187
187
  : basePadding;
188
188
  };
189
189
  const withUnit = (s: string, unit?: string) => (unit ? `${s} ${unit}` : s);
190
- let hovered = $state<T | null>(null);
190
+ // Raw, not a proxy: marks compare the hovered row with each datum by identity.
191
+ let hovered = $state.raw<T | null>(null);
191
192
  </script>
192
193
 
193
194
  <Chart {style} {locale} {medium} {width} {alt} {embed}>