@fusion.dev/helix-map 0.117.0 → 0.119.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,10 +1,9 @@
1
- import { HelixActivateEvent, HelixMapClusterEvent, HelixMapPanEvent, HelixMapPartChangeEvent, HelixMapRotateEvent, HelixMapTiltEvent, HelixMapZoomEvent, isRtl, } from '@fusion.dev/helix-core';
1
+ import { HelixActivateEvent, HelixMapClusterEvent, HelixMapPanEvent, HelixMapPartChangeEvent, HelixMapRotateEvent, HelixMapTiltEvent, HelixMapZoomEvent, isRtl, watchTheme, } from '@fusion.dev/helix-core';
2
2
  import { creditParts } from '../credit/credit.js';
3
3
  import { motionOf } from '../motion/motion.js';
4
4
  import { pointsFrom } from '../points/points.js';
5
5
  import { colorsNow, settledColor } from '../style/map-colors.js';
6
6
  import { legible, parseColor } from '../style/oklab.js';
7
- import { watchTheme } from '../theme/watch-theme.js';
8
7
  import { captionAt } from './caption.js';
9
8
  const SAME_SPOT = 2;
10
9
  const fanOut = (count, spacing) => {
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { watchTheme } from '@fusion.dev/helix-core';
1
2
  export type { ConnectOptions, MapBounds, MapConnection, MapDriver, MapInView, MapLayerEvents, MapLayerSpec, MapPadding, MapPlace, MapType, } from './connect-map/index.js';
2
3
  export { connectMap, distancesAlong } from './connect-map/index.js';
3
4
  export type { CreditPart } from './credit/index.js';
@@ -8,4 +9,3 @@ export type { MapPoints } from './points/index.js';
8
9
  export { pointsFrom } from './points/index.js';
9
10
  export type { MapColors } from './style/index.js';
10
11
  export { colorsNow, colorsReady, fontReady, mapColorsFrom, mapFontFrom, PATIENCE, settledColor, } from './style/index.js';
11
- export { watchTheme } from './theme/index.js';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
+ export { watchTheme } from '@fusion.dev/helix-core';
1
2
  export { connectMap, distancesAlong } from './connect-map/index.js';
2
3
  export { creditParts } from './credit/index.js';
3
4
  export { easingOf, millisecondsOf, motionOf } from './motion/index.js';
4
5
  export { pointsFrom } from './points/index.js';
5
6
  export { colorsNow, colorsReady, fontReady, mapColorsFrom, mapFontFrom, PATIENCE, settledColor, } from './style/index.js';
6
- export { watchTheme } from './theme/index.js';
@@ -1,7 +1,7 @@
1
+ import { watchTheme } from '@fusion.dev/helix-core';
1
2
  import { contourInterval, contoursOf, heightsFrom, joinedAcross, tilesCovering, } from '../contours/contours.js';
2
3
  import { colorsNow, mapColorsFrom, PATIENCE } from '../style/map-colors.js';
3
4
  import { cssColor, mix, oklch, parseColor } from '../style/oklab.js';
4
- import { watchTheme } from '../theme/watch-theme.js';
5
5
  import { drawMapImage, IMAGE_RATIO } from './map-images.js';
6
6
  const SOURCE = 'helix-layers';
7
7
  export const LAYERS = [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fusion.dev/helix-map",
3
3
  "description": "Connects the Helix Map frame to a map renderer: MapLibre, Leaflet, or a driver of your own.",
4
- "version": "0.117.0",
4
+ "version": "0.119.0",
5
5
  "license": "MIT",
6
6
  "author": "Ross Sheppard <ross.sheppard@fusion.dev>",
7
7
  "repository": {
@@ -43,14 +43,14 @@
43
43
  },
44
44
  "bugs": "https://github.com/project-fusion/fusion/issues",
45
45
  "dependencies": {
46
- "@fusion.dev/helix-core": "0.117.0",
47
- "@fusion.dev/helix-icons": "0.117.0",
46
+ "@fusion.dev/helix-core": "0.119.0",
47
+ "@fusion.dev/helix-icons": "0.119.0",
48
48
  "@mapbox/vector-tile": "^3.0.0",
49
49
  "pbf": "^5.1.2"
50
50
  },
51
51
  "devDependencies": {
52
- "@fusion.dev/helix-headless": "0.117.0",
53
- "@fusion.dev/helix-testing": "0.117.0",
52
+ "@fusion.dev/helix-headless": "0.119.0",
53
+ "@fusion.dev/helix-testing": "0.119.0",
54
54
  "@maplibre/maplibre-gl-style-spec": "^26.4.4",
55
55
  "@types/bun": "^1.3.0",
56
56
  "@types/leaflet": "^1.9.20",
@@ -1 +0,0 @@
1
- export { watchTheme } from './watch-theme.js';
@@ -1 +0,0 @@
1
- export { watchTheme } from './watch-theme.js';
@@ -1,13 +0,0 @@
1
- /**
2
- * Calls `changed` once a frame after anything that can move an element's
3
- * theme: a class, a mode, a theme's own marker or an inline token on the
4
- * element or any element above it, or the reader's light or dark preference.
5
- *
6
- * **Above it and not beside it.** A theme reaches an element only through
7
- * the elements it is inside, so each of those is watched for its own
8
- * attributes and nothing below them is: a page-wide watch heard a map's own
9
- * markers being placed, every frame of every pan, and threw each one away.
10
- *
11
- * Returns what stops watching.
12
- */
13
- export declare const watchTheme: (element: Element, changed: () => void) => (() => void);
@@ -1,29 +0,0 @@
1
- const above = (element) => {
2
- const chain = [];
3
- let at = element;
4
- while (at) {
5
- chain.push(at);
6
- const root = at.getRootNode();
7
- at = at.parentElement ?? (root instanceof ShadowRoot ? root.host : null);
8
- }
9
- return chain;
10
- };
11
- const THEMING = ['class', 'data-color-mode', 'data-helix-theme', 'style'];
12
- export const watchTheme = (element, changed) => {
13
- let pending = 0;
14
- const soon = () => {
15
- cancelAnimationFrame(pending);
16
- pending = requestAnimationFrame(() => changed());
17
- };
18
- const observer = new MutationObserver(soon);
19
- for (const one of above(element)) {
20
- observer.observe(one, { attributeFilter: THEMING, attributes: true });
21
- }
22
- const scheme = typeof matchMedia === 'function' ? matchMedia('(prefers-color-scheme: dark)') : null;
23
- scheme?.addEventListener('change', soon);
24
- return () => {
25
- cancelAnimationFrame(pending);
26
- observer.disconnect();
27
- scheme?.removeEventListener('change', soon);
28
- };
29
- };