@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,268 @@
1
+ var $33088e8384af337c$exports = require("./main.module.ccec47df.js");
2
+ require("./main.module.becc2fe7.css");
3
+ var $750d69d73bfbdc9a$exports = require("./expansion-panel.08532cee.js");
4
+ var $dHcMG$blueprintjscore = require("@blueprintjs/core");
5
+ var $dHcMG$macrostratmapboxreact = require("@macrostrat/mapbox-react");
6
+ var $dHcMG$macrostrathyper = require("@macrostrat/hyper");
7
+ var $dHcMG$react = require("react");
8
+ var $dHcMG$macrostratuicomponents = require("@macrostrat/ui-components");
9
+ var $dHcMG$d3array = require("d3-array");
10
+
11
+
12
+ function $parcel$interopDefault(a) {
13
+ return a && a.__esModule ? a.default : a;
14
+ }
15
+
16
+ function $parcel$export(e, n, v, s) {
17
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
18
+ }
19
+
20
+ $parcel$export(module.exports, "FeatureProperties", () => $db14eb7a5c07abdb$export$2906e7f4b228efe9);
21
+ $parcel$export(module.exports, "FeatureRecord", () => $db14eb7a5c07abdb$export$dc87b4d46cea200d);
22
+ $parcel$export(module.exports, "FeatureSelectionHandler", () => $db14eb7a5c07abdb$export$214daccdda0f4ac6);
23
+ $parcel$export(module.exports, "Features", () => $db14eb7a5c07abdb$export$617d79dae526d2cf);
24
+ $parcel$export(module.exports, "TileInfo", () => $db14eb7a5c07abdb$export$43c75dec9d0b96c);
25
+ $parcel$export(module.exports, "FeaturePanel", () => $db14eb7a5c07abdb$export$43277c51a01761c1);
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+ const $db14eb7a5c07abdb$var$h = (0, ($parcel$interopDefault($dHcMG$macrostrathyper))).styled((0, ($parcel$interopDefault($33088e8384af337c$exports))));
35
+ function $db14eb7a5c07abdb$export$2906e7f4b228efe9({ data: data, ...rest }) {
36
+ // Instead of managing hover state with CSS, we use a state variable,
37
+ // so that the button re-renders when the state changes
38
+ const [showControls, setShowControls] = (0, $dHcMG$react.useState)(false);
39
+ const onMouseEnter = (0, $dHcMG$react.useCallback)(()=>setShowControls(true), []);
40
+ const onMouseLeave = (0, $dHcMG$react.useCallback)(()=>setShowControls(false), []);
41
+ return $db14eb7a5c07abdb$var$h("div.feature-properties", {
42
+ onMouseEnter: onMouseEnter,
43
+ onMouseLeave: onMouseLeave
44
+ }, [
45
+ $db14eb7a5c07abdb$var$h.if(showControls)("div.controls", $db14eb7a5c07abdb$var$h($db14eb7a5c07abdb$var$CopyJSONButton, {
46
+ data: data
47
+ })),
48
+ $db14eb7a5c07abdb$var$h((0, $dHcMG$macrostratuicomponents.JSONView), {
49
+ data: data,
50
+ hideRoot: true,
51
+ ...rest
52
+ })
53
+ ]);
54
+ }
55
+ function $db14eb7a5c07abdb$export$dc87b4d46cea200d({ feature: feature }) {
56
+ const props = feature.properties;
57
+ return $db14eb7a5c07abdb$var$h("div.feature-record", [
58
+ $db14eb7a5c07abdb$var$h.if(Object.keys(props).length > 0)($db14eb7a5c07abdb$export$2906e7f4b228efe9, {
59
+ data: props
60
+ })
61
+ ]);
62
+ }
63
+ function $db14eb7a5c07abdb$var$CopyJSONButton({ data: data }) {
64
+ const [copied, setCopied] = (0, $dHcMG$react.useState)(false);
65
+ return $db14eb7a5c07abdb$var$h((0, $dHcMG$blueprintjscore.Button), {
66
+ icon: copied ? "tick" : "clipboard",
67
+ intent: copied ? (0, $dHcMG$blueprintjscore.Intent).SUCCESS : (0, $dHcMG$blueprintjscore.Intent).NONE,
68
+ minimal: true,
69
+ small: true,
70
+ onClick () {
71
+ navigator.clipboard.writeText(JSON.stringify(data, null, 2));
72
+ setCopied(true);
73
+ }
74
+ });
75
+ }
76
+ function $db14eb7a5c07abdb$export$214daccdda0f4ac6({ selectedLocation: selectedLocation, setFeatures: setFeatures, radius: radius = 2 }) {
77
+ const mapRef = (0, $dHcMG$macrostratmapboxreact.useMapRef)();
78
+ const isLoading = (0, $dHcMG$macrostratmapboxreact.useMapStatus)((s)=>s.isLoading);
79
+ const isInitialized = (0, $dHcMG$macrostratmapboxreact.useMapStatus)((s)=>s.isInitialized);
80
+ const prevLocation = (0, $dHcMG$react.useRef)(null);
81
+ const prevFeatures = (0, $dHcMG$react.useRef)([]);
82
+ (0, $dHcMG$react.useEffect)(()=>{
83
+ const map = mapRef?.current;
84
+ if (map == null) return;
85
+ if (selectedLocation == null) {
86
+ setFeatures(null);
87
+ return;
88
+ }
89
+ if (!isInitialized) return;
90
+ const hasPreviouslyLoadedFeatures = prevFeatures.current.length > 0;
91
+ const locationMemo = JSON.stringify(selectedLocation);
92
+ if (locationMemo == prevLocation.current && hasPreviouslyLoadedFeatures) return;
93
+ prevLocation.current = locationMemo;
94
+ // Don't update if the location hasn't changed
95
+ //if (selectedLocation == prevLocation) return;
96
+ const r = radius;
97
+ const pt = map.project(selectedLocation);
98
+ const bbox = [
99
+ [
100
+ pt.x - r,
101
+ pt.y - r
102
+ ],
103
+ [
104
+ pt.x + r,
105
+ pt.y + r
106
+ ]
107
+ ];
108
+ const features = map.queryRenderedFeatures(bbox);
109
+ prevFeatures.current = features ?? [];
110
+ setFeatures(features);
111
+ }, [
112
+ isInitialized,
113
+ selectedLocation,
114
+ isLoading
115
+ ]);
116
+ return null;
117
+ }
118
+ function $db14eb7a5c07abdb$var$FeatureHeader({ feature: feature }) {
119
+ return $db14eb7a5c07abdb$var$h("div.feature-header", [
120
+ $db14eb7a5c07abdb$var$h("h3", [
121
+ $db14eb7a5c07abdb$var$h($db14eb7a5c07abdb$var$KeyValue, {
122
+ label: "Source",
123
+ value: feature.source
124
+ }),
125
+ $db14eb7a5c07abdb$var$h($db14eb7a5c07abdb$var$KeyValue, {
126
+ label: "Source layer",
127
+ value: feature.sourceLayer
128
+ })
129
+ ])
130
+ ]);
131
+ }
132
+ function $db14eb7a5c07abdb$var$KeyValue({ label: label, value: value }) {
133
+ return $db14eb7a5c07abdb$var$h("span.key-value", [
134
+ $db14eb7a5c07abdb$var$h("span.key", label),
135
+ $db14eb7a5c07abdb$var$h("code.value", value)
136
+ ]);
137
+ }
138
+ function $db14eb7a5c07abdb$var$LoadingAwareFeatureSet({ features: features, sourceID: sourceID }) {
139
+ const map = (0, $dHcMG$macrostratmapboxreact.useMapRef)();
140
+ if (map?.current == null) return null;
141
+ const [isLoaded, setIsLoaded] = (0, $dHcMG$react.useState)(false);
142
+ const sourceFeatures = features.filter((d)=>d.source == "burwell");
143
+ (0, $dHcMG$react.useEffect)(()=>{
144
+ if (sourceFeatures.length > 0) {
145
+ setIsLoaded(true);
146
+ return;
147
+ }
148
+ const isLoaded = map.current.isSourceLoaded(sourceID);
149
+ setIsLoaded(isLoaded);
150
+ if (!isLoaded) map.current.once("sourcedata", (e)=>{
151
+ if (e.sourceId == sourceID) setIsLoaded(true);
152
+ });
153
+ }, [
154
+ map.current,
155
+ sourceID,
156
+ sourceFeatures.length
157
+ ]);
158
+ if (!isLoaded) return $db14eb7a5c07abdb$var$h((0, $dHcMG$blueprintjscore.Spinner));
159
+ return $db14eb7a5c07abdb$var$h($db14eb7a5c07abdb$export$617d79dae526d2cf, {
160
+ features: sourceFeatures
161
+ });
162
+ }
163
+ function $db14eb7a5c07abdb$export$43c75dec9d0b96c({ feature: feature, showExtent: showExtent, setShowExtent: setShowExtent }) {
164
+ if (feature == null) return null;
165
+ const size = feature._vectorTileFeature._pbf.length;
166
+ return $db14eb7a5c07abdb$var$h("div.tile-info", [
167
+ $db14eb7a5c07abdb$var$h("h3", "Tile"),
168
+ $db14eb7a5c07abdb$var$h("div.tile-index", [
169
+ $db14eb7a5c07abdb$var$h($db14eb7a5c07abdb$var$KeyValue, {
170
+ label: "x",
171
+ value: feature._x
172
+ }),
173
+ $db14eb7a5c07abdb$var$h($db14eb7a5c07abdb$var$KeyValue, {
174
+ label: "y",
175
+ value: feature._y
176
+ }),
177
+ $db14eb7a5c07abdb$var$h($db14eb7a5c07abdb$var$KeyValue, {
178
+ label: "z",
179
+ value: feature._z
180
+ })
181
+ ]),
182
+ $db14eb7a5c07abdb$var$h("div.spacer"),
183
+ $db14eb7a5c07abdb$var$h($db14eb7a5c07abdb$var$KeyValue, {
184
+ label: "Size",
185
+ value: $db14eb7a5c07abdb$var$formatSize(size)
186
+ }),
187
+ $db14eb7a5c07abdb$var$h((0, $dHcMG$blueprintjscore.Switch), {
188
+ label: "Show extent",
189
+ alignIndicator: "right",
190
+ checked: showExtent,
191
+ onChange () {
192
+ setShowExtent(!showExtent);
193
+ }
194
+ })
195
+ ]);
196
+ }
197
+ function $db14eb7a5c07abdb$var$formatSize(size) {
198
+ if (size > 1000000) return $db14eb7a5c07abdb$var$h($db14eb7a5c07abdb$var$UnitNumber, {
199
+ value: size / 1000000,
200
+ unit: "Mb"
201
+ });
202
+ if (size > 1000) return $db14eb7a5c07abdb$var$h($db14eb7a5c07abdb$var$UnitNumber, {
203
+ value: size / 1000,
204
+ unit: "Kb"
205
+ });
206
+ return `${size} bytes`;
207
+ }
208
+ function $db14eb7a5c07abdb$var$UnitNumber({ value: value, unit: unit, precision: precision = 1 }) {
209
+ return $db14eb7a5c07abdb$var$h("span.unit-number", [
210
+ $db14eb7a5c07abdb$var$h("span.number", value.toFixed(precision)),
211
+ $db14eb7a5c07abdb$var$h("span.unit", unit)
212
+ ]);
213
+ }
214
+ function $db14eb7a5c07abdb$export$43277c51a01761c1({ features: features, focusedSource: focusedSource = null }) {
215
+ if (features == null) return null;
216
+ let focusedSourcePanel = null;
217
+ let filteredFeatures = features;
218
+ let title = "Features";
219
+ if (focusedSource != null) {
220
+ title = "Basemap features";
221
+ focusedSourcePanel = $db14eb7a5c07abdb$var$h((0, $750d69d73bfbdc9a$exports.ExpansionPanel), {
222
+ title: "Macrostrat features",
223
+ className: "macrostrat-features",
224
+ expanded: true
225
+ }, [
226
+ $db14eb7a5c07abdb$var$h($db14eb7a5c07abdb$var$LoadingAwareFeatureSet, {
227
+ features: features,
228
+ sourceID: focusedSource
229
+ })
230
+ ]);
231
+ filteredFeatures = features.filter((d)=>d.source != focusedSource);
232
+ }
233
+ return $db14eb7a5c07abdb$var$h("div.feature-panel", [
234
+ focusedSourcePanel,
235
+ $db14eb7a5c07abdb$var$h((0, $750d69d73bfbdc9a$exports.ExpansionPanel), {
236
+ title: title,
237
+ className: "basemap-features",
238
+ expanded: focusedSource == null
239
+ }, [
240
+ $db14eb7a5c07abdb$var$h($db14eb7a5c07abdb$var$FeatureGroups, {
241
+ features: filteredFeatures
242
+ })
243
+ ])
244
+ ]);
245
+ }
246
+ function $db14eb7a5c07abdb$var$FeatureGroups({ features: features }) {
247
+ /** Group features by source and sourceLayer */ if (features == null) return null;
248
+ const groups = (0, $dHcMG$d3array.group)(features, (d)=>`${d.source} - ${d.sourceLayer}`);
249
+ return $db14eb7a5c07abdb$var$h("div.feature-groups", Array.from(groups).map(([key, features])=>{
250
+ return $db14eb7a5c07abdb$var$h("div.feature-group", [
251
+ $db14eb7a5c07abdb$var$h($db14eb7a5c07abdb$var$FeatureHeader, {
252
+ feature: features[0]
253
+ }),
254
+ $db14eb7a5c07abdb$var$h($db14eb7a5c07abdb$export$617d79dae526d2cf, {
255
+ features: features
256
+ })
257
+ ]);
258
+ }));
259
+ }
260
+ function $db14eb7a5c07abdb$export$617d79dae526d2cf({ features: features }) {
261
+ return $db14eb7a5c07abdb$var$h("div.features", features.map((feature, i)=>$db14eb7a5c07abdb$var$h($db14eb7a5c07abdb$export$dc87b4d46cea200d, {
262
+ key: i,
263
+ feature: feature
264
+ })));
265
+ }
266
+
267
+
268
+ //# sourceMappingURL=vector-tile-features.456f887b.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,0BAAI,CAAA,GAAA,gDAAI,EAAE,MAAM,CAAC,CAAA,GAAA,mDAAK;AAErB,SAAS,0CAAkB,QAAE,IAAI,EAAE,GAAG,MAAM;IACjD,qEAAqE;IACrE,uDAAuD;IACvD,MAAM,CAAC,cAAc,gBAAgB,GAAG,CAAA,GAAA,qBAAO,EAAE;IACjD,MAAM,eAAe,CAAA,GAAA,wBAAU,EAAE,IAAM,gBAAgB,OAAO,EAAE;IAChE,MAAM,eAAe,CAAA,GAAA,wBAAU,EAAE,IAAM,gBAAgB,QAAQ,EAAE;IAEjE,OAAO,wBAAE,0BAA0B;sBAAE;sBAAc;IAAa,GAAG;QACjE,wBAAE,EAAE,CAAC,cAAc,gBAAgB,wBAAE,sCAAgB;kBAAE;QAAK;QAC5D,wBAAE,CAAA,GAAA,sCAA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inner, 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({ features, focusedSource = null }) {\n if (features == null) return null;\n\n let focusedSourcePanel = null;\n let filteredFeatures = features;\n let title = \"Features\";\n\n if (focusedSource != null) {\n title = \"Basemap features\";\n focusedSourcePanel = h(\n ExpansionPanel,\n {\n title: \"Macrostrat features\",\n className: \"macrostrat-features\",\n expanded: true,\n },\n [\n h(LoadingAwareFeatureSet, {\n features,\n sourceID: focusedSource,\n }),\n ]\n );\n filteredFeatures = features.filter((d) => d.source != focusedSource);\n }\n\n return h(\"div.feature-panel\", [\n focusedSourcePanel,\n h(\n ExpansionPanel,\n { title, className: \"basemap-features\", expanded: focusedSource == null },\n [\n h(FeatureGroups, {\n features: filteredFeatures,\n }),\n ]\n ),\n ]);\n}\n\nfunction FeatureGroups({ features }) {\n /** Group features by source and sourceLayer */\n if (features == null) return null;\n\n const groups = group(features, (d) => `${d.source} - ${d.sourceLayer}`);\n\n return h(\n \"div.feature-groups\",\n Array.from(groups).map(([key, features]) => {\n return h(\"div.feature-group\", [\n h(FeatureHeader, { feature: features[0] }),\n h(Features, { features }),\n ]);\n })\n );\n}\n\nexport function Features({ features }) {\n return h(\n \"div.features\",\n features.map((feature, i) => h(FeatureRecord, { key: i, feature }))\n );\n}\n"],"names":[],"version":3,"file":"vector-tile-features.456f887b.js.map"}
@@ -0,0 +1,89 @@
1
+ var $aGB2m$macrostratmapboxutils = require("@macrostrat/mapbox-utils");
2
+ var $aGB2m$macrostratcolorutils = require("@macrostrat/color-utils");
3
+
4
+
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
+ }
8
+
9
+ $parcel$export(module.exports, "buildXRayStyle", () => $8646508ae99a5857$export$eff5fb2e10d05b1d);
10
+ $parcel$export(module.exports, "buildInspectorStyle", () => $8646508ae99a5857$export$e739dc8dfc0db9a6);
11
+
12
+
13
+ async function $8646508ae99a5857$export$eff5fb2e10d05b1d(baseStyle, params = null) {
14
+ const { inDarkMode: inDarkMode = false, color: color = "rgb(74, 242, 161)", mapboxToken: mapboxToken, xRaySources: xRaySources } = params;
15
+ const style = await (0, $aGB2m$macrostratmapboxutils.getMapboxStyle)(baseStyle, {
16
+ access_token: mapboxToken
17
+ });
18
+ const sources = xRaySources ?? Object.keys(style.sources);
19
+ let layers = [];
20
+ for (let layer of style.layers){
21
+ if (!sources.includes(layer.source)) {
22
+ layers.push(layer);
23
+ continue;
24
+ }
25
+ let newLayer = $8646508ae99a5857$var$transformMapboxLayer(layer, color, inDarkMode);
26
+ if (newLayer != null) layers.push(newLayer);
27
+ }
28
+ return {
29
+ ...style,
30
+ layers: layers
31
+ };
32
+ }
33
+ function $8646508ae99a5857$var$transformMapboxLayer(layer, color, inDarkMode) {
34
+ const c = (0, $aGB2m$macrostratcolorutils.asChromaColor)(color);
35
+ const xRayColor = (opacity = 1, darken = 0)=>{
36
+ if (!inDarkMode) return (0, $aGB2m$macrostratcolorutils.toRGBAString)(c.darken(2 - darken).alpha(opacity));
37
+ return (0, $aGB2m$macrostratcolorutils.toRGBAString)(c.alpha(opacity).darken(darken));
38
+ };
39
+ if (layer.type == "background") return null;
40
+ let newLayer = {
41
+ ...layer
42
+ };
43
+ console.log(xRayColor(0.5));
44
+ if (layer.type == "fill") newLayer.paint = {
45
+ "fill-color": xRayColor(0.1),
46
+ "fill-outline-color": xRayColor(0.5)
47
+ };
48
+ else if (layer.type == "line") newLayer.paint = {
49
+ "line-color": xRayColor(0.5, 0),
50
+ "line-width": 1.5
51
+ };
52
+ else if (layer.type == "symbol") newLayer.paint = {
53
+ "text-color": xRayColor(1, -0.5),
54
+ "text-halo-color": "#000"
55
+ };
56
+ else if (layer.type == "circle") newLayer.paint = {
57
+ "circle-color": xRayColor(0.5, 0),
58
+ "circle-stroke-color": xRayColor(0.5, 1),
59
+ "circle-radius": 2
60
+ };
61
+ return newLayer;
62
+ }
63
+ async function $8646508ae99a5857$export$e739dc8dfc0db9a6(baseStyle, overlayStyle = null, params = {}) {
64
+ const { mapboxToken: mapboxToken, xRay: xRay = false, xRaySources: _xRaySources, ...rest } = params;
65
+ let xRaySources = _xRaySources;
66
+ let style = await (0, $aGB2m$macrostratmapboxutils.getMapboxStyle)(baseStyle, {
67
+ access_token: mapboxToken
68
+ });
69
+ if (overlayStyle != null) {
70
+ const overlay = await (0, $aGB2m$macrostratmapboxutils.getMapboxStyle)(overlayStyle, {
71
+ access_token: mapboxToken
72
+ });
73
+ style = (0, $aGB2m$macrostratmapboxutils.mergeStyles)(style, overlay);
74
+ xRaySources ??= Object.keys(overlay.sources);
75
+ }
76
+ if (xRay) {
77
+ // If we haven't specified sources, then we'll use all of them
78
+ xRaySources ??= Object.keys(style.sources);
79
+ style = await $8646508ae99a5857$export$eff5fb2e10d05b1d(style, {
80
+ ...rest,
81
+ mapboxToken: mapboxToken,
82
+ xRaySources: xRaySources
83
+ });
84
+ }
85
+ return style;
86
+ }
87
+
88
+
89
+ //# sourceMappingURL=xray.a23f8660.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;AAWO,eAAe,0CACpB,SAA0B,EAC1B,SAAsB,IAAI;IAE1B,MAAM,cACJ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AI,UACvB,SAAS,KAAK,GAAG;QACf,gBAAgB,UAAU,KAAK;QAC/B,uBAAuB,UAAU,KAAK;QACtC,iBAAiB;IACnB;IAGF,OAAO;AACT;AAMO,eAAe,0CACpB,SAAkC,EAClC,eAA+C,IAAI,EACnD,SAAgC,CAAC,CAAC;IAElC,MAAM,eACJ,WAAW,QACX,OAAO,OACP,aAAa,YAAY,EACzB,GAAG,MACJ,GAAG;IACJ,IAAI,cAAc;IAClB,IAAI,QAAQ,MAAM,CAAA,GAAA,2CAAa,EAAE,WAAW;QAC1C,cAAc;IAChB;IAEA,IAAI,gBAAgB,MAAM;QACxB,MAAM,UAAU,MAAM,CAAA,GAAA,2CAAa,EAAE,cAAc;YACjD,cAAc;QAChB;QACA,QAAQ,CAAA,GAAA,wCAAU,EAAE,OAAO;QAC3B,gBAAgB,OAAO,IAAI,CAAC,QAAQ,OAAO;IAC7C;IAEA,IAAI,MAAM;QACR,8DAA8D;QAC9D,gBAAgB,OAAO,IAAI,CAAC,MAAM,OAAO;QAEzC,QAAQ,MAAM,0CAAe,OAAO;YAAE,GAAG,IAAI;yBAAE;yBAAa;QAAY;IAC1E;IACA,OAAO;AACT","sources":["packages/map-interface/src/dev/xray.ts"],"sourcesContent":["import { getMapboxStyle, mergeStyles } from \"@macrostrat/mapbox-utils\";\nimport { asChromaColor, toRGBAString } from \"@macrostrat/color-utils\";\nimport mapboxgl from \"mapbox-gl\";\n\ninterface XRayOptions {\n color?: string;\n inDarkMode?: boolean;\n mapboxToken?: string;\n xRaySources?: string[];\n}\n\nexport async function buildXRayStyle(\n baseStyle: string | object,\n params: XRayOptions = null\n) {\n const {\n inDarkMode = false,\n color = \"rgb(74, 242, 161)\",\n mapboxToken,\n xRaySources,\n } = params;\n const style = await getMapboxStyle(baseStyle, { access_token: mapboxToken });\n const sources = xRaySources ?? Object.keys(style.sources);\n\n let layers = [];\n for (let layer of style.layers) {\n if (!sources.includes(layer.source)) {\n layers.push(layer);\n continue;\n }\n let newLayer = transformMapboxLayer(layer, color, inDarkMode);\n if (newLayer != null) {\n layers.push(newLayer);\n }\n }\n\n return {\n ...style,\n layers,\n };\n}\n\nfunction transformMapboxLayer(layer, color, inDarkMode) {\n const c = asChromaColor(color);\n const xRayColor = (opacity = 1, darken = 0) => {\n if (!inDarkMode) {\n return toRGBAString(c.darken(2 - darken).alpha(opacity));\n }\n return toRGBAString(c.alpha(opacity).darken(darken));\n };\n\n if (layer.type == \"background\") {\n return null;\n }\n\n let newLayer = { ...layer };\n\n console.log(xRayColor(0.5));\n\n if (layer.type == \"fill\") {\n newLayer.paint = {\n \"fill-color\": xRayColor(0.1),\n \"fill-outline-color\": xRayColor(0.5),\n };\n } else if (layer.type == \"line\") {\n newLayer.paint = {\n \"line-color\": xRayColor(0.5, 0),\n \"line-width\": 1.5,\n };\n } else if (layer.type == \"symbol\") {\n newLayer.paint = {\n \"text-color\": xRayColor(1, -0.5),\n \"text-halo-color\": \"#000\",\n };\n } else if (layer.type == \"circle\") {\n newLayer.paint = {\n \"circle-color\": xRayColor(0.5, 0),\n \"circle-stroke-color\": xRayColor(0.5, 1),\n \"circle-radius\": 2,\n };\n }\n\n return newLayer;\n}\n\ntype InspectorStyleOptions = XRayOptions & {\n xRay?: boolean;\n};\n\nexport async function buildInspectorStyle(\n baseStyle: mapboxgl.Style | string,\n overlayStyle: mapboxgl.Style | string | null = null,\n params: InspectorStyleOptions = {}\n) {\n const {\n mapboxToken,\n xRay = false,\n xRaySources: _xRaySources,\n ...rest\n } = params;\n let xRaySources = _xRaySources;\n let style = await getMapboxStyle(baseStyle, {\n access_token: mapboxToken,\n });\n\n if (overlayStyle != null) {\n const overlay = await getMapboxStyle(overlayStyle, {\n access_token: mapboxToken,\n });\n style = mergeStyles(style, overlay);\n xRaySources ??= Object.keys(overlay.sources);\n }\n\n if (xRay) {\n // If we haven't specified sources, then we'll use all of them\n xRaySources ??= Object.keys(style.sources);\n\n style = await buildXRayStyle(style, { ...rest, mapboxToken, xRaySources });\n }\n return style;\n}\n"],"names":[],"version":3,"file":"xray.a23f8660.js.map"}
@@ -0,0 +1,126 @@
1
+ import $gPxI6$mainmodulef70e002bjs from "./main.module.f70e002b.js";
2
+ import "../cjs/main.module.f085a193.css";
3
+ import {MapBottomControls as $91d5aa004eeb2226$export$db1a2e058a06fb5c} from "./controls.f757ce16.js";
4
+ import $gPxI6$macrostrathyper, {addClassNames as $gPxI6$addClassNames} from "@macrostrat/hyper";
5
+ import $gPxI6$classnames from "classnames";
6
+ import {useTransition as $gPxI6$useTransition} from "transition-hook";
7
+ import {ZoomControl as $gPxI6$ZoomControl, MapboxMapProvider as $gPxI6$MapboxMapProvider, useMapPosition as $gPxI6$useMapPosition} from "@macrostrat/mapbox-react";
8
+ import {ToasterContext as $gPxI6$ToasterContext} from "@macrostrat/ui-components";
9
+ import {mapViewInfo as $gPxI6$mapViewInfo} from "@macrostrat/mapbox-utils";
10
+ import {Card as $gPxI6$Card} from "@blueprintjs/core";
11
+
12
+
13
+ function $parcel$interopDefault(a) {
14
+ return a && a.__esModule ? a.default : a;
15
+ }
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+ const $4bdfa9cd8240b2fd$var$h = (0, $gPxI6$macrostrathyper).styled((0, ($parcel$interopDefault($gPxI6$mainmodulef70e002bjs))));
26
+ const $4bdfa9cd8240b2fd$export$ec68dd77edbe678b = (props)=>$4bdfa9cd8240b2fd$var$h((0, $gPxI6$Card), {
27
+ ...props,
28
+ className: (0, $gPxI6$classnames)("panel-card", props.className)
29
+ });
30
+ var $4bdfa9cd8240b2fd$export$612ca936d3ed4784 = /*#__PURE__*/ function(DetailPanelStyle) {
31
+ DetailPanelStyle["FIXED"] = "fixed";
32
+ DetailPanelStyle["FLOATING"] = "floating";
33
+ return DetailPanelStyle;
34
+ }({});
35
+ const $4bdfa9cd8240b2fd$export$9fa5da0bcfd0a290 = (props)=>$4bdfa9cd8240b2fd$var$h($4bdfa9cd8240b2fd$var$MapProviders, $4bdfa9cd8240b2fd$var$h($4bdfa9cd8240b2fd$var$_MapAreaContainer, props));
36
+ function $4bdfa9cd8240b2fd$var$_MapAreaContainer({ children: children, className: className, navbar: navbar, contextPanel: contextPanel = null, detailPanel: detailPanel = null, detailPanelOpen: detailPanelOpen, contextPanelOpen: contextPanelOpen = true, bottomPanel: bottomPanel = null, mainPanel: mainPanel, mapControls: mapControls = $4bdfa9cd8240b2fd$var$h((0, $91d5aa004eeb2226$export$db1a2e058a06fb5c)), contextStackProps: contextStackProps = null, detailStackProps: detailStackProps = null, detailPanelStyle: detailPanelStyle = "floating", fitViewport: fitViewport = true, showPanelOutlines: showPanelOutlines = false, preventMapInteraction: preventMapInteraction = false, ...rest }) {
37
+ const _detailPanelOpen = detailPanelOpen ?? detailPanel != null;
38
+ const contextPanelTrans = (0, $gPxI6$useTransition)(contextPanelOpen, 800);
39
+ const detailPanelTrans = (0, $gPxI6$useTransition)(_detailPanelOpen, 800);
40
+ /*- We apply a custom style to the panel container when we are interacting
41
+ with the search bar, so that we can block map interactions until search
42
+ bar focus is lost.
43
+ - We also apply a custom style when the infodrawer is open so we can hide
44
+ the search bar on mobile platforms
45
+ - These styles are doubly applied so we can have both namespaced and
46
+ outside-accessible styles for each case.
47
+ */ const mainUIClassNames = (0, $gPxI6$classnames)("map-container", className, `detail-panel-${detailPanelStyle}`, `context-panel-${contextPanelTrans.stage}`, `map-context-${contextPanelTrans.stage}`, `detail-panel-${detailPanelTrans.stage}`, `map-detail-${detailPanelTrans.stage}`, {
48
+ "detail-panel-open": _detailPanelOpen,
49
+ "map-context-open": contextPanelOpen,
50
+ "show-panel-outlines": showPanelOutlines,
51
+ "fit-viewport": fitViewport
52
+ });
53
+ const mapControlsExt = $4bdfa9cd8240b2fd$var$h([
54
+ $4bdfa9cd8240b2fd$var$h((0, $gPxI6$ZoomControl), {
55
+ className: "zoom-control"
56
+ }),
57
+ $4bdfa9cd8240b2fd$var$h("div.spacer"),
58
+ mapControls
59
+ ]);
60
+ const detailStackExt = $4bdfa9cd8240b2fd$var$h("div.detail-stack.infodrawer-container", detailStackProps, [
61
+ $4bdfa9cd8240b2fd$var$h("div.detail-panel-holder", null, detailPanel),
62
+ $4bdfa9cd8240b2fd$var$h.if(detailPanelStyle == "floating")([
63
+ mapControlsExt
64
+ ])
65
+ ]);
66
+ let contextStack = null;
67
+ if (navbar != null && contextPanel != null) contextStack = $4bdfa9cd8240b2fd$var$h($4bdfa9cd8240b2fd$var$ContextStack, {
68
+ navbar: navbar,
69
+ ...contextStackProps
70
+ }, [
71
+ $4bdfa9cd8240b2fd$var$h.if(contextPanelTrans.shouldMount)([
72
+ contextPanel
73
+ ])
74
+ ]);
75
+ return $4bdfa9cd8240b2fd$var$h($4bdfa9cd8240b2fd$export$fa395a37c3898ae3, {
76
+ className: mainUIClassNames
77
+ }, [
78
+ $4bdfa9cd8240b2fd$var$h("div.main-row", [
79
+ $4bdfa9cd8240b2fd$var$h("div.map-ui", {
80
+ ...rest
81
+ }, [
82
+ contextStack,
83
+ //h(MapView),
84
+ children ?? mainPanel,
85
+ $4bdfa9cd8240b2fd$var$h.if(detailPanelStyle == "floating")([
86
+ detailStackExt
87
+ ]),
88
+ $4bdfa9cd8240b2fd$var$h.if(detailPanelStyle == "fixed")("div.map-control-stack", mapControlsExt)
89
+ ]),
90
+ $4bdfa9cd8240b2fd$var$h.if(detailPanelStyle == "fixed")([
91
+ detailStackExt
92
+ ])
93
+ ]),
94
+ $4bdfa9cd8240b2fd$var$h("div.bottom", null, bottomPanel)
95
+ ]);
96
+ }
97
+ function $4bdfa9cd8240b2fd$var$ContextStack(props) {
98
+ const { adaptiveWidth: adaptiveWidth, navbar: navbar, children: children, ...rest } = props;
99
+ const props1 = (0, $gPxI6$addClassNames)(rest, {
100
+ "adaptive-width": adaptiveWidth
101
+ });
102
+ return $4bdfa9cd8240b2fd$var$h("div.context-stack", props1, [
103
+ navbar,
104
+ $4bdfa9cd8240b2fd$var$h("div.context-panel-holder", null, children),
105
+ $4bdfa9cd8240b2fd$var$h("div.spacer")
106
+ ]);
107
+ }
108
+ const $4bdfa9cd8240b2fd$var$MapProviders = ({ children: children })=>$4bdfa9cd8240b2fd$var$h((0, $gPxI6$ToasterContext), $4bdfa9cd8240b2fd$var$h((0, $gPxI6$MapboxMapProvider), children));
109
+ function $4bdfa9cd8240b2fd$export$fa395a37c3898ae3({ className: className, children: children }) {
110
+ const mapPosition = (0, $gPxI6$useMapPosition)();
111
+ if (mapPosition != null) {
112
+ const { mapIsRotated: mapIsRotated, mapUse3D: mapUse3D, mapIsGlobal: mapIsGlobal } = (0, $gPxI6$mapViewInfo)(mapPosition);
113
+ className = (0, $gPxI6$classnames)(className, {
114
+ "map-is-rotated": mapIsRotated,
115
+ "map-3d-available": mapUse3D,
116
+ "map-is-global": mapIsGlobal
117
+ });
118
+ }
119
+ return $4bdfa9cd8240b2fd$var$h("div", {
120
+ className: className
121
+ }, children);
122
+ } //const _MapPage = compose(HotkeysProvider, MapPage);
123
+
124
+
125
+ export {$4bdfa9cd8240b2fd$export$ec68dd77edbe678b as PanelCard, $4bdfa9cd8240b2fd$export$612ca936d3ed4784 as DetailPanelStyle, $4bdfa9cd8240b2fd$export$9fa5da0bcfd0a290 as MapAreaContainer, $4bdfa9cd8240b2fd$export$fa395a37c3898ae3 as MapStyledContainer};
126
+ //# sourceMappingURL=container.16bde261.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiBA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,sEAAK;AAIrB,MAAM,4CAAY,CAAC,QACxB,wBAAE,CAAA,GAAA,WAAG,GAAG;QAAE,GAAG,KAAK;QAAE,WAAW,CAAA,GAAA,iBAAS,EAAE,cAAc,MAAM,SAAS;IAAE;AAOpE,IAAA,AAAK,mEAAA;;;WAAA;;AAKL,MAAM,4CAAmB,CAAC,QAC/B,wBAAE,oCAAc,wBAAE,yCAAmB;AAsBvC,SAAS,wCAAk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AChB,wBAAE,cAAc;gBAAE,GAAG,IAAI;YAAC,GAAG;gBAC3B;gBACA,aAAa;gBACb,YAAY;gBACZ,wBAAE,EAAE,CAAC,gCAA+C;oBAAC;iBAAe;gBACpE,wBAAE,EAAE,CAAC,6BACH,yBACA;aAEH;YACD,wBAAE,EAAE,CAAC,6BAA4C;gBAAC;aAAe;SAClE;QACD,wBAAE,cAAc,MAAM;KACvB;AACH;AAEA,SAAS,mCAAa,KAAwB;IAC5C,MAAM,iBAAE,aAAa,UAAE,MAAM,YAAE,QAAQ,EAAE,GAAG,MAAM,GAAG;IACrD,MAAM,SAAS,CAAA,GAAA,oBAAY,EAAE,MAAM;QAAE,kBAAkB;IAAc;IACrE,OAAO,wBAAE,qBAAqB,QAAQ;QACpC;QACA,wBAAE,4BAA4B,MAAM;QACpC,wBAAE;KACH;AACH;AAEA,MAAM,qCAAe,CAAC,YAAE,QAAQ,EAAE,GAChC,wBAAE,CAAA,GAAA,qBAAa,GAAG,wBAAE,CAAA,GAAA,wBAAgB,GAAG;AAOlC,SAAS,0CAAmB,aAAE,SAAS,YAAE,QAAQ,EAAqB;IAC3E,MAAM,cAAc,CAAA,GAAA,qBAAa;IACjC,IAAI,eAAe,MAAM;QACvB,MAAM,gBAAE,YAAY,YAAE,QAAQ,eAAE,WAAW,EAAE,GAAG,CAAA,GAAA,kBAAU,EAAE;QAC5D,YAAY,CAAA,GAAA,iBAAS,EAAE,WAAW;YAChC,kBAAkB;YAClB,oBAAoB;YACpB,iBAAiB;QACnB;IACF;IAEA,OAAO,wBAAE,OAAO;mBAAE;IAAU,GAAG;AACjC,EAEA,qDAAqD","sources":["packages/map-interface/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":[],"version":3,"file":"container.16bde261.js.map"}
@@ -0,0 +1,81 @@
1
+ import "../cjs/main.module.92978d8b.css";
2
+ import $9qPq1$mainmodule9c57cc95js from "./main.module.9c57cc95.js";
3
+ import {Spinner as $9qPq1$Spinner, Button as $9qPq1$Button, Text as $9qPq1$Text, Navbar as $9qPq1$Navbar, Card as $9qPq1$Card} from "@blueprintjs/core";
4
+ import $9qPq1$macrostrathyper from "@macrostrat/hyper";
5
+ import {useMapStatus as $9qPq1$useMapStatus} from "@macrostrat/mapbox-react";
6
+ import {Spacer as $9qPq1$Spacer} from "@macrostrat/ui-components";
7
+
8
+
9
+ function $parcel$interopDefault(a) {
10
+ return a && a.__esModule ? a.default : a;
11
+ }
12
+
13
+
14
+
15
+
16
+
17
+ const $6e914c81c8e053da$var$h = (0, $9qPq1$macrostrathyper).styled((0, ($parcel$interopDefault($9qPq1$mainmodule9c57cc95js))));
18
+ const $6e914c81c8e053da$var$spinnerElement = $6e914c81c8e053da$var$h((0, $9qPq1$Spinner), {
19
+ size: 16
20
+ });
21
+ function $6e914c81c8e053da$export$4ec83e90d030b2f3({ isLoading: isLoading = false, onClick: onClick, active: active = false, large: large = true, icon: icon = "menu", style: style }) {
22
+ return $6e914c81c8e053da$var$h((0, $9qPq1$Button), {
23
+ className: "loading-button",
24
+ icon: isLoading ? $6e914c81c8e053da$var$spinnerElement : icon,
25
+ large: large,
26
+ minimal: true,
27
+ onClick: onClick,
28
+ active: active && !isLoading,
29
+ style: style
30
+ });
31
+ }
32
+ function $6e914c81c8e053da$export$9e3bae3c08bde368(props) {
33
+ const isLoading = (0, $9qPq1$useMapStatus)((s)=>s.isLoading);
34
+ return $6e914c81c8e053da$var$h($6e914c81c8e053da$export$4ec83e90d030b2f3, {
35
+ ...props,
36
+ isLoading: isLoading
37
+ });
38
+ }
39
+ function $6e914c81c8e053da$export$a8cc0062d02a3841({ className: className, children: children, headerElement: headerElement = null, title: title = null, statusElement: statusElement = null, rightElement: rightElement = null, height: height, width: width, style: style = {} }) {
40
+ let _rightElement = null;
41
+ if (rightElement != null) _rightElement = $6e914c81c8e053da$var$h("div.right-element", rightElement);
42
+ let _headerElement = headerElement;
43
+ if (title != null && _headerElement == null) {
44
+ if (typeof title === "string") _headerElement = $6e914c81c8e053da$var$h((0, $9qPq1$Text), {
45
+ tagName: "h2",
46
+ ellipsize: true
47
+ }, title);
48
+ else _headerElement = title;
49
+ }
50
+ if (_headerElement != null) _headerElement = $6e914c81c8e053da$var$h([
51
+ _headerElement,
52
+ $6e914c81c8e053da$var$h((0, $9qPq1$Spacer))
53
+ ]);
54
+ return $6e914c81c8e053da$var$h("div.searchbar-holder", {
55
+ className: className,
56
+ style: {
57
+ width: width
58
+ }
59
+ }, [
60
+ $6e914c81c8e053da$var$h("div.navbar-holder", [
61
+ $6e914c81c8e053da$var$h((0, $9qPq1$Navbar), {
62
+ className: "searchbar navbar panel",
63
+ style: {
64
+ height: height,
65
+ ...style
66
+ }
67
+ }, [
68
+ _headerElement,
69
+ children,
70
+ _rightElement
71
+ ])
72
+ ]),
73
+ $6e914c81c8e053da$var$h.if(statusElement != null)((0, $9qPq1$Card), {
74
+ className: "status-tongue"
75
+ }, statusElement)
76
+ ]);
77
+ }
78
+
79
+
80
+ export {$6e914c81c8e053da$export$4ec83e90d030b2f3 as LoadingButton, $6e914c81c8e053da$export$9e3bae3c08bde368 as Map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GAAG;QAChE,wBAAE,qBAAqB;YACrB,wBACE,CAAA,GAAA,aAAK,GACL;gBACE,WAAW;gBACX,OAAO;4BAAE;oBAAQ,GAAG,KAAK;gBAAC;YAC5B,GACA;gBAAC;gBAAgB;gBAAU;aAAc;SAE5C;QACD,wBAAE,EAAE,CAAC,iBAAiB,MACpB,CAAA,GAAA,WAAG,GACH;YAAE,WAAW;QAAgB,GAC7B;KAEH;AACH","sources":["packages/map-interface/src/context-panel/index.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport { Navbar, Button, Spinner, Card, Text } from \"@blueprintjs/core\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { useMapStatus } from \"@macrostrat/mapbox-react\";\nimport { Spacer } from \"@macrostrat/ui-components\";\n\nconst h = hyper.styled(styles);\n\nconst spinnerElement = h(Spinner, { size: 16 });\n\nexport function LoadingButton({\n isLoading = false,\n onClick,\n active = false,\n large = true,\n icon = \"menu\",\n style,\n}) {\n return h(Button, {\n className: \"loading-button\",\n icon: isLoading ? spinnerElement : icon,\n large,\n minimal: true,\n onClick,\n active: active && !isLoading,\n style,\n });\n}\n\nexport function MapLoadingButton(props) {\n const isLoading = useMapStatus((s) => s.isLoading);\n return h(LoadingButton, { ...props, isLoading });\n}\n\ntype AnyChildren = React.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: React.ReactNode | null = null;\n if (rightElement != null) {\n _rightElement = h(\"div.right-element\", rightElement);\n }\n\n let _headerElement: React.ReactNode | null = headerElement;\n if (title != null && _headerElement == null) {\n if (typeof title === \"string\") {\n _headerElement = h(Text, { tagName: \"h2\", ellipsize: true }, title);\n } else {\n _headerElement = title;\n }\n }\n\n if (_headerElement != null) {\n _headerElement = h([_headerElement, h(Spacer)]);\n }\n\n return h(\"div.searchbar-holder\", { className, style: { width } }, [\n h(\"div.navbar-holder\", [\n h(\n Navbar,\n {\n className: \"searchbar navbar panel\",\n style: { height, ...style },\n },\n [_headerElement, children, _rightElement]\n ),\n ]),\n h.if(statusElement != null)(\n Card,\n { className: \"status-tongue\" },\n statusElement\n ),\n ]);\n}\n"],"names":[],"version":3,"file":"context-panel.c288c5cd.js.map"}