@macrostrat/column-views 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -3
- package/dist/{age-axis.7ce58d66.js → esm/age-axis.64c509ee.js} +11 -11
- package/dist/{age-axis.7ce58d66.js.map → esm/age-axis.64c509ee.js.map} +1 -1
- package/dist/{boxes.6d3192e6.js → esm/boxes.13968b76.js} +26 -26
- package/dist/{boxes.6d3192e6.js.map → esm/boxes.13968b76.js.map} +1 -1
- package/dist/{boxes.module.dd631fe3.css → esm/boxes.module.28873d08.css} +1 -1
- package/dist/{boxes.module.dd631fe3.css.map → esm/boxes.module.28873d08.css.map} +1 -1
- package/dist/{boxes.module.998ff312.js → esm/boxes.module.605bdcd6.js} +1 -1
- package/dist/{boxes.module.998ff312.js.map → esm/boxes.module.605bdcd6.js.map} +1 -1
- package/dist/esm/carbon-isotopes.3b502a9e.js +11 -0
- package/dist/{carbon-isotopes.6d9bddcf.js.map → esm/carbon-isotopes.3b502a9e.js.map} +1 -1
- package/dist/{column.e35a471f.js → esm/column.8dd26e1a.js} +21 -21
- package/dist/{column.e35a471f.js.map → esm/column.8dd26e1a.js.map} +1 -1
- package/dist/{column.e901b5d4.js → esm/column.db058031.js} +17 -17
- package/dist/{column.e901b5d4.js.map → esm/column.db058031.js.map} +1 -1
- package/dist/{column.module.c9df6edf.css → esm/column.module.039d872c.css} +28 -15
- package/dist/esm/column.module.039d872c.css.map +1 -0
- package/dist/{column.module.35ba04e7.js → esm/column.module.7f47d25a.js} +1 -1
- package/dist/{column.module.35ba04e7.js.map → esm/column.module.7f47d25a.js.map} +1 -1
- package/dist/{column.module.35184ea7.css → esm/column.module.cbb072df.css} +1 -1
- package/dist/{column.module.35184ea7.css.map → esm/column.module.cbb072df.css.map} +1 -1
- package/dist/{column.module.2e29259c.js → esm/column.module.e632868a.js} +1 -4
- package/dist/esm/column.module.e632868a.js.map +1 -0
- package/dist/{composite.494beffc.js → esm/composite.608a4ca2.js} +20 -20
- package/dist/{composite.494beffc.js.map → esm/composite.608a4ca2.js.map} +1 -1
- package/dist/{composite.module.6359deba.js → esm/composite.module.0638e7ee.js} +1 -1
- package/dist/{composite.module.6359deba.js.map → esm/composite.module.0638e7ee.js.map} +1 -1
- package/dist/esm/composite.module.69a38fd1.css +4 -0
- package/dist/{composite.module.5cc0e747.css.map → esm/composite.module.69a38fd1.css.map} +1 -1
- package/dist/{core.f3824dd8.js → esm/core.4db8e452.js} +15 -15
- package/dist/{core.f3824dd8.js.map → esm/core.4db8e452.js.map} +1 -1
- package/dist/{data-area.f9bb9ad9.js → esm/data-area.daff8da0.js} +15 -15
- package/dist/{data-area.f9bb9ad9.js.map → esm/data-area.daff8da0.js.map} +1 -1
- package/dist/{data-provider.61ef7f9a.js → esm/data-provider.1506eb64.js} +8 -8
- package/dist/{data-provider.61ef7f9a.js.map → esm/data-provider.1506eb64.js.map} +1 -1
- package/dist/{helpers.2af05ee4.js → esm/helpers.8a03cfc7.js} +6 -6
- package/dist/{helpers.2af05ee4.js.map → esm/helpers.8a03cfc7.js.map} +1 -1
- package/dist/{index.js → esm/index.js} +8 -8
- package/dist/{index.module.de76feb2.css → esm/index.module.0844afd8.css} +1 -1
- package/dist/{index.module.de76feb2.css.map → esm/index.module.0844afd8.css.map} +1 -1
- package/dist/{index.module.8fad0020.js → esm/index.module.24fe3a2e.js} +1 -1
- package/dist/{index.module.8fad0020.js.map → esm/index.module.24fe3a2e.js.map} +1 -1
- package/dist/{isotopes-column.b5442b4d.js → esm/isotopes-column.7cb5cc45.js} +33 -33
- package/dist/{isotopes-column.b5442b4d.js.map → esm/isotopes-column.7cb5cc45.js.map} +1 -1
- package/dist/{layers.946aaa37.js → esm/layers.ad5fd25d.js} +31 -31
- package/dist/{layers.946aaa37.js.map → esm/layers.ad5fd25d.js.map} +1 -1
- package/dist/{map.e782010f.js → esm/map.7aa26f17.js} +17 -17
- package/dist/{map.e782010f.js.map → esm/map.7aa26f17.js.map} +1 -1
- package/dist/{names.ab14789e.js → esm/names.f6a4e9a4.js} +11 -11
- package/dist/{names.ab14789e.js.map → esm/names.f6a4e9a4.js.map} +1 -1
- package/dist/{providers.abcb2cbe.js → esm/providers.cd1e652f.js} +7 -7
- package/dist/{providers.abcb2cbe.js.map → esm/providers.cd1e652f.js.map} +1 -1
- package/dist/{resolvers.2949c4c0.js → esm/resolvers.b5c82b78.js} +1 -1
- package/dist/{resolvers.2949c4c0.js.map → esm/resolvers.b5c82b78.js.map} +1 -1
- package/dist/{section.6f6fc929.js → esm/section.cc1b1100.js} +19 -19
- package/dist/{section.6f6fc929.js.map → esm/section.cc1b1100.js.map} +1 -1
- package/dist/{selection-popover.7e008544.js → esm/selection-popover.17d1bd55.js} +9 -9
- package/dist/{selection-popover.7e008544.js.map → esm/selection-popover.17d1bd55.js.map} +1 -1
- package/dist/{selection-popover.module.2732ebc0.css → esm/selection-popover.module.0a701258.css} +1 -1
- package/dist/{selection-popover.module.2732ebc0.css.map → esm/selection-popover.module.0a701258.css.map} +1 -1
- package/dist/{selection-popover.module.fdbfb40e.js → esm/selection-popover.module.e22f5183.js} +1 -1
- package/dist/{selection-popover.module.fdbfb40e.js.map → esm/selection-popover.module.e22f5183.js.map} +1 -1
- package/dist/{selection.add9f8b0.js → esm/selection.bbf26d0e.js} +23 -23
- package/dist/{selection.add9f8b0.js.map → esm/selection.bbf26d0e.js.map} +1 -1
- package/dist/{store.c5271371.js → esm/store.25eaa168.js} +6 -6
- package/dist/{store.c5271371.js.map → esm/store.25eaa168.js.map} +1 -1
- package/dist/{types.ff938b22.js → esm/types.f016e032.js} +1 -1
- package/dist/{types.ff938b22.js.map → esm/types.f016e032.js.map} +1 -1
- package/dist/{unit-details.0c1edd00.js → esm/unit-details.56ff8b70.js} +30 -30
- package/dist/{unit-details.0c1edd00.js.map → esm/unit-details.56ff8b70.js.map} +1 -1
- package/dist/{units.5ec6a44c.js → esm/units.361088d4.js} +13 -13
- package/dist/{units.5ec6a44c.js.map → esm/units.361088d4.js.map} +1 -1
- package/dist/node/index.js +2 -0
- package/dist/node/index.js.map +1 -0
- package/package.json +19 -10
- package/src/column.module.sass +25 -12
- package/dist/carbon-isotopes.6d9bddcf.js +0 -11
- package/dist/column.module.2e29259c.js.map +0 -1
- package/dist/column.module.c9df6edf.css.map +0 -1
- package/dist/composite.module.5cc0e747.css +0 -4
- /package/dist/{index.d.ts → esm/index.d.ts} +0 -0
- /package/dist/{index.d.ts.map → esm/index.d.ts.map} +0 -0
- /package/dist/{index.js.map → esm/index.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
All notable changes to this project will be documented in this file. The format
|
|
4
|
+
is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this
|
|
5
|
+
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [1.0.2] - 2025-02-16
|
|
8
|
+
|
|
9
|
+
Improve column styles
|
|
10
|
+
|
|
11
|
+
## [1.0.1] - 2025-02-15
|
|
12
|
+
|
|
13
|
+
Add a `node` target to bundle without imported CSS
|
|
6
14
|
|
|
7
15
|
## [1.0.0] - 2025-02-14
|
|
8
16
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import $
|
|
2
|
-
import {ColumnContext as $
|
|
3
|
-
import {useContext as $
|
|
1
|
+
import $lfxOo$macrostrathyper from "@macrostrat/hyper";
|
|
2
|
+
import {ColumnContext as $lfxOo$ColumnContext, ColumnAxis as $lfxOo$ColumnAxis, ColumnSVG as $lfxOo$ColumnSVG} from "@macrostrat/column-components";
|
|
3
|
+
import {useContext as $lfxOo$useContext} from "react";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -8,13 +8,13 @@ import {useContext as $52nTP$useContext} from "react";
|
|
|
8
8
|
// import "@macrostrat/timescale/dist/timescale.css";
|
|
9
9
|
//
|
|
10
10
|
const $43794af7643cdf40$var$AgeAxisCore = ({ ticks: ticks, tickSpacing: tickSpacing = 40, showDomain: showDomain = false })=>{
|
|
11
|
-
const { pixelHeight: pixelHeight } = (0, $
|
|
11
|
+
const { pixelHeight: pixelHeight } = (0, $lfxOo$useContext)((0, $lfxOo$ColumnContext));
|
|
12
12
|
// A tick roughly every 40 pixels
|
|
13
13
|
let v = Math.max(Math.round(pixelHeight / tickSpacing), 1);
|
|
14
|
-
return (0, $
|
|
14
|
+
return (0, $lfxOo$macrostrathyper)("g.axis", {
|
|
15
15
|
transform: "translate(20 0)"
|
|
16
16
|
}, [
|
|
17
|
-
(0, $
|
|
17
|
+
(0, $lfxOo$macrostrathyper)((0, $lfxOo$ColumnAxis), {
|
|
18
18
|
ticks: v,
|
|
19
19
|
showDomain: showDomain
|
|
20
20
|
})
|
|
@@ -23,12 +23,12 @@ const $43794af7643cdf40$var$AgeAxisCore = ({ ticks: ticks, tickSpacing: tickSpac
|
|
|
23
23
|
function $43794af7643cdf40$export$25ce20521d0ab97d(props) {
|
|
24
24
|
const { ticks: ticks, tickSpacing: tickSpacing, showLabel: showLabel = true, paddingV: paddingV = 10, showDomain: showDomain, ...rest } = props;
|
|
25
25
|
// Not sure where this extra 5px comes from.
|
|
26
|
-
return (0, $
|
|
27
|
-
(0, $
|
|
28
|
-
(0, $
|
|
26
|
+
return (0, $lfxOo$macrostrathyper)("div.column.age-axis", [
|
|
27
|
+
(0, $lfxOo$macrostrathyper).if(showLabel)("div.age-axis-label", "Age (Ma)"),
|
|
28
|
+
(0, $lfxOo$macrostrathyper)((0, $lfxOo$ColumnSVG), {
|
|
29
29
|
paddingV: paddingV,
|
|
30
30
|
...rest
|
|
31
|
-
}, (0, $
|
|
31
|
+
}, (0, $lfxOo$macrostrathyper)($43794af7643cdf40$var$AgeAxisCore, {
|
|
32
32
|
ticks: ticks,
|
|
33
33
|
tickSpacing: tickSpacing,
|
|
34
34
|
showDomain: showDomain
|
|
@@ -38,4 +38,4 @@ function $43794af7643cdf40$export$25ce20521d0ab97d(props) {
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
export {$43794af7643cdf40$export$25ce20521d0ab97d as AgeAxis};
|
|
41
|
-
//# sourceMappingURL=age-axis.
|
|
41
|
+
//# sourceMappingURL=age-axis.64c509ee.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AAOA,qDAAqD;AACrD,EAAE;AACF,MAAM,oCAAc,CAAC,SAAE,KAAK,eAAE,cAAc,gBAAI,aAAa,OAAO;IAClE,MAAM,eAAE,WAAW,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,oBAAY;IAC/C,iCAAiC;IACjC,IAAI,IAAI,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,cAAc,cAAc;IAExD,OAAO,CAAA,GAAA,sBAAA,EAAE,UAAU;QAAE,WAAW;IAAkB,GAAG;QACnD,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,iBAAS,GAAG;YACZ,OAAO;wBACP;QACF;KACD;AACH;AAEO,SAAS,0CAAQ,KAAK;IAC3B,MAAM,SACJ,KAAK,eACL,WAAW,aACX,YAAY,gBACZ,WAAW,gBACX,UAAU,EACV,GAAG,MACJ,GAAG;IAEJ,4CAA4C;IAC5C,OAAO,CAAA,GAAA,sBAAA,EAAE,uBAAuB;QAC9B,CAAA,GAAA,sBAAA,EAAE,EAAE,CAAC,WAAW,sBAAsB;QACtC,CAAA,GAAA,sBAAA,EACE,CAAA,GAAA,gBAAQ,GACR;sBAAE;YAAU,GAAG,IAAI;QAAC,GACpB,CAAA,GAAA,sBAAA,EAAE,mCAAa;mBAAE;yBAAO;wBAAa;QAAW;KAEnD;AACH","sources":["packages/column-views/src/age-axis.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport {\n ColumnSVG,\n ColumnAxis,\n ColumnContext,\n} from \"@macrostrat/column-components\";\nimport { useContext } from \"react\";\n// import \"@macrostrat/timescale/dist/timescale.css\";\n//\nconst AgeAxisCore = ({ ticks, tickSpacing = 40, showDomain = false }) => {\n const { pixelHeight } = useContext(ColumnContext);\n // A tick roughly every 40 pixels\n let v = Math.max(Math.round(pixelHeight / tickSpacing), 1);\n\n return h(\"g.axis\", { transform: \"translate(20 0)\" }, [\n h(ColumnAxis, {\n ticks: v,\n showDomain,\n }),\n ]);\n};\n\nexport function AgeAxis(props) {\n const {\n ticks,\n tickSpacing,\n showLabel = true,\n paddingV = 10,\n showDomain,\n ...rest\n } = props;\n\n // Not sure where this extra 5px comes from.\n return h(\"div.column.age-axis\", [\n h.if(showLabel)(\"div.age-axis-label\", \"Age (Ma)\"),\n h(\n ColumnSVG,\n { paddingV, ...rest },\n h(AgeAxisCore, { ticks, tickSpacing, showDomain })\n ),\n ]);\n}\n"],"names":[],"version":3,"file":"age-axis.
|
|
1
|
+
{"mappings":";;;;;;;AAOA,qDAAqD;AACrD,EAAE;AACF,MAAM,oCAAc,CAAC,SAAE,KAAK,eAAE,cAAc,gBAAI,aAAa,OAAO;IAClE,MAAM,eAAE,WAAW,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,oBAAY;IAC/C,iCAAiC;IACjC,IAAI,IAAI,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,cAAc,cAAc;IAExD,OAAO,CAAA,GAAA,sBAAA,EAAE,UAAU;QAAE,WAAW;IAAkB,GAAG;QACnD,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,iBAAS,GAAG;YACZ,OAAO;wBACP;QACF;KACD;AACH;AAEO,SAAS,0CAAQ,KAAK;IAC3B,MAAM,SACJ,KAAK,eACL,WAAW,aACX,YAAY,gBACZ,WAAW,gBACX,UAAU,EACV,GAAG,MACJ,GAAG;IAEJ,4CAA4C;IAC5C,OAAO,CAAA,GAAA,sBAAA,EAAE,uBAAuB;QAC9B,CAAA,GAAA,sBAAA,EAAE,EAAE,CAAC,WAAW,sBAAsB;QACtC,CAAA,GAAA,sBAAA,EACE,CAAA,GAAA,gBAAQ,GACR;sBAAE;YAAU,GAAG,IAAI;QAAC,GACpB,CAAA,GAAA,sBAAA,EAAE,mCAAa;mBAAE;yBAAO;wBAAa;QAAW;KAEnD;AACH","sources":["packages/column-views/src/age-axis.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport {\n ColumnSVG,\n ColumnAxis,\n ColumnContext,\n} from \"@macrostrat/column-components\";\nimport { useContext } from \"react\";\n// import \"@macrostrat/timescale/dist/timescale.css\";\n//\nconst AgeAxisCore = ({ ticks, tickSpacing = 40, showDomain = false }) => {\n const { pixelHeight } = useContext(ColumnContext);\n // A tick roughly every 40 pixels\n let v = Math.max(Math.round(pixelHeight / tickSpacing), 1);\n\n return h(\"g.axis\", { transform: \"translate(20 0)\" }, [\n h(ColumnAxis, {\n ticks: v,\n showDomain,\n }),\n ]);\n};\n\nexport function AgeAxis(props) {\n const {\n ticks,\n tickSpacing,\n showLabel = true,\n paddingV = 10,\n showDomain,\n ...rest\n } = props;\n\n // Not sure where this extra 5px comes from.\n return h(\"div.column.age-axis\", [\n h.if(showLabel)(\"div.age-axis-label\", \"Age (Ma)\"),\n h(\n ColumnSVG,\n { paddingV, ...rest },\n h(AgeAxisCore, { ticks, tickSpacing, showDomain })\n ),\n ]);\n}\n"],"names":[],"version":3,"file":"age-axis.64c509ee.js.map"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {resolveID as $d3e69bd163d41f63$export$7be7d732f3de9464, scalePattern as $d3e69bd163d41f63$export$e8deec7b02ce51eb} from "./resolvers.
|
|
2
|
-
import {useSelectedUnit as $4d5d1c15f39f6a14$export$f0dd93f90aa8e5da, useUnitSelectionDispatch as $4d5d1c15f39f6a14$export$77a278d5ca56e309} from "./selection.
|
|
3
|
-
import {transformAxisType as $faf1eba02aecac6a$export$ab2a19f8a72df19b} from "./types.
|
|
4
|
-
import "./boxes.module.
|
|
5
|
-
import $
|
|
6
|
-
import {ColumnAxisType as $
|
|
7
|
-
import {SizeAwareLabel as $
|
|
8
|
-
import $
|
|
9
|
-
import {useContext as $
|
|
1
|
+
import {resolveID as $d3e69bd163d41f63$export$7be7d732f3de9464, scalePattern as $d3e69bd163d41f63$export$e8deec7b02ce51eb} from "./resolvers.b5c82b78.js";
|
|
2
|
+
import {useSelectedUnit as $4d5d1c15f39f6a14$export$f0dd93f90aa8e5da, useUnitSelectionDispatch as $4d5d1c15f39f6a14$export$77a278d5ca56e309} from "./selection.bbf26d0e.js";
|
|
3
|
+
import {transformAxisType as $faf1eba02aecac6a$export$ab2a19f8a72df19b} from "./types.f016e032.js";
|
|
4
|
+
import "./boxes.module.28873d08.css";
|
|
5
|
+
import $lClM8$boxesmodule605bdcd6js from "./boxes.module.605bdcd6.js";
|
|
6
|
+
import {ColumnAxisType as $lClM8$ColumnAxisType, ColumnContext as $lClM8$ColumnContext, ColumnLayoutContext as $lClM8$ColumnLayoutContext, useColumn as $lClM8$useColumn, useGeologicPattern as $lClM8$useGeologicPattern, ForeignObject as $lClM8$ForeignObject, PatternDefsProvider as $lClM8$PatternDefsProvider} from "@macrostrat/column-components";
|
|
7
|
+
import {SizeAwareLabel as $lClM8$SizeAwareLabel} from "@macrostrat/ui-components";
|
|
8
|
+
import $lClM8$macrostrathyper from "@macrostrat/hyper";
|
|
9
|
+
import {useContext as $lClM8$useContext, useRef as $lClM8$useRef, useCallback as $lClM8$useCallback, useEffect as $lClM8$useEffect, useMemo as $lClM8$useMemo} from "react";
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
function $parcel$interopDefault(a) {
|
|
@@ -20,11 +20,11 @@ function $parcel$interopDefault(a) {
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
const $d254716a820e9c85$var$h = (0, $
|
|
23
|
+
const $d254716a820e9c85$var$h = (0, $lClM8$macrostrathyper).styled((0, ($parcel$interopDefault($lClM8$boxesmodule605bdcd6js))));
|
|
24
24
|
function $d254716a820e9c85$var$useUnitRect(division, options = {}) {
|
|
25
|
-
const { widthFraction: widthFraction = 1, axisType: axisType = (0, $
|
|
26
|
-
const { scale: scale } = (0, $
|
|
27
|
-
const { width: width } = (0, $
|
|
25
|
+
const { widthFraction: widthFraction = 1, axisType: axisType = (0, $lClM8$ColumnAxisType).AGE } = options;
|
|
26
|
+
const { scale: scale } = (0, $lClM8$useContext)((0, $lClM8$ColumnContext));
|
|
27
|
+
const { width: width } = (0, $lClM8$useContext)((0, $lClM8$ColumnLayoutContext));
|
|
28
28
|
const macrostratAxisKey = (0, $faf1eba02aecac6a$export$ab2a19f8a72df19b)(axisType);
|
|
29
29
|
const t_key = "t_" + macrostratAxisKey;
|
|
30
30
|
const b_key = "b_" + macrostratAxisKey;
|
|
@@ -42,7 +42,7 @@ function $d254716a820e9c85$var$useUnitRect(division, options = {}) {
|
|
|
42
42
|
}
|
|
43
43
|
function $d254716a820e9c85$export$1d8b9ae22d404866(props) {
|
|
44
44
|
const { division: d, children: children, defaultFill: defaultFill = "transparent", className: className, widthFraction: widthFraction = 1, ...baseBounds } = props;
|
|
45
|
-
const { axisType: axisType } = (0, $
|
|
45
|
+
const { axisType: axisType } = (0, $lClM8$useColumn)();
|
|
46
46
|
const bounds = {
|
|
47
47
|
...$d254716a820e9c85$var$useUnitRect(d, {
|
|
48
48
|
widthFraction: widthFraction,
|
|
@@ -51,9 +51,9 @@ function $d254716a820e9c85$export$1d8b9ae22d404866(props) {
|
|
|
51
51
|
...baseBounds
|
|
52
52
|
};
|
|
53
53
|
const patternID = (0, $d3e69bd163d41f63$export$7be7d732f3de9464)(d);
|
|
54
|
-
const fill = (0, $
|
|
54
|
+
const fill = (0, $lClM8$useGeologicPattern)(patternID, defaultFill);
|
|
55
55
|
// Allow us to select this unit if in the proper context
|
|
56
|
-
const ref = (0, $
|
|
56
|
+
const ref = (0, $lClM8$useRef)();
|
|
57
57
|
const [selected, onClick] = $d254716a820e9c85$var$useUnitSelectionManager(ref, d);
|
|
58
58
|
return $d254716a820e9c85$var$h("g.unit", {
|
|
59
59
|
className: className
|
|
@@ -72,7 +72,7 @@ function $d254716a820e9c85$var$useUnitSelectionManager(ref, unit) {
|
|
|
72
72
|
const selectedUnit = (0, $4d5d1c15f39f6a14$export$f0dd93f90aa8e5da)();
|
|
73
73
|
const selected = selectedUnit?.unit_id == unit.unit_id;
|
|
74
74
|
const dispatch = (0, $4d5d1c15f39f6a14$export$77a278d5ca56e309)();
|
|
75
|
-
const onClick = (0, $
|
|
75
|
+
const onClick = (0, $lClM8$useCallback)((evt)=>{
|
|
76
76
|
dispatch(unit, ref.current, evt);
|
|
77
77
|
evt.stopPropagation();
|
|
78
78
|
}, [
|
|
@@ -80,7 +80,7 @@ function $d254716a820e9c85$var$useUnitSelectionManager(ref, unit) {
|
|
|
80
80
|
ref,
|
|
81
81
|
dispatch
|
|
82
82
|
]);
|
|
83
|
-
(0, $
|
|
83
|
+
(0, $lClM8$useEffect)(()=>{
|
|
84
84
|
if (!selected) return;
|
|
85
85
|
// In case we haven't set the position of the unit (if we don't have a target), set the selected unit
|
|
86
86
|
dispatch(unit, ref.current, null);
|
|
@@ -100,7 +100,7 @@ function $d254716a820e9c85$var$useUnitSelectionManager(ref, unit) {
|
|
|
100
100
|
}
|
|
101
101
|
function $d254716a820e9c85$export$b4f0ca233b98f9af(props) {
|
|
102
102
|
const { division: division, label: label, onLabelUpdated: onLabelUpdated, widthFraction: widthFraction, ...baseBounds } = props;
|
|
103
|
-
const { axisType: axisType } = (0, $
|
|
103
|
+
const { axisType: axisType } = (0, $lClM8$useColumn)();
|
|
104
104
|
const bounds = {
|
|
105
105
|
...$d254716a820e9c85$var$useUnitRect(division, {
|
|
106
106
|
widthFraction: widthFraction,
|
|
@@ -114,10 +114,10 @@ function $d254716a820e9c85$export$b4f0ca233b98f9af(props) {
|
|
|
114
114
|
division: division,
|
|
115
115
|
...bounds
|
|
116
116
|
}, [
|
|
117
|
-
$d254716a820e9c85$var$h((0, $
|
|
117
|
+
$d254716a820e9c85$var$h((0, $lClM8$ForeignObject), {
|
|
118
118
|
...bounds,
|
|
119
119
|
className: "unit-label-container"
|
|
120
|
-
}, $d254716a820e9c85$var$h((0, $
|
|
120
|
+
}, $d254716a820e9c85$var$h((0, $lClM8$SizeAwareLabel), {
|
|
121
121
|
className: "unit-overlay",
|
|
122
122
|
labelClassName: "unit-label",
|
|
123
123
|
style: {
|
|
@@ -133,18 +133,18 @@ function $d254716a820e9c85$export$b4f0ca233b98f9af(props) {
|
|
|
133
133
|
}
|
|
134
134
|
function $d254716a820e9c85$export$5d1cdfabe8dc8085(props) {
|
|
135
135
|
const { unitComponent: unitComponent = $d254716a820e9c85$export$1d8b9ae22d404866, unitComponentProps: unitComponentProps = {} } = props;
|
|
136
|
-
const { divisions: divisions } = (0, $
|
|
136
|
+
const { divisions: divisions } = (0, $lClM8$useContext)((0, $lClM8$ColumnContext));
|
|
137
137
|
if (divisions.length == 0) {
|
|
138
138
|
console.warn("No divisions found in column context");
|
|
139
139
|
return null;
|
|
140
140
|
}
|
|
141
|
-
const children = (0, $
|
|
141
|
+
const children = (0, $lClM8$useMemo)(()=>{
|
|
142
142
|
return divisions.map((division, i)=>{
|
|
143
143
|
// @ts-ignore
|
|
144
144
|
return $d254716a820e9c85$var$h(unitComponent, {
|
|
145
145
|
division: division,
|
|
146
146
|
key: division.unit_id,
|
|
147
|
-
axisType: (0, $
|
|
147
|
+
axisType: (0, $lClM8$ColumnAxisType).HEIGHT,
|
|
148
148
|
...unitComponentProps
|
|
149
149
|
});
|
|
150
150
|
});
|
|
@@ -153,7 +153,7 @@ function $d254716a820e9c85$export$5d1cdfabe8dc8085(props) {
|
|
|
153
153
|
unitComponent,
|
|
154
154
|
unitComponentProps
|
|
155
155
|
]);
|
|
156
|
-
return $d254716a820e9c85$var$h((0, $
|
|
156
|
+
return $d254716a820e9c85$var$h((0, $lClM8$PatternDefsProvider), {
|
|
157
157
|
resolveID: $d3e69bd163d41f63$export$7be7d732f3de9464,
|
|
158
158
|
scalePattern: $d3e69bd163d41f63$export$e8deec7b02ce51eb
|
|
159
159
|
}, $d254716a820e9c85$var$h("g.divisions", children));
|
|
@@ -161,4 +161,4 @@ function $d254716a820e9c85$export$5d1cdfabe8dc8085(props) {
|
|
|
161
161
|
|
|
162
162
|
|
|
163
163
|
export {$d254716a820e9c85$export$1d8b9ae22d404866 as Unit, $d254716a820e9c85$export$b4f0ca233b98f9af as LabeledUnit, $d254716a820e9c85$export$5d1cdfabe8dc8085 as UnitBoxes};
|
|
164
|
-
//# sourceMappingURL=boxes.
|
|
164
|
+
//# sourceMappingURL=boxes.13968b76.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAkC5B,SAAS,kCACP,QAAe,EACf,UAA2B,CAAC,CAAC;IAE7B,MAAM,iBAAE,gBAAgB,aAAG,WAAW,CAAA,GAAA,qBAAa,EAAE,GAAG,EAAE,GAAG;IAC7D,MAAM,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,oBAAY;IACzC,MAAM,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0BAAkB;IAC/C,MAAM,oBAAoB,CAAA,GAAA,yCAAgB,EAAE;IAC5C,MAAM,QAAQ,OAAO;IACrB,MAAM,QAAQ,OAAO;IAErB,MAAM,YAAY,QAAQ,CAAC,MAAM;IACjC,MAAM,eAAe,QAAQ,CAAC,MAAM;IACpC,IAAI,aAAa,QAAQ,gBAAgB,MACvC,QAAQ,IAAI,CACV,CAAC,aAAa,EAAE,MAAM,KAAK,EAAE,MAAM,KAAK,EAAE,SAAS,OAAO,CAAC,EAAE,EAAE,SAAS,SAAS,CAAC,CAAC,CAAC;IAIxF,MAAM,IAA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;QAAW;QAAe;KAAmB;IAEjD,OAAO,wBACL,CAAA,GAAA,0BAAkB,GAClB;mBAAE;sBAAW;IAAa,GAC1B,wBAAE,eAAe;AAErB","sources":["packages/column-views/src/units/boxes.ts"],"sourcesContent":["import {\n ColumnAxisType,\n ColumnContext,\n ColumnLayoutContext,\n ForeignObject,\n PatternDefsProvider,\n useColumn,\n useGeologicPattern,\n} from \"@macrostrat/column-components\";\nimport { SizeAwareLabel, Clickable } from \"@macrostrat/ui-components\";\nimport hyper from \"@macrostrat/hyper\";\nimport {\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport { resolveID, scalePattern } from \"./resolvers\";\nimport { useSelectedUnit, useUnitSelectionDispatch } from \"./selection\";\nimport { IUnit, transformAxisType } from \"./types\";\nimport styles from \"./boxes.module.sass\";\n\nconst h = hyper.styled(styles);\n\nexport interface RectBounds {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\ninterface UnitRectOptions {\n widthFraction?: number;\n axisType?: ColumnAxisType;\n}\n\ninterface UnitProps extends Clickable, Partial<RectBounds>, UnitRectOptions {\n division: IUnit;\n resolveID?(IUnit): string;\n UUID?: string;\n defaultFill?: string;\n widthFraction?: number;\n children?: ReactNode;\n className?: string;\n}\n\nexport interface LabeledUnitProps\n extends UnitRectOptions,\n Clickable,\n Partial<RectBounds> {\n division: IUnit;\n label: string;\n onLabelUpdated?(label: string, shown: boolean);\n halfWidth?: boolean;\n}\n\nfunction useUnitRect(\n division: IUnit,\n options: UnitRectOptions = {}\n): RectBounds {\n const { widthFraction = 1, axisType = ColumnAxisType.AGE } = options;\n const { scale } = useContext(ColumnContext);\n const { width } = useContext(ColumnLayoutContext);\n const macrostratAxisKey = transformAxisType(axisType);\n const t_key = \"t_\" + macrostratAxisKey;\n const b_key = \"b_\" + macrostratAxisKey;\n\n const topHeight = division[t_key];\n const bottomHeight = division[b_key];\n if (topHeight == null && bottomHeight == null) {\n console.warn(\n `Missing keys ${t_key} and ${b_key} for ${division.unit_id} (${division.unit_name})`\n );\n }\n\n const y = scale(topHeight);\n const height = Math.abs(scale(bottomHeight) - y);\n\n return {\n x: width * (1 - widthFraction),\n y,\n height,\n width: widthFraction * width,\n };\n}\n\nfunction Unit(props: UnitProps) {\n const {\n division: d,\n children,\n defaultFill = \"transparent\",\n className,\n widthFraction = 1,\n ...baseBounds\n } = props;\n\n const { axisType } = useColumn();\n const bounds = {\n ...useUnitRect(d, { widthFraction, axisType }),\n ...baseBounds,\n };\n const patternID = resolveID(d);\n const fill = useGeologicPattern(patternID, defaultFill);\n // Allow us to select this unit if in the proper context\n\n const ref = useRef<HTMLElement>();\n\n const [selected, onClick] = useUnitSelectionManager(ref, d);\n\n return h(\"g.unit\", { className }, [\n h(\"rect.unit\", {\n ref,\n ...bounds,\n fill,\n onClick,\n }),\n h.if(selected)(\"rect.selection-overlay\", bounds),\n children,\n ]);\n}\n\nfunction useUnitSelectionManager(\n ref: React.RefObject<HTMLElement>,\n unit: IUnit\n): [boolean, (evt: Event) => void] {\n const selectedUnit = useSelectedUnit();\n const selected = selectedUnit?.unit_id == unit.unit_id;\n\n const dispatch = useUnitSelectionDispatch();\n\n const onClick = useCallback(\n (evt: Event) => {\n dispatch(unit, ref.current, evt);\n evt.stopPropagation();\n },\n [unit, ref, dispatch]\n );\n\n useEffect(() => {\n if (!selected) return;\n // In case we haven't set the position of the unit (if we don't have a target), set the selected unit\n dispatch(unit, ref.current, null);\n\n // Scroll the unit into view\n ref.current?.scrollIntoView({\n behavior: \"smooth\",\n block: \"center\",\n inline: \"nearest\",\n });\n }, [selected]);\n\n return [selected, onClick];\n}\n\nfunction LabeledUnit(props: LabeledUnitProps) {\n const { division, label, onLabelUpdated, widthFraction, ...baseBounds } =\n props;\n\n const { axisType } = useColumn();\n const bounds = {\n ...useUnitRect(division, { widthFraction, axisType }),\n ...baseBounds,\n };\n const { width, height } = bounds;\n return h(Unit, { className: \"labeled-unit\", division, ...bounds }, [\n h(\n ForeignObject,\n { ...bounds, className: \"unit-label-container\" },\n h(SizeAwareLabel, {\n className: \"unit-overlay\",\n labelClassName: \"unit-label\",\n style: { width, height },\n label,\n onVisibilityChanged(viz) {\n onLabelUpdated(label, viz);\n },\n })\n ),\n ]);\n}\n\nfunction UnitBoxes<T>(props: {\n unitComponent: React.FunctionComponent<{ division: T }>;\n unitComponentProps?: any;\n transformDivisions?(divisions: T[]): T[];\n transformDivision?: (\n division: any,\n index: number,\n divisions: any[]\n ) => T | null;\n}) {\n const { unitComponent = Unit, unitComponentProps = {} } = props;\n const { divisions } = useContext(ColumnContext);\n\n if (divisions.length == 0) {\n console.warn(\"No divisions found in column context\");\n return null;\n }\n\n const children = useMemo(() => {\n return divisions.map((division: any, i) => {\n // @ts-ignore\n return h(unitComponent, {\n division,\n key: division.unit_id,\n axisType: ColumnAxisType.HEIGHT,\n ...unitComponentProps,\n });\n });\n }, [divisions, unitComponent, unitComponentProps]);\n\n return h(\n PatternDefsProvider,\n { resolveID, scalePattern },\n h(\"g.divisions\", children)\n );\n}\n\nexport { LabeledUnit, Unit, UnitBoxes, UnitProps };\n"],"names":[],"version":3,"file":"boxes.
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAkC5B,SAAS,kCACP,QAAe,EACf,UAA2B,CAAC,CAAC;IAE7B,MAAM,iBAAE,gBAAgB,aAAG,WAAW,CAAA,GAAA,qBAAa,EAAE,GAAG,EAAE,GAAG;IAC7D,MAAM,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,oBAAY;IACzC,MAAM,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0BAAkB;IAC/C,MAAM,oBAAoB,CAAA,GAAA,yCAAgB,EAAE;IAC5C,MAAM,QAAQ,OAAO;IACrB,MAAM,QAAQ,OA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CAAC;QACb,OAAO;IACT;IAEA,MAAM,WAAW,CAAA,GAAA,cAAM,EAAE;QACvB,OAAO,UAAU,GAAG,CAAC,CAAC,UAAe;YACnC,aAAa;YACb,OAAO,wBAAE,eAAe;0BACtB;gBACA,KAAK,SAAS,OAAO;gBACrB,UAAU,CAAA,GAAA,qBAAa,EAAE,MAAM;gBAC/B,GAAG,kBAAkB;YACvB;QACF;IACF,GAAG;QAAC;QAAW;QAAe;KAAmB;IAEjD,OAAO,wBACL,CAAA,GAAA,0BAAkB,GAClB;mBAAE;sBAAW;IAAa,GAC1B,wBAAE,eAAe;AAErB","sources":["packages/column-views/src/units/boxes.ts"],"sourcesContent":["import {\n ColumnAxisType,\n ColumnContext,\n ColumnLayoutContext,\n ForeignObject,\n PatternDefsProvider,\n useColumn,\n useGeologicPattern,\n} from \"@macrostrat/column-components\";\nimport { SizeAwareLabel, Clickable } from \"@macrostrat/ui-components\";\nimport hyper from \"@macrostrat/hyper\";\nimport {\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport { resolveID, scalePattern } from \"./resolvers\";\nimport { useSelectedUnit, useUnitSelectionDispatch } from \"./selection\";\nimport { IUnit, transformAxisType } from \"./types\";\nimport styles from \"./boxes.module.sass\";\n\nconst h = hyper.styled(styles);\n\nexport interface RectBounds {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\ninterface UnitRectOptions {\n widthFraction?: number;\n axisType?: ColumnAxisType;\n}\n\ninterface UnitProps extends Clickable, Partial<RectBounds>, UnitRectOptions {\n division: IUnit;\n resolveID?(IUnit): string;\n UUID?: string;\n defaultFill?: string;\n widthFraction?: number;\n children?: ReactNode;\n className?: string;\n}\n\nexport interface LabeledUnitProps\n extends UnitRectOptions,\n Clickable,\n Partial<RectBounds> {\n division: IUnit;\n label: string;\n onLabelUpdated?(label: string, shown: boolean);\n halfWidth?: boolean;\n}\n\nfunction useUnitRect(\n division: IUnit,\n options: UnitRectOptions = {}\n): RectBounds {\n const { widthFraction = 1, axisType = ColumnAxisType.AGE } = options;\n const { scale } = useContext(ColumnContext);\n const { width } = useContext(ColumnLayoutContext);\n const macrostratAxisKey = transformAxisType(axisType);\n const t_key = \"t_\" + macrostratAxisKey;\n const b_key = \"b_\" + macrostratAxisKey;\n\n const topHeight = division[t_key];\n const bottomHeight = division[b_key];\n if (topHeight == null && bottomHeight == null) {\n console.warn(\n `Missing keys ${t_key} and ${b_key} for ${division.unit_id} (${division.unit_name})`\n );\n }\n\n const y = scale(topHeight);\n const height = Math.abs(scale(bottomHeight) - y);\n\n return {\n x: width * (1 - widthFraction),\n y,\n height,\n width: widthFraction * width,\n };\n}\n\nfunction Unit(props: UnitProps) {\n const {\n division: d,\n children,\n defaultFill = \"transparent\",\n className,\n widthFraction = 1,\n ...baseBounds\n } = props;\n\n const { axisType } = useColumn();\n const bounds = {\n ...useUnitRect(d, { widthFraction, axisType }),\n ...baseBounds,\n };\n const patternID = resolveID(d);\n const fill = useGeologicPattern(patternID, defaultFill);\n // Allow us to select this unit if in the proper context\n\n const ref = useRef<HTMLElement>();\n\n const [selected, onClick] = useUnitSelectionManager(ref, d);\n\n return h(\"g.unit\", { className }, [\n h(\"rect.unit\", {\n ref,\n ...bounds,\n fill,\n onClick,\n }),\n h.if(selected)(\"rect.selection-overlay\", bounds),\n children,\n ]);\n}\n\nfunction useUnitSelectionManager(\n ref: React.RefObject<HTMLElement>,\n unit: IUnit\n): [boolean, (evt: Event) => void] {\n const selectedUnit = useSelectedUnit();\n const selected = selectedUnit?.unit_id == unit.unit_id;\n\n const dispatch = useUnitSelectionDispatch();\n\n const onClick = useCallback(\n (evt: Event) => {\n dispatch(unit, ref.current, evt);\n evt.stopPropagation();\n },\n [unit, ref, dispatch]\n );\n\n useEffect(() => {\n if (!selected) return;\n // In case we haven't set the position of the unit (if we don't have a target), set the selected unit\n dispatch(unit, ref.current, null);\n\n // Scroll the unit into view\n ref.current?.scrollIntoView({\n behavior: \"smooth\",\n block: \"center\",\n inline: \"nearest\",\n });\n }, [selected]);\n\n return [selected, onClick];\n}\n\nfunction LabeledUnit(props: LabeledUnitProps) {\n const { division, label, onLabelUpdated, widthFraction, ...baseBounds } =\n props;\n\n const { axisType } = useColumn();\n const bounds = {\n ...useUnitRect(division, { widthFraction, axisType }),\n ...baseBounds,\n };\n const { width, height } = bounds;\n return h(Unit, { className: \"labeled-unit\", division, ...bounds }, [\n h(\n ForeignObject,\n { ...bounds, className: \"unit-label-container\" },\n h(SizeAwareLabel, {\n className: \"unit-overlay\",\n labelClassName: \"unit-label\",\n style: { width, height },\n label,\n onVisibilityChanged(viz) {\n onLabelUpdated(label, viz);\n },\n })\n ),\n ]);\n}\n\nfunction UnitBoxes<T>(props: {\n unitComponent: React.FunctionComponent<{ division: T }>;\n unitComponentProps?: any;\n transformDivisions?(divisions: T[]): T[];\n transformDivision?: (\n division: any,\n index: number,\n divisions: any[]\n ) => T | null;\n}) {\n const { unitComponent = Unit, unitComponentProps = {} } = props;\n const { divisions } = useContext(ColumnContext);\n\n if (divisions.length == 0) {\n console.warn(\"No divisions found in column context\");\n return null;\n }\n\n const children = useMemo(() => {\n return divisions.map((division: any, i) => {\n // @ts-ignore\n return h(unitComponent, {\n division,\n key: division.unit_id,\n axisType: ColumnAxisType.HEIGHT,\n ...unitComponentProps,\n });\n });\n }, [divisions, unitComponent, unitComponentProps]);\n\n return h(\n PatternDefsProvider,\n { resolveID, scalePattern },\n h(\"g.divisions\", children)\n );\n}\n\nexport { LabeledUnit, Unit, UnitBoxes, UnitProps };\n"],"names":[],"version":3,"file":"boxes.13968b76.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAA","sources":["packages/column-views/src/units/boxes.module.sass"],"sourcesContent":[".unit-label-container\n pointer-events: none\n\n"],"names":[],"version":3,"file":"boxes.module.
|
|
1
|
+
{"mappings":"AAAA","sources":["packages/column-views/src/units/boxes.module.sass"],"sourcesContent":[".unit-label-container\n pointer-events: none\n\n"],"names":[],"version":3,"file":"boxes.module.28873d08.css.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AAAA,IAAA;AAAA,4CAAyC,CAAC,2BAA2B,CAAC","sources":["packages/column-views/src/units/boxes.module.sass"],"sourcesContent":[".unit-label-container\n pointer-events: none\n\n"],"names":[],"version":3,"file":"boxes.module.
|
|
1
|
+
{"mappings":";;;;;;;AAAA,IAAA;AAAA,4CAAyC,CAAC,2BAA2B,CAAC","sources":["packages/column-views/src/units/boxes.module.sass"],"sourcesContent":[".unit-label-container\n pointer-events: none\n\n"],"names":[],"version":3,"file":"boxes.module.605bdcd6.js.map"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {IsotopesDataset as $d5a3eba6c540ff58$export$c69bd0285aa5d775, IsotopesColumn as $d5a3eba6c540ff58$export$5d8aa8022c284748} from "./isotopes-column.7cb5cc45.js";
|
|
2
|
+
import {MeasurementDataContext as $8adf39b8c41fe3cc$export$c644ef985ce7a4c4, MeasurementDataProvider as $8adf39b8c41fe3cc$export$5f01d5b342a89841, useMeasurementData as $8adf39b8c41fe3cc$export$8a0335fd9ff72150} from "./data-provider.1506eb64.js";
|
|
3
|
+
import {CarbonIsotopesColumn as $5cc70deb5088007a$export$883edafebdc6d87e, CarbonIsotopesApp as $5cc70deb5088007a$export$e2beef9ae524c9d5} from "./core.4db8e452.js";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export {$d5a3eba6c540ff58$export$c69bd0285aa5d775 as IsotopesDataset, $d5a3eba6c540ff58$export$5d8aa8022c284748 as IsotopesColumn, $8adf39b8c41fe3cc$export$c644ef985ce7a4c4 as MeasurementDataContext, $8adf39b8c41fe3cc$export$5f01d5b342a89841 as MeasurementDataProvider, $8adf39b8c41fe3cc$export$8a0335fd9ff72150 as useMeasurementData, $5cc70deb5088007a$export$883edafebdc6d87e as CarbonIsotopesColumn, $5cc70deb5088007a$export$e2beef9ae524c9d5 as CarbonIsotopesApp};
|
|
11
|
+
//# sourceMappingURL=carbon-isotopes.3b502a9e.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"","sources":["packages/column-views/src/carbon-isotopes/index.ts"],"sourcesContent":["export * from \"./isotopes-column\";\nexport * from \"./data-provider\";\nexport * from \"./core\";\n"],"names":[],"version":3,"file":"carbon-isotopes.
|
|
1
|
+
{"mappings":"","sources":["packages/column-views/src/carbon-isotopes/index.ts"],"sourcesContent":["export * from \"./isotopes-column\";\nexport * from \"./data-provider\";\nexport * from \"./core\";\n"],"names":[],"version":3,"file":"carbon-isotopes.3b502a9e.js.map"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import $
|
|
2
|
-
import "./column.module.
|
|
3
|
-
import {TrackedLabeledUnit as $8c8238faa5cde49c$export$f613830566442374} from "./composite.
|
|
4
|
-
import {UnitSelectionProvider as $4d5d1c15f39f6a14$export$f19d75b1d4b676a4, useUnitSelectionDispatch as $4d5d1c15f39f6a14$export$77a278d5ca56e309, UnitKeyboardNavigation as $4d5d1c15f39f6a14$export$70f5ee19650fc7d1} from "./selection.
|
|
5
|
-
import {UnitSelectionPopover as $80d4db83aa9ba807$export$db1115efab13710d} from "./selection-popover.
|
|
6
|
-
import {MacrostratUnitsProvider as $1fcb9b8d7da394a3$export$e5fe24ae4f287040} from "./store.
|
|
7
|
-
import {Section as $7d0f52717c0de7e1$export$6e2c8f0811a474ce} from "./section.
|
|
8
|
-
import {ensureArray as $2c60de495788ce61$export$d0c8ecbd4ed8940c, groupUnitsIntoSections as $2c60de495788ce61$export$dfbd00399d639b4c, _mergeOverlappingSections as $2c60de495788ce61$export$ec445c47b6e5d2d} from "./helpers.
|
|
9
|
-
import {ColumnLayoutContext as $
|
|
10
|
-
import {hyperStyled as $
|
|
11
|
-
import {useDarkMode as $
|
|
12
|
-
import $
|
|
13
|
-
import {useContext as $
|
|
1
|
+
import $bTsJU$columnmodulee632868ajs from "./column.module.e632868a.js";
|
|
2
|
+
import "./column.module.039d872c.css";
|
|
3
|
+
import {TrackedLabeledUnit as $8c8238faa5cde49c$export$f613830566442374} from "./composite.608a4ca2.js";
|
|
4
|
+
import {UnitSelectionProvider as $4d5d1c15f39f6a14$export$f19d75b1d4b676a4, useUnitSelectionDispatch as $4d5d1c15f39f6a14$export$77a278d5ca56e309, UnitKeyboardNavigation as $4d5d1c15f39f6a14$export$70f5ee19650fc7d1} from "./selection.bbf26d0e.js";
|
|
5
|
+
import {UnitSelectionPopover as $80d4db83aa9ba807$export$db1115efab13710d} from "./selection-popover.17d1bd55.js";
|
|
6
|
+
import {MacrostratUnitsProvider as $1fcb9b8d7da394a3$export$e5fe24ae4f287040} from "./store.25eaa168.js";
|
|
7
|
+
import {Section as $7d0f52717c0de7e1$export$6e2c8f0811a474ce} from "./section.cc1b1100.js";
|
|
8
|
+
import {ensureArray as $2c60de495788ce61$export$d0c8ecbd4ed8940c, groupUnitsIntoSections as $2c60de495788ce61$export$dfbd00399d639b4c, _mergeOverlappingSections as $2c60de495788ce61$export$ec445c47b6e5d2d} from "./helpers.8a03cfc7.js";
|
|
9
|
+
import {ColumnLayoutContext as $bTsJU$ColumnLayoutContext} from "@macrostrat/column-components";
|
|
10
|
+
import {hyperStyled as $bTsJU$hyperStyled} from "@macrostrat/hyper";
|
|
11
|
+
import {useDarkMode as $bTsJU$useDarkMode} from "@macrostrat/ui-components";
|
|
12
|
+
import $bTsJU$classnames from "classnames";
|
|
13
|
+
import {useContext as $bTsJU$useContext, createRef as $bTsJU$createRef, useState as $bTsJU$useState, useMemo as $bTsJU$useMemo} from "react";
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
function $parcel$interopDefault(a) {
|
|
@@ -27,9 +27,9 @@ function $parcel$interopDefault(a) {
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
const $2118f0266dc7e955$var$h = (0, $
|
|
30
|
+
const $2118f0266dc7e955$var$h = (0, $bTsJU$hyperStyled)((0, ($parcel$interopDefault($bTsJU$columnmodulee632868ajs))));
|
|
31
31
|
function $2118f0266dc7e955$export$48a4cacf2b7a4441({ division: division, nColumns: nColumns = 2, ...rest }) {
|
|
32
|
-
const { width: width } = (0, $
|
|
32
|
+
const { width: width } = (0, $bTsJU$useContext)((0, $bTsJU$ColumnLayoutContext));
|
|
33
33
|
//const nCols = Math.min(nColumns, division.overlappingUnits.length+1)
|
|
34
34
|
//console.log(division);
|
|
35
35
|
return $2118f0266dc7e955$var$h((0, $8c8238faa5cde49c$export$f613830566442374), {
|
|
@@ -53,9 +53,9 @@ function $2118f0266dc7e955$var$sectionClassName(section) {
|
|
|
53
53
|
}
|
|
54
54
|
function $2118f0266dc7e955$export$816b5d811295e6bc(props) {
|
|
55
55
|
const { showUnitPopover: showUnitPopover = false, ...rest } = props;
|
|
56
|
-
const ref = (0, $
|
|
56
|
+
const ref = (0, $bTsJU$createRef)();
|
|
57
57
|
// Selected item position
|
|
58
|
-
const [position, setPosition] = (0, $
|
|
58
|
+
const [position, setPosition] = (0, $bTsJU$useState)(null);
|
|
59
59
|
if (!showUnitPopover) return $2118f0266dc7e955$var$h($2118f0266dc7e955$var$_Column, rest);
|
|
60
60
|
return $2118f0266dc7e955$var$h((0, $4d5d1c15f39f6a14$export$f19d75b1d4b676a4), {
|
|
61
61
|
onUnitSelected: (unit, target)=>{
|
|
@@ -84,8 +84,8 @@ function $2118f0266dc7e955$export$816b5d811295e6bc(props) {
|
|
|
84
84
|
}
|
|
85
85
|
function $2118f0266dc7e955$var$_Column(props) {
|
|
86
86
|
const { data: data, unitComponent: unitComponent = $2118f0266dc7e955$export$48a4cacf2b7a4441, unconformityLabels: unconformityLabels = true, showLabels: showLabels = true, width: width = 300, columnWidth: columnWidth = 150, className: baseClassName, showLabelColumn: showLabelColumn = true, mergeOverlappingSections: mergeOverlappingSections = true, keyboardNavigation: keyboardNavigation = false, columnRef: columnRef, children: children, ...rest } = props;
|
|
87
|
-
const darkMode = (0, $
|
|
88
|
-
const sectionGroups = (0, $
|
|
87
|
+
const darkMode = (0, $bTsJU$useDarkMode)();
|
|
88
|
+
const sectionGroups = (0, $bTsJU$useMemo)(()=>{
|
|
89
89
|
let res = (0, $2c60de495788ce61$export$dfbd00399d639b4c)(data);
|
|
90
90
|
if (mergeOverlappingSections) res = (0, $2c60de495788ce61$export$ec445c47b6e5d2d)(res);
|
|
91
91
|
return res;
|
|
@@ -93,7 +93,7 @@ function $2118f0266dc7e955$var$_Column(props) {
|
|
|
93
93
|
data,
|
|
94
94
|
mergeOverlappingSections
|
|
95
95
|
]);
|
|
96
|
-
const className = (0, $
|
|
96
|
+
const className = (0, $bTsJU$classnames)(baseClassName, {
|
|
97
97
|
"dark-mode": darkMode?.isEnabled ?? false
|
|
98
98
|
});
|
|
99
99
|
// Clear unit selection on click outside of units, if we have a dispatch function
|
|
@@ -146,4 +146,4 @@ function $2118f0266dc7e955$var$_Column(props) {
|
|
|
146
146
|
|
|
147
147
|
|
|
148
148
|
export {$2118f0266dc7e955$export$48a4cacf2b7a4441 as UnitComponent, $2118f0266dc7e955$export$816b5d811295e6bc as Column};
|
|
149
|
-
//# sourceMappingURL=column.
|
|
149
|
+
//# sourceMappingURL=column.8dd26e1a.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,0BAAI,CAAA,GAAA,kBAAU,EAAE,CAAA,GAAA,wEAAK;AAEpB,SAAS,0CAAc,YAAE,QAAQ,YAAE,WAAW,GAAG,GAAG,MAAM;IAC/D,MAAM,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0BAAkB;IAE/C,sEAAsE;IACtE,wBAAwB;IACxB,OAAO,wBAAE,CAAA,GAAA,yCAAiB,GAAG;kBAC3B;QACA,GAAG,IAAI;QACP,OAAO,SAAS,gBAAgB,CAAC,MAAM,GAAG,IAAI,QAAQ,WAAW;QACjE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AAC,WAAW,CAAC,EAAE;wBAAE,WAAW,uCAAiB;oBAAO,GAAG;wBACvD,wBAAE,CAAA,GAAA,yCAAM,GAAG;kCACT;2CACA;wCACA;mCACA;yCACA;6CACA;4BACA,GAAG,IAAI;wBACT;qBACD;iBACF;YACH;YAEF,wBAAE,EAAE,CAAC,oBAAoB,CAAA,GAAA,yCAAqB,GAAG;gBAAE,OAAO;YAAK;YAC/D;SACD;KACF;AAEL","sources":["packages/column-views/src/column.ts"],"sourcesContent":["import {\n ColumnAxisType,\n ColumnLayoutContext,\n ColumnProvider,\n} from \"@macrostrat/column-components\";\nimport { hyperStyled } from \"@macrostrat/hyper\";\nimport { useDarkMode } from \"@macrostrat/ui-components\";\nimport classNames from \"classnames\";\nimport { createRef, RefObject, useContext, useMemo, useState } from \"react\";\nimport styles from \"./column.module.sass\";\nimport {\n TrackedLabeledUnit,\n UnitKeyboardNavigation,\n UnitSelectionProvider,\n useUnitSelectionDispatch,\n} from \"./units\";\nimport { SectionInfo } from \"./section\";\nimport { RectBounds } from \"./units/boxes\";\nimport { UnitSelectionPopover } from \"./selection-popover\";\nimport { MacrostratUnitsProvider } from \"./store\";\nimport { IColumnProps, Section } from \"./section\";\nimport {\n _mergeOverlappingSections,\n ensureArray,\n groupUnitsIntoSections,\n} from \"./helpers\";\n\nconst h = hyperStyled(styles);\n\nexport function UnitComponent({ division, nColumns = 2, ...rest }) {\n const { width } = useContext(ColumnLayoutContext);\n\n //const nCols = Math.min(nColumns, division.overlappingUnits.length+1)\n //console.log(division);\n return h(TrackedLabeledUnit, {\n division,\n ...rest,\n width: division.overlappingUnits.length > 0 ? width / nColumns : width,\n x: (division.column * width) / nColumns,\n });\n}\n\nfunction Unconformity({ upperUnits = [], lowerUnits = [], style }) {\n if (upperUnits.length == 0 || lowerUnits.length == 0) {\n return null;\n }\n\n const ageGap = lowerUnits[0].t_age - upperUnits[upperUnits.length - 1].b_age;\n\n return h(\"div.unconformity\", { style }, [\n h(\"div.unconformity-text\", `${ageGap.toFixed(1)} Ma`),\n ]);\n}\n\nfunction sectionClassName(section: SectionInfo) {\n return `section-${ensureArray(section.section_id).join(\"-\")}`;\n}\n\nexport interface ColumnProps extends IColumnProps {\n unconformityLabels?: boolean;\n className?: string;\n mergeOverlappingSections?: boolean;\n showLabelColumn?: boolean;\n columnRef?: RefObject<HTMLElement>;\n keyboardNavigation?: boolean;\n showUnitPopover?: boolean;\n t_age?: number;\n b_age?: number;\n}\n\nexport function Column(props: ColumnProps) {\n const { showUnitPopover = false, ...rest } = props;\n const ref = createRef<HTMLElement>();\n // Selected item position\n const [position, setPosition] = useState<RectBounds | null>(null);\n\n if (!showUnitPopover) {\n return h(_Column, rest);\n }\n\n return h(\n UnitSelectionProvider,\n {\n onUnitSelected: (unit, target: SVGElement | HTMLElement | null) => {\n if (!showUnitPopover) return;\n\n if (unit == null) {\n setPosition(null);\n return;\n }\n const el: HTMLElement = ref.current;\n if (el == null || target == null) return;\n const rect = el.getBoundingClientRect();\n const targetRect = target.getBoundingClientRect();\n setPosition({\n x: targetRect.left - rect.left,\n y: targetRect.top - rect.top,\n width: targetRect.width,\n height: targetRect.height,\n });\n },\n },\n h(\n _Column,\n { ...rest, columnRef: ref },\n h(UnitSelectionPopover, { position })\n )\n );\n}\n\nfunction _Column(props: Omit<ColumnProps, \"showUnitPopover\">) {\n const {\n data,\n unitComponent = UnitComponent,\n unconformityLabels = true,\n showLabels = true,\n width = 300,\n columnWidth = 150,\n className: baseClassName,\n showLabelColumn = true,\n mergeOverlappingSections = true,\n keyboardNavigation = false,\n columnRef,\n children,\n ...rest\n } = props;\n\n const darkMode = useDarkMode();\n const sectionGroups = useMemo(() => {\n let res = groupUnitsIntoSections(data);\n if (mergeOverlappingSections) {\n res = _mergeOverlappingSections(res);\n }\n return res;\n }, [data, mergeOverlappingSections]);\n\n const className = classNames(baseClassName, {\n \"dark-mode\": darkMode?.isEnabled ?? false,\n });\n\n // Clear unit selection on click outside of units, if we have a dispatch function\n const dispatch = useUnitSelectionDispatch();\n\n return h(\n \"div.column-container\",\n {\n className,\n onClick(evt) {\n dispatch?.(null, null, evt as any);\n },\n },\n h(MacrostratUnitsProvider, { units: data }, [\n h(\"div.column\", { ref: columnRef }, [\n h(\"div.age-axis-label\", \"Age (Ma)\"),\n h(\n \"div.main-column\",\n sectionGroups.map((group, i) => {\n const { section_id: id, units: data } = group;\n const lastGroup = sectionGroups[i - 1];\n return h([\n h.if(unconformityLabels)(Unconformity, {\n upperUnits: lastGroup?.units,\n lowerUnits: data,\n style: { width: showLabels ? columnWidth : width },\n }),\n h(`div.section`, { className: sectionClassName(group) }, [\n h(Section, {\n data,\n unitComponent,\n showLabels,\n width,\n columnWidth,\n showLabelColumn,\n ...rest,\n }),\n ]),\n ]);\n })\n ),\n h.if(keyboardNavigation)(UnitKeyboardNavigation, { units: data }),\n children,\n ]),\n ])\n );\n}\n"],"names":[],"version":3,"file":"column.
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,0BAAI,CAAA,GAAA,kBAAU,EAAE,CAAA,GAAA,wEAAK;AAEpB,SAAS,0CAAc,YAAE,QAAQ,YAAE,WAAW,GAAG,GAAG,MAAM;IAC/D,MAAM,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0BAAkB;IAE/C,sEAAsE;IACtE,wBAAwB;IACxB,OAAO,wBAAE,CAAA,GAAA,yCAAiB,GAAG;kBAC3B;QACA,GAAG,IAAI;QACP,OAAO,SAAS,gBAAgB,CAAC,MAAM,GAAG,IAAI,QAAQ,WAAW;QACjE,GAAG,AAAC,SAAS,MAAM,GAAG,QAAS;IACjC;AACF;AAEA,SAAS,mCAAa,cAAE,aAAa,EAAE,cAAE,aAAa,EAAE,SAAE,KAAK,EAAE;IAC/D,IAAI,WAAW,MAAM,IAAI,KAAK,WAAW,MAAM,IAAI,GACjD,OAAO;IAGT,MAAM,SAAS,UAAU,CAAC,EAAE,CAAC,K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G;gBAAE,OAAO;YAAK;YAC/D;SACD;KACF;AAEL","sources":["packages/column-views/src/column.ts"],"sourcesContent":["import {\n ColumnAxisType,\n ColumnLayoutContext,\n ColumnProvider,\n} from \"@macrostrat/column-components\";\nimport { hyperStyled } from \"@macrostrat/hyper\";\nimport { useDarkMode } from \"@macrostrat/ui-components\";\nimport classNames from \"classnames\";\nimport { createRef, RefObject, useContext, useMemo, useState } from \"react\";\nimport styles from \"./column.module.sass\";\nimport {\n TrackedLabeledUnit,\n UnitKeyboardNavigation,\n UnitSelectionProvider,\n useUnitSelectionDispatch,\n} from \"./units\";\nimport { SectionInfo } from \"./section\";\nimport { RectBounds } from \"./units/boxes\";\nimport { UnitSelectionPopover } from \"./selection-popover\";\nimport { MacrostratUnitsProvider } from \"./store\";\nimport { IColumnProps, Section } from \"./section\";\nimport {\n _mergeOverlappingSections,\n ensureArray,\n groupUnitsIntoSections,\n} from \"./helpers\";\n\nconst h = hyperStyled(styles);\n\nexport function UnitComponent({ division, nColumns = 2, ...rest }) {\n const { width } = useContext(ColumnLayoutContext);\n\n //const nCols = Math.min(nColumns, division.overlappingUnits.length+1)\n //console.log(division);\n return h(TrackedLabeledUnit, {\n division,\n ...rest,\n width: division.overlappingUnits.length > 0 ? width / nColumns : width,\n x: (division.column * width) / nColumns,\n });\n}\n\nfunction Unconformity({ upperUnits = [], lowerUnits = [], style }) {\n if (upperUnits.length == 0 || lowerUnits.length == 0) {\n return null;\n }\n\n const ageGap = lowerUnits[0].t_age - upperUnits[upperUnits.length - 1].b_age;\n\n return h(\"div.unconformity\", { style }, [\n h(\"div.unconformity-text\", `${ageGap.toFixed(1)} Ma`),\n ]);\n}\n\nfunction sectionClassName(section: SectionInfo) {\n return `section-${ensureArray(section.section_id).join(\"-\")}`;\n}\n\nexport interface ColumnProps extends IColumnProps {\n unconformityLabels?: boolean;\n className?: string;\n mergeOverlappingSections?: boolean;\n showLabelColumn?: boolean;\n columnRef?: RefObject<HTMLElement>;\n keyboardNavigation?: boolean;\n showUnitPopover?: boolean;\n t_age?: number;\n b_age?: number;\n}\n\nexport function Column(props: ColumnProps) {\n const { showUnitPopover = false, ...rest } = props;\n const ref = createRef<HTMLElement>();\n // Selected item position\n const [position, setPosition] = useState<RectBounds | null>(null);\n\n if (!showUnitPopover) {\n return h(_Column, rest);\n }\n\n return h(\n UnitSelectionProvider,\n {\n onUnitSelected: (unit, target: SVGElement | HTMLElement | null) => {\n if (!showUnitPopover) return;\n\n if (unit == null) {\n setPosition(null);\n return;\n }\n const el: HTMLElement = ref.current;\n if (el == null || target == null) return;\n const rect = el.getBoundingClientRect();\n const targetRect = target.getBoundingClientRect();\n setPosition({\n x: targetRect.left - rect.left,\n y: targetRect.top - rect.top,\n width: targetRect.width,\n height: targetRect.height,\n });\n },\n },\n h(\n _Column,\n { ...rest, columnRef: ref },\n h(UnitSelectionPopover, { position })\n )\n );\n}\n\nfunction _Column(props: Omit<ColumnProps, \"showUnitPopover\">) {\n const {\n data,\n unitComponent = UnitComponent,\n unconformityLabels = true,\n showLabels = true,\n width = 300,\n columnWidth = 150,\n className: baseClassName,\n showLabelColumn = true,\n mergeOverlappingSections = true,\n keyboardNavigation = false,\n columnRef,\n children,\n ...rest\n } = props;\n\n const darkMode = useDarkMode();\n const sectionGroups = useMemo(() => {\n let res = groupUnitsIntoSections(data);\n if (mergeOverlappingSections) {\n res = _mergeOverlappingSections(res);\n }\n return res;\n }, [data, mergeOverlappingSections]);\n\n const className = classNames(baseClassName, {\n \"dark-mode\": darkMode?.isEnabled ?? false,\n });\n\n // Clear unit selection on click outside of units, if we have a dispatch function\n const dispatch = useUnitSelectionDispatch();\n\n return h(\n \"div.column-container\",\n {\n className,\n onClick(evt) {\n dispatch?.(null, null, evt as any);\n },\n },\n h(MacrostratUnitsProvider, { units: data }, [\n h(\"div.column\", { ref: columnRef }, [\n h(\"div.age-axis-label\", \"Age (Ma)\"),\n h(\n \"div.main-column\",\n sectionGroups.map((group, i) => {\n const { section_id: id, units: data } = group;\n const lastGroup = sectionGroups[i - 1];\n return h([\n h.if(unconformityLabels)(Unconformity, {\n upperUnits: lastGroup?.units,\n lowerUnits: data,\n style: { width: showLabels ? columnWidth : width },\n }),\n h(`div.section`, { className: sectionClassName(group) }, [\n h(Section, {\n data,\n unitComponent,\n showLabels,\n width,\n columnWidth,\n showLabelColumn,\n ...rest,\n }),\n ]),\n ]);\n })\n ),\n h.if(keyboardNavigation)(UnitKeyboardNavigation, { units: data }),\n children,\n ]),\n ])\n );\n}\n"],"names":[],"version":3,"file":"column.8dd26e1a.js.map"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {SimpleUnitsColumn as $4c8184c4a7317749$export$2006342ddaa547c6} from "./units.
|
|
2
|
-
import {IsotopesColumn as $d5a3eba6c540ff58$export$5d8aa8022c284748} from "./isotopes-column.
|
|
3
|
-
import {MacrostratColumnProvider as $29bf41d89292aad4$export$9e42f9b6e0d67c7d} from "./providers.
|
|
4
|
-
import $
|
|
5
|
-
import "./column.module.
|
|
6
|
-
import $
|
|
7
|
-
import {group as $
|
|
8
|
-
import {useAPIResult as $
|
|
9
|
-
import {ColumnContext as $
|
|
10
|
-
import {useContext as $
|
|
1
|
+
import {SimpleUnitsColumn as $4c8184c4a7317749$export$2006342ddaa547c6} from "./units.361088d4.js";
|
|
2
|
+
import {IsotopesColumn as $d5a3eba6c540ff58$export$5d8aa8022c284748} from "./isotopes-column.7cb5cc45.js";
|
|
3
|
+
import {MacrostratColumnProvider as $29bf41d89292aad4$export$9e42f9b6e0d67c7d} from "./providers.cd1e652f.js";
|
|
4
|
+
import $hEPNH$columnmodule7f47d25ajs from "./column.module.7f47d25a.js";
|
|
5
|
+
import "./column.module.cbb072df.css";
|
|
6
|
+
import $hEPNH$macrostrathyper from "@macrostrat/hyper";
|
|
7
|
+
import {group as $hEPNH$group} from "d3-array";
|
|
8
|
+
import {useAPIResult as $hEPNH$useAPIResult} from "@macrostrat/ui-components";
|
|
9
|
+
import {ColumnContext as $hEPNH$ColumnContext, ColumnAxis as $hEPNH$ColumnAxis, ColumnSVG as $hEPNH$ColumnSVG} from "@macrostrat/column-components";
|
|
10
|
+
import {useContext as $hEPNH$useContext} from "react";
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
function $parcel$interopDefault(a) {
|
|
@@ -22,12 +22,12 @@ function $parcel$interopDefault(a) {
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
const $132b1b0fb905c489$var$h = (0, $
|
|
25
|
+
const $132b1b0fb905c489$var$h = (0, $hEPNH$macrostrathyper).styled((0, ($parcel$interopDefault($hEPNH$columnmodule7f47d25ajs))));
|
|
26
26
|
const $132b1b0fb905c489$var$AgeAxis = ({ ticks: ticks })=>{
|
|
27
|
-
const { pixelHeight: pixelHeight } = (0, $
|
|
27
|
+
const { pixelHeight: pixelHeight } = (0, $hEPNH$useContext)((0, $hEPNH$ColumnContext));
|
|
28
28
|
// A tick roughly every 40 pixels
|
|
29
29
|
let v = Math.max(Math.round(pixelHeight / 40), 1);
|
|
30
|
-
return $132b1b0fb905c489$var$h((0, $
|
|
30
|
+
return $132b1b0fb905c489$var$h((0, $hEPNH$ColumnAxis), {
|
|
31
31
|
ticks: v,
|
|
32
32
|
showDomain: false
|
|
33
33
|
});
|
|
@@ -51,7 +51,7 @@ const $132b1b0fb905c489$export$6e2c8f0811a474ce = (props)=>{
|
|
|
51
51
|
range: range,
|
|
52
52
|
pixelsPerMeter: pixelScale
|
|
53
53
|
}, [
|
|
54
|
-
$132b1b0fb905c489$var$h((0, $
|
|
54
|
+
$132b1b0fb905c489$var$h((0, $hEPNH$ColumnSVG), {
|
|
55
55
|
width: 650,
|
|
56
56
|
padding: 20,
|
|
57
57
|
paddingTop: 5,
|
|
@@ -90,13 +90,13 @@ const $132b1b0fb905c489$export$6e2c8f0811a474ce = (props)=>{
|
|
|
90
90
|
};
|
|
91
91
|
function $132b1b0fb905c489$var$Column(props) {
|
|
92
92
|
const { params: params } = props;
|
|
93
|
-
const data = (0, $
|
|
93
|
+
const data = (0, $hEPNH$useAPIResult)("/units", {
|
|
94
94
|
all: true,
|
|
95
95
|
...params,
|
|
96
96
|
response: "long"
|
|
97
97
|
});
|
|
98
98
|
if (data == null) return null;
|
|
99
|
-
let sectionGroups = Array.from((0, $
|
|
99
|
+
let sectionGroups = Array.from((0, $hEPNH$group)(data, (d)=>d.section_id));
|
|
100
100
|
//sectionGroups.sort((a, b) => a.t_age - b.t_age);
|
|
101
101
|
return $132b1b0fb905c489$var$h("div.column", [
|
|
102
102
|
$132b1b0fb905c489$var$h("div.age-axis-label", "Age (Ma)"),
|
|
@@ -114,4 +114,4 @@ var $132b1b0fb905c489$export$2e2bcd8739ae039 = $132b1b0fb905c489$var$Column;
|
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
export {$132b1b0fb905c489$export$6e2c8f0811a474ce as Section, $132b1b0fb905c489$export$2e2bcd8739ae039 as default};
|
|
117
|
-
//# sourceMappingURL=column.
|
|
117
|
+
//# sourceMappingURL=column.db058031.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,wEAAK;AAS5B,MAAM,gCAAU,CAAC,SAAE,KAAK,EAAE;IACxB,MAAM,eAAE,WAAW,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,oBAAY;IAC/C,iCAAiC;IACjC,IAAI,IAAI,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,cAAc,KAAK;IAE/C,OAAO,wBAAE,CAAA,GAAA,iBAAS,GAAG;QACnB,OAAO;QACP,YAAY;IACd;AACF;AAEA,MAAM,4CAAU,CAAC;IACf,oCAAoC;IACpC,MAAM,QACJ,IAAI,kBACJ,iBAAiB,aACjB,QAAQ;QAAC,IAAI,CAAC,KAAK,MAAM,GAAG,EAAE,CAAC,KAAK;QAAE,IAAI,CAAC,E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C,CAAC,IAAI,OAAO,EAAE;YAC/B,OAAO,wBAAE,CAAC,YAAY,EAAE,IAAI,EAAE;gBAC5B,wBAAE,2CAAS;oBACT,MAAM;oBACN,gBAAgB,KAAK,cAAc,MAAM,GAAG;gBAC9C;aACD;QACH;KAEH;AACH;IAGA,2CAAe","sources":["packages/column-views/src/carbon-isotopes/column.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport { group } from \"d3-array\";\nimport { useAPIResult } from \"@macrostrat/ui-components\";\nimport {\n ColumnSVG,\n ColumnAxis,\n ColumnContext,\n} from \"@macrostrat/column-components\";\nimport { SimpleUnitsColumn, IUnit, ColumnArgs } from \"../units\";\nimport { useContext } from \"react\";\nimport { IsotopesColumn } from \"./isotopes-column\";\nimport { MacrostratColumnProvider } from \"../providers\";\nimport styles from \"./column.module.sass\";\n\nconst h = hyper.styled(styles);\n\ninterface IColumnProps {\n data: IUnit[];\n pixelScale?: number;\n isOldestColumn: boolean;\n range?: [number, number];\n}\n\nconst AgeAxis = ({ ticks }) => {\n const { pixelHeight } = useContext(ColumnContext);\n // A tick roughly every 40 pixels\n let v = Math.max(Math.round(pixelHeight / 40), 1);\n\n return h(ColumnAxis, {\n ticks: v,\n showDomain: false,\n });\n};\n\nconst Section = (props: IColumnProps) => {\n // Section with \"squishy\" time scale\n const {\n data,\n isOldestColumn = true,\n range = [data[data.length - 1].b_age, data[0].t_age],\n } = props;\n let { pixelScale } = props;\n\n const notesOffset = 100;\n\n if (!pixelScale) {\n // Make up a pixel scale\n const dAge = range[0] - range[1];\n const targetHeight = 50 * data.length;\n pixelScale = Math.ceil(targetHeight / dAge);\n }\n\n return h(\n MacrostratColumnProvider,\n {\n divisions: data,\n range,\n pixelsPerMeter: pixelScale, // Actually pixels per myr\n },\n [\n h(\n ColumnSVG,\n {\n width: 650,\n padding: 20,\n paddingTop: 5,\n paddingBottom: 25,\n },\n [\n h(AgeAxis),\n h(SimpleUnitsColumn, {\n width: 400,\n columnWidth: 90,\n }),\n h(IsotopesColumn, {\n parameter: \"D13C\",\n label: \"δ¹³C\",\n width: 100,\n // @ts-ignore\n nTicks: 4,\n showAxis: isOldestColumn,\n transform: \"translate(250,0)\",\n }),\n h(IsotopesColumn, {\n parameter: \"D18O\",\n label: \"δ¹⁸O\",\n color: \"red\",\n domain: [-40, 0],\n width: 100,\n // @ts-ignore\n nTicks: 4,\n showAxis: isOldestColumn,\n transform: \"translate(370,0)\",\n }),\n ]\n ),\n ]\n );\n};\n\nfunction Column(props: Omit<IColumnProps, \"data\"> & { params: ColumnArgs }) {\n const { params } = props;\n const data: IUnit[] = useAPIResult(\"/units\", {\n all: true,\n ...params,\n response: \"long\",\n });\n if (data == null) return null;\n\n let sectionGroups = Array.from(group(data, (d) => d.section_id));\n\n //sectionGroups.sort((a, b) => a.t_age - b.t_age);\n\n return h(\"div.column\", [\n h(\"div.age-axis-label\", \"Age (Ma)\"),\n h(\n \"div.main-column\",\n sectionGroups.map(([id, values], i) => {\n return h(`div.section-${id}`, [\n h(Section, {\n data: values,\n isOldestColumn: i == sectionGroups.length - 1,\n }),\n ]);\n })\n ),\n ]);\n}\n\nexport { Section, IColumnProps };\nexport default Column;\n"],"names":[],"version":3,"file":"column.
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,wEAAK;AAS5B,MAAM,gCAAU,CAAC,SAAE,KAAK,EAAE;IACxB,MAAM,eAAE,WAAW,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,oBAAY;IAC/C,iCAAiC;IACjC,IAAI,IAAI,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,cAAc,KAAK;IAE/C,OAAO,wBAAE,CAAA,GAAA,iBAAS,GAAG;QACnB,OAAO;QACP,YAAY;IACd;AACF;AAEA,MAAM,4CAAU,CAAC;IACf,oCAAoC;IACpC,MAAM,QACJ,IAAI,kBACJ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,kDAAkD;IAElD,OAAO,wBAAE,cAAc;QACrB,wBAAE,sBAAsB;QACxB,wBACE,mBACA,cAAc,GAAG,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE;YAC/B,OAAO,wBAAE,CAAC,YAAY,EAAE,IAAI,EAAE;gBAC5B,wBAAE,2CAAS;oBACT,MAAM;oBACN,gBAAgB,KAAK,cAAc,MAAM,GAAG;gBAC9C;aACD;QACH;KAEH;AACH;IAGA,2CAAe","sources":["packages/column-views/src/carbon-isotopes/column.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport { group } from \"d3-array\";\nimport { useAPIResult } from \"@macrostrat/ui-components\";\nimport {\n ColumnSVG,\n ColumnAxis,\n ColumnContext,\n} from \"@macrostrat/column-components\";\nimport { SimpleUnitsColumn, IUnit, ColumnArgs } from \"../units\";\nimport { useContext } from \"react\";\nimport { IsotopesColumn } from \"./isotopes-column\";\nimport { MacrostratColumnProvider } from \"../providers\";\nimport styles from \"./column.module.sass\";\n\nconst h = hyper.styled(styles);\n\ninterface IColumnProps {\n data: IUnit[];\n pixelScale?: number;\n isOldestColumn: boolean;\n range?: [number, number];\n}\n\nconst AgeAxis = ({ ticks }) => {\n const { pixelHeight } = useContext(ColumnContext);\n // A tick roughly every 40 pixels\n let v = Math.max(Math.round(pixelHeight / 40), 1);\n\n return h(ColumnAxis, {\n ticks: v,\n showDomain: false,\n });\n};\n\nconst Section = (props: IColumnProps) => {\n // Section with \"squishy\" time scale\n const {\n data,\n isOldestColumn = true,\n range = [data[data.length - 1].b_age, data[0].t_age],\n } = props;\n let { pixelScale } = props;\n\n const notesOffset = 100;\n\n if (!pixelScale) {\n // Make up a pixel scale\n const dAge = range[0] - range[1];\n const targetHeight = 50 * data.length;\n pixelScale = Math.ceil(targetHeight / dAge);\n }\n\n return h(\n MacrostratColumnProvider,\n {\n divisions: data,\n range,\n pixelsPerMeter: pixelScale, // Actually pixels per myr\n },\n [\n h(\n ColumnSVG,\n {\n width: 650,\n padding: 20,\n paddingTop: 5,\n paddingBottom: 25,\n },\n [\n h(AgeAxis),\n h(SimpleUnitsColumn, {\n width: 400,\n columnWidth: 90,\n }),\n h(IsotopesColumn, {\n parameter: \"D13C\",\n label: \"δ¹³C\",\n width: 100,\n // @ts-ignore\n nTicks: 4,\n showAxis: isOldestColumn,\n transform: \"translate(250,0)\",\n }),\n h(IsotopesColumn, {\n parameter: \"D18O\",\n label: \"δ¹⁸O\",\n color: \"red\",\n domain: [-40, 0],\n width: 100,\n // @ts-ignore\n nTicks: 4,\n showAxis: isOldestColumn,\n transform: \"translate(370,0)\",\n }),\n ]\n ),\n ]\n );\n};\n\nfunction Column(props: Omit<IColumnProps, \"data\"> & { params: ColumnArgs }) {\n const { params } = props;\n const data: IUnit[] = useAPIResult(\"/units\", {\n all: true,\n ...params,\n response: \"long\",\n });\n if (data == null) return null;\n\n let sectionGroups = Array.from(group(data, (d) => d.section_id));\n\n //sectionGroups.sort((a, b) => a.t_age - b.t_age);\n\n return h(\"div.column\", [\n h(\"div.age-axis-label\", \"Age (Ma)\"),\n h(\n \"div.main-column\",\n sectionGroups.map(([id, values], i) => {\n return h(`div.section-${id}`, [\n h(Section, {\n data: values,\n isOldestColumn: i == sectionGroups.length - 1,\n }),\n ]);\n })\n ),\n ]);\n}\n\nexport { Section, IColumnProps };\nexport default Column;\n"],"names":[],"version":3,"file":"column.db058031.js.map"}
|
|
@@ -1,16 +1,41 @@
|
|
|
1
|
-
.column-container_afc440 {
|
|
1
|
+
.column-container_afc440, body.light-mode .column-container_afc440 {
|
|
2
2
|
--column-background-color: var(--background-color, #fff);
|
|
3
3
|
--column-stroke-color: var(--text-color, #000);
|
|
4
4
|
--column-text-color: var(--text-color, #000);
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
@media (prefers-color-scheme: dark) {
|
|
8
|
-
.column-container_afc440 {
|
|
8
|
+
body:not(.light-mode) .column-container_afc440 {
|
|
9
9
|
--column-background-color: var(--background-color, #000);
|
|
10
10
|
--column-stroke-color: var(--text-color, #fff);
|
|
11
11
|
--column-text-color: var(--text-color, #fff);
|
|
12
12
|
color-scheme: dark;
|
|
13
|
+
color: var(--column-text-color);
|
|
13
14
|
}
|
|
15
|
+
|
|
16
|
+
body:not(.light-mode) .column-container_afc440 .timescale {
|
|
17
|
+
color: #000;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
body:not(.light-mode) .column-container_afc440 g.inner pattern image {
|
|
21
|
+
filter: invert(80%);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
body.dark-mode .column-container_afc440 {
|
|
26
|
+
--column-background-color: var(--background-color, #000);
|
|
27
|
+
--column-stroke-color: var(--text-color, #fff);
|
|
28
|
+
--column-text-color: var(--text-color, #fff);
|
|
29
|
+
color-scheme: dark;
|
|
30
|
+
color: var(--column-text-color);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
body.dark-mode .column-container_afc440 .timescale {
|
|
34
|
+
color: #000;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
body.dark-mode .column-container_afc440 g.inner pattern image {
|
|
38
|
+
filter: invert(80%);
|
|
14
39
|
}
|
|
15
40
|
|
|
16
41
|
.column-container_afc440 .column {
|
|
@@ -123,16 +148,4 @@
|
|
|
123
148
|
color: var(--column-stroke-color);
|
|
124
149
|
transform: translateY(-.5em);
|
|
125
150
|
}
|
|
126
|
-
|
|
127
|
-
.column-container_afc440.dark-mode_afc440 {
|
|
128
|
-
color: var(--column-text-color);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.column-container_afc440.dark-mode_afc440 .timescale {
|
|
132
|
-
color: #000;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.column-container_afc440.dark-mode_afc440 g.inner pattern image {
|
|
136
|
-
filter: invert(80%);
|
|
137
|
-
}
|
|
138
|
-
/*# sourceMappingURL=column.module.c9df6edf.css.map */
|
|
151
|
+
/*# sourceMappingURL=column.module.039d872c.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA;;;;;;AAWE;EACE;;;;;;;;EAOI;;;;EAEA;;;;;AAIN;;;;;;;;AAOE;;;;AAIF;;;;;;;;;;AAUI;;;;;;;;;;AAUF;;;;;;AAMA;;;;;;;;;;;AASF;;;;;;;;;;;;AAUF;;;;AAGA;;;;AAIE;;;;AAGF;;;;;;;;;;;;;;;;;;;;;;;AAkBA;;;;AAGA;;;;;;;;AAOE;;;;;AAIF","sources":["packages/column-views/src/column.module.sass"],"sourcesContent":[".column-container, body:global(.light-mode) .column-container\n --column-background-color: var(--background-color, #fff)\n --column-stroke-color: var(--text-color, #000)\n --column-text-color: var(--text-color, #000)\n\n/* We have to duplicate the dark mode styles here\n because we want to set them either if the preferred\n color scheme is dark OR if dark mode is explicitly enabled.\n If dark mode is explicitly enabled, we want to override\n the media query. */\n@media (prefers-color-scheme: dark)\n body:not(:global(.light-mode)) .column-container\n --column-background-color: var(--background-color, #000)\n --column-stroke-color: var(--text-color, #fff)\n --column-text-color: var(--text-color, #fff)\n color-scheme: dark\n color: var(--column-text-color)\n :global\n .timescale\n color: #000\n g.inner pattern image\n filter: invert(80%)\n\nbody:global(.dark-mode) .column-container\n --column-background-color: var(--background-color, #000)\n --column-stroke-color: var(--text-color, #fff)\n --column-text-color: var(--text-color, #fff)\n color-scheme: dark\n color: var(--column-text-color)\n :global\n .timescale\n color: #000\n g.inner pattern image\n filter: invert(80%)\n\n.column-container :global\n .column\n display: flex\n flex-direction: row\n position: relative\n\n .age-axis-label\n writing-mode: vertical-lr\n transform: rotate(180deg)\n font-size: 12px\n text-align: center\n position: sticky\n top: 0\n max-height: 100vh\n\n .tick text\n text-anchor: middle\n font-weight: 400 !important\n transform: rotate(-90deg) translate(8px, -12px)\n\n rect.unit\n stroke: var(--column-stroke-color)\n stroke-width: 1px\n\n g.lithology-column use.frame\n stroke: var(--column-stroke-color)\n stroke-width: 1.5px !important\n pointer-events: none\n\n.column-container :global .unit-label\n text-align: center\n\n.column-container :global .col-note-label\n font-size: 10px\n margin-top: 3px\n padding: 2px\n padding-left: 3px\n line-height: 9px\n border-left: none !important\n\n.column-container :global g.height-range\n display: none\n\n.column-container :global .note-inner\n border: none\n\n.column-container :global .frame rect\n fill: transparent\n\n.column-container :global .labeled-unit .unit-overlay\n font-size: 10px\n font-style: italic\n display: flex\n align-items: center\n justify-content: center\n\n.column-container :global .labeled-unit .unit-overlay .unit-label\n display: block\n text-shadow: 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color), 0px 0px 4px var(--column-background-color)\n\n.column-container :global .default-buttons\n width: 100%\n margin: 0 -10px\n\n.column-container :global div.section\n display: flex\n flex-direction: row\n\n.column-container :global div.section :global(.timescale)\n transform: translateY(0.5)\n\n.column-container :global .section .divisions .unit\n cursor: pointer\n\n.column-container :global rect.selection-overlay\n fill: rgba(255,0,0,0.5)\n\n.column-container :global div.timescale\n width: calc(6em + 4px)\n --timescale-level-size: 1.5em\n\n.unconformity\n height: 0px\n font-size: 10px\n font-style: italic\n text-align: center\n margin-left: calc(6em + 4px + 40px)\n\n.unconformity-text\n transform: translateY(-0.5em)\n width: var(--column-width)\n color: var(--column-stroke-color)\n"],"names":[],"version":3,"file":"column.module.039d872c.css.map"}
|