@macrostrat/map-interface 2.0.1 → 2.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/CHANGELOG.md +10 -0
- package/dist/container.js +2 -2
- package/dist/container.js.map +1 -1
- package/dist/context-panel/index.js +2 -2
- package/dist/context-panel/index.js.map +1 -1
- package/dist/context-panel/main.module.sass.cjs +6 -1
- package/dist/context-panel/main.module.sass.cjs.map +1 -1
- package/dist/context-panel/main.module.sass.js +4 -1
- package/dist/context-panel/main.module.sass.js.map +1 -1
- package/dist/controls.js +2 -2
- package/dist/controls.js.map +1 -1
- package/dist/dev/main.module.sass.cjs +6 -1
- package/dist/dev/main.module.sass.cjs.map +1 -1
- package/dist/dev/main.module.sass.js +4 -1
- package/dist/dev/main.module.sass.js.map +1 -1
- package/dist/dev/map-page.js +2 -2
- package/dist/dev/map-page.js.map +1 -1
- package/dist/dev/vector-tile-features.cjs +3 -3
- package/dist/dev/vector-tile-features.cjs.map +1 -1
- package/dist/dev/vector-tile-features.js +3 -3
- package/dist/dev/vector-tile-features.js.map +1 -1
- package/dist/index.cjs +6 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -13
- package/dist/index.js.map +1 -1
- package/dist/location-details/fossil-collections/collections.js +2 -2
- package/dist/location-details/fossil-collections/collections.js.map +1 -1
- package/dist/location-details/fossil-collections/main.module.sass.cjs +6 -1
- package/dist/location-details/fossil-collections/main.module.sass.cjs.map +1 -1
- package/dist/location-details/fossil-collections/main.module.sass.js +4 -1
- package/dist/location-details/fossil-collections/main.module.sass.js.map +1 -1
- package/dist/location-details/index.d.ts +0 -1
- package/dist/location-details/info-blocks.cjs +0 -22
- package/dist/location-details/info-blocks.cjs.map +1 -1
- package/dist/location-details/info-blocks.js +2 -24
- package/dist/location-details/info-blocks.js.map +1 -1
- package/dist/location-details/info-blocks.module.sass.cjs +6 -1
- package/dist/location-details/info-blocks.module.sass.cjs.map +1 -1
- package/dist/location-details/info-blocks.module.sass.js +4 -1
- package/dist/location-details/info-blocks.module.sass.js.map +1 -1
- package/dist/location-details/macrostrat-linked.cjs +82 -129
- package/dist/location-details/macrostrat-linked.cjs.map +1 -1
- package/dist/location-details/macrostrat-linked.js +29 -75
- package/dist/location-details/macrostrat-linked.js.map +1 -1
- package/dist/location-details/main.module.sass.cjs +6 -1
- package/dist/location-details/main.module.sass.cjs.map +1 -1
- package/dist/location-details/main.module.sass.js +4 -1
- package/dist/location-details/main.module.sass.js.map +1 -1
- package/dist/location-details/physiography.cjs +2 -2
- package/dist/location-details/physiography.cjs.map +1 -1
- package/dist/location-details/physiography.js +1 -1
- package/dist/location-details/physiography.js.map +1 -1
- package/dist/location-details/reg-strat.cjs +2 -2
- package/dist/location-details/reg-strat.cjs.map +1 -1
- package/dist/location-details/reg-strat.js +1 -1
- package/dist/location-details/reg-strat.js.map +1 -1
- package/dist/location-panel/header.js +2 -2
- package/dist/location-panel/header.js.map +1 -1
- package/dist/location-panel/index.js +2 -2
- package/dist/location-panel/index.js.map +1 -1
- package/dist/location-panel/main.module.sass.cjs +6 -1
- package/dist/location-panel/main.module.sass.cjs.map +1 -1
- package/dist/location-panel/main.module.sass.js +4 -1
- package/dist/location-panel/main.module.sass.js.map +1 -1
- package/dist/main.module.sass.cjs +6 -1
- package/dist/main.module.sass.cjs.map +1 -1
- package/dist/main.module.sass.js +4 -1
- package/dist/main.module.sass.js.map +1 -1
- package/dist/map-interface.css +43 -215
- package/dist/map-view.js +2 -2
- package/dist/map-view.js.map +1 -1
- package/package.json +8 -8
- package/src/dev/vector-tile-features.ts +1 -1
- package/src/index.ts +0 -1
- package/src/location-details/index.ts +0 -1
- package/src/location-details/macrostrat-linked.ts +29 -81
- package/src/location-details/main.module.sass +0 -1
- package/src/location-details/physiography.ts +1 -1
- package/src/location-details/reg-strat.ts +1 -1
- package/dist/expansion-panel/headers.cjs +0 -22
- package/dist/expansion-panel/headers.cjs.map +0 -1
- package/dist/expansion-panel/headers.d.ts +0 -1
- package/dist/expansion-panel/headers.js +0 -20
- package/dist/expansion-panel/headers.js.map +0 -1
- package/dist/expansion-panel/index.cjs +0 -128
- package/dist/expansion-panel/index.cjs.map +0 -1
- package/dist/expansion-panel/index.d.ts +0 -18
- package/dist/expansion-panel/index.js +0 -125
- package/dist/expansion-panel/index.js.map +0 -1
- package/dist/expansion-panel/main.module.sass.cjs +0 -27
- package/dist/expansion-panel/main.module.sass.cjs.map +0 -1
- package/dist/expansion-panel/main.module.sass.js +0 -27
- package/dist/expansion-panel/main.module.sass.js.map +0 -1
- package/dist/location-details/fetch.d.ts +0 -4
- package/dist/location-details/utils/index.cjs +0 -15
- package/dist/location-details/utils/index.cjs.map +0 -1
- package/dist/location-details/utils/index.js +0 -15
- package/dist/location-details/utils/index.js.map +0 -1
- package/dist/location-details/xdd-panel/article.cjs +0 -64
- package/dist/location-details/xdd-panel/article.cjs.map +0 -1
- package/dist/location-details/xdd-panel/article.d.ts +0 -1
- package/dist/location-details/xdd-panel/article.js +0 -62
- package/dist/location-details/xdd-panel/article.js.map +0 -1
- package/dist/location-details/xdd-panel/index.cjs +0 -71
- package/dist/location-details/xdd-panel/index.cjs.map +0 -1
- package/dist/location-details/xdd-panel/index.d.ts +0 -18
- package/dist/location-details/xdd-panel/index.js +0 -69
- package/dist/location-details/xdd-panel/index.js.map +0 -1
- package/dist/location-details/xdd-panel/journal.cjs +0 -27
- package/dist/location-details/xdd-panel/journal.cjs.map +0 -1
- package/dist/location-details/xdd-panel/journal.d.ts +0 -20
- package/dist/location-details/xdd-panel/journal.js +0 -25
- package/dist/location-details/xdd-panel/journal.js.map +0 -1
- package/src/expansion-panel/headers.ts +0 -18
- package/src/expansion-panel/index.ts +0 -135
- package/src/expansion-panel/main.module.sass +0 -157
- package/src/location-details/fetch.ts +0 -57
- package/src/location-details/location-details.stories.ts +0 -88
- package/src/location-details/xdd-panel/article.ts +0 -67
- package/src/location-details/xdd-panel/index.ts +0 -70
- package/src/location-details/xdd-panel/journal.ts +0 -60
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. The format
|
|
|
4
4
|
is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this
|
|
5
5
|
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [2.1.0] - 2026-02-09
|
|
8
|
+
|
|
9
|
+
- Remove xDD info panel components
|
|
10
|
+
- Move `ExpansionPanel` and `ExpandableDetails` components to
|
|
11
|
+
`@macrostrat/data-components`
|
|
12
|
+
|
|
13
|
+
## [2.0.2] - 2026-02-06
|
|
14
|
+
|
|
15
|
+
Remove typings that repeat Vite defaults
|
|
16
|
+
|
|
7
17
|
## [2.0.1] - 2026-01-29
|
|
8
18
|
|
|
9
19
|
- Change layout of `package.json` and remove `ui-box` dependency.
|
package/dist/container.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import h$1, { addClassNames } from "@macrostrat/hyper";
|
|
2
|
-
import
|
|
2
|
+
import h$2 from "./main.module.sass.js";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { useTransition } from "transition-hook";
|
|
5
5
|
import { useMapPosition, MapboxMapProvider, ZoomControl } from "@macrostrat/mapbox-react";
|
|
@@ -7,7 +7,7 @@ import { ToasterContext } from "@macrostrat/ui-components";
|
|
|
7
7
|
import { MapBottomControls } from "./controls.js";
|
|
8
8
|
import { mapViewInfo } from "@macrostrat/mapbox-utils";
|
|
9
9
|
import { Card } from "@blueprintjs/core";
|
|
10
|
-
const h = h$1.styled(
|
|
10
|
+
const h = h$1.styled(h$2);
|
|
11
11
|
const PanelCard = (props) => h(Card, { ...props, className: classNames("panel-card", props.className) });
|
|
12
12
|
var DetailPanelStyle = /* @__PURE__ */ ((DetailPanelStyle2) => {
|
|
13
13
|
DetailPanelStyle2["FIXED"] = "fixed";
|
package/dist/container.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.js","sources":["../src/container.ts"],"sourcesContent":["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\ninterface MapAreaContainerProps {\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 preventMapInteraction?: boolean;\n}\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}: MapAreaContainerProps) {\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 let contextStack = null;\n if (navbar != null || contextPanel != null) {\n contextStack = h(ContextStack, { navbar, ...contextStackProps }, [\n h.if(contextPanelTrans.shouldMount)([contextPanel]),\n ]);\n }\n\n return h(MapStyledContainer, { className: mainUIClassNames }, [\n h(\"div.main-row\", [\n h(\"div.map-ui\", { ...rest }, [\n contextStack,\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"],"names":["hyper","DetailPanelStyle"],"mappings":";;;;;;;;;AAiBA,MAAM,IAAIA,IAAM,
|
|
1
|
+
{"version":3,"file":"container.js","sources":["../src/container.ts"],"sourcesContent":["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\ninterface MapAreaContainerProps {\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 preventMapInteraction?: boolean;\n}\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}: MapAreaContainerProps) {\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 let contextStack = null;\n if (navbar != null || contextPanel != null) {\n contextStack = h(ContextStack, { navbar, ...contextStackProps }, [\n h.if(contextPanelTrans.shouldMount)([contextPanel]),\n ]);\n }\n\n return h(MapStyledContainer, { className: mainUIClassNames }, [\n h(\"div.main-row\", [\n h(\"div.map-ui\", { ...rest }, [\n contextStack,\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"],"names":["hyper","styles","DetailPanelStyle"],"mappings":";;;;;;;;;AAiBA,MAAM,IAAIA,IAAM,OAAOC,GAAM;AAItB,MAAM,YAAY,CAAC,UACxB,EAAE,MAAM,EAAE,GAAG,OAAO,WAAW,WAAW,cAAc,MAAM,SAAS,GAAG;AAOrE,IAAK,qCAAAC,sBAAL;AACLA,oBAAA,OAAA,IAAQ;AACRA,oBAAA,UAAA,IAAW;AAFD,SAAAA;AAAA,GAAA,oBAAA,CAAA,CAAA;AAKL,MAAM,mBAAmB,CAAC,UAC/B,EAAE,cAAc,EAAE,mBAAmB,KAAK,CAAC;AAsB7C,SAAS,kBAAkB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,cAAc;AAAA,EACd;AAAA,EACA,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd;AAAA,EACA,cAAc,EAAE,iBAAiB;AAAA,EACjC,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,wBAAwB;AAAA,EACxB,GAAG;AACL,GAA0B;AACxB,QAAM,mBAAmB,mBAAmB,eAAe;AAC3D,QAAM,oBAAoB,cAAc,kBAAkB,GAAG;AAC7D,QAAM,mBAAmB,cAAc,kBAAkB,GAAG;AAU5D,QAAM,mBAAmB;AAAA,IACvB;AAAA,IACA;AAAA,IACA,gBAAgB,gBAAgB;AAAA,IAChC,iBAAiB,kBAAkB,KAAK;AAAA,IACxC,eAAe,kBAAkB,KAAK;AAAA,IACtC,gBAAgB,iBAAiB,KAAK;AAAA,IACtC,cAAc,iBAAiB,KAAK;AAAA,IACpC;AAAA,MACE,qBAAqB;AAAA,MACrB,oBAAoB;AAAA,MACpB,uBAAuB;AAAA,MACvB,gBAAgB;AAAA,IAAA;AAAA,E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C5C,EAAE,YAAY;AAAA,EAAA,CACf;AACH;AAEA,MAAM,eAAe,CAAC,EAAE,eACtB,EAAE,gBAAgB,EAAE,mBAAmB,QAAQ,CAAC;AAO3C,SAAS,mBAAmB,EAAE,WAAW,YAA+B;AAC7E,QAAM,cAAc,eAAA;AACpB,MAAI,eAAe,MAAM;AACvB,UAAM,EAAE,cAAc,UAAU,YAAA,IAAgB,YAAY,WAAW;AACvE,gBAAY,WAAW,WAAW;AAAA,MAChC,kBAAkB;AAAA,MAClB,oBAAoB;AAAA,MACpB,iBAAiB;AAAA,IAAA,CAClB;AAAA,EACH;AAEA,SAAO,EAAE,OAAO,EAAE,UAAA,GAAa,QAAQ;AACzC;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Spinner, Button, Text, Navbar, Card } from "@blueprintjs/core";
|
|
2
2
|
import h$1 from "@macrostrat/hyper";
|
|
3
|
-
import
|
|
3
|
+
import h$2 from "./main.module.sass.js";
|
|
4
4
|
import { useMapStatus } from "@macrostrat/mapbox-react";
|
|
5
5
|
import { Spacer } from "@macrostrat/ui-components";
|
|
6
|
-
const h = h$1.styled(
|
|
6
|
+
const h = h$1.styled(h$2);
|
|
7
7
|
const spinnerElement = h(Spinner, { size: 16 });
|
|
8
8
|
function LoadingButton({
|
|
9
9
|
isLoading = false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/context-panel/index.ts"],"sourcesContent":["import { 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\";\nimport type { ReactNode } from \"react\";\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 = true,\n icon = \"menu\",\n style,\n}) {\n return h(Button, {\n className: \"loading-button\",\n icon: (isLoading ? spinnerElement : icon) as any,\n large,\n minimal: true,\n onClick,\n active: active && !isLoading,\n style,\n });\n}\n\nexport function MapLoadingButton(props: any) {\n const isLoading = useMapStatus((s) => s.isLoading);\n return h(LoadingButton, { ...props, isLoading });\n}\n\ntype AnyChildren = ReactNode;\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: ReactNode | null = null;\n if (rightElement != null) {\n _rightElement = h(\"div.right-element\", rightElement);\n }\n\n let _headerElement: 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"],"names":["hyper"],"mappings":";;;;;AAOA,MAAM,IAAIA,IAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/context-panel/index.ts"],"sourcesContent":["import { 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\";\nimport type { ReactNode } from \"react\";\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 = true,\n icon = \"menu\",\n style,\n}) {\n return h(Button, {\n className: \"loading-button\",\n icon: (isLoading ? spinnerElement : icon) as any,\n large,\n minimal: true,\n onClick,\n active: active && !isLoading,\n style,\n });\n}\n\nexport function MapLoadingButton(props: any) {\n const isLoading = useMapStatus((s) => s.isLoading);\n return h(LoadingButton, { ...props, isLoading });\n}\n\ntype AnyChildren = ReactNode;\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: ReactNode | null = null;\n if (rightElement != null) {\n _rightElement = h(\"div.right-element\", rightElement);\n }\n\n let _headerElement: 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"],"names":["hyper","styles"],"mappings":";;;;;AAOA,MAAM,IAAIA,IAAM,OAAOC,GAAM;AAE7B,MAAM,iBAAiB,EAAE,SAAS,EAAE,MAAM,IAAI;AAEvC,SAAS,cAAc;AAAA,EAC5B,YAAY;AAAA,EACZ;AAAA,EACA,SAAS;AAAA,EACT,QAAQ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AAAA,MACxB;AAAA,MACA,EAAE,WAAW,gBAAA;AAAA,MACb;AAAA,IAAA;AAAA,EACF,CACD;AACH;"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const h$1 = require("@macrostrat/hyper");
|
|
4
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
5
|
+
const h__default = /* @__PURE__ */ _interopDefault(h$1);
|
|
3
6
|
const searchbar = "_searchbar_n1neb_1";
|
|
4
7
|
const navbar = "_navbar_n1neb_7";
|
|
5
8
|
const styles = {
|
|
@@ -10,7 +13,9 @@ const styles = {
|
|
|
10
13
|
"loading-button": "_loading-button_n1neb_30",
|
|
11
14
|
"status-tongue": "_status-tongue_n1neb_35"
|
|
12
15
|
};
|
|
13
|
-
|
|
16
|
+
let h = h__default.default.styled(styles);
|
|
17
|
+
Object.assign(h, styles);
|
|
18
|
+
exports.default = h;
|
|
14
19
|
exports.navbar = navbar;
|
|
15
20
|
exports.searchbar = searchbar;
|
|
16
21
|
//# sourceMappingURL=main.module.sass.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import h$1 from "@macrostrat/hyper";
|
|
1
2
|
const searchbar = "_searchbar_n1neb_1";
|
|
2
3
|
const navbar = "_navbar_n1neb_7";
|
|
3
4
|
const styles = {
|
|
@@ -8,8 +9,10 @@ const styles = {
|
|
|
8
9
|
"loading-button": "_loading-button_n1neb_30",
|
|
9
10
|
"status-tongue": "_status-tongue_n1neb_35"
|
|
10
11
|
};
|
|
12
|
+
let h = h$1.styled(styles);
|
|
13
|
+
Object.assign(h, styles);
|
|
11
14
|
export {
|
|
12
|
-
|
|
15
|
+
h as default,
|
|
13
16
|
navbar,
|
|
14
17
|
searchbar
|
|
15
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
package/dist/controls.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useRef } from "react";
|
|
2
2
|
import { ScaleControl as ScaleControl$1, GeolocateControl } from "mapbox-gl";
|
|
3
3
|
import h$1 from "@macrostrat/hyper";
|
|
4
|
-
import
|
|
4
|
+
import h$2 from "./main.module.sass.js";
|
|
5
5
|
import { useMapStatus, ThreeDControl, CompassControl, GlobeControl, MapControlWrapper } from "@macrostrat/mapbox-react";
|
|
6
6
|
import { DevToolsButtonSlot } from "@macrostrat/ui-components";
|
|
7
|
-
const h = h$1.styled(
|
|
7
|
+
const h = h$1.styled(h$2);
|
|
8
8
|
function ScaleControl(props) {
|
|
9
9
|
const optionsRef = useRef({
|
|
10
10
|
maxWidth: 200,
|
package/dist/controls.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controls.js","sources":["../src/controls.ts"],"sourcesContent":["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"],"names":["hyper","BaseScaleControl"],"mappings":";;;;;;AAcA,MAAM,IAAIA,IAAM,
|
|
1
|
+
{"version":3,"file":"controls.js","sources":["../src/controls.ts"],"sourcesContent":["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"],"names":["hyper","styles","BaseScaleControl"],"mappings":";;;;;;AAcA,MAAM,IAAIA,IAAM,OAAOC,GAAM;AAE7B,SAAS,aAAa,OAAO;AAC3B,QAAM,aAAa,OAAO;AAAA,IACxB,UAAU;AAAA,IACV,MAAM;AAAA,EAAA,CACP;AACD,SAAO,EAAE,mBAAmB;AAAA,IAC1B,WAAW;AAAA,IACX,SAASC;AAAAA,IACT,SAAS,WAAW;AAAA,IACpB,GAAG;AAAA,EAAA,CACJ;AACH;AAEA,SAAS,mBAAmB,OAAO;AACjC,QAAM,aAAa,OAAO;AAAA,IACxB,oBAAoB;AAAA,IACpB,kBAAkB;AAAA,IAClB,mBAAmB;AAAA,IACnB,iBAAiB;AAAA,MACf,oBAAoB;AAAA,IAAA;AAAA,EACtB,CACD;AACD,SAAO,EAAE,mBAAmB;AAAA,IAC1B,SAAS;AAAA,IACT,SAAS,WAAW;AAAA,IACpB,GAAG;AAAA,EAAA,CACJ;AACH;AAEO,SAAS,kBAAkB,EAAE,YAAY;AAC9C,QAAM,EAAE,cAAA,IAAkB,aAAA;AAE1B,MAAI,CAAC,eAAe;AAClB,WAAO;AAAA,EACT;AAEA,SAAO,EAAE,oBAAoB;AAAA,IAC3B,EAAE,YAAY;AAAA,IACd,EAAE,eAAe,EAAE,WAAW,kBAAkB;AAAA,IAChD,EAAE,gBAAgB,EAAE,WAAW,mBAAmB;AAAA,IAClD,EAAE,cAAc,EAAE,WAAW,iBAAiB;AAAA,IAC9C,EAAE,oBAAoB,EAAE,WAAW,uBAAuB;AAAA;AAAA,IAE1D,EAAE,oBAAoB,EAAE,WAAW,eAAe;AAAA,IAClD;AAAA,EAAA,CACD;AACH;"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const h$1 = require("@macrostrat/hyper");
|
|
4
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
5
|
+
const h__default = /* @__PURE__ */ _interopDefault(h$1);
|
|
3
6
|
const key = "_key_1jzmh_7";
|
|
4
7
|
const value = "_value_1jzmh_18";
|
|
5
8
|
const controls = "_controls_1jzmh_31";
|
|
@@ -21,8 +24,10 @@ const styles = {
|
|
|
21
24
|
page,
|
|
22
25
|
"dev-index-page": "_dev-index-page_1jzmh_82"
|
|
23
26
|
};
|
|
27
|
+
let h = h__default.default.styled(styles);
|
|
28
|
+
Object.assign(h, styles);
|
|
24
29
|
exports.controls = controls;
|
|
25
|
-
exports.default =
|
|
30
|
+
exports.default = h;
|
|
26
31
|
exports.key = key;
|
|
27
32
|
exports.page = page;
|
|
28
33
|
exports.unit = unit;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import h$1 from "@macrostrat/hyper";
|
|
1
2
|
const key = "_key_1jzmh_7";
|
|
2
3
|
const value = "_value_1jzmh_18";
|
|
3
4
|
const controls = "_controls_1jzmh_31";
|
|
@@ -19,9 +20,11 @@ const styles = {
|
|
|
19
20
|
page,
|
|
20
21
|
"dev-index-page": "_dev-index-page_1jzmh_82"
|
|
21
22
|
};
|
|
23
|
+
let h = h$1.styled(styles);
|
|
24
|
+
Object.assign(h, styles);
|
|
22
25
|
export {
|
|
23
26
|
controls,
|
|
24
|
-
|
|
27
|
+
h as default,
|
|
25
28
|
key,
|
|
26
29
|
page,
|
|
27
30
|
unit,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/dev/map-page.js
CHANGED
|
@@ -9,10 +9,10 @@ import { FloatingNavbar, MapLoadingButton } from "../context-panel/index.js";
|
|
|
9
9
|
import { useBasicMapStyle, MapMarker } from "../helpers.js";
|
|
10
10
|
import { LocationPanel } from "../location-panel/index.js";
|
|
11
11
|
import { MapView } from "../map-view.js";
|
|
12
|
-
import
|
|
12
|
+
import h$2 from "./main.module.sass.js";
|
|
13
13
|
import { TileExtentLayer } from "./tile-extent.js";
|
|
14
14
|
import { TileInfo, FeaturePanel, FeatureSelectionHandler } from "./vector-tile-features.js";
|
|
15
|
-
const h = h$1.styled(
|
|
15
|
+
const h = h$1.styled(h$2);
|
|
16
16
|
function MapInspectorV2({
|
|
17
17
|
title = "Map inspector",
|
|
18
18
|
headerElement = null,
|
package/dist/dev/map-page.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-page.js","sources":["../../src/dev/map-page.ts"],"sourcesContent":["// Import other components\nimport { Switch } from \"@blueprintjs/core\";\nimport hyper from \"@macrostrat/hyper\";\nimport { useDarkMode, useStoredState } from \"@macrostrat/ui-components\";\nimport mapboxgl from \"mapbox-gl\";\nimport React from \"react\";\nimport { useCallback, useState, useEffect } from \"react\";\nimport { buildInspectorStyle } from \"./xray\";\nimport { MapAreaContainer, PanelCard } from \"../container\";\nimport { FloatingNavbar, MapLoadingButton } from \"../context-panel\";\nimport { MapMarker, useBasicMapStyle } from \"../helpers\";\nimport { LocationPanel } from \"../location-panel\";\nimport { MapView, MapViewProps } 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\ninterface MapInspectorProps extends MapViewProps {\n headerElement?: React.ReactNode;\n transformRequest?: mapboxgl.RequestTransformFunction;\n title?: string;\n style?: mapboxgl.StyleSpecification | string;\n controls?: React.ReactNode;\n children?: React.ReactNode;\n mapboxToken?: string;\n overlayStyle?: mapboxgl.StyleSpecification | string;\n focusedSource?: string;\n focusedSourceTitle?: string;\n projection?: string;\n mapPosition?: MapPosition;\n bounds?: [number, number, number, number];\n fitViewport?: boolean;\n styleType?: \"standard\" | \"macrostrat\";\n enableTerrain?: boolean;\n}\n\nexport function MapInspectorV2({\n title = \"Map inspector\",\n headerElement = null,\n transformRequest = null,\n mapPosition = null,\n mapboxToken = null,\n overlayStyle = null,\n controls = null,\n children = null,\n style,\n bounds = null,\n focusedSource = null,\n focusedSourceTitle = null,\n fitViewport = true,\n styleType = \"macrostrat\",\n ...rest\n}: MapInspectorProps) {\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 const basicStyle = useBasicMapStyle({ styleType });\n style ??= basicStyle;\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(null);\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 controls,\n h(Switch, {\n checked: xRay,\n label: \"X-ray mode\",\n onChange() {\n setState({ ...state, xRay: !xRay });\n },\n }),\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 bounds,\n ...rest,\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 children,\n ],\n ),\n );\n}\n\nfunction MapInspector(props) {\n const { children, controls, ...rest } = props;\n /** Compatibility wrapper for MapInspectorV2 */\n // React warning about this legacy usage\n console.warn(\"MapInspector is deprecated. Use MapInspectorV2 instead\");\n\n return h(MapInspectorV2, {\n ...rest,\n controls: [children, controls],\n });\n}\n\n// Legacy export\nexport const DevMapPage = MapInspector;\n"],"names":["hyper"],"mappings":";;;;;;;;;;;;;;AAsBO,MAAM,IAAIA,IAAM,
|
|
1
|
+
{"version":3,"file":"map-page.js","sources":["../../src/dev/map-page.ts"],"sourcesContent":["// Import other components\nimport { Switch } from \"@blueprintjs/core\";\nimport hyper from \"@macrostrat/hyper\";\nimport { useDarkMode, useStoredState } from \"@macrostrat/ui-components\";\nimport mapboxgl from \"mapbox-gl\";\nimport React from \"react\";\nimport { useCallback, useState, useEffect } from \"react\";\nimport { buildInspectorStyle } from \"./xray\";\nimport { MapAreaContainer, PanelCard } from \"../container\";\nimport { FloatingNavbar, MapLoadingButton } from \"../context-panel\";\nimport { MapMarker, useBasicMapStyle } from \"../helpers\";\nimport { LocationPanel } from \"../location-panel\";\nimport { MapView, MapViewProps } 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\ninterface MapInspectorProps extends MapViewProps {\n headerElement?: React.ReactNode;\n transformRequest?: mapboxgl.RequestTransformFunction;\n title?: string;\n style?: mapboxgl.StyleSpecification | string;\n controls?: React.ReactNode;\n children?: React.ReactNode;\n mapboxToken?: string;\n overlayStyle?: mapboxgl.StyleSpecification | string;\n focusedSource?: string;\n focusedSourceTitle?: string;\n projection?: string;\n mapPosition?: MapPosition;\n bounds?: [number, number, number, number];\n fitViewport?: boolean;\n styleType?: \"standard\" | \"macrostrat\";\n enableTerrain?: boolean;\n}\n\nexport function MapInspectorV2({\n title = \"Map inspector\",\n headerElement = null,\n transformRequest = null,\n mapPosition = null,\n mapboxToken = null,\n overlayStyle = null,\n controls = null,\n children = null,\n style,\n bounds = null,\n focusedSource = null,\n focusedSourceTitle = null,\n fitViewport = true,\n styleType = \"macrostrat\",\n ...rest\n}: MapInspectorProps) {\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 const basicStyle = useBasicMapStyle({ styleType });\n style ??= basicStyle;\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(null);\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 controls,\n h(Switch, {\n checked: xRay,\n label: \"X-ray mode\",\n onChange() {\n setState({ ...state, xRay: !xRay });\n },\n }),\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 bounds,\n ...rest,\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 children,\n ],\n ),\n );\n}\n\nfunction MapInspector(props) {\n const { children, controls, ...rest } = props;\n /** Compatibility wrapper for MapInspectorV2 */\n // React warning about this legacy usage\n console.warn(\"MapInspector is deprecated. Use MapInspectorV2 instead\");\n\n return h(MapInspectorV2, {\n ...rest,\n controls: [children, controls],\n });\n}\n\n// Legacy export\nexport const DevMapPage = MapInspector;\n"],"names":["hyper","styles"],"mappings":";;;;;;;;;;;;;;AAsBO,MAAM,IAAIA,IAAM,OAAOC,GAAM;AAqB7B,SAAS,eAAe;AAAA,EAC7B,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,cAAc;AAAA,EACd,eAAe;AAAA,EACf,WAAW;AAAA,EACX,WAAW;AAAA,EACX;AAAA,EACA,SAAS;AAAA,EACT,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,EACrB,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,GAAG;AACL,GAAsB;AAQpB,QAAM,OAAO,YAAA;AACb,QAAM,YAAY,MAAM;AAExB,MAAI,eAAe,MAAM;AACvB,aAAS,cAAc;AAAA,EACzB;AAEA,QAAM,aAAa,iBAAiB,EAAE,WAAW;AACjD,YAAU;AAEV,QA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@ const main_module = require("./main.module.sass.cjs");
|
|
|
7
7
|
const React = require("react");
|
|
8
8
|
const uiComponents = require("@macrostrat/ui-components");
|
|
9
9
|
const d3Array = require("d3-array");
|
|
10
|
-
const
|
|
10
|
+
const dataComponents = require("@macrostrat/data-components");
|
|
11
11
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
12
12
|
const h__default = /* @__PURE__ */ _interopDefault(h$1);
|
|
13
13
|
const h = h__default.default.styled(main_module.default);
|
|
@@ -158,7 +158,7 @@ function FeaturePanel({
|
|
|
158
158
|
if (focusedSource != null) {
|
|
159
159
|
title = "Basemap features";
|
|
160
160
|
focusedSourcePanel = h(
|
|
161
|
-
|
|
161
|
+
dataComponents.ExpansionPanel,
|
|
162
162
|
{
|
|
163
163
|
title: focusedSourceTitle ?? "Macrostrat features",
|
|
164
164
|
className: "macrostrat-features",
|
|
@@ -176,7 +176,7 @@ function FeaturePanel({
|
|
|
176
176
|
return h("div.feature-panel", [
|
|
177
177
|
focusedSourcePanel,
|
|
178
178
|
h(
|
|
179
|
-
|
|
179
|
+
dataComponents.ExpansionPanel,
|
|
180
180
|
{ title, className: "basemap-features", expanded: focusedSource == null },
|
|
181
181
|
[
|
|
182
182
|
h(FeatureGroups, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-tile-features.cjs","sources":["../../src/dev/vector-tile-features.ts"],"sourcesContent":["import { Spinner, Switch, Button, Intent } 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 { useCallback, useEffect, useRef, useState } from \"react\";\nimport { JSONView } 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 // Instead of managing hover state with CSS, we use a state variable,\n // so that the button re-renders when the state changes\n const [showControls, setShowControls] = useState(false);\n const onMouseEnter = useCallback(() => setShowControls(true), []);\n const onMouseLeave = useCallback(() => setShowControls(false), []);\n\n return h(\"div.feature-properties\", { onMouseEnter, onMouseLeave }, [\n h.if(showControls)(\"div.controls\", h(CopyJSONButton, { data })),\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\nfunction CopyJSONButton({ data }) {\n const [copied, setCopied] = useState(false);\n return h(Button, {\n icon: copied ? \"tick\" : \"clipboard\",\n intent: copied ? Intent.SUCCESS : Intent.NONE,\n minimal: true,\n small: true,\n onClick() {\n navigator.clipboard.writeText(JSON.stringify(data, null, 2));\n setCopied(true);\n },\n });\n}\n\n/** This component wraps queryRenderedFeatures to get features at a given location */\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((s) => s.isLoading);\n const isInitialized = useMapStatus((s) => s.isInitialized);\n const prevLocation = useRef(null);\n const prevFeatures = useRef([]);\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 if (!isInitialized) return;\n\n const hasPreviouslyLoadedFeatures = prevFeatures.current.length > 0;\n\n const locationMemo = JSON.stringify(selectedLocation);\n if (locationMemo == prevLocation.current && hasPreviouslyLoadedFeatures)\n return;\n\n prevLocation.current = locationMemo;\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 prevFeatures.current = features ?? [];\n setFeatures(features);\n }, [isInitialized, 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: focusedSourceTitle ?? \"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: any) => `${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"],"names":["hyper","styles","useState","useCallback","JSONView","Button","Intent","useMapRef","useMapStatus","useRef","useEffect","isLoaded","Spinner","Switch","ExpansionPanel","group","features"],"mappings":";;;;;;;;;;;;AAUA,MAAM,IAAIA,WAAAA,QAAM,OAAOC,mBAAM;AAEtB,SAAS,kBAAkB,EAAE,MAAM,GAAG,QAAQ;AAGnD,QAAM,CAAC,cAAc,eAAe,IAAIC,MAAAA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AU,CAAC,MAAW,GAAG,EAAE,MAAM,MAAM,EAAE,WAAW,EAAE;AAE3E,SAAO;AAAA,IACL;AAAA,IACA,MAAM,KAAK,MAAM,EAAE,IAAI,CAAC,CAAC,KAAKC,SAAQ,MAAM;AAC1C,aAAO,EAAE,qBAAqB;AAAA,QAC5B,EAAE,eAAe,EAAE,SAASA,UAAS,CAAC,GAAG;AAAA,QACzC,EAAE,UAAU,EAAE,UAAAA,WAAU;AAAA,MAAA,CACzB;AAAA,IACH,CAAC;AAAA,EAAA;AAEL;AAEO,SAAS,SAAS,EAAE,YAAY;AACrC,SAAO;AAAA,IACL;AAAA,IACA,SAAS,IAAI,CAAC,SAAS,MAAM,EAAE,eAAe,EAAE,KAAK,GAAG,SAAS,CAAC;AAAA,EAAA;AAEtE;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"vector-tile-features.cjs","sources":["../../src/dev/vector-tile-features.ts"],"sourcesContent":["import { Spinner, Switch, Button, Intent } 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 { useCallback, useEffect, useRef, useState } from \"react\";\nimport { JSONView } from \"@macrostrat/ui-components\";\nimport { group } from \"d3-array\";\nimport { ExpansionPanel } from \"@macrostrat/data-components\";\n\nconst h = hyper.styled(styles);\n\nexport function FeatureProperties({ data, ...rest }) {\n // Instead of managing hover state with CSS, we use a state variable,\n // so that the button re-renders when the state changes\n const [showControls, setShowControls] = useState(false);\n const onMouseEnter = useCallback(() => setShowControls(true), []);\n const onMouseLeave = useCallback(() => setShowControls(false), []);\n\n return h(\"div.feature-properties\", { onMouseEnter, onMouseLeave }, [\n h.if(showControls)(\"div.controls\", h(CopyJSONButton, { data })),\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\nfunction CopyJSONButton({ data }) {\n const [copied, setCopied] = useState(false);\n return h(Button, {\n icon: copied ? \"tick\" : \"clipboard\",\n intent: copied ? Intent.SUCCESS : Intent.NONE,\n minimal: true,\n small: true,\n onClick() {\n navigator.clipboard.writeText(JSON.stringify(data, null, 2));\n setCopied(true);\n },\n });\n}\n\n/** This component wraps queryRenderedFeatures to get features at a given location */\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((s) => s.isLoading);\n const isInitialized = useMapStatus((s) => s.isInitialized);\n const prevLocation = useRef(null);\n const prevFeatures = useRef([]);\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 if (!isInitialized) return;\n\n const hasPreviouslyLoadedFeatures = prevFeatures.current.length > 0;\n\n const locationMemo = JSON.stringify(selectedLocation);\n if (locationMemo == prevLocation.current && hasPreviouslyLoadedFeatures)\n return;\n\n prevLocation.current = locationMemo;\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 prevFeatures.current = features ?? [];\n setFeatures(features);\n }, [isInitialized, 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: focusedSourceTitle ?? \"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: any) => `${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"],"names":["hyper","styles","useState","useCallback","JSONView","Button","Intent","useMapRef","useMapStatus","useRef","useEffect","isLoaded","Spinner","Switch","ExpansionPanel","group","features"],"mappings":";;;;;;;;;;;;AAUA,MAAM,IAAIA,WAAAA,QAAM,OAAOC,mBAAM;AAEtB,SAAS,kBAAkB,EAAE,MAAM,GAAG,QAAQ;AAGnD,QAAM,CAAC,cAAc,eAAe,IAAIC,MAAAA,SAAS,KAAK;AACtD,QAAM,eAAeC,MAAAA,YAAY,MAAM,gBAAgB,IAAI,GAAG,CAAA,CAAE;AAChE,QAAM,eAAeA,MAAAA,YAAY,MAAM,gBAAgB,KAAK,GAAG,CAAA,CAAE;AAEjE,SAAO,EAAE,0BAA0B,EAAE,cAAc,gBAAgB;AAAA,IACjE,EAAE,GAAG,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,KAAA,CAAM,CAAC;AAAA,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,CACzB;AAAA,IACH,CAAC;AAAA,EAAA;AAEL;AAEO,SAAS,SAAS,EAAE,YAAY;AACrC,SAAO;AAAA,IACL;AAAA,IACA,SAAS,IAAI,CAAC,SAAS,MAAM,EAAE,eAAe,EAAE,KAAK,GAAG,SAAS,CAAC;AAAA,EAAA;AAEtE;;;;;;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Switch, Spinner, Button, Intent } from "@blueprintjs/core";
|
|
2
2
|
import { useMapRef, useMapStatus } from "@macrostrat/mapbox-react";
|
|
3
3
|
import h$1 from "@macrostrat/hyper";
|
|
4
|
-
import
|
|
4
|
+
import h$2 from "./main.module.sass.js";
|
|
5
5
|
import { useState, useCallback, useRef, useEffect } from "react";
|
|
6
6
|
import { JSONView } from "@macrostrat/ui-components";
|
|
7
7
|
import { group } from "d3-array";
|
|
8
|
-
import { ExpansionPanel } from "
|
|
9
|
-
const h = h$1.styled(
|
|
8
|
+
import { ExpansionPanel } from "@macrostrat/data-components";
|
|
9
|
+
const h = h$1.styled(h$2);
|
|
10
10
|
function FeatureProperties({ data, ...rest }) {
|
|
11
11
|
const [showControls, setShowControls] = useState(false);
|
|
12
12
|
const onMouseEnter = useCallback(() => setShowControls(true), []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-tile-features.js","sources":["../../src/dev/vector-tile-features.ts"],"sourcesContent":["import { Spinner, Switch, Button, Intent } 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 { useCallback, useEffect, useRef, useState } from \"react\";\nimport { JSONView } 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 // Instead of managing hover state with CSS, we use a state variable,\n // so that the button re-renders when the state changes\n const [showControls, setShowControls] = useState(false);\n const onMouseEnter = useCallback(() => setShowControls(true), []);\n const onMouseLeave = useCallback(() => setShowControls(false), []);\n\n return h(\"div.feature-properties\", { onMouseEnter, onMouseLeave }, [\n h.if(showControls)(\"div.controls\", h(CopyJSONButton, { data })),\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\nfunction CopyJSONButton({ data }) {\n const [copied, setCopied] = useState(false);\n return h(Button, {\n icon: copied ? \"tick\" : \"clipboard\",\n intent: copied ? Intent.SUCCESS : Intent.NONE,\n minimal: true,\n small: true,\n onClick() {\n navigator.clipboard.writeText(JSON.stringify(data, null, 2));\n setCopied(true);\n },\n });\n}\n\n/** This component wraps queryRenderedFeatures to get features at a given location */\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((s) => s.isLoading);\n const isInitialized = useMapStatus((s) => s.isInitialized);\n const prevLocation = useRef(null);\n const prevFeatures = useRef([]);\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 if (!isInitialized) return;\n\n const hasPreviouslyLoadedFeatures = prevFeatures.current.length > 0;\n\n const locationMemo = JSON.stringify(selectedLocation);\n if (locationMemo == prevLocation.current && hasPreviouslyLoadedFeatures)\n return;\n\n prevLocation.current = locationMemo;\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 prevFeatures.current = features ?? [];\n setFeatures(features);\n }, [isInitialized, 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: focusedSourceTitle ?? \"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: any) => `${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"],"names":["hyper","isLoaded","features"],"mappings":";;;;;;;;AAUA,MAAM,IAAIA,IAAM,OAAO,MAAM;AAEtB,SAAS,kBAAkB,EAAE,MAAM,GAAG,QAAQ;AAGnD,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,KAAK;AACtD,QAAM,eAAe,YAAY,MAAM,gBAAgB,IAAI,GAAG,CAAA,CAAE;AAChE,QAAM,eAAe,YAAY,MAAM,gBAAgB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AAA,MAAA,CACzB;AAAA,IACH,CAAC;AAAA,EAAA;AAEL;AAEO,SAAS,SAAS,EAAE,YAAY;AACrC,SAAO;AAAA,IACL;AAAA,IACA,SAAS,IAAI,CAAC,SAAS,MAAM,EAAE,eAAe,EAAE,KAAK,GAAG,SAAS,CAAC;AAAA,EAAA;AAEtE;"}
|
|
1
|
+
{"version":3,"file":"vector-tile-features.js","sources":["../../src/dev/vector-tile-features.ts"],"sourcesContent":["import { Spinner, Switch, Button, Intent } 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 { useCallback, useEffect, useRef, useState } from \"react\";\nimport { JSONView } from \"@macrostrat/ui-components\";\nimport { group } from \"d3-array\";\nimport { ExpansionPanel } from \"@macrostrat/data-components\";\n\nconst h = hyper.styled(styles);\n\nexport function FeatureProperties({ data, ...rest }) {\n // Instead of managing hover state with CSS, we use a state variable,\n // so that the button re-renders when the state changes\n const [showControls, setShowControls] = useState(false);\n const onMouseEnter = useCallback(() => setShowControls(true), []);\n const onMouseLeave = useCallback(() => setShowControls(false), []);\n\n return h(\"div.feature-properties\", { onMouseEnter, onMouseLeave }, [\n h.if(showControls)(\"div.controls\", h(CopyJSONButton, { data })),\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\nfunction CopyJSONButton({ data }) {\n const [copied, setCopied] = useState(false);\n return h(Button, {\n icon: copied ? \"tick\" : \"clipboard\",\n intent: copied ? Intent.SUCCESS : Intent.NONE,\n minimal: true,\n small: true,\n onClick() {\n navigator.clipboard.writeText(JSON.stringify(data, null, 2));\n setCopied(true);\n },\n });\n}\n\n/** This component wraps queryRenderedFeatures to get features at a given location */\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((s) => s.isLoading);\n const isInitialized = useMapStatus((s) => s.isInitialized);\n const prevLocation = useRef(null);\n const prevFeatures = useRef([]);\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 if (!isInitialized) return;\n\n const hasPreviouslyLoadedFeatures = prevFeatures.current.length > 0;\n\n const locationMemo = JSON.stringify(selectedLocation);\n if (locationMemo == prevLocation.current && hasPreviouslyLoadedFeatures)\n return;\n\n prevLocation.current = locationMemo;\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 prevFeatures.current = features ?? [];\n setFeatures(features);\n }, [isInitialized, 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: focusedSourceTitle ?? \"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: any) => `${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"],"names":["hyper","styles","isLoaded","features"],"mappings":";;;;;;;;AAUA,MAAM,IAAIA,IAAM,OAAOC,GAAM;AAEtB,SAAS,kBAAkB,EAAE,MAAM,GAAG,QAAQ;AAGnD,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,KAAK;AACtD,QAAM,eAAe,YAAY,MAAM,gBAAgB,IAAI,GAAG,CAAA,CAAE;AAChE,QAAM,eAAe,YAAY,MAAM,gBAAgB,KAAK,GAAG,CAAA,CAAE;AAEjE,SAAO,EAAE,0BAA0B,EAAE,cAAc,gBAAgB;AAAA,IACjE,EAAE,GAAG,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,KAAA,CAAM,CAAC;AAAA,IAC9D,EAAE,UAAU;AAAA,MACV;AAAA,MACA,UAAU;AAAA,MACV,GAAG;AAAA,IAAA,CACJ;AAAA,EAAA,CACF;AACH;AAEO,SAAS,cAAc,EAAE,WAAW;AACzC,QAAM,QAAQ,QAAQ;AACtB,SAAO,EAAE,sBAAsB;AAAA,IAC7B,EAAE,GAAG,OAAO,KAAK,KAAK,EAAE,SAAS,CAAC,EAAE,mBAAmB,EAAE,MAAM,OAAO;AAAA,EAAA,CACvE;AACH;AAEA,SAAS,eAAe,EAAE,QAAQ;AAChC,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAC1C,SAAO,EAAE,QA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BAAmB,SAAS,OAAO,CAAC,MAAM,EAAE,UAAU,aAAa;AAAA,EACrE;AAEA,SAAO,EAAE,qBAAqB;AAAA,IAC5B;AAAA,IACA;AAAA,MACE;AAAA,MACA,EAAE,OAAO,WAAW,oBAAoB,UAAU,iBAAiB,KAAA;AAAA,MACnE;AAAA,QACE,EAAE,eAAe;AAAA,UACf,UAAU;AAAA,QAAA,CACX;AAAA,MAAA;AAAA,IACH;AAAA,EACF,CACD;AACH;AAEA,SAAS,cAAc,EAAE,YAAY;AAEnC,MAAI,YAAY,KAAM,QAAO;AAE7B,QAAM,SAAS,MAAM,UAAU,CAAC,MAAW,GAAG,EAAE,MAAM,MAAM,EAAE,WAAW,EAAE;AAE3E,SAAO;AAAA,IACL;AAAA,IACA,MAAM,KAAK,MAAM,EAAE,IAAI,CAAC,CAAC,KAAKC,SAAQ,MAAM;AAC1C,aAAO,EAAE,qBAAqB;AAAA,QAC5B,EAAE,eAAe,EAAE,SAASA,UAAS,CAAC,GAAG;AAAA,QACzC,EAAE,UAAU,EAAE,UAAAA,WAAU;AAAA,MAAA,CACzB;AAAA,IACH,CAAC;AAAA,EAAA;AAEL;AAEO,SAAS,SAAS,EAAE,YAAY;AACrC,SAAO;AAAA,IACL;AAAA,IACA,SAAS,IAAI,CAAC,SAAS,MAAM,EAAE,eAAe,EAAE,KAAK,GAAG,SAAS,CAAC;AAAA,EAAA;AAEtE;"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index$
|
|
3
|
+
const index$1 = require("./context-panel/index.cjs");
|
|
4
4
|
const index = require("./location-panel/index.cjs");
|
|
5
5
|
const container = require("./container.cjs");
|
|
6
6
|
const mapView = require("./map-view.cjs");
|
|
7
7
|
const controls = require("./controls.cjs");
|
|
8
8
|
const helpers = require("./helpers.cjs");
|
|
9
9
|
const utils = require("./utils.cjs");
|
|
10
|
-
const index$1 = require("./expansion-panel/index.cjs");
|
|
11
10
|
const hashString = require("./hash-string.cjs");
|
|
12
11
|
const mapPage = require("./dev/map-page.cjs");
|
|
13
12
|
const vectorTileFeatures = require("./dev/vector-tile-features.cjs");
|
|
14
|
-
const index$
|
|
13
|
+
const index$2 = require("./location-details/fossil-collections/index.cjs");
|
|
15
14
|
const macrostratLinked = require("./location-details/macrostrat-linked.cjs");
|
|
16
|
-
const headers = require("./expansion-panel/headers.cjs");
|
|
17
15
|
const physiography = require("./location-details/physiography.cjs");
|
|
18
16
|
const regStrat = require("./location-details/reg-strat.cjs");
|
|
19
17
|
const tileExtent = require("./dev/tile-extent.cjs");
|
|
20
|
-
const index$4 = require("./location-details/xdd-panel/index.cjs");
|
|
21
18
|
const xray = require("./dev/xray.cjs");
|
|
22
|
-
exports.FloatingNavbar = index$
|
|
23
|
-
exports.LoadingButton = index$
|
|
24
|
-
exports.MapLoadingButton = index$
|
|
19
|
+
exports.FloatingNavbar = index$1.FloatingNavbar;
|
|
20
|
+
exports.LoadingButton = index$1.LoadingButton;
|
|
21
|
+
exports.MapLoadingButton = index$1.MapLoadingButton;
|
|
25
22
|
exports.BaseInfoDrawer = index.BaseInfoDrawer;
|
|
26
23
|
exports.DetailsPanel = index.DetailsPanel;
|
|
27
24
|
exports.InfoDrawerContainer = index.InfoDrawerContainer;
|
|
@@ -43,12 +40,6 @@ exports.useBasicMapStyle = helpers.useBasicMapStyle;
|
|
|
43
40
|
exports.useBasicStylePair = helpers.useBasicStylePair;
|
|
44
41
|
exports.getMapPadding = utils.getMapPadding;
|
|
45
42
|
exports.useMapMarker = utils.useMapMarker;
|
|
46
|
-
exports.ExpandableDetailsPanel = index$1.ExpandableDetailsPanel;
|
|
47
|
-
exports.ExpansionBody = index$1.ExpansionBody;
|
|
48
|
-
exports.ExpansionPanel = index$1.ExpansionPanel;
|
|
49
|
-
exports.ExpansionPanelSummary = index$1.ExpansionPanelSummary;
|
|
50
|
-
exports.InfoPanelSection = index$1.InfoPanelSection;
|
|
51
|
-
exports.SubExpansionPanel = index$1.SubExpansionPanel;
|
|
52
43
|
exports.applyMapPositionToHash = hashString.applyMapPositionToHash;
|
|
53
44
|
exports.getMapPositionForHash = hashString.getMapPositionForHash;
|
|
54
45
|
exports.DevMapPage = mapPage.DevMapPage;
|
|
@@ -60,14 +51,11 @@ exports.FeatureRecord = vectorTileFeatures.FeatureRecord;
|
|
|
60
51
|
exports.FeatureSelectionHandler = vectorTileFeatures.FeatureSelectionHandler;
|
|
61
52
|
exports.Features = vectorTileFeatures.Features;
|
|
62
53
|
exports.TileInfo = vectorTileFeatures.TileInfo;
|
|
63
|
-
exports.FossilCollections = index$
|
|
54
|
+
exports.FossilCollections = index$2.FossilCollections;
|
|
64
55
|
exports.MacrostratLinkedData = macrostratLinked.MacrostratLinkedData;
|
|
65
|
-
exports.PanelSubhead = headers.PanelSubhead;
|
|
66
56
|
exports.Physiography = physiography.Physiography;
|
|
67
57
|
exports.RegionalStratigraphy = regStrat.RegionalStratigraphy;
|
|
68
58
|
exports.TileExtentLayer = tileExtent.TileExtentLayer;
|
|
69
|
-
exports.XddExpansion = index$4.XddExpansion;
|
|
70
|
-
exports.xDDPanelCore = index$4.xDDPanelCore;
|
|
71
59
|
exports.buildInspectorStyle = xray.buildInspectorStyle;
|
|
72
60
|
exports.buildXRayStyle = xray.buildXRayStyle;
|
|
73
61
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -5,27 +5,20 @@ import { MapTerrainManager, MapView } from "./map-view.js";
|
|
|
5
5
|
import { MapBottomControls } from "./controls.js";
|
|
6
6
|
import { MapLoadingReporter, MapMarker, MapMovedReporter, MapPaddingManager, MapResizeManager, getBasicMapStyle, useBasicMapStyle, useBasicStylePair } from "./helpers.js";
|
|
7
7
|
import { getMapPadding, useMapMarker } from "./utils.js";
|
|
8
|
-
import { ExpandableDetailsPanel, ExpansionBody, ExpansionPanel, ExpansionPanelSummary, InfoPanelSection, SubExpansionPanel } from "./expansion-panel/index.js";
|
|
9
8
|
import { applyMapPositionToHash, getMapPositionForHash } from "./hash-string.js";
|
|
10
9
|
import { DevMapPage, MapInspectorV2, h } from "./dev/map-page.js";
|
|
11
10
|
import { FeaturePanel, FeatureProperties, FeatureRecord, FeatureSelectionHandler, Features, TileInfo } from "./dev/vector-tile-features.js";
|
|
12
11
|
import { FossilCollections } from "./location-details/fossil-collections/index.js";
|
|
13
12
|
import { MacrostratLinkedData } from "./location-details/macrostrat-linked.js";
|
|
14
|
-
import { PanelSubhead } from "./expansion-panel/headers.js";
|
|
15
13
|
import { Physiography } from "./location-details/physiography.js";
|
|
16
14
|
import { RegionalStratigraphy } from "./location-details/reg-strat.js";
|
|
17
15
|
import { TileExtentLayer } from "./dev/tile-extent.js";
|
|
18
|
-
import { XddExpansion, xDDPanelCore } from "./location-details/xdd-panel/index.js";
|
|
19
16
|
import { buildInspectorStyle, buildXRayStyle } from "./dev/xray.js";
|
|
20
17
|
export {
|
|
21
18
|
BaseInfoDrawer,
|
|
22
19
|
DetailPanelStyle,
|
|
23
20
|
DetailsPanel,
|
|
24
21
|
DevMapPage,
|
|
25
|
-
ExpandableDetailsPanel,
|
|
26
|
-
ExpansionBody,
|
|
27
|
-
ExpansionPanel,
|
|
28
|
-
ExpansionPanelSummary,
|
|
29
22
|
FeaturePanel,
|
|
30
23
|
FeatureProperties,
|
|
31
24
|
FeatureRecord,
|
|
@@ -34,7 +27,6 @@ export {
|
|
|
34
27
|
FloatingNavbar,
|
|
35
28
|
FossilCollections,
|
|
36
29
|
InfoDrawerContainer,
|
|
37
|
-
InfoPanelSection,
|
|
38
30
|
LoadingButton,
|
|
39
31
|
LocationPanel,
|
|
40
32
|
MacrostratLinkedData,
|
|
@@ -51,13 +43,10 @@ export {
|
|
|
51
43
|
MapTerrainManager,
|
|
52
44
|
MapView,
|
|
53
45
|
PanelCard,
|
|
54
|
-
PanelSubhead,
|
|
55
46
|
Physiography,
|
|
56
47
|
RegionalStratigraphy,
|
|
57
|
-
SubExpansionPanel,
|
|
58
48
|
TileExtentLayer,
|
|
59
49
|
TileInfo,
|
|
60
|
-
XddExpansion,
|
|
61
50
|
applyMapPositionToHash,
|
|
62
51
|
buildInspectorStyle,
|
|
63
52
|
buildXRayStyle,
|
|
@@ -67,7 +56,6 @@ export {
|
|
|
67
56
|
h,
|
|
68
57
|
useBasicMapStyle,
|
|
69
58
|
useBasicStylePair,
|
|
70
|
-
useMapMarker
|
|
71
|
-
xDDPanelCore
|
|
59
|
+
useMapMarker
|
|
72
60
|
};
|
|
73
61
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|