@macrostrat/column-views 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/esm/_shared.f7eec55a.js +9 -0
- package/dist/esm/_shared.f7eec55a.js.map +1 -0
- package/dist/esm/age-axis.4a8cf5e6.js +98 -0
- package/dist/esm/age-axis.4a8cf5e6.js.map +1 -0
- package/dist/esm/age-axis.module.03773a80.css +33 -0
- package/dist/esm/age-axis.module.03773a80.css.map +1 -0
- package/dist/esm/age-axis.module.3cc91335.js +22 -0
- package/dist/esm/age-axis.module.3cc91335.js.map +1 -0
- package/dist/esm/age-model-overlay.c7226855.js +57 -0
- package/dist/esm/age-model-overlay.c7226855.js.map +1 -0
- package/dist/esm/age-model-overlay.module.5d9e78fb.css +14 -0
- package/dist/esm/age-model-overlay.module.5d9e78fb.css.map +1 -0
- package/dist/esm/age-model-overlay.module.cd985dcb.js +16 -0
- package/dist/esm/age-model-overlay.module.cd985dcb.js.map +1 -0
- package/dist/esm/base.910b80b4.js +288 -0
- package/dist/esm/base.910b80b4.js.map +1 -0
- package/dist/esm/boxes.8292cff2.js +258 -0
- package/dist/esm/boxes.8292cff2.js.map +1 -0
- package/dist/esm/boxes.module.2b5fb18e.css +26 -0
- package/dist/esm/boxes.module.2b5fb18e.css.map +1 -0
- package/dist/esm/boxes.module.4ebc7796.js +19 -0
- package/dist/esm/boxes.module.4ebc7796.js.map +1 -0
- package/dist/esm/{carbon-isotopes.3b502a9e.js → carbon-isotopes.10db8285.js} +2 -2
- package/dist/esm/{carbon-isotopes.3b502a9e.js.map → carbon-isotopes.10db8285.js.map} +1 -1
- package/dist/esm/colors.395c6db5.js +40 -0
- package/dist/esm/colors.395c6db5.js.map +1 -0
- package/dist/esm/column-correlation.c8dcfe98.js +9 -0
- package/dist/esm/column-correlation.c8dcfe98.js.map +1 -0
- package/dist/esm/column-nav.5414677c.js +55 -0
- package/dist/esm/column-nav.5414677c.js.map +1 -0
- package/dist/esm/column-navigation.37cd3245.js +9 -0
- package/dist/esm/column-navigation.37cd3245.js.map +1 -0
- package/dist/esm/column.01d68dd8.js +127 -0
- package/dist/esm/column.01d68dd8.js.map +1 -0
- package/dist/esm/{column.db058031.js → column.a25f8ebd.js} +4 -4
- package/dist/esm/column.a25f8ebd.js.map +1 -0
- package/dist/esm/column.module.1b776e15.js +46 -0
- package/dist/esm/column.module.1b776e15.js.map +1 -0
- package/dist/esm/column.module.a67a6b4c.css +159 -0
- package/dist/esm/column.module.a67a6b4c.css.map +1 -0
- package/dist/esm/composite-scale.577bf64a.js +222 -0
- package/dist/esm/composite-scale.577bf64a.js.map +1 -0
- package/dist/esm/composite.039e4798.js +163 -0
- package/dist/esm/composite.039e4798.js.map +1 -0
- package/dist/esm/{core.4db8e452.js → core.843310d3.js} +11 -12
- package/dist/esm/core.843310d3.js.map +1 -0
- package/dist/esm/core.91ede078.js +206 -0
- package/dist/esm/core.91ede078.js.map +1 -0
- package/dist/esm/correlation-chart.abd8b346.js +9 -0
- package/dist/esm/correlation-chart.abd8b346.js.map +1 -0
- package/dist/esm/data-provider.1506eb64.js.map +1 -1
- package/dist/esm/data-provider.f10c6d0b.js +13 -0
- package/dist/esm/data-provider.f10c6d0b.js.map +1 -0
- package/dist/esm/fetch.99aec438.js +152 -0
- package/dist/esm/fetch.99aec438.js.map +1 -0
- package/dist/esm/hash-string.285b37fb.js +39 -0
- package/dist/esm/hash-string.285b37fb.js.map +1 -0
- package/dist/esm/helpers.2f0a0cb7.js +141 -0
- package/dist/esm/helpers.2f0a0cb7.js.map +1 -0
- package/dist/esm/index.d.ts +797 -120
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +14 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/inset-map.3c18106d.js +66 -0
- package/dist/esm/inset-map.3c18106d.js.map +1 -0
- package/dist/esm/keyboard-navigation.6713401b.js +48 -0
- package/dist/esm/keyboard-navigation.6713401b.js.map +1 -0
- package/dist/esm/keyboard-navigation.a9fc80dd.js +112 -0
- package/dist/esm/keyboard-navigation.a9fc80dd.js.map +1 -0
- package/dist/esm/layers.033d3fb0.js +170 -0
- package/dist/esm/layers.033d3fb0.js.map +1 -0
- package/dist/esm/main.2e0375a5.js +221 -0
- package/dist/esm/main.2e0375a5.js.map +1 -0
- package/dist/esm/main.module.3dd9500b.css +134 -0
- package/dist/esm/main.module.3dd9500b.css.map +1 -0
- package/dist/esm/main.module.c09154b1.js +70 -0
- package/dist/esm/main.module.c09154b1.js.map +1 -0
- package/dist/esm/mapbox.cac42eed.js +167 -0
- package/dist/esm/mapbox.cac42eed.js.map +1 -0
- package/dist/esm/maps.bcdea9c1.js +11 -0
- package/dist/esm/maps.bcdea9c1.js.map +1 -0
- package/dist/esm/{names.f6a4e9a4.js → names.a8f2b452.js} +5 -5
- package/dist/esm/names.a8f2b452.js.map +1 -0
- package/dist/esm/panel.598f76a5.js +420 -0
- package/dist/esm/panel.598f76a5.js.map +1 -0
- package/dist/esm/panel.module.386166cc.js +58 -0
- package/dist/esm/panel.module.386166cc.js.map +1 -0
- package/dist/esm/panel.module.3d2ea3c6.css +111 -0
- package/dist/esm/panel.module.3d2ea3c6.css.map +1 -0
- package/dist/esm/popover.a810b7bc.js +66 -0
- package/dist/esm/popover.a810b7bc.js.map +1 -0
- package/dist/esm/popover.module.c4ba4189.js +22 -0
- package/dist/esm/popover.module.c4ba4189.js.map +1 -0
- package/dist/esm/{selection-popover.module.0a701258.css → popover.module.c4d6bfb0.css} +11 -8
- package/dist/esm/popover.module.c4d6bfb0.css.map +1 -0
- package/dist/esm/prepare-data.d4284b4a.js +125 -0
- package/dist/esm/prepare-data.d4284b4a.js.map +1 -0
- package/dist/esm/prepare-units.6c890a96.js +104 -0
- package/dist/esm/prepare-units.6c890a96.js.map +1 -0
- package/dist/esm/{resolvers.b5c82b78.js → resolvers.36013b49.js} +13 -2
- package/dist/esm/resolvers.36013b49.js.map +1 -0
- package/dist/esm/section.a34d379a.js +215 -0
- package/dist/esm/section.a34d379a.js.map +1 -0
- package/dist/esm/selection.f5b0297e.js +143 -0
- package/dist/esm/selection.f5b0297e.js.map +1 -0
- package/dist/esm/state.178ef364.js +75 -0
- package/dist/esm/state.178ef364.js.map +1 -0
- package/dist/esm/state.2952cbca.js +118 -0
- package/dist/esm/state.2952cbca.js.map +1 -0
- package/dist/esm/store.c4d7a8a4.js +52 -0
- package/dist/esm/store.c4d7a8a4.js.map +1 -0
- package/dist/esm/styles.7bc776d1.js +95 -0
- package/dist/esm/styles.7bc776d1.js.map +1 -0
- package/dist/esm/svg.4b9a96c1.js +89 -0
- package/dist/esm/svg.4b9a96c1.js.map +1 -0
- package/dist/esm/types.0f0b57c9.js +3 -0
- package/dist/esm/types.0f0b57c9.js.map +1 -0
- package/dist/esm/unit-details.071cefed.js +9 -0
- package/dist/esm/unit-details.071cefed.js.map +1 -0
- package/dist/esm/units.5a4fc058.js +98 -0
- package/dist/esm/units.5a4fc058.js.map +1 -0
- package/dist/esm/utils.d7a43a2a.js +55 -0
- package/dist/esm/utils.d7a43a2a.js.map +1 -0
- package/dist/node/index.js.map +1 -1
- package/package.json +24 -7
- package/src/age-axis.module.sass +27 -0
- package/src/age-axis.ts +82 -19
- package/src/age-model-overlay.module.sass +11 -0
- package/src/age-model-overlay.ts +73 -0
- package/src/carbon-isotopes/column.ts +4 -2
- package/src/carbon-isotopes/core.ts +9 -6
- package/src/carbon-isotopes/data-provider.ts +3 -3
- package/src/column.module.sass +58 -49
- package/src/column.ts +149 -135
- package/src/correlation-chart/hash-string.ts +57 -0
- package/src/correlation-chart/index.ts +2 -0
- package/src/correlation-chart/main.module.sass +122 -0
- package/src/correlation-chart/main.ts +305 -0
- package/src/correlation-chart/prepare-data.ts +217 -0
- package/src/correlation-chart/stories/correlation-chart.stories.ts +192 -0
- package/src/correlation-chart/stories/stories.module.sass +18 -0
- package/src/correlation-chart/unconformity-line.module.sass +8 -0
- package/src/correlation-chart/unconformity-line.ts +25 -0
- package/src/data-provider/base.ts +388 -0
- package/src/data-provider/column-nav.ts +53 -0
- package/src/data-provider/fetch.ts +231 -0
- package/src/data-provider/index.ts +4 -0
- package/src/data-provider/store.ts +72 -0
- package/src/index.ts +6 -3
- package/src/maps/_shared/index.ts +2 -0
- package/src/maps/_shared/inset-map.stories.ts +20 -0
- package/src/maps/_shared/inset-map.ts +87 -0
- package/src/maps/_shared/styles.ts +57 -0
- package/src/maps/column-correlation/column-correlation-map.stories.ts +96 -0
- package/src/maps/column-correlation/core.ts +225 -0
- package/src/maps/column-correlation/index.ts +2 -0
- package/src/maps/column-correlation/state.ts +192 -0
- package/src/maps/column-navigation/index.ts +2 -0
- package/src/maps/column-navigation/mapbox/column-navigation-map.stories.ts +102 -0
- package/src/maps/column-navigation/mapbox/index.ts +219 -0
- package/src/maps/column-navigation/mapbox/keyboard-navigation.ts +119 -0
- package/src/maps/column-navigation/mapbox/state.ts +109 -0
- package/src/maps/column-navigation/svg/column-navigation-svg-map.stories.ts +46 -0
- package/src/{map → maps/column-navigation/svg}/index.ts +18 -6
- package/src/{map → maps/column-navigation/svg}/layers.ts +28 -109
- package/src/maps/column-navigation/utils/keyboard-navigation.ts +58 -0
- package/src/maps/index.ts +3 -0
- package/src/prepare-units/composite-scale.ts +353 -0
- package/src/prepare-units/helpers.ts +226 -0
- package/src/prepare-units/index.ts +177 -0
- package/src/prepare-units/utils.ts +98 -0
- package/src/section.ts +264 -84
- package/src/unit-details/index.ts +2 -215
- package/src/unit-details/{index.module.sass → panel.module.sass} +39 -8
- package/src/unit-details/panel.ts +523 -0
- package/src/{selection-popover.module.sass → unit-details/popover.module.sass} +4 -2
- package/src/unit-details/popover.ts +82 -0
- package/src/units/boxes.module.sass +16 -0
- package/src/units/boxes.ts +243 -90
- package/src/units/colors.ts +64 -0
- package/src/units/composite.ts +157 -152
- package/src/units/index.ts +76 -9
- package/src/units/names.ts +8 -4
- package/src/units/resolvers.ts +11 -0
- package/src/units/selection.ts +115 -101
- package/src/units/types.ts +5 -16
- package/dist/esm/age-axis.64c509ee.js +0 -41
- package/dist/esm/age-axis.64c509ee.js.map +0 -1
- package/dist/esm/boxes.13968b76.js +0 -164
- package/dist/esm/boxes.13968b76.js.map +0 -1
- package/dist/esm/boxes.module.28873d08.css +0 -4
- package/dist/esm/boxes.module.28873d08.css.map +0 -1
- package/dist/esm/boxes.module.605bdcd6.js +0 -13
- package/dist/esm/boxes.module.605bdcd6.js.map +0 -1
- package/dist/esm/column.8dd26e1a.js +0 -149
- package/dist/esm/column.8dd26e1a.js.map +0 -1
- package/dist/esm/column.db058031.js.map +0 -1
- package/dist/esm/column.module.039d872c.css +0 -151
- package/dist/esm/column.module.039d872c.css.map +0 -1
- package/dist/esm/column.module.e632868a.js +0 -19
- package/dist/esm/column.module.e632868a.js.map +0 -1
- package/dist/esm/composite.608a4ca2.js +0 -153
- package/dist/esm/composite.608a4ca2.js.map +0 -1
- package/dist/esm/core.4db8e452.js.map +0 -1
- package/dist/esm/helpers.8a03cfc7.js +0 -94
- package/dist/esm/helpers.8a03cfc7.js.map +0 -1
- package/dist/esm/index.module.0844afd8.css +0 -65
- package/dist/esm/index.module.0844afd8.css.map +0 -1
- package/dist/esm/index.module.24fe3a2e.js +0 -37
- package/dist/esm/index.module.24fe3a2e.js.map +0 -1
- package/dist/esm/layers.ad5fd25d.js +0 -231
- package/dist/esm/layers.ad5fd25d.js.map +0 -1
- package/dist/esm/map.7aa26f17.js +0 -82
- package/dist/esm/map.7aa26f17.js.map +0 -1
- package/dist/esm/names.f6a4e9a4.js.map +0 -1
- package/dist/esm/providers.cd1e652f.js +0 -25
- package/dist/esm/providers.cd1e652f.js.map +0 -1
- package/dist/esm/resolvers.b5c82b78.js.map +0 -1
- package/dist/esm/section.cc1b1100.js +0 -118
- package/dist/esm/section.cc1b1100.js.map +0 -1
- package/dist/esm/selection-popover.17d1bd55.js +0 -60
- package/dist/esm/selection-popover.17d1bd55.js.map +0 -1
- package/dist/esm/selection-popover.module.0a701258.css.map +0 -1
- package/dist/esm/selection-popover.module.e22f5183.js +0 -22
- package/dist/esm/selection-popover.module.e22f5183.js.map +0 -1
- package/dist/esm/selection.bbf26d0e.js +0 -117
- package/dist/esm/selection.bbf26d0e.js.map +0 -1
- package/dist/esm/store.25eaa168.js +0 -18
- package/dist/esm/store.25eaa168.js.map +0 -1
- package/dist/esm/types.f016e032.js +0 -18
- package/dist/esm/types.f016e032.js.map +0 -1
- package/dist/esm/unit-details.56ff8b70.js +0 -209
- package/dist/esm/unit-details.56ff8b70.js.map +0 -1
- package/dist/esm/units.361088d4.js +0 -42
- package/dist/esm/units.361088d4.js.map +0 -1
- package/src/helpers.ts +0 -133
- package/src/providers.ts +0 -34
- package/src/selection-popover.ts +0 -71
- package/src/store.ts +0 -12
- package/src/units/units.scss +0 -16
- /package/src/{map → maps/column-navigation/svg}/animated.ts +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {useMacrostratColumns as $774a5efa27d1c77b$export$81eaae0b474404fd} from "./base.910b80b4.js";
|
|
2
|
+
import {create as $i7Wch$create, useStore as $i7Wch$useStore} from "zustand";
|
|
3
|
+
import {lineIntersect as $i7Wch$lineIntersect} from "@turf/line-intersect";
|
|
4
|
+
import $i7Wch$turfdistance from "@turf/distance";
|
|
5
|
+
import {nearestPointOnLine as $i7Wch$nearestPointOnLine} from "@turf/nearest-point-on-line";
|
|
6
|
+
import {centroid as $i7Wch$centroid} from "@turf/centroid";
|
|
7
|
+
import {createContext as $i7Wch$createContext, useState as $i7Wch$useState, useEffect as $i7Wch$useEffect, useContext as $i7Wch$useContext} from "react";
|
|
8
|
+
import $i7Wch$macrostrathyper from "@macrostrat/hyper";
|
|
9
|
+
import {createComputed as $i7Wch$createComputed} from "zustand-computed";
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
const $74e211dc185c20b4$var$CorrelationStoreContext = (0, $i7Wch$createContext)(null);
|
|
21
|
+
/** A computed store that will automatically update when the state changes */ const $74e211dc185c20b4$var$computed = (0, $i7Wch$createComputed)((state)=>{
|
|
22
|
+
return {
|
|
23
|
+
// We compute the focused columns based on columns and focusedLine
|
|
24
|
+
focusedColumns: $74e211dc185c20b4$var$buildCorrelationColumns(state.columns, state.focusedLine)
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
function $74e211dc185c20b4$export$72ffe141ebf87ef1({ children: children, columns: columns, projectID: projectID, inProcess: inProcess, focusedLine: focusedLine, onSelectColumns: onSelectColumns }) {
|
|
28
|
+
const [store] = (0, $i7Wch$useState)(()=>{
|
|
29
|
+
return (0, $i7Wch$create)($74e211dc185c20b4$var$computed((set, get)=>{
|
|
30
|
+
return {
|
|
31
|
+
focusedLine: focusedLine,
|
|
32
|
+
columns: null,
|
|
33
|
+
onClickMap (event, point) {
|
|
34
|
+
const state = get();
|
|
35
|
+
// Check if shift key is pressed
|
|
36
|
+
const shiftKeyPressed = event.originalEvent.shiftKey;
|
|
37
|
+
let existingCoords = state.focusedLine?.coordinates ?? [];
|
|
38
|
+
if (existingCoords.length >= 2 && !shiftKeyPressed) // Reset the line to zero length
|
|
39
|
+
existingCoords = [];
|
|
40
|
+
set({
|
|
41
|
+
focusedLine: {
|
|
42
|
+
type: "LineString",
|
|
43
|
+
coordinates: [
|
|
44
|
+
...existingCoords,
|
|
45
|
+
point.coordinates
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}));
|
|
52
|
+
});
|
|
53
|
+
// Set up the store
|
|
54
|
+
/** TODO: move the fetching of all columns to within the map */ const _columns = (0, $774a5efa27d1c77b$export$81eaae0b474404fd)(projectID, inProcess);
|
|
55
|
+
(0, $i7Wch$useEffect)(()=>{
|
|
56
|
+
if (_columns != null) store.setState({
|
|
57
|
+
columns: _columns
|
|
58
|
+
});
|
|
59
|
+
}, [
|
|
60
|
+
_columns
|
|
61
|
+
]);
|
|
62
|
+
// Kind of an awkward way to do this but we need to allow the selector to run
|
|
63
|
+
const focusedColumns = (0, $i7Wch$useStore)(store, (state)=>state.focusedColumns);
|
|
64
|
+
const _focusedLine = (0, $i7Wch$useStore)(store, (state)=>state.focusedLine);
|
|
65
|
+
(0, $i7Wch$useEffect)(()=>{
|
|
66
|
+
onSelectColumns?.(focusedColumns, _focusedLine);
|
|
67
|
+
}, [
|
|
68
|
+
focusedColumns,
|
|
69
|
+
_focusedLine
|
|
70
|
+
]);
|
|
71
|
+
return (0, $i7Wch$macrostrathyper)($74e211dc185c20b4$var$CorrelationStoreContext.Provider, {
|
|
72
|
+
value: store
|
|
73
|
+
}, children);
|
|
74
|
+
}
|
|
75
|
+
function $74e211dc185c20b4$export$21398703d3a9bb4d(selector) {
|
|
76
|
+
const storeApi = (0, $i7Wch$useContext)($74e211dc185c20b4$var$CorrelationStoreContext);
|
|
77
|
+
if (storeApi == null) throw new Error("Missing CorrelationMapProvider");
|
|
78
|
+
return (0, $i7Wch$useStore)(storeApi, selector);
|
|
79
|
+
}
|
|
80
|
+
function $74e211dc185c20b4$var$buildCorrelationColumns(columns, line) {
|
|
81
|
+
if (columns == null || line == null || line.coordinates.length < 2) return [];
|
|
82
|
+
return $74e211dc185c20b4$var$orderColumnsByDistance($74e211dc185c20b4$var$computeIntersectingColumns(columns, line), line);
|
|
83
|
+
}
|
|
84
|
+
function $74e211dc185c20b4$var$computeIntersectingColumns(columns, line) {
|
|
85
|
+
if (columns == null || line == null) return [];
|
|
86
|
+
return columns.filter((col)=>{
|
|
87
|
+
const poly = col.geometry;
|
|
88
|
+
// Some in-process datasets seem to have null geometries
|
|
89
|
+
if (poly == null) return false;
|
|
90
|
+
if (poly.type != "Polygon" && poly.type != "MultiPolygon") return false;
|
|
91
|
+
const intersection = (0, $i7Wch$lineIntersect)(line, poly);
|
|
92
|
+
return intersection.features.length > 0;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function $74e211dc185c20b4$var$orderColumnsByDistance(columns, line) {
|
|
96
|
+
const centroids = columns.map((col)=>(0, $i7Wch$centroid)(col.geometry));
|
|
97
|
+
const projectedPoints = centroids.map((point)=>(0, $i7Wch$nearestPointOnLine)(line, point));
|
|
98
|
+
const distances = projectedPoints.map((point)=>(0, $i7Wch$turfdistance)(point.geometry.coordinates, line.coordinates[0]));
|
|
99
|
+
let newColumns = columns.map((col, i)=>{
|
|
100
|
+
return {
|
|
101
|
+
...col,
|
|
102
|
+
properties: {
|
|
103
|
+
...col.properties,
|
|
104
|
+
centroid: centroids[i],
|
|
105
|
+
nearestPointOnLine: projectedPoints[i],
|
|
106
|
+
distanceAlongLine: distances[i]
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
return $74e211dc185c20b4$var$sorted(newColumns, (d)=>d.properties.distanceAlongLine);
|
|
111
|
+
}
|
|
112
|
+
function $74e211dc185c20b4$var$sorted(data, accessor) {
|
|
113
|
+
return data.sort((a, b)=>accessor(a) - accessor(b));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
export {$74e211dc185c20b4$export$72ffe141ebf87ef1 as ColumnCorrelationProvider, $74e211dc185c20b4$export$21398703d3a9bb4d as useCorrelationMapStore};
|
|
118
|
+
//# sourceMappingURL=state.2952cbca.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;AAwCA,MAAM,gDACJ,CAAA,GAAA,oBAAY,EAAwC;AAMtD,2EAA2E,GAC3E,MAAM,iCAAW,CAAA,GAAA,qBAAa,EAAE,CAAC;IAC/B,OAAO;QACL,kEAAkE;QAClE,gBAAgB,8CAAwB,MAAM,OAAO,EAAE,MAAM,WAAW;IAC1E;AACF;AAEO,SAAS,0CAA0B,YACxC,QAAQ,WACR,OAAO,aACP,SAAS,aACT,SAAS,eACT,WAAW,mBACX,eAAe,EACU;IACzB,MAAM,CAAC,MAAM,GAAG,CAAA,GAAA,eAAO,EAAE;QACvB,OAAO,CAAA,GAAA,aAAK,EACV,+BAAS,CAAC,KAAK;YACb,OAAO;6BACL;gBACA,SAAS;gBACT,YAAW,KAA6B,EAAE,KAAY;oBACpD,MAAM,QAAQ;oBACd,gCAAgC;oBAChC,MAAM,kBAAkB,MAAM,aAAa,CAAC,QAAQ;oBACpD,IAAI,iBAAiB,MAAM,WAAW,EAAE,eAAe,EAAE;oBAEzD,IAAI,eAAe,MAAM,IAAI,KAAK,CAAC,iBACjC,gCAAgC;oBAChC,iBAAiB,EAAE;oBAErB,IAAI;wBACF,aAAa;4BACX,MAAM;4BACN,aAAa;mCAAI;gCAAgB,MAAM,WAAW;6BAAC;wBACrD;oBACF;gBACF;YACF;QACF;IAEJ;IAEA,mBAAmB;IACnB,6DAA6D,GAC7D,MAAM,WAAW,CAAA,GAAA,yCAAmB,EAAE,WAAW;IACjD,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,YAAY,MACd,MAAM,QAAQ,CAAC;YAAE,SAAS;QAAS;IAEvC,GAAG;QAAC;KAAS;IAEb,6EAA6E;IAC7E,MAAM,iBAAiB,CAAA,GAAA,eAAO,EAAE,OAAO,CAAC,QAAU,MAAM,cAAc;IACtE,MAAM,eAAe,CAAA,GAAA,eAAO,EAAE,OAAO,CAAC,QAAU,MAAM,WAAW;IAEjE,CAAA,GAAA,gBAAQ,EAAE;QACR,kBAAkB,gBAAgB;IACpC,GAAG;QAAC;QAAgB;KAAa;IAEjC,OAAO,CAAA,GAAA,sBAAA,EAAE,8CAAwB,QAAQ,EAAE;QAAE,OAAO;IAAM,GAAG;AAC/D;AAEO,SAAS,0CACd,QAA6D;IAE7D,MAAM,WAAW,CAAA,GAAA,iBAAS,EAAE;IAC5B,IAAI,YAAY,MACd,MAAM,IAAI,MAAM;IAElB,OAAO,CAAA,GAAA,eAAO,EAAE,UAAU;AAC5B;AAEA,SAAS,8CACP,OAA8B,EAC9B,IAAgB;IAEhB,IAAI,WAAW,QAAQ,QAAQ,QAAQ,KAAK,WAAW,CAAC,MAAM,GAAG,GAC/D,OAAO,EAAE;IAEX,OAAO,6CACL,iDAA2B,SAAS,OACpC;AAEJ;AAEA,SAAS,iDACP,OAA8B,EAC9B,IAAgB;IAEhB,IAAI,WAAW,QAAQ,QAAQ,MAC7B,OAAO,EAAE;IAGX,OAAO,QAAQ,MAAM,CAAC,CAAC;QACrB,MAAM,OAAO,IAAI,QAAQ;QAEzB,wDAAwD;QACxD,IAAI,QAAQ,MAAM,OAAO;QACzB,IAAI,KAAK,IAAI,IAAI,aAAa,KAAK,IAAI,IAAI,gBAAgB,OAAO;QAElE,MAAM,eAAe,CAAA,GAAA,oBAAY,EAAE,MAAM;QACzC,OAAO,aAAa,QAAQ,CAAC,MAAM,GAAG;IACxC;AACF;AAUA,SAAS,6CACP,OAA8B,EAC9B,IAAgB;IAEhB,MAAM,YAAY,QAAQ,GAAG,CAAC,CAAC,MAAQ,CAAA,GAAA,eAAO,EAAE,IAAI,QAAQ;IAC5D,MAAM,kBAAkB,UAAU,GAAG,CAAC,CAAC,QACrC,CAAA,GAAA,yBAAiB,EAAE,MAAM;IAE3B,MAAM,YAAY,gBAAgB,GAAG,CAAC,CAAC,QACrC,CAAA,GAAA,mBAAO,EAAE,MAAM,QAAQ,CAAC,WAAW,EAAE,KAAK,WAAW,CAAC,EAAE;IAG1D,IAAI,aAAa,QAAQ,GAAG,CAAC,CAAC,KAAK;QACjC,OAAO;YACL,GAAG,GAAG;YACN,YAAY;gBACV,GAAG,IAAI,UAAU;gBACjB,UAAU,SAAS,CAAC,EAAE;gBACtB,oBAAoB,eAAe,CAAC,EAAE;gBACtC,mBAAmB,SAAS,CAAC,EAAE;YACjC;QACF;IACF;IAEA,OAAO,6BAAO,YAAY,CAAC,IAAM,EAAE,UAAU,CAAC,iBAAiB;AACjE;AAEA,SAAS,6BAAO,IAAI,EAAE,QAAuB;IAC3C,OAAO,KAAK,IAAI,CAAC,CAAC,GAAG,IAAM,SAAS,KAAK,SAAS;AACpD","sources":["packages/column-views/src/maps/column-correlation/state.ts"],"sourcesContent":["import { LineString, Point } from \"geojson\";\nimport { create, StoreApi, useStore } from \"zustand\";\nimport type { ColumnGeoJSONRecord } from \"@macrostrat/api-types\";\n// Turf intersection\nimport { lineIntersect } from \"@turf/line-intersect\";\nimport distance from \"@turf/distance\";\nimport { nearestPointOnLine } from \"@turf/nearest-point-on-line\";\nimport { centroid } from \"@turf/centroid\";\nimport mapboxgl from \"mapbox-gl\";\nimport {\n createContext,\n useState,\n useContext,\n ReactNode,\n useEffect,\n} from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport { createComputed } from \"zustand-computed\";\nimport { useMacrostratColumns } from \"../../data-provider/base\";\n\nexport interface CorrelationMapInput {\n columns: ColumnGeoJSONRecord[];\n focusedLine: LineString | null;\n}\n\nexport interface CorrelationMapStore extends CorrelationMapInput {\n onClickMap: (event: mapboxgl.MapMouseEvent, point: Point) => void;\n}\n\nexport interface CorrelationProviderProps extends CorrelationMapInput {\n projectID?: number;\n inProcess?: boolean;\n columns: ColumnGeoJSONRecord[] | null;\n children: ReactNode;\n onSelectColumns?: (\n columns: FocusedColumnGeoJSONRecord[],\n line: LineString | null\n ) => void;\n}\n\nconst CorrelationStoreContext =\n createContext<StoreApi<CorrelationMapStore> | null>(null);\n\ntype ComputedStore = {\n focusedColumns: FocusedColumnGeoJSONRecord[];\n};\n\n/** A computed store that will automatically update when the state changes */\nconst computed = createComputed((state: CorrelationMapStore): ComputedStore => {\n return {\n // We compute the focused columns based on columns and focusedLine\n focusedColumns: buildCorrelationColumns(state.columns, state.focusedLine),\n };\n}) as any;\n\nexport function ColumnCorrelationProvider({\n children,\n columns,\n projectID,\n inProcess,\n focusedLine,\n onSelectColumns,\n}: CorrelationProviderProps) {\n const [store] = useState(() => {\n return create<CorrelationMapStore & ComputedStore>(\n computed((set, get): CorrelationMapStore => {\n return {\n focusedLine,\n columns: null,\n onClickMap(event: mapboxgl.MapMouseEvent, point: Point) {\n const state = get();\n // Check if shift key is pressed\n const shiftKeyPressed = event.originalEvent.shiftKey;\n let existingCoords = state.focusedLine?.coordinates ?? [];\n\n if (existingCoords.length >= 2 && !shiftKeyPressed) {\n // Reset the line to zero length\n existingCoords = [];\n }\n set({\n focusedLine: {\n type: \"LineString\",\n coordinates: [...existingCoords, point.coordinates],\n },\n });\n },\n };\n })\n );\n });\n\n // Set up the store\n /** TODO: move the fetching of all columns to within the map */\n const _columns = useMacrostratColumns(projectID, inProcess);\n useEffect(() => {\n if (_columns != null) {\n store.setState({ columns: _columns });\n }\n }, [_columns]);\n\n // Kind of an awkward way to do this but we need to allow the selector to run\n const focusedColumns = useStore(store, (state) => state.focusedColumns);\n const _focusedLine = useStore(store, (state) => state.focusedLine);\n\n useEffect(() => {\n onSelectColumns?.(focusedColumns, _focusedLine);\n }, [focusedColumns, _focusedLine]);\n\n return h(CorrelationStoreContext.Provider, { value: store }, children);\n}\n\nexport function useCorrelationMapStore(\n selector: (state: CorrelationMapStore & ComputedStore) => any\n) {\n const storeApi = useContext(CorrelationStoreContext);\n if (storeApi == null) {\n throw new Error(\"Missing CorrelationMapProvider\");\n }\n return useStore(storeApi, selector);\n}\n\nfunction buildCorrelationColumns(\n columns: ColumnGeoJSONRecord[],\n line: LineString\n): FocusedColumnGeoJSONRecord[] {\n if (columns == null || line == null || line.coordinates.length < 2) {\n return [];\n }\n return orderColumnsByDistance(\n computeIntersectingColumns(columns, line),\n line\n );\n}\n\nfunction computeIntersectingColumns(\n columns: ColumnGeoJSONRecord[],\n line: LineString\n): ColumnGeoJSONRecord[] {\n if (columns == null || line == null) {\n return [];\n }\n\n return columns.filter((col) => {\n const poly = col.geometry;\n\n // Some in-process datasets seem to have null geometries\n if (poly == null) return false;\n if (poly.type != \"Polygon\" && poly.type != \"MultiPolygon\") return false;\n\n const intersection = lineIntersect(line, poly);\n return intersection.features.length > 0;\n });\n}\n\ninterface FocusedColumnGeoJSONRecord extends ColumnGeoJSONRecord {\n properties: {\n centroid: Point;\n nearestPointOnLine: Point;\n distanceAlongLine: number;\n } & ColumnGeoJSONRecord[\"properties\"];\n}\n\nfunction orderColumnsByDistance(\n columns: ColumnGeoJSONRecord[],\n line: LineString\n): FocusedColumnGeoJSONRecord[] {\n const centroids = columns.map((col) => centroid(col.geometry));\n const projectedPoints = centroids.map((point) =>\n nearestPointOnLine(line, point)\n );\n const distances = projectedPoints.map((point) =>\n distance(point.geometry.coordinates, line.coordinates[0])\n );\n\n let newColumns = columns.map((col, i) => {\n return {\n ...col,\n properties: {\n ...col.properties,\n centroid: centroids[i],\n nearestPointOnLine: projectedPoints[i],\n distanceAlongLine: distances[i],\n },\n };\n });\n\n return sorted(newColumns, (d) => d.properties.distanceAlongLine);\n}\n\nfunction sorted(data, accessor: (d) => number) {\n return data.sort((a, b) => accessor(a) - accessor(b));\n}\n"],"names":[],"version":3,"file":"state.2952cbca.js.map"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {createCompositeScale as $728f6cf6c12cd490$export$3ada7641926a616d} from "./composite-scale.577bf64a.js";
|
|
2
|
+
import {createContext as $a90Ta$createContext, useMemo as $a90Ta$useMemo, useContext as $a90Ta$useContext} from "react";
|
|
3
|
+
import $a90Ta$macrostrathyper from "@macrostrat/hyper";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const $d5074f164411387e$var$MacrostratColumnDataContext = (0, $a90Ta$createContext)(null);
|
|
9
|
+
function $d5074f164411387e$export$7fec7bd80ff9c10e({ children: children, units: units, sections: sections, totalHeight: totalHeight, axisType: axisType }) {
|
|
10
|
+
/** Provider for Macrostrat column data.
|
|
11
|
+
* As a general rule, we want to provide data and column-axis
|
|
12
|
+
* height calculations through the context, since these need to
|
|
13
|
+
* be accessed by any component that lays out information on the
|
|
14
|
+
* column.
|
|
15
|
+
*
|
|
16
|
+
* Cross-axis layout and view configuration (e.g., showing and hiding
|
|
17
|
+
* of different components or labels) should be handled through passing
|
|
18
|
+
* props to the components themselves.
|
|
19
|
+
* */ const value = (0, $a90Ta$useMemo)(()=>{
|
|
20
|
+
return {
|
|
21
|
+
units: units,
|
|
22
|
+
sections: sections,
|
|
23
|
+
totalHeight: totalHeight,
|
|
24
|
+
axisType: axisType
|
|
25
|
+
};
|
|
26
|
+
}, [
|
|
27
|
+
units,
|
|
28
|
+
sections,
|
|
29
|
+
totalHeight,
|
|
30
|
+
axisType
|
|
31
|
+
]);
|
|
32
|
+
return (0, $a90Ta$macrostrathyper)($d5074f164411387e$var$MacrostratColumnDataContext.Provider, {
|
|
33
|
+
value: value
|
|
34
|
+
}, children);
|
|
35
|
+
}
|
|
36
|
+
function $d5074f164411387e$export$f8509b7cce386c7d() {
|
|
37
|
+
const ctx = (0, $a90Ta$useContext)($d5074f164411387e$var$MacrostratColumnDataContext);
|
|
38
|
+
if (!ctx) throw new Error("useMacrostratColumnData must be used within a MacrostratColumnDataProvider");
|
|
39
|
+
return ctx;
|
|
40
|
+
}
|
|
41
|
+
function $d5074f164411387e$export$6fb40844db555b2() {
|
|
42
|
+
return $d5074f164411387e$export$f8509b7cce386c7d().units;
|
|
43
|
+
}
|
|
44
|
+
function $d5074f164411387e$export$a7fc62995ec4f76() {
|
|
45
|
+
const ctx = (0, $a90Ta$useContext)($d5074f164411387e$var$MacrostratColumnDataContext);
|
|
46
|
+
if (!ctx) throw new Error("useCompositeScale must be used within a MacrostratUnitsProvider");
|
|
47
|
+
return (0, $728f6cf6c12cd490$export$3ada7641926a616d)(ctx.sections, true);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
export {$d5074f164411387e$export$7fec7bd80ff9c10e as MacrostratColumnDataProvider, $d5074f164411387e$export$f8509b7cce386c7d as useMacrostratColumnData, $d5074f164411387e$export$6fb40844db555b2 as useMacrostratUnits, $d5074f164411387e$export$a7fc62995ec4f76 as useCompositeScale};
|
|
52
|
+
//# sourceMappingURL=store.c4d7a8a4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;AAgBA,MAAM,oDACJ,CAAA,GAAA,oBAAY,EAA+B;AAEtC,SAAS,0CAA6B,YAC3C,QAAQ,SACR,KAAK,YACL,QAAQ,eACR,WAAW,YACX,QAAQ,EAC8C;IACtD;;;;;;;;;KASG,GAEH,MAAM,QAAQ,CAAA,GAAA,cAAM,EAAE;QACpB,OAAO;mBACL;sBACA;yBACA;sBACA;QACF;IACF,GAAG;QAAC;QAAO;QAAU;QAAa;KAAS;IAE3C,OAAO,CAAA,GAAA,sBAAA,EAAE,kDAA4B,QAAQ,EAAE;eAAE;IAAM,GAAG;AAC5D;AAEO,SAAS;IACd,MAAM,MAAM,CAAA,GAAA,iBAAS,EAAE;IACvB,IAAI,CAAC,KACH,MAAM,IAAI,MACR;IAGJ,OAAO;AACT;AAEO,SAAS;IACd,OAAO,4CAA0B,KAAK;AACxC;AAEO,SAAS;IACd,MAAM,MAAM,CAAA,GAAA,iBAAS,EAAE;IACvB,IAAI,CAAC,KACH,MAAM,IAAI,MACR;IAGJ,OAAO,CAAA,GAAA,yCAAmB,EAAE,IAAI,QAAQ,EAAE;AAC5C","sources":["packages/column-views/src/data-provider/store.ts"],"sourcesContent":["import { createContext, useContext, ReactNode, useMemo } from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport {\n createCompositeScale,\n PackageLayoutData,\n} from \"../prepare-units/composite-scale\";\nimport { ExtUnit } from \"../prepare-units/helpers\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\n\nexport interface MacrostratColumnDataContext {\n units: ExtUnit[];\n sections: PackageLayoutData[];\n totalHeight?: number;\n axisType?: ColumnAxisType;\n}\n\nconst MacrostratColumnDataContext =\n createContext<MacrostratColumnDataContext>(null);\n\nexport function MacrostratColumnDataProvider({\n children,\n units,\n sections,\n totalHeight,\n axisType,\n}: MacrostratColumnDataContext & { children: ReactNode }) {\n /** Provider for Macrostrat column data.\n * As a general rule, we want to provide data and column-axis\n * height calculations through the context, since these need to\n * be accessed by any component that lays out information on the\n * column.\n *\n * Cross-axis layout and view configuration (e.g., showing and hiding\n * of different components or labels) should be handled through passing\n * props to the components themselves.\n * */\n\n const value = useMemo(() => {\n return {\n units,\n sections,\n totalHeight,\n axisType,\n };\n }, [units, sections, totalHeight, axisType]);\n\n return h(MacrostratColumnDataContext.Provider, { value }, children);\n}\n\nexport function useMacrostratColumnData() {\n const ctx = useContext(MacrostratColumnDataContext);\n if (!ctx) {\n throw new Error(\n \"useMacrostratColumnData must be used within a MacrostratColumnDataProvider\"\n );\n }\n return ctx;\n}\n\nexport function useMacrostratUnits() {\n return useMacrostratColumnData().units;\n}\n\nexport function useCompositeScale() {\n const ctx = useContext(MacrostratColumnDataContext);\n if (!ctx) {\n throw new Error(\n \"useCompositeScale must be used within a MacrostratUnitsProvider\"\n );\n }\n return createCompositeScale(ctx.sections, true);\n}\n"],"names":[],"version":3,"file":"store.c4d7a8a4.js.map"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {getCSSVariable as $8F7e5$getCSSVariable} from "@macrostrat/color-utils";
|
|
2
|
+
import {buildGeoJSONSource as $8F7e5$buildGeoJSONSource} from "@macrostrat/mapbox-utils";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function $1dbfddc9637b572c$export$d2995719c3a4ae17(color) {
|
|
7
|
+
const columnColor = color ?? (0, $8F7e5$getCSSVariable)("--text-subtle-color", "black");
|
|
8
|
+
return {
|
|
9
|
+
sources: {
|
|
10
|
+
columns: (0, $8F7e5$buildGeoJSONSource)()
|
|
11
|
+
},
|
|
12
|
+
layers: [
|
|
13
|
+
{
|
|
14
|
+
id: "columns-fill",
|
|
15
|
+
type: "fill",
|
|
16
|
+
source: "columns",
|
|
17
|
+
paint: {
|
|
18
|
+
"fill-color": columnColor,
|
|
19
|
+
"fill-opacity": [
|
|
20
|
+
"case",
|
|
21
|
+
[
|
|
22
|
+
"boolean",
|
|
23
|
+
[
|
|
24
|
+
"feature-state",
|
|
25
|
+
"selected"
|
|
26
|
+
],
|
|
27
|
+
false
|
|
28
|
+
],
|
|
29
|
+
0.5,
|
|
30
|
+
[
|
|
31
|
+
"boolean",
|
|
32
|
+
[
|
|
33
|
+
"feature-state",
|
|
34
|
+
"hover"
|
|
35
|
+
],
|
|
36
|
+
false
|
|
37
|
+
],
|
|
38
|
+
0.3,
|
|
39
|
+
0.1
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "columns-line",
|
|
45
|
+
type: "line",
|
|
46
|
+
source: "columns",
|
|
47
|
+
paint: {
|
|
48
|
+
"line-color": columnColor,
|
|
49
|
+
"line-width": 2,
|
|
50
|
+
"line-opacity": 0.5
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: "columns-points",
|
|
55
|
+
type: "circle",
|
|
56
|
+
source: "columns",
|
|
57
|
+
paint: {
|
|
58
|
+
"circle-radius": 4,
|
|
59
|
+
"circle-color": columnColor,
|
|
60
|
+
"circle-opacity": [
|
|
61
|
+
"case",
|
|
62
|
+
[
|
|
63
|
+
"boolean",
|
|
64
|
+
[
|
|
65
|
+
"feature-state",
|
|
66
|
+
"selected"
|
|
67
|
+
],
|
|
68
|
+
false
|
|
69
|
+
],
|
|
70
|
+
1,
|
|
71
|
+
[
|
|
72
|
+
"boolean",
|
|
73
|
+
[
|
|
74
|
+
"feature-state",
|
|
75
|
+
"hover"
|
|
76
|
+
],
|
|
77
|
+
false
|
|
78
|
+
],
|
|
79
|
+
0.7,
|
|
80
|
+
0.5
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
filter: [
|
|
84
|
+
"==",
|
|
85
|
+
"$type",
|
|
86
|
+
"Point"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
export {$1dbfddc9637b572c$export$d2995719c3a4ae17 as buildColumnsStyle};
|
|
95
|
+
//# sourceMappingURL=styles.7bc776d1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;AAGO,SAAS,0CAAkB,KAAa;IAC7C,MAAM,cAAc,SAAS,CAAA,GAAA,qBAAa,EAAE,uBAAuB;IACnE,OAAO;QACL,SAAS;YACP,SAAS,CAAA,GAAA,yBAAiB;QAC5B;QACA,QAAQ;YACN;gBACE,IAAI;gBACJ,MAAM;gBACN,QAAQ;gBACR,OAAO;oBACL,cAAc;oBACd,gBAAgB;wBACd;wBACA;4BAAC;4BAAW;gCAAC;gCAAiB;6BAAW;4BAAE;yBAAM;wBACjD;wBACA;4BAAC;4BAAW;gCAAC;gCAAiB;6BAAQ;4BAAE;yBAAM;wBAC9C;wBACA;qBACD;gBACH;YACF;YACA;gBACE,IAAI;gBACJ,MAAM;gBACN,QAAQ;gBACR,OAAO;oBACL,cAAc;oBACd,cAAc;oBACd,gBAAgB;gBAClB;YACF;YACA;gBACE,IAAI;gBACJ,MAAM;gBACN,QAAQ;gBACR,OAAO;oBACL,iBAAiB;oBACjB,gBAAgB;oBAChB,kBAAkB;wBAChB;wBACA;4BAAC;4BAAW;gCAAC;gCAAiB;6BAAW;4BAAE;yBAAM;wBACjD;wBACA;4BAAC;4BAAW;gCAAC;gCAAiB;6BAAQ;4BAAE;yBAAM;wBAC9C;wBACA;qBACD;gBACH;gBACA,QAAQ;oBAAC;oBAAM;oBAAS;iBAAQ;YAClC;SACD;IACH;AACF","sources":["packages/column-views/src/maps/_shared/styles.ts"],"sourcesContent":["import { getCSSVariable } from \"@macrostrat/color-utils\";\nimport { buildGeoJSONSource } from \"@macrostrat/mapbox-utils\";\n\nexport function buildColumnsStyle(color: string) {\n const columnColor = color ?? getCSSVariable(\"--text-subtle-color\", \"black\");\n return {\n sources: {\n columns: buildGeoJSONSource(),\n },\n layers: [\n {\n id: \"columns-fill\",\n type: \"fill\",\n source: \"columns\",\n paint: {\n \"fill-color\": columnColor,\n \"fill-opacity\": [\n \"case\",\n [\"boolean\", [\"feature-state\", \"selected\"], false],\n 0.5,\n [\"boolean\", [\"feature-state\", \"hover\"], false],\n 0.3,\n 0.1,\n ],\n },\n },\n {\n id: \"columns-line\",\n type: \"line\",\n source: \"columns\",\n paint: {\n \"line-color\": columnColor,\n \"line-width\": 2,\n \"line-opacity\": 0.5,\n },\n },\n {\n id: \"columns-points\",\n type: \"circle\",\n source: \"columns\",\n paint: {\n \"circle-radius\": 4,\n \"circle-color\": columnColor,\n \"circle-opacity\": [\n \"case\",\n [\"boolean\", [\"feature-state\", \"selected\"], false],\n 1,\n [\"boolean\", [\"feature-state\", \"hover\"], false],\n 0.7,\n 0.5,\n ],\n },\n filter: [\"==\", \"$type\", \"Point\"],\n },\n ],\n };\n}\n"],"names":[],"version":3,"file":"styles.7bc776d1.js.map"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {Columns as $93f116a6493b17c3$export$f02cc02ad0e0bba3, CurrentColumn as $93f116a6493b17c3$export$b9d912252344e099, MeasurementsLayer as $93f116a6493b17c3$export$2254347cd20e6080, ColumnFeatures as $93f116a6493b17c3$export$f177ff57c101017a, ColumnKeyboardNavigation as $93f116a6493b17c3$export$8c41dd563753848, ColumnCenters as $93f116a6493b17c3$export$4d8f6e6df85d9012} from "./layers.033d3fb0.js";
|
|
2
|
+
import {useRef as $9RwS3$useRef} from "react";
|
|
3
|
+
import $9RwS3$macrostrathyper from "@macrostrat/hyper";
|
|
4
|
+
import {Globe as $9RwS3$Globe, LandLayer as $9RwS3$LandLayer} from "@macrostrat/svg-map-components";
|
|
5
|
+
import {geoCentroid as $9RwS3$geoCentroid} from "d3-geo";
|
|
6
|
+
import {useElementSize as $9RwS3$useElementSize} from "@macrostrat/ui-components";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
function $e6046e00d2c8a163$export$c4313db718750a5a(props) {
|
|
15
|
+
const { center: center, children: children, style: style, margin: margin, className: className, allowZoom: allowZoom, ...rest } = props;
|
|
16
|
+
let { scale: scale } = props;
|
|
17
|
+
const ref = (0, $9RwS3$useRef)(null);
|
|
18
|
+
const sz = (0, $9RwS3$useElementSize)(ref);
|
|
19
|
+
const { width: width, height: height } = sz ?? {
|
|
20
|
+
width: 0,
|
|
21
|
+
height: 0
|
|
22
|
+
};
|
|
23
|
+
if (scale == null) scale = Math.min(width, height) + 2 * margin;
|
|
24
|
+
let zoomScaleExtent = null;
|
|
25
|
+
if (allowZoom) zoomScaleExtent = [
|
|
26
|
+
0.1 * Math.min(width, height),
|
|
27
|
+
2 * Math.max(width, height)
|
|
28
|
+
];
|
|
29
|
+
return (0, $9RwS3$macrostrathyper)("div.map-area", {
|
|
30
|
+
ref: ref,
|
|
31
|
+
style: style,
|
|
32
|
+
className: className
|
|
33
|
+
}, [
|
|
34
|
+
(0, $9RwS3$macrostrathyper)((0, $9RwS3$Globe), {
|
|
35
|
+
width: width,
|
|
36
|
+
height: height,
|
|
37
|
+
margin: margin,
|
|
38
|
+
center: center,
|
|
39
|
+
allowDrag: true,
|
|
40
|
+
allowZoom: allowZoom,
|
|
41
|
+
keepNorthUp: true,
|
|
42
|
+
zoomScaleExtent: zoomScaleExtent,
|
|
43
|
+
...rest,
|
|
44
|
+
scale: scale
|
|
45
|
+
}, [
|
|
46
|
+
(0, $9RwS3$macrostrathyper)((0, $9RwS3$LandLayer)),
|
|
47
|
+
children
|
|
48
|
+
])
|
|
49
|
+
]);
|
|
50
|
+
}
|
|
51
|
+
function $e6046e00d2c8a163$export$9595c40c7a4c4f7b(props) {
|
|
52
|
+
const { currentColumn: currentColumn, setCurrentColumn: setCurrentColumn, children: children, style: style, margin: margin = 10, scale: scale, className: className, showInProcessColumns: showInProcessColumns = false, showDebugLayers: showDebugLayers = false, center: center, ...rest } = props;
|
|
53
|
+
let _center = center ?? [
|
|
54
|
+
-100,
|
|
55
|
+
38
|
|
56
|
+
];
|
|
57
|
+
// Override center if currentColumn is set
|
|
58
|
+
if (currentColumn != null) _center = (0, $9RwS3$geoCentroid)(currentColumn);
|
|
59
|
+
console.log(currentColumn);
|
|
60
|
+
return (0, $9RwS3$macrostrathyper)($e6046e00d2c8a163$export$c4313db718750a5a, {
|
|
61
|
+
center: _center,
|
|
62
|
+
style: style,
|
|
63
|
+
margin: margin,
|
|
64
|
+
scale: scale,
|
|
65
|
+
className: className
|
|
66
|
+
}, [
|
|
67
|
+
children,
|
|
68
|
+
(0, $9RwS3$macrostrathyper)((0, $93f116a6493b17c3$export$f02cc02ad0e0bba3), {
|
|
69
|
+
onChange: setCurrentColumn,
|
|
70
|
+
col_id: currentColumn?.properties.col_id,
|
|
71
|
+
showDebugLayers: showDebugLayers,
|
|
72
|
+
...rest
|
|
73
|
+
}),
|
|
74
|
+
(0, $9RwS3$macrostrathyper).if(showInProcessColumns)((0, $93f116a6493b17c3$export$f02cc02ad0e0bba3), {
|
|
75
|
+
onChange: setCurrentColumn,
|
|
76
|
+
col_id: currentColumn?.properties.col_id,
|
|
77
|
+
status_code: "in process",
|
|
78
|
+
color: "rgba(200,150,150, 0.5)",
|
|
79
|
+
...rest
|
|
80
|
+
}),
|
|
81
|
+
(0, $9RwS3$macrostrathyper).if(currentColumn != null)((0, $93f116a6493b17c3$export$b9d912252344e099), {
|
|
82
|
+
feature: currentColumn
|
|
83
|
+
})
|
|
84
|
+
]);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
export {$e6046e00d2c8a163$export$c4313db718750a5a as ResizableMapFrame, $e6046e00d2c8a163$export$9595c40c7a4c4f7b as ColumnNavigationSVGMap, $93f116a6493b17c3$export$2254347cd20e6080 as MeasurementsLayer, $93f116a6493b17c3$export$f177ff57c101017a as ColumnFeatures, $93f116a6493b17c3$export$8c41dd563753848 as ColumnKeyboardNavigation, $93f116a6493b17c3$export$f02cc02ad0e0bba3 as Columns, $93f116a6493b17c3$export$4d8f6e6df85d9012 as ColumnCenters, $93f116a6493b17c3$export$b9d912252344e099 as CurrentColumn};
|
|
89
|
+
//# sourceMappingURL=svg.4b9a96c1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;AAQO,SAAS,0CAAkB,KAAK;IACrC,MAAM,UAAE,MAAM,YAAE,QAAQ,SAAE,KAAK,UAAE,MAAM,aAAE,SAAS,aAAE,SAAS,EAAE,GAAG,MAAM,GACtE;IACF,IAAI,SAAE,KAAK,EAAE,GAAG;IAChB,MAAM,MAAM,CAAA,GAAA,aAAK,EAAE;IACnB,MAAM,KAAK,CAAA,GAAA,qBAAa,EAAE;IAC1B,MAAM,SAAE,KAAK,UAAE,MAAM,EAAE,GAAG,MAAM;QAAE,OAAO;QAAG,QAAQ;IAAE;IACtD,IAAI,SAAS,MACX,QAAQ,KAAK,GAAG,CAAC,OAAO,UAAU,IAAI;IAGxC,IAAI,kBAAkB;IAEtB,IAAI,WACF,kBAAkB;QAChB,MAAM,KAAK,GAAG,CAAC,OAAO;QACtB,IAAI,KAAK,GAAG,CAAC,OAAO;KACrB;IAGH,OAAO,CAAA,GAAA,sBAAA,EAAE,gBAAgB;aAAE;eAAK;mBAAO;IAAU,GAAG;QAClD,CAAA,GAAA,sBAAA,EACE,CAAA,GAAA,YAAI,GACJ;mBACE;oBACA;oBACA;oBACA;YACA,WAAW;uBACX;YACA,aAAa;6BACb;YACA,GAAG,IAAI;mBACP;QACF,GACA;YAAC,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,gBAAQ;YAAI;SAAS;KAE3B;AACH;AAKO,SAAS,0CAAuB,KAAK;IAC1C,MAAM,iBACJ,aAAa,oBACb,gBAAgB,YAChB,QAAQ,SACR,KAAK,UACL,SAAS,WACT,KAAK,aACL,SAAS,wBACT,uBAAuB,wBACvB,kBAAkB,eAClB,MAAM,EACN,GAAG,MACJ,GAAG;IAEJ,IAAI,UAA6B,UAAU;QAAC;QAAM;KAAG;IACrD,0CAA0C;IAC1C,IAAI,iBAAiB,MACnB,UAAU,CAAA,GAAA,kBAAU,EAAE;IAGxB,QAAQ,GAAG,CAAC;IAEZ,OAAO,CAAA,GAAA,sBAAA,EACL,2CACA;QAAE,QAAQ;eAAS;gBAAO;eAAQ;mBAAO;IAAU,GACnD;QACE;QACA,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAM,GAAG;YACT,UAAU;YACV,QAAQ,eAAe,WAAW;6BAClC;YACA,GAAG,IAAI;QACT;QACA,CAAA,GAAA,sBAAA,EAAE,EAAE,CAAC,sBAAsB,CAAA,GAAA,yCAAM,GAAG;YAClC,UAAU;YACV,QAAQ,eAAe,WAAW;YAClC,aAAa;YACb,OAAO;YACP,GAAG,IAAI;QACT;QACA,CAAA,GAAA,sBAAA,EAAE,EAAE,CAAC,iBAAiB,MAAM,CAAA,GAAA,yCAAY,GAAG;YAAE,SAAS;QAAc;KACrE;AAEL","sources":["packages/column-views/src/maps/column-navigation/svg/index.ts"],"sourcesContent":["import { useRef } from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport { Globe, LandLayer } from \"@macrostrat/svg-map-components\";\nimport { geoCentroid } from \"d3-geo\";\nimport { useElementSize } from \"@macrostrat/ui-components\";\nimport { Columns, CurrentColumn } from \"./layers\";\nimport type { LngLatLike } from \"mapbox-gl\";\n\nexport function ResizableMapFrame(props) {\n const { center, children, style, margin, className, allowZoom, ...rest } =\n props;\n let { scale } = props;\n const ref = useRef(null);\n const sz = useElementSize(ref);\n const { width, height } = sz ?? { width: 0, height: 0 };\n if (scale == null) {\n scale = Math.min(width, height) + 2 * margin;\n }\n\n let zoomScaleExtent = null;\n\n if (allowZoom) {\n zoomScaleExtent = [\n 0.1 * Math.min(width, height),\n 2 * Math.max(width, height),\n ];\n }\n\n return h(\"div.map-area\", { ref, style, className }, [\n h(\n Globe,\n {\n width,\n height,\n margin,\n center,\n allowDrag: true,\n allowZoom,\n keepNorthUp: true,\n zoomScaleExtent,\n ...rest,\n scale,\n },\n [h(LandLayer), children]\n ),\n ]);\n}\n\ntype ColumnNavigationSVGMapProps = any;\nexport type { ColumnNavigationSVGMapProps };\n\nexport function ColumnNavigationSVGMap(props) {\n const {\n currentColumn,\n setCurrentColumn,\n children,\n style,\n margin = 10,\n scale,\n className,\n showInProcessColumns = false,\n showDebugLayers = false,\n center,\n ...rest\n } = props;\n\n let _center: LngLatLike | null = center ?? [-100, 38];\n // Override center if currentColumn is set\n if (currentColumn != null) {\n _center = geoCentroid(currentColumn);\n }\n\n console.log(currentColumn);\n\n return h(\n ResizableMapFrame,\n { center: _center, style, margin, scale, className },\n [\n children,\n h(Columns, {\n onChange: setCurrentColumn,\n col_id: currentColumn?.properties.col_id,\n showDebugLayers,\n ...rest,\n }),\n h.if(showInProcessColumns)(Columns, {\n onChange: setCurrentColumn,\n col_id: currentColumn?.properties.col_id,\n status_code: \"in process\",\n color: \"rgba(200,150,150, 0.5)\",\n ...rest,\n }),\n h.if(currentColumn != null)(CurrentColumn, { feature: currentColumn }),\n ]\n );\n}\n\nexport * from \"./layers\";\n"],"names":[],"version":3,"file":"svg.4b9a96c1.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"","sources":["packages/column-views/src/units/types.ts"],"sourcesContent":["export interface IUnit {\n unit_id: number;\n col_id: number;\n section_id: number;\n t_age: number;\n b_age: number;\n [x: string]: any;\n}\n\nexport interface RectBounds {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n"],"names":[],"version":3,"file":"types.0f0b57c9.js.map"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {UnitDetailsPanel as $448b24baeef3b229$export$fbd245232df17557, LegendPanelHeader as $448b24baeef3b229$export$fc503c39cc5cff43, UnitDetailsFeature as $448b24baeef3b229$export$ec297f6f9a6ccad0, Duration as $448b24baeef3b229$export$3b11bc38611c5941} from "./panel.598f76a5.js";
|
|
2
|
+
import {UnitDetailsPopover as $a9bcb536274d1bf9$export$6716aecc2c9afbe2, UnitSelectionPopover as $a9bcb536274d1bf9$export$db1115efab13710d} from "./popover.a810b7bc.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export {$448b24baeef3b229$export$fbd245232df17557 as UnitDetailsPanel, $448b24baeef3b229$export$fc503c39cc5cff43 as LegendPanelHeader, $448b24baeef3b229$export$ec297f6f9a6ccad0 as UnitDetailsFeature, $448b24baeef3b229$export$3b11bc38611c5941 as Duration, $a9bcb536274d1bf9$export$6716aecc2c9afbe2 as UnitDetailsPopover, $a9bcb536274d1bf9$export$db1115efab13710d as UnitSelectionPopover};
|
|
9
|
+
//# sourceMappingURL=unit-details.071cefed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"","sources":["packages/column-views/src/unit-details/index.ts"],"sourcesContent":["export * from \"./panel\";\nexport * from \"./popover\";\n"],"names":[],"version":3,"file":"unit-details.071cefed.js.map"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {UnitNamesColumn as $bc17276da4abb183$export$594d19cdd88f8c16} from "./names.a8f2b452.js";
|
|
2
|
+
import {UnitBoxes as $d254716a820e9c85$export$5d1cdfabe8dc8085} from "./boxes.8292cff2.js";
|
|
3
|
+
import {TrackedLabeledUnit as $8c8238faa5cde49c$export$f613830566442374, LabelTrackerProvider as $8c8238faa5cde49c$export$e4e89ab6c86ac513, CompositeUnitComponent as $8c8238faa5cde49c$export$1dfa200d57964eee, CompositeUnitsColumn as $8c8238faa5cde49c$export$a6684360fef0406e, AnnotatedUnitsColumn as $8c8238faa5cde49c$export$d8c3f2fdd653a082, SectionLabelsColumn as $8c8238faa5cde49c$export$13984e34afdbb040, compositeScale as $8c8238faa5cde49c$export$723b790ebe9cdff8} from "./composite.039e4798.js";
|
|
4
|
+
import "./types.0f0b57c9.js";
|
|
5
|
+
import {useUnitSelectionDispatch as $4d5d1c15f39f6a14$export$77a278d5ca56e309, useUnitSelectionStore as $4d5d1c15f39f6a14$export$b220b1d3591dc9e5, useSelectedUnit as $4d5d1c15f39f6a14$export$f0dd93f90aa8e5da, UnitSelectionProvider as $4d5d1c15f39f6a14$export$f19d75b1d4b676a4, useUnitSelectionTarget as $4d5d1c15f39f6a14$export$cbbec12b1451fe7d, UnitKeyboardNavigation as $4d5d1c15f39f6a14$export$70f5ee19650fc7d1} from "./selection.f5b0297e.js";
|
|
6
|
+
import {getMixedUnitColor as $6698edd2a743bf07$export$175d3e927f1a9860} from "./colors.395c6db5.js";
|
|
7
|
+
import {useLithologies as $774a5efa27d1c77b$export$4d18a90c945d129f} from "./base.910b80b4.js";
|
|
8
|
+
import {resolveID as $d3e69bd163d41f63$export$7be7d732f3de9464} from "./resolvers.36013b49.js";
|
|
9
|
+
import $7H3th$macrostrathyper from "@macrostrat/hyper";
|
|
10
|
+
import {LithologyColumn as $7H3th$LithologyColumn, useColumnLayout as $7H3th$useColumnLayout, useGeologicPattern as $7H3th$useGeologicPattern} from "@macrostrat/column-components";
|
|
11
|
+
import {useInDarkMode as $7H3th$useInDarkMode} from "@macrostrat/ui-components";
|
|
12
|
+
import {useMemo as $7H3th$useMemo} from "react";
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
function $4c8184c4a7317749$export$3750278673318c9a({ width: width = 100 }) {
|
|
27
|
+
/*
|
|
28
|
+
A column showing units with USGS color fill
|
|
29
|
+
*/ return (0, $7H3th$macrostrathyper)((0, $7H3th$LithologyColumn), {
|
|
30
|
+
width: width
|
|
31
|
+
}, (0, $7H3th$macrostrathyper)((0, $d254716a820e9c85$export$5d1cdfabe8dc8085)));
|
|
32
|
+
}
|
|
33
|
+
function $4c8184c4a7317749$export$2006342ddaa547c6(props) {
|
|
34
|
+
/*
|
|
35
|
+
A column with units and names either
|
|
36
|
+
overlapping or offset to the right
|
|
37
|
+
*/ const { columnWidth: columnWidth, width: width, gutterWidth: gutterWidth = 0, labelOffset: labelOffset = 30 } = props;
|
|
38
|
+
return (0, $7H3th$macrostrathyper)([
|
|
39
|
+
(0, $7H3th$macrostrathyper)($4c8184c4a7317749$export$3750278673318c9a, {
|
|
40
|
+
width: columnWidth
|
|
41
|
+
}),
|
|
42
|
+
(0, $7H3th$macrostrathyper)((0, $bc17276da4abb183$export$594d19cdd88f8c16), {
|
|
43
|
+
transform: `translate(${columnWidth + gutterWidth})`,
|
|
44
|
+
paddingLeft: labelOffset,
|
|
45
|
+
width: width - columnWidth - gutterWidth
|
|
46
|
+
})
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
function $4c8184c4a7317749$export$48a4cacf2b7a4441({ division: division, nColumns: nColumns = 2, ...rest }) {
|
|
50
|
+
const width = rest.width ?? (0, $7H3th$useColumnLayout)()?.width;
|
|
51
|
+
const nOverlappingUnits = division.overlappingUnits?.length ?? 0;
|
|
52
|
+
const columnIx = (division.column ?? 0) % nColumns;
|
|
53
|
+
return (0, $7H3th$macrostrathyper)((0, $8c8238faa5cde49c$export$f613830566442374), {
|
|
54
|
+
division: division,
|
|
55
|
+
...rest,
|
|
56
|
+
width: nOverlappingUnits > 0 ? width / nColumns : width,
|
|
57
|
+
x: columnIx * width / nColumns
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function $4c8184c4a7317749$export$6012fd1584b5d0c0(props) {
|
|
61
|
+
/** A unit component that is colored using a mixture of lithologies.
|
|
62
|
+
* This is a separate component because it depends on more providers/contexts to determine coloring. */ const lithMap = (0, $774a5efa27d1c77b$export$4d18a90c945d129f)();
|
|
63
|
+
const inDarkMode = (0, $7H3th$useInDarkMode)();
|
|
64
|
+
const backgroundColor = (0, $7H3th$useMemo)(()=>{
|
|
65
|
+
return (0, $6698edd2a743bf07$export$175d3e927f1a9860)(props.division, lithMap, inDarkMode);
|
|
66
|
+
}, [
|
|
67
|
+
props.division?.unit_id,
|
|
68
|
+
lithMap,
|
|
69
|
+
inDarkMode
|
|
70
|
+
]);
|
|
71
|
+
const patternID = (0, $7H3th$useMemo)(()=>{
|
|
72
|
+
return (0, $d3e69bd163d41f63$export$7be7d732f3de9464)(props.division); // ?? getPatternID(props.division.lith, lithMap);
|
|
73
|
+
}, [
|
|
74
|
+
props.division?.unit_id,
|
|
75
|
+
lithMap
|
|
76
|
+
]);
|
|
77
|
+
const fill = (0, $7H3th$useGeologicPattern)(patternID);
|
|
78
|
+
return (0, $7H3th$macrostrathyper)($4c8184c4a7317749$export$48a4cacf2b7a4441, {
|
|
79
|
+
fill: fill,
|
|
80
|
+
backgroundColor: backgroundColor,
|
|
81
|
+
...props
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function $4c8184c4a7317749$var$getPatternID(liths, lithMap) {
|
|
85
|
+
if (lithMap == null || liths == null || liths.length == 0) return null;
|
|
86
|
+
const patternIDs = new Set();
|
|
87
|
+
for (const lith of liths){
|
|
88
|
+
const lithData = lithMap.get(lith.lith_id);
|
|
89
|
+
if (lithData) patternIDs.add(`${lithData.fill}`);
|
|
90
|
+
}
|
|
91
|
+
let id = patternIDs.values()[0];
|
|
92
|
+
if (id == "0") return null;
|
|
93
|
+
return id;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
export {$4c8184c4a7317749$export$3750278673318c9a as UnitsColumn, $4c8184c4a7317749$export$2006342ddaa547c6 as SimpleUnitsColumn, $4c8184c4a7317749$export$48a4cacf2b7a4441 as UnitComponent, $4c8184c4a7317749$export$6012fd1584b5d0c0 as ColoredUnitComponent, $8c8238faa5cde49c$export$e4e89ab6c86ac513 as LabelTrackerProvider, $8c8238faa5cde49c$export$f613830566442374 as TrackedLabeledUnit, $8c8238faa5cde49c$export$1dfa200d57964eee as CompositeUnitComponent, $8c8238faa5cde49c$export$a6684360fef0406e as CompositeUnitsColumn, $8c8238faa5cde49c$export$d8c3f2fdd653a082 as AnnotatedUnitsColumn, $8c8238faa5cde49c$export$13984e34afdbb040 as SectionLabelsColumn, $8c8238faa5cde49c$export$723b790ebe9cdff8 as compositeScale, $4d5d1c15f39f6a14$export$77a278d5ca56e309 as useUnitSelectionDispatch, $4d5d1c15f39f6a14$export$b220b1d3591dc9e5 as useUnitSelectionStore, $4d5d1c15f39f6a14$export$f0dd93f90aa8e5da as useSelectedUnit, $4d5d1c15f39f6a14$export$f19d75b1d4b676a4 as UnitSelectionProvider, $4d5d1c15f39f6a14$export$cbbec12b1451fe7d as useUnitSelectionTarget, $4d5d1c15f39f6a14$export$70f5ee19650fc7d1 as UnitKeyboardNavigation, $6698edd2a743bf07$export$175d3e927f1a9860 as getMixedUnitColor};
|
|
98
|
+
//# sourceMappingURL=units.5a4fc058.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsBO,SAAS,0CAAY,SAAE,QAAQ,KAAK;IACzC;;EAEA,GACA,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,sBAAc,GAAG;eAAE;IAAM,GAAG,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAQ;AACjD;AAEO,SAAS,0CAAkB,KAA0B;IAC1D;;;EAGA,GACA,MAAM,eAAE,WAAW,SAAE,KAAK,eAAE,cAAc,gBAAG,cAAc,IAAI,GAAG;IAElE,OAAO,CAAA,GAAA,sBAAA,EAAE;QACP,CAAA,GAAA,sBAAA,EAAE,2CAAa;YACb,OAAO;QACT;QACA,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAc,GAAG;YACjB,WAAW,CAAC,UAAU,EAAE,cAAc,YAAY,CAAC,CAAC;YACpD,aAAa;YACb,OAAO,QAAQ,cAAc;QAC/B;KACD;AACH;AAEO,SAAS,0CAAc,YAAE,QAAQ,YAAE,WAAW,GAAG,GAAG,MAAM;IAC/D,MAAM,QAAQ,KAAK,KAAK,IAAI,CAAA,GAAA,sBAAc,KAAK;IAE/C,MAAM,oBAAoB,SAAS,gBAAgB,EAAE,UAAU;IAC/D,MAAM,WAAW,AAAC,CAAA,SAAS,MAAM,IAAI,CAAA,IAAK;IAE1C,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAiB,GAAG;kBAC3B;QACA,GAAG,IAAI;QACP,OAAO,oBAAoB,IAAI,QAAQ,WAAW;QAClD,GAAG,AAAC,WAAW,QAAS;IAC1B;AACF;AAEO,SAAS,0CAAqB,KAAK;IACxC;uGACqG,GACrG,MAAM,UAAU,CAAA,GAAA,yCAAa;IAC7B,MAAM,aAAa,CAAA,GAAA,oBAAY;IAE/B,MAAM,kBAAkB,CAAA,GAAA,cAAM,EAAE;QAC9B,OAAO,CAAA,GAAA,yCAAgB,EAAE,MAAM,QAAQ,EAAE,SAAS;IACpD,GAAG;QAAC,MAAM,QAAQ,EAAE;QAAS;QAAS;KAAW;IAEjD,MAAM,YAAY,CAAA,GAAA,cAAM,EAAE;QACxB,OAAO,CAAA,GAAA,yCAAQ,EAAE,MAAM,QAAQ,GAAG,iDAAiD;IACrF,GAAG;QAAC,MAAM,QAAQ,EAAE;QAAS;KAAQ;IAErC,MAAM,OAAO,CAAA,GAAA,yBAAiB,EAAE;IAEhC,OAAO,CAAA,GAAA,sBAAA,EAAE,2CAAe;cACtB;yBACA;QACA,GAAG,KAAK;IACV;AACF;AAEA,SAAS,mCACP,KAAuB,EACvB,OAA+B;IAE/B,IAAI,WAAW,QAAQ,SAAS,QAAQ,MAAM,MAAM,IAAI,GACtD,OAAO;IAET,MAAM,aAAa,IAAI;IACvB,KAAK,MAAM,QAAQ,MAAO;QACxB,MAAM,WAAW,QAAQ,GAAG,CAAC,KAAK,OAAO;QACzC,IAAI,UACF,WAAW,GAAG,CAAC,GAAG,SAAS,IAAI,EAAE;IAErC;IACA,IAAI,KAAK,WAAW,MAAM,EAAE,CAAC,EAAE;IAC/B,IAAI,MAAM,KAAK,OAAO;IACtB,OAAO;AACT","sources":["packages/column-views/src/units/index.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport {\n LithologyColumn,\n useGeologicPattern,\n} from \"@macrostrat/column-components\";\nimport { UnitNamesColumn } from \"./names\";\nimport { ICompositeUnitProps } from \"./composite\";\nimport { UnitBoxes } from \"./boxes\";\nimport { useColumnLayout } from \"@macrostrat/column-components\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport { getMixedUnitColor } from \"./colors\";\nimport { TrackedLabeledUnit } from \"./composite\";\nimport { useLithologies } from \"../data-provider\";\nimport { useMemo } from \"react\";\nimport { resolveID } from \"./resolvers\";\nimport { Lithology } from \"@macrostrat/api-types\";\n\nexport * from \"./composite\";\nexport * from \"./types\";\nexport * from \"./selection\";\nexport * from \"./colors\";\n\nexport function UnitsColumn({ width = 100 }) {\n /*\n A column showing units with USGS color fill\n */\n return h(LithologyColumn, { width }, h(UnitBoxes));\n}\n\nexport function SimpleUnitsColumn(props: ICompositeUnitProps) {\n /*\n A column with units and names either\n overlapping or offset to the right\n */\n const { columnWidth, width, gutterWidth = 0, labelOffset = 30 } = props;\n\n return h([\n h(UnitsColumn, {\n width: columnWidth,\n }),\n h(UnitNamesColumn, {\n transform: `translate(${columnWidth + gutterWidth})`,\n paddingLeft: labelOffset,\n width: width - columnWidth - gutterWidth,\n }),\n ]);\n}\n\nexport function UnitComponent({ division, nColumns = 2, ...rest }) {\n const width = rest.width ?? useColumnLayout()?.width;\n\n const nOverlappingUnits = division.overlappingUnits?.length ?? 0;\n const columnIx = (division.column ?? 0) % nColumns;\n\n return h(TrackedLabeledUnit, {\n division,\n ...rest,\n width: nOverlappingUnits > 0 ? width / nColumns : width,\n x: (columnIx * width) / nColumns,\n });\n}\n\nexport function ColoredUnitComponent(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */\n const lithMap = useLithologies();\n const inDarkMode = useInDarkMode();\n\n const backgroundColor = useMemo(() => {\n return getMixedUnitColor(props.division, lithMap, inDarkMode);\n }, [props.division?.unit_id, lithMap, inDarkMode]);\n\n const patternID = useMemo(() => {\n return resolveID(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [props.division?.unit_id, lithMap]);\n\n const fill = useGeologicPattern(patternID);\n\n return h(UnitComponent, {\n fill,\n backgroundColor,\n ...props,\n });\n}\n\nfunction getPatternID(\n liths: Array<Lithology>,\n lithMap: Map<number, Lithology>\n): string | null {\n if (lithMap == null || liths == null || liths.length == 0) {\n return null;\n }\n const patternIDs = new Set<string>();\n for (const lith of liths) {\n const lithData = lithMap.get(lith.lith_id);\n if (lithData) {\n patternIDs.add(`${lithData.fill}`);\n }\n }\n let id = patternIDs.values()[0];\n if (id == \"0\") return null;\n return id;\n}\n"],"names":[],"version":3,"file":"units.5a4fc058.js.map"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {compareAgeRanges as $1qVxh$compareAgeRanges, AgeRangeRelationship as $1qVxh$AgeRangeRelationship} from "@macrostrat/stratigraphy-utils";
|
|
2
|
+
import {ColumnAxisType as $1qVxh$ColumnAxisType} from "@macrostrat/column-components";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const $b6657fba8924a702$var$dt = 0.001;
|
|
7
|
+
const $b6657fba8924a702$export$f1a15f539858307 = function(a, b, axisType = (0, $1qVxh$ColumnAxisType).AGE, tolerance = 0.001) {
|
|
8
|
+
const rel = (0, $1qVxh$compareAgeRanges)($b6657fba8924a702$export$70e712e2ac0237a(a, axisType), $b6657fba8924a702$export$70e712e2ac0237a(b, axisType), tolerance);
|
|
9
|
+
return rel != (0, $1qVxh$AgeRangeRelationship).Disjoint;
|
|
10
|
+
};
|
|
11
|
+
function $b6657fba8924a702$export$d92a67740c050efb(a, b, tolerance = $b6657fba8924a702$var$dt) {
|
|
12
|
+
return $b6657fba8924a702$export$f1a15f539858307(a, b, (0, $1qVxh$ColumnAxisType).AGE, tolerance);
|
|
13
|
+
}
|
|
14
|
+
function $b6657fba8924a702$export$70e712e2ac0237a(unit, axisType) {
|
|
15
|
+
switch(axisType){
|
|
16
|
+
case (0, $1qVxh$ColumnAxisType).AGE:
|
|
17
|
+
return [
|
|
18
|
+
unit.b_clip_pos ?? unit.b_age,
|
|
19
|
+
unit.t_clip_pos ?? unit.t_age
|
|
20
|
+
];
|
|
21
|
+
case (0, $1qVxh$ColumnAxisType).DEPTH:
|
|
22
|
+
case (0, $1qVxh$ColumnAxisType).ORDINAL:
|
|
23
|
+
case (0, $1qVxh$ColumnAxisType).HEIGHT:
|
|
24
|
+
return [
|
|
25
|
+
unit.b_clip_pos ?? unit.b_pos,
|
|
26
|
+
unit.t_clip_pos ?? unit.t_pos
|
|
27
|
+
];
|
|
28
|
+
default:
|
|
29
|
+
throw new Error(`Unknown axis type: ${axisType}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const $b6657fba8924a702$export$ab14c04795685c55 = (axisType)=>{
|
|
33
|
+
return (a, b)=>{
|
|
34
|
+
const a_pos = $b6657fba8924a702$export$70e712e2ac0237a(a, axisType);
|
|
35
|
+
const b_pos = $b6657fba8924a702$export$70e712e2ac0237a(b, axisType);
|
|
36
|
+
const d_top = a_pos[1] - b_pos[1];
|
|
37
|
+
if (d_top != 0) return d_top;
|
|
38
|
+
return a_pos[0] - b_pos[0];
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
function $b6657fba8924a702$export$d0c8ecbd4ed8940c(x) {
|
|
42
|
+
if (Array.isArray(x)) return x;
|
|
43
|
+
return [
|
|
44
|
+
x
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
function $b6657fba8924a702$export$97de5b0a6b4e4dac(x) {
|
|
48
|
+
if (typeof x == "string") x = parseFloat(x);
|
|
49
|
+
if (isNaN(x)) return null;
|
|
50
|
+
return x;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
export {$b6657fba8924a702$export$f1a15f539858307 as unitsOverlap, $b6657fba8924a702$export$70e712e2ac0237a as getUnitHeightRange, $b6657fba8924a702$export$d92a67740c050efb as agesOverlap, $b6657fba8924a702$export$ab14c04795685c55 as createUnitSorter, $b6657fba8924a702$export$d0c8ecbd4ed8940c as ensureArray, $b6657fba8924a702$export$97de5b0a6b4e4dac as ensureRealFloat};
|
|
55
|
+
//# sourceMappingURL=utils.d7a43a2a.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;AAQA,MAAM,2BAAK;AAiBJ,MAAM,2CAA6B,SACxC,CAAC,EACD,CAAC,EACD,WAA2B,CAAA,GAAA,qBAAa,EAAE,GAAG,EAC7C,YAAoB,KAAK;IAEzB,MAAM,MAAM,CAAA,GAAA,uBAAe,EACzB,yCAAmB,GAAG,WACtB,yCAAmB,GAAG,WACtB;IAEF,OAAO,OAAO,CAAA,GAAA,2BAAmB,EAAE,QAAQ;AAC7C;AAGO,SAAS,0CACd,CAAuB,EACvB,CAAuB,EACvB,YAAoB,wBAAE;IAEtB,OAAO,yCAAa,GAAG,GAAG,CAAA,GAAA,qBAAa,EAAE,GAAG,EAAE;AAChD;AAQO,SAAS,yCACd,IAAyB,EACzB,QAAwB;IAExB,OAAQ;QACN,KAAK,CAAA,GAAA,qBAAa,EAAE,GAAG;YACrB,OAAO;gBAAC,KAAK,UAAU,IAAI,KAAK,KAAK;gBAAE,KAAK,UAAU,IAAI,KAAK,KAAK;aAAC;QACvE,KAAK,CAAA,GAAA,qBAAa,EAAE,KAAK;QACzB,KAAK,CAAA,GAAA,qBAAa,EAAE,OAAO;QAC3B,KAAK,CAAA,GAAA,qBAAa,EAAE,MAAM;YACxB,OAAO;gBAAC,KAAK,UAAU,IAAI,KAAK,KAAK;gBAAE,KAAK,UAAU,IAAI,KAAK,KAAK;aAAC;QACvE;YACE,MAAM,IAAI,MAAM,CAAC,mBAAmB,EAAE,UAAU;IACpD;AACF;AAEO,MAAM,4CAAmB,CAAC;IAC/B,OAAO,CAAC,GAAa;QACnB,MAAM,QAAQ,yCAAmB,GAAG;QACpC,MAAM,QAAQ,yCAAmB,GAAG;QACpC,MAAM,QAAQ,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE;QACjC,IAAI,SAAS,GACX,OAAO;QAET,OAAO,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE;IAC5B;AACF;AAEO,SAAS,0CAAe,CAAU;IACvC,IAAI,MAAM,OAAO,CAAC,IAChB,OAAO;IAET,OAAO;QAAC;KAAE;AACZ;AAEO,SAAS,0CAAgB,CAAyB;IACvD,IAAI,OAAO,KAAK,UACd,IAAI,WAAW;IAEjB,IAAI,MAAM,IACR,OAAO;IAET,OAAO;AACT","sources":["packages/column-views/src/prepare-units/utils.ts"],"sourcesContent":["import type { BaseUnit } from \"@macrostrat/api-types\";\nimport {\n AgeRangeRelationship,\n compareAgeRanges,\n} from \"@macrostrat/stratigraphy-utils\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport { StratigraphicPackage } from \"./helpers\";\n\nconst dt = 0.001;\n\ninterface UnitsOverlap {\n (\n a: StratigraphicPackage,\n b: StratigraphicPackage,\n axisType?: ColumnAxisType.AGE,\n tolerance?: number\n ): boolean;\n (\n a: BaseUnit,\n b: BaseUnit,\n axisType: ColumnAxisType,\n tolerance?: number\n ): boolean;\n}\n\nexport const unitsOverlap: UnitsOverlap = function (\n a,\n b,\n axisType: ColumnAxisType = ColumnAxisType.AGE,\n tolerance: number = 0.001\n): boolean {\n const rel = compareAgeRanges(\n getUnitHeightRange(a, axisType),\n getUnitHeightRange(b, axisType),\n tolerance\n );\n return rel != AgeRangeRelationship.Disjoint;\n};\n\n/** A more permissive overlap function in the age space */\nexport function agesOverlap(\n a: StratigraphicPackage,\n b: StratigraphicPackage,\n tolerance: number = dt\n): boolean {\n return unitsOverlap(a, b, ColumnAxisType.AGE, tolerance);\n}\n\ninterface PossiblyClippedUnit extends BaseUnit {\n // Internally created clipped positions\n t_clip_pos?: number;\n b_clip_pos?: number;\n}\n\nexport function getUnitHeightRange(\n unit: PossiblyClippedUnit,\n axisType: ColumnAxisType\n): [number, number] {\n switch (axisType) {\n case ColumnAxisType.AGE:\n return [unit.b_clip_pos ?? unit.b_age, unit.t_clip_pos ?? unit.t_age];\n case ColumnAxisType.DEPTH:\n case ColumnAxisType.ORDINAL:\n case ColumnAxisType.HEIGHT:\n return [unit.b_clip_pos ?? unit.b_pos, unit.t_clip_pos ?? unit.t_pos];\n default:\n throw new Error(`Unknown axis type: ${axisType}`);\n }\n}\n\nexport const createUnitSorter = (axisType: ColumnAxisType) => {\n return (a: BaseUnit, b: BaseUnit) => {\n const a_pos = getUnitHeightRange(a, axisType);\n const b_pos = getUnitHeightRange(b, axisType);\n const d_top = a_pos[1] - b_pos[1];\n if (d_top != 0) {\n return d_top;\n }\n return a_pos[0] - b_pos[0];\n };\n};\n\nexport function ensureArray<T>(x: T | T[]): T[] {\n if (Array.isArray(x)) {\n return x;\n }\n return [x];\n}\n\nexport function ensureRealFloat(x: number | string | null): number | null {\n if (typeof x == \"string\") {\n x = parseFloat(x);\n }\n if (isNaN(x)) {\n return null;\n }\n return x;\n}\n"],"names":[],"version":3,"file":"utils.d7a43a2a.js.map"}
|
package/dist/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"","sources":["packages/column-views/src/index.ts"],"sourcesContent":["export * from \"./units\";\nexport * from \"./age-axis\";\nexport * from \"./carbon-isotopes\";\nexport * from \"./
|
|
1
|
+
{"mappings":"","sources":["packages/column-views/src/index.ts"],"sourcesContent":["export * from \"./units\";\nexport * from \"./data-provider\";\nexport * from \"./age-axis\";\nexport * from \"./carbon-isotopes\";\nexport * from \"./prepare-units\";\nexport * from \"./column\";\nexport * from \"./unit-details\";\nexport * from \"./maps\";\nexport * from \"./age-model-overlay\";\nexport * from \"./correlation-chart\";\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../../../../"}
|