@macrostrat/map-interface 0.0.8 → 0.0.10

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.
@@ -0,0 +1,223 @@
1
+ import mapboxgl from "mapbox-gl";
2
+ import { ReactNode } from "react";
3
+ type LatLng = {
4
+ lng: number;
5
+ lat: number;
6
+ };
7
+ type TargetPosition = LatLng & {
8
+ zoom: number;
9
+ };
10
+ type CameraPosition = LatLng & {
11
+ bearing?: number;
12
+ pitch?: number;
13
+ altitude: number;
14
+ };
15
+ type MapPosition = {
16
+ camera: CameraPosition;
17
+ target?: TargetPosition;
18
+ };
19
+ export function LoadingButton({ isLoading, onClick, active, icon, }: {
20
+ isLoading?: boolean;
21
+ onClick: any;
22
+ active?: boolean;
23
+ icon?: string;
24
+ }): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
25
+ export function MapLoadingButton(props: any): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
26
+ type AnyChildren = React.ReactNode | React.ReactFragment;
27
+ export function FloatingNavbar({ className, children, statusElement, }: {
28
+ className?: string;
29
+ children?: AnyChildren;
30
+ statusElement?: AnyChildren;
31
+ }): import("react").ReactElement<{
32
+ className: string;
33
+ }, string | import("react").JSXElementConstructor<any>>;
34
+ declare namespace InfiniteScrollView {
35
+ var defaultProps: {
36
+ hasMore(a: any, b: any): boolean;
37
+ getItems(d: any): any;
38
+ getCount(d: any): any;
39
+ getNextParams(response: any, params: any): any;
40
+ placeholder: React.ReactElement<any, string | React.JSXElementConstructor<any>>;
41
+ };
42
+ }
43
+ declare namespace ThreeColumnLayout {
44
+ var Panels: typeof SidePanel;
45
+ }
46
+ export function ValueWithUnit(props: any): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
47
+ export function DegreeCoord(props: any): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
48
+ export interface LngLatProps {
49
+ /** Map position */
50
+ position: [number, number] | {
51
+ lat: number;
52
+ lng: number;
53
+ };
54
+ className?: string;
55
+ /** Zoom level (used to infer coordinate rounding if provided) */
56
+ zoom?: number | null;
57
+ /** Number of decimal places to round coordinates to */
58
+ precision: number | null;
59
+ /** Function to format coordinates */
60
+ format?: (val: number, precision: number) => string;
61
+ }
62
+ export function LngLatCoords(props: LngLatProps): import("react").ReactElement<{
63
+ className: string;
64
+ }, string | import("react").JSXElementConstructor<any>>;
65
+ export function Elevation(props: any): import("react").ReactElement<{
66
+ className: any;
67
+ }, string | import("react").JSXElementConstructor<any>>;
68
+ export function InfoDrawerContainer(props: any): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
69
+ export function LocationPanel(props: any): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
70
+ interface XRayOptions {
71
+ color?: string;
72
+ inDarkMode?: boolean;
73
+ mapboxToken?: string;
74
+ xRaySources?: string[];
75
+ }
76
+ export function buildXRayStyle(baseStyle: string | object, params?: XRayOptions): Promise<{
77
+ layers: any[];
78
+ sources: mapboxgl.Sources;
79
+ bearing?: number;
80
+ center?: number[];
81
+ fog?: mapboxgl.Fog;
82
+ glyphs?: string;
83
+ metadata?: any;
84
+ name?: string;
85
+ pitch?: number;
86
+ light?: mapboxgl.Light;
87
+ sprite?: string;
88
+ terrain?: mapboxgl.TerrainSpecification;
89
+ transition?: mapboxgl.Transition;
90
+ version: number;
91
+ zoom?: number;
92
+ }>;
93
+ type InspectorStyleOptions = XRayOptions & {
94
+ xRay?: boolean;
95
+ };
96
+ export function buildInspectorStyle(baseStyle: mapboxgl.Style | string, overlayStyle?: mapboxgl.Style | string | null, params?: InspectorStyleOptions): Promise<mapboxgl.Style>;
97
+ export function MapBottomControls(): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
98
+ export function MapInterface(): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
99
+ export const PanelCard: (props: any) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
100
+ export const MapAreaContainer: (props: any) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
101
+ interface MapContainerProps {
102
+ className?: string;
103
+ mapPosition?: MapPosition;
104
+ children?: ReactNode;
105
+ }
106
+ export function MapStyledContainer({ className, children }: MapContainerProps): import("react").ReactElement<{
107
+ className: string;
108
+ }, string | import("react").JSXElementConstructor<any>>;
109
+ export function getMapPadding(ref: any, parentRef: any): {
110
+ left: number;
111
+ top: number;
112
+ right: number;
113
+ bottom: number;
114
+ };
115
+ export function useMapMarker(mapRef: any, markerRef: any, markerPosition: any): void;
116
+ export function MapResizeManager({ containerRef }: {
117
+ containerRef: any;
118
+ }): any;
119
+ interface MapPaddingManagerProps {
120
+ containerRef: React.RefObject<HTMLDivElement>;
121
+ parentRef: React.RefObject<HTMLDivElement>;
122
+ infoMarkerPosition: mapboxgl.LngLatLike;
123
+ }
124
+ export function MapPaddingManager({ containerRef, parentRef, infoMarkerPosition, }: MapPaddingManagerProps): any;
125
+ export function MapMovedReporter({ onMapMoved }: {
126
+ onMapMoved?: any;
127
+ }): any;
128
+ export function MapLoadingReporter({ ignoredSources, onMapLoading, onMapIdle, mapIsLoading, }: {
129
+ ignoredSources: any;
130
+ onMapLoading?: any;
131
+ onMapIdle?: any;
132
+ mapIsLoading: any;
133
+ }): any;
134
+ export function MapMarker({ position, setPosition, centerMarker }: {
135
+ position: any;
136
+ setPosition: any;
137
+ centerMarker?: boolean;
138
+ }): any;
139
+ type MapboxCoreOptions = Omit<mapboxgl.MapboxOptions, "container">;
140
+ export interface MapViewProps extends MapboxCoreOptions {
141
+ showLineSymbols?: boolean;
142
+ children?: React.ReactNode;
143
+ accessToken?: string;
144
+ terrainSourceID?: string;
145
+ enableTerrain?: boolean;
146
+ infoMarkerPosition?: mapboxgl.LngLatLike;
147
+ mapPosition?: MapPosition;
148
+ }
149
+ export function MapView(props: MapViewProps): import("react").ReactElement<{
150
+ ref: import("react").MutableRefObject<HTMLDivElement>;
151
+ }, string | import("react").JSXElementConstructor<any>>;
152
+ export function MapTerrainManager({ mapUse3D, terrainSourceID, }: {
153
+ mapUse3D?: boolean;
154
+ terrainSourceID?: string;
155
+ }): any;
156
+ type TileIndex = {
157
+ x: number;
158
+ y: number;
159
+ z: number;
160
+ };
161
+ export function TileExtentLayer({ tile, color, }: {
162
+ tile: TileIndex | null;
163
+ color?: string;
164
+ }): any;
165
+ export function ExpansionPanelSummary(props: any): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
166
+ export function InfoPanelSection(props: any): import("react").ReactElement<{
167
+ className: any;
168
+ }, string | import("react").JSXElementConstructor<any>>;
169
+ export function ExpansionPanel(props: any): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
170
+ export function SubExpansionPanel(props: any): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
171
+ export function ExpandableDetailsPanel(props: any): import("react").ReactElement<{
172
+ className: any;
173
+ }, string | import("react").JSXElementConstructor<any>>;
174
+ export function ExpansionBody({ title, className, children }: {
175
+ title: any;
176
+ className: any;
177
+ children: any;
178
+ }): import("react").ReactElement<{
179
+ className: any;
180
+ }, string | import("react").JSXElementConstructor<any>>;
181
+ export function FeatureRecord({ feature }: {
182
+ feature: any;
183
+ }): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
184
+ export function FeatureSelectionHandler({ selectedLocation, setFeatures, radius, }: {
185
+ selectedLocation: mapboxgl.LngLat;
186
+ setFeatures: (features: mapboxgl.MapboxGeoJSONFeature[]) => void;
187
+ radius?: number;
188
+ }): any;
189
+ export function TileInfo({ feature, showExtent, setShowExtent }: {
190
+ feature: any;
191
+ showExtent: any;
192
+ setShowExtent: any;
193
+ }): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
194
+ export function FeaturePanel({ features, focusedSource, focusedSourceTitle, }: {
195
+ features: any;
196
+ focusedSource?: any;
197
+ focusedSourceTitle?: any;
198
+ }): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
199
+ export enum MacrostratVectorTileset {
200
+ Carto = "carto",
201
+ CartoSlim = "carto-slim",
202
+ IGCPOrogens = "igcp-orogens"
203
+ }
204
+ export enum MacrostratRasterTileset {
205
+ Carto = "carto",
206
+ Emphasized = "emphasized"
207
+ }
208
+ export const h: import("@macrostrat/hyper").Hyper;
209
+ export function DevMapPage({ title, headerElement, transformRequest, mapPosition, mapboxToken, overlayStyle, children, style, focusedSource, focusedSourceTitle, projection, }: {
210
+ headerElement?: React.ReactElement;
211
+ transformRequest?: mapboxgl.TransformRequestFunction;
212
+ title?: string;
213
+ style: mapboxgl.Style | string;
214
+ children?: React.ReactNode;
215
+ mapboxToken?: string;
216
+ overlayStyle?: mapboxgl.Style | string;
217
+ focusedSource?: string;
218
+ focusedSourceTitle?: string;
219
+ projection?: string;
220
+ mapPosition?: MapPosition;
221
+ }): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
222
+
223
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"mappings":";;ACGA,cAAc;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,sBAAsB,MAAM,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,sBAAsB,MAAM,GAAG;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,mBAA0B;IACxB,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB,CAAC;AWXF,8BAA8B,EAC5B,SAAiB,EACjB,OAAO,EACP,MAAc,EACd,IAAa,GACd;;;;;CAAA,0FAQA;AAED,iCAAiC,KAAK,KAAA,0FAIrC;AAED,mBAAmB,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC;AAEzD,+BAA+B,EAC7B,SAAS,EACT,QAAQ,EACR,aAAoB,GACrB,EAAE;IACD,SAAS,CAAC,EAAE,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B,WAAW,iBAAiB;CAC7B;AAED;IACE,KAAK,UAAU;IACf,UAAU,eAAe;CAC1B;AAED,OAAO,MAAM,oCAAwB,CAAC;AAEtC,2BAA2B,EACzB,KAAuB,EACvB,aAAoB,EACpB,gBAAuB,EACvB,WAAkB,EAClB,WAAkB,EAClB,YAAmB,EACnB,QAAQ,EACR,KAAK,EACL,aAAoB,EACpB,kBAAyB,EACzB,UAAiB,GAClB,EAAE;IACD,aAAa,CAAC,EAAE,MAAM,YAAY,CAAC;IACnC,gBAAgB,CAAC,EAAE,SAAS,wBAAwB,CAAC;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,KAAK,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,SAAS,KAAK,GAAG,MAAM,CAAC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,0FA0HA","sources":["packages/map-interface/mapbox-utils/src/preprocess-styles.ts","packages/map-interface/mapbox-utils/src/position.ts","packages/map-interface/mapbox-utils/src/view-info.ts","packages/map-interface/mapbox-utils/src/labels.ts","packages/map-interface/mapbox-utils/src/index.ts","packages/map-interface/mapbox-react/src/context.ts","packages/map-interface/mapbox-react/src/hooks.ts","packages/map-interface/mapbox-react/src/controls.ts","packages/map-interface/mapbox-react/src/terrain.ts","packages/map-interface/mapbox-react/src/debugger.ts","packages/map-interface/mapbox-react/src/focus-state.ts","packages/map-interface/mapbox-react/src/index.ts","packages/map-interface/src/src/context-panel/index.ts","packages/map-interface/ui-components/src/api/types.ts","packages/map-interface/ui-components/src/util/query-string.ts","packages/map-interface/ui-components/src/util/state-hooks.ts","packages/map-interface/ui-components/src/util/layout-hooks.ts","packages/map-interface/ui-components/src/util/local-storage.ts","packages/map-interface/ui-components/src/dark-mode.ts","packages/map-interface/ui-components/src/util/json-view.ts","packages/map-interface/ui-components/src/util/scroll-helpers.ts","packages/map-interface/ui-components/src/util/migration-helpers.ts","packages/map-interface/ui-components/src/util/box-model.ts","packages/map-interface/ui-components/src/util/event-hooks.ts","packages/map-interface/ui-components/src/util/flexbox.ts","packages/map-interface/ui-components/src/util/index.ts","packages/map-interface/ui-components/src/api/provider.ts","packages/map-interface/ui-components/src/api/data-provider.ts","packages/map-interface/ui-components/src/api/indexing.ts","packages/map-interface/ui-components/src/api/frontend.ts","packages/map-interface/ui-components/src/api/paged.ts","packages/map-interface/ui-components/src/api/index.ts","packages/map-interface/ui-components/src/infinite-scroll.ts","packages/map-interface/ui-components/src/buttons/delete-button.ts","packages/map-interface/ui-components/src/buttons/index.ts","packages/map-interface/ui-components/src/collapse-panel/index.ts","packages/map-interface/ui-components/src/link-card.ts","packages/map-interface/ui-components/src/file-upload/index.ts","packages/map-interface/ui-components/src/image.ts","packages/map-interface/ui-components/src/model-editor.ts","packages/map-interface/ui-components/src/toaster.ts","packages/map-interface/ui-components/src/citations/author-list.ts","packages/map-interface/ui-components/src/citations/index.ts","packages/map-interface/ui-components/src/geodeepdive/reference-card.ts","packages/map-interface/ui-components/src/geodeepdive/index.ts","packages/map-interface/ui-components/src/text.ts","packages/map-interface/ui-components/src/form-controls/slider.ts","packages/map-interface/ui-components/src/form-controls/index.ts","packages/map-interface/ui-components/src/settings/index.ts","packages/map-interface/ui-components/src/error-boundary.ts","packages/map-interface/ui-components/src/patterns/composite-image.ts","packages/map-interface/ui-components/src/patterns/index.ts","packages/map-interface/ui-components/src/collapse-card.ts","packages/map-interface/ui-components/src/modal-panel/draggable-overlay.ts","packages/map-interface/ui-components/src/modal-panel/index.ts","packages/map-interface/ui-components/src/page-layouts/index.ts","packages/map-interface/ui-components/src/index.ts","packages/map-interface/src/src/location-info/utils.ts","packages/map-interface/src/src/location-info/index.ts","packages/map-interface/src/src/location-panel/header.ts","packages/map-interface/src/src/location-panel/index.ts","packages/map-interface/src/src/dev/xray.ts","packages/map-interface/src/src/controls.ts","packages/map-interface/src/src/container.ts","packages/map-interface/src/src/utils.ts","packages/map-interface/src/src/helpers.ts","packages/map-interface/src/src/map-view/terrain.ts","packages/map-interface/src/src/map-view/index.ts","packages/map-interface/src/src/dev/tile-extent.ts","packages/map-interface/src/src/expansion-panel/headers.ts","packages/map-interface/src/src/expansion-panel/index.ts","packages/map-interface/src/src/dev/vector-tile-features.ts","packages/map-interface/src/src/dev/map-page.ts","packages/map-interface/src/src/dev/index.ts","packages/map-interface/src/src/index.ts","packages/map-interface/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"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"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@macrostrat/map-interface",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Map interface for Macrostrat",
5
- "type": "module",
6
5
  "source": "src/index.ts",
7
- "main": "dist/index.js",
6
+ "types": "dist/types.d.ts",
7
+ "module": "dist/module.js",
8
8
  "dependencies": {
9
9
  "@macrostrat/hyper": "^2.2.1",
10
- "@macrostrat/mapbox-react": "^2.0.1",
11
- "@macrostrat/mapbox-utils": "^1.2.0",
12
- "@macrostrat/ui-components": "^3.0.0-b9",
10
+ "@macrostrat/mapbox-react": "^2.0.2",
11
+ "@macrostrat/mapbox-utils": "^1.2.1",
12
+ "@macrostrat/ui-components": "^3.0.0-b10",
13
13
  "@mapbox/tilebelt": "^1.0.2",
14
14
  "@turf/bbox": "^6.5.0",
15
15
  "chroma-js": "^2.4.2",
@@ -23,7 +23,8 @@
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@blueprintjs/core": "^3.43.0 || ^4.3.0",
26
- "react": "^16.8.6||^17.0.0||^18.0.0"
26
+ "react": "^16.8.6||^17.0.0||^18.0.0",
27
+ "react-dom": "^16.8.6||^17.0.0||^18.0.0"
27
28
  },
28
29
  "scripts": {
29
30
  "dev": "parcel watch",
package/src/dev/index.ts CHANGED
@@ -1,179 +1,4 @@
1
- // Import other components
2
- import { Switch } from "@blueprintjs/core";
3
- import hyper from "@macrostrat/hyper";
4
- import { Spacer, useDarkMode, useStoredState } from "@macrostrat/ui-components";
5
- import mapboxgl from "mapbox-gl";
6
- import { useCallback, useState, useEffect } from "react";
7
- import { buildInspectorStyle, buildXRayStyle } from "./xray";
8
- import { MapAreaContainer, PanelCard } from "../container";
9
- import { FloatingNavbar, MapLoadingButton } from "../context-panel";
10
- import { MapMarker } from "../helpers";
11
- import { LocationPanel } from "../location-panel";
12
- import { MapView } from "../map-view";
13
- import styles from "./main.module.sass";
14
- import { TileExtentLayer } from "./tile-extent";
15
- import {
16
- FeaturePanel,
17
- FeatureSelectionHandler,
18
- TileInfo,
19
- } from "./vector-tile-features";
20
- import { MapPosition } from "@macrostrat/mapbox-utils";
21
-
22
- export enum MacrostratVectorTileset {
23
- Carto = "carto",
24
- CartoSlim = "carto-slim",
25
- IGCPOrogens = "igcp-orogens",
26
- }
27
-
28
- export enum MacrostratRasterTileset {
29
- Carto = "carto",
30
- Emphasized = "emphasized",
31
- }
32
-
33
- export const h = hyper.styled(styles);
34
-
35
- export function DevMapPage({
36
- title = "Map inspector",
37
- headerElement = null,
38
- transformRequest = null,
39
- mapPosition = null,
40
- mapboxToken = null,
41
- overlayStyle = null,
42
- children,
43
- style,
44
- focusedSource = null,
45
- focusedSourceTitle = null,
46
- projection = null,
47
- }: {
48
- headerElement?: React.ReactElement;
49
- transformRequest?: mapboxgl.TransformRequestFunction;
50
- title?: string;
51
- style: mapboxgl.Style | string;
52
- children?: React.ReactNode;
53
- mapboxToken?: string;
54
- overlayStyle?: mapboxgl.Style | string;
55
- focusedSource?: string;
56
- focusedSourceTitle?: string;
57
- projection?: string;
58
- mapPosition?: MapPosition;
59
- }) {
60
- /* We apply a custom style to the panel container when we are interacting
61
- with the search bar, so that we can block map interactions until search
62
- bar focus is lost.
63
- We also apply a custom style when the infodrawer is open so we can hide
64
- the search bar on mobile platforms
65
- */
66
-
67
- const dark = useDarkMode();
68
- const isEnabled = dark?.isEnabled;
69
-
70
- if (mapboxToken != null) {
71
- mapboxgl.accessToken = mapboxToken;
72
- }
73
-
74
- style ??= isEnabled
75
- ? "mapbox://styles/mapbox/dark-v10"
76
- : "mapbox://styles/mapbox/light-v10";
77
-
78
- const [isOpen, setOpen] = useState(false);
79
-
80
- const [state, setState] = useStoredState("macrostrat:dev-map-page", {
81
- showTileExtent: false,
82
- xRay: false,
83
- });
84
- const { showTileExtent, xRay } = state;
85
-
86
- const [actualStyle, setActualStyle] = useState(style);
87
-
88
- useEffect(() => {
89
- buildInspectorStyle(style, overlayStyle, {
90
- mapboxToken,
91
- inDarkMode: isEnabled,
92
- xRay,
93
- }).then(setActualStyle);
94
- }, [style, xRay, mapboxToken, isEnabled, overlayStyle]);
95
-
96
- const [inspectPosition, setInspectPosition] =
97
- useState<mapboxgl.LngLat | null>(null);
98
-
99
- const [data, setData] = useState(null);
100
-
101
- const onSelectPosition = useCallback((position: mapboxgl.LngLat) => {
102
- setInspectPosition(position);
103
- }, []);
104
-
105
- let detailElement = null;
106
- if (inspectPosition != null) {
107
- detailElement = h(
108
- LocationPanel,
109
- {
110
- onClose() {
111
- setInspectPosition(null);
112
- },
113
- position: inspectPosition,
114
- },
115
- [
116
- h(TileInfo, {
117
- feature: data?.[0] ?? null,
118
- showExtent: showTileExtent,
119
- setShowExtent() {
120
- setState({ ...state, showTileExtent: !showTileExtent });
121
- },
122
- }),
123
- h(FeaturePanel, { features: data, focusedSource, focusedSourceTitle }),
124
- ]
125
- );
126
- }
127
-
128
- let tile = null;
129
- if (showTileExtent && data?.[0] != null) {
130
- let f = data[0];
131
- tile = { x: f._x, y: f._y, z: f._z };
132
- }
133
-
134
- return h(
135
- MapAreaContainer,
136
- {
137
- navbar: h(FloatingNavbar, [
138
- headerElement ?? h("h2", title),
139
- h(Spacer),
140
- h(MapLoadingButton, {
141
- active: isOpen,
142
- onClick: () => setOpen(!isOpen),
143
- }),
144
- ]),
145
- contextPanel: h(PanelCard, [
146
- h(Switch, {
147
- checked: xRay,
148
- label: "X-ray mode",
149
- onChange() {
150
- setState({ ...state, xRay: !xRay });
151
- },
152
- }),
153
- children,
154
- ]),
155
- detailPanel: detailElement,
156
- contextPanelOpen: isOpen,
157
- },
158
- h(
159
- MapView,
160
- {
161
- style: actualStyle,
162
- transformRequest,
163
- mapPosition,
164
- projection: "globe",
165
- },
166
- [
167
- h(FeatureSelectionHandler, {
168
- selectedLocation: inspectPosition,
169
- setFeatures: setData,
170
- }),
171
- h(MapMarker, {
172
- position: inspectPosition,
173
- setPosition: onSelectPosition,
174
- }),
175
- h(TileExtentLayer, { tile, color: isEnabled ? "white" : "black" }),
176
- ]
177
- )
178
- );
179
- }
1
+ export * from "./map-page";
2
+ export * from "./tile-extent";
3
+ export * from "./vector-tile-features";
4
+ export * from "./xray";
@@ -0,0 +1,181 @@
1
+ // Import other components
2
+ import { Switch } from "@blueprintjs/core";
3
+ import hyper from "@macrostrat/hyper";
4
+ import { Spacer, useDarkMode, useStoredState } from "@macrostrat/ui-components";
5
+ import mapboxgl from "mapbox-gl";
6
+ import { useCallback, useState, useEffect } from "react";
7
+ import { buildInspectorStyle, buildXRayStyle } from "./xray";
8
+ import { MapAreaContainer, PanelCard } from "../container";
9
+ import { FloatingNavbar, MapLoadingButton } from "../context-panel";
10
+ import { MapMarker } from "../helpers";
11
+ import { LocationPanel } from "../location-panel";
12
+ import { MapView } from "../map-view";
13
+ import styles from "./main.module.sass";
14
+ import { TileExtentLayer } from "./tile-extent";
15
+ import {
16
+ FeaturePanel,
17
+ FeatureSelectionHandler,
18
+ TileInfo,
19
+ } from "./vector-tile-features";
20
+ import { MapPosition } from "@macrostrat/mapbox-utils";
21
+
22
+ export enum MacrostratVectorTileset {
23
+ Carto = "carto",
24
+ CartoSlim = "carto-slim",
25
+ IGCPOrogens = "igcp-orogens",
26
+ }
27
+
28
+ export enum MacrostratRasterTileset {
29
+ Carto = "carto",
30
+ Emphasized = "emphasized",
31
+ }
32
+
33
+ export const h = hyper.styled(styles);
34
+
35
+ export function DevMapPage({
36
+ title = "Map inspector",
37
+ headerElement = null,
38
+ transformRequest = null,
39
+ mapPosition = null,
40
+ mapboxToken = null,
41
+ overlayStyle = null,
42
+ children,
43
+ style,
44
+ focusedSource = null,
45
+ focusedSourceTitle = null,
46
+ projection = null,
47
+ }: {
48
+ headerElement?: React.ReactElement;
49
+ transformRequest?: mapboxgl.TransformRequestFunction;
50
+ title?: string;
51
+ style: mapboxgl.Style | string;
52
+ children?: React.ReactNode;
53
+ mapboxToken?: string;
54
+ overlayStyle?: mapboxgl.Style | string;
55
+ focusedSource?: string;
56
+ focusedSourceTitle?: string;
57
+ projection?: string;
58
+ mapPosition?: MapPosition;
59
+ }) {
60
+ /* We apply a custom style to the panel container when we are interacting
61
+ with the search bar, so that we can block map interactions until search
62
+ bar focus is lost.
63
+ We also apply a custom style when the infodrawer is open so we can hide
64
+ the search bar on mobile platforms
65
+ */
66
+
67
+ const dark = useDarkMode();
68
+ const isEnabled = dark?.isEnabled;
69
+
70
+ if (mapboxToken != null) {
71
+ mapboxgl.accessToken = mapboxToken;
72
+ }
73
+
74
+ style ??= isEnabled
75
+ ? "mapbox://styles/mapbox/dark-v10"
76
+ : "mapbox://styles/mapbox/light-v10";
77
+
78
+ const [isOpen, setOpen] = useState(false);
79
+
80
+ const [state, setState] = useStoredState("macrostrat:dev-map-page", {
81
+ showTileExtent: false,
82
+ xRay: false,
83
+ });
84
+ const { showTileExtent, xRay } = state;
85
+
86
+ const [actualStyle, setActualStyle] = useState(style);
87
+
88
+ useEffect(() => {
89
+ buildInspectorStyle(style, overlayStyle, {
90
+ mapboxToken,
91
+ inDarkMode: isEnabled,
92
+ xRay,
93
+ }).then(setActualStyle);
94
+ }, [style, xRay, mapboxToken, isEnabled, overlayStyle]);
95
+
96
+ const [inspectPosition, setInspectPosition] =
97
+ useState<mapboxgl.LngLat | null>(null);
98
+
99
+ const [data, setData] = useState(null);
100
+
101
+ const onSelectPosition = useCallback((position: mapboxgl.LngLat) => {
102
+ setInspectPosition(position);
103
+ }, []);
104
+
105
+ let detailElement = null;
106
+ if (inspectPosition != null) {
107
+ detailElement = h(
108
+ LocationPanel,
109
+ {
110
+ onClose() {
111
+ setInspectPosition(null);
112
+ },
113
+ position: inspectPosition,
114
+ },
115
+ [
116
+ h(TileInfo, {
117
+ feature: data?.[0] ?? null,
118
+ showExtent: showTileExtent,
119
+ setShowExtent() {
120
+ setState({ ...state, showTileExtent: !showTileExtent });
121
+ },
122
+ }),
123
+ h(FeaturePanel, { features: data, focusedSource, focusedSourceTitle }),
124
+ ]
125
+ );
126
+ }
127
+
128
+ let tile = null;
129
+ if (showTileExtent && data?.[0] != null) {
130
+ let f = data[0];
131
+ tile = { x: f._x, y: f._y, z: f._z };
132
+ }
133
+
134
+ console.log("Style", actualStyle);
135
+
136
+ return h(
137
+ MapAreaContainer,
138
+ {
139
+ navbar: h(FloatingNavbar, [
140
+ headerElement ?? h("h2", title),
141
+ h(Spacer),
142
+ h(MapLoadingButton, {
143
+ active: isOpen,
144
+ onClick: () => setOpen(!isOpen),
145
+ }),
146
+ ]),
147
+ contextPanel: h(PanelCard, [
148
+ h(Switch, {
149
+ checked: xRay,
150
+ label: "X-ray mode",
151
+ onChange() {
152
+ setState({ ...state, xRay: !xRay });
153
+ },
154
+ }),
155
+ children,
156
+ ]),
157
+ detailPanel: detailElement,
158
+ contextPanelOpen: isOpen,
159
+ },
160
+ h(
161
+ MapView,
162
+ {
163
+ style: actualStyle,
164
+ transformRequest,
165
+ mapPosition,
166
+ projection: "globe",
167
+ },
168
+ [
169
+ h(FeatureSelectionHandler, {
170
+ selectedLocation: inspectPosition,
171
+ setFeatures: setData,
172
+ }),
173
+ h(MapMarker, {
174
+ position: inspectPosition,
175
+ setPosition: onSelectPosition,
176
+ }),
177
+ h(TileExtentLayer, { tile, color: isEnabled ? "white" : "black" }),
178
+ ]
179
+ )
180
+ );
181
+ }
package/src/index.ts CHANGED
@@ -3,3 +3,8 @@ export * from "./location-panel";
3
3
  export * from "./dev";
4
4
  export * from "./container";
5
5
  export * from "./map-view";
6
+ export * from "./controls";
7
+ export * from "./helpers";
8
+ export * from "./utils";
9
+ export * from "./location-info";
10
+ export * from "./expansion-panel";