@swr-data-lab/components 2.26.0 → 2.28.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.
@@ -47,6 +47,7 @@ const rules = [
47
47
  --color-pageFill: var(--pageFill-light);
48
48
  --color-surfaceFill: var(--surfaceFill-light);
49
49
  --color-surfaceBorder: var(--surfaceBorder-light);
50
+ --color-dropShadow: var(--dropShadow-light);
50
51
  }
51
52
  .container[data-theme=dark] {
52
53
  --color-logoFill: var(--logoFill-dark);
@@ -56,6 +57,7 @@ const rules = [
56
57
  --color-textPrimary: var(--textPrimary-dark);
57
58
  --color-textSecondary: var(--textSecondary-dark);
58
59
  --color-textSecondaryHover: var(--textSecondaryHover-dark);
60
+ --color-dropShadow: var(--dropShadow-dark);
59
61
  }
60
62
  .container {
61
63
  --swr-text: "SWR-VAR-Text", sans-serif;
@@ -169,12 +169,16 @@ const semantics = {
169
169
  light: '#ffffff'
170
170
  },
171
171
  surfaceBorder: {
172
- dark: 'hsl(0, 0%, 35%)',
173
- light: shades.gray.base
172
+ dark: 'rgba(255,255,255,.15)',
173
+ light: shades.gray.light3
174
174
  },
175
175
  pageFill: {
176
176
  dark: '#0C0C0C',
177
177
  light: '#fff'
178
+ },
179
+ dropShadow: {
180
+ dark: 'rgba(0,0,0, 0.25)',
181
+ light: 'rgba(0,0,0, 0.0375)'
178
182
  }
179
183
  };
180
184
  const scales = {
@@ -0,0 +1,36 @@
1
+ <script lang="ts">import {} from 'svelte';
2
+ let { height = '100vh', children } = $props();
3
+ </script>
4
+
5
+ <section class="container" style:height>
6
+ <div class="inner">
7
+ {@render children?.()}
8
+ </div>
9
+ </section>
10
+
11
+ <style>.container {
12
+ display: flex;
13
+ align-items: center;
14
+ }
15
+
16
+ .inner {
17
+ margin: 0 auto;
18
+ padding: 1em 1.5em;
19
+ color: var(--color-textPrimary);
20
+ max-width: 40em;
21
+ font-family: var(--swr-sans);
22
+ font-weight: 400;
23
+ line-height: 1.5;
24
+ letter-spacing: 0.01em;
25
+ font-size: var(--fs-small-1);
26
+ border-radius: 8px;
27
+ background: var(--color-surfaceFill);
28
+ box-shadow: 0 0 8px 1px var(--color-dropShadow);
29
+ border: 1px solid var(--color-surfaceBorder);
30
+ }
31
+ @media (min-width: 500px) {
32
+ .inner {
33
+ padding: 1.25em;
34
+ margin: 1em auto;
35
+ }
36
+ }</style>
@@ -0,0 +1,8 @@
1
+ import { type Snippet } from 'svelte';
2
+ interface SlideContentProps {
3
+ height?: string;
4
+ children: Snippet;
5
+ }
6
+ declare const ScrollerSection: import("svelte").Component<SlideContentProps, {}, "">;
7
+ type ScrollerSection = ReturnType<typeof ScrollerSection>;
8
+ export default ScrollerSection;
@@ -0,0 +1,2 @@
1
+ import ScrollerSection from './ScrollerSection.svelte';
2
+ export default ScrollerSection;
@@ -0,0 +1,2 @@
1
+ import ScrollerSection from './ScrollerSection.svelte';
2
+ export default ScrollerSection;
@@ -1,11 +1,10 @@
1
- <script lang="ts">import { getContext } from 'svelte';
1
+ <script lang="ts">import {} from 'svelte';
2
2
  import Caption from '../Caption/Caption.svelte';
3
- let theme = getContext('theme');
4
3
  const { title, subtitle, eyebrow, imageModules, updated, bylines = [] } = $props();
5
4
  const updated_on = updated ? (updated instanceof Date ? updated : new Date(updated)) : null;
6
5
  </script>
7
6
 
8
- <header class={`container theme-${theme}`}>
7
+ <header class="container">
9
8
  {#if eyebrow}
10
9
  <p class="eyebrow">{eyebrow}</p>
11
10
  {/if}
@@ -46,10 +45,7 @@ const updated_on = updated ? (updated instanceof Date ? updated : new Date(updat
46
45
  margin: 0 auto;
47
46
  margin-bottom: 1rem;
48
47
  max-width: 44rem;
49
- text-shadow: 0 0 4px white;
50
- }
51
- .container.theme-dark {
52
- text-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
48
+ text-shadow: 0 0 6px var(--color-pageFill);
53
49
  }
54
50
 
55
51
  .eyebrow {
@@ -74,7 +70,6 @@ const updated_on = updated ? (updated instanceof Date ? updated : new Date(updat
74
70
  line-height: 1.4;
75
71
  font-size: var(--fs-base);
76
72
  font-weight: 400;
77
- text-shadow: none;
78
73
  hyphens: auto;
79
74
  }
80
75
 
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { default as Caption } from "./Caption/Caption.svelte";
7
7
  export { default as Note } from "./Note/Note.svelte";
8
8
  export { default as Card } from "./Card/Card.svelte";
9
9
  export { default as Scroller } from "./Scroller/Scroller.svelte";
10
+ export { default as ScrollerSection } from "./ScrollerSection/ScrollerSection.svelte";
10
11
  export { default as SwrHeader } from "./SwrHeader/SwrHeader.svelte";
11
12
  export { default as ChartHeader } from "./ChartHeader/ChartHeader.svelte";
12
13
  export { default as ChartFooter } from "./ChartFooter/ChartFooter.svelte";
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@ export { default as Note } from './Note/Note.svelte';
12
12
  // Display
13
13
  export { default as Card } from './Card/Card.svelte';
14
14
  export { default as Scroller } from './Scroller/Scroller.svelte';
15
+ export { default as ScrollerSection } from './ScrollerSection/ScrollerSection.svelte';
15
16
  export { default as SwrHeader } from './SwrHeader/SwrHeader.svelte';
16
17
 
17
18
  // Chart
@@ -1,5 +1,5 @@
1
- import type { StyleSpecification } from 'maplibre-gl';
2
1
  import type { StyleOptions } from './types';
2
+ import type { StyleSpecification } from 'maplibre-gl';
3
3
  interface styleFunction {
4
4
  (options?: StyleOptions): StyleSpecification;
5
5
  }
@@ -1,3 +1,4 @@
1
+ import defaultOptions from './defaultOptions';
1
2
  import makeAdmin from './components/Admin';
2
3
  import makeBuildings from './components/Buildings';
3
4
  import makeLanduse from './components/Landuse';
@@ -46,10 +47,7 @@ const { roadLabels, roadBridges, roadSurface, roadTunnels } = makeRoads(tokens);
46
47
  const { buildingFootprints, buildingExtrusions, structureExtrusions } = makeBuildings(tokens);
47
48
  const style = (opts) => {
48
49
  const options = {
49
- enableBuildingExtrusions: false,
50
- roads: {
51
- showLabels: true
52
- },
50
+ ...defaultOptions,
53
51
  ...opts
54
52
  };
55
53
  return {
@@ -113,7 +111,8 @@ const style = (opts) => {
113
111
  // 8. Building extrusions
114
112
  ...(options.enableBuildingExtrusions ? [buildingExtrusions] : []),
115
113
  // 8. Point labels
116
- ...placeLabels,
114
+ ...(options.places?.showLabels ? placeLabels : []),
115
+ // 9. Admin boundary labels
117
116
  ...boundaryLabels
118
117
  ]
119
118
  };
@@ -1,5 +1,5 @@
1
- import type { StyleSpecification } from 'maplibre-gl';
2
1
  import type { StyleOptions } from './types';
2
+ import type { StyleSpecification } from 'maplibre-gl';
3
3
  interface styleFunction {
4
4
  (options?: StyleOptions): StyleSpecification;
5
5
  }
@@ -5,6 +5,7 @@ import makeTransit from './components/Transit';
5
5
  import makePlaceLabels from './components/PlaceLabels';
6
6
  import makeWalking from './components/Walking';
7
7
  import makeRoads from './components/Roads';
8
+ import defaultOptions from './defaultOptions';
8
9
  const tokens = {
9
10
  sans_regular: ['SWR Sans Regular'],
10
11
  sans_medium: ['SWR Sans Medium'],
@@ -46,7 +47,7 @@ const { roadLabels, roadBridges, roadSurface, roadTunnels } = makeRoads(tokens);
46
47
  const { buildingFootprints, buildingExtrusions, structureExtrusions } = makeBuildings(tokens);
47
48
  const style = (opts) => {
48
49
  const options = {
49
- enableBuildingExtrusions: false,
50
+ ...defaultOptions,
50
51
  ...opts
51
52
  };
52
53
  return {
@@ -110,7 +111,8 @@ const style = (opts) => {
110
111
  // 8. Building extrusions
111
112
  ...(options.enableBuildingExtrusions ? [buildingExtrusions] : []),
112
113
  // 8. Point labels
113
- ...placeLabels,
114
+ ...(options.places?.showLabels ? placeLabels : []),
115
+ // 9. Admin boundary labels
114
116
  ...boundaryLabels
115
117
  ]
116
118
  };
@@ -0,0 +1,3 @@
1
+ import type { StyleOptions } from './types';
2
+ declare const opts: StyleOptions;
3
+ export default opts;
@@ -0,0 +1,10 @@
1
+ const opts = {
2
+ enableBuildingExtrusions: false,
3
+ places: {
4
+ showLabels: true
5
+ },
6
+ roads: {
7
+ showLabels: true
8
+ }
9
+ };
10
+ export default opts;
@@ -1,5 +1,8 @@
1
1
  interface StyleOptions {
2
2
  enableBuildingExtrusions?: boolean;
3
+ places?: {
4
+ showLabels?: boolean;
5
+ };
3
6
  roads?: {
4
7
  showLabels?: boolean;
5
8
  };
@@ -1,4 +1,4 @@
1
- <script lang="ts">import { onDestroy } from 'svelte';
1
+ <script lang="ts">import { onDestroy, tick } from 'svelte';
2
2
  import maplibre, {} from 'maplibre-gl';
3
3
  import { getMapContext } from '../context.svelte.js';
4
4
  import { resetPopupEventListener } from '../utils';
@@ -14,6 +14,10 @@ let el = $state();
14
14
  $effect(() => {
15
15
  if (position && el && map) {
16
16
  tooltip.setLngLat(position).setDOMContent(el).addTo(map);
17
+ // Ensure tooltip doesn't extend beyond the map canvas, see #223
18
+ tick().then(() => {
19
+ tooltip._update();
20
+ });
17
21
  }
18
22
  else {
19
23
  tooltip.remove();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@swr-data-lab/components",
3
3
  "description": "SWR Data Lab component library",
4
- "version": "2.26.0",
4
+ "version": "2.28.0",
5
5
  "author": "SWR Data Lab",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -59,7 +59,7 @@
59
59
  "concurrently": "^9.2.1",
60
60
  "http-server": "^14.1.1",
61
61
  "mdx-mermaid": "^2.0.3",
62
- "playwright": "^1.55.0",
62
+ "playwright": "^1.55.1",
63
63
  "publint": "^0.3.12",
64
64
  "sass": "^1.91.0",
65
65
  "sass-embedded": "^1.93.2",
@@ -69,7 +69,7 @@
69
69
  "svelte-check": "^4.3.2",
70
70
  "svelte-preprocess": "^6.0.3",
71
71
  "typescript": "^5.9.2",
72
- "vite": "^7.1.7",
72
+ "vite": "^7.1.11",
73
73
  "vitest": "^3.1.1",
74
74
  "wait-on": "^8.0.1"
75
75
  },