@macrostrat/map-interface 1.0.11 → 1.1.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.
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@macrostrat/map-interface",
3
- "version": "1.0.11",
3
+ "version": "1.1.0",
4
4
  "description": "Map interface for Macrostrat",
5
- "main": "dist/main.cjs",
6
- "module": "dist/module.mjs",
5
+ "main": "dist/index.cjs.js",
6
+ "module": "dist/index.js",
7
7
  "types": "dist/types.d.ts",
8
8
  "source": "src/index.ts",
9
- "style": "dist/main.css",
9
+ "style": "dist/index.css",
10
10
  "dependencies": {
11
11
  "@macrostrat/color-utils": "^1.0.0",
12
12
  "@macrostrat/hyper": "^3.0.0",
13
- "@macrostrat/mapbox-react": "^2.2.3",
13
+ "@macrostrat/mapbox-react": "^2.4.0",
14
14
  "@macrostrat/mapbox-utils": "^1.3.2",
15
15
  "@macrostrat/ui-components": "^4.0.4",
16
16
  "@mapbox/tilebelt": "^2.0.0",
@@ -35,14 +35,24 @@
35
35
  "exports": {
36
36
  ".": {
37
37
  "typescript": "./src",
38
- "import": "./dist/module.mjs",
39
- "require": "./dist/main.cjs",
38
+ "import": {
39
+ "types": "./dist/types.d.ts",
40
+ "default": "./dist/index.js"
41
+ },
42
+ "require": {
43
+ "types": "./dist/types.d.ts",
44
+ "default": "./dist/index.cjs.js"
45
+ },
40
46
  "types:": "./dist/types.d.ts",
41
- "style": "./dist/main.css"
47
+ "style": "./dist/index.css"
42
48
  },
43
49
  "./dist/": {
44
50
  "import": "./dist/",
45
51
  "require": "./dist/"
52
+ },
53
+ "./dist/index.css": {
54
+ "import": "./dist/index.css",
55
+ "require": "./dist/index.css"
46
56
  }
47
57
  },
48
58
  "files": [
@@ -29,12 +29,11 @@ export function LoadingButton({
29
29
  }
30
30
 
31
31
  export function MapLoadingButton(props) {
32
- const { isLoading } = useMapStatus();
33
- const mapIsLoading = useMemo(() => isLoading, [isLoading]);
34
- return h(LoadingButton, { ...props, isLoading: mapIsLoading });
32
+ const isLoading = useMapStatus((s) => s.isLoading);
33
+ return h(LoadingButton, { ...props, isLoading });
35
34
  }
36
35
 
37
- type AnyChildren = React.ReactNode | React.ReactFragment;
36
+ type AnyChildren = React.ReactNode;
38
37
 
39
38
  export interface FloatingNavbarProps {
40
39
  className?: string;
@@ -4,7 +4,7 @@ import hyper from "@macrostrat/hyper";
4
4
  import { Spacer, useDarkMode, useStoredState } from "@macrostrat/ui-components";
5
5
  import mapboxgl from "mapbox-gl";
6
6
  import { useCallback, useState, useEffect } from "react";
7
- import { buildInspectorStyle, buildXRayStyle } from "./xray";
7
+ import { buildInspectorStyle } from "./xray";
8
8
  import { MapAreaContainer, PanelCard } from "../container";
9
9
  import { FloatingNavbar, MapLoadingButton } from "../context-panel";
10
10
  import { MapMarker } from "../helpers";
@@ -30,11 +30,13 @@ export function MapInspector({
30
30
  overlayStyle = null,
31
31
  children,
32
32
  style,
33
+ bounds = null,
33
34
  focusedSource = null,
34
35
  focusedSourceTitle = null,
35
36
  fitViewport = true,
37
+ styleType = "macrostrat",
36
38
  }: {
37
- headerElement?: React.ReactElement;
39
+ headerElement?: React.ReactNode;
38
40
  transformRequest?: mapboxgl.TransformRequestFunction;
39
41
  title?: string;
40
42
  style?: mapboxgl.Style | string;
@@ -45,7 +47,9 @@ export function MapInspector({
45
47
  focusedSourceTitle?: string;
46
48
  projection?: string;
47
49
  mapPosition?: MapPosition;
50
+ bounds?: [number, number, number, number];
48
51
  fitViewport?: boolean;
52
+ styleType: "standard" | "macrostrat";
49
53
  }) {
50
54
  /* We apply a custom style to the panel container when we are interacting
51
55
  with the search bar, so that we can block map interactions until search
@@ -61,9 +65,15 @@ export function MapInspector({
61
65
  mapboxgl.accessToken = mapboxToken;
62
66
  }
63
67
 
64
- style ??= isEnabled
65
- ? "mapbox://styles/mapbox/dark-v10"
66
- : "mapbox://styles/mapbox/light-v10";
68
+ if (styleType == "macrostrat") {
69
+ style ??= isEnabled
70
+ ? "mapbox://styles/jczaplewski/cl5uoqzzq003614o6url9ou9z?optimize=true"
71
+ : "mapbox://styles/jczaplewski/clatdbkw4002q14lov8zx0bm0?optimize=true";
72
+ } else {
73
+ style ??= isEnabled
74
+ ? "mapbox://styles/mapbox/dark-v10"
75
+ : "mapbox://styles/mapbox/light-v10";
76
+ }
67
77
 
68
78
  const [isOpen, setOpen] = useState(false);
69
79
 
@@ -73,9 +83,7 @@ export function MapInspector({
73
83
  });
74
84
  const { showTileExtent, xRay } = state;
75
85
 
76
- const [actualStyle, setActualStyle] = useState(style);
77
-
78
- console.log("actualStyle", actualStyle);
86
+ const [actualStyle, setActualStyle] = useState(null);
79
87
 
80
88
  useEffect(() => {
81
89
  buildInspectorStyle(style, overlayStyle, {
@@ -139,6 +147,7 @@ export function MapInspector({
139
147
  title,
140
148
  }),
141
149
  contextPanel: h(PanelCard, [
150
+ children,
142
151
  h(Switch, {
143
152
  checked: xRay,
144
153
  label: "X-ray mode",
@@ -146,7 +155,6 @@ export function MapInspector({
146
155
  setState({ ...state, xRay: !xRay });
147
156
  },
148
157
  }),
149
- children,
150
158
  ]),
151
159
  detailPanel: detailElement,
152
160
  contextPanelOpen: isOpen,
@@ -160,6 +168,7 @@ export function MapInspector({
160
168
  mapPosition,
161
169
  projection: { name: "globe" },
162
170
  mapboxToken,
171
+ bounds,
163
172
  },
164
173
  [
165
174
  h(FeatureSelectionHandler, {
package/src/helpers.ts CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  useMapEaseTo,
4
4
  useMapDispatch,
5
5
  useMapStatus,
6
+ useMapInitialized,
6
7
  } from "@macrostrat/mapbox-react";
7
8
  import { useMemo, useRef } from "react";
8
9
  import { debounce } from "underscore";
@@ -86,6 +87,7 @@ export function MapPaddingManager({
86
87
  export function MapMovedReporter({ onMapMoved = null }) {
87
88
  const mapRef = useMapRef();
88
89
  const dispatch = useMapDispatch();
90
+ const isInitialized = useMapInitialized();
89
91
 
90
92
  const mapMovedCallback = useCallback(() => {
91
93
  const map = mapRef.current;
@@ -93,7 +95,7 @@ export function MapMovedReporter({ onMapMoved = null }) {
93
95
  const mapPosition = getMapPosition(map);
94
96
  dispatch({ type: "map-moved", payload: mapPosition });
95
97
  onMapMoved?.(mapPosition, map);
96
- }, [mapRef.current, onMapMoved, dispatch]);
98
+ }, [onMapMoved, dispatch, isInitialized]);
97
99
 
98
100
  useEffect(() => {
99
101
  // Get the current value of the map. Useful for gradually moving away
@@ -120,6 +122,7 @@ export function MapLoadingReporter({
120
122
  const mapRef = useMapRef();
121
123
  const loadingRef = useRef(false);
122
124
  const dispatch = useMapDispatch();
125
+ const isInitialized = useMapInitialized();
123
126
 
124
127
  useEffect(() => {
125
128
  const map = mapRef.current;
@@ -148,36 +151,35 @@ export function MapLoadingReporter({
148
151
  map?.off("sourcedataloading", loadingCallback);
149
152
  map?.off("idle", idleCallback);
150
153
  };
151
- }, [ignoredSources, mapRef.current, mapIsLoading]);
154
+ }, [ignoredSources, mapIsLoading, isInitialized]);
152
155
  return null;
153
156
  }
154
157
 
155
158
  export function MapMarker({ position, setPosition, centerMarker = true }) {
156
159
  const mapRef = useMapRef();
157
160
  const markerRef = useRef(null);
161
+ const isInitialized = useMapInitialized();
158
162
 
159
163
  useMapMarker(mapRef, markerRef, position);
160
164
 
161
- const handleMapClick = useCallback(
162
- (event: mapboxgl.MapMouseEvent) => {
165
+ useEffect(() => {
166
+ const map = mapRef.current;
167
+ if (map == null || setPosition == null) return;
168
+
169
+ const handleMapClick = (event: mapboxgl.MapMouseEvent) => {
163
170
  setPosition(event.lngLat, event, mapRef.current);
164
171
  // We should integrate this with the "easeToCenter" hook
165
172
  if (centerMarker) {
166
173
  mapRef.current?.flyTo({ center: event.lngLat, duration: 800 });
167
174
  }
168
- }, // eslint-disable-next-line react-hooks/exhaustive-deps
169
- [mapRef.current, setPosition]
170
- );
175
+ };
176
+
177
+ map.on("click", handleMapClick);
171
178
 
172
- useEffect(() => {
173
- const map = mapRef.current;
174
- if (map != null && setPosition != null) {
175
- map.on("click", handleMapClick);
176
- }
177
179
  return () => {
178
180
  map?.off("click", handleMapClick);
179
181
  };
180
- }, [mapRef.current, setPosition]);
182
+ }, [setPosition, isInitialized]);
181
183
 
182
184
  return null;
183
185
  }
@@ -3,6 +3,7 @@ import {
3
3
  useMapRef,
4
4
  useMapDispatch,
5
5
  useMapPosition,
6
+ useMapStatus,
6
7
  } from "@macrostrat/mapbox-react";
7
8
  import {
8
9
  mapViewInfo,
@@ -116,45 +117,40 @@ export function MapView(props: MapViewProps) {
116
117
  const ref = useRef<HTMLDivElement>();
117
118
  const parentRef = useRef<HTMLDivElement>();
118
119
 
119
- // Keep track of map position for reloads
120
- useEffect(() => {
121
- console.log("Map updated", mapRef.current);
122
- }, [mapRef.current]);
123
-
124
120
  useEffect(() => {
125
121
  if (style == null) return;
126
- if (mapRef.current != null) {
122
+ let map = mapRef.current;
123
+ if (map != null) {
127
124
  console.log("Setting style", style);
128
- mapRef.current.setStyle(style);
129
- return;
125
+ map.setStyle(style);
126
+ } else {
127
+ console.log("Initializing map", style);
128
+ const map = initializeMap(ref.current, {
129
+ style,
130
+ projection,
131
+ mapPosition,
132
+ ...rest,
133
+ });
134
+ dispatch({ type: "set-map", payload: map });
135
+ map.setPadding(getMapPadding(ref, parentRef), { animate: false });
136
+ onMapLoaded?.(map);
130
137
  }
131
- const map = initializeMap(ref.current, {
132
- style,
133
- projection,
134
- mapPosition,
135
- ...rest,
136
- });
137
- map.setPadding(getMapPadding(ref, parentRef), { animate: false });
138
- map.on("style.load", () => {
138
+
139
+ const loadCallback = () => {
139
140
  onStyleLoaded?.(map);
140
141
  dispatch({ type: "set-style-loaded", payload: true });
141
- });
142
- onMapLoaded?.(map);
143
- dispatch({ type: "set-map", payload: map });
144
- }, [style]);
142
+ };
145
143
 
146
- // Map style updating
147
- // useEffect(() => {
148
- // if (mapRef?.current == null || style == null) return;
149
- // mapRef?.current?.setStyle(style);
150
- // }, [mapRef.current, style]);
151
-
152
- // Set map position if it changes
153
- // useEffect(() => {
154
- // const map = mapRef.current;
155
- // if (map == null || mapPosition == null) return;
156
- // setMapPosition(map, mapPosition);
157
- // }, [mapPosition]);
144
+ map = mapRef.current;
145
+ if (map.isStyleLoaded()) {
146
+ // Catch a race condition where the style is loaded before the callback is set
147
+ loadCallback();
148
+ }
149
+ map.on("style.load", loadCallback);
150
+ return () => {
151
+ map.off("style.load", loadCallback);
152
+ };
153
+ }, [style]);
158
154
 
159
155
  const _computedMapPosition = useMapPosition();
160
156
  const { mapUse3D, mapIsRotated } = mapViewInfo(_computedMapPosition);
package/dist/main.cjs.map DELETED
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AALA,4CAAmC,CAAC,sBAAsB,CAAC;AAC3D,4CAA2B,CAAC,cAAc,CAAC;AAC3C,4CAAkC,CAAC,qBAAqB,CAAC;AACzD,4CAA8B,CAAC,iBAAiB,CAAC;AACjD,4CAAqC,CAAC,wBAAwB,CAAC;AAC/D,4CAAkC,CAAC,qBAAqB,CAAC;;;;;ADEzD,MAAM,0BAAI,CAAA,GAAA,gDAAI,EAAE,MAAM,CAAC,CAAA,GAAA,gEAAK;AAE5B,MAAM,uCAAiB,wBAAE,CAAA,GAAA,8BAAM,GAAG;IAAE,MAAM;AAAG;AAEtC,SAAS,0CAAc,aAC5B,YAAY,gBACZ,OAAO,UACP,SAAS,cACT,QAAQ,aACR,OAAO,eACP,KAAK,EACN;IACC,OAAO,wBAAE,CAAA,GAAA,6BAAK,GAAG;QACf,WAAW;QACX,MAAM,YAAY,uCAAiB;eACnC;QACA,SAAS;iBACT;QACA,QAAQ,UAAU,CAAC;eACnB;IACF;AACF;AAEO,SAAS,0CAAiB,KAAK;IACpC,MAAM,aAAE,SAAS,EAAE,GAAG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GO,MAAM,4CAAa;;;;;;;;;;","sources":["packages/map-interface/src/index.ts","packages/map-interface/src/context-panel/index.ts","packages/map-interface/src/context-panel/main.module.sass","packages/map-interface/src/location-panel/index.ts","packages/map-interface/src/location-panel/header.ts","packages/map-interface/src/location-panel/main.module.sass","packages/map-interface/src/location-info/index.ts","packages/map-interface/src/location-info/utils.ts","packages/map-interface/src/location-info/hash-string.ts","packages/map-interface/src/dev/index.ts","packages/map-interface/src/dev/map-page.ts","packages/map-interface/src/dev/xray.ts","packages/map-interface/src/container.ts","packages/map-interface/src/main.module.sass","packages/map-interface/src/controls.ts","packages/map-interface/src/helpers.ts","packages/map-interface/src/utils.ts","packages/map-interface/src/map-view/index.ts","packages/map-interface/src/map-view/terrain.ts","packages/map-interface/src/dev/main.module.sass","packages/map-interface/src/dev/tile-extent.ts","packages/map-interface/src/dev/vector-tile-features.ts","packages/map-interface/src/expansion-panel/index.ts","packages/map-interface/src/expansion-panel/main.module.sass","packages/map-interface/src/expansion-panel/headers.ts"],"sourcesContent":["export * from \"./context-panel\";\nexport * from \"./location-panel\";\nexport * from \"./dev\";\nexport * from \"./container\";\nexport * from \"./map-view\";\nexport * from \"./controls\";\nexport * from \"./helpers\";\nexport * from \"./utils\";\nexport * from \"./location-info\";\nexport * from \"./expansion-panel\";\n","import { useMemo } from \"react\";\nimport { Navbar, Button, Spinner, Card, Text } from \"@blueprintjs/core\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { useMapStatus } from \"@macrostrat/mapbox-react\";\nimport { Spacer } from \"@macrostrat/ui-components\";\n\nconst h = hyper.styled(styles);\n\nconst spinnerElement = h(Spinner, { size: 16 });\n\nexport function LoadingButton({\n isLoading = false,\n onClick,\n active = false,\n large = false,\n icon = \"menu\",\n style,\n}) {\n return h(Button, {\n className: \"loading-button\",\n icon: isLoading ? spinnerElement : icon,\n large,\n minimal: true,\n onClick,\n active: active && !isLoading,\n style,\n });\n}\n\nexport function MapLoadingButton(props) {\n const { isLoading } = useMapStatus();\n const mapIsLoading = useMemo(() => isLoading, [isLoading]);\n return h(LoadingButton, { ...props, isLoading: mapIsLoading });\n}\n\ntype AnyChildren = React.ReactNode | React.ReactFragment;\n\nexport interface FloatingNavbarProps {\n className?: string;\n children: AnyChildren;\n headerElement?: AnyChildren;\n title?: AnyChildren;\n statusElement?: AnyChildren;\n rightElement?: AnyChildren;\n height: number | string;\n width: number | string;\n style?: object;\n}\n\nexport function FloatingNavbar({\n className,\n children,\n headerElement = null,\n title = null,\n statusElement = null,\n rightElement = null,\n height,\n width,\n style = {},\n}: FloatingNavbarProps) {\n let _rightElement: React.ReactNode | null = null;\n if (rightElement != null) {\n _rightElement = h(\"div.right-element\", rightElement);\n }\n\n let _headerElement: React.ReactNode | null = headerElement;\n if (title != null && _headerElement == null) {\n if (typeof title === \"string\") {\n _headerElement = h(Text, { tagName: \"h2\", ellipsize: true }, title);\n } else {\n _headerElement = title;\n }\n }\n\n if (_headerElement != null) {\n _headerElement = h([_headerElement, h(Spacer)]);\n }\n\n return h(\"div.searchbar-holder\", { className, style: { width } }, [\n h(\"div.navbar-holder\", [\n h(\n Navbar,\n {\n className: \"searchbar navbar panel\",\n style: { height, ...style },\n },\n [_headerElement, children, _rightElement]\n ),\n ]),\n h.if(statusElement != null)(\n Card,\n { className: \"status-tongue\" },\n statusElement\n ),\n ]);\n}\n",".searchbar-holder\n transition: margin 300ms\n display: flex\n flex-direction: column\n margin: 0\n\n .navbar-holder\n display: flex\n flex-direction: row\n\n .searchbar\n width: 100%\n background-color: var(--panel-background-color)\n border-radius: 5px\n padding: var(--navbar-padding, 10px)\n display: flex\n flex-direction: row\n align-items: center\n gap: 5px\n\n :global(.bp5-input-group)\n flex-grow: 1\n cursor: text\n\n.navbar\n min-height: 50px\n\n:global(.bp5-navbar) > .loading-button\n width: 40px\n height: 40px\n\n.status-tongue\n background-color: var(--panel-background-color)\n margin: 5px\n margin-bottom: 0\n margin-top: -12px\n padding: 0\n padding-top: 12px\n overflow: hidden\n\n@media screen and (max-width: 768px)\n .status-tongue\n max-width: 100vw\n margin: 0\n border-radius: 0\n margin-top: -3px\n","import { Card } from \"@blueprintjs/core\";\nimport hyper from \"@macrostrat/hyper\";\nimport { InfoDrawerHeader, InfoDrawerHeaderProps } from \"./header\";\nimport classNames from \"classnames\";\nimport styles from \"./main.module.sass\";\nimport { ErrorBoundary } from \"@macrostrat/ui-components\";\n\nconst h = hyper.styled(styles);\n\nexport function InfoDrawerContainer(props) {\n const className = classNames(\"infodrawer\", props.className);\n return h(Card, { ...props, className });\n}\n\ninterface BaseInfoDrawerProps extends InfoDrawerHeaderProps {\n className?: string;\n title?: string;\n headerElement?: JSX.Element;\n children?: React.ReactNode;\n}\n\nexport function BaseInfoDrawer(props: BaseInfoDrawerProps) {\n const {\n className,\n headerElement = null,\n title,\n onClose,\n children,\n ...rest\n } = props;\n const header =\n headerElement ??\n h(InfoDrawerHeader, { onClose, ...rest }, [\n title == null ? null : h(\"h3\", [title]),\n ]);\n return h(InfoDrawerContainer, { className }, [\n header,\n h(\n \"div.infodrawer-body\",\n h(\"div.infodrawer-contents\", h(ErrorBoundary, null, children))\n ),\n ]);\n}\n\nexport function LocationPanel(props) {\n const { children, className, loading = false, ...rest } = props;\n const cls = classNames(\"location-panel\", className, { loading });\n return h(BaseInfoDrawer, { className: cls, ...rest }, children);\n}\n","import { Icon, Button } from \"@blueprintjs/core\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { useToaster } from \"@macrostrat/ui-components\";\nimport { LngLatCoords, Elevation } from \"../location-info\";\nimport {\n LocationFocusButton,\n useFocusState,\n isCentered,\n} from \"@macrostrat/mapbox-react\";\n\nconst h = hyper.styled(styles);\n\nfunction PositionButton({ position, showCopyLink = false }) {\n const focusState = useFocusState(position);\n\n const copyLinkIsVisible = isCentered(focusState) && showCopyLink;\n\n return h(\"div.position-controls\", [\n h(LocationFocusButton, { location: position, focusState }, []),\n h.if(copyLinkIsVisible)(CopyLinkButton, { itemName: \"position\" }),\n ]);\n}\n\nfunction CopyLinkButton({ itemName, children, onClick, ...rest }) {\n const toaster = useToaster();\n\n let message = `Copied link`;\n if (itemName != null) {\n message += ` to ${itemName}`;\n }\n message += \"!\";\n\n return h(\n Button,\n {\n className: \"copy-link-button\",\n rightIcon: h(Icon, { icon: \"link\", size: 12 }),\n minimal: true,\n small: true,\n onClick() {\n navigator.clipboard.writeText(window.location.href).then(\n () => {\n toaster?.show({\n message,\n intent: \"success\",\n icon: \"clipboard\",\n timeout: 1000,\n });\n onClick?.();\n },\n () => {\n toaster?.show({\n message: \"Failed to copy link\",\n intent: \"danger\",\n icon: \"error\",\n timeout: 1000,\n });\n }\n );\n },\n ...rest,\n },\n children ?? \"Copy link\"\n );\n}\n\nexport interface InfoDrawerHeaderProps {\n onClose: () => void;\n position: mapboxgl.LngLat;\n zoom?: number;\n elevation?: number;\n showCopyPositionButton?: boolean;\n}\n\nexport function InfoDrawerHeader(props: InfoDrawerHeaderProps) {\n const {\n onClose,\n position,\n zoom = 7,\n elevation,\n showCopyPositionButton,\n } = props;\n\n return h(\"header.location-panel-header\", [\n h(PositionButton, { position, showCopyLink: showCopyPositionButton }),\n h(\"div.spacer\"),\n h(LngLatCoords, {\n position,\n zoom,\n className: \"infodrawer-header-item\",\n }),\n h.if(elevation != null)(Elevation, {\n elevation,\n className: \"infodrawer-header-item\",\n }),\n h(Button, { minimal: true, icon: \"cross\", onClick: onClose }),\n ]);\n}\n",".copy-link-button:global(.bp5-minimal.bp5-button)\n color: var(--text-subtle-color)\n\n svg\n fill: var(--text-subtle-color)\n\n.location-panel-header\n padding: 5px\n display: flex\n flex-direction: row\n align-items: center\n gap: 1em\n border-bottom: 1px solid var(--panel-rule-color)\n\n .spacer\n flex-grow: 1\n\n .left-icon\n padding: 7px\n\n .position-controls :global(.bp5-button)\n font-size: 12px !important\n\n.infodrawer-header-item\n font-size: 12px\n\n :global(.secondary)\n font-size: 0.9em\n color: var(--text-subtle-color)\n\n.infodrawer\n pointer-events: all\n max-height: 100%\n max-width: 100%\n height: fit-content\n display: flex\n flex-direction: column\n overflow: hidden\n background-color: var(--panel-background-color)\n\n &:global(.bp5-card)\n padding: 0\n background-color: var(--panel-background-color)\n\n\n &.loading\n .infodrawer-body\n overflow-y: hidden\n min-height: 70px\n\n\n.infodrawer-contents\n padding: 0 1em 1em\n\n.infodrawer-body\n flex-shrink: 1\n min-height: 0\n transition: min-height 0.5s ease\n overflow-y: scroll\n position: relative\n\n// TODO: remove this when we have a better way to handle card media queries\n@media screen and (max-width: 768px)\n .infodrawer\n border-radius: var(--panel-border-radius, 0px)\n","import h from \"@macrostrat/hyper\";\nimport {\n formatCoordForZoomLevel,\n metersToFeet,\n normalizeLng,\n} from \"@macrostrat/mapbox-utils\";\nimport { formatValue } from \"./utils\";\n\nexport * from \"./hash-string\";\n\nexport function ValueWithUnit(props) {\n const { value, unit } = props;\n return h(\"span.value-with-unit\", [\n h(\"span.value\", [value]),\n h(\"span.spacer\", [\" \"]),\n h(\"span.unit\", [unit]),\n ]);\n}\n\nexport function DegreeCoord(props) {\n const { value, labels, precision = 3, format = formatValue } = props;\n const direction = value < 0 ? labels[1] : labels[0];\n\n return h(ValueWithUnit, {\n value: format(Math.abs(value), precision) + \"°\",\n unit: direction,\n });\n}\n\nexport interface LngLatProps {\n /** Map position */\n position: [number, number] | { lat: number; lng: number };\n className?: string;\n /** Zoom level (used to infer coordinate rounding if provided) */\n zoom?: number | null;\n /** Number of decimal places to round coordinates to */\n precision: number | null;\n /** Function to format coordinates */\n format?: (val: number, precision: number) => string;\n}\n\nexport function LngLatCoords(props: LngLatProps) {\n /** Formatted geographic coordinates */\n const { position, className, precision, zoom } = props;\n let { format } = props;\n if (position == null) {\n return null;\n }\n let lat, lng;\n if (Array.isArray(position)) {\n [lng, lat] = position;\n } else {\n ({ lat, lng } = position);\n }\n\n if (zoom != null && format == null && precision == null) {\n format = (val, _) => formatCoordForZoomLevel(val, zoom);\n }\n\n return h(\"div.lnglat-container\", { className }, [\n h(\"span.lnglat\", [\n h(DegreeCoord, {\n value: lat,\n labels: [\"N\", \"S\"],\n precision,\n format,\n }),\n \", \",\n h(DegreeCoord, {\n value: normalizeLng(lng),\n labels: [\"E\", \"W\"],\n precision,\n format,\n }),\n ]),\n ]);\n}\n\nexport function Elevation(props) {\n /** Renders an elevation value in meters and a parenthetical conversion to feet. */\n const { elevation, className, includeFeet = true } = props;\n if (elevation == null) return null;\n return h(\"div.elevation\", { className }, [\n h(ValueWithUnit, { value: elevation, unit: \"m\" }),\n h.if(includeFeet)(\"span.secondary\", [\n \" (\",\n h(ValueWithUnit, { value: metersToFeet(elevation), unit: \"ft\" }),\n \")\",\n ]),\n ]);\n}\n","import { format } from \"d3-format\";\n\nexport const fmt4 = format(\".4~f\");\nexport const fmt3 = format(\".3~f\");\nexport const fmt2 = format(\".2~f\");\nexport const fmt1 = format(\".1~f\");\nexport const fmtInt = format(\".0f\");\n\nexport function formatValue(val: number, precision: number = 0): string {\n switch (precision) {\n case 4:\n return fmt4(val);\n case 3:\n return fmt3(val);\n case 2:\n return fmt2(val);\n case 1:\n return fmt1(val);\n case 0:\n return fmtInt(val);\n default:\n return fmt4(val);\n }\n}\n","import {\n LatLng,\n MapPosition,\n formatCoordForZoomLevel,\n} from \"@macrostrat/mapbox-utils\";\nimport { ParsedQuery } from \"query-string\";\nimport { fmt1, fmt2, fmtInt } from \"./utils\";\n\ninterface LocationHashParams {\n x?: string;\n y?: string;\n z?: string;\n a?: string;\n e?: string;\n}\n\nexport function applyMapPositionToHash(\n args: LocationHashParams,\n mapPosition: MapPosition | null\n) {\n const pos = mapPosition?.camera;\n if (pos == null) return;\n const zoom = mapPosition.target?.zoom;\n\n args.x = formatCoordForZoomLevel(pos.lng, zoom);\n args.y = formatCoordForZoomLevel(pos.lat, zoom);\n\n if (pos.bearing == 0 && pos.pitch == 0 && zoom != null) {\n args.z = fmt1(zoom);\n } else if (pos.altitude != null) {\n if (pos.altitude > 5000) {\n args.z = fmt2(pos.altitude / 1000) + \"km\";\n } else {\n args.z = fmtInt(pos.altitude) + \"m\";\n }\n }\n if (pos.bearing != 0) {\n let az = pos.bearing;\n if (az < 0) az += 360;\n args.a = fmtInt(az);\n }\n if (pos.pitch != 0) {\n args.e = fmtInt(pos.pitch);\n }\n}\n\nfunction _fmt(x: string | number | string[]) {\n if (Array.isArray(x)) {\n x = x[0];\n }\n return parseFloat(x.toString());\n}\n\nexport function getMapPositionForHash(\n hashData: ParsedQuery<string>,\n centerPosition: LatLng | null\n): MapPosition {\n const {\n x = centerPosition?.lng ?? 0,\n y = centerPosition?.lat ?? 0,\n // Different default for zoom depending on whether we have a marker\n z = centerPosition != null ? 7 : 2,\n a = 0,\n e = 0,\n } = hashData;\n\n const lng = _fmt(x);\n const lat = _fmt(y);\n\n let altitude = null;\n let zoom = null;\n const _z = z.toString();\n if (_z.endsWith(\"km\")) {\n altitude = _fmt(_z.substring(0, _z.length - 2)) * 1000;\n } else if (_z.endsWith(\"m\")) {\n altitude = _fmt(_z.substring(0, _z.length - 1));\n } else {\n zoom = _fmt(z);\n }\n const bearing = _fmt(a);\n const pitch = _fmt(e);\n\n let target = undefined;\n if (bearing == 0 && pitch == 0 && zoom != null) {\n target = {\n lat,\n lng,\n zoom,\n };\n }\n\n return {\n camera: {\n lng: _fmt(x),\n lat: _fmt(y),\n altitude,\n bearing: _fmt(a),\n pitch: _fmt(e),\n },\n target,\n };\n}\n","export * from \"./map-page\";\nexport * from \"./tile-extent\";\nexport * from \"./vector-tile-features\";\nexport * from \"./xray\";\n","// Import other components\nimport { Switch } from \"@blueprintjs/core\";\nimport hyper from \"@macrostrat/hyper\";\nimport { Spacer, useDarkMode, useStoredState } from \"@macrostrat/ui-components\";\nimport mapboxgl from \"mapbox-gl\";\nimport { useCallback, useState, useEffect } from \"react\";\nimport { buildInspectorStyle, buildXRayStyle } from \"./xray\";\nimport { MapAreaContainer, PanelCard } from \"../container\";\nimport { FloatingNavbar, MapLoadingButton } from \"../context-panel\";\nimport { MapMarker } from \"../helpers\";\nimport { LocationPanel } from \"../location-panel\";\nimport { MapView } from \"../map-view\";\nimport styles from \"./main.module.sass\";\nimport { TileExtentLayer } from \"./tile-extent\";\nimport {\n FeaturePanel,\n FeatureSelectionHandler,\n TileInfo,\n} from \"./vector-tile-features\";\nimport { MapPosition } from \"@macrostrat/mapbox-utils\";\n\nexport const h = hyper.styled(styles);\n\nexport function MapInspector({\n title = \"Map inspector\",\n headerElement = null,\n transformRequest = null,\n mapPosition = null,\n mapboxToken = null,\n overlayStyle = null,\n children,\n style,\n focusedSource = null,\n focusedSourceTitle = null,\n fitViewport = true,\n}: {\n headerElement?: React.ReactElement;\n transformRequest?: mapboxgl.TransformRequestFunction;\n title?: string;\n style?: mapboxgl.Style | string;\n children?: React.ReactNode;\n mapboxToken?: string;\n overlayStyle?: mapboxgl.Style | string;\n focusedSource?: string;\n focusedSourceTitle?: string;\n projection?: string;\n mapPosition?: MapPosition;\n fitViewport?: boolean;\n}) {\n /* We apply a custom style to the panel container when we are interacting\n with the search bar, so that we can block map interactions until search\n bar focus is lost.\n We also apply a custom style when the infodrawer is open so we can hide\n the search bar on mobile platforms\n */\n\n const dark = useDarkMode();\n const isEnabled = dark?.isEnabled;\n\n if (mapboxToken != null) {\n mapboxgl.accessToken = mapboxToken;\n }\n\n style ??= isEnabled\n ? \"mapbox://styles/mapbox/dark-v10\"\n : \"mapbox://styles/mapbox/light-v10\";\n\n const [isOpen, setOpen] = useState(false);\n\n const [state, setState] = useStoredState(\"macrostrat:dev-map-page\", {\n showTileExtent: false,\n xRay: false,\n });\n const { showTileExtent, xRay } = state;\n\n const [actualStyle, setActualStyle] = useState(style);\n\n console.log(\"actualStyle\", actualStyle);\n\n useEffect(() => {\n buildInspectorStyle(style, overlayStyle, {\n mapboxToken,\n inDarkMode: isEnabled,\n xRay,\n }).then(setActualStyle);\n }, [style, xRay, mapboxToken, isEnabled, overlayStyle]);\n\n const [inspectPosition, setInspectPosition] =\n useState<mapboxgl.LngLat | null>(null);\n\n const [data, setData] = useState(null);\n\n const onSelectPosition = useCallback((position: mapboxgl.LngLat) => {\n setInspectPosition(position);\n }, []);\n\n let detailElement = null;\n if (inspectPosition != null) {\n detailElement = h(\n LocationPanel,\n {\n onClose() {\n setInspectPosition(null);\n },\n position: inspectPosition,\n },\n [\n h(TileInfo, {\n feature: data?.[0] ?? null,\n showExtent: showTileExtent,\n setShowExtent() {\n setState({ ...state, showTileExtent: !showTileExtent });\n },\n }),\n h(FeaturePanel, { features: data, focusedSource, focusedSourceTitle }),\n ]\n );\n }\n\n let tile = null;\n if (showTileExtent && data?.[0] != null) {\n let f = data[0];\n tile = { x: f._x, y: f._y, z: f._z };\n }\n\n return h(\n MapAreaContainer,\n {\n navbar: h(FloatingNavbar, {\n rightElement: h(MapLoadingButton, {\n large: true,\n active: isOpen,\n onClick: () => setOpen(!isOpen),\n style: {\n marginRight: \"-5px\",\n },\n }),\n headerElement,\n title,\n }),\n contextPanel: h(PanelCard, [\n h(Switch, {\n checked: xRay,\n label: \"X-ray mode\",\n onChange() {\n setState({ ...state, xRay: !xRay });\n },\n }),\n children,\n ]),\n detailPanel: detailElement,\n contextPanelOpen: isOpen,\n fitViewport,\n },\n h(\n MapView,\n {\n style: actualStyle,\n transformRequest,\n mapPosition,\n projection: { name: \"globe\" },\n mapboxToken,\n },\n [\n h(FeatureSelectionHandler, {\n selectedLocation: inspectPosition,\n setFeatures: setData,\n }),\n h(MapMarker, {\n position: inspectPosition,\n setPosition: onSelectPosition,\n }),\n h(TileExtentLayer, { tile, color: isEnabled ? \"white\" : \"black\" }),\n ]\n )\n );\n}\n\n// Legacy export\nexport const DevMapPage = MapInspector;\n","import { getMapboxStyle, mergeStyles } from \"@macrostrat/mapbox-utils\";\nimport { asChromaColor, toRGBAString } from \"@macrostrat/color-utils\";\nimport mapboxgl from \"mapbox-gl\";\n\ninterface XRayOptions {\n color?: string;\n inDarkMode?: boolean;\n mapboxToken?: string;\n xRaySources?: string[];\n}\n\nexport async function buildXRayStyle(\n baseStyle: string | object,\n params: XRayOptions = null\n) {\n const {\n inDarkMode = false,\n color = \"rgb(74, 242, 161)\",\n mapboxToken,\n xRaySources,\n } = params;\n const style = await getMapboxStyle(baseStyle, { access_token: mapboxToken });\n const sources = xRaySources ?? Object.keys(style.sources);\n\n let layers = [];\n for (let layer of style.layers) {\n if (!sources.includes(layer.source)) {\n layers.push(layer);\n continue;\n }\n let newLayer = transformMapboxLayer(layer, color, inDarkMode);\n if (newLayer != null) {\n layers.push(newLayer);\n }\n }\n\n return {\n ...style,\n layers,\n };\n}\n\nfunction transformMapboxLayer(layer, color, inDarkMode) {\n const c = asChromaColor(color);\n const xRayColor = (opacity = 1, darken = 0) => {\n if (!inDarkMode) {\n return toRGBAString(c.darken(2 - darken).alpha(opacity));\n }\n return toRGBAString(c.alpha(opacity).darken(darken));\n };\n\n if (layer.type == \"background\") {\n return null;\n }\n\n let newLayer = { ...layer };\n\n console.log(xRayColor(0.5));\n\n if (layer.type == \"fill\") {\n newLayer.paint = {\n \"fill-color\": xRayColor(0.1),\n \"fill-outline-color\": xRayColor(0.5),\n };\n } else if (layer.type == \"line\") {\n newLayer.paint = {\n \"line-color\": xRayColor(0.5, 0),\n \"line-width\": 1.5,\n };\n } else if (layer.type == \"symbol\") {\n newLayer.paint = {\n \"text-color\": xRayColor(1, -0.5),\n \"text-halo-color\": \"#000\",\n };\n } else if (layer.type == \"circle\") {\n newLayer.paint = {\n \"circle-color\": xRayColor(0.5, 0),\n \"circle-stroke-color\": xRayColor(0.5, 1),\n \"circle-radius\": 2,\n };\n }\n\n return newLayer;\n}\n\ntype InspectorStyleOptions = XRayOptions & {\n xRay?: boolean;\n};\n\nexport async function buildInspectorStyle(\n baseStyle: mapboxgl.Style | string,\n overlayStyle: mapboxgl.Style | string | null = null,\n params: InspectorStyleOptions = {}\n) {\n const {\n mapboxToken,\n xRay = false,\n xRaySources: _xRaySources,\n ...rest\n } = params;\n let xRaySources = _xRaySources;\n let style = await getMapboxStyle(baseStyle, {\n access_token: mapboxToken,\n });\n\n if (overlayStyle != null) {\n const overlay = await getMapboxStyle(overlayStyle, {\n access_token: mapboxToken,\n });\n style = mergeStyles(style, overlay);\n xRaySources ??= Object.keys(overlay.sources);\n }\n\n if (xRay) {\n // If we haven't specified sources, then we'll use all of them\n xRaySources ??= Object.keys(style.sources);\n\n style = await buildXRayStyle(style, { ...rest, mapboxToken, xRaySources });\n }\n return style;\n}\n","import hyper, { addClassNames } from \"@macrostrat/hyper\";\nimport { HTMLDivProps } from \"@blueprintjs/core\";\nimport styles from \"./main.module.sass\";\nimport classNames from \"classnames\";\nimport { useTransition } from \"transition-hook\";\nimport {\n MapboxMapProvider,\n ZoomControl,\n useMapPosition,\n} from \"@macrostrat/mapbox-react\";\nimport { ToasterContext } from \"@macrostrat/ui-components\";\nimport { MapBottomControls } from \"./controls\";\nimport { mapViewInfo, MapPosition } from \"@macrostrat/mapbox-utils\";\nimport { Card } from \"@blueprintjs/core\";\n\nimport { ReactNode } from \"react\";\n\nconst h = hyper.styled(styles);\n\ntype AnyElement = React.ReactNode | React.ReactElement | React.ReactFragment;\n\nexport const PanelCard = (props) =>\n h(Card, { ...props, className: classNames(\"panel-card\", props.className) });\n\ninterface ContextStackProps extends HTMLDivProps {\n adaptiveWidth: boolean;\n navbar: AnyElement;\n}\n\nexport enum DetailPanelStyle {\n FIXED = \"fixed\",\n FLOATING = \"floating\",\n}\n\nexport const MapAreaContainer = (props) =>\n h(MapProviders, h(_MapAreaContainer, props));\n\nfunction _MapAreaContainer({\n children,\n className,\n navbar,\n contextPanel = null,\n detailPanel = null,\n detailPanelOpen,\n contextPanelOpen = true,\n bottomPanel = null,\n mainPanel,\n mapControls = h(MapBottomControls),\n contextStackProps = null,\n detailStackProps = null,\n detailPanelStyle = DetailPanelStyle.FLOATING,\n fitViewport = true,\n showPanelOutlines = false,\n preventMapInteraction = false,\n ...rest\n}: {\n navbar: AnyElement;\n children?: AnyElement;\n mapControls?: AnyElement;\n contextPanel?: AnyElement;\n contextStack?: AnyElement;\n mainPanel?: AnyElement;\n detailPanel?: AnyElement;\n bottomPanel?: AnyElement;\n className?: string;\n detailPanelOpen?: boolean;\n contextPanelOpen?: boolean;\n contextStackProps?: ContextStackProps;\n detailStackProps?: HTMLDivProps;\n detailPanelStyle: DetailPanelStyle;\n fitViewport?: boolean;\n showPanelOutlines?: boolean;\n}) {\n const _detailPanelOpen = detailPanelOpen ?? detailPanel != null;\n const contextPanelTrans = useTransition(contextPanelOpen, 800);\n const detailPanelTrans = useTransition(_detailPanelOpen, 800);\n\n /*- We apply a custom style to the panel container when we are interacting\n with the search bar, so that we can block map interactions until search\n bar focus is lost.\n - We also apply a custom style when the infodrawer is open so we can hide\n the search bar on mobile platforms\n - These styles are doubly applied so we can have both namespaced and\n outside-accessible styles for each case.\n */\n const mainUIClassNames = classNames(\n \"map-container\",\n className,\n `detail-panel-${detailPanelStyle}`,\n `context-panel-${contextPanelTrans.stage}`,\n `map-context-${contextPanelTrans.stage}`,\n `detail-panel-${detailPanelTrans.stage}`,\n `map-detail-${detailPanelTrans.stage}`,\n {\n \"detail-panel-open\": _detailPanelOpen,\n \"map-context-open\": contextPanelOpen,\n \"show-panel-outlines\": showPanelOutlines,\n \"fit-viewport\": fitViewport,\n }\n );\n\n const mapControlsExt = h([\n h(ZoomControl, { className: \"zoom-control\" }),\n h(\"div.spacer\"),\n mapControls,\n ]);\n\n const detailStackExt = h(\n \"div.detail-stack.infodrawer-container\",\n detailStackProps,\n [\n h(\"div.detail-panel-holder\", null, detailPanel),\n h.if(detailPanelStyle == DetailPanelStyle.FLOATING)([mapControlsExt]),\n ]\n );\n\n return h(MapStyledContainer, { className: mainUIClassNames }, [\n h(\"div.main-row\", [\n h(\"div.map-ui\", { ...rest }, [\n h(ContextStack, { navbar, ...contextStackProps }, [\n h.if(contextPanelTrans.shouldMount)([contextPanel]),\n ]),\n //h(MapView),\n children ?? mainPanel,\n h.if(detailPanelStyle == DetailPanelStyle.FLOATING)([detailStackExt]),\n h.if(detailPanelStyle == DetailPanelStyle.FIXED)(\n \"div.map-control-stack\",\n mapControlsExt\n ),\n ]),\n h.if(detailPanelStyle == DetailPanelStyle.FIXED)([detailStackExt]),\n ]),\n h(\"div.bottom\", null, bottomPanel),\n ]);\n}\n\nfunction ContextStack(props: ContextStackProps) {\n const { adaptiveWidth, navbar, children, ...rest } = props;\n const props1 = addClassNames(rest, { \"adaptive-width\": adaptiveWidth });\n return h(\"div.context-stack\", props1, [\n navbar,\n h(\"div.context-panel-holder\", null, children),\n h(\"div.spacer\"),\n ]);\n}\n\nconst MapProviders = ({ children }) =>\n h(ToasterContext, h(MapboxMapProvider, children));\n\ninterface MapContainerProps {\n className?: string;\n children?: ReactNode;\n}\n\nexport function MapStyledContainer({ className, children }: MapContainerProps) {\n const mapPosition = useMapPosition();\n if (mapPosition != null) {\n const { mapIsRotated, mapUse3D, mapIsGlobal } = mapViewInfo(mapPosition);\n className = classNames(className, {\n \"map-is-rotated\": mapIsRotated,\n \"map-3d-available\": mapUse3D,\n \"map-is-global\": mapIsGlobal,\n });\n }\n\n return h(\"div\", { className }, children);\n}\n\n//const _MapPage = compose(HotkeysProvider, MapPage);\n",".map-container\n display: flex\n flex-direction: column\n position: relative\n width: 100%\n height: 100%\n overflow: hidden\n\n &.show-panel-outlines\n .map-view-container\n outline: 2px dotted dodgerblue\n\n &.fit-viewport\n height: 100vh\n width: 100vw\n /* mobile viewport bug fix */\n max-height: -webkit-fill-available\n\n // Compass display\n .compass-control\n display: none\n\n &.map-is-rotated\n .compass-control\n display: block\n\n .map-3d-control\n display: none\n\n &.map-3d-available .map-3d-control\n display: block\n\n &.map-is-rotated.map-3d-available .map-3d-control\n display: none\n\n .globe-control\n display: none\n\n svg\n color: var(--secondary-color)\n\n &.map-is-global .globe-control\n display: block\n\n &.detail-panel-open\n .zoom-control\n opacity: 0\n display: none\n\n &.detail-panel-fixed\n .detail-panel-holder\n & > *\n border-radius: unset\n\n.detail-panel-holder\n display: flex\n flex-direction: column\n min-height: 0\n\n & > *\n flex: 1\n\n.map-control-stack\n display: flex\n flex-direction: column\n width: 30em\n margin-left: -30em\n pointer-events: none\n\n.main-row\n flex: 1\n display: flex\n flex-direction: row\n position: relative\n max-height: 100%\n min-height: 0\n\n.map-ui\n flex: 1\n position: relative\n display: flex\n flex-direction: column\n max-height: 100%\n height: 100%\n box-shadow: 0 0 10px 4px var(--card-shadow-color)\n\n.map-view-container\n flex-grow: 1\n position: relative\n overflow: hidden\n\n.mapbox-map\n position: absolute\n top: 0\n bottom: 0\n left: 0\n right: 0\n\n &:global(.mapboxgl-map)\n // override the default mapbox position: relative in all cases\n position: absolute\n\n\n.context-panel-holder>:global(.bp5-card)\n padding: 10px\n background-color: var(--panel-background-color)\n\n.panel-card\n padding: 10px\n background-color: var(--panel-background-color)\n overflow: hidden\n\n & > :last-child\n margin-bottom: 0\n\n:global(.bp5-dark) .panel-card\n background-color: var(--panel-background-color)\n\n.context-stack\n & > div\n flex-shrink: 1\n\n & > .searchbar\n flex: 0\n\n.context-stack,\n.detail-stack\n z-index: 10\n max-height: 100%\n\n.panel-container\n display: flex\n flex-direction: column\n\n & > div\n pointer-events: all\n\n.panel-title\n font-size: 16px\n\n.spacer\n flex-grow: 1\n pointer-events: none\n\n.map-view-container\n flex-grow: 1\n position: relative\n overflow: hidden\n\n.searchbar-holder\n margin-bottom: 0.5em\n\n.right-panel\n width: 24em\n\n.buttons\n display: flex\n flex-direction: row\n flex: 1\n min-width: 0\n\n.tab-button\n flex-shrink: 1\n min-width: 40px\n overflow: hidden\n text-align: right\n\n & :global(.bp5-button-text)\n transition: all 0.2s\n transition-delay: 0.1s\n\n .menu-card.narrow-card .panel-header:not(.minimal) &:global(.bp5-active) ~ & :global(.bp5-button-text)\n width: 0\n opacity: 0\n margin-left: -7px\n\n .context-panel-leave .menu-card .panel-header & :global(.bp5-button-text)\n opacity: 0\n width: 0\n\n.narrow-card.narrow-enter .panel-header .buttons\n margin-right: -500px\n\n.panel-header.minimal .tab-button:not(:hover):not(:global(.bp5-active))\n padding-left: 0\n padding-right: 0\n min-width: 30px\n width: 30px\n\n.panel-header.minimal .tab-button:not(:hover) :global(.bp5-button-text)\n width: 0\n opacity: 0\n margin-left: -7px\n\n.menu-group\n margin-bottom: 0.5em\n margin-top: 0.2em\n\n.menu-card :global .bp5-text ul,\n.menu-card :global .text-panel ul\n padding-left: 1em\n\n.menu-content\n display: flex\n flex-direction: column\n margin-bottom: -8px\n\n & .bp5-button-group\n margin-bottom: 4px\n\n & hr\n width: 100%\n\n:global\n .mapbox-map\n .mapbox-compass, .mapbox-3d\n display: none\n\n .mapboxgl-ctrl.mapbox-3d.mapbox-control\n width: unset\n\n .mapboxgl-ctrl.mapbox-3d.mapbox-control button\n width: unset\n padding-inline: 4px\n\n .mapboxgl-canvas-container\n width: 100%\n height: 100%\n\n .mapboxgl-ctrl.mapboxgl-ctrl-attrib\n background-color: var(--translucent-panel-background-color) !important\n\n .mapboxgl-ctrl.mapboxgl-ctrl-attrib a\n color: var(--text-color)\n\n .mapboxgl-marker svg path\n fill: var(--panel-background-color) !important\n\n .mapboxgl-marker svg circle\n fill: var(--secondary-color) !important\n\n .mapbox-control.mapbox-zoom\n background: var(--translucent-panel-background-inner)\n\n .mapbox-control.mapbox-zoom svg\n fill: var(--text-color) !important\n\n .mapboxgl-ctrl-logo\n transform: scale(0.9) translate(-8px, 2px)\n\n .bp5-dark\n .mapboxgl-ctrl-group\n background-color: var(--panel-background-color)\n\n .mapboxgl-ctrl-logo\n filter: invert(100%)\n\n .mapboxgl-ctrl-group button + button\n border-top: 1px solid var(--panel-rule-color) !important\n\n .bp5-dark .mapboxgl-ctrl-group .mapboxgl-ctrl-icon\n filter: invert(40%)\n\n .bp5-dark .mapboxgl-ctrl-group .mapboxgl-ctrl-icon:hover\n filter: invert(50%)\n\n .mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon\n filter: invert(40%)\n\n .mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon:hover\n filter: invert(50%)\n\n.detail-stack\n position: relative\n\n.detail-panel-container, .map-right-controls\n flex: 1\n\n\n.zoom-control\n transition: opacity 1s ease-in-out\n width: 30px\n position: absolute\n top: 0\n right: 0\n\n.map-controls\n display: flex\n flex-direction: row\n justify-content: right\n margin-bottom: 0\n gap: 0.5em\n\n :global(.map-control)\n & > :global(.bp5-button)\n padding: 0\n transform: translate(-3.5px, -3.5px)\n width: 22px !important\n\n\n.map-controls :global(.mapbox-control),\n.map-controls :global(.map-control-wrapper),\n.map-controls :global(.map-control)\n max-height: 22px\n height: 22px\n border-radius: 4px\n background-color: var(--panel-background-color)\n box-shadow: 0 0 0 1px var(--card-shadow-color)\n\n.map-controls :global(.mapbox-control) button,\n.map-controls :global(.map-control-wrapper) button,\n.map-controls :global(.map-control) button\n max-height: 22px\n height: 22px\n width: 22px\n max-width: 22px\n background-position: center center\n padding: 0\n//background-color: var(--panel-background-color)\n//color: var(--text-color)\n\n//.map-controls :global(.mapbox-control) button:hover,\n//.map-controls :global(.map-control-wrapper) button:hover,\n//.map-controls .map-control button:hover\n// background-color: var(--panel-background-color) !important\n\n.map-controls .map-scale-control\n background: none\n box-shadow: none\n padding-top: 8px\n\n :global(.mapboxgl-ctrl-scale)\n background-color: var(--translucent-panel-background-color)\n border-color: var(--secondary-text-color)\n color: var(--secondary-text-color)\n\n// .map-container.detail-panel-fixed\n// right: 30em\n\n/* For mobile phones, we want to make the most of screen space,\n which in some cases means adding complications to the basic page. */\n@media only screen and (max-width: 768px)\n .map-container.detail-panel-enter .context-stack\n height: 0\n visibility: hidden\n transition: height 0.5s ease-in-out\n\n .detail-stack\n height: fit-content\n position: inherit\n max-height: 70%\n\n .infodrawer-stack\n max-height: 70%\n\n &:global(.exit-active)\n max-height: 0\n\n :global(.mapbox-control.mapbox-zoom)\n display: none\n\n .map-controls\n position: absolute\n top: -60px\n right: 10px\n\n .detail-panel\n border-radius: 0px\n\n\n/* Desktop styling is necessarily much more complicated than mobile\n to handle a two-column layout. */\n@media screen and (min-width: 768px)\n /* Make map fill page rather than containing div,\n by unsetting map position */\n // We should move this to another file.\n .map-view-container\n position: unset\n\n\n .map-ui\n flex-direction: row\n padding: 1em 1em 2em\n min-height: 80px\n gap: 0.5em\n\n .context-stack\n max-width: var(--map-context-stack-max-width, 34em)\n min-width: 14em\n transition: width 300ms ease\n padding-bottom: 0.5em\n width: var(--map-context-stack-width, 16em)\n margin-right: 0.5em\n display: flex\n flex-direction: column\n\n &.adaptive-width\n width: var(--map-context-stack-width, none)\n max-width: var(--map-context-stack-max-width, none)\n transition: width 300ms ease\n\n :global(.bp5-navbar)\n //height: unset\n //padding: 5px\n h1, h2, h3\n margin: 0\n\n & > .spacer\n flex-grow: 0\n\n .context-panel-holder\n min-height: 0\n position: relative\n\n & > div\n max-height: 100%\n\n .detail-stack\n width: var(--map-detail-stack-width, 30em)\n display: flex\n flex-direction: column\n\n .context-stack, .detail-stack\n pointer-events: none\n z-index: 10\n\n & > div\n pointer-events: all\n margin-bottom: 0.5em\n\n &:last-child\n margin-bottom: 0\n\n &.spacer\n pointer-events: none\n\n .context-stack .spacer\n min-height: 1em\n\n /* Make map fill page rather than containing div,\n by unsetting map position */\n .map-view-container\n position: unset\n\n/** CSS Transitions **/\n\n.map-container\n // Context panel\n .context-panel-holder\n pointer-events: none\n flex: 1\n\n & > div\n pointer-events: all\n transition: opacity 0.8s ease\n //, height 0.8s ease, max-height 0.8s ease, padding 0.8s ease\n\n &.context-panel-from .context-panel-holder > div\n opacity: 0\n\n &.context-panel-enter .context-panel-holder > div\n opacity: 1\n\n &.context-panel-leave .context-panel-holder > div\n opacity: 0\n\n // Detail panel (floating)\n &.detail-panel-floating\n // We assume that the relevant panel is the first child of the stack.\n &.detail-panel-from .detail-panel-holder\n opacity: 0\n\n &.detail-panel-enter .detail-panel-holder\n opacity: 1\n\n &.detail-panel-leave .detail-panel-holder\n opacity: 0\n\n .detail-panel\n transition: opacity 0.8s ease, height 0.8s ease, max-height 0.8s ease\n\n // TODO: these styles have not been evaluated for mobile\n &.detail-panel-fixed\n .map-ui\n transition: margin-right 0.8s ease\n\n .detail-stack\n transition: margin-right 0.8s ease\n\n &.detail-panel-from .detail-panel-holder\n margin-right: calc(-1 * var(--map-detail-stack-width, 30em))\n\n &.detail-panel-enter .detail-panel-holder\n margin-right: 0\n\n &.detail-panel-leave .detail-panel-holder\n margin-right: calc(-1 * var(--map-detail-stack-width, 30em))\n\n\n// The max-height transition is a bit jerky because of panel padding.\n// We could probably fix this by pulling the panel container itself into\n// the class.\n//max-height: 0\n//padding: 0i\n\n@media only screen and (max-width: 768px)\n .map-container .detail-stack\n transition: opacity 0.8s ease, height 0.8s ease, max-height 0.8s ease\n\n .map-container.detail-panel-from .detail-stack\n max-height: 0\n height: 0\n\n .map-container.detail-panel-leave .detail-stack\n max-height: 0\n\n .map-container.context-panel-from .context-panel\n max-height: 0\n height: 0\n\n .map-container.context-panel-leave\n .context-stack\n .context-panel-holder\n flex: 0\n\n .spacer\n flex: 1\n\n\n// Shift UI around to center elements if we're in the global view\n@media only screen and (min-width: 768px)\n .map-container.detail-panel-leave .map-view-container\n margin-right: -14em\n\n .map-container.map-is-global.detail-panel-leave .map-view-container\n margin-right: -30em\n\n .map-container.map-is-global.context-panel-leave .map-view-container\n margin-left: -16em\n","import { useRef } from \"react\";\nimport { GeolocateControl } from \"mapbox-gl\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport {\n CompassControl,\n GlobeControl,\n ThreeDControl,\n MapControlWrapper,\n useMapStatus,\n} from \"@macrostrat/mapbox-react\";\nimport { ScaleControl as BaseScaleControl } from \"mapbox-gl\";\nimport { DevToolsButtonSlot } from \"@macrostrat/ui-components\";\n\nconst h = hyper.styled(styles);\n\nfunction ScaleControl(props) {\n const optionsRef = useRef({\n maxWidth: 200,\n unit: \"metric\",\n });\n return h(MapControlWrapper, {\n className: \"map-scale-control\",\n control: BaseScaleControl,\n options: optionsRef.current,\n ...props,\n });\n}\n\nfunction GeolocationControl(props) {\n const optionsRef = useRef({\n showAccuracyCircle: true,\n showUserLocation: true,\n trackUserLocation: true,\n positionOptions: {\n enableHighAccuracy: true,\n },\n });\n return h(MapControlWrapper, {\n control: GeolocateControl,\n options: optionsRef.current,\n ...props,\n });\n}\n\nexport function MapBottomControls({ children }) {\n const { isInitialized } = useMapStatus();\n\n if (!isInitialized) {\n return null;\n }\n\n return h(\"div.map-controls\", [\n h(ScaleControl),\n h(ThreeDControl, { className: \"map-3d-control\" }),\n h(CompassControl, { className: \"compass-control\" }),\n h(GlobeControl, { className: \"globe-control\" }),\n h(GeolocationControl, { className: \"geolocation-control\" }),\n // If we have global development tools enabled, show the button\n h(DevToolsButtonSlot, { className: \"map-control\" }),\n children,\n ]);\n}\n","import {\n useMapRef,\n useMapEaseTo,\n useMapDispatch,\n useMapStatus,\n} from \"@macrostrat/mapbox-react\";\nimport { useMemo, useRef } from \"react\";\nimport { debounce } from \"underscore\";\nimport useResizeObserver from \"use-resize-observer\";\n\nimport { getMapPosition } from \"@macrostrat/mapbox-utils\";\nimport mapboxgl from \"mapbox-gl\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { getMapPadding, useMapMarker } from \"./utils\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\n\nexport function MapResizeManager({ containerRef }) {\n const mapRef = useMapRef();\n\n const debouncedResize = useRef(\n debounce(() => {\n mapRef.current?.resize();\n }, 100)\n );\n\n useResizeObserver({\n ref: containerRef,\n onResize: debouncedResize.current,\n });\n\n return null;\n}\n\ninterface MapPaddingManagerProps {\n containerRef: React.RefObject<HTMLDivElement>;\n parentRef: React.RefObject<HTMLDivElement>;\n infoMarkerPosition: mapboxgl.LngLatLike;\n debounceTime?: number;\n}\n\nexport function MapPaddingManager({\n containerRef,\n parentRef,\n infoMarkerPosition,\n debounceTime = 200,\n}: MapPaddingManagerProps) {\n const mapRef = useMapRef();\n\n const [padding, setPadding] = useState(\n getMapPadding(containerRef, parentRef)\n );\n\n const _updateMapPadding = useCallback(() => {\n const newPadding = getMapPadding(containerRef, parentRef);\n setPadding(newPadding);\n }, [containerRef.current, parentRef.current]);\n\n const updateMapPadding = useMemo(\n () => debounce(_updateMapPadding, debounceTime),\n [_updateMapPadding, debounceTime]\n );\n\n useEffect(() => {\n const map = mapRef.current;\n if (map == null) return;\n // Update map padding on load\n updateMapPadding();\n }, [mapRef.current]);\n\n useResizeObserver({\n ref: parentRef,\n onResize(sz) {\n updateMapPadding();\n },\n round(n) {\n return Math.round(n);\n },\n });\n\n // Ideally, we would not have to do this when we know the infobox is loaded\n useMapEaseTo({ center: infoMarkerPosition, padding });\n\n return null;\n}\n\nexport function MapMovedReporter({ onMapMoved = null }) {\n const mapRef = useMapRef();\n const dispatch = useMapDispatch();\n\n const mapMovedCallback = useCallback(() => {\n const map = mapRef.current;\n if (map == null) return;\n const mapPosition = getMapPosition(map);\n dispatch({ type: \"map-moved\", payload: mapPosition });\n onMapMoved?.(mapPosition, map);\n }, [mapRef.current, onMapMoved, dispatch]);\n\n useEffect(() => {\n // Get the current value of the map. Useful for gradually moving away\n // from class component\n const map = mapRef.current;\n if (map == null) return;\n // Update the URI when the map moves\n mapMovedCallback();\n const cb = debounce(mapMovedCallback, 100);\n map.on(\"moveend\", cb);\n return () => {\n map?.off(\"moveend\", cb);\n };\n }, [mapMovedCallback]);\n return null;\n}\n\nexport function MapLoadingReporter({\n ignoredSources,\n onMapLoading = null,\n onMapIdle = null,\n mapIsLoading,\n}) {\n const mapRef = useMapRef();\n const loadingRef = useRef(false);\n const dispatch = useMapDispatch();\n\n useEffect(() => {\n const map = mapRef.current;\n const mapIsLoading = loadingRef.current;\n if (map == null) return;\n\n let didSendLoading = false;\n\n const loadingCallback = (evt) => {\n if (ignoredSources.includes(evt.sourceId) || mapIsLoading) return;\n if (didSendLoading) return;\n onMapLoading?.(evt);\n dispatch({ type: \"set-loading\", payload: true });\n loadingRef.current = true;\n didSendLoading = true;\n };\n const idleCallback = (evt) => {\n if (!mapIsLoading) return;\n dispatch({ type: \"set-loading\", payload: false });\n loadingRef.current = false;\n onMapIdle?.(evt);\n };\n map.on(\"sourcedataloading\", loadingCallback);\n map.on(\"idle\", idleCallback);\n return () => {\n map?.off(\"sourcedataloading\", loadingCallback);\n map?.off(\"idle\", idleCallback);\n };\n }, [ignoredSources, mapRef.current, mapIsLoading]);\n return null;\n}\n\nexport function MapMarker({ position, setPosition, centerMarker = true }) {\n const mapRef = useMapRef();\n const markerRef = useRef(null);\n\n useMapMarker(mapRef, markerRef, position);\n\n const handleMapClick = useCallback(\n (event: mapboxgl.MapMouseEvent) => {\n setPosition(event.lngLat, event, mapRef.current);\n // We should integrate this with the \"easeToCenter\" hook\n if (centerMarker) {\n mapRef.current?.flyTo({ center: event.lngLat, duration: 800 });\n }\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [mapRef.current, setPosition]\n );\n\n useEffect(() => {\n const map = mapRef.current;\n if (map != null && setPosition != null) {\n map.on(\"click\", handleMapClick);\n }\n return () => {\n map?.off(\"click\", handleMapClick);\n };\n }, [mapRef.current, setPosition]);\n\n return null;\n}\n\nexport function useBasicStylePair() {\n const inDarkMode = useInDarkMode();\n return inDarkMode\n ? \"mapbox://styles/mapbox/dark-v10\"\n : \"mapbox://styles/mapbox/light-v10\";\n}\n","import { useEffect } from \"react\";\nimport { Marker } from \"mapbox-gl\";\n\nfunction calcMapPadding(rect, childRect) {\n return {\n left: Math.max(rect.left - childRect.left, 0),\n top: Math.max(rect.top - childRect.top, 0),\n right: Math.max(childRect.right - rect.right, 0),\n bottom: Math.max(childRect.bottom - rect.bottom, 0),\n };\n}\n\nexport function getMapPadding(ref, parentRef) {\n const rect = parentRef.current?.getBoundingClientRect();\n const childRect = ref.current?.getBoundingClientRect();\n if (rect == null || childRect == null) return;\n return calcMapPadding(rect, childRect);\n}\n\nexport function useMapMarker(mapRef, markerRef, markerPosition) {\n useEffect(() => {\n const map = mapRef.current;\n if (map == null) return;\n if (markerPosition == null) {\n markerRef.current?.remove();\n return;\n }\n const marker = markerRef.current ?? new Marker();\n marker.setLngLat(markerPosition).addTo(map);\n markerRef.current = marker;\n return () => marker.remove();\n }, [mapRef.current, markerPosition]);\n}\n","import hyper from \"@macrostrat/hyper\";\nimport {\n useMapRef,\n useMapDispatch,\n useMapPosition,\n} from \"@macrostrat/mapbox-react\";\nimport {\n mapViewInfo,\n MapPosition,\n setMapPosition,\n} from \"@macrostrat/mapbox-utils\";\nimport classNames from \"classnames\";\nimport mapboxgl from \"mapbox-gl\";\nimport { useEffect, useRef, useCallback } from \"react\";\nimport styles from \"../main.module.sass\";\nimport { enable3DTerrain } from \"./terrain\";\nimport {\n MapLoadingReporter,\n MapMovedReporter,\n MapPaddingManager,\n MapResizeManager,\n} from \"../helpers\";\nimport \"mapbox-gl/dist/mapbox-gl.css\";\nimport { getMapPadding } from \"../utils\";\n\nconst h = hyper.styled(styles);\n\ntype MapboxCoreOptions = Omit<mapboxgl.MapboxOptions, \"container\">;\n\nexport interface MapViewProps extends MapboxCoreOptions {\n showLineSymbols?: boolean;\n children?: React.ReactNode;\n mapboxToken?: string;\n // Deprecated\n accessToken?: string;\n terrainSourceID?: string;\n enableTerrain?: boolean;\n infoMarkerPosition?: mapboxgl.LngLatLike;\n mapPosition?: MapPosition;\n initializeMap?: (\n container: HTMLElement,\n args: MapboxOptionsExt\n ) => mapboxgl.Map;\n onMapLoaded?: (map: mapboxgl.Map) => void;\n onStyleLoaded?: (map: mapboxgl.Map) => void;\n onMapMoved?: (mapPosition: MapPosition, map: mapboxgl.Map) => void;\n}\n\nexport interface MapboxOptionsExt extends MapboxCoreOptions {\n mapPosition?: MapPosition;\n}\n\nfunction defaultInitializeMap(container, args: MapboxOptionsExt = {}) {\n const { mapPosition, ...rest } = args;\n console.log(\"Initializing map (default)\", args);\n\n const map = new mapboxgl.Map({\n container,\n maxZoom: 18,\n //maxTileCacheSize: 0,\n logoPosition: \"bottom-left\",\n trackResize: true,\n antialias: true,\n optimizeForTerrain: true,\n ...rest,\n });\n\n // set initial map position\n if (mapPosition != null) {\n setMapPosition(map, mapPosition);\n }\n\n //setMapPosition(map, mapPosition);\n return map;\n}\n\nconst defaultMapPosition: MapPosition = {\n camera: {\n lat: 34,\n lng: -120,\n altitude: 300000,\n },\n};\n\nexport function MapView(props: MapViewProps) {\n let { terrainSourceID } = props;\n const {\n enableTerrain = true,\n style,\n mapPosition = defaultMapPosition,\n initializeMap = defaultInitializeMap,\n children,\n mapboxToken,\n // Deprecated\n accessToken,\n infoMarkerPosition,\n transformRequest,\n projection,\n onMapLoaded = null,\n onStyleLoaded = null,\n onMapMoved = null,\n ...rest\n } = props;\n if (enableTerrain) {\n terrainSourceID ??= \"mapbox-3d-dem\";\n }\n\n const _mapboxToken = mapboxToken ?? accessToken;\n\n if (_mapboxToken != null) {\n mapboxgl.accessToken = _mapboxToken;\n }\n\n const dispatch = useMapDispatch();\n let mapRef = useMapRef();\n const ref = useRef<HTMLDivElement>();\n const parentRef = useRef<HTMLDivElement>();\n\n // Keep track of map position for reloads\n useEffect(() => {\n console.log(\"Map updated\", mapRef.current);\n }, [mapRef.current]);\n\n useEffect(() => {\n if (style == null) return;\n if (mapRef.current != null) {\n console.log(\"Setting style\", style);\n mapRef.current.setStyle(style);\n return;\n }\n const map = initializeMap(ref.current, {\n style,\n projection,\n mapPosition,\n ...rest,\n });\n map.setPadding(getMapPadding(ref, parentRef), { animate: false });\n map.on(\"style.load\", () => {\n onStyleLoaded?.(map);\n dispatch({ type: \"set-style-loaded\", payload: true });\n });\n onMapLoaded?.(map);\n dispatch({ type: \"set-map\", payload: map });\n }, [style]);\n\n // Map style updating\n // useEffect(() => {\n // if (mapRef?.current == null || style == null) return;\n // mapRef?.current?.setStyle(style);\n // }, [mapRef.current, style]);\n\n // Set map position if it changes\n // useEffect(() => {\n // const map = mapRef.current;\n // if (map == null || mapPosition == null) return;\n // setMapPosition(map, mapPosition);\n // }, [mapPosition]);\n\n const _computedMapPosition = useMapPosition();\n const { mapUse3D, mapIsRotated } = mapViewInfo(_computedMapPosition);\n\n // Get map projection\n const _projection = mapRef.current?.getProjection()?.name ?? \"mercator\";\n\n const className = classNames(\n {\n \"is-rotated\": mapIsRotated ?? false,\n \"is-3d-available\": mapUse3D ?? false,\n },\n `${_projection}-projection`\n );\n\n return h(\"div.map-view-container.main-view\", { ref: parentRef }, [\n h(\"div.mapbox-map#map\", { ref, className }),\n h(MapLoadingReporter, {\n ignoredSources: [\"elevationMarker\", \"crossSectionEndpoints\"],\n }),\n h(MapMovedReporter, { onMapMoved }),\n h(MapResizeManager, { containerRef: ref }),\n h(MapPaddingManager, { containerRef: ref, parentRef, infoMarkerPosition }),\n h(MapTerrainManager, { mapUse3D, terrainSourceID }),\n children,\n ]);\n}\n\nexport function MapTerrainManager({\n mapUse3D,\n terrainSourceID,\n}: {\n mapUse3D?: boolean;\n terrainSourceID?: string;\n}) {\n const mapRef = useMapRef();\n\n useEffect(() => {\n const map = mapRef.current;\n if (map == null) return;\n enable3DTerrain(map, mapUse3D, terrainSourceID);\n }, [mapRef.current, mapUse3D]);\n return null;\n}\n","// We should merge this with code in @macrostrat/mapbox-react/src/terrain.ts:\n\nexport function enable3DTerrain(\n map,\n shouldEnable: boolean,\n sourceID: string | null = null\n) {\n if (!map.style?._loaded) {\n map.once(\"style.load\", () => {\n enable3DTerrain(map, shouldEnable, sourceID);\n });\n return;\n }\n\n const currentTerrainSource = getTerrainSourceID(map);\n let demSourceID = sourceID ?? currentTerrainSource ?? \"mapbox-dem\";\n\n console.log(\"Enabling 3D terrain with source\", demSourceID);\n\n // Enable or disable terrain depending on our current desires...\n const currentTerrain = map.getTerrain();\n\n if (!shouldEnable) {\n if (currentTerrain != null) map.setTerrain(null);\n return;\n }\n if (currentTerrain != null) return;\n\n // Add a DEM source if one is not found already.\n if (map.getSource(demSourceID) == null) {\n map.addSource(demSourceID, {\n type: \"raster-dem\",\n url: \"mapbox://mapbox.mapbox-terrain-dem-v1\",\n tileSize: 512,\n maxzoom: 14,\n });\n }\n\n // add a sky layer that will show when the map is highly pitched\n if (map.getLayer(\"sky\") == null) {\n map.addLayer({\n id: \"sky\",\n type: \"sky\",\n paint: {\n \"sky-type\": \"atmosphere\",\n \"sky-atmosphere-sun\": [0.0, 0.0],\n \"sky-atmosphere-sun-intensity\": 15,\n },\n });\n }\n\n map.setTerrain({ source: demSourceID, exaggeration: 1 });\n console.log(map.getTerrain());\n}\n\nfunction getTerrainSourceID(map) {\n for (const [key, source] of Object.entries(map.getStyle().sources)) {\n if (source.type == \"raster-dem\") {\n return key;\n }\n }\n return null;\n}\n",".feature-panel\n position: relative\n margin: 0 -1em\n\n.key-value\n display: inline-block\n margin-right: 1em\n .key\n font-weight: bold\n font-size: 0.9em\n &:after\n content: ': '\n .value\n font-size: 0.9em\n\n.feature-properties\n position: relative\n &:before\n content: \"–\"\n position: absolute\n top: 4px\n left: 0\n\n.feature-header h3\n margin-bottom: 0\n margin-top: 0.5em\n\n.feature-group\n border-bottom: 1px solid var(--panel-rule-inner)\n margin-bottom: 0.5em\n &:last-child\n border-bottom: none\n\n.tile-info\n display: flex\n flex-direction: row\n align-items: baseline\n h3\n margin-right: 0.5em\n\n.opacity-slider\n margin: 0 1em 0.5em\n :global\n .bp5-slider-handle .bp5-slider-label\n background-color: var(--secondary-color)\n color: var(--text-color)\n\n.unit-number\n .unit\n font-size: 0.9em\n margin-left: 0.2em\n font-weight: bold\n\n.page\n margin: 2em auto\n max-width: 50em\n\n.dev-index-page\n overflow-y: scroll\n","import { useMapConditionalStyle, useMapRef } from \"@macrostrat/mapbox-react\";\nimport { tileToGeoJSON } from \"@mapbox/tilebelt\";\nimport { useCallback } from \"react\";\n\ntype TileIndex = { x: number; y: number; z: number };\n\nexport function TileExtentLayer({\n tile,\n color = \"red\",\n}: {\n tile: TileIndex | null;\n color?: string;\n}) {\n const styleCallback = useCallback(\n (map, val: TileIndex) => {\n const style = map.getStyle();\n if (style.layers == null) return;\n style.layers = style.layers.filter((l) => l.id != \"tile-extent\");\n if (val == null) {\n return map.setStyle(style);\n }\n const { x, y, z } = val;\n const extent = tileToGeoJSON([x, y, z]);\n const source = {\n type: \"geojson\",\n data: extent,\n };\n const layer = {\n id: \"tile-extent\",\n type: \"line\",\n source: \"tile-extent\",\n paint: {\n \"line-color\": color,\n \"line-width\": 2,\n },\n };\n style.sources[\"tile-extent\"] = source;\n style.layers.push(layer);\n map.setStyle(style);\n },\n [color]\n );\n const map = useMapRef();\n useMapConditionalStyle(map, tile, styleCallback);\n return null;\n}\n","import { Spinner, Switch } from \"@blueprintjs/core\";\nimport { useMapRef, useMapStatus } from \"@macrostrat/mapbox-react\";\nimport mapboxgl from \"mapbox-gl\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { useEffect, useState } from \"react\";\nimport { JSONView, usePrevious } from \"@macrostrat/ui-components\";\nimport { group } from \"d3-array\";\nimport { ExpansionPanel } from \"../expansion-panel\";\n\nconst h = hyper.styled(styles);\n\nexport function FeatureProperties({ data, ...rest }) {\n return h(\"div.feature-properties\", [\n h(JSONView, {\n data,\n hideRoot: true,\n ...rest,\n }),\n ]);\n}\n\nexport function FeatureRecord({ feature }) {\n const props = feature.properties;\n return h(\"div.feature-record\", [\n h.if(Object.keys(props).length > 0)(FeatureProperties, { data: props }),\n ]);\n}\n\nexport function FeatureSelectionHandler({\n selectedLocation,\n setFeatures,\n radius = 2,\n}: {\n selectedLocation: mapboxgl.LngLat;\n setFeatures: (features: mapboxgl.MapboxGeoJSONFeature[]) => void;\n radius?: number;\n}) {\n const mapRef = useMapRef();\n const { isLoading } = useMapStatus();\n const prevLocation = usePrevious(selectedLocation);\n\n useEffect(() => {\n const map = mapRef?.current;\n if (map == null) return;\n if (selectedLocation == null) {\n setFeatures(null);\n return;\n }\n\n // Don't update if the location hasn't changed\n if (selectedLocation == prevLocation) return;\n\n const r = radius;\n const pt = map.project(selectedLocation);\n\n const bbox: [mapboxgl.PointLike, mapboxgl.PointLike] = [\n [pt.x - r, pt.y - r],\n [pt.x + r, pt.y + r],\n ];\n const features = map.queryRenderedFeatures(bbox);\n setFeatures(features);\n }, [mapRef.current, prevLocation?.current, selectedLocation, isLoading]);\n\n return null;\n}\n\nfunction FeatureHeader({ feature }) {\n return h(\"div.feature-header\", [\n h(\"h3\", [\n h(KeyValue, { label: \"Source\", value: feature.source }),\n h(KeyValue, { label: \"Source layer\", value: feature.sourceLayer }),\n ]),\n ]);\n}\n\nfunction KeyValue({ label, value }) {\n return h(\"span.key-value\", [h(\"span.key\", label), h(\"code.value\", value)]);\n}\n\nfunction LoadingAwareFeatureSet({ features, sourceID }) {\n const map = useMapRef();\n if (map?.current == null) return null;\n const [isLoaded, setIsLoaded] = useState(false);\n\n const sourceFeatures = features.filter((d) => d.source == \"burwell\");\n\n useEffect(() => {\n if (sourceFeatures.length > 0) {\n setIsLoaded(true);\n return;\n }\n\n const isLoaded = map.current.isSourceLoaded(sourceID);\n setIsLoaded(isLoaded);\n if (!isLoaded) {\n map.current.once(\"sourcedata\", (e) => {\n if (e.sourceId == sourceID) {\n setIsLoaded(true);\n }\n });\n }\n }, [map.current, sourceID, sourceFeatures.length]);\n\n if (!isLoaded) return h(Spinner);\n return h(Features, { features: sourceFeatures });\n}\n\nexport function TileInfo({ feature, showExtent, setShowExtent }) {\n if (feature == null) return null;\n const size = feature._vectorTileFeature._pbf.length;\n return h(\"div.tile-info\", [\n h(\"h3\", \"Tile\"),\n h(\"div.tile-index\", [\n h(KeyValue, { label: \"x\", value: feature._x }),\n h(KeyValue, { label: \"y\", value: feature._y }),\n h(KeyValue, { label: \"z\", value: feature._z }),\n ]),\n h(\"div.spacer\"),\n h(KeyValue, { label: \"Size\", value: formatSize(size) }),\n h(Switch, {\n label: \"Show extent\",\n alignIndicator: \"right\",\n checked: showExtent,\n onChange() {\n setShowExtent(!showExtent);\n },\n }),\n ]);\n}\n\nfunction formatSize(size: number) {\n if (size > 1000000)\n return h(UnitNumber, { value: size / 1000000, unit: \"Mb\" });\n if (size > 1000) return h(UnitNumber, { value: size / 1000, unit: \"Kb\" });\n return `${size} bytes`;\n}\n\nfunction UnitNumber({ value, unit, precision = 1 }) {\n return h(\"span.unit-number\", [\n h(\"span.number\", value.toFixed(precision)),\n h(\"span.unit\", unit),\n ]);\n}\n\nexport function FeaturePanel({\n features,\n focusedSource = null,\n focusedSourceTitle = null,\n}) {\n if (features == null) return null;\n\n let focusedSourcePanel = null;\n let filteredFeatures = features;\n let title = \"Features\";\n\n if (focusedSource != null) {\n title = \"Basemap features\";\n focusedSourcePanel = h(\n ExpansionPanel,\n {\n title: \"Macrostrat features\",\n className: \"macrostrat-features\",\n expanded: true,\n },\n [\n h(LoadingAwareFeatureSet, {\n features,\n sourceID: focusedSource,\n }),\n ]\n );\n filteredFeatures = features.filter((d) => d.source != focusedSource);\n }\n\n return h(\"div.feature-panel\", [\n focusedSourcePanel,\n h(\n ExpansionPanel,\n { title, className: \"basemap-features\", expanded: focusedSource == null },\n [\n h(FeatureGroups, {\n features: filteredFeatures,\n }),\n ]\n ),\n ]);\n}\n\nfunction FeatureGroups({ features }) {\n /** Group features by source and sourceLayer */\n if (features == null) return null;\n\n const groups = group(features, (d) => `${d.source} - ${d.sourceLayer}`);\n\n return h(\n \"div.feature-groups\",\n Array.from(groups).map(([key, features]) => {\n return h(\"div.feature-group\", [\n h(FeatureHeader, { feature: features[0] }),\n h(Features, { features }),\n ]);\n })\n );\n}\n\nexport function Features({ features }) {\n return h(\n \"div.features\",\n features.map((feature, i) => h(FeatureRecord, { key: i, feature }))\n );\n}\n","import { useState } from \"react\";\nimport { Collapse, Icon } from \"@blueprintjs/core\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport classNames from \"classnames\";\nimport { Button } from \"@blueprintjs/core\";\nimport { PanelSubhead } from \"./headers\";\n\nconst h = hyper.styled(styles);\n\nfunction ExpansionPanelSummary(props) {\n const { expanded, children, onChange, className, title, titleComponent } =\n props;\n const icon = expanded ? \"chevron-up\" : \"chevron-down\";\n return h(\n PanelSubhead,\n {\n className: classNames(\"expansion-panel-header\", className),\n onClick: onChange,\n title,\n component: titleComponent,\n },\n [children, h(Icon, { icon })]\n );\n}\n\nfunction ExpansionPanelBase(props) {\n let {\n title,\n titleComponent = \"h3\",\n children,\n expanded,\n helpText,\n onChange = () => {},\n sideComponent = null,\n className,\n } = props;\n const [isOpen, setOpen] = useState(expanded || false);\n\n const onChange_ = () => {\n onChange();\n setOpen(!isOpen);\n };\n\n return h(\n \"div.expansion-panel-base\",\n {\n className: classNames(className, {\n expanded: isOpen,\n collapsed: !isOpen,\n }),\n },\n [\n h(\n ExpansionPanelSummary,\n {\n onChange: onChange_,\n expanded: isOpen,\n title,\n titleComponent,\n },\n h(\"div.expansion-summary-title-help\", [\n h(\"span.expansion-panel-subtext\", helpText),\n \" \",\n sideComponent,\n ])\n ),\n h(Collapse, { isOpen }, h(\"div.expansion-children\", null, children)),\n ]\n );\n}\n\nexport function InfoPanelSection(props) {\n let { title, children, className, headerElement = null } = props;\n return h(\"div.info-panel-section\", { className }, [\n h(\"div.panel-subhead\", null, headerElement ?? h(\"h3\", title)),\n h(\"div.panel-content\", null, children),\n ]);\n}\n\nfunction ExpansionPanel(props) {\n return h(ExpansionPanelBase, {\n ...props,\n className: \"expansion-panel\",\n });\n}\n\nfunction SubExpansionPanel(props) {\n return h(ExpansionPanelBase, {\n ...props,\n className: \"expansion-panel sub-expansion-panel\",\n titleComponent: \"h4\",\n });\n}\n\nfunction ExpandableDetailsPanel(props) {\n let { title, children, value, headerElement, className } = props;\n const [isOpen, setIsOpen] = useState(false);\n headerElement ??= h([h(\"div.title\", title), value]);\n return h(\"div.expandable-details\", { className }, [\n h(\"div.expandable-details-main\", [\n h(\"div.expandable-details-header\", headerElement),\n h(\"div.expandable-details-toggle\", [\n h(Button, {\n small: true,\n minimal: true,\n active: isOpen,\n onClick: () => setIsOpen(!isOpen),\n icon: \"more\",\n }),\n ]),\n ]),\n h(\n Collapse,\n { isOpen },\n h(\"div.expandable-details-children\", null, children)\n ),\n ]);\n}\n\nfunction ExpansionBody({ title, className, children }) {\n return h(\"div.expansion-body\", { className }, [\n h(\"div.expansion-panel-detail-header\", title),\n h(\"div.expansion-panel-detail-body\", null, children),\n ]);\n}\n\nexport {\n ExpansionPanel,\n ExpansionPanelSummary,\n ExpandableDetailsPanel,\n SubExpansionPanel,\n ExpansionBody,\n PanelSubhead,\n};\n","\n.panel-subhead\n padding: 0.2em var(--box-horizontal-padding)\n border-top: 1px solid var(--panel-rule-color)\n border-bottom: 1px solid var(--panel-rule-color)\n background-color: var(--accent-color)\n display: flex\n flex-direction: row\n align-items: center\n z-index: 1\n gap: var(--box-horizontal-padding)\n top: -1px\n position: sticky\n h1, h2, h3, h4\n font-family: Montserrat,sans-serif\n font-weight: 700\n margin: 0.2em 0\n h4\n font-weight: 600\n .title\n flex-grow: 1\n\n// :global(.bp5-dark) .panel-subhead\n// margin 0 1px\n\n.info-panel-section\n &>.panel-subhead\n margin: -1px calc(var(--panel-padding-h) * -1) 0\n\n.expansion-panel\n padding: 0\n flex-wrap: wrap\n margin-top: -1px\n // &.collapsed\n // .expansion-panel-header\n // border-bottom-width: 0;\n\n.sub-expansion-panel\n margin: -1px calc(var(--panel-padding-h) * -0.5) 0\n overflow: hidden\n &:first-child\n .expansion-panel-header\n border-top-width: 0\n .panel-subhead\n border-top: none\n border-bottom: none\n\n .expansion-panel-header\n background-color: var(--accent-secondary-color)\n cursor: pointer\n &:hover\n background-color: var(--accent-secondary-hover-color)\n h2, h3, h4\n font-weight: 500\n border-bottom: 1px solid var(--tertiary-border-color)\n border-top: 1px solid var(--tertiary-border-color)\n margin-top: -1px\n padding: 5px 1em 5px\n align-items: center\n\n.expansion-summary-title-help\n margin-left: 5px\n :global(.bp5-icon)\n margin-left: 5px\n\n.expansion-panel-header\n cursor: pointer\n &:hover\n background-color: var(--accent-hover-color)\n :global(.bp5-icon)\n transform: translate(0,3px)\n\n.expansion-children\n padding: 5px 1em 10px\n .expansion-panel\n margin-left: -1em\n margin-right: -1em\n &:first-child\n margin-top: -5px\n\n.expansion-panel-subtext\n font-size: 85%\n font-weight: 400\n\n:global\n .expansion-panel-root\n padding-left: 15px !important\n\n .expansion-panel-detail\n display: block !important\n padding: 0 !important\n\n .expansion-panel-detail-sub\n display: block !important\n\n// New expandable panel for details\n.expandable-details-main\n display: flex\n flex-direction: row\n align-items: center\n justify-content: space-between\n margin: 3px 0\n\n.expandable-details-header\n display: inline-flex\n flex-direction: row\n align-items: baseline\n flex-grow: 1\n\n.expandable-details-children\n position: relative\n\n.expandable-details-toggle\n :global(.bp5-button)\n font-size: 10px\n\n.expandable-details\n &.macrostrat-unit\n .title:after\n content: none\n .title\n margin-right: 1em\n &:after\n content: \":\"\n\n.expansion-body\n display: inline-block\n //flex-direction row\n align-items: baseline\n background-color: var(--tertiary-background)\n padding: 2px 6px\n border-radius: 4px\n width: 100%\n box-shadow: 0px 1px 2px 1px rgba(0,0,0,0.2)\n margin-bottom: 6px\n\n.expansion-panel-detail-header\n font-size: 90%\n font-style: italic\n margin-right: 1em\n display: inline\n color: var(--secondary-color)\n &:after\n content: \":\"\n\n.expansion-panel-detail-body\n display: inline\n","import hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\n\nconst h = hyper.styled(styles);\n\nexport function PanelSubhead(props) {\n const { title, component = \"h3\", children, ...rest } = props;\n return h(\"div.panel-subhead\", rest, [\n h(\n component,\n {\n className: \"title\",\n },\n title\n ),\n children,\n ]);\n}\n"],"names":[],"version":3,"file":"main.cjs.map"}