@macrostrat/column-views 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +3 -0
- package/dist/age-axis.7ce58d66.js +41 -0
- package/dist/age-axis.7ce58d66.js.map +1 -0
- package/dist/boxes.6d3192e6.js +164 -0
- package/dist/boxes.6d3192e6.js.map +1 -0
- package/dist/boxes.module.998ff312.js +13 -0
- package/dist/boxes.module.998ff312.js.map +1 -0
- package/dist/boxes.module.dd631fe3.css +4 -0
- package/dist/boxes.module.dd631fe3.css.map +1 -0
- package/dist/carbon-isotopes.6d9bddcf.js +11 -0
- package/dist/carbon-isotopes.6d9bddcf.js.map +1 -0
- package/dist/column.e35a471f.js +149 -0
- package/dist/column.e35a471f.js.map +1 -0
- package/dist/column.e901b5d4.js +117 -0
- package/dist/column.e901b5d4.js.map +1 -0
- package/dist/column.module.2e29259c.js +22 -0
- package/dist/column.module.2e29259c.js.map +1 -0
- package/dist/column.module.35184ea7.css +157 -0
- package/dist/column.module.35184ea7.css.map +1 -0
- package/dist/column.module.35ba04e7.js +34 -0
- package/dist/column.module.35ba04e7.js.map +1 -0
- package/dist/column.module.c9df6edf.css +138 -0
- package/dist/column.module.c9df6edf.css.map +1 -0
- package/dist/composite.494beffc.js +153 -0
- package/dist/composite.494beffc.js.map +1 -0
- package/dist/composite.module.5cc0e747.css +4 -0
- package/dist/composite.module.5cc0e747.css.map +1 -0
- package/dist/composite.module.6359deba.js +13 -0
- package/dist/composite.module.6359deba.js.map +1 -0
- package/dist/core.f3824dd8.js +89 -0
- package/dist/core.f3824dd8.js.map +1 -0
- package/dist/data-area.f9bb9ad9.js +86 -0
- package/dist/data-area.f9bb9ad9.js.map +1 -0
- package/dist/data-provider.61ef7f9a.js +25 -0
- package/dist/data-provider.61ef7f9a.js.map +1 -0
- package/dist/helpers.2af05ee4.js +94 -0
- package/dist/helpers.2af05ee4.js.map +1 -0
- package/dist/index.d.ts +363 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/index.module.8fad0020.js +37 -0
- package/dist/index.module.8fad0020.js.map +1 -0
- package/dist/index.module.de76feb2.css +65 -0
- package/dist/index.module.de76feb2.css.map +1 -0
- package/dist/isotopes-column.b5442b4d.js +163 -0
- package/dist/isotopes-column.b5442b4d.js.map +1 -0
- package/dist/layers.946aaa37.js +231 -0
- package/dist/layers.946aaa37.js.map +1 -0
- package/dist/map.e782010f.js +82 -0
- package/dist/map.e782010f.js.map +1 -0
- package/dist/names.ab14789e.js +65 -0
- package/dist/names.ab14789e.js.map +1 -0
- package/dist/providers.abcb2cbe.js +25 -0
- package/dist/providers.abcb2cbe.js.map +1 -0
- package/dist/resolvers.2949c4c0.js +83 -0
- package/dist/resolvers.2949c4c0.js.map +1 -0
- package/dist/section.6f6fc929.js +118 -0
- package/dist/section.6f6fc929.js.map +1 -0
- package/dist/selection-popover.7e008544.js +60 -0
- package/dist/selection-popover.7e008544.js.map +1 -0
- package/dist/selection-popover.module.2732ebc0.css +34 -0
- package/dist/selection-popover.module.2732ebc0.css.map +1 -0
- package/dist/selection-popover.module.fdbfb40e.js +22 -0
- package/dist/selection-popover.module.fdbfb40e.js.map +1 -0
- package/dist/selection.add9f8b0.js +117 -0
- package/dist/selection.add9f8b0.js.map +1 -0
- package/dist/store.c5271371.js +18 -0
- package/dist/store.c5271371.js.map +1 -0
- package/dist/types.ff938b22.js +18 -0
- package/dist/types.ff938b22.js.map +1 -0
- package/dist/unit-details.0c1edd00.js +209 -0
- package/dist/unit-details.0c1edd00.js.map +1 -0
- package/dist/units.5ec6a44c.js +42 -0
- package/dist/units.5ec6a44c.js.map +1 -0
- package/package.json +66 -0
- package/src/age-axis.ts +42 -0
- package/src/carbon-isotopes/column.module.sass +136 -0
- package/src/carbon-isotopes/column.ts +131 -0
- package/src/carbon-isotopes/core.ts +78 -0
- package/src/carbon-isotopes/data-area.ts +96 -0
- package/src/carbon-isotopes/data-provider.ts +19 -0
- package/src/carbon-isotopes/index.ts +3 -0
- package/src/carbon-isotopes/isotopes-column.ts +214 -0
- package/src/column.module.sass +114 -0
- package/src/column.ts +185 -0
- package/src/helpers.ts +133 -0
- package/src/index.ts +7 -0
- package/src/map/animated.ts +78 -0
- package/src/map/index.ts +86 -0
- package/src/map/layers.ts +316 -0
- package/src/providers.ts +34 -0
- package/src/section.ts +129 -0
- package/src/selection-popover.module.sass +27 -0
- package/src/selection-popover.ts +71 -0
- package/src/store.ts +12 -0
- package/src/unit-details/index.module.sass +51 -0
- package/src/unit-details/index.ts +215 -0
- package/src/units/boxes.module.sass +3 -0
- package/src/units/boxes.ts +221 -0
- package/src/units/composite.module.sass +2 -0
- package/src/units/composite.ts +266 -0
- package/src/units/index.ts +36 -0
- package/src/units/names.ts +118 -0
- package/src/units/resolvers.ts +111 -0
- package/src/units/selection.ts +167 -0
- package/src/units/types.ts +26 -0
- package/src/units/units.scss +16 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {UnitsColumn as $4c8184c4a7317749$export$3750278673318c9a, SimpleUnitsColumn as $4c8184c4a7317749$export$2006342ddaa547c6, TrackedLabeledUnit as $8c8238faa5cde49c$export$f613830566442374, AnnotatedUnitsColumn as $8c8238faa5cde49c$export$d8c3f2fdd653a082, CompositeUnitsColumn as $8c8238faa5cde49c$export$a6684360fef0406e, CompositeUnitComponent as $8c8238faa5cde49c$export$1dfa200d57964eee, MacrostratAxisKey as $faf1eba02aecac6a$export$6d217bb9de27dba7, transformAxisType as $faf1eba02aecac6a$export$ab2a19f8a72df19b, useUnitSelectionDispatch as $4d5d1c15f39f6a14$export$77a278d5ca56e309, useSelectedUnit as $4d5d1c15f39f6a14$export$f0dd93f90aa8e5da, UnitSelectionProvider as $4d5d1c15f39f6a14$export$f19d75b1d4b676a4, useColumnNav as $4d5d1c15f39f6a14$export$91cb5ac808759b34, ColumnNavProvider as $4d5d1c15f39f6a14$export$36fed9e0f93a8fde, UnitKeyboardNavigation as $4d5d1c15f39f6a14$export$70f5ee19650fc7d1} from "./units.5ec6a44c.js";
|
|
2
|
+
import {extendDivision as $2c60de495788ce61$export$9f8a901d6936c6b6, preprocessUnits as $2c60de495788ce61$export$55543e159517d62d, groupUnitsIntoSections as $2c60de495788ce61$export$dfbd00399d639b4c, _mergeOverlappingSections as $2c60de495788ce61$export$ec445c47b6e5d2d, ensureArray as $2c60de495788ce61$export$d0c8ecbd4ed8940c} from "./helpers.2af05ee4.js";
|
|
3
|
+
import {AgeAxis as $43794af7643cdf40$export$25ce20521d0ab97d} from "./age-axis.7ce58d66.js";
|
|
4
|
+
import {MeasurementDataContext as $8adf39b8c41fe3cc$export$c644ef985ce7a4c4, MeasurementDataProvider as $8adf39b8c41fe3cc$export$5f01d5b342a89841, useMeasurementData as $8adf39b8c41fe3cc$export$8a0335fd9ff72150, IsotopesDataset as $d5a3eba6c540ff58$export$c69bd0285aa5d775, IsotopesColumn as $d5a3eba6c540ff58$export$5d8aa8022c284748, CarbonIsotopesColumn as $5cc70deb5088007a$export$883edafebdc6d87e, CarbonIsotopesApp as $5cc70deb5088007a$export$e2beef9ae524c9d5} from "./carbon-isotopes.6d9bddcf.js";
|
|
5
|
+
import {MacrostratColumnProvider as $29bf41d89292aad4$export$9e42f9b6e0d67c7d, MacrostratAPIProvider as $29bf41d89292aad4$export$3098013bc6cc316d} from "./providers.abcb2cbe.js";
|
|
6
|
+
import {ResizableMapFrame as $157bdadaa2bcfcf5$export$c4313db718750a5a, ColumnNavigatorMap as $157bdadaa2bcfcf5$export$d9144ecbc6b090c5, MeasurementsLayer as $347c34ac01fb689b$export$2254347cd20e6080, processTopoJSON as $347c34ac01fb689b$export$4ad66a3119e1afaa, ColumnFeatures as $347c34ac01fb689b$export$f177ff57c101017a, ColumnKeyboardNavigation as $347c34ac01fb689b$export$8c41dd563753848, useColumnData as $347c34ac01fb689b$export$6b70218db02fa4ce, Columns as $347c34ac01fb689b$export$f02cc02ad0e0bba3, ColumnCenters as $347c34ac01fb689b$export$4d8f6e6df85d9012, CurrentColumn as $347c34ac01fb689b$export$b9d912252344e099} from "./map.e782010f.js";
|
|
7
|
+
import {UnitComponent as $2118f0266dc7e955$export$48a4cacf2b7a4441, Column as $2118f0266dc7e955$export$816b5d811295e6bc} from "./column.e35a471f.js";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export {$4c8184c4a7317749$export$3750278673318c9a as UnitsColumn, $4c8184c4a7317749$export$2006342ddaa547c6 as SimpleUnitsColumn, $8c8238faa5cde49c$export$f613830566442374 as TrackedLabeledUnit, $8c8238faa5cde49c$export$d8c3f2fdd653a082 as AnnotatedUnitsColumn, $8c8238faa5cde49c$export$a6684360fef0406e as CompositeUnitsColumn, $8c8238faa5cde49c$export$1dfa200d57964eee as CompositeUnitComponent, $faf1eba02aecac6a$export$6d217bb9de27dba7 as MacrostratAxisKey, $faf1eba02aecac6a$export$ab2a19f8a72df19b as transformAxisType, $4d5d1c15f39f6a14$export$77a278d5ca56e309 as useUnitSelectionDispatch, $4d5d1c15f39f6a14$export$f0dd93f90aa8e5da as useSelectedUnit, $4d5d1c15f39f6a14$export$f19d75b1d4b676a4 as UnitSelectionProvider, $4d5d1c15f39f6a14$export$91cb5ac808759b34 as useColumnNav, $4d5d1c15f39f6a14$export$36fed9e0f93a8fde as ColumnNavProvider, $4d5d1c15f39f6a14$export$70f5ee19650fc7d1 as UnitKeyboardNavigation, $2c60de495788ce61$export$9f8a901d6936c6b6 as extendDivision, $2c60de495788ce61$export$55543e159517d62d as preprocessUnits, $2c60de495788ce61$export$dfbd00399d639b4c as groupUnitsIntoSections, $2c60de495788ce61$export$ec445c47b6e5d2d as _mergeOverlappingSections, $2c60de495788ce61$export$d0c8ecbd4ed8940c as ensureArray, $43794af7643cdf40$export$25ce20521d0ab97d as AgeAxis, $8adf39b8c41fe3cc$export$c644ef985ce7a4c4 as MeasurementDataContext, $8adf39b8c41fe3cc$export$5f01d5b342a89841 as MeasurementDataProvider, $8adf39b8c41fe3cc$export$8a0335fd9ff72150 as useMeasurementData, $d5a3eba6c540ff58$export$c69bd0285aa5d775 as IsotopesDataset, $d5a3eba6c540ff58$export$5d8aa8022c284748 as IsotopesColumn, $5cc70deb5088007a$export$883edafebdc6d87e as CarbonIsotopesColumn, $5cc70deb5088007a$export$e2beef9ae524c9d5 as CarbonIsotopesApp, $29bf41d89292aad4$export$9e42f9b6e0d67c7d as MacrostratColumnProvider, $29bf41d89292aad4$export$3098013bc6cc316d as MacrostratAPIProvider, $157bdadaa2bcfcf5$export$c4313db718750a5a as ResizableMapFrame, $157bdadaa2bcfcf5$export$d9144ecbc6b090c5 as ColumnNavigatorMap, $347c34ac01fb689b$export$2254347cd20e6080 as MeasurementsLayer, $347c34ac01fb689b$export$4ad66a3119e1afaa as processTopoJSON, $347c34ac01fb689b$export$f177ff57c101017a as ColumnFeatures, $347c34ac01fb689b$export$8c41dd563753848 as ColumnKeyboardNavigation, $347c34ac01fb689b$export$6b70218db02fa4ce as useColumnData, $347c34ac01fb689b$export$f02cc02ad0e0bba3 as Columns, $347c34ac01fb689b$export$4d8f6e6df85d9012 as ColumnCenters, $347c34ac01fb689b$export$b9d912252344e099 as CurrentColumn, $2118f0266dc7e955$export$48a4cacf2b7a4441 as UnitComponent, $2118f0266dc7e955$export$816b5d811295e6bc as Column};
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"","sources":["packages/column-views/src/index.ts"],"sourcesContent":["export * from \"./units\";\nexport * from \"./age-axis\";\nexport * from \"./carbon-isotopes\";\nexport * from \"./providers\";\nexport * from \"./helpers\";\nexport * from \"./map\";\nexport * from \"./column\";\n"],"names":[],"version":3,"file":"index.js.map"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
function $parcel$export(e, n, v, s) {
|
|
3
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
|
+
}
|
|
5
|
+
var $051e16c544ec71c3$exports = {};
|
|
6
|
+
|
|
7
|
+
$parcel$export($051e16c544ec71c3$exports, "color-swatch", () => $051e16c544ec71c3$export$def51519e6441a17, (v) => $051e16c544ec71c3$export$def51519e6441a17 = v);
|
|
8
|
+
$parcel$export($051e16c544ec71c3$exports, "legend-panel-header", () => $051e16c544ec71c3$export$ce652ed9af8e3365, (v) => $051e16c544ec71c3$export$ce652ed9af8e3365 = v);
|
|
9
|
+
$parcel$export($051e16c544ec71c3$exports, "no-units", () => $051e16c544ec71c3$export$aff88130074c0d5f, (v) => $051e16c544ec71c3$export$aff88130074c0d5f = v);
|
|
10
|
+
$parcel$export($051e16c544ec71c3$exports, "proportion", () => $051e16c544ec71c3$export$5a14da41381fe262, (v) => $051e16c544ec71c3$export$5a14da41381fe262 = v);
|
|
11
|
+
$parcel$export($051e16c544ec71c3$exports, "sep", () => $051e16c544ec71c3$export$5aee1a5bd9743d8f, (v) => $051e16c544ec71c3$export$5aee1a5bd9743d8f = v);
|
|
12
|
+
$parcel$export($051e16c544ec71c3$exports, "spacer", () => $051e16c544ec71c3$export$8cc075c801fd6817, (v) => $051e16c544ec71c3$export$8cc075c801fd6817 = v);
|
|
13
|
+
$parcel$export($051e16c544ec71c3$exports, "strat-name-id", () => $051e16c544ec71c3$export$3ab27000c02e6186, (v) => $051e16c544ec71c3$export$3ab27000c02e6186 = v);
|
|
14
|
+
$parcel$export($051e16c544ec71c3$exports, "unit-details-content", () => $051e16c544ec71c3$export$1c30616b5f94c6bc, (v) => $051e16c544ec71c3$export$1c30616b5f94c6bc = v);
|
|
15
|
+
$parcel$export($051e16c544ec71c3$exports, "unit-id", () => $051e16c544ec71c3$export$e22f189945dfce76, (v) => $051e16c544ec71c3$export$e22f189945dfce76 = v);
|
|
16
|
+
var $051e16c544ec71c3$export$def51519e6441a17;
|
|
17
|
+
var $051e16c544ec71c3$export$ce652ed9af8e3365;
|
|
18
|
+
var $051e16c544ec71c3$export$aff88130074c0d5f;
|
|
19
|
+
var $051e16c544ec71c3$export$5a14da41381fe262;
|
|
20
|
+
var $051e16c544ec71c3$export$5aee1a5bd9743d8f;
|
|
21
|
+
var $051e16c544ec71c3$export$8cc075c801fd6817;
|
|
22
|
+
var $051e16c544ec71c3$export$3ab27000c02e6186;
|
|
23
|
+
var $051e16c544ec71c3$export$1c30616b5f94c6bc;
|
|
24
|
+
var $051e16c544ec71c3$export$e22f189945dfce76;
|
|
25
|
+
$051e16c544ec71c3$export$def51519e6441a17 = `Mnh6ea_color-swatch`;
|
|
26
|
+
$051e16c544ec71c3$export$ce652ed9af8e3365 = `Mnh6ea_legend-panel-header`;
|
|
27
|
+
$051e16c544ec71c3$export$aff88130074c0d5f = `Mnh6ea_no-units`;
|
|
28
|
+
$051e16c544ec71c3$export$5a14da41381fe262 = `Mnh6ea_proportion`;
|
|
29
|
+
$051e16c544ec71c3$export$5aee1a5bd9743d8f = `Mnh6ea_sep`;
|
|
30
|
+
$051e16c544ec71c3$export$8cc075c801fd6817 = `Mnh6ea_spacer`;
|
|
31
|
+
$051e16c544ec71c3$export$3ab27000c02e6186 = `Mnh6ea_strat-name-id`;
|
|
32
|
+
$051e16c544ec71c3$export$1c30616b5f94c6bc = `Mnh6ea_unit-details-content`;
|
|
33
|
+
$051e16c544ec71c3$export$e22f189945dfce76 = `Mnh6ea_unit-id`;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export {$051e16c544ec71c3$exports as default};
|
|
37
|
+
//# sourceMappingURL=index.module.8fad0020.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AARA,4CAAiC,CAAC,mBAAmB,CAAC;AACtD,4CAAwC,CAAC,0BAA0B,CAAC;AACpE,4CAA6B,CAAC,eAAe,CAAC;AAC9C,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAwB,CAAC,UAAU,CAAC;AACpC,4CAA2B,CAAC,aAAa,CAAC;AAC1C,4CAAkC,CAAC,oBAAoB,CAAC;AACxD,4CAAyC,CAAC,2BAA2B,CAAC;AACtE,4CAA4B,CAAC,cAAc,CAAC","sources":["packages/column-views/src/unit-details/index.module.sass"],"sourcesContent":[".legend-panel-header\n display: flex\n justify-content: space-between\n align-items: baseline\n gap: 1em\n border-bottom: 1px solid var(--panel-rule-color)\n position: sticky\n top: 0\n background-color: var(--panel-secondary-background-color)\n margin: -1em -1em 0\n padding: 0.5em 1em\n z-index: 50\n code\n font-size: 0.9em\n color: var(--secondary-color)\n .spacer\n flex: 1\n button\n line-height: 1.5\n transform: translateY(2px)\n\n h3\n margin: 0 0 0.5em\n font-size: 1.1em\n\n.unit-details-content\n position: relative\n margin-top: 1em\n margin-bottom: -0.5em\n\n.proportion, .sep, .no-units\n color: var(--secondary-color)\n font-style: italic\n font-size: 0.9em\n\n.strat-name-id, .unit-id\n font-family: var(--monospace-font)\n color: var(--secondary-color)\n font-size: 0.9em\n\n &::before\n content: '#'\n color: var(--tertiary-color)\n\n.color-swatch\n width: 1em\n height: 1em\n border-radius: 0.2em\n margin-right: 0.2em\n border: 1px solid var(--panel-rule-color)\n display: inline-block\n"],"names":[],"version":3,"file":"index.module.8fad0020.js.map"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
.Mnh6ea_legend-panel-header {
|
|
2
|
+
border-bottom: 1px solid var(--panel-rule-color);
|
|
3
|
+
background-color: var(--panel-secondary-background-color);
|
|
4
|
+
z-index: 50;
|
|
5
|
+
justify-content: space-between;
|
|
6
|
+
align-items: baseline;
|
|
7
|
+
gap: 1em;
|
|
8
|
+
margin: -1em -1em 0;
|
|
9
|
+
padding: .5em 1em;
|
|
10
|
+
display: flex;
|
|
11
|
+
position: sticky;
|
|
12
|
+
top: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.Mnh6ea_legend-panel-header code {
|
|
16
|
+
color: var(--secondary-color);
|
|
17
|
+
font-size: .9em;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.Mnh6ea_legend-panel-header .Mnh6ea_spacer {
|
|
21
|
+
flex: 1;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.Mnh6ea_legend-panel-header button {
|
|
25
|
+
line-height: 1.5;
|
|
26
|
+
transform: translateY(2px);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.Mnh6ea_legend-panel-header h3 {
|
|
30
|
+
margin: 0 0 .5em;
|
|
31
|
+
font-size: 1.1em;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.Mnh6ea_unit-details-content {
|
|
35
|
+
margin-top: 1em;
|
|
36
|
+
margin-bottom: -.5em;
|
|
37
|
+
position: relative;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.Mnh6ea_proportion, .Mnh6ea_sep, .Mnh6ea_no-units {
|
|
41
|
+
color: var(--secondary-color);
|
|
42
|
+
font-size: .9em;
|
|
43
|
+
font-style: italic;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.Mnh6ea_strat-name-id, .Mnh6ea_unit-id {
|
|
47
|
+
font-family: var(--monospace-font);
|
|
48
|
+
color: var(--secondary-color);
|
|
49
|
+
font-size: .9em;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.Mnh6ea_strat-name-id:before, .Mnh6ea_unit-id:before {
|
|
53
|
+
content: "#";
|
|
54
|
+
color: var(--tertiary-color);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.Mnh6ea_color-swatch {
|
|
58
|
+
border: 1px solid var(--panel-rule-color);
|
|
59
|
+
border-radius: .2em;
|
|
60
|
+
width: 1em;
|
|
61
|
+
height: 1em;
|
|
62
|
+
margin-right: .2em;
|
|
63
|
+
display: inline-block;
|
|
64
|
+
}
|
|
65
|
+
/*# sourceMappingURL=index.module.de76feb2.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA;;;;;;;;;;;;;;AAYE;;;;;AAGA;;;;AAEA;;;;;AAIA;;;;;AAIF;;;;;;AAKA;;;;;;AAKA;;;;;;AAKE;;;;;AAIF","sources":["packages/column-views/src/unit-details/index.module.sass"],"sourcesContent":[".legend-panel-header\n display: flex\n justify-content: space-between\n align-items: baseline\n gap: 1em\n border-bottom: 1px solid var(--panel-rule-color)\n position: sticky\n top: 0\n background-color: var(--panel-secondary-background-color)\n margin: -1em -1em 0\n padding: 0.5em 1em\n z-index: 50\n code\n font-size: 0.9em\n color: var(--secondary-color)\n .spacer\n flex: 1\n button\n line-height: 1.5\n transform: translateY(2px)\n\n h3\n margin: 0 0 0.5em\n font-size: 1.1em\n\n.unit-details-content\n position: relative\n margin-top: 1em\n margin-bottom: -0.5em\n\n.proportion, .sep, .no-units\n color: var(--secondary-color)\n font-style: italic\n font-size: 0.9em\n\n.strat-name-id, .unit-id\n font-family: var(--monospace-font)\n color: var(--secondary-color)\n font-size: 0.9em\n\n &::before\n content: '#'\n color: var(--tertiary-color)\n\n.color-swatch\n width: 1em\n height: 1em\n border-radius: 0.2em\n margin-right: 0.2em\n border: 1px solid var(--panel-rule-color)\n display: inline-block\n"],"names":[],"version":3,"file":"index.module.de76feb2.css.map"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import {useMeasurementData as $8adf39b8c41fe3cc$export$8a0335fd9ff72150} from "./data-provider.61ef7f9a.js";
|
|
2
|
+
import {useDataLocator as $1dbd903fb3e2f029$export$919dbb10b6b5b75, IsotopesDataArea as $1dbd903fb3e2f029$export$309ef8546e07d921, IsotopeDataPoint as $1dbd903fb3e2f029$export$4cb5d059db4e2bd} from "./data-area.f9bb9ad9.js";
|
|
3
|
+
import {format as $5FELH$format} from "d3-format";
|
|
4
|
+
import {useContext as $5FELH$useContext} from "react";
|
|
5
|
+
import $5FELH$macrostrathyper from "@macrostrat/hyper";
|
|
6
|
+
import $5FELH$classnames from "classnames";
|
|
7
|
+
import {AxisBottom as $5FELH$AxisBottom} from "@visx/axis";
|
|
8
|
+
import {referenceMeasuresToColumn as $5FELH$referenceMeasuresToColumn} from "@macrostrat/stratigraphy-utils";
|
|
9
|
+
import {ColumnLayoutContext as $5FELH$ColumnLayoutContext, useColumnDivisions as $5FELH$useColumnDivisions, CrossAxisLayoutProvider as $5FELH$CrossAxisLayoutProvider} from "@macrostrat/column-components";
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
const $d5a3eba6c540ff58$var$fmt = (0, $5FELH$format)(".1f");
|
|
21
|
+
function $d5a3eba6c540ff58$var$IsotopeText({ datum: datum, text: text, ...rest }) {
|
|
22
|
+
const { pointLocator: pointLocator } = (0, $1dbd903fb3e2f029$export$919dbb10b6b5b75)();
|
|
23
|
+
const [x, y] = pointLocator(datum);
|
|
24
|
+
return (0, $5FELH$macrostrathyper)("text", {
|
|
25
|
+
x: x,
|
|
26
|
+
y: y,
|
|
27
|
+
...rest
|
|
28
|
+
}, text);
|
|
29
|
+
}
|
|
30
|
+
function $d5a3eba6c540ff58$var$ColumnScale(props) {
|
|
31
|
+
const { label: label, showAxis: showAxis = true, nTicks: nTicks = 6, tickValues: _tickVals, ...rest } = props;
|
|
32
|
+
const { xScale: xScale, pixelHeight: pixelHeight, width: width } = (0, $5FELH$useContext)((0, $5FELH$ColumnLayoutContext));
|
|
33
|
+
const tickValues = _tickVals ?? xScale.ticks(nTicks);
|
|
34
|
+
return (0, $5FELH$macrostrathyper)("g.scale.isotope-scale-axis", [
|
|
35
|
+
(0, $5FELH$macrostrathyper)("g.scale-lines", tickValues.map((value)=>{
|
|
36
|
+
const strokeDasharray = value == 0 ? null : "2 6";
|
|
37
|
+
return (0, $5FELH$macrostrathyper)($d5a3eba6c540ff58$var$ScaleLine, {
|
|
38
|
+
value: value,
|
|
39
|
+
stroke: "#ddd",
|
|
40
|
+
strokeDasharray: strokeDasharray
|
|
41
|
+
});
|
|
42
|
+
})),
|
|
43
|
+
(0, $5FELH$macrostrathyper).if(showAxis)([
|
|
44
|
+
(0, $5FELH$macrostrathyper)("rect.underlay", {
|
|
45
|
+
x: 0,
|
|
46
|
+
y: pixelHeight,
|
|
47
|
+
width: width,
|
|
48
|
+
height: 30
|
|
49
|
+
}),
|
|
50
|
+
(0, $5FELH$macrostrathyper)((0, $5FELH$AxisBottom), {
|
|
51
|
+
scale: xScale,
|
|
52
|
+
tickLength: 3,
|
|
53
|
+
tickValues: tickValues,
|
|
54
|
+
...rest,
|
|
55
|
+
top: pixelHeight,
|
|
56
|
+
tickLabelProps (tickValue, i) {
|
|
57
|
+
// Compensate for negative sign
|
|
58
|
+
let dx;
|
|
59
|
+
if (tickValue < 0) dx = -2;
|
|
60
|
+
return {
|
|
61
|
+
dy: "-1px",
|
|
62
|
+
dx: dx,
|
|
63
|
+
fontSize: 10,
|
|
64
|
+
textAnchor: "middle",
|
|
65
|
+
fill: "#aaa"
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
labelOffset: 0,
|
|
69
|
+
label: label
|
|
70
|
+
})
|
|
71
|
+
])
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
function $d5a3eba6c540ff58$var$ScaleLine(props) {
|
|
75
|
+
let { value: value, className: className, labelBottom: labelBottom, labelOffset: labelOffset, ...rest } = props;
|
|
76
|
+
if (labelBottom == null) labelBottom = false;
|
|
77
|
+
if (labelOffset == null) labelOffset = 12;
|
|
78
|
+
const { xScale: xScale, pixelHeight: pixelHeight } = (0, $5FELH$useContext)((0, $5FELH$ColumnLayoutContext));
|
|
79
|
+
const x = xScale(value);
|
|
80
|
+
const transform = `translate(${x})`;
|
|
81
|
+
className = (0, $5FELH$classnames)(className, {
|
|
82
|
+
zero: value === 0
|
|
83
|
+
});
|
|
84
|
+
return (0, $5FELH$macrostrathyper)("g.tick", {
|
|
85
|
+
transform: transform,
|
|
86
|
+
className: className,
|
|
87
|
+
key: value
|
|
88
|
+
}, [
|
|
89
|
+
(0, $5FELH$macrostrathyper)("line", {
|
|
90
|
+
x0: 0,
|
|
91
|
+
x1: 0,
|
|
92
|
+
y0: 0,
|
|
93
|
+
y1: pixelHeight,
|
|
94
|
+
...rest
|
|
95
|
+
}),
|
|
96
|
+
(0, $5FELH$macrostrathyper).if(labelBottom)("text", {
|
|
97
|
+
y: pixelHeight + labelOffset
|
|
98
|
+
}, `${value}`)
|
|
99
|
+
]);
|
|
100
|
+
}
|
|
101
|
+
function $d5a3eba6c540ff58$var$unnestPoints(measures) {
|
|
102
|
+
let points = [];
|
|
103
|
+
for (const meas of measures){
|
|
104
|
+
const vals = meas.measure_value.map((d, i)=>{
|
|
105
|
+
return {
|
|
106
|
+
value: d,
|
|
107
|
+
age: meas.measure_age[i],
|
|
108
|
+
position: meas.measure_position[i],
|
|
109
|
+
unit_id: meas.unit_id,
|
|
110
|
+
sample_id: meas.sample_no[i],
|
|
111
|
+
measurement: meas.measurement
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
Array.prototype.push.apply(points, vals);
|
|
115
|
+
}
|
|
116
|
+
return points;
|
|
117
|
+
}
|
|
118
|
+
function $d5a3eba6c540ff58$export$c69bd0285aa5d775(props) {
|
|
119
|
+
const { parameter: parameter, color: color = "dodgerblue" } = props;
|
|
120
|
+
const divisions = (0, $5FELH$useColumnDivisions)();
|
|
121
|
+
const measures = (0, $8adf39b8c41fe3cc$export$8a0335fd9ff72150)() ?? [];
|
|
122
|
+
const refMeasures = (0, $5FELH$referenceMeasuresToColumn)(divisions, measures).filter((d)=>d.measurement == parameter);
|
|
123
|
+
const points = $d5a3eba6c540ff58$var$unnestPoints(refMeasures);
|
|
124
|
+
return (0, $5FELH$macrostrathyper)((0, $1dbd903fb3e2f029$export$309ef8546e07d921), {
|
|
125
|
+
getHeight (d) {
|
|
126
|
+
return d.age;
|
|
127
|
+
}
|
|
128
|
+
}, (0, $5FELH$macrostrathyper)("g.data-points", points.map((d)=>{
|
|
129
|
+
return (0, $5FELH$macrostrathyper)((0, $1dbd903fb3e2f029$export$4cb5d059db4e2bd), {
|
|
130
|
+
datum: d,
|
|
131
|
+
fill: color
|
|
132
|
+
});
|
|
133
|
+
})));
|
|
134
|
+
}
|
|
135
|
+
function $d5a3eba6c540ff58$export$5d8aa8022c284748(props) {
|
|
136
|
+
const { width: width = 120, domain: domain = [
|
|
137
|
+
-14,
|
|
138
|
+
6
|
|
139
|
+
], parameter: parameter, label: label, color: color = "dodgerblue", children: children = null, transform: transform, getHeight: getHeight, ...rest } = props;
|
|
140
|
+
let _children = children;
|
|
141
|
+
if (children == null && parameter != null) _children = (0, $5FELH$macrostrathyper)($d5a3eba6c540ff58$export$c69bd0285aa5d775, {
|
|
142
|
+
parameter: parameter,
|
|
143
|
+
color: color,
|
|
144
|
+
getHeight: getHeight
|
|
145
|
+
});
|
|
146
|
+
return (0, $5FELH$macrostrathyper)((0, $5FELH$CrossAxisLayoutProvider), {
|
|
147
|
+
width: width,
|
|
148
|
+
domain: domain
|
|
149
|
+
}, (0, $5FELH$macrostrathyper)("g.isotopes-column", {
|
|
150
|
+
className: parameter,
|
|
151
|
+
transform: transform
|
|
152
|
+
}, [
|
|
153
|
+
(0, $5FELH$macrostrathyper)($d5a3eba6c540ff58$var$ColumnScale, {
|
|
154
|
+
label: label ?? parameter,
|
|
155
|
+
...rest
|
|
156
|
+
}),
|
|
157
|
+
_children
|
|
158
|
+
]));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
export {$d5a3eba6c540ff58$export$c69bd0285aa5d775 as IsotopesDataset, $d5a3eba6c540ff58$export$5d8aa8022c284748 as IsotopesColumn};
|
|
163
|
+
//# sourceMappingURL=isotopes-column.b5442b4d.js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AgBA,SAAS,0CAAgB,KAAK;IAC5B,MAAM,aAAE,SAAS,SAAE,QAAQ,cAAc,GAAG;IAC5C,MAAM,YAAwB,CAAA,GAAA,yBAAiB;IAC/C,MAAM,WAAW,CAAA,GAAA,yCAAiB,OAAO,EAAE;IAC3C,MAAM,cAAc,CAAA,GAAA,gCAAwB,EAAE,WAAW,UAAU,MAAM,CACvE,CAAC,IAAM,EAAE,WAAW,IAAI;IAE1B,MAAM,SAAS,mCAAa;IAE5B,OAAO,CAAA,GAAA,sBAAA,EACL,CAAA,GAAA,yCAAe,GACf;QACE,WAAU,CAAC;YACT,OAAO,EAAE,GAAG;QACd;IACF,GACA,CAAA,GAAA,sBAAA,EACE,iBACA,OAAO,GAAG,CAAC,CAAC;QACV,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,wCAAe,GAAG;YACzB,OAAO;YACP,MAAM;QACR;IACF;AAGN;AAEA,SAAS,0CACP,KAA2E;IAE3E,MAAM,SACJ,QAAQ,aACR,SAAS;QAAC;QAAK;KAAE,aACjB,SAAS,SACT,KAAK,SACL,QAAQ,wBACR,WAAW,iBACX,SAAS,aACT,SAAS,EACT,GAAG,MACJ,GAAG;IAEJ,IAAI,YAAiB;IACrB,IAAI,YAAY,QAAQ,aAAa,MACnC,YAAY,CAAA,GAAA,sBAAA,EAAE,2CAAiB;mBAAE;eAAW;mBAAO;IAAU;IAG/D,OAAO,CAAA,GAAA,sBAAA,EACL,CAAA,GAAA,8BAAsB,GACtB;eAAE;gBAAO;IAAO,GAChB,CAAA,GAAA,sBAAA,EAAE,qBAAqB;QAAE,WAAW;mBAAW;IAAU,GAAG;QAC1D,CAAA,GAAA,sBAAA,EAAE,mCAAa;YAAE,OAAO,SAAS;YAAW,GAAG,IAAI;QAAC;QACpD;KACD;AAEL","sources":["packages/column-views/src/carbon-isotopes/isotopes-column.ts"],"sourcesContent":["import { format } from \"d3-format\";\nimport { useContext } from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport classNames from \"classnames\";\nimport { AxisBottom } from \"@visx/axis\";\nimport { useMeasurementData } from \"./data-provider\";\n\nimport {\n IsotopesDataArea,\n useDataLocator,\n IsotopeDataPoint,\n} from \"./data-area\";\nimport { referenceMeasuresToColumn } from \"@macrostrat/stratigraphy-utils\";\nimport {\n CrossAxisLayoutProvider,\n ColumnLayoutContext,\n useColumnDivisions,\n} from \"@macrostrat/column-components\";\nimport { BaseUnit } from \"@macrostrat/api-types\";\nimport { AxisProps } from \"@visx/axis/lib/axis/Axis\";\n\nconst fmt = format(\".1f\");\n\ntype IsotopesTextProps = {\n datum: any;\n text: string;\n};\n\nfunction IsotopeText({ datum, text, ...rest }: IsotopesTextProps) {\n const { pointLocator } = useDataLocator();\n const [x, y] = pointLocator(datum);\n return h(\n \"text\",\n {\n x,\n y,\n ...rest,\n },\n text\n );\n}\n\nfunction ColumnScale(props) {\n const {\n label,\n showAxis = true,\n nTicks = 6,\n tickValues: _tickVals,\n ...rest\n } = props;\n const { xScale, pixelHeight, width } = useContext(ColumnLayoutContext);\n\n const tickValues = _tickVals ?? xScale.ticks(nTicks);\n\n return h(\"g.scale.isotope-scale-axis\", [\n h(\n \"g.scale-lines\",\n tickValues.map((value) => {\n const strokeDasharray = value == 0 ? null : \"2 6\";\n return h(ScaleLine, { value, stroke: \"#ddd\", strokeDasharray });\n })\n ),\n h.if(showAxis)([\n h(\"rect.underlay\", {\n x: 0,\n y: pixelHeight,\n width,\n height: 30,\n }),\n h(AxisBottom, {\n scale: xScale,\n tickLength: 3,\n tickValues,\n ...rest,\n top: pixelHeight,\n tickLabelProps(tickValue, i) {\n // Compensate for negative sign\n let dx;\n if (tickValue < 0) {\n dx = -2;\n }\n return {\n dy: \"-1px\",\n dx,\n fontSize: 10,\n textAnchor: \"middle\",\n fill: \"#aaa\",\n };\n },\n labelOffset: 0,\n label,\n }),\n ]),\n ]);\n}\n\ninterface ScaleLineProps {\n value: number;\n className?: string;\n labelBottom?: boolean;\n labelOffset?: number;\n strokeDasharray?: string;\n stroke?: string | number;\n}\n\nfunction ScaleLine(props: ScaleLineProps) {\n let { value, className, labelBottom, labelOffset, ...rest } = props;\n if (labelBottom == null) {\n labelBottom = false;\n }\n if (labelOffset == null) {\n labelOffset = 12;\n }\n const { xScale, pixelHeight } = useContext(ColumnLayoutContext);\n const x = xScale(value);\n const transform = `translate(${x})`;\n className = classNames(className, { zero: value === 0 });\n return h(\"g.tick\", { transform, className, key: value }, [\n h(\"line\", { x0: 0, x1: 0, y0: 0, y1: pixelHeight, ...rest }),\n h.if(labelBottom)(\"text\", { y: pixelHeight + labelOffset }, `${value}`),\n ]);\n}\n\nfunction unnestPoints(measures) {\n let points = [];\n for (const meas of measures) {\n const vals = meas.measure_value.map((d, i) => {\n return {\n value: d,\n age: meas.measure_age[i],\n position: meas.measure_position[i],\n unit_id: meas.unit_id,\n sample_id: meas.sample_no[i],\n measurement: meas.measurement,\n };\n });\n Array.prototype.push.apply(points, vals);\n }\n return points;\n}\n\ninterface IsotopesDatasetProps {\n color: string;\n parameter: string;\n}\n\ninterface IsotopeColumnProps extends IsotopesDatasetProps {\n width: number;\n tickValues?: number[];\n label: string;\n domain: [number, number];\n transform?: string;\n getHeight?: Function;\n}\n\nfunction IsotopesDataset(props) {\n const { parameter, color = \"dodgerblue\" } = props;\n const divisions: BaseUnit[] = useColumnDivisions() as any;\n const measures = useMeasurementData() ?? [];\n const refMeasures = referenceMeasuresToColumn(divisions, measures).filter(\n (d) => d.measurement == parameter\n );\n const points = unnestPoints(refMeasures);\n\n return h(\n IsotopesDataArea,\n {\n getHeight(d) {\n return d.age;\n },\n } as any,\n h(\n \"g.data-points\",\n points.map((d) => {\n return h(IsotopeDataPoint, {\n datum: d,\n fill: color,\n });\n })\n )\n );\n}\n\nfunction IsotopesColumn(\n props: IsotopeColumnProps & { children?: React.ReactNode } & AxisProps<any>\n) {\n const {\n width = 120,\n domain = [-14, 6],\n parameter,\n label,\n color = \"dodgerblue\",\n children = null,\n transform,\n getHeight,\n ...rest\n } = props;\n\n let _children: any = children;\n if (children == null && parameter != null) {\n _children = h(IsotopesDataset, { parameter, color, getHeight });\n }\n\n return h(\n CrossAxisLayoutProvider,\n { width, domain },\n h(\"g.isotopes-column\", { className: parameter, transform }, [\n h(ColumnScale, { label: label ?? parameter, ...rest }),\n _children,\n ])\n );\n}\n\nexport { IsotopesColumn, IsotopesDataset };\n"],"names":[],"version":3,"file":"isotopes-column.b5442b4d.js.map"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import $4ZhRb$macrostrathyper from "@macrostrat/hyper";
|
|
2
|
+
import {FeatureLayer as $4ZhRb$FeatureLayer, Feature as $4ZhRb$Feature, MapContext as $4ZhRb$MapContext} from "@macrostrat/svg-map-components";
|
|
3
|
+
import {useAPIResult as $4ZhRb$useAPIResult, useKeyHandler as $4ZhRb$useKeyHandler} from "@macrostrat/ui-components";
|
|
4
|
+
import $4ZhRb$chromajs from "chroma-js";
|
|
5
|
+
import {geoCentroid as $4ZhRb$geoCentroid} from "d3-geo";
|
|
6
|
+
import {geoVoronoi as $4ZhRb$geoVoronoi} from "d3-geo-voronoi";
|
|
7
|
+
import {useContext as $4ZhRb$useContext, useMemo as $4ZhRb$useMemo} from "react";
|
|
8
|
+
import {feature as $4ZhRb$feature} from "topojson-client";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const $347c34ac01fb689b$var$defaultStyle = {
|
|
19
|
+
fill: "rgb(239, 180, 249)",
|
|
20
|
+
stroke: "magenta"
|
|
21
|
+
};
|
|
22
|
+
function $347c34ac01fb689b$export$2254347cd20e6080(props) {
|
|
23
|
+
const { style: style = $347c34ac01fb689b$var$defaultStyle, ...params } = props;
|
|
24
|
+
const res = (0, $4ZhRb$useAPIResult)("/measurements", {
|
|
25
|
+
...params,
|
|
26
|
+
format: "geojson",
|
|
27
|
+
response: "light"
|
|
28
|
+
});
|
|
29
|
+
if (res == null) return null;
|
|
30
|
+
return (0, $4ZhRb$macrostrathyper)((0, $4ZhRb$FeatureLayer), {
|
|
31
|
+
useCanvas: false,
|
|
32
|
+
style: style,
|
|
33
|
+
features: res.features.filter((d)=>d.properties.unit_id != null)
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function $347c34ac01fb689b$export$4ad66a3119e1afaa(res) {
|
|
37
|
+
try {
|
|
38
|
+
const { data: data } = res.success;
|
|
39
|
+
const { features: f } = (0, $4ZhRb$feature)(data, data.objects.output);
|
|
40
|
+
return f;
|
|
41
|
+
} catch (err) {
|
|
42
|
+
console.error(err);
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function $347c34ac01fb689b$export$f177ff57c101017a(props) {
|
|
47
|
+
const { features: features, onClick: onClick, color: color = "rgba(150,150,150, 1)", singleFeature: singleFeature = true } = props;
|
|
48
|
+
const c = (0, $4ZhRb$chromajs)(color);
|
|
49
|
+
return (0, $4ZhRb$macrostrathyper)((0, $4ZhRb$FeatureLayer), {
|
|
50
|
+
className: "columns",
|
|
51
|
+
useCanvas: onClick == null,
|
|
52
|
+
style: {
|
|
53
|
+
fill: c.alpha(0.2).css(),
|
|
54
|
+
stroke: c.alpha(0.4).css()
|
|
55
|
+
}
|
|
56
|
+
}, features.map((f)=>{
|
|
57
|
+
return (0, $4ZhRb$macrostrathyper)((0, $4ZhRb$Feature), {
|
|
58
|
+
id: f.id ?? f.properties.col_id,
|
|
59
|
+
onClick: onClick,
|
|
60
|
+
feature: f
|
|
61
|
+
});
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
var $347c34ac01fb689b$var$MacrostratStatusCode = /*#__PURE__*/ function(MacrostratStatusCode) {
|
|
65
|
+
MacrostratStatusCode["InProcess"] = "in process";
|
|
66
|
+
return MacrostratStatusCode;
|
|
67
|
+
}($347c34ac01fb689b$var$MacrostratStatusCode || {});
|
|
68
|
+
function $347c34ac01fb689b$var$normalize(angle) {
|
|
69
|
+
if (angle > Math.PI) angle -= 2 * Math.PI;
|
|
70
|
+
else if (angle <= -Math.PI) angle += 2 * Math.PI;
|
|
71
|
+
return angle;
|
|
72
|
+
}
|
|
73
|
+
function $347c34ac01fb689b$var$buildTriangulation(features) {
|
|
74
|
+
console.log("Computing triangulation");
|
|
75
|
+
const centroids = features.map((0, $4ZhRb$geoCentroid));
|
|
76
|
+
const tri = (0, $4ZhRb$geoVoronoi)(centroids);
|
|
77
|
+
return {
|
|
78
|
+
centroids: centroids,
|
|
79
|
+
tri: tri
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function $347c34ac01fb689b$var$buildKeyMapping(neighbors, centroids, currentIndex, projection) {
|
|
83
|
+
if (neighbors == null) return;
|
|
84
|
+
const currentCentroid = projection(centroids[currentIndex]);
|
|
85
|
+
let edgeAngles = neighbors.map((index)=>{
|
|
86
|
+
const centroid = projection(centroids[index]);
|
|
87
|
+
const dx = centroid[0] - currentCentroid[0];
|
|
88
|
+
const dy = centroid[1] - currentCentroid[1];
|
|
89
|
+
return {
|
|
90
|
+
col_index: index,
|
|
91
|
+
angle: Math.atan2(dy, dx)
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
edgeAngles.sort((d)=>d.angle);
|
|
95
|
+
function closestAngle(num) {
|
|
96
|
+
// Find closest angle in array of neighbors
|
|
97
|
+
let curr = edgeAngles[0];
|
|
98
|
+
for (let next of edgeAngles)if (Math.abs($347c34ac01fb689b$var$normalize(num - next.angle)) < Math.abs($347c34ac01fb689b$var$normalize(num - curr.angle))) curr = next;
|
|
99
|
+
return curr.col_index;
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
37: closestAngle(Math.PI),
|
|
103
|
+
38: closestAngle(3 * Math.PI / 2),
|
|
104
|
+
39: closestAngle(0),
|
|
105
|
+
40: closestAngle(Math.PI / 2)
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function $347c34ac01fb689b$export$8c41dd563753848(props) {
|
|
109
|
+
/** Keyboard navigation of columns using a Delaunay triangulation */ const { features: features = [], col_id: col_id = null, onChange: onChange, showLayers: showLayers = false, ...projectArgs } = props;
|
|
110
|
+
const { projection: projection } = (0, $4ZhRb$useContext)((0, $4ZhRb$MapContext));
|
|
111
|
+
const { centroids: centroids, tri: tri } = (0, $4ZhRb$useMemo)(()=>$347c34ac01fb689b$var$buildTriangulation(features), [
|
|
112
|
+
features
|
|
113
|
+
]);
|
|
114
|
+
const currentIndex = (0, $4ZhRb$useMemo)(()=>{
|
|
115
|
+
return features.findIndex((d)=>d.properties.col_id == col_id);
|
|
116
|
+
}, [
|
|
117
|
+
features,
|
|
118
|
+
col_id
|
|
119
|
+
]);
|
|
120
|
+
const neighbors = tri.delaunay.neighbors[currentIndex];
|
|
121
|
+
const keyMapping = (0, $4ZhRb$useMemo)(()=>{
|
|
122
|
+
return $347c34ac01fb689b$var$buildKeyMapping(neighbors, centroids, currentIndex, projection);
|
|
123
|
+
}, [
|
|
124
|
+
neighbors,
|
|
125
|
+
currentIndex
|
|
126
|
+
]);
|
|
127
|
+
(0, $4ZhRb$useKeyHandler)((event)=>{
|
|
128
|
+
const nextColumnIx = keyMapping[event.keyCode];
|
|
129
|
+
if (nextColumnIx == null) return;
|
|
130
|
+
const { col_id: col_id } = features[nextColumnIx].properties;
|
|
131
|
+
// @ts-ignore
|
|
132
|
+
onChange({
|
|
133
|
+
col_id: col_id,
|
|
134
|
+
...projectArgs
|
|
135
|
+
});
|
|
136
|
+
}, [
|
|
137
|
+
keyMapping
|
|
138
|
+
]);
|
|
139
|
+
if (neighbors == null) return null;
|
|
140
|
+
const neighborFeatures = neighbors.map((d)=>features[d]);
|
|
141
|
+
return (0, $4ZhRb$macrostrathyper).if(showLayers)([
|
|
142
|
+
(0, $4ZhRb$macrostrathyper)((0, $4ZhRb$FeatureLayer), {
|
|
143
|
+
features: tri.links().features,
|
|
144
|
+
useCanvas: false,
|
|
145
|
+
style: {
|
|
146
|
+
stroke: "purple",
|
|
147
|
+
fill: "transparent"
|
|
148
|
+
}
|
|
149
|
+
}),
|
|
150
|
+
(0, $4ZhRb$macrostrathyper)((0, $4ZhRb$FeatureLayer), {
|
|
151
|
+
features: neighborFeatures,
|
|
152
|
+
useCanvas: false,
|
|
153
|
+
style: {
|
|
154
|
+
stroke: "rgb(93, 101, 212)",
|
|
155
|
+
strokeWidth: 3,
|
|
156
|
+
fill: "rgba(93, 101, 212, 0.5)"
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
]);
|
|
160
|
+
}
|
|
161
|
+
function $347c34ac01fb689b$var$processGeoJSON(res) {
|
|
162
|
+
return $347c34ac01fb689b$var$processGeoJSONBare(res?.success?.data);
|
|
163
|
+
}
|
|
164
|
+
function $347c34ac01fb689b$var$processGeoJSONBare(res) {
|
|
165
|
+
return res?.features;
|
|
166
|
+
}
|
|
167
|
+
const $347c34ac01fb689b$var$processors = {
|
|
168
|
+
topojson: $347c34ac01fb689b$export$4ad66a3119e1afaa,
|
|
169
|
+
geojson: $347c34ac01fb689b$var$processGeoJSON,
|
|
170
|
+
geojson_bare: $347c34ac01fb689b$var$processGeoJSONBare
|
|
171
|
+
};
|
|
172
|
+
function $347c34ac01fb689b$export$6b70218db02fa4ce({ apiRoute: apiRoute = "/columns", status_code: status_code, project_id: project_id, format: format = "topojson" }) {
|
|
173
|
+
let all = undefined;
|
|
174
|
+
if (status_code == null && project_id == null) all = true;
|
|
175
|
+
const processor = $347c34ac01fb689b$var$processors[format];
|
|
176
|
+
return (0, $4ZhRb$useAPIResult)(apiRoute, {
|
|
177
|
+
format: format,
|
|
178
|
+
all: all,
|
|
179
|
+
status_code: status_code,
|
|
180
|
+
project_id: project_id
|
|
181
|
+
}, processor);
|
|
182
|
+
}
|
|
183
|
+
const $347c34ac01fb689b$export$f02cc02ad0e0bba3 = (props)=>{
|
|
184
|
+
const { apiRoute: apiRoute = "/columns", onChange: onChange, col_id: col_id = null, status_code: status_code, project_id: project_id, color: color, filterColumns: filterColumns, showDebugLayers: showDebugLayers = false, format: format = "topojson" } = props;
|
|
185
|
+
let features = $347c34ac01fb689b$export$6b70218db02fa4ce({
|
|
186
|
+
apiRoute: apiRoute,
|
|
187
|
+
status_code: status_code,
|
|
188
|
+
project_id: project_id,
|
|
189
|
+
format: format
|
|
190
|
+
});
|
|
191
|
+
if (features == null) return null;
|
|
192
|
+
if (filterColumns != null) features = features.filter(filterColumns);
|
|
193
|
+
return (0, $4ZhRb$macrostrathyper)([
|
|
194
|
+
(0, $4ZhRb$macrostrathyper)($347c34ac01fb689b$export$8c41dd563753848, {
|
|
195
|
+
features: features,
|
|
196
|
+
col_id: col_id,
|
|
197
|
+
onChange: onChange,
|
|
198
|
+
status_code: status_code,
|
|
199
|
+
project_id: project_id,
|
|
200
|
+
showLayers: showDebugLayers
|
|
201
|
+
}),
|
|
202
|
+
(0, $4ZhRb$macrostrathyper)($347c34ac01fb689b$export$f177ff57c101017a, {
|
|
203
|
+
features: features,
|
|
204
|
+
onClick: onChange,
|
|
205
|
+
color: color
|
|
206
|
+
})
|
|
207
|
+
]);
|
|
208
|
+
};
|
|
209
|
+
const $347c34ac01fb689b$export$4d8f6e6df85d9012 = (props)=>{
|
|
210
|
+
return (0, $4ZhRb$macrostrathyper)($347c34ac01fb689b$export$f02cc02ad0e0bba3, {
|
|
211
|
+
apiRoute: "/defs/columns",
|
|
212
|
+
...props
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
const $347c34ac01fb689b$export$b9d912252344e099 = (props)=>{
|
|
216
|
+
const { feature: feature } = props;
|
|
217
|
+
return (0, $4ZhRb$macrostrathyper)((0, $4ZhRb$FeatureLayer), {
|
|
218
|
+
features: [
|
|
219
|
+
feature
|
|
220
|
+
],
|
|
221
|
+
style: {
|
|
222
|
+
fill: "rgba(255,0,0,0.4)",
|
|
223
|
+
stroke: "rgba(255,0,0,0.6)",
|
|
224
|
+
strokeWidth: 2
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
export {$347c34ac01fb689b$export$2254347cd20e6080 as MeasurementsLayer, $347c34ac01fb689b$export$4ad66a3119e1afaa as processTopoJSON, $347c34ac01fb689b$export$f177ff57c101017a as ColumnFeatures, $347c34ac01fb689b$export$8c41dd563753848 as ColumnKeyboardNavigation, $347c34ac01fb689b$export$6b70218db02fa4ce as useColumnData, $347c34ac01fb689b$export$f02cc02ad0e0bba3 as Columns, $347c34ac01fb689b$export$4d8f6e6df85d9012 as ColumnCenters, $347c34ac01fb689b$export$b9d912252344e099 as CurrentColumn};
|
|
231
|
+
//# sourceMappingURL=layers.946aaa37.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;AAcA,MAAM,qCAAe;IACnB,MAAM;IACN,QAAQ;AACV;AAEO,SAAS,0CAAkB,KAAK;IACrC,MAAM,SAAE,QAAQ,oCAAc,GAAG,QAAQ,GAAG;IAC5C,MAAM,MAAW,CAAA,GAAA,mBAAW,EAAE,iBAAiB;QAC7C,GAAG,MAAM;QACT,QAAQ;QACR,UAAU;IACZ;IACA,IAAI,OAAO,MAAM,OAAO;IAExB,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,mBAAW,GAAG;QACrB,WAAW;eACX;QACA,UAAU,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAM,EAAE,UAAU,CAAC,OAAO,IAAI;IAC/D;AACF;AAMA,SAAS,0CAAgB,GAAG;IAC1B,IAAI;QACF,MAAM,QAAE,IAAI,EAAE,GAAG,IAAI,OAAO;QAC5B,MAAM,EAAE,UAAU,CAAC,EAAE,GAAG,CAAA,GAAA,cAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM;QACzD,OAAO;IACT,EAAE,OAAO,KAAK;QACZ,QAAQ,KAAK,CAAC;QACd,OAAO,EAAE;IACX;AACF;AACA,SAAS,0CAAe,KAAK;IAC3B,MAAM,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,IAAI,WAAkB,0CAAc;kBAClC;qBACA;oBACA;gBACA;IACF;IAEA,IAAI,YAAY,MAAM,OAAO;IAE7B,IAAI,iBAAiB,MACnB,WAAW,SAAS,MAAM,CAAC;IAG7B,OAAO,CAAA,GAAA,sBAAA,EAAE;QACP,CAAA,GAAA,sBAAA,EAAE,0CAA0B;sBAC1B;oBACA;sBACA;yBACA;wBACA;YACA,YAAY;QACd;QACA,CAAA,GAAA,sBAAA,EAAE,2CAAgB;sBAAE;YAAU,SAAS;mBAAU;QAAM;KACxD;AACH;AAEA,MAAM,4CAAgB,CAAC;IACrB,OAAO,CAAA,GAAA,sBAAA,EAAE,2CAAS;QAAE,UAAU;QAAiB,GAAG,KAAK;IAAC;AAC1D;AAEA,MAAM,4CAAgB,CAAC;IACrB,MAAM,WAAE,OAAO,EAAE,GAAG;IACpB,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,mBAAW,GAAG;QACrB,UAAU;YAAC;SAAQ;QACnB,OAAO;YACL,MAAM;YACN,QAAQ;YACR,aAAa;QACf;IACF;AACF","sources":["packages/column-views/src/map/layers.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport {\n Feature,\n FeatureLayer,\n MapContext,\n} from \"@macrostrat/svg-map-components\";\nimport { useAPIResult, useKeyHandler } from \"@macrostrat/ui-components\";\nimport chroma from \"chroma-js\";\nimport { ExtendedFeature, geoCentroid } from \"d3-geo\";\nimport { geoVoronoi } from \"d3-geo-voronoi\";\nimport { FeatureCollection, GeometryCollection, Polygon } from \"geojson\";\nimport { useContext, useEffect, useMemo } from \"react\";\nimport { feature } from \"topojson-client\";\n\nconst defaultStyle = {\n fill: \"rgb(239, 180, 249)\",\n stroke: \"magenta\",\n};\n\nexport function MeasurementsLayer(props) {\n const { style = defaultStyle, ...params } = props;\n const res: any = useAPIResult(\"/measurements\", {\n ...params,\n format: \"geojson\",\n response: \"light\",\n });\n if (res == null) return null;\n\n return h(FeatureLayer, {\n useCanvas: false,\n style,\n features: res.features.filter((d) => d.properties.unit_id != null),\n });\n}\n\ntype ColumnProps = { col_id: number };\n\ntype ColumnFeature = ExtendedFeature<Polygon, ColumnProps>;\n\nfunction processTopoJSON(res) {\n try {\n const { data } = res.success;\n const { features: f } = feature(data, data.objects.output) as any;\n return f;\n } catch (err) {\n console.error(err);\n return [];\n }\n}\nfunction ColumnFeatures(props) {\n const {\n features,\n onClick,\n color = \"rgba(150,150,150, 1)\",\n singleFeature = true,\n } = props;\n\n const c = chroma(color);\n\n return h(\n FeatureLayer,\n {\n className: \"columns\",\n useCanvas: onClick == null,\n style: {\n fill: c.alpha(0.2).css(),\n stroke: c.alpha(0.4).css(),\n },\n },\n features.map((f) => {\n return h(Feature, {\n id: f.id ?? f.properties.col_id,\n onClick,\n feature: f,\n });\n })\n );\n}\n\nenum MacrostratStatusCode {\n InProcess = \"in process\",\n}\n\ninterface ColumnNavProps {\n col_id: number;\n status_code?: MacrostratStatusCode;\n project_id?: number;\n onChange(col_id: number): void;\n}\n\ninterface KeyboardNavProps extends ColumnNavProps {\n features: ColumnFeature[];\n showLayers: boolean;\n}\n\nfunction normalize(angle) {\n if (angle > Math.PI) {\n angle -= 2 * Math.PI;\n } else if (angle <= -Math.PI) {\n angle += 2 * Math.PI;\n }\n return angle;\n}\n\nfunction buildTriangulation(features) {\n console.log(\"Computing triangulation\");\n const centroids = features.map(geoCentroid);\n const tri = geoVoronoi(centroids);\n return { centroids, tri };\n}\n\nfunction buildKeyMapping(neighbors, centroids, currentIndex, projection) {\n if (neighbors == null) return;\n\n const currentCentroid = projection(centroids[currentIndex]);\n\n let edgeAngles = neighbors.map((index) => {\n const centroid = projection(centroids[index]);\n const dx = centroid[0] - currentCentroid[0];\n const dy = centroid[1] - currentCentroid[1];\n return { col_index: index, angle: Math.atan2(dy, dx) };\n });\n\n edgeAngles.sort((d) => d.angle);\n\n function closestAngle(num) {\n // Find closest angle in array of neighbors\n let curr = edgeAngles[0];\n for (let next of edgeAngles) {\n if (\n Math.abs(normalize(num - next.angle)) <\n Math.abs(normalize(num - curr.angle))\n ) {\n curr = next;\n }\n }\n return curr.col_index;\n }\n\n return {\n 37: closestAngle(Math.PI), // left\n 38: closestAngle((3 * Math.PI) / 2), // up\n 39: closestAngle(0), // right\n 40: closestAngle(Math.PI / 2), // down\n };\n}\n\nfunction ColumnKeyboardNavigation(props: KeyboardNavProps) {\n /** Keyboard navigation of columns using a Delaunay triangulation */\n const {\n features = [],\n col_id = null,\n onChange,\n showLayers = false,\n ...projectArgs\n } = props;\n const { projection } = useContext(MapContext);\n const { centroids, tri } = useMemo(\n () => buildTriangulation(features),\n [features]\n );\n\n const currentIndex = useMemo(() => {\n return features.findIndex((d) => d.properties.col_id == col_id);\n }, [features, col_id]);\n\n const neighbors = tri.delaunay.neighbors[currentIndex];\n\n const keyMapping = useMemo(() => {\n return buildKeyMapping(neighbors, centroids, currentIndex, projection);\n }, [neighbors, currentIndex]);\n\n useKeyHandler(\n (event) => {\n const nextColumnIx = keyMapping[event.keyCode];\n if (nextColumnIx == null) return;\n const { col_id } = features[nextColumnIx].properties;\n\n // @ts-ignore\n onChange({ col_id, ...projectArgs });\n },\n [keyMapping]\n );\n\n if (neighbors == null) return null;\n const neighborFeatures = neighbors.map((d) => features[d]);\n\n return h.if(showLayers)([\n h(FeatureLayer, {\n features: tri.links().features,\n useCanvas: false,\n style: {\n stroke: \"purple\",\n fill: \"transparent\",\n },\n }),\n h(FeatureLayer, {\n features: neighborFeatures,\n useCanvas: false,\n style: {\n stroke: \"rgb(93, 101, 212)\",\n strokeWidth: 3,\n fill: \"rgba(93, 101, 212, 0.5)\",\n },\n }),\n\n //h(FeatureLayer, {features: tri.centers, useCanvas: false})\n ]);\n}\n\nfunction processGeoJSON(res) {\n return processGeoJSONBare(res?.success?.data);\n}\n\nfunction processGeoJSONBare(res) {\n return res?.features;\n}\n\nconst processors = {\n topojson: processTopoJSON,\n geojson: processGeoJSON,\n geojson_bare: processGeoJSONBare,\n};\n\nfunction useColumnData({\n apiRoute = \"/columns\",\n status_code,\n project_id,\n format = \"topojson\",\n}) {\n let all: boolean = undefined;\n if (status_code == null && project_id == null) {\n all = true;\n }\n\n const processor = processors[format];\n\n return useAPIResult(\n apiRoute,\n { format, all, status_code, project_id },\n processor\n );\n}\n\ninterface ColumnExtraInfo {\n apiRoute?: string;\n color?: string;\n filterColumns?(d: ColumnFeature): boolean;\n showDebugLayers?: boolean;\n format?: \"topojson\" | \"geojson\";\n}\n\nconst Columns = (props: ColumnNavProps & ColumnExtraInfo) => {\n const {\n apiRoute = \"/columns\",\n onChange,\n col_id = null,\n status_code,\n project_id,\n color,\n filterColumns,\n showDebugLayers = false,\n format = \"topojson\",\n } = props;\n\n let features: any[] = useColumnData({\n apiRoute,\n status_code,\n project_id,\n format,\n }) as any;\n\n if (features == null) return null;\n\n if (filterColumns != null) {\n features = features.filter(filterColumns);\n }\n\n return h([\n h(ColumnKeyboardNavigation, {\n features,\n col_id,\n onChange,\n status_code,\n project_id,\n showLayers: showDebugLayers,\n }),\n h(ColumnFeatures, { features, onClick: onChange, color }),\n ]);\n};\n\nconst ColumnCenters = (props: ColumnNavProps) => {\n return h(Columns, { apiRoute: \"/defs/columns\", ...props });\n};\n\nconst CurrentColumn = (props) => {\n const { feature } = props;\n return h(FeatureLayer, {\n features: [feature],\n style: {\n fill: \"rgba(255,0,0,0.4)\",\n stroke: \"rgba(255,0,0,0.6)\",\n strokeWidth: 2,\n },\n });\n};\n\nexport {\n Columns,\n CurrentColumn,\n processTopoJSON,\n ColumnCenters,\n ColumnFeatures,\n ColumnKeyboardNavigation,\n useColumnData,\n};\n"],"names":[],"version":3,"file":"layers.946aaa37.js.map"}
|