@macrostrat/map-interface 2.0.1 → 2.0.2
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 +4 -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.js +2 -2
- package/dist/dev/vector-tile-features.js.map +1 -1
- package/dist/expansion-panel/headers.js +2 -2
- package/dist/expansion-panel/headers.js.map +1 -1
- package/dist/expansion-panel/index.js +2 -2
- package/dist/expansion-panel/index.js.map +1 -1
- package/dist/expansion-panel/main.module.sass.cjs +6 -1
- package/dist/expansion-panel/main.module.sass.cjs.map +1 -1
- package/dist/expansion-panel/main.module.sass.js +4 -1
- package/dist/expansion-panel/main.module.sass.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/info-blocks.js +2 -2
- 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.js +2 -2
- 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-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 +1 -1
- package/dist/map-view.js +2 -2
- package/dist/map-view.js.map +1 -1
- package/package.json +8 -8
- package/src/location-details/location-details.stories.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@ 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.0.2] - 2026-02-06
|
|
8
|
+
|
|
9
|
+
Remove typings that repeat Vite defaults
|
|
10
|
+
|
|
7
11
|
## [2.0.1] - 2026-01-29
|
|
8
12
|
|
|
9
13
|
- 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;A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G,oBAAoB;AAAA;AAAA,UAA2B,CAAC,cAAc,CAAC;AAAA,QACpE,EAAE;AAAA,UAAG,oBAAoB;AAAA;AAAA,QAAA;AAAA,UACvB;AAAA,UACA;AAAA,QAAA;AAAA,MACF,CACD;AAAA,MACD,EAAE;AAAA,QAAG,oBAAoB;AAAA;AAAA,QAAwB,CAAC,cAAc,CAAC;AAAA,IAAA,CAClE;AAAA,IACD,EAAE,cAAc,MAAM,WAAW;AAAA,EAAA,CAClC;AACH;AAEA,SAAS,aAAa,OAA0B;AAC9C,QAAM,EAAE,eAAe,QAAQ,UAAU,GAAG,SAAS;AACrD,QAAM,SAAS,cAAc,MAAM,EAAE,kBAAkB,eAAe;AACtE,SAAO,EAAE,qBAAqB,QAAQ;AAAA,IACpC;AAAA,IACA,EAAE,4BAA4B,MAAM,QAAQ;AAAA,IAC5C,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;AAAA,EACR,OAAO;AAAA,EACP;AACF,GAAG;AACD,SAAO,EAAE,QAAQ;AAAA,IACf,WAAW;AAAA,IACX,MAAO,YAAY,iBAAiB;AAAA,IACpC;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA,QAAQ,UAAU,CAAC;AAAA,IACnB;AAAA,EAAA,CACD;AACH;AAEO,SAAS,iBAAiB,OAAY;AAC3C,QAAM,YAAY,aAAa,CAAC,MAAM,EAAE,SAAS;AACjD,SAAO,EAAE,eAAe,EAAE,GAAG,OAAO,WAAW;AACjD;AAgBO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA,QAAQ,CAAA;AACV,GAAwB;AACtB,MAAI,gBAAkC;AACtC,MAAI,gBAAgB,MAAM;AACxB,oBAAgB,EAAE,qBAAqB,YAAY;AAAA,EACrD;AAEA,MAAI,iBAAmC;AACvC,MAAI,SAAS,QAAQ,kBAAkB,MAAM;AAC3C,QAAI,OAAO,UAAU,UAAU;AAC7B,uBAAiB,EAAE,MAAM,EAAE,SAAS,MAAM,WAAW,KAAA,GAAQ,KAAK;AAAA,IACpE,OAAO;AACL,uBAAiB;AAAA,IACnB;AAAA,EACF;AAEA,MAAI,kBAAkB,MAAM;AAC1B,qBAAiB,EAAE,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAAA,EAChD;AAEA,SAAO,EAAE,wBAAwB,EAAE,WAAW,OAAO,EAAE,MAAA,KAAW;AAAA,IAChE,EAAE,qBAAqB;AAAA,MACrB;AAAA,QACE;AAAA,QACA;AAAA,UACE,WAAW;AAAA,UACX,OAAO,EAAE,QAAQ,GAAG,MAAA;AAAA,QAAM;AAAA,QAE5B,CAAC,gBAAgB,UAAU,aAAa;AAAA,MAAA;AAAA,IAC1C,CACD;AAAA,IACD,EAAE,GAAG,iBAAiB,IAAI;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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AAAA,MAEL;AAAA,QACE,EAAE,yBAAyB;AAAA,UACzB,kBAAkB;AAAA,UAClB,aAAa;AAAA,QAAA,CACd;AAAA,QACD,EAAE,WAAW;AAAA,UACX,UAAU;AAAA,UACV,aAAa;AAAA,QAAA,CACd;AAAA,QACD,EAAE,iBAAiB,EAAE,MAAM,OAAO,YAAY,UAAU,SAAS;AAAA,QACjE;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAEJ;AAEA,SAAS,aAAa,OAAO;AAC3B,QAAM,EAAE,UAAU,UAAU,GAAG,SAAS;AAGxC,UAAQ,KAAK,wDAAwD;AAErE,SAAO,EAAE,gBAAgB;AAAA,IACvB,GAAG;AAAA,IACH,UAAU,CAAC,UAAU,QAAQ;AAAA,EAAA,CAC9B;AACH;AAGO,MAAM,aAAa;"}
|
|
@@ -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
8
|
import { ExpansionPanel } from "../expansion-panel/index.js";
|
|
9
|
-
const h = h$1.styled(
|
|
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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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.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","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,QA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1.styled(
|
|
2
|
+
import h$2 from "./main.module.sass.js";
|
|
3
|
+
const h = h$1.styled(h$2);
|
|
4
4
|
function PanelSubhead(props) {
|
|
5
5
|
const { title, component = "h3", children, ...rest } = props;
|
|
6
6
|
return h("div.panel-subhead", rest, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headers.js","sources":["../../src/expansion-panel/headers.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\n\nconst h = hyper.styled(styles);\n\nexport function PanelSubhead(props) {\n const { title, component = \"h3\", children, ...rest } = props;\n return h(\"div.panel-subhead\", rest, [\n h(\n component,\n {\n className: \"title\",\n },\n title,\n ),\n children,\n ]);\n}\n"],"names":["hyper"],"mappings":";;AAGA,MAAM,IAAIA,IAAM,
|
|
1
|
+
{"version":3,"file":"headers.js","sources":["../../src/expansion-panel/headers.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\n\nconst h = hyper.styled(styles);\n\nexport function PanelSubhead(props) {\n const { title, component = \"h3\", children, ...rest } = props;\n return h(\"div.panel-subhead\", rest, [\n h(\n component,\n {\n className: \"title\",\n },\n title,\n ),\n children,\n ]);\n}\n"],"names":["hyper","styles"],"mappings":";;AAGA,MAAM,IAAIA,IAAM,OAAOC,GAAM;AAEtB,SAAS,aAAa,OAAO;AAClC,QAAM,EAAE,OAAO,YAAY,MAAM,UAAU,GAAG,SAAS;AACvD,SAAO,EAAE,qBAAqB,MAAM;AAAA,IAClC;AAAA,MACE;AAAA,MACA;AAAA,QACE,WAAW;AAAA,MAAA;AAAA,MAEb;AAAA,IAAA;AAAA,IAEF;AAAA,EAAA,CACD;AACH;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import { Button, Collapse, Icon } from "@blueprintjs/core";
|
|
3
3
|
import h$1 from "@macrostrat/hyper";
|
|
4
|
-
import
|
|
4
|
+
import h$2 from "./main.module.sass.js";
|
|
5
5
|
import classNames from "classnames";
|
|
6
6
|
import { PanelSubhead } from "./headers.js";
|
|
7
|
-
const h = h$1.styled(
|
|
7
|
+
const h = h$1.styled(h$2);
|
|
8
8
|
function ExpansionPanelSummary(props) {
|
|
9
9
|
const { expanded, children, onChange, className, title, titleComponent } = props;
|
|
10
10
|
const icon = expanded ? "chevron-up" : "chevron-down";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/expansion-panel/index.ts"],"sourcesContent":["import { useState } from \"react\";\nimport { Collapse, Icon } from \"@blueprintjs/core\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport classNames from \"classnames\";\nimport { Button } from \"@blueprintjs/core\";\nimport { PanelSubhead } from \"./headers\";\n\nconst h = hyper.styled(styles);\n\nfunction ExpansionPanelSummary(props) {\n const { expanded, children, onChange, className, title, titleComponent } =\n props;\n const icon = expanded ? \"chevron-up\" : \"chevron-down\";\n return h(\n PanelSubhead,\n {\n className: classNames(\"expansion-panel-header\", className),\n onClick: onChange,\n title,\n component: titleComponent,\n },\n [children, h(Icon, { icon, className: \"expansion-panel-icon\" })],\n );\n}\n\nfunction ExpansionPanelBase(props) {\n let {\n title,\n titleComponent = \"h3\",\n children,\n expanded,\n helpText,\n onChange = () => {},\n sideComponent = null,\n className,\n } = props;\n const [isOpen, setOpen] = useState(expanded || false);\n\n const onChange_ = () => {\n onChange();\n setOpen(!isOpen);\n };\n\n return h(\n \"div.expansion-panel-base\",\n {\n className: classNames(className, {\n expanded: isOpen,\n collapsed: !isOpen,\n }),\n },\n [\n h(\n ExpansionPanelSummary,\n {\n onChange: onChange_,\n expanded: isOpen,\n title,\n titleComponent,\n },\n h(\"div.expansion-summary-title-help\", [\n h(\"span.expansion-panel-subtext\", helpText),\n \" \",\n sideComponent,\n ]),\n ),\n h(Collapse, { isOpen }, h(\"div.expansion-children\", null, children)),\n ],\n );\n}\n\nexport function InfoPanelSection(props) {\n let { title, children, className, headerElement = null } = props;\n return h(\"div.info-panel-section\", { className }, [\n h(\"div.panel-subhead\", null, headerElement ?? h(\"h3\", title)),\n h(\"div.panel-content\", null, children),\n ]);\n}\n\nfunction ExpansionPanel(props) {\n return h(ExpansionPanelBase, {\n ...props,\n className: \"expansion-panel\",\n });\n}\n\nfunction SubExpansionPanel(props) {\n return h(ExpansionPanelBase, {\n ...props,\n className: \"expansion-panel sub-expansion-panel\",\n titleComponent: \"h4\",\n });\n}\n\nfunction ExpandableDetailsPanel(props) {\n let { title, children, value, headerElement, className } = props;\n const [isOpen, setIsOpen] = useState(false);\n headerElement ??= h([h(\"div.title\", title), value]);\n return h(\"div.expandable-details\", { className }, [\n h(\"div.expandable-details-main\", [\n h(\"div.expandable-details-header\", headerElement),\n h(\"div.expandable-details-toggle\", [\n h(Button, {\n small: true,\n minimal: true,\n active: isOpen,\n onClick: () => setIsOpen(!isOpen),\n icon: \"more\",\n }),\n ]),\n ]),\n h(\n Collapse,\n { isOpen },\n h(\"div.expandable-details-children\", null, children),\n ),\n ]);\n}\n\nfunction ExpansionBody({ title, className, children }) {\n return h(\"div.expansion-body\", { className }, [\n h(\"div.expansion-panel-detail-header\", title),\n h(\"div.expansion-panel-detail-body\", null, children),\n ]);\n}\n\nexport {\n ExpansionPanel,\n ExpansionPanelSummary,\n ExpandableDetailsPanel,\n SubExpansionPanel,\n ExpansionBody,\n PanelSubhead,\n};\n"],"names":["hyper"],"mappings":";;;;;;AAQA,MAAM,IAAIA,IAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/expansion-panel/index.ts"],"sourcesContent":["import { useState } from \"react\";\nimport { Collapse, Icon } from \"@blueprintjs/core\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport classNames from \"classnames\";\nimport { Button } from \"@blueprintjs/core\";\nimport { PanelSubhead } from \"./headers\";\n\nconst h = hyper.styled(styles);\n\nfunction ExpansionPanelSummary(props) {\n const { expanded, children, onChange, className, title, titleComponent } =\n props;\n const icon = expanded ? \"chevron-up\" : \"chevron-down\";\n return h(\n PanelSubhead,\n {\n className: classNames(\"expansion-panel-header\", className),\n onClick: onChange,\n title,\n component: titleComponent,\n },\n [children, h(Icon, { icon, className: \"expansion-panel-icon\" })],\n );\n}\n\nfunction ExpansionPanelBase(props) {\n let {\n title,\n titleComponent = \"h3\",\n children,\n expanded,\n helpText,\n onChange = () => {},\n sideComponent = null,\n className,\n } = props;\n const [isOpen, setOpen] = useState(expanded || false);\n\n const onChange_ = () => {\n onChange();\n setOpen(!isOpen);\n };\n\n return h(\n \"div.expansion-panel-base\",\n {\n className: classNames(className, {\n expanded: isOpen,\n collapsed: !isOpen,\n }),\n },\n [\n h(\n ExpansionPanelSummary,\n {\n onChange: onChange_,\n expanded: isOpen,\n title,\n titleComponent,\n },\n h(\"div.expansion-summary-title-help\", [\n h(\"span.expansion-panel-subtext\", helpText),\n \" \",\n sideComponent,\n ]),\n ),\n h(Collapse, { isOpen }, h(\"div.expansion-children\", null, children)),\n ],\n );\n}\n\nexport function InfoPanelSection(props) {\n let { title, children, className, headerElement = null } = props;\n return h(\"div.info-panel-section\", { className }, [\n h(\"div.panel-subhead\", null, headerElement ?? h(\"h3\", title)),\n h(\"div.panel-content\", null, children),\n ]);\n}\n\nfunction ExpansionPanel(props) {\n return h(ExpansionPanelBase, {\n ...props,\n className: \"expansion-panel\",\n });\n}\n\nfunction SubExpansionPanel(props) {\n return h(ExpansionPanelBase, {\n ...props,\n className: \"expansion-panel sub-expansion-panel\",\n titleComponent: \"h4\",\n });\n}\n\nfunction ExpandableDetailsPanel(props) {\n let { title, children, value, headerElement, className } = props;\n const [isOpen, setIsOpen] = useState(false);\n headerElement ??= h([h(\"div.title\", title), value]);\n return h(\"div.expandable-details\", { className }, [\n h(\"div.expandable-details-main\", [\n h(\"div.expandable-details-header\", headerElement),\n h(\"div.expandable-details-toggle\", [\n h(Button, {\n small: true,\n minimal: true,\n active: isOpen,\n onClick: () => setIsOpen(!isOpen),\n icon: \"more\",\n }),\n ]),\n ]),\n h(\n Collapse,\n { isOpen },\n h(\"div.expandable-details-children\", null, children),\n ),\n ]);\n}\n\nfunction ExpansionBody({ title, className, children }) {\n return h(\"div.expansion-body\", { className }, [\n h(\"div.expansion-panel-detail-header\", title),\n h(\"div.expansion-panel-detail-body\", null, children),\n ]);\n}\n\nexport {\n ExpansionPanel,\n ExpansionPanelSummary,\n ExpandableDetailsPanel,\n SubExpansionPanel,\n ExpansionBody,\n PanelSubhead,\n};\n"],"names":["hyper","styles"],"mappings":";;;;;;AAQA,MAAM,IAAIA,IAAM,OAAOC,GAAM;AAE7B,SAAS,sBAAsB,OAAO;AACpC,QAAM,EAAE,UAAU,UAAU,UAAU,WAAW,OAAO,mBACtD;AACF,QAAM,OAAO,WAAW,eAAe;AACvC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,WAAW,WAAW,0BAA0B,SAAS;AAAA,MACzD,SAAS;AAAA,MACT;AAAA,MACA,WAAW;AAAA,IAAA;AAAA,IAEb,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,wBAAwB,CAAC;AAAA,EAAA;AAEnE;AAEA,SAAS,mBAAmB,OAAO;AACjC,MAAI;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,MAAM;AAAA,IAAC;AAAA,IAClB,gBAAgB;AAAA,IAChB;AAAA,EAAA,IACE;AACJ,QAAM,CAAC,QAAQ,OAAO,IAAI,SAAS,YAAY,KAAK;AAEpD,QAAM,YAAY,MAAM;AACtB,aAAA;AACA,YAAQ,CAAC,MAAM;AAAA,EACjB;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,WAAW,WAAW,WAAW;AAAA,QAC/B,UAAU;AAAA,QACV,WAAW,CAAC;AAAA,MAAA,CACb;AAAA,IAAA;AAAA,IAEH;AAAA,MACE;AAAA,QACE;AAAA,QACA;AAAA,UACE,UA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A,MAAA,CACF;AAAA,IAAA,CACF;AAAA,IACD;AAAA,MACE;AAAA,MACA,EAAE,OAAA;AAAA,MACF,EAAE,mCAAmC,MAAM,QAAQ;AAAA,IAAA;AAAA,EACrD,CACD;AACH;AAEA,SAAS,cAAc,EAAE,OAAO,WAAW,YAAY;AACrD,SAAO,EAAE,sBAAsB,EAAE,aAAa;AAAA,IAC5C,EAAE,qCAAqC,KAAK;AAAA,IAC5C,EAAE,mCAAmC,MAAM,QAAQ;AAAA,EAAA,CACpD;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 title = "_title_1phba_23";
|
|
4
7
|
const styles = {
|
|
5
8
|
"panel-subhead": "_panel-subhead_1phba_1",
|
|
@@ -22,6 +25,8 @@ const styles = {
|
|
|
22
25
|
"expansion-panel-detail-header": "_expansion-panel-detail-header_1phba_160",
|
|
23
26
|
"expansion-panel-detail-body": "_expansion-panel-detail-body_1phba_171"
|
|
24
27
|
};
|
|
25
|
-
|
|
28
|
+
let h = h__default.default.styled(styles);
|
|
29
|
+
Object.assign(h, styles);
|
|
30
|
+
exports.default = h;
|
|
26
31
|
exports.title = title;
|
|
27
32
|
//# 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 title = "_title_1phba_23";
|
|
2
3
|
const styles = {
|
|
3
4
|
"panel-subhead": "_panel-subhead_1phba_1",
|
|
@@ -20,8 +21,10 @@ const styles = {
|
|
|
20
21
|
"expansion-panel-detail-header": "_expansion-panel-detail-header_1phba_160",
|
|
21
22
|
"expansion-panel-detail-body": "_expansion-panel-detail-body_1phba_171"
|
|
22
23
|
};
|
|
24
|
+
let h = h$1.styled(styles);
|
|
25
|
+
Object.assign(h, styles);
|
|
23
26
|
export {
|
|
24
|
-
|
|
27
|
+
h as default,
|
|
25
28
|
title
|
|
26
29
|
};
|
|
27
30
|
//# sourceMappingURL=main.module.sass.js.map
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Tabs, Tab } from "@blueprintjs/core";
|
|
3
3
|
import h$1 from "@macrostrat/hyper";
|
|
4
|
-
import
|
|
4
|
+
import h$2 from "./main.module.sass.js";
|
|
5
5
|
import { makeOccurrenceTree } from "../utils/fossils.js";
|
|
6
|
-
const h = h$1.styled(
|
|
6
|
+
const h = h$1.styled(h$2);
|
|
7
7
|
function PBDBCollections({ data }) {
|
|
8
8
|
if (data == null) return null;
|
|
9
9
|
return h(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.js","sources":["../../../src/location-details/fossil-collections/collections.tsx"],"sourcesContent":["import React from \"react\";\nimport { Tabs, Tab } from \"@blueprintjs/core\";\nimport { makeOccurrenceTree } from \"../utils\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nconst h = hyper.styled(styles);\n\nexport default function PBDBCollections({ data }) {\n if (data == null) return null;\n return h(\n \"div.collections\",\n data.map((col, ix) => h(FossilCollection, { key: ix, col })),\n );\n}\n\nfunction FossilCollection({ col }) {\n let occurrenceTree = makeOccurrenceTree(col.occurrences);\n return h(\n \"div.fossil-collection\",\n <>\n <Header col={col} />\n <Tabs>\n <Tab title=\"Info\" panel={<InfoPanel col={col} />} id=\"info\" />\n <Tab\n id=\"occ\"\n title={`Occurrences (${col.occurrences.length})`}\n disabled={col.occurrences.length == 0}\n panel={<OccurencesPanel occurrenceTree={occurrenceTree} />}\n />\n </Tabs>\n </>,\n );\n}\n\nfunction CollectionNumber({ col }) {\n const num = col.oid.replace(\"col:\", \"\");\n return h(\"div.collection-number\", [\n h(\"span.collection-number-prefix\", \"#\"),\n h(\n \"a\",\n {\n href: `https://paleobiodb.org/classic/basicCollectionSearch?collection_no=${num}`,\n target: \"_blank\",\n },\n num,\n ),\n ]);\n}\n\nfunction Header({ col }) {\n return h(\"div.pbdb-panel-header\", [\n h.if(col.nam)(\"h4\", {}, col.nam),\n h.if(col.oid)(CollectionNumber, { col }),\n ]);\n}\n\nfunction InfoPanel(props) {\n const { col } = props;\n\n return (\n <div>\n {col.oei && (\n <div className=\"map-source-attr\">\n <span className=\"attr\">Age: </span> {col.oei} ({col.lag} - {col.lag}\n <span className=\"age-chip-ma\">Ma</span>)\n </div>\n )}\n {col.sgr && (\n <div className=\"map-source-attr\">\n <span className=\"attr\">Group: </span> {col.sgr}\n </div>\n )}\n {col.sfm && (\n <div className=\"map-source-attr\">\n <span className=\"attr\">Formation: </span> {col.sfm}\n </div>\n )}\n {col.lt1 && (\n <div className=\"map-source-attr\">\n <span className=\"attr\">Lithology: </span> {col.la1 ? col.la1 : \"\"}{\" \"}\n {col.lf1 ? col.lf1 : \"\"} {col.lt1.replace('\"', \"\")}{\" \"}\n {col.lt2 ? \", \" : \"\"}\n {col.la2 ? col.la2 : \"\"} {col.lf2 ? col.lf2 : \"\"} {col.lt2}\n </div>\n )}\n {col.env && (\n <div className=\"map-source-attr\">\n <span className=\"attr\">Environment: </span> {col.env}\n </div>\n )}\n {col.ref && (\n <div className=\"reference map-source-attr\">\n <span className=\"attr\">Reference: </span>{\" \"}\n <span dangerouslySetInnerHTML={{ __html: col.ref }}></span>\n </div>\n )}\n </div>\n );\n}\n\nfunction OccurencesPanel(props) {\n const { occurrenceTree } = props;\n\n return (\n <div>\n <ul className=\"taxon-list phylum-list\">\n {occurrenceTree.phyla.map((phylum, pidx) => {\n return (\n <div key={pidx} className=\"phyla\">\n <li>{phylum.phylum}</li>\n <ul className=\"taxon-list\">\n {phylum.classes.map((cls, clsidx) => {\n return (\n <div key={clsidx} className=\"classes\">\n <li>{cls.nameClass}</li>\n <ul className=\"taxon-list\">\n {cls.families.map((family, familyidx) => {\n return (\n <div key={familyidx} className=\"families\">\n <li>{family.family}</li>\n <ul className=\"taxon-list genera\">\n {family.genera.map((genus, genusidx) => {\n return (\n <li key={genusidx}>\n {genus.old_name\n ? '\"' + genus.old_name + '\" - '\n : \"\"}\n {genus.genusRes ? genus.genusRes : \" \"}\n {genus.display_name1}\n <i>\n {genus.display_name2\n ? genus.display_name2\n : \"\"}\n {genus.display_name3\n ? genus.display_name3\n : \"\"}\n </i>\n </li>\n );\n })}\n </ul>\n </div>\n );\n })}\n </ul>\n </div>\n );\n })}\n </ul>\n </div>\n );\n })}\n </ul>\n </div>\n );\n}\n"],"names":["hyper"],"mappings":";;;;;AAKA,MAAM,IAAIA,IAAM,
|
|
1
|
+
{"version":3,"file":"collections.js","sources":["../../../src/location-details/fossil-collections/collections.tsx"],"sourcesContent":["import React from \"react\";\nimport { Tabs, Tab } from \"@blueprintjs/core\";\nimport { makeOccurrenceTree } from \"../utils\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nconst h = hyper.styled(styles);\n\nexport default function PBDBCollections({ data }) {\n if (data == null) return null;\n return h(\n \"div.collections\",\n data.map((col, ix) => h(FossilCollection, { key: ix, col })),\n );\n}\n\nfunction FossilCollection({ col }) {\n let occurrenceTree = makeOccurrenceTree(col.occurrences);\n return h(\n \"div.fossil-collection\",\n <>\n <Header col={col} />\n <Tabs>\n <Tab title=\"Info\" panel={<InfoPanel col={col} />} id=\"info\" />\n <Tab\n id=\"occ\"\n title={`Occurrences (${col.occurrences.length})`}\n disabled={col.occurrences.length == 0}\n panel={<OccurencesPanel occurrenceTree={occurrenceTree} />}\n />\n </Tabs>\n </>,\n );\n}\n\nfunction CollectionNumber({ col }) {\n const num = col.oid.replace(\"col:\", \"\");\n return h(\"div.collection-number\", [\n h(\"span.collection-number-prefix\", \"#\"),\n h(\n \"a\",\n {\n href: `https://paleobiodb.org/classic/basicCollectionSearch?collection_no=${num}`,\n target: \"_blank\",\n },\n num,\n ),\n ]);\n}\n\nfunction Header({ col }) {\n return h(\"div.pbdb-panel-header\", [\n h.if(col.nam)(\"h4\", {}, col.nam),\n h.if(col.oid)(CollectionNumber, { col }),\n ]);\n}\n\nfunction InfoPanel(props) {\n const { col } = props;\n\n return (\n <div>\n {col.oei && (\n <div className=\"map-source-attr\">\n <span className=\"attr\">Age: </span> {col.oei} ({col.lag} - {col.lag}\n <span className=\"age-chip-ma\">Ma</span>)\n </div>\n )}\n {col.sgr && (\n <div className=\"map-source-attr\">\n <span className=\"attr\">Group: </span> {col.sgr}\n </div>\n )}\n {col.sfm && (\n <div className=\"map-source-attr\">\n <span className=\"attr\">Formation: </span> {col.sfm}\n </div>\n )}\n {col.lt1 && (\n <div className=\"map-source-attr\">\n <span className=\"attr\">Lithology: </span> {col.la1 ? col.la1 : \"\"}{\" \"}\n {col.lf1 ? col.lf1 : \"\"} {col.lt1.replace('\"', \"\")}{\" \"}\n {col.lt2 ? \", \" : \"\"}\n {col.la2 ? col.la2 : \"\"} {col.lf2 ? col.lf2 : \"\"} {col.lt2}\n </div>\n )}\n {col.env && (\n <div className=\"map-source-attr\">\n <span className=\"attr\">Environment: </span> {col.env}\n </div>\n )}\n {col.ref && (\n <div className=\"reference map-source-attr\">\n <span className=\"attr\">Reference: </span>{\" \"}\n <span dangerouslySetInnerHTML={{ __html: col.ref }}></span>\n </div>\n )}\n </div>\n );\n}\n\nfunction OccurencesPanel(props) {\n const { occurrenceTree } = props;\n\n return (\n <div>\n <ul className=\"taxon-list phylum-list\">\n {occurrenceTree.phyla.map((phylum, pidx) => {\n return (\n <div key={pidx} className=\"phyla\">\n <li>{phylum.phylum}</li>\n <ul className=\"taxon-list\">\n {phylum.classes.map((cls, clsidx) => {\n return (\n <div key={clsidx} className=\"classes\">\n <li>{cls.nameClass}</li>\n <ul className=\"taxon-list\">\n {cls.families.map((family, familyidx) => {\n return (\n <div key={familyidx} className=\"families\">\n <li>{family.family}</li>\n <ul className=\"taxon-list genera\">\n {family.genera.map((genus, genusidx) => {\n return (\n <li key={genusidx}>\n {genus.old_name\n ? '\"' + genus.old_name + '\" - '\n : \"\"}\n {genus.genusRes ? genus.genusRes : \" \"}\n {genus.display_name1}\n <i>\n {genus.display_name2\n ? genus.display_name2\n : \"\"}\n {genus.display_name3\n ? genus.display_name3\n : \"\"}\n </i>\n </li>\n );\n })}\n </ul>\n </div>\n );\n })}\n </ul>\n </div>\n );\n })}\n </ul>\n </div>\n );\n })}\n </ul>\n </div>\n );\n}\n"],"names":["hyper","styles"],"mappings":";;;;;AAKA,MAAM,IAAIA,IAAM,OAAOC,GAAM;AAE7B,SAAwB,gBAAgB,EAAE,QAAQ;AAChD,MAAI,QAAQ,KAAM,QAAO;AACzB,SAAO;AAAA,IACL;AAAA,IACA,KAAK,IAAI,CAAC,KAAK,OAAO,EAAE,kBAAkB,EAAE,KAAK,IAAI,KAAK,CAAC;AAAA,EAAA;AAE/D;AAEA,SAAS,iBAAiB,EAAE,OAAO;AACjC,MAAI,iBAAiB,mBAAmB,IAAI,WAAW;AACvD,SAAO;AAAA,IACL;AAAA,8DAEE,sBAAA,cAAC,QAAA,EAAO,KAAU,GAClB,sBAAA,cAAC,YACC,sBAAA,cAAC,KAAA,EAAI,OAAM,QAAO,OAAO,sBAAA,cAAC,WAAA,EAAU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QAAQ,cAAc;AACvC,eACE,sBAAA,cAAC,SAAI,KAAK,WAAW,WAAU,WAAA,GAC7B,sBAAA,cAAC,YAAI,OAAO,MAAO,GACnB,sBAAA,cAAC,MAAA,EAAG,WAAU,uBACX,OAAO,OAAO,IAAI,CAAC,OAAO,aAAa;AACtC,iBACE,sBAAA,cAAC,MAAA,EAAG,KAAK,SAAA,GACN,MAAM,WACH,MAAM,MAAM,WAAW,SACvB,IACH,MAAM,WAAW,MAAM,WAAW,KAClC,MAAM,eACP,sBAAA,cAAC,KAAA,MACE,MAAM,gBACH,MAAM,gBACN,IACH,MAAM,gBACH,MAAM,gBACN,EACN,CACF;AAAA,QAEJ,CAAC,CACH,CACF;AAAA,MAEJ,CAAC,CACH,CACF;AAAA,IAEJ,CAAC,CACH,CACF;AAAA,EAEJ,CAAC,CACH,CACF;AAEJ;"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
const h$1 = require("@macrostrat/hyper");
|
|
3
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
4
|
+
const h__default = /* @__PURE__ */ _interopDefault(h$1);
|
|
2
5
|
const styles = {
|
|
3
6
|
"pbdb-panel-header": "_pbdb-panel-header_i4zn4_1",
|
|
4
7
|
"fossil-collection": "_fossil-collection_i4zn4_14"
|
|
5
8
|
};
|
|
6
|
-
|
|
9
|
+
let h = h__default.default.styled(styles);
|
|
10
|
+
Object.assign(h, styles);
|
|
11
|
+
module.exports = h;
|
|
7
12
|
//# 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,8 +1,11 @@
|
|
|
1
|
+
import h$1 from "@macrostrat/hyper";
|
|
1
2
|
const styles = {
|
|
2
3
|
"pbdb-panel-header": "_pbdb-panel-header_i4zn4_1",
|
|
3
4
|
"fossil-collection": "_fossil-collection_i4zn4_14"
|
|
4
5
|
};
|
|
6
|
+
let h = h$1.styled(styles);
|
|
7
|
+
Object.assign(h, styles);
|
|
5
8
|
export {
|
|
6
|
-
|
|
9
|
+
h as default
|
|
7
10
|
};
|
|
8
11
|
//# sourceMappingURL=main.module.sass.js.map
|
|
@@ -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":";;;;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import h$1 from "@macrostrat/hyper";
|
|
2
2
|
import { hexToRgb } from "./utils/index.js";
|
|
3
|
-
import
|
|
3
|
+
import h$2 from "./info-blocks.module.sass.js";
|
|
4
4
|
import { useDarkMode } from "@macrostrat/ui-components";
|
|
5
5
|
import chroma from "chroma-js";
|
|
6
|
-
const h = h$1.styled(
|
|
6
|
+
const h = h$1.styled(h$2);
|
|
7
7
|
function getColor(color, darkenAmount) {
|
|
8
8
|
try {
|
|
9
9
|
return chroma(color).darken(darkenAmount).hex();
|