@macrostrat/column-views 2.3.3 → 2.4.1
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 +14 -0
- package/dist/esm/{column-views.b977da35.js → column-views.083fb787.js} +5 -5
- package/dist/esm/{column-views.b977da35.js.map → column-views.083fb787.js.map} +1 -1
- package/dist/esm/{column-views.4685ea28.js → column-views.088a0274.js} +2 -2
- package/dist/esm/{column-views.4685ea28.js.map → column-views.088a0274.js.map} +1 -1
- package/dist/esm/{column-views.a665cbb2.js → column-views.11353c2c.js} +5 -5
- package/dist/esm/{column-views.a665cbb2.js.map → column-views.11353c2c.js.map} +1 -1
- package/dist/esm/{column-views.f7cdf6be.js → column-views.18655508.js} +3 -3
- package/dist/esm/{column-views.f7cdf6be.js.map → column-views.18655508.js.map} +1 -1
- package/dist/esm/column-views.1cd55918.js +206 -0
- package/dist/esm/column-views.1cd55918.js.map +1 -0
- package/dist/esm/column-views.1ef55568.js +15 -0
- package/dist/esm/{column-views.04636815.js.map → column-views.1ef55568.js.map} +1 -1
- package/dist/esm/{column-views.e075af15.js → column-views.3090f246.js} +22 -4
- package/dist/esm/column-views.3090f246.js.map +1 -0
- package/dist/esm/{column-views.c92a359e.js → column-views.33796541.js} +2 -2
- package/dist/esm/{column-views.c92a359e.js.map → column-views.33796541.js.map} +1 -1
- package/dist/esm/{column-views.488f24b6.js → column-views.3ae8f23d.js} +2 -2
- package/dist/esm/{column-views.488f24b6.js.map → column-views.3ae8f23d.js.map} +1 -1
- package/dist/esm/{column-views.faa7e52e.js → column-views.40d3688c.js} +3 -3
- package/dist/esm/{column-views.faa7e52e.js.map → column-views.40d3688c.js.map} +1 -1
- package/dist/esm/{column-views.b9265595.js → column-views.4e9b8594.js} +11 -10
- package/dist/esm/column-views.4e9b8594.js.map +1 -0
- package/dist/esm/{column-views.8c296309.js → column-views.5e1c216f.js} +27 -6
- package/dist/esm/column-views.5e1c216f.js.map +1 -0
- package/dist/esm/{column-views.e3f0cd7b.js → column-views.5e830e7c.js} +23 -33
- package/dist/esm/column-views.5e830e7c.js.map +1 -0
- package/dist/esm/{column-views.c149f7a5.js → column-views.5ec7294d.js} +3 -3
- package/dist/esm/{column-views.c149f7a5.js.map → column-views.5ec7294d.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.3f1cdc18.js → column-views.6f0d4f3a.js} +2 -2
- package/dist/esm/{column-views.3f1cdc18.js.map → column-views.6f0d4f3a.js.map} +1 -1
- package/dist/esm/{column-views.58b891df.js → column-views.76fb9948.js} +2 -2
- package/dist/esm/{column-views.58b891df.js.map → column-views.76fb9948.js.map} +1 -1
- package/dist/esm/{column-views.3d3e00be.js → column-views.77322764.js} +2 -2
- package/dist/esm/{column-views.3d3e00be.js.map → column-views.77322764.js.map} +1 -1
- package/dist/esm/{column-views.82a5112b.js → column-views.85d57d04.js} +4 -4
- package/dist/esm/{column-views.82a5112b.js.map → column-views.85d57d04.js.map} +1 -1
- package/dist/esm/{column-views.4e6eead3.js → column-views.88436022.js} +2 -2
- package/dist/esm/{column-views.4e6eead3.js.map → column-views.88436022.js.map} +1 -1
- package/dist/esm/{column-views.2f979aee.js → column-views.88b2418b.js} +3 -3
- package/dist/esm/{column-views.2f979aee.js.map → column-views.88b2418b.js.map} +1 -1
- package/dist/esm/{column-views.d6c0b7bc.js → column-views.8ce33ec6.js} +2 -2
- package/dist/esm/{column-views.d6c0b7bc.js.map → column-views.8ce33ec6.js.map} +1 -1
- package/dist/esm/{column-views.6f96d1c3.js → column-views.91c18fe3.js} +31 -19
- package/dist/esm/column-views.91c18fe3.js.map +1 -0
- package/dist/esm/{column-views.18aac6a5.js → column-views.99cb1c41.js} +3 -3
- package/dist/esm/{column-views.18aac6a5.js.map → column-views.99cb1c41.js.map} +1 -1
- package/dist/esm/{column-views.0a010643.js → column-views.ab2cc6cb.js} +27 -14
- package/dist/esm/column-views.ab2cc6cb.js.map +1 -0
- package/dist/esm/{column-views.d5fff9b8.js → column-views.af4278f0.js} +3 -3
- package/dist/esm/{column-views.d5fff9b8.js.map → column-views.af4278f0.js.map} +1 -1
- package/dist/esm/{column-views.d1b49f5c.js → column-views.b957dc19.js} +3 -3
- package/dist/esm/{column-views.d1b49f5c.js.map → column-views.b957dc19.js.map} +1 -1
- package/dist/esm/{column-views.ad2fe46c.js → column-views.bc83a85d.js} +19 -3
- package/dist/esm/column-views.bc83a85d.js.map +1 -0
- package/dist/esm/column-views.c1e507e6.js +113 -0
- package/dist/esm/column-views.c1e507e6.js.map +1 -0
- package/dist/esm/{column-views.ce3a3ac8.js → column-views.c93b63db.js} +3 -3
- package/dist/esm/column-views.c93b63db.js.map +1 -0
- package/dist/esm/{column-views.26e0e0b6.js → column-views.ce5251f7.js} +2 -2
- package/dist/esm/{column-views.26e0e0b6.js.map → column-views.ce5251f7.js.map} +1 -1
- package/dist/esm/{column-views.8d972657.js → column-views.d4e50f74.js} +3 -3
- package/dist/esm/{column-views.8d972657.js.map → column-views.d4e50f74.js.map} +1 -1
- package/dist/esm/{column-views.75b83110.js → column-views.dd2d5a6d.js} +5 -5
- package/dist/esm/{column-views.75b83110.js.map → column-views.dd2d5a6d.js.map} +1 -1
- package/dist/esm/{column-views.73fc96cb.js → column-views.e6882667.js} +5 -5
- package/dist/esm/{column-views.73fc96cb.js.map → column-views.e6882667.js.map} +1 -1
- package/dist/esm/{column-views.ee9d71ba.js → column-views.e885211d.js} +2 -2
- package/dist/esm/{column-views.ee9d71ba.js.map → column-views.e885211d.js.map} +1 -1
- package/dist/esm/{column-views.029ea8f1.js → column-views.ee2fd38f.js} +3 -3
- package/dist/esm/{column-views.029ea8f1.js.map → column-views.ee2fd38f.js.map} +1 -1
- package/dist/esm/{column-views.9d51a5ab.js → column-views.f35c4621.js} +2 -2
- package/dist/esm/column-views.f35c4621.js.map +1 -0
- package/dist/esm/{column-views.5fff0716.js → column-views.f56e604d.js} +3 -3
- package/dist/esm/{column-views.5fff0716.js.map → column-views.f56e604d.js.map} +1 -1
- package/dist/esm/{column-views.9ffc089b.js → column-views.f904e6d7.js} +3 -3
- package/dist/esm/{column-views.9ffc089b.js.map → column-views.f904e6d7.js.map} +1 -1
- package/dist/esm/{column-views.24060b85.js → column-views.fc4860bd.js} +4 -4
- package/dist/esm/{column-views.24060b85.js.map → column-views.fc4860bd.js.map} +1 -1
- package/dist/esm/{column-views.0da4503a.js → column-views.fedccce9.js} +2 -2
- package/dist/esm/{column-views.0da4503a.js.map → column-views.fedccce9.js.map} +1 -1
- package/dist/esm/index.d.ts +91 -86
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +11 -11
- package/dist/node/{column-views.02869dc5.js → column-views.003e0c17.js} +2 -2
- package/dist/node/{column-views.02869dc5.js.map → column-views.003e0c17.js.map} +1 -1
- package/dist/node/column-views.080781ca.js +2 -0
- package/dist/node/column-views.080781ca.js.map +1 -0
- package/dist/node/{column-views.00ad98fa.js → column-views.0818254f.js} +2 -2
- package/dist/node/{column-views.00ad98fa.js.map → column-views.0818254f.js.map} +1 -1
- package/dist/node/{column-views.2577dec0.js → column-views.0d48f51d.js} +2 -2
- package/dist/node/{column-views.2577dec0.js.map → column-views.0d48f51d.js.map} +1 -1
- package/dist/node/column-views.18e86c2d.js +2 -0
- package/dist/node/column-views.18e86c2d.js.map +1 -0
- package/dist/node/{column-views.8eae7028.js → column-views.375529b1.js} +2 -2
- package/dist/node/{column-views.8eae7028.js.map → column-views.375529b1.js.map} +1 -1
- package/dist/node/{column-views.6b391d60.js → column-views.39b71a38.js} +2 -2
- package/dist/node/{column-views.6b391d60.js.map → column-views.39b71a38.js.map} +1 -1
- package/dist/node/{column-views.47440961.js → column-views.447008d0.js} +2 -2
- package/dist/node/{column-views.47440961.js.map → column-views.447008d0.js.map} +1 -1
- package/dist/node/{column-views.c4188442.js → column-views.4d573ded.js} +2 -2
- package/dist/node/{column-views.c4188442.js.map → column-views.4d573ded.js.map} +1 -1
- package/dist/node/{column-views.8f540f78.js → column-views.4d8fc443.js} +2 -2
- package/dist/node/{column-views.8f540f78.js.map → column-views.4d8fc443.js.map} +1 -1
- package/dist/node/{column-views.3a947d58.js → column-views.54f7a243.js} +2 -2
- package/dist/node/{column-views.3a947d58.js.map → column-views.54f7a243.js.map} +1 -1
- package/dist/node/column-views.58b336f1.js +2 -0
- package/dist/node/column-views.58b336f1.js.map +1 -0
- package/dist/node/{column-views.465e593b.js → column-views.5908556a.js} +2 -2
- package/dist/node/{column-views.465e593b.js.map → column-views.5908556a.js.map} +1 -1
- package/dist/node/column-views.5c02450b.js +2 -0
- package/dist/node/column-views.5c02450b.js.map +1 -0
- package/dist/node/column-views.5e73411d.js +2 -0
- package/dist/node/column-views.5e73411d.js.map +1 -0
- package/dist/node/{column-views.825d2719.js → column-views.5f3f8ccf.js} +2 -2
- package/dist/node/{column-views.825d2719.js.map → column-views.5f3f8ccf.js.map} +1 -1
- package/dist/node/{column-views.0a2596c2.js → column-views.6051e986.js} +2 -2
- package/dist/node/{column-views.0a2596c2.js.map → column-views.6051e986.js.map} +1 -1
- package/dist/node/{column-views.c921fa1a.js → column-views.64fc40d6.js} +2 -2
- package/dist/node/{column-views.c921fa1a.js.map → column-views.64fc40d6.js.map} +1 -1
- package/dist/node/{column-views.6556e004.js → column-views.66663668.js} +2 -2
- package/dist/node/{column-views.6556e004.js.map → column-views.66663668.js.map} +1 -1
- package/dist/node/{column-views.a14f0134.js → column-views.6f0cb059.js} +2 -2
- package/dist/node/{column-views.a14f0134.js.map → column-views.6f0cb059.js.map} +1 -1
- package/dist/node/{column-views.9efa91f1.js → column-views.72c3c6e7.js} +2 -2
- package/dist/node/{column-views.9efa91f1.js.map → column-views.72c3c6e7.js.map} +1 -1
- package/dist/node/column-views.74fcfb9c.js +2 -0
- package/dist/node/column-views.74fcfb9c.js.map +1 -0
- package/dist/node/{column-views.75456275.js → column-views.784bac2a.js} +2 -2
- package/dist/node/{column-views.75456275.js.map → column-views.784bac2a.js.map} +1 -1
- package/dist/node/{column-views.0f401891.js → column-views.796fc1de.js} +2 -2
- package/dist/node/{column-views.0f401891.js.map → column-views.796fc1de.js.map} +1 -1
- package/dist/node/column-views.7b6e7d82.js +2 -0
- package/dist/node/column-views.7b6e7d82.js.map +1 -0
- package/dist/node/{column-views.7c322202.js → column-views.7e895e1a.js} +2 -2
- package/dist/node/{column-views.7c322202.js.map → column-views.7e895e1a.js.map} +1 -1
- package/dist/node/column-views.87d31e0a.js +2 -0
- package/dist/node/column-views.87d31e0a.js.map +1 -0
- package/dist/node/{column-views.59ce629d.js → column-views.94c8ce3e.js} +2 -2
- package/dist/node/{column-views.59ce629d.js.map → column-views.94c8ce3e.js.map} +1 -1
- package/dist/node/{column-views.48a3cfa3.js → column-views.951e3e9a.js} +2 -2
- package/dist/node/{column-views.48a3cfa3.js.map → column-views.951e3e9a.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.67e7a200.js → column-views.b6613ab0.js} +2 -2
- package/dist/node/{column-views.67e7a200.js.map → column-views.b6613ab0.js.map} +1 -1
- package/dist/node/{column-views.d529d3aa.js → column-views.b762c9a8.js} +2 -2
- package/dist/node/{column-views.d529d3aa.js.map → column-views.b762c9a8.js.map} +1 -1
- package/dist/node/{column-views.e153680b.js → column-views.bdf05ed4.js} +2 -2
- package/dist/node/{column-views.e153680b.js.map → column-views.bdf05ed4.js.map} +1 -1
- package/dist/node/{column-views.fafbc028.js → column-views.d30231cb.js} +2 -2
- package/dist/node/{column-views.fafbc028.js.map → column-views.d30231cb.js.map} +1 -1
- package/dist/node/column-views.d86e6c7d.js +2 -0
- package/dist/node/column-views.d86e6c7d.js.map +1 -0
- package/dist/node/column-views.db3377d8.js +2 -0
- package/dist/node/column-views.db3377d8.js.map +1 -0
- package/dist/node/{column-views.2fe8feb9.js → column-views.f4063bc8.js} +2 -2
- package/dist/node/{column-views.2fe8feb9.js.map → column-views.f4063bc8.js.map} +1 -1
- package/dist/node/{column-views.3d0c2bea.js → column-views.f93b4175.js} +2 -2
- package/dist/node/{column-views.3d0c2bea.js.map → column-views.f93b4175.js.map} +1 -1
- package/dist/node/{column-views.cd54f1b1.js → column-views.fa5ee6de.js} +2 -2
- package/dist/node/{column-views.cd54f1b1.js.map → column-views.fa5ee6de.js.map} +1 -1
- package/dist/node/{column-views.08bef1f6.js → column-views.fe7a5452.js} +2 -2
- package/dist/node/{column-views.08bef1f6.js.map → column-views.fe7a5452.js.map} +1 -1
- package/dist/node/column-views.ffbffec7.js +2 -0
- package/dist/node/column-views.ffbffec7.js.map +1 -0
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/package.json +4 -2
- package/src/age-model-overlay.ts +4 -2
- package/src/column.ts +18 -41
- package/src/correlation-chart/main.ts +24 -13
- package/src/correlation-chart/stories/correlation-chart.stories.ts +38 -17
- package/src/data-provider/base.ts +22 -0
- package/src/data-provider/core.ts +89 -0
- package/src/data-provider/fetch.ts +35 -10
- package/src/data-provider/store.ts +79 -88
- package/src/data-provider/unit-selection.ts +265 -159
- package/src/maps/column-correlation/core.ts +1 -1
- package/src/maps/column-correlation/state.ts +16 -1
- package/src/unit-details/panel.ts +44 -26
- package/src/unit-details/popover.ts +21 -9
- package/dist/esm/column-views.04636815.js +0 -15
- package/dist/esm/column-views.0a010643.js.map +0 -1
- 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.8c296309.js.map +0 -1
- package/dist/esm/column-views.9d51a5ab.js.map +0 -1
- package/dist/esm/column-views.ad2fe46c.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.ce3a3ac8.js.map +0 -1
- package/dist/esm/column-views.e075af15.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.7425d37b.js +0 -2
- package/dist/node/column-views.7425d37b.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.8e846c57.js +0 -2
- package/dist/node/column-views.8e846c57.js.map +0 -1
- package/dist/node/column-views.c007152b.js +0 -2
- package/dist/node/column-views.c007152b.js.map +0 -1
- package/dist/node/column-views.d818b387.js +0 -2
- package/dist/node/column-views.d818b387.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 +0 -2
- 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/dist/node/column-views.fee4e65d.js +0 -2
- package/dist/node/column-views.fee4e65d.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {BaseMeasurementsColumn as $50d219504625a431$export$ce5c4f2fdf4e644d, groupNotesByPixelDistance as $50d219504625a431$export$4e649f790614b299, standardizeMeasurementHeight as $50d219504625a431$export$9d101e1fcb2166a6, TruncatedList as $50d219504625a431$export$653e47a7a0da0f0d} from "./column-views.
|
|
2
|
-
import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.
|
|
1
|
+
import {BaseMeasurementsColumn as $50d219504625a431$export$ce5c4f2fdf4e644d, groupNotesByPixelDistance as $50d219504625a431$export$4e649f790614b299, standardizeMeasurementHeight as $50d219504625a431$export$9d101e1fcb2166a6, TruncatedList as $50d219504625a431$export$653e47a7a0da0f0d} from "./column-views.ce5251f7.js";
|
|
2
|
+
import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.c1e507e6.js";
|
|
3
3
|
import $8DpYT$macrostrathyper from "@macrostrat/hyper";
|
|
4
4
|
import {useAPIResult as $8DpYT$useAPIResult} from "@macrostrat/ui-components";
|
|
5
5
|
|
|
@@ -58,4 +58,4 @@ function $c8e156b0b9c785ec$var$prepareSGPData(data, scale, units, axisType) {
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
export {$c8e156b0b9c785ec$export$c49cf57576706bab as SGPMeasurementsColumn};
|
|
61
|
-
//# sourceMappingURL=column-views.
|
|
61
|
+
//# sourceMappingURL=column-views.af4278f0.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAgBA,SAAS,iCAAW,UAAE,MAAM,EAAE;IAC5B,OAAO,CAAA,GAAA,mBAAW,EAChB,sDACA;QACE,QAAQ,CAAC,GAAG,EAAE,QAAQ;IACxB,GACA,CAAC,IAAM;AAEX;AAQO,SAAS,0CAAsB,YAAE,QAAQ,EAAE;IAChD,MAAM,OAA+B,iCAAW;QAAE,QAAQ;IAAS;IACnE,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,qCAAe,MAAM,OAAO,OAAO;IAEjD,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAqB,GAAG;QAC/B,MAAM;QACN,eAAe;QACf,sBAAsB;IACxB;AACF;AAEA,SAAS,qCAAe,KAAsC;IAC5D,MAAM,QAAE,IAAI,WAAE,OAAO,EAAE,GAAG;IAC1B,MAAM,cAAc,MAAM;IAE1B,IAAI,eAAe,QAAQ,YAAY,MAAM,KAAK,GAAG,OAAO;IAE5D,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAY,GAAG;QACtB,WAAW;QACX,MAAM;QACN,cAAc,CAAC,IAAM,CAAA,GAAA,sBAAA,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI;QAC1C,UAAU,UAAU,WAAW;IACjC;AACF;AAEA,SAAS,qCACP,IAAqB,EACrB,KAA2B,EAC3B,KAAiB,EACjB,QAAwB;IAExB,kCAAkC;IAClC,MAAM,KAAK,KACR,GAAG,CAAC,CAAC;QACJ,MAAM,OAAO,OAAO,WAAW;QAC/B,IAAI,QAAQ,QAAQ,KAAK,MAAM,KAAK,GAAG,OAAO;QAC9C,MAAM,aAAa,CAAA,GAAA,yCAA2B,EAC5C;YAAE,SAAS,OAAO,OAAO;QAAC,GAC1B,OACA;QAEF,IAAI,cAAc,MAAM,OAAO;QAC/B,KAAK,IAAI,CAAC,CAAC,GAAG,IAAM,EAAE,EAAE,GAAG,EAAE,EAAE;QAC/B,OAAO;YACL,GAAG,UAAU;kBACb;YACA,IAAI,OAAO,OAAO;QACpB;IACF,GACC,MAAM,CAAC;IAEV,OAAO,CAAA,GAAA,yCAAwB,EAAE,IAAI,OAAO,UAAU;AACxD","sources":["packages/column-views/src/facets/measurements/sgp.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport { useAPIResult } from \"@macrostrat/ui-components\";\nimport {\n BaseMeasurementsColumn,\n groupNotesByPixelDistance,\n standardizeMeasurementHeight,\n TruncatedList,\n} from \"./base\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport {\n useCompositeScale,\n useMacrostratColumnData,\n} from \"../../data-provider\";\nimport type { CompositeColumnScale } from \"../../prepare-units\";\n\nfunction useSGPData({ col_id }) {\n return useAPIResult(\n \"https://dev.macrostrat.org/api/pg/sgp_unit_matches\",\n {\n col_id: `eq.${col_id}`,\n },\n (d) => d,\n );\n}\n\ninterface SGPSampleData {\n col_id: number;\n unit_id: number;\n sgp_samples: { name: string; id: number }[];\n}\n\nexport function SGPMeasurementsColumn({ columnID }) {\n const data: SGPSampleData[] | null = useSGPData({ col_id: columnID });\n const { axisType, units } = useMacrostratColumnData();\n const scale = useCompositeScale();\n\n if (data == null || units == null || scale == null) return null;\n\n const data1 = prepareSGPData(data, scale, units, axisType);\n\n return h(BaseMeasurementsColumn, {\n data: data1,\n noteComponent: SGPSamplesNote,\n focusedNoteComponent: SGPSamplesNote,\n });\n}\n\nfunction SGPSamplesNote(props: { note: any; focused: boolean }) {\n const { note, focused } = props;\n const sgp_samples = note?.data;\n\n if (sgp_samples == null || sgp_samples.length === 0) return null;\n\n return h(TruncatedList, {\n className: \"sgp-samples\",\n data: sgp_samples,\n itemRenderer: (p) => h(\"span\", p.data.name),\n maxItems: focused ? Infinity : 5,\n });\n}\n\nfunction prepareSGPData(\n data: SGPSampleData[],\n scale: CompositeColumnScale,\n units: UnitLong[],\n axisType: ColumnAxisType,\n) {\n // Find matching units for samples\n const d1 = data\n .map((sample) => {\n const data = sample.sgp_samples;\n if (data == null || data.length === 0) return null;\n const heightData = standardizeMeasurementHeight(\n { unit_id: sample.unit_id },\n units,\n axisType,\n );\n if (heightData == null) return null;\n data.sort((a, b) => a.id - b.id);\n return {\n ...heightData,\n data,\n id: sample.unit_id,\n };\n })\n .filter(Boolean);\n\n return groupNotesByPixelDistance(d1, scale, axisType, 5);\n}\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":";;;;;;;;;AAgBA,SAAS,iCAAW,UAAE,MAAM,EAAE;IAC5B,OAAO,CAAA,GAAA,mBAAW,EAChB,sDACA;QACE,QAAQ,CAAC,GAAG,EAAE,QAAQ;IACxB,GACA,CAAC,IAAM;AAEX;AAQO,SAAS,0CAAsB,YAAE,QAAQ,EAAE;IAChD,MAAM,OAA+B,iCAAW;QAAE,QAAQ;IAAS;IACnE,MAAM,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ages/column-views/src/facets/measurements/sgp.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport { useAPIResult } from \"@macrostrat/ui-components\";\nimport {\n BaseMeasurementsColumn,\n groupNotesByPixelDistance,\n standardizeMeasurementHeight,\n TruncatedList,\n} from \"./base\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport {\n useCompositeScale,\n useMacrostratColumnData,\n} from \"../../data-provider\";\nimport type { CompositeColumnScale } from \"../../prepare-units\";\n\nfunction useSGPData({ col_id }) {\n return useAPIResult(\n \"https://dev.macrostrat.org/api/pg/sgp_unit_matches\",\n {\n col_id: `eq.${col_id}`,\n },\n (d) => d,\n );\n}\n\ninterface SGPSampleData {\n col_id: number;\n unit_id: number;\n sgp_samples: { name: string; id: number }[];\n}\n\nexport function SGPMeasurementsColumn({ columnID }) {\n const data: SGPSampleData[] | null = useSGPData({ col_id: columnID });\n const { axisType, units } = useMacrostratColumnData();\n const scale = useCompositeScale();\n\n if (data == null || units == null || scale == null) return null;\n\n const data1 = prepareSGPData(data, scale, units, axisType);\n\n return h(BaseMeasurementsColumn, {\n data: data1,\n noteComponent: SGPSamplesNote,\n focusedNoteComponent: SGPSamplesNote,\n });\n}\n\nfunction SGPSamplesNote(props: { note: any; focused: boolean }) {\n const { note, focused } = props;\n const sgp_samples = note?.data;\n\n if (sgp_samples == null || sgp_samples.length === 0) return null;\n\n return h(TruncatedList, {\n className: \"sgp-samples\",\n data: sgp_samples,\n itemRenderer: (p) => h(\"span\", p.data.name),\n maxItems: focused ? Infinity : 5,\n });\n}\n\nfunction prepareSGPData(\n data: SGPSampleData[],\n scale: CompositeColumnScale,\n units: UnitLong[],\n axisType: ColumnAxisType,\n) {\n // Find matching units for samples\n const d1 = data\n .map((sample) => {\n const data = sample.sgp_samples;\n if (data == null || data.length === 0) return null;\n const heightData = standardizeMeasurementHeight(\n { unit_id: sample.unit_id },\n units,\n axisType,\n );\n if (heightData == null) return null;\n data.sort((a, b) => a.id - b.id);\n return {\n ...heightData,\n data,\n id: sample.unit_id,\n };\n })\n .filter(Boolean);\n\n return groupNotesByPixelDistance(d1, scale, axisType, 5);\n}\n"],"names":[],"version":3,"file":"column-views.af4278f0.js.map"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {ColumnNavigationMap as $9d5d216fa2057b5b$export$821baedf611249f3} from "./column-views.
|
|
2
|
-
import {ResizableMapFrame as $e6046e00d2c8a163$export$c4313db718750a5a, ColumnNavigationSVGMap as $e6046e00d2c8a163$export$9595c40c7a4c4f7b, MeasurementsLayer as $93f116a6493b17c3$export$2254347cd20e6080, ColumnFeatures as $93f116a6493b17c3$export$f177ff57c101017a, ColumnKeyboardNavigation as $93f116a6493b17c3$export$8c41dd563753848, Columns as $93f116a6493b17c3$export$f02cc02ad0e0bba3, ColumnCenters as $93f116a6493b17c3$export$4d8f6e6df85d9012, CurrentColumn as $93f116a6493b17c3$export$b9d912252344e099} from "./column-views.
|
|
1
|
+
import {ColumnNavigationMap as $9d5d216fa2057b5b$export$821baedf611249f3} from "./column-views.f56e604d.js";
|
|
2
|
+
import {ResizableMapFrame as $e6046e00d2c8a163$export$c4313db718750a5a, ColumnNavigationSVGMap as $e6046e00d2c8a163$export$9595c40c7a4c4f7b, MeasurementsLayer as $93f116a6493b17c3$export$2254347cd20e6080, ColumnFeatures as $93f116a6493b17c3$export$f177ff57c101017a, ColumnKeyboardNavigation as $93f116a6493b17c3$export$8c41dd563753848, Columns as $93f116a6493b17c3$export$f02cc02ad0e0bba3, ColumnCenters as $93f116a6493b17c3$export$4d8f6e6df85d9012, CurrentColumn as $93f116a6493b17c3$export$b9d912252344e099} from "./column-views.33796541.js";
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
export {$9d5d216fa2057b5b$export$821baedf611249f3 as ColumnNavigationMap, $e6046e00d2c8a163$export$c4313db718750a5a as ResizableMapFrame, $e6046e00d2c8a163$export$9595c40c7a4c4f7b as ColumnNavigationSVGMap, $93f116a6493b17c3$export$2254347cd20e6080 as MeasurementsLayer, $93f116a6493b17c3$export$f177ff57c101017a as ColumnFeatures, $93f116a6493b17c3$export$8c41dd563753848 as ColumnKeyboardNavigation, $93f116a6493b17c3$export$f02cc02ad0e0bba3 as Columns, $93f116a6493b17c3$export$4d8f6e6df85d9012 as ColumnCenters, $93f116a6493b17c3$export$b9d912252344e099 as CurrentColumn};
|
|
9
|
-
//# sourceMappingURL=column-views.
|
|
9
|
+
//# sourceMappingURL=column-views.b957dc19.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"","sources":["packages/column-views/src/maps/column-navigation/index.ts"],"sourcesContent":["export * from \"./mapbox\";\nexport * from \"./svg\";\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":"","sources":["packages/column-views/src/maps/column-navigation/index.ts"],"sourcesContent":["export * from \"./mapbox\";\nexport * from \"./svg\";\n"],"names":[],"version":3,"file":"column-views.b957dc19.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.3090f246.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";
|
|
@@ -7,6 +7,10 @@ import {centroid as $i7Wch$centroid} from "@turf/centroid";
|
|
|
7
7
|
import {createContext as $i7Wch$createContext, useState as $i7Wch$useState, useEffect as $i7Wch$useEffect, useContext as $i7Wch$useContext} from "react";
|
|
8
8
|
import $i7Wch$macrostrathyper from "@macrostrat/hyper";
|
|
9
9
|
import {createComputed as $i7Wch$createComputed} from "zustand-computed";
|
|
10
|
+
import {buffer as $i7Wch$buffer} from "@turf/buffer";
|
|
11
|
+
import {booleanPointInPolygon as $i7Wch$booleanPointInPolygon} from "@turf/boolean-point-in-polygon";
|
|
12
|
+
|
|
13
|
+
|
|
10
14
|
|
|
11
15
|
|
|
12
16
|
|
|
@@ -29,6 +33,7 @@ function $74e211dc185c20b4$export$72ffe141ebf87ef1({ children: children, columns
|
|
|
29
33
|
return (0, $i7Wch$create)($74e211dc185c20b4$var$computed((set, get)=>{
|
|
30
34
|
return {
|
|
31
35
|
focusedLine: focusedLine,
|
|
36
|
+
projectID: projectID,
|
|
32
37
|
columns: null,
|
|
33
38
|
onClickMap (event, point) {
|
|
34
39
|
const state = get();
|
|
@@ -83,7 +88,14 @@ function $74e211dc185c20b4$var$buildCorrelationColumns(columns, line) {
|
|
|
83
88
|
}
|
|
84
89
|
function $74e211dc185c20b4$var$computeIntersectingColumns(columns, line) {
|
|
85
90
|
if (columns == null || line == null) return [];
|
|
86
|
-
|
|
91
|
+
/** eODP-focused process. Find buffers around line and then find columns intersecting that buffer */ const bufferedLine = (0, $i7Wch$buffer)(line, 1, {
|
|
92
|
+
units: "degrees"
|
|
93
|
+
});
|
|
94
|
+
const nearbyPoints = columns.filter((col)=>{
|
|
95
|
+
if (col.geometry?.type != "Point") return false;
|
|
96
|
+
return (0, $i7Wch$booleanPointInPolygon)(col.geometry, bufferedLine);
|
|
97
|
+
});
|
|
98
|
+
const intersectingPolygons = columns.filter((col)=>{
|
|
87
99
|
const poly = col.geometry;
|
|
88
100
|
// Some in-process datasets seem to have null geometries
|
|
89
101
|
if (poly == null) return false;
|
|
@@ -91,6 +103,10 @@ function $74e211dc185c20b4$var$computeIntersectingColumns(columns, line) {
|
|
|
91
103
|
const intersection = (0, $i7Wch$lineIntersect)(line, poly);
|
|
92
104
|
return intersection.features.length > 0;
|
|
93
105
|
});
|
|
106
|
+
return [
|
|
107
|
+
...intersectingPolygons,
|
|
108
|
+
...nearbyPoints
|
|
109
|
+
];
|
|
94
110
|
}
|
|
95
111
|
function $74e211dc185c20b4$var$orderColumnsByDistance(columns, line) {
|
|
96
112
|
const centroids = columns.map((col)=>(0, $i7Wch$centroid)(col.geometry));
|
|
@@ -115,4 +131,4 @@ function $74e211dc185c20b4$var$sorted(data, accessor) {
|
|
|
115
131
|
|
|
116
132
|
|
|
117
133
|
export {$74e211dc185c20b4$export$72ffe141ebf87ef1 as ColumnCorrelationProvider, $74e211dc185c20b4$export$21398703d3a9bb4d as useCorrelationMapStore};
|
|
118
|
-
//# sourceMappingURL=column-views.
|
|
134
|
+
//# sourceMappingURL=column-views.bc83a85d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyCA,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;2BACA;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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EA,MAAM,uBAAuB,QAAQ,MAAM,CAAC,CAAC;QAC3C,MAAM,OAAO,IAAI,QAAQ;QAEzB,wDAAwD;QACxD,IAAI,QAAQ,MAAM,OAAO;QACzB,IAAI,KAAK,IAAI,IAAI,aAAa,KAAK,IAAI,IAAI,gBAAgB,OAAO;QAElE,MAAM,eAAe,CAAA,GAAA,oBAAY,EAAE,MAAM;QACzC,OAAO,aAAa,QAAQ,CAAC,MAAM,GAAG;IACxC;IAEA,OAAO;WAAI;WAAyB;KAAa;AACnD;AAUA,SAAS,6CACP,OAA8B,EAC9B,IAAgB;IAEhB,MAAM,YAAY,QAAQ,GAAG,CAAC,CAAC,MAAQ,CAAA,GAAA,eAAO,EAAE,IAAI,QAAQ;IAC5D,MAAM,kBAAkB,UAAU,GAAG,CAAC,CAAC,QACrC,CAAA,GAAA,yBAAiB,EAAE,MAAM;IAE3B,MAAM,YAAY,gBAAgB,GAAG,CAAC,CAAC,QACrC,CAAA,GAAA,mBAAO,EAAE,MAAM,QAAQ,CAAC,WAAW,EAAE,KAAK,WAAW,CAAC,EAAE;IAG1D,IAAI,aAAa,QAAQ,GAAG,CAAC,CAAC,KAAK;QACjC,OAAO;YACL,GAAG,GAAG;YACN,YAAY;gBACV,GAAG,IAAI,UAAU;gBACjB,UAAU,SAAS,CAAC,EAAE;gBACtB,oBAAoB,eAAe,CAAC,EAAE;gBACtC,mBAAmB,SAAS,CAAC,EAAE;YACjC;QACF;IACF;IAEA,OAAO,6BAAO,YAAY,CAAC,IAAM,EAAE,UAAU,CAAC,iBAAiB;AACjE;AAEA,SAAS,6BAAO,IAAI,EAAE,QAAuB;IAC3C,OAAO,KAAK,IAAI,CAAC,CAAC,GAAG,IAAM,SAAS,KAAK,SAAS;AACpD","sources":["packages/column-views/src/maps/column-correlation/state.ts"],"sourcesContent":["import { LineString, Point } from \"geojson\";\nimport { create, StoreApi, useStore } from \"zustand\";\nimport type { ColumnGeoJSONRecord } from \"@macrostrat/api-types\";\n// Turf intersection\nimport { lineIntersect } from \"@turf/line-intersect\";\nimport distance from \"@turf/distance\";\nimport { nearestPointOnLine } from \"@turf/nearest-point-on-line\";\nimport { centroid } from \"@turf/centroid\";\nimport {\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\";\nimport { buffer } from \"@turf/buffer\";\nimport { booleanPointInPolygon } from \"@turf/boolean-point-in-polygon\";\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 projectID,\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 /** eODP-focused process. Find buffers around line and then find columns intersecting that buffer */\n const bufferedLine = buffer(line, 1, { units: \"degrees\" });\n\n const nearbyPoints = columns.filter((col) => {\n if (col.geometry?.type != \"Point\") {\n return false;\n }\n return booleanPointInPolygon(col.geometry, bufferedLine);\n });\n\n const intersectingPolygons = 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 return [...intersectingPolygons, ...nearbyPoints];\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.bc83a85d.js.map"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import {createCompositeScale as $728f6cf6c12cd490$export$3ada7641926a616d} from "./column-views.1b5bf0c6.js";
|
|
2
|
+
import {allowUnitSelectionAtom as $61771df184788970$export$3c12ff51b216428d, selectedUnitIDAtom as $61771df184788970$export$6d9520abc11d1c2b, UnitSelectionCallbackManager as $61771df184788970$export$1a7a0d00e4ba9c81} from "./column-views.1cd55918.js";
|
|
3
|
+
import {columnUnitsAtom as $c4083056aa697244$export$533095c4f32f2edc, columnUnitsMapAtom as $c4083056aa697244$export$c798b7ff7cb2357b, scope as $c4083056aa697244$export$5cff813ca8e50db9, ScopedProvider as $c4083056aa697244$export$deff48bd299912d9} from "./column-views.67804ce5.js";
|
|
4
|
+
import {useMemo as $a90Ta$useMemo, createContext as $a90Ta$createContext, useContext as $a90Ta$useContext} from "react";
|
|
5
|
+
import $a90Ta$macrostrathyper from "@macrostrat/hyper";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
function $d5074f164411387e$export$ef5395089200109b({ children: children, units: units, allowUnitSelection: allowUnitSelection = false, onUnitSelected: onUnitSelected, selectedUnit: selectedUnit }) {
|
|
13
|
+
/** Top-level provider for Macrostrat column data.
|
|
14
|
+
* It is either provided by the Column component itself, or
|
|
15
|
+
* can be hoisted higher in the tree to provide a common data context
|
|
16
|
+
*/ /* By default, unit selection is disabled. However, if any related props are passed,
|
|
17
|
+
we enable it.
|
|
18
|
+
*/ const _allowSelection = (0, $a90Ta$useMemo)(()=>{
|
|
19
|
+
if (allowUnitSelection) return true;
|
|
20
|
+
return selectedUnit != null || onUnitSelected != null;
|
|
21
|
+
}, []);
|
|
22
|
+
const atomMap = [
|
|
23
|
+
[
|
|
24
|
+
(0, $c4083056aa697244$export$533095c4f32f2edc),
|
|
25
|
+
units
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
(0, $61771df184788970$export$3c12ff51b216428d),
|
|
29
|
+
_allowSelection
|
|
30
|
+
],
|
|
31
|
+
[
|
|
32
|
+
(0, $61771df184788970$export$6d9520abc11d1c2b),
|
|
33
|
+
selectedUnit
|
|
34
|
+
]
|
|
35
|
+
];
|
|
36
|
+
let selectionHandlers = null;
|
|
37
|
+
if (_allowSelection) selectionHandlers = (0, $a90Ta$macrostrathyper)((0, $61771df184788970$export$1a7a0d00e4ba9c81), {
|
|
38
|
+
onUnitSelected: onUnitSelected
|
|
39
|
+
});
|
|
40
|
+
return (0, $a90Ta$macrostrathyper)((0, $c4083056aa697244$export$deff48bd299912d9), {
|
|
41
|
+
atoms: atomMap
|
|
42
|
+
}, [
|
|
43
|
+
selectionHandlers,
|
|
44
|
+
children
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
const $d5074f164411387e$var$MacrostratColumnDataContext = (0, $a90Ta$createContext)(null);
|
|
48
|
+
function $d5074f164411387e$export$7fec7bd80ff9c10e({ children: children, units: units, sections: sections, totalHeight: totalHeight, axisType: axisType, allowUnitSelection: allowUnitSelection, onUnitSelected: onUnitSelected, selectedUnit: selectedUnit }) {
|
|
49
|
+
/** Internal provider for Macrostrat column data.
|
|
50
|
+
* As a general rule, we want to provide data and column-axis
|
|
51
|
+
* height calculations through the context, since these need to
|
|
52
|
+
* be accessed by any component that lays out information on the
|
|
53
|
+
* column.
|
|
54
|
+
*
|
|
55
|
+
* Cross-axis layout and view configuration (e.g., showing and hiding
|
|
56
|
+
* of different components or labels) should be handled through passing
|
|
57
|
+
* props to the components themselves.
|
|
58
|
+
* */ const value = (0, $a90Ta$useMemo)(()=>{
|
|
59
|
+
// For now, change ordinal axis types to age axis types
|
|
60
|
+
return {
|
|
61
|
+
units: units,
|
|
62
|
+
sections: sections,
|
|
63
|
+
totalHeight: totalHeight,
|
|
64
|
+
axisType: axisType
|
|
65
|
+
};
|
|
66
|
+
}, [
|
|
67
|
+
units,
|
|
68
|
+
sections,
|
|
69
|
+
totalHeight,
|
|
70
|
+
axisType
|
|
71
|
+
]);
|
|
72
|
+
return (0, $a90Ta$macrostrathyper)($d5074f164411387e$export$ef5395089200109b, {
|
|
73
|
+
units: units,
|
|
74
|
+
allowUnitSelection: allowUnitSelection,
|
|
75
|
+
onUnitSelected: onUnitSelected,
|
|
76
|
+
selectedUnit: selectedUnit
|
|
77
|
+
}, (0, $a90Ta$macrostrathyper)($d5074f164411387e$var$MacrostratColumnDataContext.Provider, {
|
|
78
|
+
value: value
|
|
79
|
+
}, children));
|
|
80
|
+
}
|
|
81
|
+
function $d5074f164411387e$export$f19d75b1d4b676a4(props) {
|
|
82
|
+
/* A basic unit selection provider without column data context.
|
|
83
|
+
Mostly for use with the CorrelationChart component.
|
|
84
|
+
*/ return (0, $a90Ta$macrostrathyper)($d5074f164411387e$export$ef5395089200109b, {
|
|
85
|
+
...props,
|
|
86
|
+
allowUnitSelection: true
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function $d5074f164411387e$export$f8509b7cce386c7d() {
|
|
90
|
+
const ctx = (0, $a90Ta$useContext)($d5074f164411387e$var$MacrostratColumnDataContext);
|
|
91
|
+
if (!ctx) throw new Error("useMacrostratColumnData must be used within a MacrostratColumnDataProvider");
|
|
92
|
+
return ctx;
|
|
93
|
+
}
|
|
94
|
+
function $d5074f164411387e$export$6fb40844db555b2() {
|
|
95
|
+
return (0, $c4083056aa697244$export$5cff813ca8e50db9).useAtomValue((0, $c4083056aa697244$export$533095c4f32f2edc));
|
|
96
|
+
}
|
|
97
|
+
function $d5074f164411387e$export$7513be0cfd10d9cc() {
|
|
98
|
+
try {
|
|
99
|
+
return (0, $c4083056aa697244$export$5cff813ca8e50db9).useAtomValue((0, $c4083056aa697244$export$c798b7ff7cb2357b));
|
|
100
|
+
} catch {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function $d5074f164411387e$export$a7fc62995ec4f76() {
|
|
105
|
+
const ctx = $d5074f164411387e$export$f8509b7cce386c7d();
|
|
106
|
+
return (0, $a90Ta$useMemo)(()=>(0, $728f6cf6c12cd490$export$3ada7641926a616d)(ctx.sections, true), [
|
|
107
|
+
ctx.sections
|
|
108
|
+
]);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
export {$d5074f164411387e$export$ef5395089200109b as MacrostratColumnStateProvider, $d5074f164411387e$export$7fec7bd80ff9c10e as MacrostratColumnDataProvider, $d5074f164411387e$export$f19d75b1d4b676a4 as UnitSelectionProvider, $d5074f164411387e$export$f8509b7cce386c7d as useMacrostratColumnData, $d5074f164411387e$export$6fb40844db555b2 as useMacrostratUnits, $d5074f164411387e$export$7513be0cfd10d9cc as useColumnUnitsMap, $d5074f164411387e$export$a7fc62995ec4f76 as useCompositeScale};
|
|
113
|
+
//# sourceMappingURL=column-views.c1e507e6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;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AACF;AAEO,SAAS;IACd,MAAM,MAAM,CAAA,GAAA,iBAAS,EAAE;IACvB,IAAI,CAAC,KACH,MAAM,IAAI,MACR;IAGJ,OAAO;AACT;AAEO,SAAS;IACd,OAAO,CAAA,GAAA,yCAAI,EAAE,YAAY,CAAC,CAAA,GAAA,yCAAc;AAC1C;AAEO,SAAS;IACd,IAAI;QACF,OAAO,CAAA,GAAA,yCAAI,EAAE,YAAY,CAAC,CAAA,GAAA,yCAAiB;IAC7C,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEO,SAAS;IACd,MAAM,MAAM;IACZ,OAAO,CAAA,GAAA,cAAM,EACX,IAAM,CAAA,GAAA,yCAAmB,EAAE,IAAI,QAAQ,EAAE,OACzC;QAAC,IAAI,QAAQ;KAAC;AAElB","sources":["packages/column-views/src/data-provider/store.ts"],"sourcesContent":["import { createContext, ReactNode, useContext, useMemo } from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport {\n CompositeColumnScale,\n createCompositeScale,\n} from \"../prepare-units/composite-scale\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport type { ExtUnit, PackageLayoutData } from \"../prepare-units\";\nimport {\n allowUnitSelectionAtom,\n selectedUnitIDAtom,\n UnitSelectionCallbacks,\n UnitSelectionCallbackManager,\n} from \"./unit-selection\";\nimport { BaseUnit } from \"@macrostrat/api-types\";\nimport {\n AtomMap,\n columnUnitsAtom,\n columnUnitsMapAtom,\n scope,\n ScopedProvider,\n} from \"./core\";\n\nexport interface ColumnStateProviderProps<\n T extends BaseUnit,\n> extends Partial<UnitSelectionCallbacks> {\n children: ReactNode;\n units: T[];\n selectedUnit: number | null;\n allowUnitSelection?: boolean;\n}\n\nexport function MacrostratColumnStateProvider<T extends BaseUnit>({\n children,\n units,\n allowUnitSelection = false,\n onUnitSelected,\n selectedUnit,\n}: ColumnStateProviderProps<T>) {\n /** Top-level provider for Macrostrat column data.\n * It is either provided by the Column component itself, or\n * can be hoisted higher in the tree to provide a common data context\n */\n\n /* By default, unit selection is disabled. However, if any related props are passed,\n we enable it.\n */\n const _allowSelection = useMemo(() => {\n if (allowUnitSelection) {\n return true;\n }\n return selectedUnit != null || onUnitSelected != null;\n }, []);\n\n const atomMap: AtomMap = [\n [columnUnitsAtom, units],\n [allowUnitSelectionAtom, _allowSelection],\n [selectedUnitIDAtom, selectedUnit],\n ];\n\n let selectionHandlers: ReactNode = null;\n if (_allowSelection) {\n selectionHandlers = h(UnitSelectionCallbackManager, { onUnitSelected });\n }\n\n return h(\n ScopedProvider,\n {\n atoms: atomMap,\n },\n [selectionHandlers, children],\n );\n}\n\nexport interface MacrostratColumnDataContext<T extends BaseUnit> {\n units: T[];\n sections: PackageLayoutData[];\n totalHeight?: number;\n axisType?: ColumnAxisType;\n allowUnitSelection?: boolean;\n}\n\nexport interface ColumnDataProviderProps<T extends BaseUnit>\n extends MacrostratColumnDataContext<T>, ColumnStateProviderProps<T> {\n children: ReactNode;\n}\n\nconst MacrostratColumnDataContext =\n createContext<MacrostratColumnDataContext<any>>(null);\n\nexport function MacrostratColumnDataProvider<T extends BaseUnit>({\n children,\n units,\n sections,\n totalHeight,\n axisType,\n allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n}: ColumnDataProviderProps<T>) {\n /** Internal provider for Macrostrat column data.\n * As a general rule, we want to provide data and column-axis\n * height calculations through the context, since these need to\n * be accessed by any component that lays out information on the\n * column.\n *\n * Cross-axis layout and view configuration (e.g., showing and hiding\n * of different components or labels) should be handled through passing\n * props to the components themselves.\n * */\n\n const value = useMemo(() => {\n // For now, change ordinal axis types to age axis types\n return {\n units,\n sections,\n totalHeight,\n axisType,\n };\n }, [units, sections, totalHeight, axisType]);\n\n return h(\n MacrostratColumnStateProvider,\n {\n units,\n allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n },\n h(MacrostratColumnDataContext.Provider, { value }, children),\n );\n}\n\nexport function UnitSelectionProvider(props: ColumnStateProviderProps<any>) {\n /* A basic unit selection provider without column data context.\n Mostly for use with the CorrelationChart component.\n */\n return h(MacrostratColumnStateProvider, {\n ...props,\n allowUnitSelection: true,\n });\n}\n\nexport function useMacrostratColumnData() {\n const ctx = useContext(MacrostratColumnDataContext);\n if (!ctx) {\n throw new Error(\n \"useMacrostratColumnData must be used within a MacrostratColumnDataProvider\",\n );\n }\n return ctx;\n}\n\nexport function useMacrostratUnits() {\n return scope.useAtomValue(columnUnitsAtom);\n}\n\nexport function useColumnUnitsMap(): Map<number, ExtUnit> | null {\n try {\n return scope.useAtomValue(columnUnitsMapAtom) as Map<number, ExtUnit>;\n } catch {\n return null;\n }\n}\n\nexport function useCompositeScale(): CompositeColumnScale {\n const ctx = useMacrostratColumnData();\n return useMemo(\n () => createCompositeScale(ctx.sections, true),\n [ctx.sections],\n );\n}\n"],"names":[],"version":3,"file":"column-views.c1e507e6.js.map"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useCorrelationMapStore as $74e211dc185c20b4$export$21398703d3a9bb4d} from "./column-views.
|
|
1
|
+
import {useCorrelationMapStore as $74e211dc185c20b4$export$21398703d3a9bb4d} from "./column-views.bc83a85d.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";
|
|
@@ -17,7 +17,7 @@ import {buildCrossSectionLayers as $6wt91$buildCrossSectionLayers} from "@macros
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
function $dcd183b733f66144$export$8e7d97509e84cc49(props) {
|
|
20
|
-
const { padding: padding = 50, children: children, columnColor: columnColor, ...rest } = props;
|
|
20
|
+
const { padding: padding = 50, children: children, columnColor: columnColor, projectID: projectID, ...rest } = props;
|
|
21
21
|
const overlayStyles = (0, $6wt91$useMemo)(()=>{
|
|
22
22
|
return [
|
|
23
23
|
(0, $1dbfddc9637b572c$export$d2995719c3a4ae17)(columnColor),
|
|
@@ -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.c93b63db.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;AAsBO,SAAS,0CAAqB,KAA0B;IAC7D,MAAM,WAAE,UAAU,cAAI,QAAQ,eAAE,WAAW,aAAE,SAAS,EAAE,GAAG,MAAM,GAAG;IAEpE,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,GAAA,yCAAO,GACP;QACE,GAAG,IAAI;QACP,SAAS;QACT,YAAY;uBACZ;IACF,GACA;QACE,CAAA,GAAA,sBAAA,EAAE;QACF,CAAA,GAAA,sBAAA,EAAE;QACF,CAAA,GAAA,sBAAA,EAAE;QACF,CAAA,GAAA,sBAAA,EAAE,mCAAa;qBAAE;QAAQ;QACzB;KACD;AAEL;AAEA,SAAS;IACP,MAAM,aAAa,CAAA,GAAA,yCAAqB,EAAE,CAAC,QAAU,MAAM,UAAU;IAErE,CAAA,GAAA,yBAAiB,EACf,CAAC;QACC,WAAW,GAAG;YAAE,MAAM;YAAS,aAAa,EAAE,MAAM,CAAC,OAAO;QAAG;IACjE,GACA;QAAC;KAAW;IAGd,OAAO;AACT;AAEA,SAAS;IACP,MAAM,iBAAiB,CAAA,GAAA,yCAAqB,EAC1C,CAAC,QAAU,MAAM,cAAc;IAG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A4B;IAChC,SAAS;IACT,SAAS;QACP,iBAAiB,CAAA,GAAA,yBAAiB;QAClC,kBAAkB,CAAA,GAAA,yBAAiB;QACnC,uBAAuB,CAAA,GAAA,yBAAiB;IAC1C;IACA,QAAQ,CAAA,GAAA,8BAAsB;AAChC;AAEA,SAAS,kCAAY,WAAE,OAAO,EAAuB;IACnD,MAAM,cAAc,CAAA,GAAA,yCAAqB,EAAE,CAAC,QAAU,MAAM,WAAW;IAEvE,qBAAqB;IACrB,CAAA,GAAA,0BAAkB,EAChB,CAAC;QACC,IAAI,eAAe,MACjB;QAEF,MAAM,OAA0B;YAC9B,MAAM;YACN,UAAU;gBACR;oBACE,MAAM;oBACN,UAAU;oBACV,YAAY;wBAAE,IAAI;oBAAc;gBAClC;aACD;QACH;QAEA,CAAA,GAAA,iBAAS,EAAE,KAAK,oBAAoB;QACpC,CAAA,GAAA,iBAAS,EAAE,KAAK,yBAAyB;YACvC,MAAM;YACN,UAAU,YAAY,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, projectID, ...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.c93b63db.js.map"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./column-views.54c1f382.css";
|
|
2
2
|
import $5tCNh$columnviews17a70358js from "./column-views.17a70358.js";
|
|
3
3
|
import {getPositionWithinUnit as $b6657fba8924a702$export$441710fb21b4ae09, getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a} from "./column-views.052498a6.js";
|
|
4
|
-
import {ColumnNotes as $9e52fe4012c88296$export$fc5babae10f3f77d} from "./column-views.
|
|
4
|
+
import {ColumnNotes as $9e52fe4012c88296$export$fc5babae10f3f77d} from "./column-views.99cb1c41.js";
|
|
5
5
|
import $5tCNh$macrostrathyper from "@macrostrat/hyper";
|
|
6
6
|
import {ColumnAxisType as $5tCNh$ColumnAxisType} from "@macrostrat/column-components";
|
|
7
7
|
|
|
@@ -136,4 +136,4 @@ function $50d219504625a431$export$4e649f790614b299(data, scale, axisType, groupD
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
export {$50d219504625a431$export$9d101e1fcb2166a6 as standardizeMeasurementHeight, $50d219504625a431$export$8f2afa8ddee7317e as mergeHeightRanges, $50d219504625a431$export$ce5c4f2fdf4e644d as BaseMeasurementsColumn, $50d219504625a431$export$653e47a7a0da0f0d as TruncatedList, $50d219504625a431$export$4e649f790614b299 as groupNotesByPixelDistance};
|
|
139
|
-
//# sourceMappingURL=column-views.
|
|
139
|
+
//# sourceMappingURL=column-views.ce5251f7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;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ClE,wEAAwE;QACxE,gDAAgD;QAChD,MAAM,WAAW,uBAAuB,MAAM,EAAE,UAAU,IAAI,EAAE,MAAM;QAEtE,IAAI,YAAY,eAAe;YAC7B,IAAI,gBAAgB,MAClB,MAAM,IAAI,MAAM;YAElB,2BAA2B;YAC3B,aAAa,IAAI,CAAC,IAAI,IAAI,EAAE,IAAI;YAChC,sBAAsB;YACtB,MAAM,aAAa,EAAE,UAAU,IAAI,EAAE,MAAM;YAC3C,IACE,aAAa,CAAA,GAAA,qBAAa,EAAE,GAAG,IAC/B,aAAa,CAAA,GAAA,qBAAa,EAAE,KAAK,EAEjC,gBAAgB;YAChB,aAAa,UAAU,GAAG,KAAK,GAAG,CAAC,aAAa,UAAU,EAAE;iBAE5D,aAAa,UAAU,GAAG,KAAK,GAAG,CAAC,aAAa,UAAU,EAAE;YAE9D,aAAa,EAAE,GAAG,GAAG,aAAa,MAAM,CAAC,CAAC,EAAE,aAAa,UAAU,EAAE;QACvE,OAAO;YACL,oBAAoB;YACpB,eAAe;gBAAE,GAAG,CAAC;gBAAE,MAAM;uBAAI,EAAE,IAAI;iBAAC;YAAC;YACzC,uBACE,MAAM,aAAa,MAAM,KACzB,MAAM,aAAa,UAAU,KAC7B;YACF,YAAY,IAAI,CAAC;QACnB;IACF;IAEA,OAAO;AACT","sources":["packages/column-views/src/facets/measurements/base.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport styles from \"./base.module.sass\";\nimport {\n type CompositeColumnScale,\n getPositionWithinUnit,\n getUnitHeightRange,\n} from \"../../prepare-units\";\nimport { ColumnNotes } from \"../../notes\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nconst h = hyper.styled(styles);\n\ntype GetHeightRangeFn<T> = (\n data: T,\n unit: UnitLong | null,\n axisType: ColumnAxisType,\n) => MeasurementHeightData;\n\nexport interface BaseMeasurementsColumnProps<T> {\n data: T[];\n noteComponent?: any;\n width?: number;\n paddingLeft?: number;\n className?: string;\n // TODO: these props are confusing\n getUnitID?: (d: T) => number | string;\n isMatchingUnit?: (d: T, unit: UnitLong) => boolean;\n getHeightRange?: GetHeightRangeFn<T>;\n deltaConnectorAttachment?: number;\n focusedNoteComponent?: any;\n}\n\nexport interface ColumnMeasurementData<T = any> extends MeasurementHeightData {\n data: T;\n id: string | number;\n}\n\ntype MeasurementPositionInformation =\n | MeasurementHeightData\n | {\n unit_id: number;\n unit_rel_pos?: number;\n };\n\nexport function standardizeMeasurementHeight(\n pos: MeasurementPositionInformation,\n units: UnitLong[],\n axisType: ColumnAxisType,\n): MeasurementHeightData | null {\n /** Get a standardized height representation from position information for\n * a measurement\n */\n if (\"height\" in pos) {\n return pos;\n }\n const unit = units.find((u) => u.unit_id === pos.unit_id);\n if (unit == null) {\n return null;\n }\n if (pos.unit_rel_pos != null) {\n const res = getPositionWithinUnit(pos.unit_rel_pos, unit, axisType);\n if (res == null) return null;\n return { height: res };\n } else {\n const [height, top_height] = getUnitHeightRange(unit, axisType);\n return { height, top_height };\n }\n}\n\nexport function mergeHeightRanges(\n data: MeasurementHeightData[],\n axisType: ColumnAxisType,\n): MeasurementHeightData {\n /** Merge multiple height ranges into a single range */\n const heights = [];\n\n for (const d of data) {\n heights.push(d.height);\n if (d.top_height != null) {\n heights.push(d.top_height);\n }\n }\n\n let height: number;\n let top_height: number;\n if (axisType === ColumnAxisType.AGE || axisType === ColumnAxisType.DEPTH) {\n height = Math.max(...heights);\n top_height = Math.min(...heights);\n } else {\n height = Math.min(...heights);\n top_height = Math.max(...heights);\n }\n\n if (top_height === height) {\n return { height };\n }\n return { height, top_height };\n}\n\nexport type MeasurementHeightData = {\n height: number;\n top_height?: number | null;\n};\n\nexport function BaseMeasurementsColumn({\n data,\n noteComponent,\n width = 500,\n paddingLeft = 40,\n className,\n deltaConnectorAttachment,\n focusedNoteComponent,\n}: BaseMeasurementsColumnProps<any>) {\n if (data == null) return null;\n\n return h(\n \"div.measurements-column\",\n { className },\n h(ColumnNotes, {\n width,\n paddingLeft,\n notes: data,\n noteComponent,\n deltaConnectorAttachment,\n focusedNoteComponent,\n }),\n );\n}\n\ninterface TruncatedListProps {\n data: any[];\n className?: string;\n maxItems?: number;\n itemRenderer?: (props: { data: any }) => any;\n}\n\nexport function TruncatedList({\n data,\n className,\n maxItems = 5,\n itemRenderer = (p) => h(\"span\", p.data),\n}: TruncatedListProps) {\n let tooMany = null;\n let d1 = data;\n if (data.length > maxItems) {\n const n = data.length - maxItems;\n d1 = data.slice(0, maxItems);\n tooMany = h(\"li.too-many\", `and ${n} more`);\n }\n\n return h(\"ul.truncated-list\", { className }, [\n d1.map((d, i) => {\n return h(\"li.element\", { key: i }, h(itemRenderer, { data: d }));\n }),\n tooMany,\n ]);\n}\n\nexport function groupNotesByPixelDistance<T = any>(\n data: ColumnMeasurementData<T[]>[],\n scale: CompositeColumnScale,\n axisType: ColumnAxisType,\n groupDistance: number,\n) {\n /** Group notes that are within a certain pixel distance of each other\n * in display space\n */\n if (data.length === 0 || groupDistance <= 0) return data;\n if (axisType === ColumnAxisType.AGE || axisType === ColumnAxisType.DEPTH) {\n data.sort((a, b) => b.height - a.height);\n } else {\n // Sort data by height (ascending up the column)\n data.sort((a, b) => a.height - b.height);\n }\n\n const groupedData: ColumnMeasurementData<T[]>[] = [];\n let currentGroup: ColumnMeasurementData<T[]> | null = null;\n let currentGroupPosition: number = Infinity;\n\n for (const d of data) {\n // Check distance from current max position\n // Pixels go up as we go down in the section\n\n // The _top_ of the next group must be within groupDistance of the\n // _bottom_ of the current group. This makes sure that we don't collapse\n // groups that are separated by a large distance\n const distance = currentGroupPosition - scale(d.top_height ?? d.height);\n\n if (distance <= groupDistance) {\n if (currentGroup == null) {\n throw new Error(\"Current group is null when it shouldn't be\");\n }\n // Merge into current group\n currentGroup.data.push(...d.data);\n // Update height range\n const top_height = d.top_height ?? d.height;\n if (\n axisType === ColumnAxisType.AGE ||\n axisType === ColumnAxisType.DEPTH\n ) {\n // Inverted axis\n currentGroup.top_height = Math.min(currentGroup.top_height, top_height);\n } else {\n currentGroup.top_height = Math.max(currentGroup.top_height, top_height);\n }\n currentGroup.id = `${currentGroup.height}-${currentGroup.top_height}`;\n } else {\n // Start a new group\n currentGroup = { ...d, data: [...d.data] };\n currentGroupPosition =\n scale(currentGroup.height) ??\n scale(currentGroup.top_height) ??\n Infinity;\n groupedData.push(currentGroup);\n }\n }\n\n return groupedData;\n}\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAUA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAkCrB,SAAS,0CACd,GAAmC,EACnC,KAAiB,EACjB,QAAwB;IAExB;;GAEC,GACD,IAAI,YAAY,KACd,OAAO;IAET,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,IAAM,EAAE,OAAO,KAAK,IAAI,OAAO;IACxD,IAAI,QAAQ,MACV,OAAO;IAET,IAAI,IAAI,YAAY,IAAI,MAAM;QAC5B,MAAM,MAAM,CAAA,GAAA,yCAAoB,EAAE,IAAI,YAAY,EAAE,MAAM;QAC1D,IAAI,OAAO,MAAM,OAAO;QACxB,OAAO;YAAE,QAAQ;QAAI;IACvB,OAAO;QACL,MAAM,CAAC,QAAQ,WAAW,GAAG,CAAA,GAAA,wCAAiB,EAAE,MAAM;QACtD,OAAO;oBAAE;wBAAQ;QAAW;IAC9B;AACF;AAEO,SAAS,0CACd,IAA6B,EAC7B,QAAwB;IAExB,qDAAqD,GACrD,MAAM,UAAU,EAAE;IAElB,KAAK,MAAM,KAAK,KAAM;QACpB,QAAQ,IAAI,CAAC,EAAE,MAAM;QACrB,IAAI,EAAE,UAAU,IAAI,MAClB,QAAQ,IAAI,CAAC,EAAE,UAAU;IAE7B;IAEA,IAAI;IACJ,IAAI;IACJ,IAAI,aAAa,CAAA,GAAA,qBAAa,EAAE,GAAG,IAAI,aAAa,CAAA,GAAA,qBAAa,E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A,qBAAa,EAAE,KAAK,EACtE,KAAK,IAAI,CAAC,CAAC,GAAG,IAAM,EAAE,MAAM,GAAG,EAAE,MAAM;SAEvC,gDAAgD;IAChD,KAAK,IAAI,CAAC,CAAC,GAAG,IAAM,EAAE,MAAM,GAAG,EAAE,MAAM;IAGzC,MAAM,cAA4C,EAAE;IACpD,IAAI,eAAkD;IACtD,IAAI,uBAA+B;IAEnC,KAAK,MAAM,KAAK,KAAM;QACpB,2CAA2C;QAC3C,4CAA4C;QAE5C,kEAAkE;QAClE,wEAAwE;QACxE,gDAAgD;QAChD,MAAM,WAAW,uBAAuB,MAAM,EAAE,UAAU,IAAI,EAAE,MAAM;QAEtE,IAAI,YAAY,eAAe;YAC7B,IAAI,gBAAgB,MAClB,MAAM,IAAI,MAAM;YAElB,2BAA2B;YAC3B,aAAa,IAAI,CAAC,IAAI,IAAI,EAAE,IAAI;YAChC,sBAAsB;YACtB,MAAM,aAAa,EAAE,UAAU,IAAI,EAAE,MAAM;YAC3C,IACE,aAAa,CAAA,GAAA,qBAAa,EAAE,GAAG,IAC/B,aAAa,CAAA,GAAA,qBAAa,EAAE,KAAK,EAEjC,gBAAgB;YAChB,aAAa,UAAU,GAAG,KAAK,GAAG,CAAC,aAAa,UAAU,EAAE;iBAE5D,aAAa,UAAU,GAAG,KAAK,GAAG,CAAC,aAAa,UAAU,EAAE;YAE9D,aAAa,EAAE,GAAG,GAAG,aAAa,MAAM,CAAC,CAAC,EAAE,aAAa,UAAU,EAAE;QACvE,OAAO;YACL,oBAAoB;YACpB,eAAe;gBAAE,GAAG,CAAC;gBAAE,MAAM;uBAAI,EAAE,IAAI;iBAAC;YAAC;YACzC,uBACE,MAAM,aAAa,MAAM,KACzB,MAAM,aAAa,UAAU,KAC7B;YACF,YAAY,IAAI,CAAC;QACnB;IACF;IAEA,OAAO;AACT","sources":["packages/column-views/src/facets/measurements/base.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport styles from \"./base.module.sass\";\nimport {\n type CompositeColumnScale,\n getPositionWithinUnit,\n getUnitHeightRange,\n} from \"../../prepare-units\";\nimport { ColumnNotes } from \"../../notes\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nconst h = hyper.styled(styles);\n\ntype GetHeightRangeFn<T> = (\n data: T,\n unit: UnitLong | null,\n axisType: ColumnAxisType,\n) => MeasurementHeightData;\n\nexport interface BaseMeasurementsColumnProps<T> {\n data: T[];\n noteComponent?: any;\n width?: number;\n paddingLeft?: number;\n className?: string;\n // TODO: these props are confusing\n getUnitID?: (d: T) => number | string;\n isMatchingUnit?: (d: T, unit: UnitLong) => boolean;\n getHeightRange?: GetHeightRangeFn<T>;\n deltaConnectorAttachment?: number;\n focusedNoteComponent?: any;\n}\n\nexport interface ColumnMeasurementData<T = any> extends MeasurementHeightData {\n data: T;\n id: string | number;\n}\n\ntype MeasurementPositionInformation =\n | MeasurementHeightData\n | {\n unit_id: number;\n unit_rel_pos?: number;\n };\n\nexport function standardizeMeasurementHeight(\n pos: MeasurementPositionInformation,\n units: UnitLong[],\n axisType: ColumnAxisType,\n): MeasurementHeightData | null {\n /** Get a standardized height representation from position information for\n * a measurement\n */\n if (\"height\" in pos) {\n return pos;\n }\n const unit = units.find((u) => u.unit_id === pos.unit_id);\n if (unit == null) {\n return null;\n }\n if (pos.unit_rel_pos != null) {\n const res = getPositionWithinUnit(pos.unit_rel_pos, unit, axisType);\n if (res == null) return null;\n return { height: res };\n } else {\n const [height, top_height] = getUnitHeightRange(unit, axisType);\n return { height, top_height };\n }\n}\n\nexport function mergeHeightRanges(\n data: MeasurementHeightData[],\n axisType: ColumnAxisType,\n): MeasurementHeightData {\n /** Merge multiple height ranges into a single range */\n const heights = [];\n\n for (const d of data) {\n heights.push(d.height);\n if (d.top_height != null) {\n heights.push(d.top_height);\n }\n }\n\n let height: number;\n let top_height: number;\n if (axisType === ColumnAxisType.AGE || axisType === ColumnAxisType.DEPTH) {\n height = Math.max(...heights);\n top_height = Math.min(...heights);\n } else {\n height = Math.min(...heights);\n top_height = Math.max(...heights);\n }\n\n if (top_height === height) {\n return { height };\n }\n return { height, top_height };\n}\n\nexport type MeasurementHeightData = {\n height: number;\n top_height?: number | null;\n};\n\nexport function BaseMeasurementsColumn({\n data,\n noteComponent,\n width = 500,\n paddingLeft = 40,\n className,\n deltaConnectorAttachment,\n focusedNoteComponent,\n}: BaseMeasurementsColumnProps<any>) {\n if (data == null) return null;\n\n return h(\n \"div.measurements-column\",\n { className },\n h(ColumnNotes, {\n width,\n paddingLeft,\n notes: data,\n noteComponent,\n deltaConnectorAttachment,\n focusedNoteComponent,\n }),\n );\n}\n\ninterface TruncatedListProps {\n data: any[];\n className?: string;\n maxItems?: number;\n itemRenderer?: (props: { data: any }) => any;\n}\n\nexport function TruncatedList({\n data,\n className,\n maxItems = 5,\n itemRenderer = (p) => h(\"span\", p.data),\n}: TruncatedListProps) {\n let tooMany = null;\n let d1 = data;\n if (data.length > maxItems) {\n const n = data.length - maxItems;\n d1 = data.slice(0, maxItems);\n tooMany = h(\"li.too-many\", `and ${n} more`);\n }\n\n return h(\"ul.truncated-list\", { className }, [\n d1.map((d, i) => {\n return h(\"li.element\", { key: i }, h(itemRenderer, { data: d }));\n }),\n tooMany,\n ]);\n}\n\nexport function groupNotesByPixelDistance<T = any>(\n data: ColumnMeasurementData<T[]>[],\n scale: CompositeColumnScale,\n axisType: ColumnAxisType,\n groupDistance: number,\n) {\n /** Group notes that are within a certain pixel distance of each other\n * in display space\n */\n if (data.length === 0 || groupDistance <= 0) return data;\n if (axisType === ColumnAxisType.AGE || axisType === ColumnAxisType.DEPTH) {\n data.sort((a, b) => b.height - a.height);\n } else {\n // Sort data by height (ascending up the column)\n data.sort((a, b) => a.height - b.height);\n }\n\n const groupedData: ColumnMeasurementData<T[]>[] = [];\n let currentGroup: ColumnMeasurementData<T[]> | null = null;\n let currentGroupPosition: number = Infinity;\n\n for (const d of data) {\n // Check distance from current max position\n // Pixels go up as we go down in the section\n\n // The _top_ of the next group must be within groupDistance of the\n // _bottom_ of the current group. This makes sure that we don't collapse\n // groups that are separated by a large distance\n const distance = currentGroupPosition - scale(d.top_height ?? d.height);\n\n if (distance <= groupDistance) {\n if (currentGroup == null) {\n throw new Error(\"Current group is null when it shouldn't be\");\n }\n // Merge into current group\n currentGroup.data.push(...d.data);\n // Update height range\n const top_height = d.top_height ?? d.height;\n if (\n axisType === ColumnAxisType.AGE ||\n axisType === ColumnAxisType.DEPTH\n ) {\n // Inverted axis\n currentGroup.top_height = Math.min(currentGroup.top_height, top_height);\n } else {\n currentGroup.top_height = Math.max(currentGroup.top_height, top_height);\n }\n currentGroup.id = `${currentGroup.height}-${currentGroup.top_height}`;\n } else {\n // Start a new group\n currentGroup = { ...d, data: [...d.data] };\n currentGroupPosition =\n scale(currentGroup.height) ??\n scale(currentGroup.top_height) ??\n Infinity;\n groupedData.push(currentGroup);\n }\n }\n\n return groupedData;\n}\n"],"names":[],"version":3,"file":"column-views.ce5251f7.js.map"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {standardizeMeasurementHeight as $50d219504625a431$export$9d101e1fcb2166a6, mergeHeightRanges as $50d219504625a431$export$8f2afa8ddee7317e, BaseMeasurementsColumn as $50d219504625a431$export$ce5c4f2fdf4e644d, TruncatedList as $50d219504625a431$export$653e47a7a0da0f0d, groupNotesByPixelDistance as $50d219504625a431$export$4e649f790614b299} from "./column-views.
|
|
2
|
-
import {SGPMeasurementsColumn as $c8e156b0b9c785ec$export$c49cf57576706bab} from "./column-views.
|
|
1
|
+
import {standardizeMeasurementHeight as $50d219504625a431$export$9d101e1fcb2166a6, mergeHeightRanges as $50d219504625a431$export$8f2afa8ddee7317e, BaseMeasurementsColumn as $50d219504625a431$export$ce5c4f2fdf4e644d, TruncatedList as $50d219504625a431$export$653e47a7a0da0f0d, groupNotesByPixelDistance as $50d219504625a431$export$4e649f790614b299} from "./column-views.ce5251f7.js";
|
|
2
|
+
import {SGPMeasurementsColumn as $c8e156b0b9c785ec$export$c49cf57576706bab} from "./column-views.af4278f0.js";
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
export {$50d219504625a431$export$9d101e1fcb2166a6 as standardizeMeasurementHeight, $50d219504625a431$export$8f2afa8ddee7317e as mergeHeightRanges, $50d219504625a431$export$ce5c4f2fdf4e644d as BaseMeasurementsColumn, $50d219504625a431$export$653e47a7a0da0f0d as TruncatedList, $50d219504625a431$export$4e649f790614b299 as groupNotesByPixelDistance, $c8e156b0b9c785ec$export$c49cf57576706bab as SGPMeasurementsColumn};
|
|
9
|
-
//# sourceMappingURL=column-views.
|
|
9
|
+
//# sourceMappingURL=column-views.d4e50f74.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"","sources":["packages/column-views/src/facets/measurements/index.ts"],"sourcesContent":["export * from \"./base\";\nexport * from \"./sgp\";\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":"","sources":["packages/column-views/src/facets/measurements/index.ts"],"sourcesContent":["export * from \"./base\";\nexport * from \"./sgp\";\n"],"names":[],"version":3,"file":"column-views.d4e50f74.js.map"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {PBDBFossilsColumn as $b9286605a04210d4$export$554267114407ef68, FossilDataType as $a3ff7da576c02df0$export$a990c76b38782f57, useFossilData as $a3ff7da576c02df0$export$e6af757fa9780077, PBDBOccurrencesMatrix as $d419340b86dbd2ea$export$652730986cccff7a} from "./column-views.
|
|
2
|
-
import {DetritalColumn as $715dd5fedd79146a$export$f176396e104db8d5, DetritalGroup as $715dd5fedd79146a$export$1b3047373cd1c8c7} from "./column-views.
|
|
3
|
-
import {IsotopesDataset as $d71d096cfe00860f$export$c69bd0285aa5d775, IsotopesColumn as $d71d096cfe00860f$export$5d8aa8022c284748, MeasurementDataContext as $5dbb619f2c7bef60$export$c644ef985ce7a4c4, MeasurementDataProvider as $5dbb619f2c7bef60$export$5f01d5b342a89841, useMeasurementData as $5dbb619f2c7bef60$export$8a0335fd9ff72150} from "./column-views.
|
|
4
|
-
import {standardizeMeasurementHeight as $50d219504625a431$export$9d101e1fcb2166a6, mergeHeightRanges as $50d219504625a431$export$8f2afa8ddee7317e, BaseMeasurementsColumn as $50d219504625a431$export$ce5c4f2fdf4e644d, TruncatedList as $50d219504625a431$export$653e47a7a0da0f0d, groupNotesByPixelDistance as $50d219504625a431$export$4e649f790614b299, SGPMeasurementsColumn as $c8e156b0b9c785ec$export$c49cf57576706bab} from "./column-views.
|
|
1
|
+
import {PBDBFossilsColumn as $b9286605a04210d4$export$554267114407ef68, FossilDataType as $a3ff7da576c02df0$export$a990c76b38782f57, useFossilData as $a3ff7da576c02df0$export$e6af757fa9780077, PBDBOccurrencesMatrix as $d419340b86dbd2ea$export$652730986cccff7a} from "./column-views.fc4860bd.js";
|
|
2
|
+
import {DetritalColumn as $715dd5fedd79146a$export$f176396e104db8d5, DetritalGroup as $715dd5fedd79146a$export$1b3047373cd1c8c7} from "./column-views.ee2fd38f.js";
|
|
3
|
+
import {IsotopesDataset as $d71d096cfe00860f$export$c69bd0285aa5d775, IsotopesColumn as $d71d096cfe00860f$export$5d8aa8022c284748, MeasurementDataContext as $5dbb619f2c7bef60$export$c644ef985ce7a4c4, MeasurementDataProvider as $5dbb619f2c7bef60$export$5f01d5b342a89841, useMeasurementData as $5dbb619f2c7bef60$export$8a0335fd9ff72150} from "./column-views.fedccce9.js";
|
|
4
|
+
import {standardizeMeasurementHeight as $50d219504625a431$export$9d101e1fcb2166a6, mergeHeightRanges as $50d219504625a431$export$8f2afa8ddee7317e, BaseMeasurementsColumn as $50d219504625a431$export$ce5c4f2fdf4e644d, TruncatedList as $50d219504625a431$export$653e47a7a0da0f0d, groupNotesByPixelDistance as $50d219504625a431$export$4e649f790614b299, SGPMeasurementsColumn as $c8e156b0b9c785ec$export$c49cf57576706bab} from "./column-views.d4e50f74.js";
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -10,4 +10,4 @@ import {standardizeMeasurementHeight as $50d219504625a431$export$9d101e1fcb2166a
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
export {$b9286605a04210d4$export$554267114407ef68 as PBDBFossilsColumn, $a3ff7da576c02df0$export$a990c76b38782f57 as FossilDataType, $a3ff7da576c02df0$export$e6af757fa9780077 as useFossilData, $d419340b86dbd2ea$export$652730986cccff7a as PBDBOccurrencesMatrix, $715dd5fedd79146a$export$f176396e104db8d5 as DetritalColumn, $715dd5fedd79146a$export$1b3047373cd1c8c7 as DetritalGroup, $d71d096cfe00860f$export$c69bd0285aa5d775 as IsotopesDataset, $d71d096cfe00860f$export$5d8aa8022c284748 as IsotopesColumn, $5dbb619f2c7bef60$export$c644ef985ce7a4c4 as MeasurementDataContext, $5dbb619f2c7bef60$export$5f01d5b342a89841 as MeasurementDataProvider, $5dbb619f2c7bef60$export$8a0335fd9ff72150 as useMeasurementData, $50d219504625a431$export$9d101e1fcb2166a6 as standardizeMeasurementHeight, $50d219504625a431$export$8f2afa8ddee7317e as mergeHeightRanges, $50d219504625a431$export$ce5c4f2fdf4e644d as BaseMeasurementsColumn, $50d219504625a431$export$653e47a7a0da0f0d as TruncatedList, $50d219504625a431$export$4e649f790614b299 as groupNotesByPixelDistance, $c8e156b0b9c785ec$export$c49cf57576706bab as SGPMeasurementsColumn};
|
|
13
|
-
//# sourceMappingURL=column-views.
|
|
13
|
+
//# sourceMappingURL=column-views.dd2d5a6d.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"","sources":["packages/column-views/src/facets/index.ts"],"sourcesContent":["export * from \"./fossils\";\nexport * from \"./detrital-zircon\";\nexport * from \"./carbon-isotopes\";\nexport * from \"./measurements\";\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":"","sources":["packages/column-views/src/facets/index.ts"],"sourcesContent":["export * from \"./fossils\";\nexport * from \"./detrital-zircon\";\nexport * from \"./carbon-isotopes\";\nexport * from \"./measurements\";\n"],"names":[],"version":3,"file":"column-views.dd2d5a6d.js.map"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {UnitNamesColumn as $bc17276da4abb183$export$594d19cdd88f8c16} from "./column-views.
|
|
2
|
-
import {UnitBoxes as $d254716a820e9c85$export$5d1cdfabe8dc8085} from "./column-views.
|
|
1
|
+
import {UnitNamesColumn as $bc17276da4abb183$export$594d19cdd88f8c16} from "./column-views.088a0274.js";
|
|
2
|
+
import {UnitBoxes as $d254716a820e9c85$export$5d1cdfabe8dc8085} from "./column-views.40d3688c.js";
|
|
3
3
|
import {getMixedUnitColor as $6698edd2a743bf07$export$175d3e927f1a9860} from "./column-views.9b77388d.js";
|
|
4
|
-
import {TrackedLabeledUnit as $8c8238faa5cde49c$export$f613830566442374, LabelTrackerProvider as $8c8238faa5cde49c$export$e4e89ab6c86ac513, CompositeUnitComponent as $8c8238faa5cde49c$export$1dfa200d57964eee, CompositeUnitsColumn as $8c8238faa5cde49c$export$a6684360fef0406e, AnnotatedUnitsColumn as $8c8238faa5cde49c$export$d8c3f2fdd653a082, SectionLabelsColumn as $8c8238faa5cde49c$export$13984e34afdbb040, ColumnNotesProvider as $8c8238faa5cde49c$export$6cc7a9df4edde18} from "./column-views.
|
|
5
|
-
import {useEnvironments as $774a5efa27d1c77b$export$c6b216bf4c71b61f, useLithologies as $774a5efa27d1c77b$export$4d18a90c945d129f} from "./column-views.
|
|
4
|
+
import {TrackedLabeledUnit as $8c8238faa5cde49c$export$f613830566442374, LabelTrackerProvider as $8c8238faa5cde49c$export$e4e89ab6c86ac513, CompositeUnitComponent as $8c8238faa5cde49c$export$1dfa200d57964eee, CompositeUnitsColumn as $8c8238faa5cde49c$export$a6684360fef0406e, AnnotatedUnitsColumn as $8c8238faa5cde49c$export$d8c3f2fdd653a082, SectionLabelsColumn as $8c8238faa5cde49c$export$13984e34afdbb040, ColumnNotesProvider as $8c8238faa5cde49c$export$6cc7a9df4edde18} from "./column-views.11353c2c.js";
|
|
5
|
+
import {useEnvironments as $774a5efa27d1c77b$export$c6b216bf4c71b61f, useLithologies as $774a5efa27d1c77b$export$4d18a90c945d129f} from "./column-views.3090f246.js";
|
|
6
6
|
import {resolveID as $d3e69bd163d41f63$export$7be7d732f3de9464} from "./column-views.006d5180.js";
|
|
7
7
|
import "./column-views.f9dab157.js";
|
|
8
8
|
import $7H3th$macrostrathyper from "@macrostrat/hyper";
|
|
@@ -146,4 +146,4 @@ function $4c8184c4a7317749$var$getPatternID(liths, lithMap) {
|
|
|
146
146
|
|
|
147
147
|
|
|
148
148
|
export {$4c8184c4a7317749$export$3750278673318c9a as UnitsColumn, $4c8184c4a7317749$export$2006342ddaa547c6 as SimpleUnitsColumn, $4c8184c4a7317749$export$600691a8e9d13a7 as BasicUnitComponent, $4c8184c4a7317749$export$48a4cacf2b7a4441 as UnitComponent, $4c8184c4a7317749$export$62c7735c72801c19 as useUnitColor, $4c8184c4a7317749$export$6012fd1584b5d0c0 as ColoredUnitComponent, $4c8184c4a7317749$export$4830e703a903113 as useUnitColorByEnvironment, $4c8184c4a7317749$export$c2fe8a14da82d570 as EnvironmentColoredUnitComponent, $6698edd2a743bf07$export$175d3e927f1a9860 as getMixedUnitColor, $8c8238faa5cde49c$export$e4e89ab6c86ac513 as LabelTrackerProvider, $8c8238faa5cde49c$export$f613830566442374 as TrackedLabeledUnit, $8c8238faa5cde49c$export$1dfa200d57964eee as CompositeUnitComponent, $8c8238faa5cde49c$export$a6684360fef0406e as CompositeUnitsColumn, $8c8238faa5cde49c$export$d8c3f2fdd653a082 as AnnotatedUnitsColumn, $8c8238faa5cde49c$export$13984e34afdbb040 as SectionLabelsColumn, $8c8238faa5cde49c$export$6cc7a9df4edde18 as ColumnNotesProvider};
|
|
149
|
-
//# sourceMappingURL=column-views.
|
|
149
|
+
//# sourceMappingURL=column-views.e6882667.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;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AAM;QAAS;QAAgB;QAAS;QAAY;KAAa;AACvE;AAEO,SAAS,0CAAgC,KAAK;IACnD;uGACqG,GACrG,MAAM,kBAAkB,yCAA0B,MAAM,QAAQ;IAEhE,MAAM,YAAY,CAAA,GAAA,cAAM,EAAE;QACxB,OAAO,CAAA,GAAA,yCAAQ,EAAE,MAAM,QAAQ,GAAG,iDAAiD;IACrF,GAAG;QAAC,MAAM,QAAQ,EAAE;KAAQ;IAE5B,MAAM,OAAO,CAAA,GAAA,yBAAiB,EAAE;IAEhC,OAAO,CAAA,GAAA,sBAAA,EAAE,2CAAe;cACtB;yBACA;QACA,GAAG,KAAK;IACV;AACF;AAEA,SAAS,mCACP,KAAuB,EACvB,OAA+B;IAE/B,IAAI,WAAW,QAAQ,SAAS,QAAQ,MAAM,MAAM,IAAI,GACtD,OAAO;IAET,MAAM,aAAa,IAAI;IACvB,KAAK,MAAM,QAAQ,MAAO;QACxB,MAAM,WAAW,QAAQ,GAAG,CAAC,KAAK,OAAO;QACzC,IAAI,UACF,WAAW,GAAG,CAAC,GAAG,SAAS,IAAI,EAAE;IAErC;IACA,IAAI,KAAK,WAAW,MAAM,EAAE,CAAC,EAAE;IAC/B,IAAI,MAAM,KAAK,OAAO;IACtB,OAAO;AACT","sources":["packages/column-views/src/units/index.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport {\n LithologyColumn,\n useGeologicPattern,\n} from \"@macrostrat/column-components\";\nimport { UnitNamesColumn } from \"./names\";\nimport { ICompositeUnitProps } from \"./composite\";\nimport { UnitBoxes, UnitProps } from \"./boxes\";\nimport { useColumnLayout } from \"@macrostrat/column-components\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport { getMixedUnitColor } from \"./colors\";\nimport { TrackedLabeledUnit } from \"./composite\";\nimport { useEnvironments, useLithologies } from \"../data-provider\";\nimport { useMemo } from \"react\";\nimport { resolveID } from \"./resolvers\";\nimport { Lithology } from \"@macrostrat/api-types\";\n\nexport * from \"./composite\";\nexport * from \"./types\";\nexport * from \"./colors\";\n\nexport function UnitsColumn({ width = 100 }) {\n /*\n A column showing units with USGS color fill\n */\n return h(LithologyColumn, { width }, h(UnitBoxes));\n}\n\nexport function SimpleUnitsColumn(props: ICompositeUnitProps) {\n /*\n A column with units and names either\n overlapping or offset to the right\n */\n const { columnWidth, width, gutterWidth = 0, labelOffset = 30 } = props;\n\n return h([\n h(UnitsColumn, {\n width: columnWidth,\n }),\n h(UnitNamesColumn, {\n transform: `translate(${columnWidth + gutterWidth})`,\n paddingLeft: labelOffset,\n width: width - columnWidth - gutterWidth,\n }),\n ]);\n}\n\nexport function BasicUnitComponent({ division, ...rest }) {\n /** A unit that allows directly setting colors and patterns. */\n\n return h(UnitComponent, {\n division,\n ...rest,\n backgroundColor: division.color,\n patternID: division.patternID,\n });\n}\n\nexport function UnitComponent({ division, nColumns = 2, ...rest }) {\n const width = rest.width ?? useColumnLayout()?.width;\n\n const nOverlappingUnits = division.overlappingUnits?.length ?? 0;\n const _nColumns = nOverlappingUnits == 0 ? 1 : nColumns;\n const columnIx = (division.column ?? 0) % _nColumns;\n const reducedWidth = width / _nColumns;\n const x = (columnIx * width) / _nColumns;\n\n return h(TrackedLabeledUnit, {\n division,\n ...rest,\n width: reducedWidth,\n x,\n });\n}\n\ninterface UnitColorOptions {\n asBackground?: boolean;\n}\n\nexport function useUnitColor(unit, opts: UnitColorOptions = {}): string | null {\n /** Get the color for a unit based on its lithology */\n const lithMap = useLithologies();\n const inDarkMode = useInDarkMode();\n const { asBackground = true } = opts;\n\n return useMemo(() => {\n if (unit == null || lithMap == null) return null;\n return getMixedUnitColor(unit, lithMap, inDarkMode, asBackground);\n }, [unit?.unit_id, lithMap, inDarkMode, asBackground]);\n}\n\nexport function ColoredUnitComponent(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */\n const backgroundColor = useUnitColor(props.division);\n\n const patternID = useMemo(() => {\n return resolveID(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [props.division?.unit_id]);\n\n const fill = useGeologicPattern(patternID);\n\n return h(UnitComponent, {\n fill,\n backgroundColor,\n ...props,\n });\n}\n\nexport function useUnitColorByEnvironment(\n unit,\n opts: UnitColorOptions = {},\n): string | null {\n /** Get the color for a unit based on its lithology */\n const environmentMap = useEnvironments();\n const lithMap = useLithologies();\n const inDarkMode = useInDarkMode();\n const { asBackground = true } = opts;\n\n return useMemo(() => {\n if (unit == null || environmentMap == null) return null;\n let c = getMixedUnitColor(unit, environmentMap, inDarkMode, asBackground, {\n key: \"environ\",\n id_key: \"environ_id\",\n });\n if (c != null) {\n return c;\n }\n // Fallback to lithology color if no environment color is found\n return getMixedUnitColor(unit, lithMap, inDarkMode, asBackground);\n }, [unit?.unit_id, environmentMap, lithMap, inDarkMode, asBackground]);\n}\n\nexport function EnvironmentColoredUnitComponent(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */\n const backgroundColor = useUnitColorByEnvironment(props.division);\n\n const patternID = useMemo(() => {\n return resolveID(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [props.division?.unit_id]);\n\n const fill = useGeologicPattern(patternID);\n\n return h(UnitComponent, {\n fill,\n backgroundColor,\n ...props,\n });\n}\n\nfunction getPatternID(\n liths: Array<Lithology>,\n lithMap: Map<number, Lithology>,\n): string | null {\n if (lithMap == null || liths == null || liths.length == 0) {\n return null;\n }\n const patternIDs = new Set<string>();\n for (const lith of liths) {\n const lithData = lithMap.get(lith.lith_id);\n if (lithData) {\n patternIDs.add(`${lithData.fill}`);\n }\n }\n let id = patternIDs.values()[0];\n if (id == \"0\") return null;\n return id;\n}\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBO,SAAS,0CAAY,SAAE,QAAQ,KAAK;IACzC;;EAEA,GACA,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,sBAAc,GAA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AM,QAAQ;IAEhE,MAAM,YAAY,CAAA,GAAA,cAAM,EAAE;QACxB,OAAO,CAAA,GAAA,yCAAQ,EAAE,MAAM,QAAQ,GAAG,iDAAiD;IACrF,GAAG;QAAC,MAAM,QAAQ,EAAE;KAAQ;IAE5B,MAAM,OAAO,CAAA,GAAA,yBAAiB,EAAE;IAEhC,OAAO,CAAA,GAAA,sBAAA,EAAE,2CAAe;cACtB;yBACA;QACA,GAAG,KAAK;IACV;AACF;AAEA,SAAS,mCACP,KAAuB,EACvB,OAA+B;IAE/B,IAAI,WAAW,QAAQ,SAAS,QAAQ,MAAM,MAAM,IAAI,GACtD,OAAO;IAET,MAAM,aAAa,IAAI;IACvB,KAAK,MAAM,QAAQ,MAAO;QACxB,MAAM,WAAW,QAAQ,GAAG,CAAC,KAAK,OAAO;QACzC,IAAI,UACF,WAAW,GAAG,CAAC,GAAG,SAAS,IAAI,EAAE;IAErC;IACA,IAAI,KAAK,WAAW,MAAM,EAAE,CAAC,EAAE;IAC/B,IAAI,MAAM,KAAK,OAAO;IACtB,OAAO;AACT","sources":["packages/column-views/src/units/index.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport {\n LithologyColumn,\n useGeologicPattern,\n} from \"@macrostrat/column-components\";\nimport { UnitNamesColumn } from \"./names\";\nimport { ICompositeUnitProps } from \"./composite\";\nimport { UnitBoxes, UnitProps } from \"./boxes\";\nimport { useColumnLayout } from \"@macrostrat/column-components\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport { getMixedUnitColor } from \"./colors\";\nimport { TrackedLabeledUnit } from \"./composite\";\nimport { useEnvironments, useLithologies } from \"../data-provider\";\nimport { useMemo } from \"react\";\nimport { resolveID } from \"./resolvers\";\nimport { Lithology } from \"@macrostrat/api-types\";\n\nexport * from \"./composite\";\nexport * from \"./types\";\nexport * from \"./colors\";\n\nexport function UnitsColumn({ width = 100 }) {\n /*\n A column showing units with USGS color fill\n */\n return h(LithologyColumn, { width }, h(UnitBoxes));\n}\n\nexport function SimpleUnitsColumn(props: ICompositeUnitProps) {\n /*\n A column with units and names either\n overlapping or offset to the right\n */\n const { columnWidth, width, gutterWidth = 0, labelOffset = 30 } = props;\n\n return h([\n h(UnitsColumn, {\n width: columnWidth,\n }),\n h(UnitNamesColumn, {\n transform: `translate(${columnWidth + gutterWidth})`,\n paddingLeft: labelOffset,\n width: width - columnWidth - gutterWidth,\n }),\n ]);\n}\n\nexport function BasicUnitComponent({ division, ...rest }) {\n /** A unit that allows directly setting colors and patterns. */\n\n return h(UnitComponent, {\n division,\n ...rest,\n backgroundColor: division.color,\n patternID: division.patternID,\n });\n}\n\nexport function UnitComponent({ division, nColumns = 2, ...rest }) {\n const width = rest.width ?? useColumnLayout()?.width;\n\n const nOverlappingUnits = division.overlappingUnits?.length ?? 0;\n const _nColumns = nOverlappingUnits == 0 ? 1 : nColumns;\n const columnIx = (division.column ?? 0) % _nColumns;\n const reducedWidth = width / _nColumns;\n const x = (columnIx * width) / _nColumns;\n\n return h(TrackedLabeledUnit, {\n division,\n ...rest,\n width: reducedWidth,\n x,\n });\n}\n\ninterface UnitColorOptions {\n asBackground?: boolean;\n}\n\nexport function useUnitColor(unit, opts: UnitColorOptions = {}): string | null {\n /** Get the color for a unit based on its lithology */\n const lithMap = useLithologies();\n const inDarkMode = useInDarkMode();\n const { asBackground = true } = opts;\n\n return useMemo(() => {\n if (unit == null || lithMap == null) return null;\n return getMixedUnitColor(unit, lithMap, inDarkMode, asBackground);\n }, [unit?.unit_id, lithMap, inDarkMode, asBackground]);\n}\n\nexport function ColoredUnitComponent(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */\n const backgroundColor = useUnitColor(props.division);\n\n const patternID = useMemo(() => {\n return resolveID(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [props.division?.unit_id]);\n\n const fill = useGeologicPattern(patternID);\n\n return h(UnitComponent, {\n fill,\n backgroundColor,\n ...props,\n });\n}\n\nexport function useUnitColorByEnvironment(\n unit,\n opts: UnitColorOptions = {},\n): string | null {\n /** Get the color for a unit based on its lithology */\n const environmentMap = useEnvironments();\n const lithMap = useLithologies();\n const inDarkMode = useInDarkMode();\n const { asBackground = true } = opts;\n\n return useMemo(() => {\n if (unit == null || environmentMap == null) return null;\n let c = getMixedUnitColor(unit, environmentMap, inDarkMode, asBackground, {\n key: \"environ\",\n id_key: \"environ_id\",\n });\n if (c != null) {\n return c;\n }\n // Fallback to lithology color if no environment color is found\n return getMixedUnitColor(unit, lithMap, inDarkMode, asBackground);\n }, [unit?.unit_id, environmentMap, lithMap, inDarkMode, asBackground]);\n}\n\nexport function EnvironmentColoredUnitComponent(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */\n const backgroundColor = useUnitColorByEnvironment(props.division);\n\n const patternID = useMemo(() => {\n return resolveID(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [props.division?.unit_id]);\n\n const fill = useGeologicPattern(patternID);\n\n return h(UnitComponent, {\n fill,\n backgroundColor,\n ...props,\n });\n}\n\nfunction getPatternID(\n liths: Array<Lithology>,\n lithMap: Map<number, Lithology>,\n): string | null {\n if (lithMap == null || liths == null || liths.length == 0) {\n return null;\n }\n const patternIDs = new Set<string>();\n for (const lith of liths) {\n const lithData = lithMap.get(lith.lith_id);\n if (lithData) {\n patternIDs.add(`${lithData.fill}`);\n }\n }\n let id = patternIDs.values()[0];\n if (id == \"0\") return null;\n return id;\n}\n"],"names":[],"version":3,"file":"column-views.e6882667.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.c1e507e6.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.e885211d.js.map
|
|
@@ -1 +1 @@
|
|
|
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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ACF;AAEA,SAAS,gDACP,IAAgB,EAChB,aAA0B,EAC1B,QAAwB;IAExB,MAAM,UAAmC,EAAE;IAC3C,IAAI,gBAAyC;IAE7C,KAAK,MAAM,KAAK,KAAM;QACpB,IAAI,cAAc,GAAG,CAAC,EAAE,OAAO,GAAG;YAChC,IAAI,iBAAiB;gBACnB,IACE,YAAY,CAAA,GAAA,qBAAa,EAAE,KAAK,IAChC,YAAY,CAAA,GAAA,qBAAa,EAAE,MAAM,EAEjC,gBAAgB;oBAAC,EAAE,KAAK;oBAAE,EAAE,KAAK;iBAAC;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.
|
|
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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AO,GACrD,YAAY,GAAG,CACb,WACA,gDAA0B,OAAO,SAAS;IAI9C,OAAO;QACL,eAAe;QACf,cAAc,IAAI,IAAI;QACtB,oBAAoB;qBACpB;IACF;AACF;AAEA,SAAS,gDACP,IAAgB,EAChB,aAA0B,EAC1B,QAAwB;IAExB,MAAM,UAAmC,EAAE;IAC3C,IAAI,gBAAyC;IAE7C,KAAK,MAAM,KAAK,KAAM;QACpB,IAAI,cAAc,GAAG,CAAC,EAAE,OAAO,GAAG;YAChC,IAAI,iBAAiB;gBACnB,IACE,YAAY,CAAA,GAAA,qBAAa,EAAE,KAAK,IAChC,YAAY,CAAA,GAAA,qBAAa,EAAE,MAAM,EAEjC,gBAAgB;oBAAC,EAAE,KAAK;oBAAE,EAAE,KAAK;iBAAC;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.e885211d.js.map"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {useDetritalMeasurements as $9f310bd6e88a58bc$export$1b0cf9c36f060135} from "./column-views.60e97132.js";
|
|
2
2
|
import $d4hxx$columnviews2c45a7b5js from "./column-views.2c45a7b5.js";
|
|
3
3
|
import "./column-views.6f9511d1.css";
|
|
4
|
-
import {BaseMeasurementsColumn as $50d219504625a431$export$ce5c4f2fdf4e644d, mergeHeightRanges as $50d219504625a431$export$8f2afa8ddee7317e} from "./column-views.
|
|
5
|
-
import {useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.
|
|
4
|
+
import {BaseMeasurementsColumn as $50d219504625a431$export$ce5c4f2fdf4e644d, mergeHeightRanges as $50d219504625a431$export$8f2afa8ddee7317e} from "./column-views.ce5251f7.js";
|
|
5
|
+
import {useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.c1e507e6.js";
|
|
6
6
|
import {getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a} from "./column-views.052498a6.js";
|
|
7
7
|
import {usePlotArea as $d4hxx$usePlotArea, DetritalSpectrumPlot as $d4hxx$DetritalSpectrumPlot, DetritalSeries as $d4hxx$DetritalSeries} from "@macrostrat/data-components";
|
|
8
8
|
import $d4hxx$macrostrathyper from "@macrostrat/hyper";
|
|
@@ -149,4 +149,4 @@ function $715dd5fedd79146a$export$1b3047373cd1c8c7(props) {
|
|
|
149
149
|
|
|
150
150
|
|
|
151
151
|
export {$715dd5fedd79146a$export$f176396e104db8d5 as DetritalColumn, $715dd5fedd79146a$export$1b3047373cd1c8c7 as DetritalGroup};
|
|
152
|
-
//# sourceMappingURL=column-views.
|
|
152
|
+
//# sourceMappingURL=column-views.ee2fd38f.js.map
|