@macrostrat/column-views 2.3.2 → 2.4.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 +11 -0
- package/dist/esm/{column-views.ce3a3ac8.js → column-views.0f910df6.js} +2 -2
- package/dist/esm/{column-views.ce3a3ac8.js.map → column-views.0f910df6.js.map} +1 -1
- package/dist/esm/{column-views.4e6eead3.js → column-views.1cd57b96.js} +2 -2
- package/dist/esm/{column-views.4e6eead3.js.map → column-views.1cd57b96.js.map} +1 -1
- package/dist/esm/{column-views.ee9d71ba.js → column-views.1d356b7e.js} +2 -2
- package/dist/esm/{column-views.ee9d71ba.js.map → column-views.1d356b7e.js.map} +1 -1
- package/dist/esm/{column-views.3d3e00be.js → column-views.1ef0f7e8.js} +2 -2
- package/dist/esm/{column-views.3d3e00be.js.map → column-views.1ef0f7e8.js.map} +1 -1
- package/dist/esm/{column-views.ad2fe46c.js → column-views.1f954206.js} +2 -2
- package/dist/esm/{column-views.ad2fe46c.js.map → column-views.1f954206.js.map} +1 -1
- package/dist/esm/{column-views.24060b85.js → column-views.25713aad.js} +4 -4
- package/dist/esm/{column-views.24060b85.js.map → column-views.25713aad.js.map} +1 -1
- package/dist/esm/{column-views.9ffc089b.js → column-views.28cab78c.js} +3 -3
- package/dist/esm/{column-views.9ffc089b.js.map → column-views.28cab78c.js.map} +1 -1
- package/dist/esm/column-views.2e517e39.js +126 -0
- package/dist/esm/column-views.2e517e39.js.map +1 -0
- package/dist/esm/{column-views.18aac6a5.js → column-views.3067c5e3.js} +3 -3
- package/dist/esm/{column-views.18aac6a5.js.map → column-views.3067c5e3.js.map} +1 -1
- package/dist/esm/{column-views.6f96d1c3.js → column-views.31152763.js} +20 -17
- package/dist/esm/column-views.31152763.js.map +1 -0
- package/dist/esm/{column-views.04636815.js → column-views.33daabd5.js} +5 -5
- package/dist/esm/{column-views.04636815.js.map → column-views.33daabd5.js.map} +1 -1
- package/dist/esm/{column-views.e075af15.js → column-views.3c1cde51.js} +2 -2
- package/dist/esm/{column-views.e075af15.js.map → column-views.3c1cde51.js.map} +1 -1
- package/dist/esm/{column-views.0da4503a.js → column-views.3c9f5ba9.js} +2 -2
- package/dist/esm/{column-views.0da4503a.js.map → column-views.3c9f5ba9.js.map} +1 -1
- package/dist/esm/{column-views.c149f7a5.js → column-views.3d33ef0f.js} +3 -3
- package/dist/esm/{column-views.c149f7a5.js.map → column-views.3d33ef0f.js.map} +1 -1
- package/dist/esm/{column-views.8d972657.js → column-views.4099a246.js} +3 -3
- package/dist/esm/{column-views.8d972657.js.map → column-views.4099a246.js.map} +1 -1
- package/dist/esm/{column-views.b9265595.js → column-views.45acb682.js} +6 -6
- package/dist/esm/column-views.45acb682.js.map +1 -0
- package/dist/esm/{column-views.26e0e0b6.js → column-views.4e5746da.js} +2 -2
- package/dist/esm/{column-views.26e0e0b6.js.map → column-views.4e5746da.js.map} +1 -1
- package/dist/esm/{column-views.f7cdf6be.js → column-views.55bce35c.js} +3 -3
- package/dist/esm/{column-views.f7cdf6be.js.map → column-views.55bce35c.js.map} +1 -1
- package/dist/esm/{column-views.029ea8f1.js → column-views.631f55d4.js} +3 -3
- package/dist/esm/{column-views.029ea8f1.js.map → column-views.631f55d4.js.map} +1 -1
- package/dist/esm/column-views.67804ce5.js +68 -0
- package/dist/esm/column-views.67804ce5.js.map +1 -0
- package/dist/esm/column-views.8168c37d.js +113 -0
- package/dist/esm/column-views.8168c37d.js.map +1 -0
- package/dist/esm/{column-views.b977da35.js → column-views.848349c0.js} +5 -5
- package/dist/esm/{column-views.b977da35.js.map → column-views.848349c0.js.map} +1 -1
- package/dist/esm/{column-views.73fc96cb.js → column-views.86b879ba.js} +5 -5
- package/dist/esm/{column-views.73fc96cb.js.map → column-views.86b879ba.js.map} +1 -1
- package/dist/esm/{column-views.d6c0b7bc.js → column-views.8c8f3fe0.js} +2 -2
- package/dist/esm/{column-views.d6c0b7bc.js.map → column-views.8c8f3fe0.js.map} +1 -1
- package/dist/esm/{column-views.3f1cdc18.js → column-views.9b210fb2.js} +2 -2
- package/dist/esm/{column-views.3f1cdc18.js.map → column-views.9b210fb2.js.map} +1 -1
- package/dist/esm/{column-views.4685ea28.js → column-views.9d0d78aa.js} +2 -2
- package/dist/esm/{column-views.4685ea28.js.map → column-views.9d0d78aa.js.map} +1 -1
- package/dist/esm/{column-views.e3f0cd7b.js → column-views.af89f2b1.js} +23 -33
- package/dist/esm/column-views.af89f2b1.js.map +1 -0
- package/dist/esm/{column-views.75b83110.js → column-views.b3398cca.js} +5 -5
- package/dist/esm/{column-views.75b83110.js.map → column-views.b3398cca.js.map} +1 -1
- package/dist/esm/{column-views.2f979aee.js → column-views.b7b0be88.js} +3 -3
- package/dist/esm/{column-views.2f979aee.js.map → column-views.b7b0be88.js.map} +1 -1
- package/dist/esm/{column-views.d1b49f5c.js → column-views.b8933ea2.js} +2 -2
- package/dist/esm/{column-views.d1b49f5c.js.map → column-views.b8933ea2.js.map} +1 -1
- package/dist/esm/{column-views.0a010643.js → column-views.b9c4d94c.js} +4 -4
- package/dist/esm/{column-views.0a010643.js.map → column-views.b9c4d94c.js.map} +1 -1
- package/dist/esm/{column-views.5fff0716.js → column-views.d3a4596e.js} +3 -3
- package/dist/esm/{column-views.5fff0716.js.map → column-views.d3a4596e.js.map} +1 -1
- package/dist/esm/{column-views.d5fff9b8.js → column-views.dda76243.js} +3 -3
- package/dist/esm/{column-views.d5fff9b8.js.map → column-views.dda76243.js.map} +1 -1
- package/dist/esm/{column-views.9d51a5ab.js → column-views.df872a2c.js} +2 -2
- package/dist/esm/column-views.df872a2c.js.map +1 -0
- package/dist/esm/{column-views.488f24b6.js → column-views.e21f4e50.js} +2 -2
- package/dist/esm/{column-views.488f24b6.js.map → column-views.e21f4e50.js.map} +1 -1
- package/dist/esm/{column-views.a665cbb2.js → column-views.f046b170.js} +5 -5
- package/dist/esm/{column-views.a665cbb2.js.map → column-views.f046b170.js.map} +1 -1
- package/dist/esm/{column-views.82a5112b.js → column-views.fc4d28d8.js} +4 -4
- package/dist/esm/{column-views.82a5112b.js.map → column-views.fc4d28d8.js.map} +1 -1
- package/dist/esm/{column-views.faa7e52e.js → column-views.fdb3799c.js} +3 -3
- package/dist/esm/{column-views.faa7e52e.js.map → column-views.fdb3799c.js.map} +1 -1
- package/dist/esm/index.d.ts +73 -57
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +11 -11
- package/dist/node/{column-views.75456275.js → column-views.00c19fe8.js} +2 -2
- package/dist/node/{column-views.75456275.js.map → column-views.00c19fe8.js.map} +1 -1
- package/dist/node/{column-views.7c322202.js → column-views.00caa49a.js} +2 -2
- package/dist/node/{column-views.7c322202.js.map → column-views.00caa49a.js.map} +1 -1
- package/dist/node/{column-views.9efa91f1.js → column-views.07680def.js} +2 -2
- package/dist/node/{column-views.9efa91f1.js.map → column-views.07680def.js.map} +1 -1
- package/dist/node/column-views.0980c2a0.js +2 -0
- package/dist/node/column-views.0980c2a0.js.map +1 -0
- package/dist/node/column-views.1495397b.js +2 -0
- package/dist/node/column-views.1495397b.js.map +1 -0
- package/dist/node/{column-views.47440961.js → column-views.190241c4.js} +2 -2
- package/dist/node/{column-views.47440961.js.map → column-views.190241c4.js.map} +1 -1
- package/dist/node/{column-views.fafbc028.js → column-views.1d1d6117.js} +2 -2
- package/dist/node/{column-views.fafbc028.js.map → column-views.1d1d6117.js.map} +1 -1
- package/dist/node/column-views.26306041.js +2 -0
- package/dist/node/column-views.26306041.js.map +1 -0
- package/dist/node/{column-views.6556e004.js → column-views.3ce34544.js} +2 -2
- package/dist/node/{column-views.6556e004.js.map → column-views.3ce34544.js.map} +1 -1
- package/dist/node/{column-views.c007152b.js → column-views.41d72280.js} +2 -2
- package/dist/node/{column-views.c007152b.js.map → column-views.41d72280.js.map} +1 -1
- package/dist/node/{column-views.59ce629d.js → column-views.4e677bc4.js} +2 -2
- package/dist/node/{column-views.59ce629d.js.map → column-views.4e677bc4.js.map} +1 -1
- package/dist/node/{column-views.2fe8feb9.js → column-views.60dc38f3.js} +2 -2
- package/dist/node/{column-views.2fe8feb9.js.map → column-views.60dc38f3.js.map} +1 -1
- package/dist/node/{column-views.d818b387.js → column-views.68fe4814.js} +2 -2
- package/dist/node/{column-views.d818b387.js.map → column-views.68fe4814.js.map} +1 -1
- package/dist/node/{column-views.3a947d58.js → column-views.69ddf14d.js} +2 -2
- package/dist/node/{column-views.3a947d58.js.map → column-views.69ddf14d.js.map} +1 -1
- package/dist/node/column-views.6d6a8fde.js +2 -0
- package/dist/node/column-views.6d6a8fde.js.map +1 -0
- package/dist/node/{column-views.08bef1f6.js → column-views.705f66b1.js} +2 -2
- package/dist/node/{column-views.08bef1f6.js.map → column-views.705f66b1.js.map} +1 -1
- package/dist/node/{column-views.8e846c57.js → column-views.7714173b.js} +2 -2
- package/dist/node/{column-views.8e846c57.js.map → column-views.7714173b.js.map} +1 -1
- package/dist/node/{column-views.a14f0134.js → column-views.7ee01d2b.js} +2 -2
- package/dist/node/{column-views.a14f0134.js.map → column-views.7ee01d2b.js.map} +1 -1
- package/dist/node/column-views.861b8e3e.js +2 -0
- package/dist/node/column-views.861b8e3e.js.map +1 -0
- package/dist/node/{column-views.c921fa1a.js → column-views.89afd6b3.js} +2 -2
- package/dist/node/{column-views.c921fa1a.js.map → column-views.89afd6b3.js.map} +1 -1
- package/dist/node/{column-views.8eae7028.js → column-views.8f5532b0.js} +2 -2
- package/dist/node/{column-views.8eae7028.js.map → column-views.8f5532b0.js.map} +1 -1
- package/dist/node/{column-views.67e7a200.js → column-views.97f7f353.js} +2 -2
- package/dist/node/{column-views.67e7a200.js.map → column-views.97f7f353.js.map} +1 -1
- package/dist/node/{column-views.3d0c2bea.js → column-views.9a408bbf.js} +2 -2
- package/dist/node/{column-views.3d0c2bea.js.map → column-views.9a408bbf.js.map} +1 -1
- package/dist/node/column-views.a0969fc8.js +2 -0
- package/dist/node/column-views.a0969fc8.js.map +1 -0
- package/dist/node/{column-views.02869dc5.js → column-views.a0e23210.js} +2 -2
- package/dist/node/{column-views.02869dc5.js.map → column-views.a0e23210.js.map} +1 -1
- package/dist/node/{column-views.8f540f78.js → column-views.a54c0820.js} +2 -2
- package/dist/node/{column-views.8f540f78.js.map → column-views.a54c0820.js.map} +1 -1
- package/dist/node/{column-views.0f401891.js → column-views.b3aa406d.js} +2 -2
- package/dist/node/{column-views.0f401891.js.map → column-views.b3aa406d.js.map} +1 -1
- package/dist/node/{column-views.0a2596c2.js → column-views.b7f69f19.js} +2 -2
- package/dist/node/{column-views.0a2596c2.js.map → column-views.b7f69f19.js.map} +1 -1
- package/dist/node/{column-views.cd54f1b1.js → column-views.b9900855.js} +2 -2
- package/dist/node/{column-views.cd54f1b1.js.map → column-views.b9900855.js.map} +1 -1
- package/dist/node/{column-views.6b391d60.js → column-views.bd1481f0.js} +2 -2
- package/dist/node/{column-views.6b391d60.js.map → column-views.bd1481f0.js.map} +1 -1
- package/dist/node/{column-views.e264a767.js → column-views.bf90c8a3.js} +2 -2
- package/dist/node/column-views.bf90c8a3.js.map +1 -0
- package/dist/node/{column-views.fee4e65d.js → column-views.bfaf5ddb.js} +2 -2
- package/dist/node/{column-views.fee4e65d.js.map → column-views.bfaf5ddb.js.map} +1 -1
- package/dist/node/{column-views.00ad98fa.js → column-views.dedafcae.js} +2 -2
- package/dist/node/{column-views.00ad98fa.js.map → column-views.dedafcae.js.map} +1 -1
- package/dist/node/{column-views.e153680b.js → column-views.e1481ea6.js} +2 -2
- package/dist/node/{column-views.e153680b.js.map → column-views.e1481ea6.js.map} +1 -1
- package/dist/node/{column-views.c4188442.js → column-views.e4e014cd.js} +2 -2
- package/dist/node/{column-views.c4188442.js.map → column-views.e4e014cd.js.map} +1 -1
- package/dist/node/{column-views.465e593b.js → column-views.ed7b4c16.js} +2 -2
- package/dist/node/{column-views.465e593b.js.map → column-views.ed7b4c16.js.map} +1 -1
- package/dist/node/{column-views.2577dec0.js → column-views.f749dbd6.js} +2 -2
- package/dist/node/{column-views.2577dec0.js.map → column-views.f749dbd6.js.map} +1 -1
- package/dist/node/{column-views.825d2719.js → column-views.fcf2be3c.js} +2 -2
- package/dist/node/{column-views.825d2719.js.map → column-views.fcf2be3c.js.map} +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/package.json +5 -4
- package/src/age-model-overlay.ts +4 -2
- package/src/column.ts +18 -41
- package/src/correlation-chart/main.ts +11 -9
- package/src/data-provider/core.ts +89 -0
- package/src/data-provider/store.ts +79 -88
- package/src/data-provider/unit-selection.ts +120 -147
- package/src/unit-details/popover.ts +8 -4
- package/dist/esm/column-views.4b259f9e.js +0 -136
- package/dist/esm/column-views.4b259f9e.js.map +0 -1
- package/dist/esm/column-views.6f96d1c3.js.map +0 -1
- package/dist/esm/column-views.9d51a5ab.js.map +0 -1
- package/dist/esm/column-views.b9265595.js.map +0 -1
- package/dist/esm/column-views.c44febd0.js +0 -169
- package/dist/esm/column-views.c44febd0.js.map +0 -1
- package/dist/esm/column-views.e3f0cd7b.js.map +0 -1
- package/dist/node/column-views.0beae29d.js +0 -2
- package/dist/node/column-views.0beae29d.js.map +0 -1
- package/dist/node/column-views.46efb749.js +0 -2
- package/dist/node/column-views.46efb749.js.map +0 -1
- package/dist/node/column-views.868c04dc.js +0 -2
- package/dist/node/column-views.868c04dc.js.map +0 -1
- package/dist/node/column-views.dfe9a971.js +0 -2
- package/dist/node/column-views.dfe9a971.js.map +0 -1
- package/dist/node/column-views.e264a767.js.map +0 -1
- package/dist/node/column-views.ed2fd268.js +0 -2
- package/dist/node/column-views.ed2fd268.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file. The format
|
|
|
4
4
|
is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this
|
|
5
5
|
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [2.4.0] - 2025-12-15
|
|
8
|
+
|
|
9
|
+
- Remove `UnitSelectionProvider` in favor of `jotai` state management
|
|
10
|
+
- Refactor selected unit state management to use `jotai` atoms
|
|
11
|
+
- Improve performance of unit selection and rendering
|
|
12
|
+
- Update dependencies
|
|
13
|
+
|
|
14
|
+
## [2.3.3] - 2025-12-14
|
|
15
|
+
|
|
16
|
+
Upgraded `jotai` and `jotai-scope` dependencies
|
|
17
|
+
|
|
7
18
|
## [2.3.2] - 2025-12-13
|
|
8
19
|
|
|
9
20
|
Remove duplicate exports; fix typings
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useCorrelationMapStore as $74e211dc185c20b4$export$21398703d3a9bb4d} from "./column-views.
|
|
1
|
+
import {useCorrelationMapStore as $74e211dc185c20b4$export$21398703d3a9bb4d} from "./column-views.1f954206.js";
|
|
2
2
|
import {buildColumnsStyle as $1dbfddc9637b572c$export$d2995719c3a4ae17} from "./column-views.633c42a3.js";
|
|
3
3
|
import {InsetMap as $5593f90ffec284da$export$1e8149fc0d15fed0} from "./column-views.3de4dc43.js";
|
|
4
4
|
import {useMapClickHandler as $6wt91$useMapClickHandler, useMapStyleOperator as $6wt91$useMapStyleOperator, useMapEaseTo as $6wt91$useMapEaseTo} from "@macrostrat/mapbox-react";
|
|
@@ -196,4 +196,4 @@ function $dcd183b733f66144$var$SectionLine({ padding: padding }) {
|
|
|
196
196
|
|
|
197
197
|
|
|
198
198
|
export {$dcd183b733f66144$export$8e7d97509e84cc49 as ColumnCorrelationMap};
|
|
199
|
-
//# sourceMappingURL=column-views.
|
|
199
|
+
//# sourceMappingURL=column-views.0f910df6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;AAsBO,SAAS,0CAAqB,KAA0B;IAC7D,MAAM,WAAE,UAAU,cAAI,QAAQ,eAAE,WAAW,EAAE,GAAG,MAAM,GAAG;IAEzD,MAAM,gBAAkC,CAAA,GAAA,cAAM,EAAE;QAC9C,OAAO;YACL,CAAA,GAAA,yCAAgB,EA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AY,WAAW,CAAC,GAAG,CAAC,CAAC,QAAW,CAAA;oBAChD,MAAM;oBACN,UAAU;wBAAE,MAAM;wBAAS,aAAa;oBAAM;oBAC9C,YAAY,CAAC;gBACf,CAAA;QACF;IACF,GACA;QAAC;KAAY;IAGf,MAAM,SAAS,CAAA,GAAA,cAAM,EAAE;QACrB,IAAI,eAAe,QAAQ,aAAa,YAAY,SAAS,GAC3D,OAAO;QAET,IAAI,SAAS,IAAI,CAAA,GAAA,mBAAW;QAC5B,KAAK,IAAI,SAAS,YAAY,WAAW,CACvC,OAAO,MAAM,CAAC;QAEhB,OAAO;IACT,GAAG;QAAC;KAAY;IAEhB,CAAA,GAAA,mBAAW,EAAE;gBAAE;iBAAQ;QAAS,aAAa;IAAK;IAElD,OAAO;AACT","sources":["packages/column-views/src/maps/column-correlation/core.ts"],"sourcesContent":["import {\n useMapClickHandler,\n useMapEaseTo,\n useMapStyleOperator,\n} from \"@macrostrat/mapbox-react\";\nimport { LngLatBounds, Style } from \"mapbox-gl\";\nimport h from \"@macrostrat/hyper\";\nimport { Feature, FeatureCollection } from \"geojson\";\nimport { ReactNode, useMemo } from \"react\";\nimport { setGeoJSON, buildGeoJSONSource } from \"@macrostrat/mapbox-utils\";\n\nimport { useCorrelationMapStore } from \"./state\";\nimport { buildColumnsStyle, InsetMap, InsetMapProps } from \"../_shared\";\nimport { buildCrossSectionLayers } from \"@macrostrat/map-styles\";\n\nexport interface CorrelationMapProps extends InsetMapProps {\n padding?: number;\n children?: ReactNode;\n accessToken?: string;\n columnColor?: string;\n}\n\nexport function ColumnCorrelationMap(props: CorrelationMapProps) {\n const { padding = 50, children, columnColor, ...rest } = props;\n\n const overlayStyles: Partial<Style>[] = useMemo(() => {\n return [\n buildColumnsStyle(columnColor) as Style,\n selectedColumnsStyle as Style,\n lineOfSectionStyle as Style,\n ];\n }, [columnColor]);\n\n return h(\n InsetMap,\n {\n ...rest,\n boxZoom: false,\n dragRotate: false,\n overlayStyles,\n },\n [\n h(ColumnsLayer),\n h(SelectedColumnsLayer),\n h(MapClickHandler),\n h(SectionLine, { padding }),\n children,\n ],\n );\n}\n\nfunction MapClickHandler() {\n const onClickMap = useCorrelationMapStore((state) => state.onClickMap);\n\n useMapClickHandler(\n (e) => {\n onClickMap(e, { type: \"Point\", coordinates: e.lngLat.toArray() });\n },\n [onClickMap],\n );\n\n return null;\n}\n\nfunction SelectedColumnsLayer() {\n const focusedColumns = useCorrelationMapStore(\n (state) => state.focusedColumns,\n );\n\n useMapStyleOperator(\n (map) => {\n let features = focusedColumns;\n\n const data: FeatureCollection = {\n type: \"FeatureCollection\",\n features,\n };\n\n const columnCentroidLine: Feature = {\n type: \"Feature\",\n geometry: {\n type: \"LineString\",\n coordinates: features.map(\n (col) => col.properties.centroid.geometry.coordinates,\n ),\n },\n properties: {},\n };\n\n setGeoJSON(map, \"selected-columns\", data);\n setGeoJSON(map, \"selected-column-centroids\", {\n type: \"FeatureCollection\",\n features: [columnCentroidLine],\n });\n },\n [focusedColumns],\n );\n return null;\n}\n\nfunction ColumnsLayer({ enabled = true }) {\n const columns = useCorrelationMapStore((state) => state.columns);\n\n useMapStyleOperator(\n (map) => {\n if (columns == null) {\n return;\n }\n const data: FeatureCollection = {\n type: \"FeatureCollection\",\n features: columns,\n };\n\n console.log(\" columns\", data);\n setGeoJSON(map, \"columns\", data);\n },\n [columns, enabled],\n );\n return null;\n}\n\nconst selectedColumnsStyle: Style = {\n version: 8,\n sources: {\n \"selected-columns\": buildGeoJSONSource(),\n \"selected-column-centroids\": buildGeoJSONSource(),\n },\n layers: [\n {\n id: \"selected-columns-fill\",\n type: \"fill\",\n source: \"selected-columns\",\n paint: {\n \"fill-color\": \"rgba(255, 0, 0, 0.1)\",\n },\n },\n {\n id: \"selected-column-centroids-line\",\n type: \"line\",\n source: \"selected-column-centroids\",\n paint: {\n \"line-color\": \"rgba(255, 0, 0, 0.8)\",\n \"line-width\": 2,\n \"line-dasharray\": [2, 2],\n },\n },\n {\n id: \"selected-column-centroids-points\",\n type: \"circle\",\n source: \"selected-column-centroids\",\n paint: {\n \"circle-radius\": 4,\n \"circle-color\": \"rgba(255, 0, 0, 0.8)\",\n },\n },\n ],\n};\n\nconst lineOfSectionStyle: Style = {\n version: 8,\n sources: {\n elevationMarker: buildGeoJSONSource(),\n crossSectionLine: buildGeoJSONSource(),\n crossSectionEndpoints: buildGeoJSONSource(),\n },\n layers: buildCrossSectionLayers(),\n};\n\nfunction SectionLine({ padding }: { padding: number }) {\n const focusedLine = useCorrelationMapStore((state) => state.focusedLine);\n\n // Setup focused line\n useMapStyleOperator(\n (map) => {\n if (focusedLine == null) {\n return;\n }\n const data: FeatureCollection = {\n type: \"FeatureCollection\",\n features: [\n {\n type: \"Feature\",\n geometry: focusedLine,\n properties: { id: \"focusedLine\" },\n },\n ],\n };\n\n setGeoJSON(map, \"crossSectionLine\", data);\n setGeoJSON(map, \"crossSectionEndpoints\", {\n type: \"FeatureCollection\",\n features: focusedLine.coordinates.map((coord) => ({\n type: \"Feature\",\n geometry: { type: \"Point\", coordinates: coord },\n properties: {},\n })),\n });\n },\n [focusedLine],\n );\n\n const bounds = useMemo(() => {\n if (focusedLine == null || focusedLine?.coordinates.length < 2) {\n return null;\n }\n let bounds = new LngLatBounds();\n for (let coord of focusedLine.coordinates) {\n bounds.extend(coord);\n }\n return bounds;\n }, [focusedLine]);\n\n useMapEaseTo({ bounds, padding, trackResize: true });\n\n return null;\n}\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;AAsBO,SAAS,0CAAqB,KAA0B;IAC7D,MAAM,WAAE,UAAU,cAAI,QAAQ,eAAE,WAAW,EAAE,GAAG,MAAM,GAAG;IAEzD,MAAM,gBAAkC,CAAA,GAAA,cAAM,EAAE;QAC9C,OAAO;YACL,CAAA,GAAA,yCAAgB,EAAE;YAClB;YACA;SACD;IACH,GAAG;QAAC;KAAY;IAEhB,OAAO,CAAA,GAAA,sBAAA,EACL,CAAA,G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AAS,aAAa;oBAAM;oBAC9C,YAAY,CAAC;gBACf,CAAA;QACF;IACF,GACA;QAAC;KAAY;IAGf,MAAM,SAAS,CAAA,GAAA,cAAM,EAAE;QACrB,IAAI,eAAe,QAAQ,aAAa,YAAY,SAAS,GAC3D,OAAO;QAET,IAAI,SAAS,IAAI,CAAA,GAAA,mBAAW;QAC5B,KAAK,IAAI,SAAS,YAAY,WAAW,CACvC,OAAO,MAAM,CAAC;QAEhB,OAAO;IACT,GAAG;QAAC;KAAY;IAEhB,CAAA,GAAA,mBAAW,EAAE;gBAAE;iBAAQ;QAAS,aAAa;IAAK;IAElD,OAAO;AACT","sources":["packages/column-views/src/maps/column-correlation/core.ts"],"sourcesContent":["import {\n useMapClickHandler,\n useMapEaseTo,\n useMapStyleOperator,\n} from \"@macrostrat/mapbox-react\";\nimport { LngLatBounds, Style } from \"mapbox-gl\";\nimport h from \"@macrostrat/hyper\";\nimport { Feature, FeatureCollection } from \"geojson\";\nimport { ReactNode, useMemo } from \"react\";\nimport { setGeoJSON, buildGeoJSONSource } from \"@macrostrat/mapbox-utils\";\n\nimport { useCorrelationMapStore } from \"./state\";\nimport { buildColumnsStyle, InsetMap, InsetMapProps } from \"../_shared\";\nimport { buildCrossSectionLayers } from \"@macrostrat/map-styles\";\n\nexport interface CorrelationMapProps extends InsetMapProps {\n padding?: number;\n children?: ReactNode;\n accessToken?: string;\n columnColor?: string;\n}\n\nexport function ColumnCorrelationMap(props: CorrelationMapProps) {\n const { padding = 50, children, columnColor, ...rest } = props;\n\n const overlayStyles: Partial<Style>[] = useMemo(() => {\n return [\n buildColumnsStyle(columnColor) as Style,\n selectedColumnsStyle as Style,\n lineOfSectionStyle as Style,\n ];\n }, [columnColor]);\n\n return h(\n InsetMap,\n {\n ...rest,\n boxZoom: false,\n dragRotate: false,\n overlayStyles,\n },\n [\n h(ColumnsLayer),\n h(SelectedColumnsLayer),\n h(MapClickHandler),\n h(SectionLine, { padding }),\n children,\n ],\n );\n}\n\nfunction MapClickHandler() {\n const onClickMap = useCorrelationMapStore((state) => state.onClickMap);\n\n useMapClickHandler(\n (e) => {\n onClickMap(e, { type: \"Point\", coordinates: e.lngLat.toArray() });\n },\n [onClickMap],\n );\n\n return null;\n}\n\nfunction SelectedColumnsLayer() {\n const focusedColumns = useCorrelationMapStore(\n (state) => state.focusedColumns,\n );\n\n useMapStyleOperator(\n (map) => {\n let features = focusedColumns;\n\n const data: FeatureCollection = {\n type: \"FeatureCollection\",\n features,\n };\n\n const columnCentroidLine: Feature = {\n type: \"Feature\",\n geometry: {\n type: \"LineString\",\n coordinates: features.map(\n (col) => col.properties.centroid.geometry.coordinates,\n ),\n },\n properties: {},\n };\n\n setGeoJSON(map, \"selected-columns\", data);\n setGeoJSON(map, \"selected-column-centroids\", {\n type: \"FeatureCollection\",\n features: [columnCentroidLine],\n });\n },\n [focusedColumns],\n );\n return null;\n}\n\nfunction ColumnsLayer({ enabled = true }) {\n const columns = useCorrelationMapStore((state) => state.columns);\n\n useMapStyleOperator(\n (map) => {\n if (columns == null) {\n return;\n }\n const data: FeatureCollection = {\n type: \"FeatureCollection\",\n features: columns,\n };\n\n console.log(\" columns\", data);\n setGeoJSON(map, \"columns\", data);\n },\n [columns, enabled],\n );\n return null;\n}\n\nconst selectedColumnsStyle: Style = {\n version: 8,\n sources: {\n \"selected-columns\": buildGeoJSONSource(),\n \"selected-column-centroids\": buildGeoJSONSource(),\n },\n layers: [\n {\n id: \"selected-columns-fill\",\n type: \"fill\",\n source: \"selected-columns\",\n paint: {\n \"fill-color\": \"rgba(255, 0, 0, 0.1)\",\n },\n },\n {\n id: \"selected-column-centroids-line\",\n type: \"line\",\n source: \"selected-column-centroids\",\n paint: {\n \"line-color\": \"rgba(255, 0, 0, 0.8)\",\n \"line-width\": 2,\n \"line-dasharray\": [2, 2],\n },\n },\n {\n id: \"selected-column-centroids-points\",\n type: \"circle\",\n source: \"selected-column-centroids\",\n paint: {\n \"circle-radius\": 4,\n \"circle-color\": \"rgba(255, 0, 0, 0.8)\",\n },\n },\n ],\n};\n\nconst lineOfSectionStyle: Style = {\n version: 8,\n sources: {\n elevationMarker: buildGeoJSONSource(),\n crossSectionLine: buildGeoJSONSource(),\n crossSectionEndpoints: buildGeoJSONSource(),\n },\n layers: buildCrossSectionLayers(),\n};\n\nfunction SectionLine({ padding }: { padding: number }) {\n const focusedLine = useCorrelationMapStore((state) => state.focusedLine);\n\n // Setup focused line\n useMapStyleOperator(\n (map) => {\n if (focusedLine == null) {\n return;\n }\n const data: FeatureCollection = {\n type: \"FeatureCollection\",\n features: [\n {\n type: \"Feature\",\n geometry: focusedLine,\n properties: { id: \"focusedLine\" },\n },\n ],\n };\n\n setGeoJSON(map, \"crossSectionLine\", data);\n setGeoJSON(map, \"crossSectionEndpoints\", {\n type: \"FeatureCollection\",\n features: focusedLine.coordinates.map((coord) => ({\n type: \"Feature\",\n geometry: { type: \"Point\", coordinates: coord },\n properties: {},\n })),\n });\n },\n [focusedLine],\n );\n\n const bounds = useMemo(() => {\n if (focusedLine == null || focusedLine?.coordinates.length < 2) {\n return null;\n }\n let bounds = new LngLatBounds();\n for (let coord of focusedLine.coordinates) {\n bounds.extend(coord);\n }\n return bounds;\n }, [focusedLine]);\n\n useMapEaseTo({ bounds, padding, trackResize: true });\n\n return null;\n}\n"],"names":[],"version":3,"file":"column-views.0f910df6.js.map"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {CorrelationChart as $ed7dc56184962590$export$9ebf875c09445bec} from "./column-views.
|
|
1
|
+
import {CorrelationChart as $ed7dc56184962590$export$9ebf875c09445bec} from "./column-views.31152763.js";
|
|
2
2
|
import {parseLineFromString as $c491b6231216b7f9$export$77c3cc7a57c6db5f, stringifyLine as $c491b6231216b7f9$export$8c53992169ff5301} from "./column-views.beb54e95.js";
|
|
3
3
|
|
|
4
4
|
|
|
@@ -6,4 +6,4 @@ import {parseLineFromString as $c491b6231216b7f9$export$77c3cc7a57c6db5f, string
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
export {$ed7dc56184962590$export$9ebf875c09445bec as CorrelationChart, $c491b6231216b7f9$export$77c3cc7a57c6db5f as parseLineFromString, $c491b6231216b7f9$export$8c53992169ff5301 as stringifyLine};
|
|
9
|
-
//# sourceMappingURL=column-views.
|
|
9
|
+
//# sourceMappingURL=column-views.1cd57b96.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"","sources":["packages/column-views/src/correlation-chart/index.ts"],"sourcesContent":["export * from \"./main\";\nexport * from \"./hash-string\";\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":"","sources":["packages/column-views/src/correlation-chart/index.ts"],"sourcesContent":["export * from \"./main\";\nexport * from \"./hash-string\";\n"],"names":[],"version":3,"file":"column-views.1cd57b96.js.map"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {FossilDataType as $a3ff7da576c02df0$export$a990c76b38782f57, useFossilData as $a3ff7da576c02df0$export$e6af757fa9780077} from "./column-views.6fff7602.js";
|
|
2
|
-
import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.
|
|
2
|
+
import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.8168c37d.js";
|
|
3
3
|
import "./column-views.cb6fc808.css";
|
|
4
4
|
import $kg3Dq$columnviewsd5e788e8js from "./column-views.d5e788e8.js";
|
|
5
5
|
import $kg3Dq$macrostrathyper from "@macrostrat/hyper";
|
|
@@ -158,4 +158,4 @@ function $d419340b86dbd2ea$var$accumulatePresenceDomains(unit, presenceUnits, ax
|
|
|
158
158
|
|
|
159
159
|
|
|
160
160
|
export {$d419340b86dbd2ea$export$652730986cccff7a as PBDBOccurrencesMatrix};
|
|
161
|
-
//# sourceMappingURL=column-views.
|
|
161
|
+
//# sourceMappingURL=column-views.1d356b7e.js.map
|
|
@@ -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Y,CAAA,GAAA,qBAAa,EAAE,MAAM,EAEjC,aAAa,CAAC,EAAE,GAAG,EAAE,KAAK;iBAE1B,aAAa,CAAC,EAAE,GAAG,EAAE,KAAK;QAGhC,OACE,IAAI,iBAAiB,MAAM;YACzB,QAAQ,IAAI,CAAC;YACb,gBAAgB;QAClB;IAEJ;IAEA,IAAI,iBAAiB,MACnB,QAAQ,IAAI,CAAC;IAGf,OAAO;AACT","sources":["packages/column-views/src/facets/fossils/taxon-ranges.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport {\n FossilDataType,\n PBDBEntity,\n PBDBOccurrence,\n useFossilData,\n} from \"./provider\";\nimport { Box, useElementSize } from \"@macrostrat/ui-components\";\nimport { group } from \"d3-array\";\nimport { ColumnAxisType, ColumnSVG } from \"@macrostrat/column-components\";\nimport {\n useMacrostratColumnData,\n useCompositeScale,\n} from \"../../data-provider\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport styles from \"./taxon-ranges.module.sass\";\nimport { useRef } from \"react\";\n\nconst h = hyper.styled(styles);\n\nexport function PBDBOccurrencesMatrix({ columnID }) {\n /* A column for a matrix of taxon occurrences displayed as a table beside the main column. This will\n eventually be extended with first/last occurrence markers and range bars.\n */\n const data = useFossilData(columnID, FossilDataType.Occurrences);\n const col = useMacrostratColumnData();\n const scale = useCompositeScale();\n\n if (data == null) return null;\n\n // convert the data to a map\n const occurrenceMap = new Map(group(data, (d) => d.unit_id)) as Map<\n number,\n PBDBOccurrence[]\n >;\n\n const matrix = createOccurrenceMatrix(col.units, occurrenceMap, col.axisType);\n\n const { taxonRanges } = matrix;\n\n const padding = 16;\n const spacing = 16;\n\n const taxonEntries = Array.from(taxonRanges.entries());\n //const taxon = taxonEntries.slice(0, 50); // limit to top 50 taxa\n\n const width = padding * 2 + spacing * taxonEntries.length;\n\n return h(Box, { className: \"taxon-ranges\", width, height: col.totalHeight }, [\n h(TaxonOccurrenceLabels, {\n taxonEntries,\n padding,\n spacing,\n scale,\n }),\n h(\n ColumnSVG,\n {\n width: padding * 2 + spacing * taxonEntries.length,\n },\n h(\n \"g.taxa-occurrences-matrix\",\n taxonEntries.map(([taxonName, ranges], rowIndex) => {\n const xPosition = padding + rowIndex * spacing;\n return h(\"g\", { transform: `translate(${xPosition})` }, [\n ranges.map(([top, bottom]) => {\n return h(\"line\", {\n y1: scale(top),\n y2: scale(bottom),\n });\n }),\n ]);\n }),\n ),\n ),\n ]);\n}\n\nfunction TaxonOccurrenceLabels({ taxonEntries, padding, spacing, scale }) {\n return h(\"div.taxon-labels\", [\n taxonEntries.map(([taxonName, ranges], rowIndex) => {\n const top = ranges[0]?.[0] ?? 0;\n let topPx = scale(top) - 20;\n if (topPx < 200) topPx = 0;\n\n return h(TaxonLabel, {\n top: topPx,\n left: padding + rowIndex * spacing,\n taxonName,\n });\n }),\n ]);\n}\n\nfunction TaxonLabel({ top, left, taxonName }) {\n const ref = useRef();\n const textSize = useElementSize(ref);\n const labelWidth = textSize?.height ?? 200;\n return h(\n \"div.taxon-label\",\n {\n style: {\n top: `${top}px`,\n marginLeft: `${left}px`,\n \"--label-width\": `${labelWidth}px`,\n },\n },\n h(\"div.taxon-label-inner\", h(\"div.taxon-label-text\", { ref }, taxonName)),\n );\n}\n\ntype TaxonUnitMap = Map<string, Set<number>>;\n\ninterface OccurrenceMatrixData {\n occurrenceMap: Map<number, PBDBEntity[]>; // Map of unit IDs to occurrences (original data)\n taxonUnitMap: TaxonUnitMap; // Map of taxon names to sets of unit IDs\n taxonOccurrenceMap: Map<string, PBDBOccurrence[]>; // Map of taxon names to occurrences\n taxonRanges: Map<string, [number, number][]>; // Map of taxon names to [top, bottom] pixel ranges\n}\n\nfunction TaxonOccurrenceEntry({\n xPosition,\n ranges,\n scale,\n name,\n}: {\n xPosition: number;\n units: Set<number>;\n ranges: any;\n scale: any;\n name: string;\n}) {\n return h(\"g\", { transform: `translate(${xPosition})` }, [\n ranges.map(([top, bottom]) => {\n return h(\"line\", {\n y1: scale(top),\n y2: scale(bottom),\n });\n }),\n ]);\n}\n\nfunction createOccurrenceMatrix(\n units: UnitLong[],\n data: Map<number, PBDBOccurrence[]>,\n axisType: ColumnAxisType = ColumnAxisType.AGE,\n): OccurrenceMatrixData {\n const taxonUnitMap = new Map<string, Set<number>>();\n const taxonOccurrenceMap = new Map<string, PBDBOccurrence[]>();\n\n for (const [unit_id, occurrences] of data.entries()) {\n for (const occ of occurrences) {\n const taxonName = occ.best_name ?? occ.taxon_name;\n if (!taxonUnitMap.has(taxonName)) {\n taxonUnitMap.set(taxonName, new Set());\n taxonOccurrenceMap.set(taxonName, []);\n }\n taxonUnitMap.get(taxonName).add(unit_id);\n taxonOccurrenceMap.get(taxonName).push(occ);\n }\n }\n\n // sort the taxon occurrence map by number of occurrences\n const sortedTaxa = Array.from(taxonUnitMap.entries()).sort((a, b) => {\n // Sort alphabetically by taxon name\n return b[0].localeCompare(a[0]);\n });\n\n const taxonRanges = new Map<string, [number, number][]>();\n for (const [taxonName, unitSet] of taxonUnitMap.entries()) {\n taxonRanges.set(\n taxonName,\n accumulatePresenceDomains(units, unitSet, axisType),\n );\n }\n\n return {\n occurrenceMap: data,\n taxonUnitMap: new Map(sortedTaxa),\n taxonOccurrenceMap: taxonOccurrenceMap,\n taxonRanges,\n };\n}\n\nfunction accumulatePresenceDomains(\n unit: UnitLong[],\n presenceUnits: Set<number>,\n axisType: ColumnAxisType,\n): Array<[number, number]> {\n const domains: Array<[number, number]> = [];\n let currentDomain: [number, number] | null = null;\n\n for (const u of unit) {\n if (presenceUnits.has(u.unit_id)) {\n if (currentDomain == null) {\n if (\n axisType == ColumnAxisType.DEPTH ||\n axisType == ColumnAxisType.HEIGHT\n ) {\n currentDomain = [u.t_pos, u.b_pos];\n } else {\n currentDomain = [u.t_age, u.b_age];\n }\n } else {\n if (\n axisType == ColumnAxisType.DEPTH ||\n axisType == ColumnAxisType.HEIGHT\n ) {\n currentDomain[1] = u.b_pos;\n } else {\n currentDomain[1] = u.b_age;\n }\n }\n } else {\n if (currentDomain != null) {\n domains.push(currentDomain);\n currentDomain = null;\n }\n }\n }\n\n if (currentDomain != null) {\n domains.push(currentDomain);\n }\n\n return domains;\n}\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAErB,SAAS,0CAAsB,YAAE,QAAQ,EAAE;IAChD;;GAEC,GACD,MAAM,OAAO,CAAA,GAAA,yCAAY,EAAE,UAAU,CAAA,GAAA,yCAAa,EAAE,WAAW;IAC/D,MAAM,MAAM,CAAA,GAAA,yCAAsB;IAClC,MAAM,QAAQ,CAAA,GAAA,wCAAgB;IAE9B,IAAI,QAAQ,MAAM,OAAO;IAEzB,4BAA4B;IAC5B,MAAM,gBAAgB,IAAI,IAAI,CAAA,GAAA,YAAI,EAAE,MAAM,CAAC,IAAM,EAAE,OAAO;IAK1D,MAAM,SAAS,6CAAuB,IAAI,KAAK,EAAE,eAAe,IAAI,QAAQ;IAE5E,MAAM,eAAE,WAAW,EAAE,GAAG;IAExB,MAAM,UAAU;IAChB,MAAM,UAAU;IAEhB,MAAM,eAAe,MAAM,IAAI,CAAC,YAAY,OAAO;IACnD,kEAAkE;IAElE,MAAM,QAAQ,UAAU,IAAI,UAAU,aAAa,MAAM;IAEzD,OAAO,wBAAE,CAAA,GAAA,UAAE,GAAG;QAAE,WAAW;eAAgB;QAAO,QAAQ,IAAI,WAAW;IAAC,GAAG;QAC3E,wBAAE,6CAAuB;0BACvB;qBACA;qBACA;mBACA;QACF;QACA,wBACE,CAAA,GAAA,gBAAQ,GACR;YACE,OAAO,UAAU,IAAI,UAAU,aAAa,MAAM;QACpD,GACA,wBACE,6BACA,aAAa,GAAG,CAAC,CAAC,CAAC,WAAW,OAAO,EAAE;YACrC,MAAM,YAAY,UAAU,WAAW;YACvC,OAAO,wBAAE,KAAK;gBAAE,WAAW,C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AAC;qBAElC,gBAAgB;oBAAC,EAAE,KAAK;oBAAE,EAAE,KAAK;iBAAC;mBAGpC,IACE,YAAY,CAAA,GAAA,qBAAa,EAAE,KAAK,IAChC,YAAY,CAAA,GAAA,qBAAa,EAAE,MAAM,EAEjC,aAAa,CAAC,EAAE,GAAG,EAAE,KAAK;iBAE1B,aAAa,CAAC,EAAE,GAAG,EAAE,KAAK;QAGhC,OACE,IAAI,iBAAiB,MAAM;YACzB,QAAQ,IAAI,CAAC;YACb,gBAAgB;QAClB;IAEJ;IAEA,IAAI,iBAAiB,MACnB,QAAQ,IAAI,CAAC;IAGf,OAAO;AACT","sources":["packages/column-views/src/facets/fossils/taxon-ranges.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport {\n FossilDataType,\n PBDBEntity,\n PBDBOccurrence,\n useFossilData,\n} from \"./provider\";\nimport { Box, useElementSize } from \"@macrostrat/ui-components\";\nimport { group } from \"d3-array\";\nimport { ColumnAxisType, ColumnSVG } from \"@macrostrat/column-components\";\nimport {\n useMacrostratColumnData,\n useCompositeScale,\n} from \"../../data-provider\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport styles from \"./taxon-ranges.module.sass\";\nimport { useRef } from \"react\";\n\nconst h = hyper.styled(styles);\n\nexport function PBDBOccurrencesMatrix({ columnID }) {\n /* A column for a matrix of taxon occurrences displayed as a table beside the main column. This will\n eventually be extended with first/last occurrence markers and range bars.\n */\n const data = useFossilData(columnID, FossilDataType.Occurrences);\n const col = useMacrostratColumnData();\n const scale = useCompositeScale();\n\n if (data == null) return null;\n\n // convert the data to a map\n const occurrenceMap = new Map(group(data, (d) => d.unit_id)) as Map<\n number,\n PBDBOccurrence[]\n >;\n\n const matrix = createOccurrenceMatrix(col.units, occurrenceMap, col.axisType);\n\n const { taxonRanges } = matrix;\n\n const padding = 16;\n const spacing = 16;\n\n const taxonEntries = Array.from(taxonRanges.entries());\n //const taxon = taxonEntries.slice(0, 50); // limit to top 50 taxa\n\n const width = padding * 2 + spacing * taxonEntries.length;\n\n return h(Box, { className: \"taxon-ranges\", width, height: col.totalHeight }, [\n h(TaxonOccurrenceLabels, {\n taxonEntries,\n padding,\n spacing,\n scale,\n }),\n h(\n ColumnSVG,\n {\n width: padding * 2 + spacing * taxonEntries.length,\n },\n h(\n \"g.taxa-occurrences-matrix\",\n taxonEntries.map(([taxonName, ranges], rowIndex) => {\n const xPosition = padding + rowIndex * spacing;\n return h(\"g\", { transform: `translate(${xPosition})` }, [\n ranges.map(([top, bottom]) => {\n return h(\"line\", {\n y1: scale(top),\n y2: scale(bottom),\n });\n }),\n ]);\n }),\n ),\n ),\n ]);\n}\n\nfunction TaxonOccurrenceLabels({ taxonEntries, padding, spacing, scale }) {\n return h(\"div.taxon-labels\", [\n taxonEntries.map(([taxonName, ranges], rowIndex) => {\n const top = ranges[0]?.[0] ?? 0;\n let topPx = scale(top) - 20;\n if (topPx < 200) topPx = 0;\n\n return h(TaxonLabel, {\n top: topPx,\n left: padding + rowIndex * spacing,\n taxonName,\n });\n }),\n ]);\n}\n\nfunction TaxonLabel({ top, left, taxonName }) {\n const ref = useRef();\n const textSize = useElementSize(ref);\n const labelWidth = textSize?.height ?? 200;\n return h(\n \"div.taxon-label\",\n {\n style: {\n top: `${top}px`,\n marginLeft: `${left}px`,\n \"--label-width\": `${labelWidth}px`,\n },\n },\n h(\"div.taxon-label-inner\", h(\"div.taxon-label-text\", { ref }, taxonName)),\n );\n}\n\ntype TaxonUnitMap = Map<string, Set<number>>;\n\ninterface OccurrenceMatrixData {\n occurrenceMap: Map<number, PBDBEntity[]>; // Map of unit IDs to occurrences (original data)\n taxonUnitMap: TaxonUnitMap; // Map of taxon names to sets of unit IDs\n taxonOccurrenceMap: Map<string, PBDBOccurrence[]>; // Map of taxon names to occurrences\n taxonRanges: Map<string, [number, number][]>; // Map of taxon names to [top, bottom] pixel ranges\n}\n\nfunction TaxonOccurrenceEntry({\n xPosition,\n ranges,\n scale,\n name,\n}: {\n xPosition: number;\n units: Set<number>;\n ranges: any;\n scale: any;\n name: string;\n}) {\n return h(\"g\", { transform: `translate(${xPosition})` }, [\n ranges.map(([top, bottom]) => {\n return h(\"line\", {\n y1: scale(top),\n y2: scale(bottom),\n });\n }),\n ]);\n}\n\nfunction createOccurrenceMatrix(\n units: UnitLong[],\n data: Map<number, PBDBOccurrence[]>,\n axisType: ColumnAxisType = ColumnAxisType.AGE,\n): OccurrenceMatrixData {\n const taxonUnitMap = new Map<string, Set<number>>();\n const taxonOccurrenceMap = new Map<string, PBDBOccurrence[]>();\n\n for (const [unit_id, occurrences] of data.entries()) {\n for (const occ of occurrences) {\n const taxonName = occ.best_name ?? occ.taxon_name;\n if (!taxonUnitMap.has(taxonName)) {\n taxonUnitMap.set(taxonName, new Set());\n taxonOccurrenceMap.set(taxonName, []);\n }\n taxonUnitMap.get(taxonName).add(unit_id);\n taxonOccurrenceMap.get(taxonName).push(occ);\n }\n }\n\n // sort the taxon occurrence map by number of occurrences\n const sortedTaxa = Array.from(taxonUnitMap.entries()).sort((a, b) => {\n // Sort alphabetically by taxon name\n return b[0].localeCompare(a[0]);\n });\n\n const taxonRanges = new Map<string, [number, number][]>();\n for (const [taxonName, unitSet] of taxonUnitMap.entries()) {\n taxonRanges.set(\n taxonName,\n accumulatePresenceDomains(units, unitSet, axisType),\n );\n }\n\n return {\n occurrenceMap: data,\n taxonUnitMap: new Map(sortedTaxa),\n taxonOccurrenceMap: taxonOccurrenceMap,\n taxonRanges,\n };\n}\n\nfunction accumulatePresenceDomains(\n unit: UnitLong[],\n presenceUnits: Set<number>,\n axisType: ColumnAxisType,\n): Array<[number, number]> {\n const domains: Array<[number, number]> = [];\n let currentDomain: [number, number] | null = null;\n\n for (const u of unit) {\n if (presenceUnits.has(u.unit_id)) {\n if (currentDomain == null) {\n if (\n axisType == ColumnAxisType.DEPTH ||\n axisType == ColumnAxisType.HEIGHT\n ) {\n currentDomain = [u.t_pos, u.b_pos];\n } else {\n currentDomain = [u.t_age, u.b_age];\n }\n } else {\n if (\n axisType == ColumnAxisType.DEPTH ||\n axisType == ColumnAxisType.HEIGHT\n ) {\n currentDomain[1] = u.b_pos;\n } else {\n currentDomain[1] = u.b_age;\n }\n }\n } else {\n if (currentDomain != null) {\n domains.push(currentDomain);\n currentDomain = null;\n }\n }\n }\n\n if (currentDomain != null) {\n domains.push(currentDomain);\n }\n\n return domains;\n}\n"],"names":[],"version":3,"file":"column-views.1d356b7e.js.map"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useMacrostratColumns as $774a5efa27d1c77b$export$81eaae0b474404fd, useMacrostratStore as $774a5efa27d1c77b$export$fb98d5bae3a6800} from "./column-views.
|
|
1
|
+
import {useMacrostratColumns as $774a5efa27d1c77b$export$81eaae0b474404fd, useMacrostratStore as $774a5efa27d1c77b$export$fb98d5bae3a6800} from "./column-views.3c1cde51.js";
|
|
2
2
|
import {create as $g0ikq$create, useStore as $g0ikq$useStore} from "zustand";
|
|
3
3
|
import {createContext as $g0ikq$createContext, useState as $g0ikq$useState, useMemo as $g0ikq$useMemo, useEffect as $g0ikq$useEffect, useContext as $g0ikq$useContext} from "react";
|
|
4
4
|
import $g0ikq$macrostrathyper from "@macrostrat/hyper";
|
|
@@ -78,4 +78,4 @@ function $09486427d129f589$export$642c2b57c47ea41(selector) {
|
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
export {$09486427d129f589$export$8da3b11f62ebf019 as ColumnNavigationProvider, $09486427d129f589$export$642c2b57c47ea41 as useColumnNavigationStore};
|
|
81
|
-
//# sourceMappingURL=column-views.
|
|
81
|
+
//# sourceMappingURL=column-views.1ef0f7e8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAoCA,MAAM,+CAAyB,CAAA,GAAA,oBAAY,EACzC;AAGK,SAAS,0CAAyB,YACvC,QAAQ,WACR,OAAO,aACP,SAAS,kBACT,cAAc,aACd,SAAS,aACT,SAAS,kBACT,cAAc,iBACd,aAAa,EACW;IAC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I,kBAAkB,yBACpB;QAEF,aAAa;IACf,GAAG;QAAC;KAAe;IAEnB,OAAO,CAAA,GAAA,sBAAA,EAAE,6CAAuB,QAAQ,EAAE;QAAE,OAAO;IAAM,GAAG;AAC9D;AAEO,SAAS,yCACd,QAAyC;IAEzC,MAAM,WAAW,CAAA,GAAA,iBAAS,EAAE;IAC5B,IAAI,YAAY,MACd,MAAM,IAAI,MAAM;IAElB,OAAO,CAAA,GAAA,eAAO,EAAE,UAAU;AAC5B","sources":["packages/column-views/src/maps/column-navigation/mapbox/state.ts"],"sourcesContent":["import { create, StoreApi, useStore } from \"zustand\";\nimport type { ColumnGeoJSONRecordWithID } from \"@macrostrat/api-types\";\nimport {\n createContext,\n useState,\n useContext,\n ReactNode,\n useEffect,\n useMemo,\n} from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport {\n useMacrostratColumns,\n useMacrostratStore,\n} from \"../../../data-provider\";\n\nexport interface NavigationStore {\n columns: ColumnGeoJSONRecordWithID[];\n selectedColumn: number | null;\n hoveredColumn: number | null;\n selectColumn: (columnID: number | null) => void;\n setHoveredColumn: (columnID: number | null) => void;\n}\n\nexport interface NavigationProviderProps {\n projectID?: number;\n inProcess?: boolean;\n selectedColumn?: number | null;\n hoveredColumn?: number | null;\n columns?: ColumnGeoJSONRecordWithID[] | null;\n columnIDs?: number[] | null;\n children: ReactNode;\n onSelectColumn?: (col_id: number | null, column: any) => void;\n onHoverColumn?: (col_id: number | null, column: any) => void;\n}\n\nconst NavigationStoreContext = createContext<StoreApi<NavigationStore> | null>(\n null,\n);\n\nexport function ColumnNavigationProvider({\n children,\n columns,\n columnIDs,\n selectedColumn,\n projectID,\n inProcess,\n onSelectColumn,\n onHoverColumn,\n}: NavigationProviderProps) {\n const getColumns = useMacrostratStore((s) => s.getColumns);\n\n const [store] = useState(() => {\n return create<NavigationStore>((set, get): NavigationStore => {\n return {\n columns: null,\n selectedColumn: null,\n hoveredColumn: null,\n selectColumn(columnID: number | null) {\n set({ selectedColumn: columnID, hoveredColumn: null });\n const { columns } = get();\n const column = columns?.find((d) => d.id == columnID);\n onSelectColumn?.(columnID, column);\n },\n setHoveredColumn(columnID: number | null) {\n set({ hoveredColumn: columnID });\n const { columns } = get();\n const column = columns?.find((d) => d.id == columnID);\n onHoverColumn?.(columnID, column);\n },\n };\n });\n });\n\n // Set up the store\n /** TODO: unify handling of columns between parts of application */\n // useAsyncEffect(async () => {\n // let _columns = columns ?? (await getColumns(projectID, inProcess));\n // store.setState({ columns: _columns, selectedColumn });\n // }, [projectID, inProcess, columns, getColumns]);\n\n let _columns = columns ?? useMacrostratColumns(projectID, inProcess);\n\n // filter columns if specified\n if (columnIDs?.length > 0) {\n _columns = useMemo(() => {\n return _columns?.filter((d) => columnIDs.includes(d.properties.col_id));\n }, [columnIDs, _columns]);\n }\n\n useEffect(() => {\n if (_columns?.length > 0) {\n store.setState({ columns: _columns, selectedColumn });\n }\n }, [_columns]);\n // Update selected column if it is changed externally\n\n // Kind of an awkward way to do this but we need to allow the selector to run\n useEffect(() => {\n const { selectColumn, selectedColumn: _internalSelectedColumn } =\n store.getState();\n if (selectedColumn == _internalSelectedColumn) {\n return;\n }\n selectColumn(selectedColumn);\n }, [selectedColumn]);\n\n return h(NavigationStoreContext.Provider, { value: store }, children);\n}\n\nexport function useColumnNavigationStore(\n selector: (state: NavigationStore) => any,\n) {\n const storeApi = useContext(NavigationStoreContext);\n if (storeApi == null) {\n throw new Error(\"Missing ColumnNavigationProvider\");\n }\n return useStore(storeApi, selector);\n}\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":";;;;;;;;;AAoCA,MAAM,+CAAyB,CAAA,GAAA,oBAAY,EACzC;AAGK,SAAS,0CAAyB,YACvC,QAAQ,WACR,OAAO,aACP,SAAS,kBACT,cAAc,aACd,SAAS,aACT,SAAS,kBACT,cAAc,iBACd,aAAa,EACW;IACxB,MAAM,aAAa,CAAA,GAAA,wCAAiB,EAAE,CAAC,IAAM,EAAE,UAAU;I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AAA,GAAA,sBAAA,EAAE,6CAAuB,QAAQ,EAAE;QAAE,OAAO;IAAM,GAAG;AAC9D;AAEO,SAAS,yCACd,QAAyC;IAEzC,MAAM,WAAW,CAAA,GAAA,iBAAS,EAAE;IAC5B,IAAI,YAAY,MACd,MAAM,IAAI,MAAM;IAElB,OAAO,CAAA,GAAA,eAAO,EAAE,UAAU;AAC5B","sources":["packages/column-views/src/maps/column-navigation/mapbox/state.ts"],"sourcesContent":["import { create, StoreApi, useStore } from \"zustand\";\nimport type { ColumnGeoJSONRecordWithID } from \"@macrostrat/api-types\";\nimport {\n createContext,\n useState,\n useContext,\n ReactNode,\n useEffect,\n useMemo,\n} from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport {\n useMacrostratColumns,\n useMacrostratStore,\n} from \"../../../data-provider\";\n\nexport interface NavigationStore {\n columns: ColumnGeoJSONRecordWithID[];\n selectedColumn: number | null;\n hoveredColumn: number | null;\n selectColumn: (columnID: number | null) => void;\n setHoveredColumn: (columnID: number | null) => void;\n}\n\nexport interface NavigationProviderProps {\n projectID?: number;\n inProcess?: boolean;\n selectedColumn?: number | null;\n hoveredColumn?: number | null;\n columns?: ColumnGeoJSONRecordWithID[] | null;\n columnIDs?: number[] | null;\n children: ReactNode;\n onSelectColumn?: (col_id: number | null, column: any) => void;\n onHoverColumn?: (col_id: number | null, column: any) => void;\n}\n\nconst NavigationStoreContext = createContext<StoreApi<NavigationStore> | null>(\n null,\n);\n\nexport function ColumnNavigationProvider({\n children,\n columns,\n columnIDs,\n selectedColumn,\n projectID,\n inProcess,\n onSelectColumn,\n onHoverColumn,\n}: NavigationProviderProps) {\n const getColumns = useMacrostratStore((s) => s.getColumns);\n\n const [store] = useState(() => {\n return create<NavigationStore>((set, get): NavigationStore => {\n return {\n columns: null,\n selectedColumn: null,\n hoveredColumn: null,\n selectColumn(columnID: number | null) {\n set({ selectedColumn: columnID, hoveredColumn: null });\n const { columns } = get();\n const column = columns?.find((d) => d.id == columnID);\n onSelectColumn?.(columnID, column);\n },\n setHoveredColumn(columnID: number | null) {\n set({ hoveredColumn: columnID });\n const { columns } = get();\n const column = columns?.find((d) => d.id == columnID);\n onHoverColumn?.(columnID, column);\n },\n };\n });\n });\n\n // Set up the store\n /** TODO: unify handling of columns between parts of application */\n // useAsyncEffect(async () => {\n // let _columns = columns ?? (await getColumns(projectID, inProcess));\n // store.setState({ columns: _columns, selectedColumn });\n // }, [projectID, inProcess, columns, getColumns]);\n\n let _columns = columns ?? useMacrostratColumns(projectID, inProcess);\n\n // filter columns if specified\n if (columnIDs?.length > 0) {\n _columns = useMemo(() => {\n return _columns?.filter((d) => columnIDs.includes(d.properties.col_id));\n }, [columnIDs, _columns]);\n }\n\n useEffect(() => {\n if (_columns?.length > 0) {\n store.setState({ columns: _columns, selectedColumn });\n }\n }, [_columns]);\n // Update selected column if it is changed externally\n\n // Kind of an awkward way to do this but we need to allow the selector to run\n useEffect(() => {\n const { selectColumn, selectedColumn: _internalSelectedColumn } =\n store.getState();\n if (selectedColumn == _internalSelectedColumn) {\n return;\n }\n selectColumn(selectedColumn);\n }, [selectedColumn]);\n\n return h(NavigationStoreContext.Provider, { value: store }, children);\n}\n\nexport function useColumnNavigationStore(\n selector: (state: NavigationStore) => any,\n) {\n const storeApi = useContext(NavigationStoreContext);\n if (storeApi == null) {\n throw new Error(\"Missing ColumnNavigationProvider\");\n }\n return useStore(storeApi, selector);\n}\n"],"names":[],"version":3,"file":"column-views.1ef0f7e8.js.map"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useMacrostratColumns as $774a5efa27d1c77b$export$81eaae0b474404fd} from "./column-views.
|
|
1
|
+
import {useMacrostratColumns as $774a5efa27d1c77b$export$81eaae0b474404fd} from "./column-views.3c1cde51.js";
|
|
2
2
|
import {create as $i7Wch$create, useStore as $i7Wch$useStore} from "zustand";
|
|
3
3
|
import {lineIntersect as $i7Wch$lineIntersect} from "@turf/line-intersect";
|
|
4
4
|
import $i7Wch$turfdistance from "@turf/distance";
|
|
@@ -115,4 +115,4 @@ function $74e211dc185c20b4$var$sorted(data, accessor) {
|
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
export {$74e211dc185c20b4$export$72ffe141ebf87ef1 as ColumnCorrelationProvider, $74e211dc185c20b4$export$21398703d3a9bb4d as useCorrelationMapStore};
|
|
118
|
-
//# sourceMappingURL=column-views.
|
|
118
|
+
//# sourceMappingURL=column-views.1f954206.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;AAuCA,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,G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,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 {\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":"column-views.
|
|
1
|
+
{"mappings":";;;;;;;;;;;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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 {\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":"column-views.1f954206.js.map"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {FossilDataType as $a3ff7da576c02df0$export$a990c76b38782f57, useFossilData as $a3ff7da576c02df0$export$e6af757fa9780077} from "./column-views.6fff7602.js";
|
|
2
|
-
import {BaseMeasurementsColumn as $50d219504625a431$export$ce5c4f2fdf4e644d, groupNotesByPixelDistance as $50d219504625a431$export$4e649f790614b299, standardizeMeasurementHeight as $50d219504625a431$export$9d101e1fcb2166a6, TruncatedList as $50d219504625a431$export$653e47a7a0da0f0d} from "./column-views.
|
|
3
|
-
import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.
|
|
2
|
+
import {BaseMeasurementsColumn as $50d219504625a431$export$ce5c4f2fdf4e644d, groupNotesByPixelDistance as $50d219504625a431$export$4e649f790614b299, standardizeMeasurementHeight as $50d219504625a431$export$9d101e1fcb2166a6, TruncatedList as $50d219504625a431$export$653e47a7a0da0f0d} from "./column-views.4e5746da.js";
|
|
3
|
+
import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.8168c37d.js";
|
|
4
4
|
import "./column-views.cb6fc808.css";
|
|
5
5
|
import $6u76g$columnviewsd5e788e8js from "./column-views.d5e788e8.js";
|
|
6
6
|
import {getPositionWithinUnit as $b6657fba8924a702$export$441710fb21b4ae09, getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a} from "./column-views.052498a6.js";
|
|
7
|
-
import {PBDBOccurrencesMatrix as $d419340b86dbd2ea$export$652730986cccff7a} from "./column-views.
|
|
7
|
+
import {PBDBOccurrencesMatrix as $d419340b86dbd2ea$export$652730986cccff7a} from "./column-views.1d356b7e.js";
|
|
8
8
|
import $6u76g$macrostrathyper from "@macrostrat/hyper";
|
|
9
9
|
import {ColumnAxisType as $6u76g$ColumnAxisType} from "@macrostrat/column-components";
|
|
10
10
|
import {scaleLinear as $6u76g$scaleLinear} from "d3-scale";
|
|
@@ -131,4 +131,4 @@ function $b9286605a04210d4$var$getRelativePositionInUnit(pos, unit, axisType) {
|
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
export {$b9286605a04210d4$export$554267114407ef68 as PBDBFossilsColumn, $a3ff7da576c02df0$export$a990c76b38782f57 as FossilDataType, $a3ff7da576c02df0$export$e6af757fa9780077 as useFossilData, $d419340b86dbd2ea$export$652730986cccff7a as PBDBOccurrencesMatrix};
|
|
134
|
-
//# sourceMappingURL=column-views.
|
|
134
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QACrE,0CAA0C;QAC1C,qEAAqE;QACrE,mEAAmE;QACnE,gCAAgC;QAChC,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,IAAM,EAAE,OAAO,KAAK,EAAE,OAAO;QACtD,IAAI,QAAQ,MAAM,OAAO;QACzB,MAAM,YAAY,gDAChB,QACA,MACA,CAAA,GAAA,qBAAa,EAAE,KAAK;QAEtB,IAAI,aAAa,MAAM,OAAO;QAC9B,SAAS,CAAA,GAAA,yCAAoB,EAAE,WAAW,MAAM;QAChD,OAAO;oBAAE;QAAO;IAClB;IACA,6EAA6E;IAC7E,OAAO,CAAA,GAAA,yCAA2B,EAAE;QAAE,SAAS,EAAE,OAAO;IAAC,GAAG,OAAO;AACrE;AAEA,SAAS,gDACP,GAAW,EACX,IAAc,EACd,QAAwB;IAExB,+CAA+C;IAC/C,MAAM,UAAU,CAAA,GAAA,wCAAiB,EAAE,MAAM,UAAU;IACnD,MAAM,QAAQ,CAAA,GAAA,kBAAU,EAAE,SAAS,MAAM,CAAC;QAAC;QAAG;KAAE;IAChD,MAAM,SAAS,MAAM,MAAM,CAAC;IAC5B,IAAI,SAAS,KAAK,SAAS,GAAG,OAAO;IACrC,OAAO;AACT","sources":["packages/column-views/src/facets/fossils/index.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport {\n FossilDataType,\n type PBDBCollection,\n type PBDBEntity,\n type PBDBOccurrence,\n useFossilData,\n} from \"./provider\";\nimport type { IUnit } from \"../../units\";\nimport {\n BaseMeasurementsColumn,\n ColumnMeasurementData,\n MeasurementHeightData,\n standardizeMeasurementHeight,\n groupNotesByPixelDistance,\n TruncatedList,\n} from \"../measurements\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport {\n useCompositeScale,\n useMacrostratColumnData,\n} from \"../../data-provider\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport styles from \"./taxon-ranges.module.sass\";\nimport {\n CompositeColumnScale,\n getPositionWithinUnit,\n getUnitHeightRange,\n} from \"../../prepare-units\";\nimport { scaleLinear } from \"d3-scale\";\n\nexport {\n FossilDataType,\n type PBDBCollection,\n type PBDBEntity,\n type PBDBOccurrence,\n useFossilData,\n};\nexport * from \"./taxon-ranges\";\n\nconst h = hyper.styled(styles);\n\nexport function PBDBFossilsColumn({\n columnID,\n type = FossilDataType.Collections,\n}: {\n columnID: number;\n type: FossilDataType;\n}) {\n const data = useFossilData(columnID, type);\n const { axisType, units } = useMacrostratColumnData();\n const scale = useCompositeScale();\n\n if (data == null || units == null || scale == null) return null;\n\n const data1 = preparePBDBData(data, units, scale, axisType);\n\n return h(BaseMeasurementsColumn, {\n data: data1,\n noteComponent: FossilInfo,\n focusedNoteComponent: FossilInfo,\n className: \"fossil-collections\",\n });\n}\n\ninterface FossilItemProps {\n note: {\n data: PBDBCollection[];\n unit?: IUnit;\n };\n spacing?: {\n below?: number;\n above?: number;\n };\n width?: number;\n height?: number;\n color?: string;\n focused?: boolean;\n maxItems?: number;\n}\n\nfunction FossilInfo(props: FossilItemProps) {\n const { note, maxItems, focused = false } = props;\n const { data } = note;\n // Sort collections by name\n data.sort((a, b) => {\n const nameA = a.best_name ?? a.cltn_name ?? \"\";\n const nameB = b.best_name ?? b.cltn_name ?? \"\";\n return nameA.localeCompare(nameB);\n });\n\n return h(TruncatedList, {\n data,\n className: \"fossil-collections\",\n itemRenderer: PBDBCollectionLink,\n maxItems: focused ? Infinity : (maxItems ?? 5),\n });\n}\n\nfunction PBDBCollectionLink({\n data,\n}: {\n data: PBDBCollection | PBDBOccurrence;\n}) {\n /** A link to a PBDB collection that handles either an occurrence or collection object */\n return h(\n \"a.link-id\",\n {\n href: `https://paleobiodb.org/app/collections#display=col:${data.cltn_id}`,\n target: \"_blank\",\n onClick(e) {\n e.stopPropagation();\n },\n },\n data.best_name ?? data.cltn_name,\n );\n}\n\ninterface PreparePBDBDataOptions {\n /** If set, group close notes within this distance (in pixels in display space)\n * into a single note. If a number is provided, that number is used as the distance,\n * otherwise a default of 5 pixels is used.\n */\n groupCloseNotes?: boolean | number;\n}\n\nfunction preparePBDBData<T extends PBDBEntity>(\n data: T[],\n units: UnitLong[],\n scale: CompositeColumnScale,\n axisType: ColumnAxisType,\n options?: PreparePBDBDataOptions,\n) {\n /** Prepare PBDB fossil data for display in a measurements column */\n const { groupCloseNotes = true } = options ?? {};\n const groupDistance =\n typeof groupCloseNotes === \"number\" ? groupCloseNotes : 10;\n\n // Map of data to its defined height ranges\n const dataMap = new Map<string, ColumnMeasurementData<T[]>>();\n\n // Todo: if we wanted, we could add a step where we group notes that are too close together here...\n\n for (const d of data) {\n const range = getHeightRangeForPBDBEntity(d, units, axisType);\n\n if (range == null) continue;\n const { height, top_height } = range;\n // compose the key based on height info\n let key = `${height}`;\n if (top_height != null) {\n key += `-${top_height}`;\n }\n\n // Group by height key\n if (!dataMap.has(key)) {\n dataMap.set(key, {\n height,\n top_height: top_height ?? height,\n data: [],\n id: key,\n });\n }\n dataMap.get(key)!.data.push(d);\n }\n\n return groupNotesByPixelDistance(\n Array.from(dataMap.values()),\n scale,\n axisType,\n groupDistance,\n );\n}\n\nfunction getHeightRangeForPBDBEntity<T extends PBDBEntity>(\n d: T,\n units: UnitLong[],\n axisType: ColumnAxisType,\n): MeasurementHeightData | null {\n let height: number | null = null;\n if (d.slb != null && d.slu == \"mbsf\") {\n // Meters below sea floor - special case for eODP where we have\n // specific depth data referenced\n height = Number(d.slb);\n if (axisType === ColumnAxisType.DEPTH) {\n // Data is already in depth units\n return { height };\n }\n }\n if (d.unit_id == null) return null;\n if (height != null) {\n // If we have both height and unit info, we need to adjust the height\n // to fit whatever scale type we're using.\n // TODO: we could improve how this works by having concurrent age and\n // height scales, which would allow us to do this without having to\n // reference to a specific unit.\n const unit = units.find((u) => u.unit_id === d.unit_id);\n if (unit == null) return null;\n const relHeight = getRelativePositionInUnit(\n height,\n unit,\n ColumnAxisType.DEPTH,\n );\n if (relHeight == null) return null;\n height = getPositionWithinUnit(relHeight, unit, axisType);\n return { height };\n }\n // We can just get the height within the unit, clipped to the unit boundaries\n return standardizeMeasurementHeight({ unit_id: d.unit_id }, units, axisType);\n}\n\nfunction getRelativePositionInUnit(\n pos: number,\n unit: UnitLong,\n axisType: ColumnAxisType,\n): number | null {\n // This is the inverse of getPositionWithinUnit\n const heights = getUnitHeightRange(unit, axisType, false);\n const scale = scaleLinear(heights).domain([0, 1]);\n const relPos = scale.invert(pos);\n if (relPos < 0 || relPos > 1) return null;\n return relPos;\n}\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAErB,SAAS,0CAAkB,YAChC,QAAQ,QACR,OAAO,CAAA,GAAA,yCAAa,EAAE,WAAW,EAIlC;IACC,MAAM,OAAO,CAAA,GAAA,yCAAY,EAAE,UAAU;IACrC,MAAM,YAAE,QAAQ,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,yCAAsB;IAClD,MAAM,QAAQ,CAAA,GAAA,wCAAgB;IAE9B,IAAI,QAAQ,QAAQ,SAAS,QAAQ,SAAS,MAAM,OAAO;IAE3D,MAAM,QAAQ,sCAAgB,MAAM,OAAO,OAAO;IAElD,OAAO,wBAAE,CAAA,GAAA,yCAAqB,GAAG;QAC/B,MAAM;QACN,eAAe;QACf,sBAAsB;QACtB,WAAW;IACb;AACF;AAkBA,SAAS,iCAAW,KAAsB;IACxC,MAAM,QAAE,IAAI,YAAE,QAAQ,WAAE,UAAU,OAAO,GAAG;IAC5C,MAAM,QAAE,IAAI,EAAE,GAAG;IACjB,2BAA2B;IAC3B,KAAK,IAAI,CAAC,CAAC,GAAG;QACZ,MAAM,QAAQ,EAAE,SAAS,IAAI,EAAE,SAAS,IAAI;QAC5C,MAAM,QAAQ,EAAE,SAAS,IAAI,EAAE,SAAS,IAAI;QAC5C,OAAO,MAAM,aAAa,CAAC;IAC7B;IAEA,OAAO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AAE,GAAG,IAAI,QAAQ;QACpC,+DAA+D;QAC/D,iCAAiC;QACjC,SAAS,OAAO,EAAE,GAAG;QACrB,IAAI,aAAa,CAAA,GAAA,qBAAa,EAAE,KAAK,EACnC,iCAAiC;QACjC,OAAO;oBAAE;QAAO;IAEpB;IACA,IAAI,EAAE,OAAO,IAAI,MAAM,OAAO;IAC9B,IAAI,UAAU,MAAM;QAClB,qEAAqE;QACrE,0CAA0C;QAC1C,qEAAqE;QACrE,mEAAmE;QACnE,gCAAgC;QAChC,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,IAAM,EAAE,OAAO,KAAK,EAAE,OAAO;QACtD,IAAI,QAAQ,MAAM,OAAO;QACzB,MAAM,YAAY,gDAChB,QACA,MACA,CAAA,GAAA,qBAAa,EAAE,KAAK;QAEtB,IAAI,aAAa,MAAM,OAAO;QAC9B,SAAS,CAAA,GAAA,yCAAoB,EAAE,WAAW,MAAM;QAChD,OAAO;oBAAE;QAAO;IAClB;IACA,6EAA6E;IAC7E,OAAO,CAAA,GAAA,yCAA2B,EAAE;QAAE,SAAS,EAAE,OAAO;IAAC,GAAG,OAAO;AACrE;AAEA,SAAS,gDACP,GAAW,EACX,IAAc,EACd,QAAwB;IAExB,+CAA+C;IAC/C,MAAM,UAAU,CAAA,GAAA,wCAAiB,EAAE,MAAM,UAAU;IACnD,MAAM,QAAQ,CAAA,GAAA,kBAAU,EAAE,SAAS,MAAM,CAAC;QAAC;QAAG;KAAE;IAChD,MAAM,SAAS,MAAM,MAAM,CAAC;IAC5B,IAAI,SAAS,KAAK,SAAS,GAAG,OAAO;IACrC,OAAO;AACT","sources":["packages/column-views/src/facets/fossils/index.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport {\n FossilDataType,\n type PBDBCollection,\n type PBDBEntity,\n type PBDBOccurrence,\n useFossilData,\n} from \"./provider\";\nimport type { IUnit } from \"../../units\";\nimport {\n BaseMeasurementsColumn,\n ColumnMeasurementData,\n MeasurementHeightData,\n standardizeMeasurementHeight,\n groupNotesByPixelDistance,\n TruncatedList,\n} from \"../measurements\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport {\n useCompositeScale,\n useMacrostratColumnData,\n} from \"../../data-provider\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport styles from \"./taxon-ranges.module.sass\";\nimport {\n CompositeColumnScale,\n getPositionWithinUnit,\n getUnitHeightRange,\n} from \"../../prepare-units\";\nimport { scaleLinear } from \"d3-scale\";\n\nexport {\n FossilDataType,\n type PBDBCollection,\n type PBDBEntity,\n type PBDBOccurrence,\n useFossilData,\n};\nexport * from \"./taxon-ranges\";\n\nconst h = hyper.styled(styles);\n\nexport function PBDBFossilsColumn({\n columnID,\n type = FossilDataType.Collections,\n}: {\n columnID: number;\n type: FossilDataType;\n}) {\n const data = useFossilData(columnID, type);\n const { axisType, units } = useMacrostratColumnData();\n const scale = useCompositeScale();\n\n if (data == null || units == null || scale == null) return null;\n\n const data1 = preparePBDBData(data, units, scale, axisType);\n\n return h(BaseMeasurementsColumn, {\n data: data1,\n noteComponent: FossilInfo,\n focusedNoteComponent: FossilInfo,\n className: \"fossil-collections\",\n });\n}\n\ninterface FossilItemProps {\n note: {\n data: PBDBCollection[];\n unit?: IUnit;\n };\n spacing?: {\n below?: number;\n above?: number;\n };\n width?: number;\n height?: number;\n color?: string;\n focused?: boolean;\n maxItems?: number;\n}\n\nfunction FossilInfo(props: FossilItemProps) {\n const { note, maxItems, focused = false } = props;\n const { data } = note;\n // Sort collections by name\n data.sort((a, b) => {\n const nameA = a.best_name ?? a.cltn_name ?? \"\";\n const nameB = b.best_name ?? b.cltn_name ?? \"\";\n return nameA.localeCompare(nameB);\n });\n\n return h(TruncatedList, {\n data,\n className: \"fossil-collections\",\n itemRenderer: PBDBCollectionLink,\n maxItems: focused ? Infinity : (maxItems ?? 5),\n });\n}\n\nfunction PBDBCollectionLink({\n data,\n}: {\n data: PBDBCollection | PBDBOccurrence;\n}) {\n /** A link to a PBDB collection that handles either an occurrence or collection object */\n return h(\n \"a.link-id\",\n {\n href: `https://paleobiodb.org/app/collections#display=col:${data.cltn_id}`,\n target: \"_blank\",\n onClick(e) {\n e.stopPropagation();\n },\n },\n data.best_name ?? data.cltn_name,\n );\n}\n\ninterface PreparePBDBDataOptions {\n /** If set, group close notes within this distance (in pixels in display space)\n * into a single note. If a number is provided, that number is used as the distance,\n * otherwise a default of 5 pixels is used.\n */\n groupCloseNotes?: boolean | number;\n}\n\nfunction preparePBDBData<T extends PBDBEntity>(\n data: T[],\n units: UnitLong[],\n scale: CompositeColumnScale,\n axisType: ColumnAxisType,\n options?: PreparePBDBDataOptions,\n) {\n /** Prepare PBDB fossil data for display in a measurements column */\n const { groupCloseNotes = true } = options ?? {};\n const groupDistance =\n typeof groupCloseNotes === \"number\" ? groupCloseNotes : 10;\n\n // Map of data to its defined height ranges\n const dataMap = new Map<string, ColumnMeasurementData<T[]>>();\n\n // Todo: if we wanted, we could add a step where we group notes that are too close together here...\n\n for (const d of data) {\n const range = getHeightRangeForPBDBEntity(d, units, axisType);\n\n if (range == null) continue;\n const { height, top_height } = range;\n // compose the key based on height info\n let key = `${height}`;\n if (top_height != null) {\n key += `-${top_height}`;\n }\n\n // Group by height key\n if (!dataMap.has(key)) {\n dataMap.set(key, {\n height,\n top_height: top_height ?? height,\n data: [],\n id: key,\n });\n }\n dataMap.get(key)!.data.push(d);\n }\n\n return groupNotesByPixelDistance(\n Array.from(dataMap.values()),\n scale,\n axisType,\n groupDistance,\n );\n}\n\nfunction getHeightRangeForPBDBEntity<T extends PBDBEntity>(\n d: T,\n units: UnitLong[],\n axisType: ColumnAxisType,\n): MeasurementHeightData | null {\n let height: number | null = null;\n if (d.slb != null && d.slu == \"mbsf\") {\n // Meters below sea floor - special case for eODP where we have\n // specific depth data referenced\n height = Number(d.slb);\n if (axisType === ColumnAxisType.DEPTH) {\n // Data is already in depth units\n return { height };\n }\n }\n if (d.unit_id == null) return null;\n if (height != null) {\n // If we have both height and unit info, we need to adjust the height\n // to fit whatever scale type we're using.\n // TODO: we could improve how this works by having concurrent age and\n // height scales, which would allow us to do this without having to\n // reference to a specific unit.\n const unit = units.find((u) => u.unit_id === d.unit_id);\n if (unit == null) return null;\n const relHeight = getRelativePositionInUnit(\n height,\n unit,\n ColumnAxisType.DEPTH,\n );\n if (relHeight == null) return null;\n height = getPositionWithinUnit(relHeight, unit, axisType);\n return { height };\n }\n // We can just get the height within the unit, clipped to the unit boundaries\n return standardizeMeasurementHeight({ unit_id: d.unit_id }, units, axisType);\n}\n\nfunction getRelativePositionInUnit(\n pos: number,\n unit: UnitLong,\n axisType: ColumnAxisType,\n): number | null {\n // This is the inverse of getPositionWithinUnit\n const heights = getUnitHeightRange(unit, axisType, false);\n const scale = scaleLinear(heights).domain([0, 1]);\n const relPos = scale.invert(pos);\n if (relPos < 0 || relPos > 1) return null;\n return relPos;\n}\n"],"names":[],"version":3,"file":"column-views.25713aad.js.map"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {useMeasurementData as $5dbb619f2c7bef60$export$8a0335fd9ff72150} from "./column-views.a7c5ae16.js";
|
|
2
|
-
import {IsotopeDataPoint as $5f39f3d52558a1d0$export$4cb5d059db4e2bd, IsotopesDataArea as $5f39f3d52558a1d0$export$309ef8546e07d921, useDataLocator as $5f39f3d52558a1d0$export$919dbb10b6b5b75} from "./column-views.
|
|
3
|
-
import {useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d, useMacrostratUnits as $d5074f164411387e$export$6fb40844db555b2} from "./column-views.
|
|
2
|
+
import {IsotopeDataPoint as $5f39f3d52558a1d0$export$4cb5d059db4e2bd, IsotopesDataArea as $5f39f3d52558a1d0$export$309ef8546e07d921, useDataLocator as $5f39f3d52558a1d0$export$919dbb10b6b5b75} from "./column-views.8c8f3fe0.js";
|
|
3
|
+
import {useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d, useMacrostratUnits as $d5074f164411387e$export$6fb40844db555b2} from "./column-views.8168c37d.js";
|
|
4
4
|
import "./column-views.708140ab.css";
|
|
5
5
|
import $0zDA3$columnviews6992ca88js from "./column-views.6992ca88.js";
|
|
6
6
|
import {useMemo as $0zDA3$useMemo} from "react";
|
|
@@ -184,4 +184,4 @@ function $d71d096cfe00860f$var$ColumnScaleLines(props) {
|
|
|
184
184
|
|
|
185
185
|
|
|
186
186
|
export {$d71d096cfe00860f$export$c69bd0285aa5d775 as IsotopesDataset, $d71d096cfe00860f$export$5d8aa8022c284748 as IsotopesColumn};
|
|
187
|
-
//# sourceMappingURL=column-views.
|
|
187
|
+
//# sourceMappingURL=column-views.28cab78c.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAO5B,SAAS,kCAAY,SAAE,KAAK,QAAE,IAAI,EAAE,GAAG,MAAyB;IAC9D,MAAM,gBAAE,YAAY,EAAE,GAAG,CAAA,GAAA,wCAAa;IACtC,MAAM,CAAC,GAAG,EAAE,GAAG,aAAa;IAC5B,OAAO,wBACL,QACA;WACE;WACA;QACA,GAAG,IAAI;IACT,GACA;AAEJ;AAWA,SAAS,gCAAU,KAAqB;IACtC,IAAI,SAAE,KAAK,aAAE,SAAS,eAAE,WAAW,eAAE,WAAW,EAAE,GAAG,MAAM,GAAG;IAC9D,MAAM,YAAE,QAAQ,EAAE,GAAG,CAAA,GAAA,yCAAsB;IAE3C,MAAM,UAAE,MAAM,EAAE,GAAG,CAAA,GAAA,sBAAc;IACjC,MAAM,IAAI,OAAO;IACjB,MAAM,YAAY,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACnC,YAAY,CAAA,GAAA,iBAAS,EAAE,WAAW;QAAE,MAAM,UAAU;IAAE;IACtD,OAAO,wBAAE,UAAU;mBAAE;mBAAW;QAAW,KAAK;IAAM,GAAG;QACvD,wBACE,gBACA,S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AAA,GAAA,iBAAS,GAAG;gBACZ,OAAO;gBACP,YAAY;4BACZ;gBACA,QAAQ;gBACR,YAAY;gBACZ,GAAG,IAAI;uBACP;YACF;SACD;KAEJ;AACH;AAEA,SAAS,uCAAiB,KAAK;IAC7B,MAAM,cAAE,UAAU,UAAE,MAAM,EAAE,GAAG;IAE/B,OAAO,wBACL,iBACA,WAAW,GAAG,CAAC,CAAC;QACd,OAAO,wBAAE,iCAAW;mBAAE;QAAM;IAC9B;AAEJ","sources":["packages/column-views/src/facets/carbon-isotopes/isotopes-column.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport hyper from \"@macrostrat/hyper\";\nimport classNames from \"classnames\";\nimport { AxisBottom } from \"@visx/axis\";\nimport { useMeasurementData } from \"./data-provider\";\n\nimport {\n IsotopesDataArea,\n useDataLocator,\n IsotopeDataPoint,\n} from \"./data-area\";\nimport { referenceMeasuresToColumn } from \"@macrostrat/stratigraphy-utils\";\nimport {\n SVG,\n ColumnLayoutProvider,\n useColumnLayout,\n} from \"@macrostrat/column-components\";\nimport {\n useMacrostratColumnData,\n useMacrostratUnits,\n} from \"../../data-provider\";\nimport styles from \"./isotopes-column.module.sass\";\nimport { scaleLinear } from \"d3-scale\";\n\nconst h = hyper.styled(styles);\n\ntype IsotopesTextProps = {\n datum: any;\n text: string;\n};\n\nfunction IsotopeText({ datum, text, ...rest }: IsotopesTextProps) {\n const { pointLocator } = useDataLocator();\n const [x, y] = pointLocator(datum);\n return h(\n \"text\",\n {\n x,\n y,\n ...rest,\n },\n text,\n );\n}\n\ninterface ScaleLineProps {\n value: number;\n className?: string;\n labelBottom?: boolean;\n labelOffset?: number;\n strokeDasharray?: string;\n stroke?: string | number;\n}\n\nfunction ScaleLine(props: ScaleLineProps) {\n let { value, className, labelBottom, labelOffset, ...rest } = props;\n const { sections } = useMacrostratColumnData();\n\n const { xScale } = useColumnLayout();\n const x = xScale(value);\n const transform = `translate(${x})`;\n className = classNames(className, { zero: value === 0 });\n return h(\"g.tick\", { transform, className, key: value }, [\n h(\n \"g.tick-lines\",\n sections.map((d) => {\n const { scaleInfo } = d;\n const y1 = scaleInfo.offset;\n const y2 = y1 + scaleInfo.pixelHeight;\n return h(\"line\", {\n y1,\n y2,\n strokeDasharray: props.strokeDasharray,\n strokeWidth: 1,\n });\n }),\n ),\n ]);\n}\n\nfunction unnestPoints(measures) {\n let points = [];\n for (const meas of measures) {\n const vals = meas.measure_value.map((d, i) => {\n return {\n value: d,\n age: meas.measure_age[i],\n position: meas.measure_position[i],\n unit_id: meas.unit_id,\n sample_id: meas.sample_no[i],\n measurement: meas.measurement,\n };\n });\n Array.prototype.push.apply(points, vals);\n }\n return points;\n}\n\ninterface IsotopesDatasetProps {\n color?: string;\n parameter: string;\n}\n\ninterface IsotopeColumnProps extends IsotopesDatasetProps {\n width: number;\n tickValues?: number[];\n label: string;\n domain?: [number, number];\n transform?: string;\n getHeight?: Function;\n nTicks?: number;\n showAxis?: boolean;\n}\n\nfunction IsotopesDataset(props) {\n const { parameter, color = \"dodgerblue\" } = props;\n const units = useMacrostratUnits();\n const measures = useMeasurementData() ?? [];\n\n const points = useMemo(() => {\n const data = measures.filter((d) => d.measurement === parameter);\n const refMeasures = referenceMeasuresToColumn(units, data);\n return unnestPoints(refMeasures);\n }, [measures, parameter, units]);\n\n return h(\n IsotopesDataArea,\n {\n getHeight(d) {\n return d.age;\n },\n } as any,\n h(\n \"g.data-points\",\n points.map((d) => {\n return h(IsotopeDataPoint, {\n datum: d,\n fill: color,\n });\n }),\n ),\n );\n}\n\nfunction IsotopesColumn(\n props: IsotopeColumnProps & { children?: React.ReactNode },\n) {\n const {\n width = 120,\n domain = [-14, 6],\n parameter,\n label,\n color = \"dodgerblue\",\n children = null,\n transform,\n getHeight,\n showAxis = true,\n tickValues: _tickVals,\n nTicks = 6,\n ...rest\n } = props;\n\n const { totalHeight } = useMacrostratColumnData();\n\n let _children: any = children;\n if (children == null && parameter != null) {\n _children = h(IsotopesDataset, { parameter, color, getHeight });\n }\n\n const xScale = useMemo(\n () => scaleLinear().domain(domain).range([0, width]),\n [domain, width],\n );\n\n const tickValues = _tickVals ?? xScale.ticks(nTicks);\n\n return h(\"div.isotopes-column\", [\n h(\n SVG,\n {\n height: totalHeight,\n innerWidth: width,\n paddingH: 15,\n },\n h(\n ColumnLayoutProvider,\n { width, xScale },\n h(\"g.isotopes-column\", { className: parameter, transform }, [\n h(ColumnScaleLines, {\n xScale,\n tickValues,\n width,\n ...rest,\n }),\n _children,\n ]),\n ),\n ),\n h.if(showAxis)(ColumnScaleAxis, {\n width,\n label: label ?? parameter,\n xScale,\n tickValues,\n ...rest,\n }),\n ]);\n}\n\nfunction ColumnScaleAxis(props) {\n const { label, xScale, width, showAxis = true, tickValues, ...rest } = props;\n\n return h(\"div.isotopes-scale-axis\", [\n h(\n SVG,\n {\n innerWidth: width,\n height: 45,\n paddingH: 15,\n },\n [\n h(AxisBottom, {\n scale: xScale,\n tickLength: 5,\n tickValues,\n stroke: \"var(--column-stroke-color)\",\n tickStroke: \"var(--column-stroke-color)\",\n ...rest,\n label,\n }),\n ],\n ),\n ]);\n}\n\nfunction ColumnScaleLines(props) {\n const { tickValues, xScale } = props;\n\n return h(\n \"g.scale-lines\",\n tickValues.map((value) => {\n return h(ScaleLine, { value });\n }),\n );\n}\n\nexport { IsotopesColumn, IsotopesDataset };\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAO5B,SAAS,kCAAY,SAAE,KAAK,QAAE,IAAI,EAAE,GAAG,MAAyB;IAC9D,MAAM,gBAAE,YAAY,EAAE,GAAG,CAAA,GAAA,wCAAa;IACtC,MAAM,CAAC,GAAG,EAAE,GAAG,aAAa;IAC5B,OAAO,wBACL,QACA;WACE;WACA;QACA,GAAG,IAAI;IACT,GACA;AAEJ;AAWA,SAA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;QAAU,GAAG;YAC1D,wBAAE,wCAAkB;wBAClB;4BACA;uBACA;gBACA,GAAG,IAAI;YACT;YACA;SACD;QAGL,wBAAE,EAAE,CAAC,UAAU,uCAAiB;mBAC9B;YACA,OAAO,SAAS;oBAChB;wBACA;YACA,GAAG,IAAI;QACT;KACD;AACH;AAEA,SAAS,sCAAgB,KAAK;IAC5B,MAAM,SAAE,KAAK,UAAE,MAAM,SAAE,KAAK,YAAE,WAAW,kBAAM,UAAU,EAAE,GAAG,MAAM,GAAG;IAEvE,OAAO,wBAAE,2BAA2B;QAClC,wBACE,CAAA,GAAA,UAAE,GACF;YACE,YAAY;YACZ,QAAQ;YACR,UAAU;QACZ,GACA;YACE,wBAAE,CAAA,GAAA,iBAAS,GAAG;gBACZ,OAAO;gBACP,YAAY;4BACZ;gBACA,QAAQ;gBACR,YAAY;gBACZ,GAAG,IAAI;uBACP;YACF;SACD;KAEJ;AACH;AAEA,SAAS,uCAAiB,KAAK;IAC7B,MAAM,cAAE,UAAU,UAAE,MAAM,EAAE,GAAG;IAE/B,OAAO,wBACL,iBACA,WAAW,GAAG,CAAC,CAAC;QACd,OAAO,wBAAE,iCAAW;mBAAE;QAAM;IAC9B;AAEJ","sources":["packages/column-views/src/facets/carbon-isotopes/isotopes-column.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport hyper from \"@macrostrat/hyper\";\nimport classNames from \"classnames\";\nimport { AxisBottom } from \"@visx/axis\";\nimport { useMeasurementData } from \"./data-provider\";\n\nimport {\n IsotopesDataArea,\n useDataLocator,\n IsotopeDataPoint,\n} from \"./data-area\";\nimport { referenceMeasuresToColumn } from \"@macrostrat/stratigraphy-utils\";\nimport {\n SVG,\n ColumnLayoutProvider,\n useColumnLayout,\n} from \"@macrostrat/column-components\";\nimport {\n useMacrostratColumnData,\n useMacrostratUnits,\n} from \"../../data-provider\";\nimport styles from \"./isotopes-column.module.sass\";\nimport { scaleLinear } from \"d3-scale\";\n\nconst h = hyper.styled(styles);\n\ntype IsotopesTextProps = {\n datum: any;\n text: string;\n};\n\nfunction IsotopeText({ datum, text, ...rest }: IsotopesTextProps) {\n const { pointLocator } = useDataLocator();\n const [x, y] = pointLocator(datum);\n return h(\n \"text\",\n {\n x,\n y,\n ...rest,\n },\n text,\n );\n}\n\ninterface ScaleLineProps {\n value: number;\n className?: string;\n labelBottom?: boolean;\n labelOffset?: number;\n strokeDasharray?: string;\n stroke?: string | number;\n}\n\nfunction ScaleLine(props: ScaleLineProps) {\n let { value, className, labelBottom, labelOffset, ...rest } = props;\n const { sections } = useMacrostratColumnData();\n\n const { xScale } = useColumnLayout();\n const x = xScale(value);\n const transform = `translate(${x})`;\n className = classNames(className, { zero: value === 0 });\n return h(\"g.tick\", { transform, className, key: value }, [\n h(\n \"g.tick-lines\",\n sections.map((d) => {\n const { scaleInfo } = d;\n const y1 = scaleInfo.offset;\n const y2 = y1 + scaleInfo.pixelHeight;\n return h(\"line\", {\n y1,\n y2,\n strokeDasharray: props.strokeDasharray,\n strokeWidth: 1,\n });\n }),\n ),\n ]);\n}\n\nfunction unnestPoints(measures) {\n let points = [];\n for (const meas of measures) {\n const vals = meas.measure_value.map((d, i) => {\n return {\n value: d,\n age: meas.measure_age[i],\n position: meas.measure_position[i],\n unit_id: meas.unit_id,\n sample_id: meas.sample_no[i],\n measurement: meas.measurement,\n };\n });\n Array.prototype.push.apply(points, vals);\n }\n return points;\n}\n\ninterface IsotopesDatasetProps {\n color?: string;\n parameter: string;\n}\n\ninterface IsotopeColumnProps extends IsotopesDatasetProps {\n width: number;\n tickValues?: number[];\n label: string;\n domain?: [number, number];\n transform?: string;\n getHeight?: Function;\n nTicks?: number;\n showAxis?: boolean;\n}\n\nfunction IsotopesDataset(props) {\n const { parameter, color = \"dodgerblue\" } = props;\n const units = useMacrostratUnits();\n const measures = useMeasurementData() ?? [];\n\n const points = useMemo(() => {\n const data = measures.filter((d) => d.measurement === parameter);\n const refMeasures = referenceMeasuresToColumn(units, data);\n return unnestPoints(refMeasures);\n }, [measures, parameter, units]);\n\n return h(\n IsotopesDataArea,\n {\n getHeight(d) {\n return d.age;\n },\n } as any,\n h(\n \"g.data-points\",\n points.map((d) => {\n return h(IsotopeDataPoint, {\n datum: d,\n fill: color,\n });\n }),\n ),\n );\n}\n\nfunction IsotopesColumn(\n props: IsotopeColumnProps & { children?: React.ReactNode },\n) {\n const {\n width = 120,\n domain = [-14, 6],\n parameter,\n label,\n color = \"dodgerblue\",\n children = null,\n transform,\n getHeight,\n showAxis = true,\n tickValues: _tickVals,\n nTicks = 6,\n ...rest\n } = props;\n\n const { totalHeight } = useMacrostratColumnData();\n\n let _children: any = children;\n if (children == null && parameter != null) {\n _children = h(IsotopesDataset, { parameter, color, getHeight });\n }\n\n const xScale = useMemo(\n () => scaleLinear().domain(domain).range([0, width]),\n [domain, width],\n );\n\n const tickValues = _tickVals ?? xScale.ticks(nTicks);\n\n return h(\"div.isotopes-column\", [\n h(\n SVG,\n {\n height: totalHeight,\n innerWidth: width,\n paddingH: 15,\n },\n h(\n ColumnLayoutProvider,\n { width, xScale },\n h(\"g.isotopes-column\", { className: parameter, transform }, [\n h(ColumnScaleLines, {\n xScale,\n tickValues,\n width,\n ...rest,\n }),\n _children,\n ]),\n ),\n ),\n h.if(showAxis)(ColumnScaleAxis, {\n width,\n label: label ?? parameter,\n xScale,\n tickValues,\n ...rest,\n }),\n ]);\n}\n\nfunction ColumnScaleAxis(props) {\n const { label, xScale, width, showAxis = true, tickValues, ...rest } = props;\n\n return h(\"div.isotopes-scale-axis\", [\n h(\n SVG,\n {\n innerWidth: width,\n height: 45,\n paddingH: 15,\n },\n [\n h(AxisBottom, {\n scale: xScale,\n tickLength: 5,\n tickValues,\n stroke: \"var(--column-stroke-color)\",\n tickStroke: \"var(--column-stroke-color)\",\n ...rest,\n label,\n }),\n ],\n ),\n ]);\n}\n\nfunction ColumnScaleLines(props) {\n const { tickValues, xScale } = props;\n\n return h(\n \"g.scale-lines\",\n tickValues.map((value) => {\n return h(ScaleLine, { value });\n }),\n );\n}\n\nexport { IsotopesColumn, IsotopesDataset };\n"],"names":[],"version":3,"file":"column-views.28cab78c.js.map"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import {columnUnitsMapAtom as $c4083056aa697244$export$c798b7ff7cb2357b, scope as $c4083056aa697244$export$5cff813ca8e50db9} from "./column-views.67804ce5.js";
|
|
2
|
+
import {useKeyHandler as $7fhMn$useKeyHandler} from "@macrostrat/ui-components";
|
|
3
|
+
import {useEffect as $7fhMn$useEffect, useRef as $7fhMn$useRef, useCallback as $7fhMn$useCallback} from "react";
|
|
4
|
+
import {atom as $7fhMn$atom} from "jotai";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
function $61771df184788970$export$77a278d5ca56e309() {
|
|
11
|
+
return (0, $c4083056aa697244$export$5cff813ca8e50db9).useSetAtom($61771df184788970$var$selectedUnitAtom);
|
|
12
|
+
}
|
|
13
|
+
function $61771df184788970$export$f0dd93f90aa8e5da() {
|
|
14
|
+
return (0, $c4083056aa697244$export$5cff813ca8e50db9).useAtomValue($61771df184788970$var$selectedUnitAtom);
|
|
15
|
+
}
|
|
16
|
+
const $61771df184788970$export$3c12ff51b216428d = (0, $7fhMn$atom)(true);
|
|
17
|
+
const $61771df184788970$export$6d9520abc11d1c2b = (0, $7fhMn$atom)();
|
|
18
|
+
const $61771df184788970$var$overlayPositionAtom = (0, $7fhMn$atom)();
|
|
19
|
+
const $61771df184788970$var$columnRefAtom = (0, $7fhMn$atom)({
|
|
20
|
+
current: null
|
|
21
|
+
});
|
|
22
|
+
function $61771df184788970$export$ab00b48759e36cb4() {
|
|
23
|
+
return (0, $c4083056aa697244$export$5cff813ca8e50db9).useAtomValue($61771df184788970$var$columnRefAtom);
|
|
24
|
+
}
|
|
25
|
+
const $61771df184788970$var$selectedUnitAtom = (0, $7fhMn$atom)((get)=>{
|
|
26
|
+
if (!get($61771df184788970$export$3c12ff51b216428d)) return null;
|
|
27
|
+
const unitID = get($61771df184788970$export$6d9520abc11d1c2b);
|
|
28
|
+
if (unitID == null) return null;
|
|
29
|
+
const unitsMap = get((0, $c4083056aa697244$export$c798b7ff7cb2357b));
|
|
30
|
+
return unitsMap?.get(unitID) || null;
|
|
31
|
+
}, (get, set, selectedUnit, target = null)=>{
|
|
32
|
+
if (!get($61771df184788970$export$3c12ff51b216428d)) throw new Error("Unit selection is disabled.");
|
|
33
|
+
let unitID;
|
|
34
|
+
let unit = null;
|
|
35
|
+
if (selectedUnit == null) unitID = null;
|
|
36
|
+
else if (typeof selectedUnit === "number") unitID = selectedUnit;
|
|
37
|
+
else if ("unit_id" in selectedUnit) unitID = selectedUnit.unit_id;
|
|
38
|
+
if (unitID != null) {
|
|
39
|
+
// Verify that the unit exists in the current colum, else throw
|
|
40
|
+
const unitsMap = get((0, $c4083056aa697244$export$c798b7ff7cb2357b));
|
|
41
|
+
if (!unitsMap?.has(unitID)) throw new Error(`Unit with ID ${unitID} not found in current column units.`);
|
|
42
|
+
unit = unitsMap.get(unitID) ?? null;
|
|
43
|
+
}
|
|
44
|
+
let overlayPosition = null;
|
|
45
|
+
const columnEl = get($61771df184788970$var$columnRefAtom)?.current;
|
|
46
|
+
if (unit != null && columnEl != null && target != null) {
|
|
47
|
+
const rect = columnEl.getBoundingClientRect();
|
|
48
|
+
const targetRect = target.getBoundingClientRect();
|
|
49
|
+
overlayPosition = {
|
|
50
|
+
x: targetRect.left - rect.left,
|
|
51
|
+
y: targetRect.top - rect.top,
|
|
52
|
+
width: targetRect.width,
|
|
53
|
+
height: targetRect.height
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
set($61771df184788970$export$6d9520abc11d1c2b, unitID);
|
|
57
|
+
set($61771df184788970$var$overlayPositionAtom, overlayPosition);
|
|
58
|
+
return unit;
|
|
59
|
+
});
|
|
60
|
+
function $61771df184788970$export$36e20e8024573d5c() {
|
|
61
|
+
return (0, $c4083056aa697244$export$5cff813ca8e50db9).useAtomValue($61771df184788970$var$overlayPositionAtom);
|
|
62
|
+
}
|
|
63
|
+
function $61771df184788970$export$1a7a0d00e4ba9c81({ onUnitSelected: onUnitSelected }) {
|
|
64
|
+
const selectedUnit = (0, $c4083056aa697244$export$5cff813ca8e50db9).useAtomValue($61771df184788970$var$selectedUnitAtom);
|
|
65
|
+
(0, $7fhMn$useEffect)(()=>{
|
|
66
|
+
onUnitSelected?.(selectedUnit?.unit_id ?? null, selectedUnit ?? null);
|
|
67
|
+
}, [
|
|
68
|
+
selectedUnit?.unit_id
|
|
69
|
+
]);
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
function $61771df184788970$export$cbbec12b1451fe7d(unit) {
|
|
73
|
+
const ref = (0, $7fhMn$useRef)();
|
|
74
|
+
const selectedUnit = $61771df184788970$export$f0dd93f90aa8e5da();
|
|
75
|
+
const selectUnit = $61771df184788970$export$77a278d5ca56e309();
|
|
76
|
+
const selected = selectedUnit?.unit_id == unit.unit_id;
|
|
77
|
+
const onClick = (0, $7fhMn$useCallback)((evt)=>{
|
|
78
|
+
selectUnit?.(unit, ref.current);
|
|
79
|
+
evt.stopPropagation();
|
|
80
|
+
}, [
|
|
81
|
+
unit,
|
|
82
|
+
selectUnit
|
|
83
|
+
]);
|
|
84
|
+
(0, $7fhMn$useEffect)(()=>{
|
|
85
|
+
if (!selected || selectUnit == null) return;
|
|
86
|
+
// In case we haven't set the position of the unit (if we don't have a target), set the selected unit
|
|
87
|
+
selectUnit(unit, ref.current);
|
|
88
|
+
// Scroll the unit into view
|
|
89
|
+
ref.current?.scrollIntoView({
|
|
90
|
+
behavior: "smooth",
|
|
91
|
+
block: "center",
|
|
92
|
+
inline: "nearest"
|
|
93
|
+
});
|
|
94
|
+
}, [
|
|
95
|
+
selected,
|
|
96
|
+
selectUnit
|
|
97
|
+
]);
|
|
98
|
+
return [
|
|
99
|
+
ref,
|
|
100
|
+
selected,
|
|
101
|
+
onClick
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
function $61771df184788970$export$70f5ee19650fc7d1({ units: units }) {
|
|
105
|
+
const selectedUnit = $61771df184788970$export$f0dd93f90aa8e5da();
|
|
106
|
+
const selectUnit = $61771df184788970$export$77a278d5ca56e309();
|
|
107
|
+
const ix = units.findIndex((unit)=>unit.unit_id === selectedUnit?.unit_id);
|
|
108
|
+
const keyMap = {
|
|
109
|
+
38: ix - 1,
|
|
110
|
+
40: ix + 1
|
|
111
|
+
};
|
|
112
|
+
(0, $7fhMn$useKeyHandler)((event)=>{
|
|
113
|
+
const nextIx = keyMap[event.keyCode];
|
|
114
|
+
if (nextIx == null || nextIx < 0 || nextIx >= units.length) return;
|
|
115
|
+
selectUnit(units[nextIx], null);
|
|
116
|
+
event.stopPropagation();
|
|
117
|
+
}, [
|
|
118
|
+
units,
|
|
119
|
+
ix
|
|
120
|
+
]);
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
export {$61771df184788970$export$77a278d5ca56e309 as useUnitSelectionDispatch, $61771df184788970$export$f0dd93f90aa8e5da as useSelectedUnit, $61771df184788970$export$3c12ff51b216428d as allowUnitSelectionAtom, $61771df184788970$export$6d9520abc11d1c2b as selectedUnitIDAtom, $61771df184788970$export$ab00b48759e36cb4 as useColumnRef, $61771df184788970$export$36e20e8024573d5c as useAtomOverlayPosition, $61771df184788970$export$1a7a0d00e4ba9c81 as UnitSelectionCallbackManager, $61771df184788970$export$cbbec12b1451fe7d as useUnitSelectionTarget, $61771df184788970$export$70f5ee19650fc7d1 as UnitKeyboardNavigation};
|
|
126
|
+
//# sourceMappingURL=column-views.2e517e39.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;AAYO,SAAS;IACd,OAAO,CAAA,GAAA,yCAAI,EAAE,UAAU,CAAC;AAC1B;AAEO,SAAS;IACd,OAAO,CAAA,GAAA,yCAAI,EAAE,YAAY,CAAC;AAC5B;AAmBO,MAAM,4CAAyB,C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MAAM,MAAM,EAAE;QAC5D,WAAW,KAAK,CAAC,OAAO,EAAE;QAC1B,MAAM,eAAe;IACvB,GACA;QAAC;QAAO;KAAG;IAEb,OAAO;AACT","sources":["packages/column-views/src/data-provider/unit-selection.ts"],"sourcesContent":["import { BaseUnit } from \"@macrostrat/api-types\";\nimport { useKeyHandler } from \"@macrostrat/ui-components\";\nimport { useEffect, useRef, useCallback } from \"react\";\nimport type { RectBounds, IUnit } from \"../units/types\";\nimport { atom } from \"jotai\";\nimport { columnUnitsMapAtom, scope } from \"./core\";\n\ntype UnitSelectDispatch = (\n unit: number | BaseUnit | null,\n target: HTMLElement | null,\n) => void;\n\nexport function useUnitSelectionDispatch(): UnitSelectDispatch {\n return scope.useSetAtom(selectedUnitAtom);\n}\n\nexport function useSelectedUnit() {\n return scope.useAtomValue(selectedUnitAtom);\n}\n\nexport interface ColumnClickData {\n unitID: number | null;\n unit: BaseUnit | null;\n target: HTMLElement | null;\n height: number;\n // Room for boundary IDs eventually\n}\n\nexport interface UnitSelectionCallbacks {\n // It's sort of unfortunate that we need to pass in the column ref here\n onClickedColumn?: (columnClickData: ColumnClickData, event: Event) => void;\n onUnitSelected?: <T extends BaseUnit>(\n unitID: number | null,\n unit: T | null,\n ) => void;\n}\n\nexport const allowUnitSelectionAtom = atom<boolean>(true);\n\nexport const selectedUnitIDAtom = atom<number | null>();\n\nconst overlayPositionAtom = atom<RectBounds | null>();\n\nconst columnRefAtom = atom<{ current: HTMLElement | null }>({ current: null });\n\nexport function useColumnRef() {\n return scope.useAtomValue(columnRefAtom);\n}\n\nconst selectedUnitAtom = atom(\n (get) => {\n if (!get(allowUnitSelectionAtom)) return null;\n\n const unitID = get(selectedUnitIDAtom);\n if (unitID == null) return null;\n const unitsMap = get(columnUnitsMapAtom);\n return unitsMap?.get(unitID) || null;\n },\n (\n get,\n set,\n selectedUnit: number | BaseUnit | null,\n target: HTMLElement | null = null,\n ): BaseUnit | null => {\n if (!get(allowUnitSelectionAtom)) {\n throw new Error(\"Unit selection is disabled.\");\n }\n\n let unitID: number | null;\n let unit: BaseUnit | null = null;\n if (selectedUnit == null) {\n unitID = null;\n } else if (typeof selectedUnit === \"number\") {\n unitID = selectedUnit;\n } else if (\"unit_id\" in selectedUnit) {\n unitID = selectedUnit.unit_id;\n }\n\n if (unitID != null) {\n // Verify that the unit exists in the current colum, else throw\n const unitsMap = get(columnUnitsMapAtom);\n if (!unitsMap?.has(unitID)) {\n throw new Error(\n `Unit with ID ${unitID} not found in current column units.`,\n );\n }\n unit = unitsMap.get(unitID) ?? null;\n }\n\n let overlayPosition: RectBounds | null = null;\n\n const columnEl = get(columnRefAtom)?.current;\n\n if (unit != null && columnEl != null && target != null) {\n const rect = columnEl.getBoundingClientRect();\n const targetRect = target.getBoundingClientRect();\n overlayPosition = {\n x: targetRect.left - rect.left,\n y: targetRect.top - rect.top,\n width: targetRect.width,\n height: targetRect.height,\n };\n }\n\n set(selectedUnitIDAtom, unitID);\n set(overlayPositionAtom, overlayPosition);\n\n return unit;\n },\n);\n\nexport function useAtomOverlayPosition() {\n return scope.useAtomValue(overlayPositionAtom);\n}\n\nexport function UnitSelectionCallbackManager({\n onUnitSelected,\n}: UnitSelectionCallbacks) {\n const selectedUnit = scope.useAtomValue(selectedUnitAtom);\n useEffect(() => {\n onUnitSelected?.(selectedUnit?.unit_id ?? null, selectedUnit ?? null);\n }, [selectedUnit?.unit_id]);\n return null;\n}\n\n/** TODO: figure out if onClickedColumn is still needed\n /** This is not the natural place to get positions within the column,\n * but it will work for now.\nif (props.onClickedColumn) {\n // Infer height from top and bottom height of unit (because that's passed back with the call)\n //const py = event.y;\n //const [bottom, top] = getUnitHeightRange(unit, axisType);\n //const height = Math.abs(bottom - top);\n\n const columnClickData: ColumnClickData = {\n unitID: unit?.unit_id,\n unit,\n target,\n height: el?.getBoundingClientRect().height || 0,\n };\n props.onClickedColumn(columnClickData, event);\n}*/\n\nexport function useUnitSelectionTarget(\n unit: IUnit,\n): [React.RefObject<HTMLElement>, boolean, (evt: Event) => void] {\n const ref = useRef<HTMLElement>();\n const selectedUnit = useSelectedUnit();\n const selectUnit = useUnitSelectionDispatch();\n const selected = selectedUnit?.unit_id == unit.unit_id;\n\n const onClick = useCallback(\n (evt: Event) => {\n selectUnit?.(unit, ref.current);\n evt.stopPropagation();\n },\n [unit, selectUnit],\n );\n\n useEffect(() => {\n if (!selected || selectUnit == null) return;\n // In case we haven't set the position of the unit (if we don't have a target), set the selected unit\n selectUnit(unit, ref.current);\n\n // Scroll the unit into view\n ref.current?.scrollIntoView({\n behavior: \"smooth\",\n block: \"center\",\n inline: \"nearest\",\n });\n }, [selected, selectUnit]);\n\n return [ref, selected, onClick];\n}\n\nexport function UnitKeyboardNavigation<T extends BaseUnit>({\n units,\n}: {\n units: T[];\n}) {\n const selectedUnit = useSelectedUnit();\n const selectUnit = useUnitSelectionDispatch();\n\n const ix = units.findIndex((unit) => unit.unit_id === selectedUnit?.unit_id);\n\n const keyMap = {\n 38: ix - 1,\n 40: ix + 1,\n };\n\n useKeyHandler(\n (event) => {\n const nextIx = keyMap[event.keyCode];\n if (nextIx == null || nextIx < 0 || nextIx >= units.length) return;\n selectUnit(units[nextIx], null);\n event.stopPropagation();\n },\n [units, ix],\n );\n return null;\n}\n"],"names":[],"version":3,"file":"column-views.2e517e39.js.map"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {ColumnNotesProvider as $8c8238faa5cde49c$export$6cc7a9df4edde18} from "./column-views.
|
|
2
|
-
import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.
|
|
1
|
+
import {ColumnNotesProvider as $8c8238faa5cde49c$export$6cc7a9df4edde18} from "./column-views.f046b170.js";
|
|
2
|
+
import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.8168c37d.js";
|
|
3
3
|
import $aB7pQ$macrostrathyper from "@macrostrat/hyper";
|
|
4
4
|
import {SVG as $aB7pQ$SVG, NotesColumn as $aB7pQ$NotesColumn} from "@macrostrat/column-components";
|
|
5
5
|
|
|
@@ -35,4 +35,4 @@ function $9e52fe4012c88296$export$fc5babae10f3f77d({ notes: notes, width: width
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
export {$9e52fe4012c88296$export$fc5babae10f3f77d as ColumnNotes};
|
|
38
|
-
//# sourceMappingURL=column-views.
|
|
38
|
+
//# sourceMappingURL=column-views.3067c5e3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAkBO,SAAS,0CAAY,SAC1B,KAAK,SACL,QAAQ,oBACR,aAAa,eACb,cAAc,8BACd,wBAAwB,wBACxB,oBAAoB,YACpB,QAAQ,EACS;IACjB,MAAM,eAAE,WAAW,EAAE,GAAG,CAAA,GAAA,yCAAsB;IAC9C,MAAM,QAAQ,CAAA,GAAA,wCAAgB;IAE9B,OAAO,CAAA,GAAA,sBAAA,EACL,CAAA,GAAA,wCAAkB,GAClB;eACE;qBACA;QACA,YAAY;IACd,GACA;QACE,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,UAAE,GAAG;mBAAE;YAAO,QAAQ;YAAa,UAAU;QAAE,GAAG;YAClD,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,kBAAU,GAAG;uBACb;uBACA;+BACA;6BACA;0CACA;sCACA;YACF;SACD;QACD;KACD;AAEL","sources":["packages/column-views/src/notes.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\n\nimport { ColumnNotesProvider } from \"./units\";\n\nimport { NotesColumn, SVG } from \"@macrostrat/column-components\";\nimport { useCompositeScale, useMacrostratColumnData } from \"./data-provider\";\nimport type { ComponentType, ReactNode } from \"react\";\n\ninterface ColumnNotesProps {\n notes: any[];\n width?: number;\n noteComponent?: any;\n paddingLeft?: number;\n deltaConnectorAttachment?: number;\n children?: ReactNode;\n focusedNoteComponent?: ComponentType<any> | null;\n}\n\nexport function ColumnNotes({\n notes,\n width = 200,\n noteComponent,\n paddingLeft = 60,\n deltaConnectorAttachment,\n focusedNoteComponent,\n children,\n}: ColumnNotesProps) {\n const { totalHeight } = useMacrostratColumnData();\n const scale = useCompositeScale();\n\n return h(\n ColumnNotesProvider,\n {\n scale,\n totalHeight,\n pixelScale: -1,\n },\n [\n h(SVG, { width, height: totalHeight, paddingH: 4 }, [\n h(NotesColumn, {\n width,\n notes,\n noteComponent,\n paddingLeft,\n deltaConnectorAttachment,\n focusedNoteComponent,\n }),\n ]),\n children,\n ],\n );\n}\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":";;;;;;;;;AAkBO,SAAS,0CAAY,SAC1B,KAAK,SACL,QAAQ,oBACR,aAAa,eACb,cAAc,8BACd,wBAAwB,wBACxB,oBAAoB,YACpB,QAAQ,EACS;IACjB,MAAM,eAAE,WAAW,EAAE,GAAG,CAAA,GAAA,yCAAsB;IAC9C,MAAM,QAAQ,CAAA,GAAA,wCAAgB;IAE9B,OAAO,CAAA,GAAA,sBAAA,EACL,CAAA,GAAA,wCAAkB,GAClB;eACE;qBACA;QACA,YAAY;IACd,GACA;QACE,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,UAAE,GAAG;mBAAE;YAAO,QAAQ;YAAa,UAAU;QAAE,GAAG;YAClD,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,kBAAU,GAAG;uBACb;uBACA;+BACA;6BACA;0CACA;sCACA;YACF;SACD;QACD;KACD;AAEL","sources":["packages/column-views/src/notes.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\n\nimport { ColumnNotesProvider } from \"./units\";\n\nimport { NotesColumn, SVG } from \"@macrostrat/column-components\";\nimport { useCompositeScale, useMacrostratColumnData } from \"./data-provider\";\nimport type { ComponentType, ReactNode } from \"react\";\n\ninterface ColumnNotesProps {\n notes: any[];\n width?: number;\n noteComponent?: any;\n paddingLeft?: number;\n deltaConnectorAttachment?: number;\n children?: ReactNode;\n focusedNoteComponent?: ComponentType<any> | null;\n}\n\nexport function ColumnNotes({\n notes,\n width = 200,\n noteComponent,\n paddingLeft = 60,\n deltaConnectorAttachment,\n focusedNoteComponent,\n children,\n}: ColumnNotesProps) {\n const { totalHeight } = useMacrostratColumnData();\n const scale = useCompositeScale();\n\n return h(\n ColumnNotesProvider,\n {\n scale,\n totalHeight,\n pixelScale: -1,\n },\n [\n h(SVG, { width, height: totalHeight, paddingH: 4 }, [\n h(NotesColumn, {\n width,\n notes,\n noteComponent,\n paddingLeft,\n deltaConnectorAttachment,\n focusedNoteComponent,\n }),\n ]),\n children,\n ],\n );\n}\n"],"names":[],"version":3,"file":"column-views.3067c5e3.js.map"}
|