@macrostrat/map-interface 1.0.12 → 1.2.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.
Files changed (134) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/container.72611900.js +134 -0
  3. package/dist/cjs/container.72611900.js.map +1 -0
  4. package/dist/cjs/context-panel.8c4b009c.js +88 -0
  5. package/dist/cjs/context-panel.8c4b009c.js.map +1 -0
  6. package/dist/cjs/controls.7ce3e95c.js +79 -0
  7. package/dist/cjs/controls.7ce3e95c.js.map +1 -0
  8. package/dist/cjs/dev.7499151f.js +33 -0
  9. package/dist/cjs/dev.7499151f.js.map +1 -0
  10. package/dist/cjs/expansion-panel.08532cee.js +134 -0
  11. package/dist/cjs/expansion-panel.08532cee.js.map +1 -0
  12. package/dist/cjs/hash-string.62e84f08.js +67 -0
  13. package/dist/cjs/hash-string.62e84f08.js.map +1 -0
  14. package/dist/cjs/header.58c5c012.js +104 -0
  15. package/dist/cjs/header.58c5c012.js.map +1 -0
  16. package/dist/cjs/headers.20eae5f7.js +29 -0
  17. package/dist/cjs/headers.20eae5f7.js.map +1 -0
  18. package/dist/cjs/helpers.0f72ddaf.js +190 -0
  19. package/dist/cjs/helpers.0f72ddaf.js.map +1 -0
  20. package/dist/cjs/index.js +51 -0
  21. package/dist/cjs/index.js.map +1 -0
  22. package/dist/cjs/location-info.92e70042.js +119 -0
  23. package/dist/cjs/location-info.92e70042.js.map +1 -0
  24. package/dist/cjs/location-panel.c95f5e96.js +66 -0
  25. package/dist/cjs/location-panel.c95f5e96.js.map +1 -0
  26. package/dist/cjs/main.module.02c4de16.css +86 -0
  27. package/dist/cjs/main.module.02c4de16.css.map +1 -0
  28. package/dist/cjs/main.module.3f2b7c9f.js +38 -0
  29. package/dist/cjs/main.module.3f2b7c9f.js.map +1 -0
  30. package/dist/cjs/main.module.4ecbaaa5.js +62 -0
  31. package/dist/cjs/main.module.4ecbaaa5.js.map +1 -0
  32. package/dist/cjs/main.module.62939ea7.js +167 -0
  33. package/dist/cjs/main.module.62939ea7.js.map +1 -0
  34. package/dist/cjs/main.module.92978d8b.css +52 -0
  35. package/dist/cjs/main.module.92978d8b.css.map +1 -0
  36. package/dist/cjs/main.module.becc2fe7.css +92 -0
  37. package/dist/cjs/main.module.becc2fe7.css.map +1 -0
  38. package/dist/cjs/main.module.ccec47df.js +50 -0
  39. package/dist/cjs/main.module.ccec47df.js.map +1 -0
  40. package/dist/cjs/main.module.e958948e.js +26 -0
  41. package/dist/cjs/main.module.e958948e.js.map +1 -0
  42. package/dist/{index.css → cjs/main.module.f085a193.css} +9 -397
  43. package/dist/cjs/main.module.f085a193.css.map +1 -0
  44. package/dist/cjs/main.module.ff1b1aca.css +179 -0
  45. package/dist/cjs/main.module.ff1b1aca.css.map +1 -0
  46. package/dist/cjs/map-page.190b6723.js +182 -0
  47. package/dist/cjs/map-page.190b6723.js.map +1 -0
  48. package/dist/cjs/map-view.93363b41.js +167 -0
  49. package/dist/cjs/map-view.93363b41.js.map +1 -0
  50. package/dist/cjs/terrain.90f76b4e.js +59 -0
  51. package/dist/cjs/terrain.90f76b4e.js.map +1 -0
  52. package/dist/cjs/tile-extent.06a4b2ed.js +51 -0
  53. package/dist/cjs/tile-extent.06a4b2ed.js.map +1 -0
  54. package/dist/cjs/utils.09cef979.js +36 -0
  55. package/dist/cjs/utils.09cef979.js.map +1 -0
  56. package/dist/cjs/utils.26f02633.js +46 -0
  57. package/dist/cjs/utils.26f02633.js.map +1 -0
  58. package/dist/cjs/vector-tile-features.456f887b.js +268 -0
  59. package/dist/cjs/vector-tile-features.456f887b.js.map +1 -0
  60. package/dist/cjs/xray.a23f8660.js +89 -0
  61. package/dist/cjs/xray.a23f8660.js.map +1 -0
  62. package/dist/esm/container.16bde261.js +126 -0
  63. package/dist/esm/container.16bde261.js.map +1 -0
  64. package/dist/esm/context-panel.c288c5cd.js +81 -0
  65. package/dist/esm/context-panel.c288c5cd.js.map +1 -0
  66. package/dist/esm/controls.f757ce16.js +74 -0
  67. package/dist/esm/controls.f757ce16.js.map +1 -0
  68. package/dist/esm/dev.ccb6e774.js +13 -0
  69. package/dist/esm/dev.ccb6e774.js.map +1 -0
  70. package/dist/esm/expansion-panel.feff0e62.js +123 -0
  71. package/dist/esm/expansion-panel.feff0e62.js.map +1 -0
  72. package/dist/esm/hash-string.836601b2.js +61 -0
  73. package/dist/esm/hash-string.836601b2.js.map +1 -0
  74. package/dist/esm/header.0f535ab1.js +99 -0
  75. package/dist/esm/header.0f535ab1.js.map +1 -0
  76. package/dist/esm/headers.b25ff414.js +24 -0
  77. package/dist/esm/headers.b25ff414.js.map +1 -0
  78. package/dist/esm/helpers.fb1d7227.js +176 -0
  79. package/dist/esm/helpers.fb1d7227.js.map +1 -0
  80. package/dist/{types.d.ts → esm/index.d.ts} +104 -52
  81. package/dist/esm/index.d.ts.map +1 -0
  82. package/dist/esm/index.js +25 -0
  83. package/dist/esm/index.js.map +1 -0
  84. package/dist/esm/location-info.5543bb05.js +89 -0
  85. package/dist/esm/location-info.5543bb05.js.map +1 -0
  86. package/dist/esm/location-panel.0b1f4ed2.js +58 -0
  87. package/dist/esm/location-panel.0b1f4ed2.js.map +1 -0
  88. package/dist/esm/main.module.5eb366de.js +52 -0
  89. package/dist/esm/main.module.5eb366de.js.map +1 -0
  90. package/dist/esm/main.module.67a908da.js +40 -0
  91. package/dist/esm/main.module.67a908da.js.map +1 -0
  92. package/dist/esm/main.module.89579666.js +64 -0
  93. package/dist/esm/main.module.89579666.js.map +1 -0
  94. package/dist/esm/main.module.9c57cc95.js +28 -0
  95. package/dist/esm/main.module.9c57cc95.js.map +1 -0
  96. package/dist/esm/main.module.f70e002b.js +169 -0
  97. package/dist/esm/main.module.f70e002b.js.map +1 -0
  98. package/dist/esm/map-page.b953c404.js +175 -0
  99. package/dist/esm/map-page.b953c404.js.map +1 -0
  100. package/dist/esm/map-view.a3fe6257.js +161 -0
  101. package/dist/esm/map-view.a3fe6257.js.map +1 -0
  102. package/dist/esm/terrain.f65cf7c5.js +54 -0
  103. package/dist/esm/terrain.f65cf7c5.js.map +1 -0
  104. package/dist/esm/tile-extent.ca526996.js +46 -0
  105. package/dist/esm/tile-extent.ca526996.js.map +1 -0
  106. package/dist/esm/utils.122d1f2d.js +28 -0
  107. package/dist/esm/utils.122d1f2d.js.map +1 -0
  108. package/dist/esm/utils.d40349f0.js +40 -0
  109. package/dist/esm/utils.d40349f0.js.map +1 -0
  110. package/dist/esm/vector-tile-features.e1a24df0.js +258 -0
  111. package/dist/esm/vector-tile-features.e1a24df0.js.map +1 -0
  112. package/dist/esm/xray.c0663c25.js +83 -0
  113. package/dist/esm/xray.c0663c25.js.map +1 -0
  114. package/package.json +19 -36
  115. package/src/container.ts +29 -21
  116. package/src/context-panel/index.ts +7 -8
  117. package/src/context-panel/main.module.sass +1 -1
  118. package/src/dev/main.module.sass +16 -0
  119. package/src/dev/map-page.ts +32 -11
  120. package/src/dev/vector-tile-features.ts +44 -13
  121. package/src/helpers.ts +15 -13
  122. package/src/location-panel/header.ts +27 -8
  123. package/src/location-panel/index.ts +4 -2
  124. package/src/location-panel/main.module.sass +7 -0
  125. package/src/main.module.sass +4 -1
  126. package/src/map-view/index.ts +28 -32
  127. package/dist/index.cjs.css +0 -961
  128. package/dist/index.cjs.css.map +0 -1
  129. package/dist/index.cjs.js +0 -1965
  130. package/dist/index.cjs.js.map +0 -1
  131. package/dist/index.css.map +0 -1
  132. package/dist/index.js +0 -1956
  133. package/dist/index.js.map +0 -1
  134. package/dist/types.d.ts.map +0 -1
@@ -0,0 +1,104 @@
1
+ require("./main.module.02c4de16.css");
2
+ var $a8d7c4c397e52cf6$exports = require("./main.module.3f2b7c9f.js");
3
+ var $860d9939f7032c69$exports = require("./location-info.92e70042.js");
4
+ var $hshpw$blueprintjscore = require("@blueprintjs/core");
5
+ var $hshpw$macrostrathyper = require("@macrostrat/hyper");
6
+ var $hshpw$macrostratuicomponents = require("@macrostrat/ui-components");
7
+ var $hshpw$macrostratmapboxreact = require("@macrostrat/mapbox-react");
8
+
9
+
10
+ function $parcel$interopDefault(a) {
11
+ return a && a.__esModule ? a.default : a;
12
+ }
13
+
14
+ function $parcel$export(e, n, v, s) {
15
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
16
+ }
17
+
18
+ $parcel$export(module.exports, "InfoDrawerHeader", () => $548387e5996cdbbd$export$e9ff14c4822c2e8c);
19
+
20
+
21
+
22
+
23
+
24
+
25
+ const $548387e5996cdbbd$var$h = (0, ($parcel$interopDefault($hshpw$macrostrathyper))).styled((0, ($parcel$interopDefault($a8d7c4c397e52cf6$exports))));
26
+ function $548387e5996cdbbd$var$PositionButton({ position: position, bounds: bounds, showCopyLink: showCopyLink = false }) {
27
+ const focusState = (0, $hshpw$macrostratmapboxreact.useFocusState)(position);
28
+ const copyLinkIsVisible = (0, $hshpw$macrostratmapboxreact.isCentered)(focusState) && showCopyLink;
29
+ return $548387e5996cdbbd$var$h("div.position-controls", [
30
+ $548387e5996cdbbd$var$h((0, $hshpw$macrostratmapboxreact.LocationFocusButton), {
31
+ location: position,
32
+ bounds: bounds,
33
+ focusState: focusState
34
+ }, []),
35
+ $548387e5996cdbbd$var$h.if(copyLinkIsVisible && position != null)($548387e5996cdbbd$var$CopyLinkButton, {
36
+ itemName: "position"
37
+ })
38
+ ]);
39
+ }
40
+ function $548387e5996cdbbd$var$CopyLinkButton({ itemName: itemName, children: children, onClick: onClick, ...rest }) {
41
+ const toaster = (0, $hshpw$macrostratuicomponents.useToaster)();
42
+ let message = `Copied link`;
43
+ if (itemName != null) message += ` to ${itemName}`;
44
+ message += "!";
45
+ return $548387e5996cdbbd$var$h((0, $hshpw$blueprintjscore.Button), {
46
+ className: "copy-link-button",
47
+ rightIcon: $548387e5996cdbbd$var$h((0, $hshpw$blueprintjscore.Icon), {
48
+ icon: "link",
49
+ size: 12
50
+ }),
51
+ minimal: true,
52
+ small: true,
53
+ onClick () {
54
+ navigator.clipboard.writeText(window.location.href).then(()=>{
55
+ toaster?.show({
56
+ message: message,
57
+ intent: "success",
58
+ icon: "clipboard",
59
+ timeout: 1000
60
+ });
61
+ onClick?.();
62
+ }, ()=>{
63
+ toaster?.show({
64
+ message: "Failed to copy link",
65
+ intent: "danger",
66
+ icon: "error",
67
+ timeout: 1000
68
+ });
69
+ });
70
+ },
71
+ ...rest
72
+ }, children ?? "Copy link");
73
+ }
74
+ function $548387e5996cdbbd$export$e9ff14c4822c2e8c(props) {
75
+ const { onClose: onClose, position: position, bounds: bounds, zoom: zoom = 7, elevation: elevation, showCopyPositionButton: showCopyPositionButton, children: children } = props;
76
+ let leftButton = null;
77
+ if (bounds != null || position != null) leftButton = $548387e5996cdbbd$var$h($548387e5996cdbbd$var$PositionButton, {
78
+ position: position,
79
+ bounds: bounds,
80
+ showCopyLink: showCopyPositionButton
81
+ });
82
+ return $548387e5996cdbbd$var$h("header.location-panel-header", [
83
+ leftButton,
84
+ children,
85
+ $548387e5996cdbbd$var$h("div.spacer"),
86
+ $548387e5996cdbbd$var$h.if(position != null)((0, $860d9939f7032c69$exports.LngLatCoords), {
87
+ position: position,
88
+ zoom: zoom,
89
+ className: "infodrawer-header-item"
90
+ }),
91
+ $548387e5996cdbbd$var$h.if(elevation != null)((0, $860d9939f7032c69$exports.Elevation), {
92
+ elevation: elevation,
93
+ className: "infodrawer-header-item"
94
+ }),
95
+ $548387e5996cdbbd$var$h.if(onClose != null)((0, $hshpw$blueprintjscore.Button), {
96
+ minimal: true,
97
+ icon: "cross",
98
+ onClick: onClose
99
+ })
100
+ ]);
101
+ }
102
+
103
+
104
+ //# sourceMappingURL=header.58c5c012.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAM,0BAAI,CAAA,GAAA,gDAAI,EAAE,MAAM,CAAC,CAAA,GAAA,mDAAK;AAE5B,SAAS,qCAAe,YAAE,QAAQ,UAAE,MAAM,gBAAE,eAAe,OAAO;IAChE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QACA;QACA,wBAAE;QACF,wBAAE,EAAE,CAAC,YAAY,MAAM,CAAA,GAAA,sCAAW,GAAG;sBACnC;kBACA;YACA,WAAW;QACb;QACA,wBAAE,EAAE,CAAC,aAAa,MAAM,CAAA,GAAA,mCAAQ,GAAG;uBACjC;YACA,WAAW;QACb;QACA,wBAAE,EAAE,CAAC,WAAW,MAAM,CAAA,GAAA,6BAAK,GAAG;YAC5B,SAAS;YACT,MAAM;YACN,SAAS;QACX;KACD;AACH","sources":["packages/map-interface/src/location-panel/header.ts"],"sourcesContent":["import { Icon, Button } from \"@blueprintjs/core\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { useToaster } from \"@macrostrat/ui-components\";\nimport { LngLatCoords, Elevation } from \"../location-info\";\nimport {\n LocationFocusButton,\n useFocusState,\n isCentered,\n} from \"@macrostrat/mapbox-react\";\n\nconst h = hyper.styled(styles);\n\nfunction PositionButton({ position, bounds, showCopyLink = false }) {\n const focusState = useFocusState(position);\n\n const copyLinkIsVisible = isCentered(focusState) && showCopyLink;\n\n return h(\"div.position-controls\", [\n h(LocationFocusButton, { location: position, bounds, focusState }, []),\n h.if(copyLinkIsVisible && position != null)(CopyLinkButton, {\n itemName: \"position\",\n }),\n ]);\n}\n\nfunction CopyLinkButton({ itemName, children, onClick, ...rest }) {\n const toaster = useToaster();\n\n let message = `Copied link`;\n if (itemName != null) {\n message += ` to ${itemName}`;\n }\n message += \"!\";\n\n return h(\n Button,\n {\n className: \"copy-link-button\",\n rightIcon: h(Icon, { icon: \"link\", size: 12 }),\n minimal: true,\n small: true,\n onClick() {\n navigator.clipboard.writeText(window.location.href).then(\n () => {\n toaster?.show({\n message,\n intent: \"success\",\n icon: \"clipboard\",\n timeout: 1000,\n });\n onClick?.();\n },\n () => {\n toaster?.show({\n message: \"Failed to copy link\",\n intent: \"danger\",\n icon: \"error\",\n timeout: 1000,\n });\n }\n );\n },\n ...rest,\n },\n children ?? \"Copy link\"\n );\n}\n\nexport interface InfoDrawerHeaderProps {\n onClose?: () => void;\n position?: mapboxgl.LngLat;\n zoom?: number;\n elevation?: number;\n showCopyPositionButton?: boolean;\n bounds?: mapboxgl.LngLatBounds;\n}\n\nexport function InfoDrawerHeader(props: InfoDrawerHeaderProps) {\n const {\n onClose,\n position,\n bounds,\n zoom = 7,\n elevation,\n showCopyPositionButton,\n children,\n } = props;\n\n let leftButton = null;\n if (bounds != null || position != null) {\n leftButton = h(PositionButton, {\n position,\n bounds,\n showCopyLink: showCopyPositionButton,\n });\n }\n\n return h(\"header.location-panel-header\", [\n leftButton,\n children,\n h(\"div.spacer\"),\n h.if(position != null)(LngLatCoords, {\n position,\n zoom,\n className: \"infodrawer-header-item\",\n }),\n h.if(elevation != null)(Elevation, {\n elevation,\n className: \"infodrawer-header-item\",\n }),\n h.if(onClose != null)(Button, {\n minimal: true,\n icon: \"cross\",\n onClick: onClose,\n }),\n ]);\n}\n"],"names":[],"version":3,"file":"header.58c5c012.js.map"}
@@ -0,0 +1,29 @@
1
+ var $b1c160aff794b8f5$exports = require("./main.module.4ecbaaa5.js");
2
+ require("./main.module.ff1b1aca.css");
3
+ var $br79r$macrostrathyper = require("@macrostrat/hyper");
4
+
5
+
6
+ function $parcel$interopDefault(a) {
7
+ return a && a.__esModule ? a.default : a;
8
+ }
9
+
10
+ function $parcel$export(e, n, v, s) {
11
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
12
+ }
13
+
14
+ $parcel$export(module.exports, "PanelSubhead", () => $a0970d22776f9f4c$export$ed081779ec3709aa);
15
+
16
+
17
+ const $a0970d22776f9f4c$var$h = (0, ($parcel$interopDefault($br79r$macrostrathyper))).styled((0, ($parcel$interopDefault($b1c160aff794b8f5$exports))));
18
+ function $a0970d22776f9f4c$export$ed081779ec3709aa(props) {
19
+ const { title: title, component: component = "h3", children: children, ...rest } = props;
20
+ return $a0970d22776f9f4c$var$h("div.panel-subhead", rest, [
21
+ $a0970d22776f9f4c$var$h(component, {
22
+ className: "title"
23
+ }, title),
24
+ children
25
+ ]);
26
+ }
27
+
28
+
29
+ //# sourceMappingURL=headers.20eae5f7.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;AAGA,MAAM,0BAAI,CAAA,GAAA,gDAAI,EAAE,MAAM,CAAC,CAAA,GAAA,mDAAK;AAErB,SAAS,0CAAa,KAAK;IAChC,MAAM,SAAE,KAAK,aAAE,YAAY,gBAAM,QAAQ,EAAE,GAAG,MAAM,GAAG;IACvD,OAAO,wBAAE,qBAAqB,MAAM;QAClC,wBACE,WACA;YACE,WAAW;QACb,GACA;QAEF;KACD;AACH","sources":["packages/map-interface/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":[],"version":3,"file":"headers.20eae5f7.js.map"}
@@ -0,0 +1,190 @@
1
+ var $3490fc4f4bda12f7$exports = require("./utils.26f02633.js");
2
+ var $dSfMz$macrostratmapboxreact = require("@macrostrat/mapbox-react");
3
+ var $dSfMz$react = require("react");
4
+ var $dSfMz$underscore = require("underscore");
5
+ var $dSfMz$useresizeobserver = require("use-resize-observer");
6
+ var $dSfMz$macrostratmapboxutils = require("@macrostrat/mapbox-utils");
7
+ var $dSfMz$macrostratuicomponents = require("@macrostrat/ui-components");
8
+
9
+
10
+ function $parcel$interopDefault(a) {
11
+ return a && a.__esModule ? a.default : a;
12
+ }
13
+
14
+ function $parcel$export(e, n, v, s) {
15
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
16
+ }
17
+
18
+ $parcel$export(module.exports, "MapResizeManager", () => $2611a7b4364593e5$export$31b2e088aff2dc5d);
19
+ $parcel$export(module.exports, "MapPaddingManager", () => $2611a7b4364593e5$export$2ab96428dea558d6);
20
+ $parcel$export(module.exports, "MapMovedReporter", () => $2611a7b4364593e5$export$f6eeee399afc4e9a);
21
+ $parcel$export(module.exports, "MapLoadingReporter", () => $2611a7b4364593e5$export$e57f9eaa51773f82);
22
+ $parcel$export(module.exports, "MapMarker", () => $2611a7b4364593e5$export$5c90a91c7455938c);
23
+ $parcel$export(module.exports, "useBasicStylePair", () => $2611a7b4364593e5$export$566518253d2584f8);
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+ function $2611a7b4364593e5$export$31b2e088aff2dc5d({ containerRef: containerRef }) {
32
+ const mapRef = (0, $dSfMz$macrostratmapboxreact.useMapRef)();
33
+ const debouncedResize = (0, $dSfMz$react.useRef)((0, $dSfMz$underscore.debounce)(()=>{
34
+ mapRef.current?.resize();
35
+ }, 100));
36
+ (0, ($parcel$interopDefault($dSfMz$useresizeobserver)))({
37
+ ref: containerRef,
38
+ onResize: debouncedResize.current
39
+ });
40
+ return null;
41
+ }
42
+ function $2611a7b4364593e5$export$2ab96428dea558d6({ containerRef: containerRef, parentRef: parentRef, infoMarkerPosition: infoMarkerPosition, debounceTime: debounceTime = 200 }) {
43
+ const mapRef = (0, $dSfMz$macrostratmapboxreact.useMapRef)();
44
+ const [padding, setPadding] = (0, $dSfMz$react.useState)((0, $3490fc4f4bda12f7$exports.getMapPadding)(containerRef, parentRef));
45
+ const _updateMapPadding = (0, $dSfMz$react.useCallback)(()=>{
46
+ const newPadding = (0, $3490fc4f4bda12f7$exports.getMapPadding)(containerRef, parentRef);
47
+ setPadding(newPadding);
48
+ }, [
49
+ containerRef.current,
50
+ parentRef.current
51
+ ]);
52
+ const updateMapPadding = (0, $dSfMz$react.useMemo)(()=>(0, $dSfMz$underscore.debounce)(_updateMapPadding, debounceTime), [
53
+ _updateMapPadding,
54
+ debounceTime
55
+ ]);
56
+ (0, $dSfMz$react.useEffect)(()=>{
57
+ const map = mapRef.current;
58
+ if (map == null) return;
59
+ // Update map padding on load
60
+ updateMapPadding();
61
+ }, [
62
+ mapRef.current
63
+ ]);
64
+ (0, ($parcel$interopDefault($dSfMz$useresizeobserver)))({
65
+ ref: parentRef,
66
+ onResize (sz) {
67
+ updateMapPadding();
68
+ },
69
+ round (n) {
70
+ return Math.round(n);
71
+ }
72
+ });
73
+ // Ideally, we would not have to do this when we know the infobox is loaded
74
+ (0, $dSfMz$macrostratmapboxreact.useMapEaseTo)({
75
+ center: infoMarkerPosition,
76
+ padding: padding
77
+ });
78
+ return null;
79
+ }
80
+ function $2611a7b4364593e5$export$f6eeee399afc4e9a({ onMapMoved: onMapMoved = null }) {
81
+ const mapRef = (0, $dSfMz$macrostratmapboxreact.useMapRef)();
82
+ const dispatch = (0, $dSfMz$macrostratmapboxreact.useMapDispatch)();
83
+ const isInitialized = (0, $dSfMz$macrostratmapboxreact.useMapInitialized)();
84
+ const mapMovedCallback = (0, $dSfMz$react.useCallback)(()=>{
85
+ const map = mapRef.current;
86
+ if (map == null) return;
87
+ const mapPosition = (0, $dSfMz$macrostratmapboxutils.getMapPosition)(map);
88
+ dispatch({
89
+ type: "map-moved",
90
+ payload: mapPosition
91
+ });
92
+ onMapMoved?.(mapPosition, map);
93
+ }, [
94
+ onMapMoved,
95
+ dispatch,
96
+ isInitialized
97
+ ]);
98
+ (0, $dSfMz$react.useEffect)(()=>{
99
+ // Get the current value of the map. Useful for gradually moving away
100
+ // from class component
101
+ const map = mapRef.current;
102
+ if (map == null) return;
103
+ // Update the URI when the map moves
104
+ mapMovedCallback();
105
+ const cb = (0, $dSfMz$underscore.debounce)(mapMovedCallback, 100);
106
+ map.on("moveend", cb);
107
+ return ()=>{
108
+ map?.off("moveend", cb);
109
+ };
110
+ }, [
111
+ mapMovedCallback
112
+ ]);
113
+ return null;
114
+ }
115
+ function $2611a7b4364593e5$export$e57f9eaa51773f82({ ignoredSources: ignoredSources, onMapLoading: onMapLoading = null, onMapIdle: onMapIdle = null, mapIsLoading: mapIsLoading }) {
116
+ const mapRef = (0, $dSfMz$macrostratmapboxreact.useMapRef)();
117
+ const loadingRef = (0, $dSfMz$react.useRef)(false);
118
+ const dispatch = (0, $dSfMz$macrostratmapboxreact.useMapDispatch)();
119
+ const isInitialized = (0, $dSfMz$macrostratmapboxreact.useMapInitialized)();
120
+ (0, $dSfMz$react.useEffect)(()=>{
121
+ const map = mapRef.current;
122
+ const mapIsLoading = loadingRef.current;
123
+ if (map == null) return;
124
+ let didSendLoading = false;
125
+ const loadingCallback = (evt)=>{
126
+ if (ignoredSources.includes(evt.sourceId) || mapIsLoading) return;
127
+ if (didSendLoading) return;
128
+ onMapLoading?.(evt);
129
+ dispatch({
130
+ type: "set-loading",
131
+ payload: true
132
+ });
133
+ loadingRef.current = true;
134
+ didSendLoading = true;
135
+ };
136
+ const idleCallback = (evt)=>{
137
+ if (!mapIsLoading) return;
138
+ dispatch({
139
+ type: "set-loading",
140
+ payload: false
141
+ });
142
+ loadingRef.current = false;
143
+ onMapIdle?.(evt);
144
+ };
145
+ map.on("sourcedataloading", loadingCallback);
146
+ map.on("idle", idleCallback);
147
+ return ()=>{
148
+ map?.off("sourcedataloading", loadingCallback);
149
+ map?.off("idle", idleCallback);
150
+ };
151
+ }, [
152
+ ignoredSources,
153
+ mapIsLoading,
154
+ isInitialized
155
+ ]);
156
+ return null;
157
+ }
158
+ function $2611a7b4364593e5$export$5c90a91c7455938c({ position: position, setPosition: setPosition, centerMarker: centerMarker = true }) {
159
+ const mapRef = (0, $dSfMz$macrostratmapboxreact.useMapRef)();
160
+ const markerRef = (0, $dSfMz$react.useRef)(null);
161
+ const isInitialized = (0, $dSfMz$macrostratmapboxreact.useMapInitialized)();
162
+ (0, $3490fc4f4bda12f7$exports.useMapMarker)(mapRef, markerRef, position);
163
+ (0, $dSfMz$react.useEffect)(()=>{
164
+ const map = mapRef.current;
165
+ if (map == null || setPosition == null) return;
166
+ const handleMapClick = (event)=>{
167
+ setPosition(event.lngLat, event, mapRef.current);
168
+ // We should integrate this with the "easeToCenter" hook
169
+ if (centerMarker) mapRef.current?.flyTo({
170
+ center: event.lngLat,
171
+ duration: 800
172
+ });
173
+ };
174
+ map.on("click", handleMapClick);
175
+ return ()=>{
176
+ map?.off("click", handleMapClick);
177
+ };
178
+ }, [
179
+ setPosition,
180
+ isInitialized
181
+ ]);
182
+ return null;
183
+ }
184
+ function $2611a7b4364593e5$export$566518253d2584f8() {
185
+ const inDarkMode = (0, $dSfMz$macrostratuicomponents.useInDarkMode)();
186
+ return inDarkMode ? "mapbox://styles/mapbox/dark-v10" : "mapbox://styles/mapbox/light-v10";
187
+ }
188
+
189
+
190
+ //# sourceMappingURL=helpers.0f72ddaf.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,SAAS,0CAAiB,gBAAE,YAAY,EAAE;IAC/C,MAAM,SAAS,CAAA,GAAA,sCAAQ;IAEvB,MAAM,kBAAkB,CAAA,GAAA,mBAAK,EAC3B,CAAA,GAAA,0BAAO,EAAE;QACP,OAAO,OAAO,EAAE;IAClB,GAAG;IAGL,CAAA,GAAA,kDAAgB,EAAE;QAChB,KAAK;QACL,UAAU,gBAAgB,OAAO;IACnC;IAEA,OAAO;AACT;AASO,SAAS,0CAAkB,gBAChC,YAAY,aACZ,SAAS,sBACT,kBAAkB,gBAClB,eAAe,KACQ;IACvB,MAAM,SAAS,CAAA,GAAA,sCAAQ;IAEvB,MAAM,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,qBAAO,EACnC,CAAA,GAAA,uCAAY,EAAE,cAAc;IAG9B,MAAM,oBAAoB,CAAA,GAAA,wBAAU,EAAE;QACpC,MAAM,aAAa,CAAA,GAAA,uCAAY,EAAE,cAAc;QAC/C,WAAW;IACb,GAAG;QAAC,aAAa,OAAO;QAAE,UAAU,OAAO;KAAC;IAE5C,MAAM,mBAAmB,CAAA,GAAA,oBAAM,EAC7B,IAAM,CAAA,GAAA,0BAAO,EAAE,mBAAmB,eAClC;QAAC;QAAmB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gBAAE,UAAU;YAAI;QAEhE;QAEA,IAAI,EAAE,CAAC,SAAS;QAEhB,OAAO;YACL,KAAK,IAAI,SAAS;QACpB;IACF,GAAG;QAAC;QAAa;KAAc;IAE/B,OAAO;AACT;AAEO,SAAS;IACd,MAAM,aAAa,CAAA,GAAA,2CAAY;IAC/B,OAAO,aACH,oCACA;AACN","sources":["packages/map-interface/src/helpers.ts"],"sourcesContent":["import {\n useMapRef,\n useMapEaseTo,\n useMapDispatch,\n useMapStatus,\n useMapInitialized,\n} from \"@macrostrat/mapbox-react\";\nimport { useMemo, useRef } from \"react\";\nimport { debounce } from \"underscore\";\nimport useResizeObserver from \"use-resize-observer\";\n\nimport { getMapPosition } from \"@macrostrat/mapbox-utils\";\nimport mapboxgl from \"mapbox-gl\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { getMapPadding, useMapMarker } from \"./utils\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\n\nexport function MapResizeManager({ containerRef }) {\n const mapRef = useMapRef();\n\n const debouncedResize = useRef(\n debounce(() => {\n mapRef.current?.resize();\n }, 100)\n );\n\n useResizeObserver({\n ref: containerRef,\n onResize: debouncedResize.current,\n });\n\n return null;\n}\n\ninterface MapPaddingManagerProps {\n containerRef: React.RefObject<HTMLDivElement>;\n parentRef: React.RefObject<HTMLDivElement>;\n infoMarkerPosition: mapboxgl.LngLatLike;\n debounceTime?: number;\n}\n\nexport function MapPaddingManager({\n containerRef,\n parentRef,\n infoMarkerPosition,\n debounceTime = 200,\n}: MapPaddingManagerProps) {\n const mapRef = useMapRef();\n\n const [padding, setPadding] = useState(\n getMapPadding(containerRef, parentRef)\n );\n\n const _updateMapPadding = useCallback(() => {\n const newPadding = getMapPadding(containerRef, parentRef);\n setPadding(newPadding);\n }, [containerRef.current, parentRef.current]);\n\n const updateMapPadding = useMemo(\n () => debounce(_updateMapPadding, debounceTime),\n [_updateMapPadding, debounceTime]\n );\n\n useEffect(() => {\n const map = mapRef.current;\n if (map == null) return;\n // Update map padding on load\n updateMapPadding();\n }, [mapRef.current]);\n\n useResizeObserver({\n ref: parentRef,\n onResize(sz) {\n updateMapPadding();\n },\n round(n) {\n return Math.round(n);\n },\n });\n\n // Ideally, we would not have to do this when we know the infobox is loaded\n useMapEaseTo({ center: infoMarkerPosition, padding });\n\n return null;\n}\n\nexport function MapMovedReporter({ onMapMoved = null }) {\n const mapRef = useMapRef();\n const dispatch = useMapDispatch();\n const isInitialized = useMapInitialized();\n\n const mapMovedCallback = useCallback(() => {\n const map = mapRef.current;\n if (map == null) return;\n const mapPosition = getMapPosition(map);\n dispatch({ type: \"map-moved\", payload: mapPosition });\n onMapMoved?.(mapPosition, map);\n }, [onMapMoved, dispatch, isInitialized]);\n\n useEffect(() => {\n // Get the current value of the map. Useful for gradually moving away\n // from class component\n const map = mapRef.current;\n if (map == null) return;\n // Update the URI when the map moves\n mapMovedCallback();\n const cb = debounce(mapMovedCallback, 100);\n map.on(\"moveend\", cb);\n return () => {\n map?.off(\"moveend\", cb);\n };\n }, [mapMovedCallback]);\n return null;\n}\n\nexport function MapLoadingReporter({\n ignoredSources,\n onMapLoading = null,\n onMapIdle = null,\n mapIsLoading,\n}) {\n const mapRef = useMapRef();\n const loadingRef = useRef(false);\n const dispatch = useMapDispatch();\n const isInitialized = useMapInitialized();\n\n useEffect(() => {\n const map = mapRef.current;\n const mapIsLoading = loadingRef.current;\n if (map == null) return;\n\n let didSendLoading = false;\n\n const loadingCallback = (evt) => {\n if (ignoredSources.includes(evt.sourceId) || mapIsLoading) return;\n if (didSendLoading) return;\n onMapLoading?.(evt);\n dispatch({ type: \"set-loading\", payload: true });\n loadingRef.current = true;\n didSendLoading = true;\n };\n const idleCallback = (evt) => {\n if (!mapIsLoading) return;\n dispatch({ type: \"set-loading\", payload: false });\n loadingRef.current = false;\n onMapIdle?.(evt);\n };\n map.on(\"sourcedataloading\", loadingCallback);\n map.on(\"idle\", idleCallback);\n return () => {\n map?.off(\"sourcedataloading\", loadingCallback);\n map?.off(\"idle\", idleCallback);\n };\n }, [ignoredSources, mapIsLoading, isInitialized]);\n return null;\n}\n\nexport function MapMarker({ position, setPosition, centerMarker = true }) {\n const mapRef = useMapRef();\n const markerRef = useRef(null);\n const isInitialized = useMapInitialized();\n\n useMapMarker(mapRef, markerRef, position);\n\n useEffect(() => {\n const map = mapRef.current;\n if (map == null || setPosition == null) return;\n\n const handleMapClick = (event: mapboxgl.MapMouseEvent) => {\n setPosition(event.lngLat, event, mapRef.current);\n // We should integrate this with the \"easeToCenter\" hook\n if (centerMarker) {\n mapRef.current?.flyTo({ center: event.lngLat, duration: 800 });\n }\n };\n\n map.on(\"click\", handleMapClick);\n\n return () => {\n map?.off(\"click\", handleMapClick);\n };\n }, [setPosition, isInitialized]);\n\n return null;\n}\n\nexport function useBasicStylePair() {\n const inDarkMode = useInDarkMode();\n return inDarkMode\n ? \"mapbox://styles/mapbox/dark-v10\"\n : \"mapbox://styles/mapbox/light-v10\";\n}\n"],"names":[],"version":3,"file":"helpers.0f72ddaf.js.map"}
@@ -0,0 +1,51 @@
1
+ var $fce5fc950d1fe35b$exports = require("./context-panel.8c4b009c.js");
2
+ var $2bc7c1e4e7da7fdf$exports = require("./location-panel.c95f5e96.js");
3
+ var $9acbb47bf7cb7660$exports = require("./dev.7499151f.js");
4
+ var $c3311f59335df34d$exports = require("./container.72611900.js");
5
+ var $12b6032029db16d4$exports = require("./map-view.93363b41.js");
6
+ var $f333fe6f49373ca9$exports = require("./controls.7ce3e95c.js");
7
+ var $2611a7b4364593e5$exports = require("./helpers.0f72ddaf.js");
8
+ var $3490fc4f4bda12f7$exports = require("./utils.26f02633.js");
9
+ var $860d9939f7032c69$exports = require("./location-info.92e70042.js");
10
+ var $750d69d73bfbdc9a$exports = require("./expansion-panel.08532cee.js");
11
+
12
+
13
+ function $parcel$exportWildcard(dest, source) {
14
+ Object.keys(source).forEach(function(key) {
15
+ if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {
16
+ return;
17
+ }
18
+
19
+ Object.defineProperty(dest, key, {
20
+ enumerable: true,
21
+ get: function get() {
22
+ return source[key];
23
+ }
24
+ });
25
+ });
26
+
27
+ return dest;
28
+ }
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+ $parcel$exportWildcard(module.exports, $fce5fc950d1fe35b$exports);
40
+ $parcel$exportWildcard(module.exports, $2bc7c1e4e7da7fdf$exports);
41
+ $parcel$exportWildcard(module.exports, $9acbb47bf7cb7660$exports);
42
+ $parcel$exportWildcard(module.exports, $c3311f59335df34d$exports);
43
+ $parcel$exportWildcard(module.exports, $12b6032029db16d4$exports);
44
+ $parcel$exportWildcard(module.exports, $f333fe6f49373ca9$exports);
45
+ $parcel$exportWildcard(module.exports, $2611a7b4364593e5$exports);
46
+ $parcel$exportWildcard(module.exports, $3490fc4f4bda12f7$exports);
47
+ $parcel$exportWildcard(module.exports, $860d9939f7032c69$exports);
48
+ $parcel$exportWildcard(module.exports, $750d69d73bfbdc9a$exports);
49
+
50
+
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"","sources":["packages/map-interface/src/index.ts"],"sourcesContent":["export * from \"./context-panel\";\nexport * from \"./location-panel\";\nexport * from \"./dev\";\nexport * from \"./container\";\nexport * from \"./map-view\";\nexport * from \"./controls\";\nexport * from \"./helpers\";\nexport * from \"./utils\";\nexport * from \"./location-info\";\nexport * from \"./expansion-panel\";\n"],"names":[],"version":3,"file":"index.js.map"}
@@ -0,0 +1,119 @@
1
+ var $bf943af2b72f182b$exports = require("./utils.09cef979.js");
2
+ var $370ea7ef3413c03a$exports = require("./hash-string.62e84f08.js");
3
+ var $eMimP$macrostrathyper = require("@macrostrat/hyper");
4
+ var $eMimP$macrostratmapboxutils = require("@macrostrat/mapbox-utils");
5
+
6
+
7
+ function $parcel$interopDefault(a) {
8
+ return a && a.__esModule ? a.default : a;
9
+ }
10
+
11
+ function $parcel$exportWildcard(dest, source) {
12
+ Object.keys(source).forEach(function(key) {
13
+ if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {
14
+ return;
15
+ }
16
+
17
+ Object.defineProperty(dest, key, {
18
+ enumerable: true,
19
+ get: function get() {
20
+ return source[key];
21
+ }
22
+ });
23
+ });
24
+
25
+ return dest;
26
+ }
27
+
28
+ function $parcel$export(e, n, v, s) {
29
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
30
+ }
31
+
32
+ $parcel$export(module.exports, "ValueWithUnit", () => $860d9939f7032c69$export$716098b85fd0efdf);
33
+ $parcel$export(module.exports, "DegreeCoord", () => $860d9939f7032c69$export$af8082af0bea3eb1);
34
+ $parcel$export(module.exports, "LngLatCoords", () => $860d9939f7032c69$export$f195b3550849e560);
35
+ $parcel$export(module.exports, "Elevation", () => $860d9939f7032c69$export$58bfb4f6ec5aa58d);
36
+
37
+
38
+
39
+
40
+ function $860d9939f7032c69$export$716098b85fd0efdf(props) {
41
+ const { value: value, unit: unit } = props;
42
+ return (0, ($parcel$interopDefault($eMimP$macrostrathyper)))("span.value-with-unit", [
43
+ (0, ($parcel$interopDefault($eMimP$macrostrathyper)))("span.value", [
44
+ value
45
+ ]),
46
+ (0, ($parcel$interopDefault($eMimP$macrostrathyper)))("span.spacer", [
47
+ " "
48
+ ]),
49
+ (0, ($parcel$interopDefault($eMimP$macrostrathyper)))("span.unit", [
50
+ unit
51
+ ])
52
+ ]);
53
+ }
54
+ function $860d9939f7032c69$export$af8082af0bea3eb1(props) {
55
+ const { value: value, labels: labels, precision: precision = 3, format: format = (0, $bf943af2b72f182b$exports.formatValue) } = props;
56
+ const direction = value < 0 ? labels[1] : labels[0];
57
+ return (0, ($parcel$interopDefault($eMimP$macrostrathyper)))($860d9939f7032c69$export$716098b85fd0efdf, {
58
+ value: format(Math.abs(value), precision) + "\xb0",
59
+ unit: direction
60
+ });
61
+ }
62
+ function $860d9939f7032c69$export$f195b3550849e560(props) {
63
+ /** Formatted geographic coordinates */ const { position: position, className: className, precision: precision, zoom: zoom } = props;
64
+ let { format: format } = props;
65
+ if (position == null) return null;
66
+ let lat, lng;
67
+ if (Array.isArray(position)) [lng, lat] = position;
68
+ else ({ lat: lat, lng: lng } = position);
69
+ if (zoom != null && format == null && precision == null) format = (val, _)=>(0, $eMimP$macrostratmapboxutils.formatCoordForZoomLevel)(val, zoom);
70
+ return (0, ($parcel$interopDefault($eMimP$macrostrathyper)))("div.lnglat-container", {
71
+ className: className
72
+ }, [
73
+ (0, ($parcel$interopDefault($eMimP$macrostrathyper)))("span.lnglat", [
74
+ (0, ($parcel$interopDefault($eMimP$macrostrathyper)))($860d9939f7032c69$export$af8082af0bea3eb1, {
75
+ value: lat,
76
+ labels: [
77
+ "N",
78
+ "S"
79
+ ],
80
+ precision: precision,
81
+ format: format
82
+ }),
83
+ ", ",
84
+ (0, ($parcel$interopDefault($eMimP$macrostrathyper)))($860d9939f7032c69$export$af8082af0bea3eb1, {
85
+ value: (0, $eMimP$macrostratmapboxutils.normalizeLng)(lng),
86
+ labels: [
87
+ "E",
88
+ "W"
89
+ ],
90
+ precision: precision,
91
+ format: format
92
+ })
93
+ ])
94
+ ]);
95
+ }
96
+ function $860d9939f7032c69$export$58bfb4f6ec5aa58d(props) {
97
+ /** Renders an elevation value in meters and a parenthetical conversion to feet. */ const { elevation: elevation, className: className, includeFeet: includeFeet = true } = props;
98
+ if (elevation == null) return null;
99
+ return (0, ($parcel$interopDefault($eMimP$macrostrathyper)))("div.elevation", {
100
+ className: className
101
+ }, [
102
+ (0, ($parcel$interopDefault($eMimP$macrostrathyper)))($860d9939f7032c69$export$716098b85fd0efdf, {
103
+ value: elevation,
104
+ unit: "m"
105
+ }),
106
+ (0, ($parcel$interopDefault($eMimP$macrostrathyper))).if(includeFeet)("span.secondary", [
107
+ " (",
108
+ (0, ($parcel$interopDefault($eMimP$macrostrathyper)))($860d9939f7032c69$export$716098b85fd0efdf, {
109
+ value: (0, $eMimP$macrostratmapboxutils.metersToFeet)(elevation),
110
+ unit: "ft"
111
+ }),
112
+ ")"
113
+ ])
114
+ ]);
115
+ }
116
+ $parcel$exportWildcard(module.exports, $370ea7ef3413c03a$exports);
117
+
118
+
119
+ //# sourceMappingURL=location-info.92e70042.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUO,SAAS,0CAAc,KAAK;IACjC,MAAM,SAAE,KAAK,QAAE,IAAI,EAAE,GAAG;IACxB,OAAO,CAAA,GAAA,gDAAA,EAAE,wBAAwB;QAC/B,CAAA,GAAA,gDAAA,EAAE,cAAc;YAAC;SAAM;QACvB,CAAA,GAAA,gDAAA,EAAE,eAAe;YAAC;SAAI;QACtB,CAAA,GAAA,gDAAA,EAAE,aAAa;YAAC;SAAK;KACtB;AACH;AAEO,SAAS,0CAAY,KAAK;IAC/B,MAAM,SAAE,KAAK,UAAE,MAAM,aAAE,YAAY,WAAG,SAAS,CAAA,GAAA,qCAAU,GAAG,GAAG;IAC/D,MAAM,YAAY,QAAQ,IAAI,MAAM,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE;IAEnD,OAAO,CAAA,GAAA,gDAAA,EAAE,2CAAe;QACtB,OAAO,OAAO,KAAK,GAAG,CAAC,QAAQ,aAAa;QAC5C,MAAM;IACR;AACF;AAcO,SAAS,0CAAa,KAAkB;IAC7C,qCAAqC,GACrC,MAAM,YAAE,QAAQ,aAAE,SAAS,aAAE,SAAS,QAAE,IAAI,EAAE,GAAG;IACjD,IAAI,UAAE,MAAM,EAAE,GAAG;IACjB,IAAI,YAAY,MACd,OAAO;IAET,IAAI,KAAK;IACT,IAAI,MAAM,OAAO,CAAC,WAChB,CAAC,KAAK,IAAI,GAAG;SAEZ,CAAA,OAAE,GAAG,OAAE,GAAG,EAAE,GAAG,QAAO;IAGzB,IAAI,QAAQ,QAAQ,UAAU,QAAQ,aAAa,MACjD,SAAS,CAAC,KAAK,IAAM,CAAA,GAAA,oDAAsB,EAAE,KAAK;IAGpD,OAAO,CAAA,GAAA,gDAAA,EAAE,wBAAwB;mBAAE;IAAU,GAAG;QAC9C,CAAA,GAAA,gDAAA,EAAE,eAAe;YACf,CAAA,GAAA,gDAAA,EAAE,2CAAa;gBACb,OAAO;gBACP,QAAQ;oBAAC;oBAAK;iBAAI;2BAClB;wBACA;YACF;YACA;YACA,CAAA,GAAA,gDAAA,EAAE,2CAAa;gBACb,OAAO,CAAA,GAAA,yCAAW,EAAE;gBACpB,QAAQ;oBAAC;oBAAK;iBAAI;2BAClB;wBACA;YACF;SACD;KACF;AACH;AAEO,SAAS,0CAAU,KAAK;IAC7B,iFAAiF,GACjF,MAAM,aAAE,SAAS,aAAE,SAAS,eAAE,cAAc,MAAM,GAAG;IACrD,IAAI,aAAa,MAAM,OAAO;IAC9B,OAAO,CAAA,GAAA,gDAAA,EAAE,iBAAiB;mBAAE;IAAU,GAAG;QACvC,CAAA,GAAA,gDAAA,EAAE,2CAAe;YAAE,OAAO;YAAW,MAAM;QAAI;QAC/C,CAAA,GAAA,gDAAA,EAAE,EAAE,CAAC,aAAa,kBAAkB;YAClC;YACA,CAAA,GAAA,gDAAA,EAAE,2CAAe;gBAAE,OAAO,CAAA,GAAA,yCAAW,EAAE;gBAAY,MAAM;YAAK;YAC9D;SACD;KACF;AACH","sources":["packages/map-interface/src/location-info/index.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport {\n formatCoordForZoomLevel,\n metersToFeet,\n normalizeLng,\n} from \"@macrostrat/mapbox-utils\";\nimport { formatValue } from \"./utils\";\n\nexport * from \"./hash-string\";\n\nexport function ValueWithUnit(props) {\n const { value, unit } = props;\n return h(\"span.value-with-unit\", [\n h(\"span.value\", [value]),\n h(\"span.spacer\", [\" \"]),\n h(\"span.unit\", [unit]),\n ]);\n}\n\nexport function DegreeCoord(props) {\n const { value, labels, precision = 3, format = formatValue } = props;\n const direction = value < 0 ? labels[1] : labels[0];\n\n return h(ValueWithUnit, {\n value: format(Math.abs(value), precision) + \"°\",\n unit: direction,\n });\n}\n\nexport interface LngLatProps {\n /** Map position */\n position: [number, number] | { lat: number; lng: number };\n className?: string;\n /** Zoom level (used to infer coordinate rounding if provided) */\n zoom?: number | null;\n /** Number of decimal places to round coordinates to */\n precision: number | null;\n /** Function to format coordinates */\n format?: (val: number, precision: number) => string;\n}\n\nexport function LngLatCoords(props: LngLatProps) {\n /** Formatted geographic coordinates */\n const { position, className, precision, zoom } = props;\n let { format } = props;\n if (position == null) {\n return null;\n }\n let lat, lng;\n if (Array.isArray(position)) {\n [lng, lat] = position;\n } else {\n ({ lat, lng } = position);\n }\n\n if (zoom != null && format == null && precision == null) {\n format = (val, _) => formatCoordForZoomLevel(val, zoom);\n }\n\n return h(\"div.lnglat-container\", { className }, [\n h(\"span.lnglat\", [\n h(DegreeCoord, {\n value: lat,\n labels: [\"N\", \"S\"],\n precision,\n format,\n }),\n \", \",\n h(DegreeCoord, {\n value: normalizeLng(lng),\n labels: [\"E\", \"W\"],\n precision,\n format,\n }),\n ]),\n ]);\n}\n\nexport function Elevation(props) {\n /** Renders an elevation value in meters and a parenthetical conversion to feet. */\n const { elevation, className, includeFeet = true } = props;\n if (elevation == null) return null;\n return h(\"div.elevation\", { className }, [\n h(ValueWithUnit, { value: elevation, unit: \"m\" }),\n h.if(includeFeet)(\"span.secondary\", [\n \" (\",\n h(ValueWithUnit, { value: metersToFeet(elevation), unit: \"ft\" }),\n \")\",\n ]),\n ]);\n}\n"],"names":[],"version":3,"file":"location-info.92e70042.js.map"}
@@ -0,0 +1,66 @@
1
+ var $548387e5996cdbbd$exports = require("./header.58c5c012.js");
2
+ require("./main.module.02c4de16.css");
3
+ var $a8d7c4c397e52cf6$exports = require("./main.module.3f2b7c9f.js");
4
+ var $c3311f59335df34d$exports = require("./container.72611900.js");
5
+ var $ah8rZ$macrostrathyper = require("@macrostrat/hyper");
6
+ var $ah8rZ$classnames = require("classnames");
7
+ var $ah8rZ$macrostratuicomponents = require("@macrostrat/ui-components");
8
+
9
+
10
+ function $parcel$interopDefault(a) {
11
+ return a && a.__esModule ? a.default : a;
12
+ }
13
+
14
+ function $parcel$export(e, n, v, s) {
15
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
16
+ }
17
+
18
+ $parcel$export(module.exports, "InfoDrawerContainer", () => $2bc7c1e4e7da7fdf$export$83f9a19cf91c2d06);
19
+ $parcel$export(module.exports, "BaseInfoDrawer", () => $2bc7c1e4e7da7fdf$export$a5ddcc2a88716895);
20
+ $parcel$export(module.exports, "DetailsPanel", () => $2bc7c1e4e7da7fdf$export$e54a7f2505304e20);
21
+ $parcel$export(module.exports, "LocationPanel", () => $2bc7c1e4e7da7fdf$export$aa4baff5242ea6e1);
22
+
23
+
24
+
25
+
26
+
27
+
28
+ const $2bc7c1e4e7da7fdf$var$h = (0, ($parcel$interopDefault($ah8rZ$macrostrathyper))).styled((0, ($parcel$interopDefault($a8d7c4c397e52cf6$exports))));
29
+ function $2bc7c1e4e7da7fdf$export$83f9a19cf91c2d06(props) {
30
+ const className = (0, ($parcel$interopDefault($ah8rZ$classnames)))("infodrawer", props.className);
31
+ return $2bc7c1e4e7da7fdf$var$h((0, $c3311f59335df34d$exports.PanelCard), {
32
+ ...props,
33
+ className: className
34
+ });
35
+ }
36
+ function $2bc7c1e4e7da7fdf$export$a5ddcc2a88716895(props) {
37
+ const { className: className, headerElement: headerElement = null, title: title, onClose: onClose, children: children, ...rest } = props;
38
+ const header = headerElement ?? $2bc7c1e4e7da7fdf$var$h((0, $548387e5996cdbbd$exports.InfoDrawerHeader), {
39
+ onClose: onClose,
40
+ ...rest
41
+ }, [
42
+ title == null ? null : $2bc7c1e4e7da7fdf$var$h("h3", [
43
+ title
44
+ ])
45
+ ]);
46
+ return $2bc7c1e4e7da7fdf$var$h($2bc7c1e4e7da7fdf$export$83f9a19cf91c2d06, {
47
+ className: className
48
+ }, [
49
+ header,
50
+ $2bc7c1e4e7da7fdf$var$h("div.infodrawer-body", $2bc7c1e4e7da7fdf$var$h("div.infodrawer-contents", $2bc7c1e4e7da7fdf$var$h((0, $ah8rZ$macrostratuicomponents.ErrorBoundary), null, children)))
51
+ ]);
52
+ }
53
+ const $2bc7c1e4e7da7fdf$export$e54a7f2505304e20 = $2bc7c1e4e7da7fdf$export$a5ddcc2a88716895;
54
+ function $2bc7c1e4e7da7fdf$export$aa4baff5242ea6e1(props) {
55
+ const { children: children, className: className, loading: loading = false, ...rest } = props;
56
+ const cls = (0, ($parcel$interopDefault($ah8rZ$classnames)))("location-panel", className, {
57
+ loading: loading
58
+ });
59
+ return $2bc7c1e4e7da7fdf$var$h($2bc7c1e4e7da7fdf$export$a5ddcc2a88716895, {
60
+ className: cls,
61
+ ...rest
62
+ }, children);
63
+ }
64
+
65
+
66
+ //# sourceMappingURL=location-panel.c95f5e96.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,0BAAI,CAAA,GAAA,gDAAI,EAAE,MAAM,CAAC,CAAA,GAAA,mDAAK;AAErB,SAAS,0CAAoB,KAAK;IACvC,MAAM,YAAY,CAAA,GAAA,2CAAS,EAAE,cAAc,MAAM,SAAS;IAC1D,OAAO,wBAAE,CAAA,GAAA,mCAAQ,GAAG;QAAE,GAAG,KAAK;mBAAE;IAAU;AAC5C;AASO,SAAS,0CAAe,KAA0B;IACvD,MAAM,aACJ,SAAS,iBACT,gBAAgB,aAChB,KAAK,WACL,OAAO,YACP,QAAQ,EACR,GAAG,MACJ,GAAG;IACJ,MAAM,SACJ,iBACA,wBAAE,CAAA,GAAA,0CAAe,GAAG;iBAAE;QAAS,GAAG,IAAI;IAAC,GAAG;QACxC,SAAS,OAAO,OAAO,wBAAE,MAAM;YAAC;SAAM;KACvC;IACH,OAAO,wBAAE,2CAAqB;mBAAE;IAAU,GAAG;QAC3C;QACA,wBACE,uBACA,wBAAE,2BAA2B,wBAAE,CAAA,GAAA,2CAAY,GAAG,MAAM;KAEvD;AACH;AAEO,MAAM,4CAAe;AAErB,SAAS,0CAAc,KAAK;IACjC,MAAM,YAAE,QAAQ,aAAE,SAAS,WAAE,UAAU,OAAO,GAAG,MAAM,GAAG;IAC1D,MAAM,MAAM,CAAA,GAAA,2CAAS,EAAE,kBAAkB,WAAW;iBAAE;IAAQ;IAC9D,OAAO,wBAAE,2CAAgB;QAAE,WAAW;QAAK,GAAG,IAAI;IAAC,GAAG;AACxD","sources":["packages/map-interface/src/location-panel/index.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport { InfoDrawerHeader, InfoDrawerHeaderProps } from \"./header\";\nimport classNames from \"classnames\";\nimport styles from \"./main.module.sass\";\nimport { ErrorBoundary } from \"@macrostrat/ui-components\";\nimport { PanelCard } from \"../container\";\n\nconst h = hyper.styled(styles);\n\nexport function InfoDrawerContainer(props) {\n const className = classNames(\"infodrawer\", props.className);\n return h(PanelCard, { ...props, className });\n}\n\ninterface BaseInfoDrawerProps extends InfoDrawerHeaderProps {\n className?: string;\n title?: string;\n headerElement?: JSX.Element;\n children?: React.ReactNode;\n}\n\nexport function BaseInfoDrawer(props: BaseInfoDrawerProps) {\n const {\n className,\n headerElement = null,\n title,\n onClose,\n children,\n ...rest\n } = props;\n const header =\n headerElement ??\n h(InfoDrawerHeader, { onClose, ...rest }, [\n title == null ? null : h(\"h3\", [title]),\n ]);\n return h(InfoDrawerContainer, { className }, [\n header,\n h(\n \"div.infodrawer-body\",\n h(\"div.infodrawer-contents\", h(ErrorBoundary, null, children))\n ),\n ]);\n}\n\nexport const DetailsPanel = BaseInfoDrawer;\n\nexport function LocationPanel(props) {\n const { children, className, loading = false, ...rest } = props;\n const cls = classNames(\"location-panel\", className, { loading });\n return h(BaseInfoDrawer, { className: cls, ...rest }, children);\n}\n"],"names":[],"version":3,"file":"location-panel.c95f5e96.js.map"}