@macrostrat/column-views 3.1.0 → 3.2.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 +6 -0
- package/dist/age-axis.js +2 -2
- package/dist/age-axis.js.map +1 -1
- package/dist/age-axis.module.sass.cjs +6 -1
- package/dist/age-axis.module.sass.cjs.map +1 -1
- package/dist/age-axis.module.sass.js +4 -1
- package/dist/age-axis.module.sass.js.map +1 -1
- package/dist/age-model-overlay.js +2 -2
- package/dist/age-model-overlay.js.map +1 -1
- package/dist/age-model-overlay.module.sass.cjs +6 -1
- package/dist/age-model-overlay.module.sass.cjs.map +1 -1
- package/dist/age-model-overlay.module.sass.js +4 -1
- package/dist/age-model-overlay.module.sass.js.map +1 -1
- package/dist/column.js +2 -2
- package/dist/column.js.map +1 -1
- package/dist/column.module.sass.cjs +6 -1
- package/dist/column.module.sass.cjs.map +1 -1
- package/dist/column.module.sass.js +4 -1
- package/dist/column.module.sass.js.map +1 -1
- package/dist/correlation-chart/main.js +2 -2
- package/dist/correlation-chart/main.js.map +1 -1
- package/dist/correlation-chart/main.module.sass.cjs +6 -1
- package/dist/correlation-chart/main.module.sass.cjs.map +1 -1
- package/dist/correlation-chart/main.module.sass.js +4 -1
- package/dist/correlation-chart/main.module.sass.js.map +1 -1
- package/dist/data-provider/store.cjs +1 -1
- package/dist/data-provider/store.cjs.map +1 -1
- package/dist/data-provider/store.js +1 -1
- package/dist/data-provider/store.js.map +1 -1
- package/dist/facets/carbon-isotopes/isotopes-column.js +2 -2
- package/dist/facets/carbon-isotopes/isotopes-column.js.map +1 -1
- package/dist/facets/carbon-isotopes/isotopes-column.module.sass.cjs +6 -1
- package/dist/facets/carbon-isotopes/isotopes-column.module.sass.cjs.map +1 -1
- package/dist/facets/carbon-isotopes/isotopes-column.module.sass.js +4 -1
- package/dist/facets/carbon-isotopes/isotopes-column.module.sass.js.map +1 -1
- package/dist/facets/detrital-zircon/index.js +2 -2
- package/dist/facets/detrital-zircon/index.js.map +1 -1
- package/dist/facets/detrital-zircon/index.module.sass.cjs +6 -1
- package/dist/facets/detrital-zircon/index.module.sass.cjs.map +1 -1
- package/dist/facets/detrital-zircon/index.module.sass.js +4 -1
- package/dist/facets/detrital-zircon/index.module.sass.js.map +1 -1
- package/dist/facets/fossils/index.js +2 -2
- package/dist/facets/fossils/index.js.map +1 -1
- package/dist/facets/fossils/taxon-ranges.js +2 -2
- package/dist/facets/fossils/taxon-ranges.js.map +1 -1
- package/dist/facets/fossils/taxon-ranges.module.sass.cjs +6 -1
- package/dist/facets/fossils/taxon-ranges.module.sass.cjs.map +1 -1
- package/dist/facets/fossils/taxon-ranges.module.sass.js +4 -1
- package/dist/facets/fossils/taxon-ranges.module.sass.js.map +1 -1
- package/dist/facets/measurements/base.js +2 -2
- package/dist/facets/measurements/base.js.map +1 -1
- package/dist/facets/measurements/base.module.sass.cjs +6 -1
- package/dist/facets/measurements/base.module.sass.cjs.map +1 -1
- package/dist/facets/measurements/base.module.sass.js +4 -1
- package/dist/facets/measurements/base.module.sass.js.map +1 -1
- package/dist/index.cjs +10 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/maps/_shared/styles.cjs +6 -1
- package/dist/maps/_shared/styles.cjs.map +1 -1
- package/dist/maps/_shared/styles.js +6 -1
- package/dist/maps/_shared/styles.js.map +1 -1
- package/dist/maps/column-navigation/mapbox/keyboard-navigation.d.ts +1 -1
- package/dist/maps/index.d.ts +1 -0
- package/dist/maps/units-overlay/index.cjs +254 -0
- package/dist/maps/units-overlay/index.cjs.map +1 -0
- package/dist/maps/units-overlay/index.d.ts +14 -0
- package/dist/maps/units-overlay/index.js +252 -0
- package/dist/maps/units-overlay/index.js.map +1 -0
- package/dist/section.js +2 -2
- package/dist/section.js.map +1 -1
- package/dist/unit-details/panel.js +2 -2
- package/dist/unit-details/panel.js.map +1 -1
- package/dist/unit-details/panel.module.sass.cjs +6 -1
- package/dist/unit-details/panel.module.sass.cjs.map +1 -1
- package/dist/unit-details/panel.module.sass.js +4 -1
- package/dist/unit-details/panel.module.sass.js.map +1 -1
- package/dist/unit-details/popover.js +2 -2
- package/dist/unit-details/popover.js.map +1 -1
- package/dist/unit-details/popover.module.sass.cjs +6 -1
- package/dist/unit-details/popover.module.sass.cjs.map +1 -1
- package/dist/unit-details/popover.module.sass.js +4 -1
- package/dist/unit-details/popover.module.sass.js.map +1 -1
- package/dist/units/boxes.js +2 -2
- package/dist/units/boxes.js.map +1 -1
- package/dist/units/boxes.module.sass.cjs +6 -1
- package/dist/units/boxes.module.sass.cjs.map +1 -1
- package/dist/units/boxes.module.sass.js +4 -1
- package/dist/units/boxes.module.sass.js.map +1 -1
- package/dist/units/colors.cjs +79 -18
- package/dist/units/colors.cjs.map +1 -1
- package/dist/units/colors.d.ts +17 -4
- package/dist/units/colors.js +79 -18
- package/dist/units/colors.js.map +1 -1
- package/dist/units/composite.js +2 -2
- package/dist/units/composite.js.map +1 -1
- package/dist/units/composite.module.sass.cjs +6 -1
- package/dist/units/composite.module.sass.cjs.map +1 -1
- package/dist/units/composite.module.sass.js +4 -1
- package/dist/units/composite.module.sass.js.map +1 -1
- package/dist/units/index.cjs +2 -0
- package/dist/units/index.cjs.map +1 -1
- package/dist/units/index.js +3 -0
- package/dist/units/index.js.map +1 -1
- package/dist/units/resolvers.cjs +11 -0
- package/dist/units/resolvers.cjs.map +1 -1
- package/dist/units/resolvers.d.ts +5 -0
- package/dist/units/resolvers.js +11 -0
- package/dist/units/resolvers.js.map +1 -1
- package/package.json +10 -9
- package/src/data-provider/store.ts +1 -0
- package/src/maps/_shared/styles.ts +10 -3
- package/src/maps/index.ts +1 -0
- package/src/maps/unit-map.stories.ts +64 -0
- package/src/maps/units-overlay/index.ts +336 -0
- package/src/units/colors.ts +137 -25
- package/src/units/resolvers.ts +16 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format
|
|
|
4
4
|
is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this
|
|
5
5
|
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [3.2.0] - 2026-02-06
|
|
8
|
+
|
|
9
|
+
- Update Mapbox dependency to v3
|
|
10
|
+
- Add a `MacrostratUnitsOverlay` component for rendering units on
|
|
11
|
+
Mapbox/Maplibre maps, with optional patterns.
|
|
12
|
+
|
|
7
13
|
## [3.1.0] - 2026-01-31
|
|
8
14
|
|
|
9
15
|
- Moved `MacrostratDataProvider` and data fetchers to
|
package/dist/age-axis.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import h$1 from "@macrostrat/hyper";
|
|
2
2
|
import { ColumnAxisType, SVG, AgeAxis } from "@macrostrat/column-components";
|
|
3
3
|
import "react";
|
|
4
|
-
import
|
|
4
|
+
import h$2 from "./age-axis.module.sass.js";
|
|
5
5
|
import { Parenthetical } from "@macrostrat/data-components";
|
|
6
6
|
import { AgeLabel } from "./unit-details/panel.js";
|
|
7
7
|
import { useCompositeScale, useMacrostratColumnData } from "./data-provider/store.js";
|
|
8
|
-
const h = h$1.styled(
|
|
8
|
+
const h = h$1.styled(h$2);
|
|
9
9
|
function VerticalAxisLabel(props) {
|
|
10
10
|
const { label = "Age", unit = "Ma", className, height } = props;
|
|
11
11
|
return h(
|
package/dist/age-axis.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"age-axis.js","sources":["../src/age-axis.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport {\n SVG,\n ColumnAxis,\n ColumnContext,\n ColumnAxisType,\n AgeAxis,\n} from \"@macrostrat/column-components\";\nimport { useContext } from \"react\";\nimport styles from \"./age-axis.module.sass\";\nimport { useCompositeScale, useMacrostratColumnData } from \"./data-provider\";\nimport { Parenthetical } from \"@macrostrat/data-components\";\nimport { AgeLabel } from \"./unit-details\";\nimport { PackageScaleLayoutData } from \"./prepare-units\";\n\nconst h = hyper.styled(styles);\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 VerticalAxisLabel(props) {\n const { label = \"Age\", unit = \"Ma\", className, height } = props;\n return h(\n \"div.column-axis-label.age-axis-label\",\n { className, style: { height } },\n [\n label,\n \" \",\n h.if(unit)(Parenthetical, { className: \"age-axis-unit\" }, unit),\n ],\n );\n}\n\ninterface CompositeAgeAxisProps {\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function CompositeAgeAxis(rest: CompositeAgeAxisProps) {\n const { axisType, sections, totalHeight } = useMacrostratColumnData();\n\n const packages = sections.map((section) => {\n return {\n key: `section-${section.section_id}`,\n ...section.scaleInfo,\n };\n });\n\n return h(CompositeAgeAxisCore, {\n axisType,\n packages,\n totalHeight,\n ...rest,\n });\n}\n\nexport function ApproximateHeightAxis(rest: CompositeAgeAxisProps) {\n /** Axis to show approximate height based on dynamic column scales */\n const { axisType, sections, totalHeight } = useMacrostratColumnData();\n\n const packages = sections.map((section) => {\n const { scaleInfo } = section;\n if (scaleInfo.heightScale == null) {\n throw new Error(\"No height scale available for section\");\n }\n return {\n key: `section-${section.section_id}`,\n ...scaleInfo,\n scale: scaleInfo.heightScale, // Use height scale instead of age scale\n // This only works with dynamic columns\n };\n });\n\n return h(CompositeAgeAxisCore, {\n axisType,\n axisLabel: \"Approx. height\",\n axisUnit: \"m\",\n packages,\n totalHeight,\n ...rest,\n });\n}\n\nexport interface CompositeStratigraphicScaleInfo extends CompositeAgeAxisProps {\n axisType: ColumnAxisType;\n axisLabel?: string;\n axisUnit?: string;\n totalHeight: number;\n packages: PackageScaleLayoutData[];\n}\n\nexport function CompositeAgeAxisCore(props: CompositeStratigraphicScaleInfo) {\n const { axisType, axisLabel, axisUnit, totalHeight, packages, ...rest } =\n props;\n\n if (axisType == ColumnAxisType.ORDINAL) {\n return null;\n }\n\n let _axisLabel: string = axisLabel ?? \"Age\";\n let _axisUnit = axisUnit ?? \"Ma\";\n if (axisType == ColumnAxisType.DEPTH) {\n _axisLabel = \"Depth\";\n _axisUnit = \"m\";\n } else if (axisType == ColumnAxisType.HEIGHT) {\n _axisLabel = \"Height\";\n _axisUnit = \"m\";\n }\n\n return h(\"div.composite-age-axis\", rest, [\n h(VerticalAxisLabel, {\n label: _axisLabel,\n unit: _axisUnit,\n height: totalHeight,\n }),\n h(\n SVG,\n {\n className: \"age-axis-column\",\n style: { width: `22px`, height: `${totalHeight}px` },\n width: 22,\n height: totalHeight,\n },\n packages.map((group, i) => {\n const { key, scale } = group;\n\n return h(AgeAxis, {\n key,\n className: \"age-axis\",\n scale,\n tickSizeOuter: 3,\n });\n }),\n ),\n ]);\n}\n\nexport function AgeCursor({ age }) {\n /** A cursor that shows the age at a specific point on the age axis. */\n const scale = useCompositeScale();\n const heightPx = scale(age);\n\n if (age == null || heightPx == null) {\n return null;\n }\n\n return h(\n \"div.age-cursor\",\n {\n style: {\n top: heightPx,\n },\n },\n [h(\"div.line\"), h(AgeLabel, { age, className: \"label\" })],\n );\n}\n"],"names":["hyper"],"mappings":";;;;;;;AAeA,MAAM,IAAIA,IAAM,
|
|
1
|
+
{"version":3,"file":"age-axis.js","sources":["../src/age-axis.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport {\n SVG,\n ColumnAxis,\n ColumnContext,\n ColumnAxisType,\n AgeAxis,\n} from \"@macrostrat/column-components\";\nimport { useContext } from \"react\";\nimport styles from \"./age-axis.module.sass\";\nimport { useCompositeScale, useMacrostratColumnData } from \"./data-provider\";\nimport { Parenthetical } from \"@macrostrat/data-components\";\nimport { AgeLabel } from \"./unit-details\";\nimport { PackageScaleLayoutData } from \"./prepare-units\";\n\nconst h = hyper.styled(styles);\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 VerticalAxisLabel(props) {\n const { label = \"Age\", unit = \"Ma\", className, height } = props;\n return h(\n \"div.column-axis-label.age-axis-label\",\n { className, style: { height } },\n [\n label,\n \" \",\n h.if(unit)(Parenthetical, { className: \"age-axis-unit\" }, unit),\n ],\n );\n}\n\ninterface CompositeAgeAxisProps {\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function CompositeAgeAxis(rest: CompositeAgeAxisProps) {\n const { axisType, sections, totalHeight } = useMacrostratColumnData();\n\n const packages = sections.map((section) => {\n return {\n key: `section-${section.section_id}`,\n ...section.scaleInfo,\n };\n });\n\n return h(CompositeAgeAxisCore, {\n axisType,\n packages,\n totalHeight,\n ...rest,\n });\n}\n\nexport function ApproximateHeightAxis(rest: CompositeAgeAxisProps) {\n /** Axis to show approximate height based on dynamic column scales */\n const { axisType, sections, totalHeight } = useMacrostratColumnData();\n\n const packages = sections.map((section) => {\n const { scaleInfo } = section;\n if (scaleInfo.heightScale == null) {\n throw new Error(\"No height scale available for section\");\n }\n return {\n key: `section-${section.section_id}`,\n ...scaleInfo,\n scale: scaleInfo.heightScale, // Use height scale instead of age scale\n // This only works with dynamic columns\n };\n });\n\n return h(CompositeAgeAxisCore, {\n axisType,\n axisLabel: \"Approx. height\",\n axisUnit: \"m\",\n packages,\n totalHeight,\n ...rest,\n });\n}\n\nexport interface CompositeStratigraphicScaleInfo extends CompositeAgeAxisProps {\n axisType: ColumnAxisType;\n axisLabel?: string;\n axisUnit?: string;\n totalHeight: number;\n packages: PackageScaleLayoutData[];\n}\n\nexport function CompositeAgeAxisCore(props: CompositeStratigraphicScaleInfo) {\n const { axisType, axisLabel, axisUnit, totalHeight, packages, ...rest } =\n props;\n\n if (axisType == ColumnAxisType.ORDINAL) {\n return null;\n }\n\n let _axisLabel: string = axisLabel ?? \"Age\";\n let _axisUnit = axisUnit ?? \"Ma\";\n if (axisType == ColumnAxisType.DEPTH) {\n _axisLabel = \"Depth\";\n _axisUnit = \"m\";\n } else if (axisType == ColumnAxisType.HEIGHT) {\n _axisLabel = \"Height\";\n _axisUnit = \"m\";\n }\n\n return h(\"div.composite-age-axis\", rest, [\n h(VerticalAxisLabel, {\n label: _axisLabel,\n unit: _axisUnit,\n height: totalHeight,\n }),\n h(\n SVG,\n {\n className: \"age-axis-column\",\n style: { width: `22px`, height: `${totalHeight}px` },\n width: 22,\n height: totalHeight,\n },\n packages.map((group, i) => {\n const { key, scale } = group;\n\n return h(AgeAxis, {\n key,\n className: \"age-axis\",\n scale,\n tickSizeOuter: 3,\n });\n }),\n ),\n ]);\n}\n\nexport function AgeCursor({ age }) {\n /** A cursor that shows the age at a specific point on the age axis. */\n const scale = useCompositeScale();\n const heightPx = scale(age);\n\n if (age == null || heightPx == null) {\n return null;\n }\n\n return h(\n \"div.age-cursor\",\n {\n style: {\n top: heightPx,\n },\n },\n [h(\"div.line\"), h(AgeLabel, { age, className: \"label\" })],\n );\n}\n"],"names":["hyper","styles"],"mappings":";;;;;;;AAeA,MAAM,IAAIA,IAAM,OAAOC,GAAM;AAetB,SAAS,kBAAkB,OAAO;AACvC,QAAM,EAAE,QAAQ,OAAO,OAAO,MAAM,WAAW,WAAW;AAC1D,SAAO;AAAA,IACL;AAAA,IACA,EAAE,WAAW,OAAO,EAAE,SAAO;AAAA,IAC7B;AAAA,MACE;AAAA,MACA;AAAA,MACA,EAAE,GAAG,IAAI,EAAE,eAAe,EAAE,WAAW,gBAAA,GAAmB,IAAI;AAAA,IAAA;AAAA,EAChE;AAEJ;AAOO,SAAS,iBAAiB,MAA6B;AAC5D,QAAM,EAAE,UAAU,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AAAA,MACA;AAAA,QACE,WAAW;AAAA,QACX,OAAO,EAAE,OAAO,QAAQ,QAAQ,GAAG,WAAW,KAAA;AAAA,QAC9C,OAAO;AAAA,QACP,QAAQ;AAAA,MAAA;AAAA,MAEV,SAAS,IAAI,CAAC,OAAO,MAAM;AACzB,cAAM,EAAE,KAAK,MAAA,IAAU;AAEvB,eAAO,EAAE,SAAS;AAAA,UAChB;AAAA,UACA,WAAW;AAAA,UACX;AAAA,UACA,eAAe;AAAA,QAAA,CAChB;AAAA,MACH,CAAC;AAAA,IAAA;AAAA,EACH,CACD;AACH;AAEO,SAAS,UAAU,EAAE,OAAO;AAEjC,QAAM,QAAQ,kBAAA;AACd,QAAM,WAAW,MAAM,GAAG;AAE1B,MAAI,OAAO,QAAQ,YAAY,MAAM;AACnC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,OAAO;AAAA,QACL,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,IAEF,CAAC,EAAE,UAAU,GAAG,EAAE,UAAU,EAAE,KAAK,WAAW,SAAS,CAAC;AAAA,EAAA;AAE5D;"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const h$1 = require("@macrostrat/hyper");
|
|
4
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
5
|
+
const h__default = /* @__PURE__ */ _interopDefault(h$1);
|
|
3
6
|
const line = "_line_mz25k_38";
|
|
4
7
|
const label = "_label_mz25k_42";
|
|
5
8
|
const styles = {
|
|
@@ -12,7 +15,9 @@ const styles = {
|
|
|
12
15
|
label,
|
|
13
16
|
"composite-age-axis": "_composite-age-axis_mz25k_50"
|
|
14
17
|
};
|
|
15
|
-
|
|
18
|
+
let h = h__default.default.styled(styles);
|
|
19
|
+
Object.assign(h, styles);
|
|
20
|
+
exports.default = h;
|
|
16
21
|
exports.label = label;
|
|
17
22
|
exports.line = line;
|
|
18
23
|
//# sourceMappingURL=age-axis.module.sass.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"age-axis.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"age-axis.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import h$1 from "@macrostrat/hyper";
|
|
1
2
|
const line = "_line_mz25k_38";
|
|
2
3
|
const label = "_label_mz25k_42";
|
|
3
4
|
const styles = {
|
|
@@ -10,8 +11,10 @@ const styles = {
|
|
|
10
11
|
label,
|
|
11
12
|
"composite-age-axis": "_composite-age-axis_mz25k_50"
|
|
12
13
|
};
|
|
14
|
+
let h = h$1.styled(styles);
|
|
15
|
+
Object.assign(h, styles);
|
|
13
16
|
export {
|
|
14
|
-
|
|
17
|
+
h as default,
|
|
15
18
|
label,
|
|
16
19
|
line
|
|
17
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"age-axis.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"age-axis.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import h$1 from "@macrostrat/hyper";
|
|
2
|
-
import
|
|
2
|
+
import h$2 from "./age-model-overlay.module.sass.js";
|
|
3
3
|
import { useAPIResult } from "@macrostrat/ui-components";
|
|
4
4
|
import { buildColumnSurfaces } from "./prepare-units/dynamic-scales.js";
|
|
5
5
|
import { useMacrostratUnits, useCompositeScale } from "./data-provider/store.js";
|
|
6
|
-
const h = h$1.styled(
|
|
6
|
+
const h = h$1.styled(h$2);
|
|
7
7
|
function BoundaryAgeModelOverlay() {
|
|
8
8
|
const col_id = useMacrostratUnits()?.[0]?.col_id;
|
|
9
9
|
const scale = useCompositeScale();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"age-model-overlay.js","sources":["../src/age-model-overlay.ts"],"sourcesContent":["/** An in-development overlay for a column's age model.\n *\n * Age model info:\n * {\n * \"boundary_id\": 8049,\n * \"col_id\": 432,\n * \"section_id\": 3104,\n * \"interval_id\": 268,\n * \"interval_name\": \"Calymmian\",\n * \"age_bottom\": 1600,\n * \"age_top\": 1400,\n * \"rel_position\": 0.85,\n * \"model_age\": 1430,\n * \"boundary_status\": \"absolute\",\n * \"boundary_type\": \"\",\n * \"boundary_position\": null,\n * \"unit_below\": 11541,\n * \"unit_above\": 0,\n * \"ref_id\": 217\n * },\n *\n * */\n\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./age-model-overlay.module.sass\";\nimport { useAPIResult } from \"@macrostrat/ui-components\";\nimport { useCompositeScale, useMacrostratUnits } from \"./data-provider\";\nimport { buildColumnSurfaces } from \"./prepare-units/dynamic-scales\";\nimport { ExtUnit } from \"./prepare-units\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nconst h = hyper.styled(styles);\n\ninterface AgeModelSurface {\n boundary_id: number;\n col_id: number;\n section_id: number;\n interval_id: number;\n interval_name: string;\n age_bottom: number;\n age_top: number;\n rel_position: number;\n model_age: number;\n boundary_status: \"absolute\" | \"relative\" | \"modeled\";\n boundary_type: string;\n boundary_position: null | number;\n unit_below: number;\n unit_above: number;\n ref_id: number;\n}\n\nexport function BoundaryAgeModelOverlay() {\n const col_id = (useMacrostratUnits() as ExtUnit[])?.[0]?.col_id;\n const scale = useCompositeScale();\n\n const ageModel = useAPIResult(\n \"https://dev.macrostrat.org/api/v2/age_model\",\n { col_id },\n (res) => res.success.data,\n );\n\n if (ageModel == null) {\n return null;\n }\n\n return h(\n \"div.boundary-age-model\",\n ageModel.map((surface) => {\n const height = scale(surface.model_age);\n\n return h(\"div.boundary-age-model-surface\", {\n key: surface.boundary_id,\n style: { top: `${height}px` },\n });\n }),\n );\n}\n\nexport function ComputedSurfacesOverlay() {\n /** Overlay showing age surfaces. This is like the boundary age model overlay but\n * it is computed on the fly from unit tops and bottoms.\n */\n const units = useMacrostratUnits() as UnitLong[];\n const surfaces = buildColumnSurfaces(units);\n const scale = useCompositeScale();\n\n return h(\n \"div.boundary-age-model\",\n surfaces.map((surface) => {\n const height = scale(surface.age);\n return h(\"div.boundary-age-model-surface\", {\n key: surface.index,\n style: { top: `${height}px` },\n });\n }),\n );\n}\n"],"names":["hyper"],"mappings":";;;;;AA8BA,MAAM,IAAIA,IAAM,
|
|
1
|
+
{"version":3,"file":"age-model-overlay.js","sources":["../src/age-model-overlay.ts"],"sourcesContent":["/** An in-development overlay for a column's age model.\n *\n * Age model info:\n * {\n * \"boundary_id\": 8049,\n * \"col_id\": 432,\n * \"section_id\": 3104,\n * \"interval_id\": 268,\n * \"interval_name\": \"Calymmian\",\n * \"age_bottom\": 1600,\n * \"age_top\": 1400,\n * \"rel_position\": 0.85,\n * \"model_age\": 1430,\n * \"boundary_status\": \"absolute\",\n * \"boundary_type\": \"\",\n * \"boundary_position\": null,\n * \"unit_below\": 11541,\n * \"unit_above\": 0,\n * \"ref_id\": 217\n * },\n *\n * */\n\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./age-model-overlay.module.sass\";\nimport { useAPIResult } from \"@macrostrat/ui-components\";\nimport { useCompositeScale, useMacrostratUnits } from \"./data-provider\";\nimport { buildColumnSurfaces } from \"./prepare-units/dynamic-scales\";\nimport { ExtUnit } from \"./prepare-units\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nconst h = hyper.styled(styles);\n\ninterface AgeModelSurface {\n boundary_id: number;\n col_id: number;\n section_id: number;\n interval_id: number;\n interval_name: string;\n age_bottom: number;\n age_top: number;\n rel_position: number;\n model_age: number;\n boundary_status: \"absolute\" | \"relative\" | \"modeled\";\n boundary_type: string;\n boundary_position: null | number;\n unit_below: number;\n unit_above: number;\n ref_id: number;\n}\n\nexport function BoundaryAgeModelOverlay() {\n const col_id = (useMacrostratUnits() as ExtUnit[])?.[0]?.col_id;\n const scale = useCompositeScale();\n\n const ageModel = useAPIResult(\n \"https://dev.macrostrat.org/api/v2/age_model\",\n { col_id },\n (res) => res.success.data,\n );\n\n if (ageModel == null) {\n return null;\n }\n\n return h(\n \"div.boundary-age-model\",\n ageModel.map((surface) => {\n const height = scale(surface.model_age);\n\n return h(\"div.boundary-age-model-surface\", {\n key: surface.boundary_id,\n style: { top: `${height}px` },\n });\n }),\n );\n}\n\nexport function ComputedSurfacesOverlay() {\n /** Overlay showing age surfaces. This is like the boundary age model overlay but\n * it is computed on the fly from unit tops and bottoms.\n */\n const units = useMacrostratUnits() as UnitLong[];\n const surfaces = buildColumnSurfaces(units);\n const scale = useCompositeScale();\n\n return h(\n \"div.boundary-age-model\",\n surfaces.map((surface) => {\n const height = scale(surface.age);\n return h(\"div.boundary-age-model-surface\", {\n key: surface.index,\n style: { top: `${height}px` },\n });\n }),\n );\n}\n"],"names":["hyper","styles"],"mappings":";;;;;AA8BA,MAAM,IAAIA,IAAM,OAAOC,GAAM;AAoBtB,SAAS,0BAA0B;AACxC,QAAM,SAAU,uBAAqC,CAAC,GAAG;AACzD,QAAM,QAAQ,kBAAA;AAEd,QAAM,WAAW;AAAA,IACf;AAAA,IACA,EAAE,OAAA;AAAA,IACF,CAAC,QAAQ,IAAI,QAAQ;AAAA,EAAA;AAGvB,MAAI,YAAY,MAAM;AACpB,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,SAAS,IAAI,CAAC,YAAY;AACxB,YAAM,SAAS,MAAM,QAAQ,SAAS;AAEtC,aAAO,EAAE,kCAAkC;AAAA,QACzC,KAAK,QAAQ;AAAA,QACb,OAAO,EAAE,KAAK,GAAG,MAAM,KAAA;AAAA,MAAK,CAC7B;AAAA,IACH,CAAC;AAAA,EAAA;AAEL;AAEO,SAAS,0BAA0B;AAIxC,QAAM,QAAQ,mBAAA;AACd,QAAM,WAAW,oBAAoB,KAAK;AAC1C,QAAM,QAAQ,kBAAA;AAEd,SAAO;AAAA,IACL;AAAA,IACA,SAAS,IAAI,CAAC,YAAY;AACxB,YAAM,SAAS,MAAM,QAAQ,GAAG;AAChC,aAAO,EAAE,kCAAkC;AAAA,QACzC,KAAK,QAAQ;AAAA,QACb,OAAO,EAAE,KAAK,GAAG,MAAM,KAAA;AAAA,MAAK,CAC7B;AAAA,IACH,CAAC;AAAA,EAAA;AAEL;"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
const h$1 = require("@macrostrat/hyper");
|
|
3
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
4
|
+
const h__default = /* @__PURE__ */ _interopDefault(h$1);
|
|
2
5
|
const styles = {
|
|
3
6
|
"boundary-age-model": "_boundary-age-model_16scl_1",
|
|
4
7
|
"boundary-age-model-surface": "_boundary-age-model-surface_16scl_8"
|
|
5
8
|
};
|
|
6
|
-
|
|
9
|
+
let h = h__default.default.styled(styles);
|
|
10
|
+
Object.assign(h, styles);
|
|
11
|
+
module.exports = h;
|
|
7
12
|
//# sourceMappingURL=age-model-overlay.module.sass.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"age-model-overlay.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"age-model-overlay.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import h$1 from "@macrostrat/hyper";
|
|
1
2
|
const styles = {
|
|
2
3
|
"boundary-age-model": "_boundary-age-model_16scl_1",
|
|
3
4
|
"boundary-age-model-surface": "_boundary-age-model-surface_16scl_8"
|
|
4
5
|
};
|
|
6
|
+
let h = h$1.styled(styles);
|
|
7
|
+
Object.assign(h, styles);
|
|
5
8
|
export {
|
|
6
|
-
|
|
9
|
+
h as default
|
|
7
10
|
};
|
|
8
11
|
//# sourceMappingURL=age-model-overlay.module.sass.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"age-model-overlay.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"age-model-overlay.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
package/dist/column.js
CHANGED
|
@@ -3,7 +3,7 @@ import { hyperStyled } from "@macrostrat/hyper";
|
|
|
3
3
|
import { useDarkMode, Box, extractPadding } from "@macrostrat/ui-components";
|
|
4
4
|
import classNames from "classnames";
|
|
5
5
|
import { useCallback } from "react";
|
|
6
|
-
import
|
|
6
|
+
import h$1 from "./column.module.sass.js";
|
|
7
7
|
import { UnitComponent } from "./units/index.js";
|
|
8
8
|
import { CompositeTimescale, SectionsColumn } from "./section.js";
|
|
9
9
|
import { CompositeAgeAxis, ApproximateHeightAxis } from "./age-axis.js";
|
|
@@ -15,7 +15,7 @@ import { MacrostratColumnDataProvider, useMacrostratColumnData, useCompositeScal
|
|
|
15
15
|
import { UnitSelectionPopover } from "./unit-details/popover.js";
|
|
16
16
|
import { UnitKeyboardNavigation, useColumnRef, useUnitSelectionDispatch } from "./data-provider/unit-selection.js";
|
|
17
17
|
import { Identifier, ReferencesField } from "./unit-details/panel.js";
|
|
18
|
-
const h = hyperStyled(
|
|
18
|
+
const h = hyperStyled(h$1);
|
|
19
19
|
function Column(props) {
|
|
20
20
|
const {
|
|
21
21
|
showUnitPopover = false,
|
package/dist/column.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column.js","sources":["../src/column.ts"],"sourcesContent":["import { ColumnAxisType } from \"@macrostrat/column-components\";\nimport { hyperStyled } from \"@macrostrat/hyper\";\nimport {\n Box,\n extractPadding,\n Padding,\n useDarkMode,\n} from \"@macrostrat/ui-components\";\nimport classNames from \"classnames\";\nimport {\n HTMLAttributes,\n useCallback,\n CSSProperties,\n ComponentType,\n} from \"react\";\nimport styles from \"./column.module.sass\";\nimport { UnitComponent } from \"./units\";\nimport {\n UnitKeyboardNavigation,\n useColumnRef,\n useUnitSelectionDispatch,\n} from \"./data-provider\";\n\nimport {\n Identifier,\n ReferencesField,\n UnitSelectionPopover,\n} from \"./unit-details\";\nimport {\n MacrostratColumnDataProvider,\n useCompositeScale,\n useMacrostratColumnData,\n} from \"./data-provider\";\nimport {\n SectionSharedProps,\n CompositeTimescale,\n SectionsColumn,\n} from \"./section\";\nimport { ApproximateHeightAxis, CompositeAgeAxis } from \"./age-axis\";\nimport {\n MergeSectionsMode,\n usePreparedColumnUnits,\n HybridScaleType,\n ColumnHeightScaleOptions,\n} from \"./prepare-units\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport { NonIdealState } from \"@blueprintjs/core\";\nimport { DataField } from \"@macrostrat/data-components\";\nimport { ScaleContinuousNumeric } from \"d3-scale\";\n\nconst h = hyperStyled(styles);\n\ninterface BaseColumnProps extends Omit<\n SectionSharedProps,\n \"unconformityLabels\"\n> {\n className?: string;\n showLabelColumn?: boolean;\n keyboardNavigation?: boolean;\n showLabels?: boolean;\n maxInternalColumns?: number;\n // Timescale properties\n showTimescale?: boolean;\n timescaleLevels?: number | [number, number];\n unconformityLabels?: boolean | UnconformityLabelPlacement;\n onMouseOver?: (\n unit: UnitLong | null,\n height: number | null,\n evt: MouseEvent,\n ) => void;\n}\n\nexport type UnconformityLabelPlacement = \"minimal\" | \"prominent\" | \"none\";\n\nexport interface ColumnProps\n extends Padding, BaseColumnProps, ColumnHeightScaleOptions {\n // Macrostrat units\n units: UnitLong[];\n t_age?: number;\n b_age?: number;\n t_pos?: number;\n b_pos?: number;\n mergeSections?: MergeSectionsMode;\n showUnitPopover?: boolean;\n allowUnitSelection?: boolean;\n selectedUnit?: number | null;\n onUnitSelected?: (unitID: number | null, unit: any) => void;\n // Unconformity height in pixels\n unconformityHeight?: number;\n scale?: ScaleContinuousNumeric<number, number>;\n}\n\nexport function Column(props: ColumnProps) {\n const {\n showUnitPopover = false,\n keyboardNavigation = false,\n mergeSections,\n onUnitSelected,\n selectedUnit,\n children,\n units: rawUnits,\n t_age,\n b_age,\n t_pos,\n b_pos,\n unconformityHeight = 30,\n targetUnitHeight = 20,\n pixelScale,\n minPixelScale = 0.2,\n minSectionHeight = 50,\n collapseSmallUnconformities = true,\n allowUnitSelection = false,\n hybridScale,\n scale,\n axisType,\n ...rest\n } = props;\n\n /* Make pixelScale and targetUnitHeight mutually exclusive. PixelScale implies\n * standardization of scales in all sections */\n let _targetUnitHeight = targetUnitHeight;\n let _minSectionHeight = minSectionHeight;\n let _minPixelScale = minPixelScale;\n if (pixelScale != null) {\n _targetUnitHeight = null;\n _minSectionHeight = 0;\n _minPixelScale = pixelScale;\n }\n\n // Handle special cases for hybrid scales (WIP, we need to regularize this)\n let _axisType = axisType ?? ColumnAxisType.AGE;\n let ageAxisComponent = CompositeAgeAxis;\n if (\n hybridScale?.type === HybridScaleType.ApproximateHeight &&\n _axisType != ColumnAxisType.AGE\n ) {\n // Use approximate height axis for non-age columns if a non-age axis type is requested\n ageAxisComponent = ApproximateHeightAxis;\n _axisType = ColumnAxisType.AGE;\n }\n\n const { sections, units, totalHeight } = usePreparedColumnUnits(rawUnits, {\n axisType: _axisType,\n t_age,\n b_age,\n t_pos,\n b_pos,\n mergeSections,\n targetUnitHeight: _targetUnitHeight,\n unconformityHeight,\n pixelScale,\n minPixelScale: _minPixelScale,\n minSectionHeight: _minSectionHeight,\n collapseSmallUnconformities,\n // TODO: consider unifying scale and hybridScale options\n scale,\n hybridScale,\n });\n\n if (sections.length === 0) {\n return h(\n \"div.column-container.empty\",\n h(NonIdealState, {\n title: \"Empty column\",\n description: \"No sections found in this column.\",\n icon: \"warning-sign\",\n }),\n );\n }\n\n return h(\n MacrostratColumnDataProvider,\n {\n units,\n sections,\n totalHeight,\n axisType: _axisType,\n allowUnitSelection: showUnitPopover || allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n },\n h(ColumnInner, { ageAxisComponent, ...rest }, [\n children,\n h.if(showUnitPopover)(UnitSelectionPopover),\n h.if(keyboardNavigation)(UnitKeyboardNavigation, { units }),\n ]),\n );\n}\n\ninterface ColumnInnerProps extends BaseColumnProps {\n ageAxisComponent?: ComponentType;\n}\n\nfunction ColumnInner(props: ColumnInnerProps) {\n const padding = extractPadding(props);\n\n // TODO: integrate padding vars more closely with the rest of the spacing (right now padding is a bit ad-hoc)\n const paddingVars: any = {\n \"--column-padding-top\": `${padding.paddingTop}px`,\n \"--column-padding-bottom\": `${padding.paddingBottom}px`,\n \"--column-padding-left\": `${padding.paddingLeft}px`,\n \"--column-padding-right\": `${padding.paddingRight}px`,\n };\n\n const {\n unitComponent = UnitComponent,\n unconformityLabels = \"minimal\",\n showLabels = true,\n width: _width = 300,\n columnWidth: _columnWidth = 150,\n showLabelColumn: _showLabelColumn = true,\n className,\n clipUnits = false,\n children,\n showTimescale,\n timescaleLevels,\n maxInternalColumns,\n onMouseOver,\n ageAxisComponent = CompositeAgeAxis,\n } = props;\n\n const { axisType } = useMacrostratColumnData();\n\n const columnRef = useColumnRef();\n\n // Coalesce unconformity label setting to a boolean\n let _timescaleUnconformityLabels = false;\n let _sectionUnconformityLabels = false;\n if (unconformityLabels === true || unconformityLabels === \"prominent\") {\n _sectionUnconformityLabels = true;\n } else if (unconformityLabels === \"minimal\") {\n _timescaleUnconformityLabels = true;\n }\n\n let width = _width;\n let columnWidth = _columnWidth;\n if (columnWidth > width) {\n columnWidth = width;\n }\n let showLabelColumn = _showLabelColumn;\n if (columnWidth > width - 10) {\n showLabelColumn = false;\n }\n\n let _showTimescale = showTimescale ?? true;\n if (timescaleLevels != null) {\n _showTimescale = true;\n }\n _showTimescale = axisType == ColumnAxisType.AGE && _showTimescale;\n\n return h(\n ColumnContainer,\n {\n ...useMouseEventHandlers(onMouseOver),\n style: paddingVars,\n className,\n },\n h(\"div.column\", { ref: columnRef }, [\n h(ageAxisComponent),\n h.if(_showTimescale)(CompositeTimescale, {\n levels: timescaleLevels,\n unconformityLabels: _timescaleUnconformityLabels,\n }),\n h(SectionsColumn, {\n unitComponent,\n showLabels,\n width,\n columnWidth,\n showLabelColumn,\n clipUnits,\n unconformityLabels: _sectionUnconformityLabels,\n maxInternalColumns,\n }),\n children,\n ]),\n );\n}\n\ntype ColumnMouseOverHandler = (\n unit: UnitLong | null,\n height: number | null,\n evt: MouseEvent,\n) => void;\n\nfunction useMouseEventHandlers(\n _onMouseOver: ColumnMouseOverHandler | null = null,\n) {\n /** Click event handler */\n\n // Click handler for unit selection\n const dispatch = useUnitSelectionDispatch();\n const onClick = useCallback(\n (evt) => {\n dispatch?.(null, null);\n },\n [dispatch],\n );\n\n /** Hover event handlers */\n const scale = useCompositeScale();\n\n const onMouseOver = useCallback(\n (evt) => {\n const height = scale.invert(\n evt.clientY - evt.currentTarget.getBoundingClientRect().top,\n );\n _onMouseOver?.(null, height, evt);\n },\n [scale, _onMouseOver],\n );\n\n const onMouseOut = useCallback(() => {\n _onMouseOver?.(null, null, null);\n }, [_onMouseOver]);\n\n if (_onMouseOver == null) {\n return {\n onClick,\n onMouseOver: undefined,\n onMouseMove: undefined,\n onMouseOut: undefined,\n };\n }\n\n return { onMouseOver, onMouseMove: onMouseOver, onMouseOut, onClick };\n}\n\nexport interface ColumnContainerProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n style?: CSSProperties;\n}\n\nexport function ColumnContainer(props: ColumnContainerProps) {\n const { className, ...rest } = props;\n const darkMode = useDarkMode();\n\n return h(Box, {\n className: classNames(\n className,\n {\n \"dark-mode\": darkMode?.isEnabled ?? false,\n },\n \"column-container\",\n ),\n ...rest,\n });\n}\n\nexport function ColumnBasicInfo({\n data,\n showColumnID = true,\n showReferences = true,\n}) {\n if (data == null) return null;\n return h(\"div.column-info\", [\n h(\"div.column-title-row\", [\n h(\"h2\", data.col_name),\n h.if(showColumnID)(\"h4\", h(Identifier, { id: data.col_id })),\n ]),\n h(DataField, { row: true, label: \"Group\", value: data.col_group }),\n h.if(showReferences)(ReferencesField, {\n refs: data.refs,\n inline: false,\n row: false,\n className: \"column-refs\",\n }),\n ]);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAkDA,MAAM,IAAI,YAAY,MAAM;AA0CrB,SAAS,OAAO,OAAoB;AACzC,QAAM;AAAA,IACJ,kBAAkB;AAAA,IAClB,qBAAqB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,qBAAqB;AAAA,IACrB,mBAAmB;AAAA,IACnB;AAAA,IACA,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,IACnB,8BAA8B;AAAA,IAC9B,qBAAqB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD;AAIJ,MAAI,oBAAoB;AACxB,MAAI,oBAAoB;AACxB,MAAI,iBAAiB;AACrB,MAAI,cAAc,MAAM;AACtB,wBAAoB;AACpB,wBAAoB;AACpB,qBAAiB;AAAA,EACnB;AAGA,MAAI,YAAY,YAAY,eAAe;AAC3C,MAAI,mBAAmB;AACvB,MACE,aAAa,SAAS,gBAAgB,qBACtC,aAAa,eAAe,KAC5B;AAEA,uBAAmB;AACnB,gBAAY,eAAe;AAAA,EAC7B;AAEA,QAAM,EAAE,UAAU,OAAO,YAAA,IAAgB,uBAAuB,UAAU;AAAA,IACxE,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf,kBAAkB;AAAA,IAClB;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,EAAA,CACD;AAED,MAAI,SAAS,WAAW,GAAG;AACzB,WAAO;AAAA,MACL;AAAA,MACA,EAAE,eAAe;AAAA,QACf,OAAO;AAAA,QACP,aAAa;AAA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AAAA,MACb,aAAa;AAAA,MACb,YAAY;AAAA,IAAA;AAAA,EAEhB;AAEA,SAAO,EAAE,aAAa,aAAa,aAAa,YAAY,QAAA;AAC9D;AAOO,SAAS,gBAAgB,OAA6B;AAC3D,QAAM,EAAE,WAAW,GAAG,KAAA,IAAS;AAC/B,QAAM,WAAW,YAAA;AAEjB,SAAO,EAAE,KAAK;AAAA,IACZ,WAAW;AAAA,MACT;AAAA,MACA;AAAA,QACE,aAAa,UAAU,aAAa;AAAA,MAAA;AAAA,MAEtC;AAAA,IAAA;AAAA,IAEF,GAAG;AAAA,EAAA,CACJ;AACH;AAEO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA,eAAe;AAAA,EACf,iBAAiB;AACnB,GAAG;AACD,MAAI,QAAQ,KAAM,QAAO;AACzB,SAAO,EAAE,mBAAmB;AAAA,IAC1B,EAAE,wBAAwB;AAAA,MACxB,EAAE,MAAM,KAAK,QAAQ;AAAA,MACrB,EAAE,GAAG,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,KAAK,QAAQ,CAAC;AAAA,IAAA,CAC5D;AAAA,IACD,EAAE,WAAW,EAAE,KAAK,MAAM,OAAO,SAAS,OAAO,KAAK,WAAW;AAAA,IACjE,EAAE,GAAG,cAAc,EAAE,iBAAiB;AAAA,MACpC,MAAM,KAAK;AAAA,MACX,QAAQ;AAAA,MACR,KAAK;AAAA,MACL,WAAW;AAAA,IAAA,CACZ;AAAA,EAAA,CACF;AACH;"}
|
|
1
|
+
{"version":3,"file":"column.js","sources":["../src/column.ts"],"sourcesContent":["import { ColumnAxisType } from \"@macrostrat/column-components\";\nimport { hyperStyled } from \"@macrostrat/hyper\";\nimport {\n Box,\n extractPadding,\n Padding,\n useDarkMode,\n} from \"@macrostrat/ui-components\";\nimport classNames from \"classnames\";\nimport {\n HTMLAttributes,\n useCallback,\n CSSProperties,\n ComponentType,\n} from \"react\";\nimport styles from \"./column.module.sass\";\nimport { UnitComponent } from \"./units\";\nimport {\n UnitKeyboardNavigation,\n useColumnRef,\n useUnitSelectionDispatch,\n} from \"./data-provider\";\n\nimport {\n Identifier,\n ReferencesField,\n UnitSelectionPopover,\n} from \"./unit-details\";\nimport {\n MacrostratColumnDataProvider,\n useCompositeScale,\n useMacrostratColumnData,\n} from \"./data-provider\";\nimport {\n SectionSharedProps,\n CompositeTimescale,\n SectionsColumn,\n} from \"./section\";\nimport { ApproximateHeightAxis, CompositeAgeAxis } from \"./age-axis\";\nimport {\n MergeSectionsMode,\n usePreparedColumnUnits,\n HybridScaleType,\n ColumnHeightScaleOptions,\n} from \"./prepare-units\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport { NonIdealState } from \"@blueprintjs/core\";\nimport { DataField } from \"@macrostrat/data-components\";\nimport { ScaleContinuousNumeric } from \"d3-scale\";\n\nconst h = hyperStyled(styles);\n\ninterface BaseColumnProps extends Omit<\n SectionSharedProps,\n \"unconformityLabels\"\n> {\n className?: string;\n showLabelColumn?: boolean;\n keyboardNavigation?: boolean;\n showLabels?: boolean;\n maxInternalColumns?: number;\n // Timescale properties\n showTimescale?: boolean;\n timescaleLevels?: number | [number, number];\n unconformityLabels?: boolean | UnconformityLabelPlacement;\n onMouseOver?: (\n unit: UnitLong | null,\n height: number | null,\n evt: MouseEvent,\n ) => void;\n}\n\nexport type UnconformityLabelPlacement = \"minimal\" | \"prominent\" | \"none\";\n\nexport interface ColumnProps\n extends Padding, BaseColumnProps, ColumnHeightScaleOptions {\n // Macrostrat units\n units: UnitLong[];\n t_age?: number;\n b_age?: number;\n t_pos?: number;\n b_pos?: number;\n mergeSections?: MergeSectionsMode;\n showUnitPopover?: boolean;\n allowUnitSelection?: boolean;\n selectedUnit?: number | null;\n onUnitSelected?: (unitID: number | null, unit: any) => void;\n // Unconformity height in pixels\n unconformityHeight?: number;\n scale?: ScaleContinuousNumeric<number, number>;\n}\n\nexport function Column(props: ColumnProps) {\n const {\n showUnitPopover = false,\n keyboardNavigation = false,\n mergeSections,\n onUnitSelected,\n selectedUnit,\n children,\n units: rawUnits,\n t_age,\n b_age,\n t_pos,\n b_pos,\n unconformityHeight = 30,\n targetUnitHeight = 20,\n pixelScale,\n minPixelScale = 0.2,\n minSectionHeight = 50,\n collapseSmallUnconformities = true,\n allowUnitSelection = false,\n hybridScale,\n scale,\n axisType,\n ...rest\n } = props;\n\n /* Make pixelScale and targetUnitHeight mutually exclusive. PixelScale implies\n * standardization of scales in all sections */\n let _targetUnitHeight = targetUnitHeight;\n let _minSectionHeight = minSectionHeight;\n let _minPixelScale = minPixelScale;\n if (pixelScale != null) {\n _targetUnitHeight = null;\n _minSectionHeight = 0;\n _minPixelScale = pixelScale;\n }\n\n // Handle special cases for hybrid scales (WIP, we need to regularize this)\n let _axisType = axisType ?? ColumnAxisType.AGE;\n let ageAxisComponent = CompositeAgeAxis;\n if (\n hybridScale?.type === HybridScaleType.ApproximateHeight &&\n _axisType != ColumnAxisType.AGE\n ) {\n // Use approximate height axis for non-age columns if a non-age axis type is requested\n ageAxisComponent = ApproximateHeightAxis;\n _axisType = ColumnAxisType.AGE;\n }\n\n const { sections, units, totalHeight } = usePreparedColumnUnits(rawUnits, {\n axisType: _axisType,\n t_age,\n b_age,\n t_pos,\n b_pos,\n mergeSections,\n targetUnitHeight: _targetUnitHeight,\n unconformityHeight,\n pixelScale,\n minPixelScale: _minPixelScale,\n minSectionHeight: _minSectionHeight,\n collapseSmallUnconformities,\n // TODO: consider unifying scale and hybridScale options\n scale,\n hybridScale,\n });\n\n if (sections.length === 0) {\n return h(\n \"div.column-container.empty\",\n h(NonIdealState, {\n title: \"Empty column\",\n description: \"No sections found in this column.\",\n icon: \"warning-sign\",\n }),\n );\n }\n\n return h(\n MacrostratColumnDataProvider,\n {\n units,\n sections,\n totalHeight,\n axisType: _axisType,\n allowUnitSelection: showUnitPopover || allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n },\n h(ColumnInner, { ageAxisComponent, ...rest }, [\n children,\n h.if(showUnitPopover)(UnitSelectionPopover),\n h.if(keyboardNavigation)(UnitKeyboardNavigation, { units }),\n ]),\n );\n}\n\ninterface ColumnInnerProps extends BaseColumnProps {\n ageAxisComponent?: ComponentType;\n}\n\nfunction ColumnInner(props: ColumnInnerProps) {\n const padding = extractPadding(props);\n\n // TODO: integrate padding vars more closely with the rest of the spacing (right now padding is a bit ad-hoc)\n const paddingVars: any = {\n \"--column-padding-top\": `${padding.paddingTop}px`,\n \"--column-padding-bottom\": `${padding.paddingBottom}px`,\n \"--column-padding-left\": `${padding.paddingLeft}px`,\n \"--column-padding-right\": `${padding.paddingRight}px`,\n };\n\n const {\n unitComponent = UnitComponent,\n unconformityLabels = \"minimal\",\n showLabels = true,\n width: _width = 300,\n columnWidth: _columnWidth = 150,\n showLabelColumn: _showLabelColumn = true,\n className,\n clipUnits = false,\n children,\n showTimescale,\n timescaleLevels,\n maxInternalColumns,\n onMouseOver,\n ageAxisComponent = CompositeAgeAxis,\n } = props;\n\n const { axisType } = useMacrostratColumnData();\n\n const columnRef = useColumnRef();\n\n // Coalesce unconformity label setting to a boolean\n let _timescaleUnconformityLabels = false;\n let _sectionUnconformityLabels = false;\n if (unconformityLabels === true || unconformityLabels === \"prominent\") {\n _sectionUnconformityLabels = true;\n } else if (unconformityLabels === \"minimal\") {\n _timescaleUnconformityLabels = true;\n }\n\n let width = _width;\n let columnWidth = _columnWidth;\n if (columnWidth > width) {\n columnWidth = width;\n }\n let showLabelColumn = _showLabelColumn;\n if (columnWidth > width - 10) {\n showLabelColumn = false;\n }\n\n let _showTimescale = showTimescale ?? true;\n if (timescaleLevels != null) {\n _showTimescale = true;\n }\n _showTimescale = axisType == ColumnAxisType.AGE && _showTimescale;\n\n return h(\n ColumnContainer,\n {\n ...useMouseEventHandlers(onMouseOver),\n style: paddingVars,\n className,\n },\n h(\"div.column\", { ref: columnRef }, [\n h(ageAxisComponent),\n h.if(_showTimescale)(CompositeTimescale, {\n levels: timescaleLevels,\n unconformityLabels: _timescaleUnconformityLabels,\n }),\n h(SectionsColumn, {\n unitComponent,\n showLabels,\n width,\n columnWidth,\n showLabelColumn,\n clipUnits,\n unconformityLabels: _sectionUnconformityLabels,\n maxInternalColumns,\n }),\n children,\n ]),\n );\n}\n\ntype ColumnMouseOverHandler = (\n unit: UnitLong | null,\n height: number | null,\n evt: MouseEvent,\n) => void;\n\nfunction useMouseEventHandlers(\n _onMouseOver: ColumnMouseOverHandler | null = null,\n) {\n /** Click event handler */\n\n // Click handler for unit selection\n const dispatch = useUnitSelectionDispatch();\n const onClick = useCallback(\n (evt) => {\n dispatch?.(null, null);\n },\n [dispatch],\n );\n\n /** Hover event handlers */\n const scale = useCompositeScale();\n\n const onMouseOver = useCallback(\n (evt) => {\n const height = scale.invert(\n evt.clientY - evt.currentTarget.getBoundingClientRect().top,\n );\n _onMouseOver?.(null, height, evt);\n },\n [scale, _onMouseOver],\n );\n\n const onMouseOut = useCallback(() => {\n _onMouseOver?.(null, null, null);\n }, [_onMouseOver]);\n\n if (_onMouseOver == null) {\n return {\n onClick,\n onMouseOver: undefined,\n onMouseMove: undefined,\n onMouseOut: undefined,\n };\n }\n\n return { onMouseOver, onMouseMove: onMouseOver, onMouseOut, onClick };\n}\n\nexport interface ColumnContainerProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n style?: CSSProperties;\n}\n\nexport function ColumnContainer(props: ColumnContainerProps) {\n const { className, ...rest } = props;\n const darkMode = useDarkMode();\n\n return h(Box, {\n className: classNames(\n className,\n {\n \"dark-mode\": darkMode?.isEnabled ?? false,\n },\n \"column-container\",\n ),\n ...rest,\n });\n}\n\nexport function ColumnBasicInfo({\n data,\n showColumnID = true,\n showReferences = true,\n}) {\n if (data == null) return null;\n return h(\"div.column-info\", [\n h(\"div.column-title-row\", [\n h(\"h2\", data.col_name),\n h.if(showColumnID)(\"h4\", h(Identifier, { id: data.col_id })),\n ]),\n h(DataField, { row: true, label: \"Group\", value: data.col_group }),\n h.if(showReferences)(ReferencesField, {\n refs: data.refs,\n inline: false,\n row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,SAAO,EAAE,aAAa,aAAa,aAAa,YAAY,QAAA;AAC9D;AAOO,SAAS,gBAAgB,OAA6B;AAC3D,QAAM,EAAE,WAAW,GAAG,KAAA,IAAS;AAC/B,QAAM,WAAW,YAAA;AAEjB,SAAO,EAAE,KAAK;AAAA,IACZ,WAAW;AAAA,MACT;AAAA,MACA;AAAA,QACE,aAAa,UAAU,aAAa;AAAA,MAAA;AAAA,MAEtC;AAAA,IAAA;AAAA,IAEF,GAAG;AAAA,EAAA,CACJ;AACH;AAEO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA,eAAe;AAAA,EACf,iBAAiB;AACnB,GAAG;AACD,MAAI,QAAQ,KAAM,QAAO;AACzB,SAAO,EAAE,mBAAmB;AAAA,IAC1B,EAAE,wBAAwB;AAAA,MACxB,EAAE,MAAM,KAAK,QAAQ;AAAA,MACrB,EAAE,GAAG,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,KAAK,QAAQ,CAAC;AAAA,IAAA,CAC5D;AAAA,IACD,EAAE,WAAW,EAAE,KAAK,MAAM,OAAO,SAAS,OAAO,KAAK,WAAW;AAAA,IACjE,EAAE,GAAG,cAAc,EAAE,iBAAiB;AAAA,MACpC,MAAM,KAAK;AAAA,MACX,QAAQ;AAAA,MACR,KAAK;AAAA,MACL,WAAW;AAAA,IAAA,CACZ;AAAA,EAAA,CACF;AACH;"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const h$1 = require("@macrostrat/hyper");
|
|
4
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
5
|
+
const h__default = /* @__PURE__ */ _interopDefault(h$1);
|
|
3
6
|
const unconformity = "_unconformity_15bga_131";
|
|
4
7
|
const giga = "_giga_15bga_146";
|
|
5
8
|
const mega = "_mega_15bga_149";
|
|
@@ -23,7 +26,9 @@ const styles = {
|
|
|
23
26
|
prefix,
|
|
24
27
|
"column-title-row": "_column-title-row_15bga_185"
|
|
25
28
|
};
|
|
26
|
-
|
|
29
|
+
let h = h__default.default.styled(styles);
|
|
30
|
+
Object.assign(h, styles);
|
|
31
|
+
exports.default = h;
|
|
27
32
|
exports.giga = giga;
|
|
28
33
|
exports.large = large;
|
|
29
34
|
exports.mega = mega;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"column.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import h$1 from "@macrostrat/hyper";
|
|
1
2
|
const unconformity = "_unconformity_15bga_131";
|
|
2
3
|
const giga = "_giga_15bga_146";
|
|
3
4
|
const mega = "_mega_15bga_149";
|
|
@@ -21,8 +22,10 @@ const styles = {
|
|
|
21
22
|
prefix,
|
|
22
23
|
"column-title-row": "_column-title-row_15bga_185"
|
|
23
24
|
};
|
|
25
|
+
let h = h$1.styled(styles);
|
|
26
|
+
Object.assign(h, styles);
|
|
24
27
|
export {
|
|
25
|
-
|
|
28
|
+
h as default,
|
|
26
29
|
giga,
|
|
27
30
|
large,
|
|
28
31
|
mega,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"column.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import h$1 from "@macrostrat/hyper";
|
|
2
|
-
import
|
|
2
|
+
import h$2 from "./main.module.sass.js";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { useInDarkMode } from "@macrostrat/ui-components";
|
|
5
5
|
import { CompositeTimescaleCore } from "../section.js";
|
|
@@ -14,7 +14,7 @@ import { UnitSelectionProvider } from "../data-provider/store.js";
|
|
|
14
14
|
import { UnitDetailsFeature } from "../unit-details/panel.js";
|
|
15
15
|
import { UnitSelectionPopover } from "../unit-details/popover.js";
|
|
16
16
|
import { UnitKeyboardNavigation, useUnitSelectionDispatch, useColumnRef } from "../data-provider/unit-selection.js";
|
|
17
|
-
const h = h$1.styled(
|
|
17
|
+
const h = h$1.styled(h$2);
|
|
18
18
|
function MainChartArea({ children }) {
|
|
19
19
|
const columnRef = useColumnRef();
|
|
20
20
|
return h("div.main-chart", { ref: columnRef }, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sources":["../../src/correlation-chart/main.ts"],"sourcesContent":["/** Correlation chart */\nimport {\n UnitSelectionProvider,\n UnitKeyboardNavigation,\n useUnitSelectionDispatch,\n useColumnRef,\n} from \"../data-provider\";\nimport { UnitDetailsFeature, UnitSelectionPopover } from \"../unit-details\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { useMemo } from \"react\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport { CompositeTimescaleCore } from \"../section\";\nimport classNames from \"classnames\";\nimport {\n findLaterallyExtensiveUnits,\n splitStratIntoBoxes,\n UnitGroupBox,\n CorrelationChartSettings,\n buildCorrelationChartData,\n} from \"./prepare-data\";\nimport {\n CompositeAgeAxisCore,\n CompositeStratigraphicScaleInfo,\n} from \"../age-axis\";\nimport {\n ColumnAxisType,\n ColumnProvider,\n SVG,\n} from \"@macrostrat/column-components\";\nimport { ColoredUnitComponent } from \"../units\";\nimport { UnitBoxes } from \"../units/boxes\";\nimport { ColumnContainer } from \"../column\";\nimport { ColumnData } from \"../data-provider\";\nimport { BaseUnit } from \"@macrostrat/api-types\";\nimport { ScaleContinuousNumeric } from \"d3-scale\";\nimport { ExtUnit } from \"../prepare-units/types\";\n\nconst h = hyper.styled(styles);\n\nexport interface CorrelationChartProps extends CorrelationChartSettings {\n data: ColumnData[];\n columnWidth?: number;\n columnSpacing?: number;\n targetUnitHeight?: number;\n unconformityLabels?: boolean;\n selectedUnit?: number | null;\n showUnitPopover?: boolean;\n unitComponent?: any;\n onUnitSelected?: (unitID: number | null, unit: BaseUnit | null) => void;\n}\n\nfunction MainChartArea({ children }) {\n const columnRef = useColumnRef();\n return h(\"div.main-chart\", { ref: columnRef }, children);\n}\n\nconst unitPopoverFeatures = new Set([\n UnitDetailsFeature.AdjacentUnits,\n UnitDetailsFeature.OutcropType,\n UnitDetailsFeature.DepthRange,\n UnitDetailsFeature.ColumnName,\n]);\n\nexport function CorrelationChart({\n data,\n columnSpacing = 0,\n columnWidth = 130,\n unconformityLabels = true,\n showUnitPopover = true,\n selectedUnit,\n onUnitSelected,\n unitComponent,\n ...scaleProps\n}: CorrelationChartProps) {\n const defaultScaleProps = {\n targetUnitHeight: 10,\n unconformityHeight: 60,\n minSectionHeight: 60,\n collapseSmallUnconformities: true,\n };\n\n const chartData = useMemo(() => {\n if (!data) return null;\n return buildCorrelationChartData(data, {\n ...defaultScaleProps,\n ...scaleProps,\n });\n }, [data, ...Object.values(scaleProps)]);\n\n // A flattened units array is used to support keyboard navigation\n const units = useMemo(() => {\n return data?.map((d0) => d0.units).flat() ?? [];\n }, [data]);\n\n const inDarkMode = useInDarkMode();\n\n const className = classNames({\n \"dark-mode\": inDarkMode,\n });\n\n if (chartData == null) {\n return null;\n }\n\n const { packages, scaleInfo, nColumns } = chartData;\n\n const mainWidth = (columnWidth + columnSpacing) * nColumns;\n\n return h(\n ColumnContainer,\n { className: \"correlation-diagram\" },\n h(\n UnitSelectionProvider,\n { selectedUnit, onUnitSelected, units },\n h(ChartArea, [\n h(TimescaleColumn, {\n key: \"timescale\",\n scaleInfo,\n unconformityLabels,\n }),\n h(MainChartArea, [\n h(\n SVG,\n {\n className,\n innerWidth: mainWidth,\n height: scaleInfo.totalHeight,\n paddingH: 4,\n },\n packages.map((pkg, i) => {\n const { offset, domain, pixelScale, scale, key } =\n scaleInfo.packages[i];\n return h(Package, {\n columnData: pkg.columnData,\n key,\n columnWidth,\n columnSpacing,\n offset,\n domain,\n pixelScale,\n scale,\n unitComponent,\n });\n }),\n ),\n h.if(showUnitPopover)(UnitSelectionPopover, {\n features: unitPopoverFeatures,\n }),\n // Navigation only works within a column for now...\n h(UnitKeyboardNavigation, { columnData: data }),\n ]),\n ]),\n ),\n );\n}\n\nfunction Package({\n columnData,\n columnSpacing,\n columnWidth,\n unitComponent,\n offset,\n domain,\n pixelScale,\n scale,\n}) {\n return h(\"g.package\", { transform: `translate(0 ${offset})` }, [\n // Disable the SVG overlay for now\n //h(PackageSVGOverlay, { data, columnSpacing }),\n h(\"g.column-units\", [\n columnData.map((data, i) => {\n return h(Column, {\n units: data.units,\n unitComponent,\n width: columnWidth,\n key: i,\n domain,\n pixelScale,\n scale,\n offsetLeft: i * (columnWidth + columnSpacing),\n });\n }),\n ]),\n ]);\n}\n\ninterface ColumnProps {\n units: ExtUnit[];\n unitComponent?: React.FunctionComponent<any>;\n unitComponentProps?: any;\n showLabels?: boolean;\n width?: number;\n columnWidth?: number;\n columnSpacing?: number;\n targetUnitHeight?: number;\n offsetLeft?: number;\n domain: [number, number];\n pixelScale: number;\n scale?: ScaleContinuousNumeric<number, number>;\n}\n\nfunction Column(props: ColumnProps) {\n const {\n units,\n width = 150,\n offsetLeft,\n domain,\n pixelScale,\n scale,\n unitComponent = ColoredUnitComponent,\n } = props;\n\n const columnWidth = width;\n\n if (units.length == 0) {\n return null;\n }\n\n return h(\n \"g.section\",\n {\n transform: `translate(${offsetLeft} 0)`,\n },\n h(\n ColumnProvider,\n {\n // Need to tighten up types here...\n divisions: units as any[],\n range: domain,\n scale,\n pixelsPerMeter: pixelScale, // Actually pixels per myr\n axisType: ColumnAxisType.AGE,\n },\n h(UnitBoxes, {\n unitComponent,\n unitComponentProps: {\n nColumns: 2,\n width: columnWidth,\n showLabel: false,\n },\n }),\n ),\n );\n}\n\nfunction PackageSVGOverlay({ data, columnWidth = 100, columnSpacing = 0 }) {\n const { b_age, t_age, bestPixelScale, columnData } = data;\n\n const width = (columnWidth + columnSpacing) * columnData.length;\n const height = Math.ceil((b_age - t_age) * bestPixelScale) + 2;\n\n const extensiveUnits = findLaterallyExtensiveUnits(data);\n\n const scale = (val: number) => {\n return (val - t_age) * bestPixelScale;\n };\n\n return h(\n \"div.package-overlay\",\n { style: { width, height } },\n extensiveUnits.map((d) => {\n return h(LaterallyExtensiveUnit, {\n data: d,\n scale,\n pixelScale: bestPixelScale,\n columnSpacing,\n });\n }),\n );\n}\n\nfunction LaterallyExtensiveUnit({ data, scale, pixelScale, columnSpacing }) {\n const { b_age, t_age, strat_name_long, units } = data;\n // Build boxes by column groups\n const boxes: UnitGroupBox[] = splitStratIntoBoxes(data);\n\n return h(\n \"div.laterally-extensive-unit\",\n boxes.map((d, i) => {\n return h(StratColSpan, {\n scale,\n data: d,\n pixelScale,\n key: i,\n columnSpacing,\n });\n }),\n );\n}\n\nfunction StratColSpan({\n data,\n scale,\n columnWidth = 100,\n columnSpacing = 0,\n pixelScale = 1,\n}) {\n const { startCol, endCol, strat_name_long, t_age, b_age } = data;\n const top = scale(t_age);\n const left = startCol * (columnWidth + columnSpacing);\n const width = (endCol - startCol + 1) * (columnWidth + columnSpacing);\n const height = (b_age - t_age) * pixelScale;\n return h(\n \"div.strat-col-span\",\n { style: { top, height, width, left } },\n strat_name_long,\n );\n}\n\nfunction ChartArea({ children }) {\n const setSelectedUnit = useUnitSelectionDispatch();\n\n return h(\n \"div.correlation-chart-inner\",\n {\n onClick() {\n setSelectedUnit(null, null);\n },\n },\n children,\n );\n}\n\ninterface TimescaleColumnProps {\n scaleInfo: CompositeStratigraphicScaleInfo;\n showLabels?: boolean;\n unconformityLabels?: boolean;\n}\n\nfunction TimescaleColumn(props: TimescaleColumnProps) {\n const { scaleInfo, unconformityLabels = true } = props;\n return h(\"div.column-container.age-axis-container\",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ACL;AAAA,UACA;AAAA,UACA;AAAA,UACA,YAAY,KAAK,cAAc;AAAA,QAAA,CAChC;AAAA,MACH,CAAC;AAAA,IAAA,CACF;AAAA,EAAA,CACF;AACH;AAiBA,SAAS,OAAO,OAAoB;AAClC,QAAM;AAAA,IACJ;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,EAAA,IACd;AAEJ,QAAM,cAAc;AAEpB,MAAI,MAAM,UAAU,GAAG;AACrB,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,WAAW,aAAa,UAAU;AAAA,IAAA;AAAA,IAEpC;AAAA,MACE;AAAA,MACA;AAAA;AAAA,QAEE,WAAW;AAAA,QACX,OAAO;AAAA,QACP;AAAA,QACA,gBAAgB;AAAA;AAAA,QAChB,UAAU,eAAe;AAAA,MAAA;AAAA,MAE3B,EAAE,WAAW;AAAA,QACX;AAAA,QACA,oBAAoB;AAAA,UAClB,UAAU;AAAA,UACV,OAAO;AAAA,UACP,WAAW;AAAA,QAAA;AAAA,MACb,CACD;AAAA,IAAA;AAAA,EACH;AAEJ;AAkEA,SAAS,UAAU,EAAE,YAAY;AAC/B,QAAM,kBAAkB,yBAAA;AAExB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,UAAU;AACR,wBAAgB,MAAM,IAAI;AAAA,MAC5B;AAAA,IAAA;AAAA,IAEF;AAAA,EAAA;AAEJ;AAQA,SAAS,gBAAgB,OAA6B;AACpD,QAAM,EAAE,WAAW,qBAAqB,KAAA,IAAS;AACjD,SAAO,EAAE,2CAA2C;AAAA,IAClD,EAAE,sBAAsB,EAAE,GAAG,WAAW;AAAA,IACxC,EAAE,wBAAwB,EAAE,GAAG,WAAW,oBAAoB;AAAA,EAAA,CAC/D;AACH;"}
|
|
1
|
+
{"version":3,"file":"main.js","sources":["../../src/correlation-chart/main.ts"],"sourcesContent":["/** Correlation chart */\nimport {\n UnitSelectionProvider,\n UnitKeyboardNavigation,\n useUnitSelectionDispatch,\n useColumnRef,\n} from \"../data-provider\";\nimport { UnitDetailsFeature, UnitSelectionPopover } from \"../unit-details\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { useMemo } from \"react\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport { CompositeTimescaleCore } from \"../section\";\nimport classNames from \"classnames\";\nimport {\n findLaterallyExtensiveUnits,\n splitStratIntoBoxes,\n UnitGroupBox,\n CorrelationChartSettings,\n buildCorrelationChartData,\n} from \"./prepare-data\";\nimport {\n CompositeAgeAxisCore,\n CompositeStratigraphicScaleInfo,\n} from \"../age-axis\";\nimport {\n ColumnAxisType,\n ColumnProvider,\n SVG,\n} from \"@macrostrat/column-components\";\nimport { ColoredUnitComponent } from \"../units\";\nimport { UnitBoxes } from \"../units/boxes\";\nimport { ColumnContainer } from \"../column\";\nimport { ColumnData } from \"../data-provider\";\nimport { BaseUnit } from \"@macrostrat/api-types\";\nimport { ScaleContinuousNumeric } from \"d3-scale\";\nimport { ExtUnit } from \"../prepare-units/types\";\n\nconst h = hyper.styled(styles);\n\nexport interface CorrelationChartProps extends CorrelationChartSettings {\n data: ColumnData[];\n columnWidth?: number;\n columnSpacing?: number;\n targetUnitHeight?: number;\n unconformityLabels?: boolean;\n selectedUnit?: number | null;\n showUnitPopover?: boolean;\n unitComponent?: any;\n onUnitSelected?: (unitID: number | null, unit: BaseUnit | null) => void;\n}\n\nfunction MainChartArea({ children }) {\n const columnRef = useColumnRef();\n return h(\"div.main-chart\", { ref: columnRef }, children);\n}\n\nconst unitPopoverFeatures = new Set([\n UnitDetailsFeature.AdjacentUnits,\n UnitDetailsFeature.OutcropType,\n UnitDetailsFeature.DepthRange,\n UnitDetailsFeature.ColumnName,\n]);\n\nexport function CorrelationChart({\n data,\n columnSpacing = 0,\n columnWidth = 130,\n unconformityLabels = true,\n showUnitPopover = true,\n selectedUnit,\n onUnitSelected,\n unitComponent,\n ...scaleProps\n}: CorrelationChartProps) {\n const defaultScaleProps = {\n targetUnitHeight: 10,\n unconformityHeight: 60,\n minSectionHeight: 60,\n collapseSmallUnconformities: true,\n };\n\n const chartData = useMemo(() => {\n if (!data) return null;\n return buildCorrelationChartData(data, {\n ...defaultScaleProps,\n ...scaleProps,\n });\n }, [data, ...Object.values(scaleProps)]);\n\n // A flattened units array is used to support keyboard navigation\n const units = useMemo(() => {\n return data?.map((d0) => d0.units).flat() ?? [];\n }, [data]);\n\n const inDarkMode = useInDarkMode();\n\n const className = classNames({\n \"dark-mode\": inDarkMode,\n });\n\n if (chartData == null) {\n return null;\n }\n\n const { packages, scaleInfo, nColumns } = chartData;\n\n const mainWidth = (columnWidth + columnSpacing) * nColumns;\n\n return h(\n ColumnContainer,\n { className: \"correlation-diagram\" },\n h(\n UnitSelectionProvider,\n { selectedUnit, onUnitSelected, units },\n h(ChartArea, [\n h(TimescaleColumn, {\n key: \"timescale\",\n scaleInfo,\n unconformityLabels,\n }),\n h(MainChartArea, [\n h(\n SVG,\n {\n className,\n innerWidth: mainWidth,\n height: scaleInfo.totalHeight,\n paddingH: 4,\n },\n packages.map((pkg, i) => {\n const { offset, domain, pixelScale, scale, key } =\n scaleInfo.packages[i];\n return h(Package, {\n columnData: pkg.columnData,\n key,\n columnWidth,\n columnSpacing,\n offset,\n domain,\n pixelScale,\n scale,\n unitComponent,\n });\n }),\n ),\n h.if(showUnitPopover)(UnitSelectionPopover, {\n features: unitPopoverFeatures,\n }),\n // Navigation only works within a column for now...\n h(UnitKeyboardNavigation, { columnData: data }),\n ]),\n ]),\n ),\n );\n}\n\nfunction Package({\n columnData,\n columnSpacing,\n columnWidth,\n unitComponent,\n offset,\n domain,\n pixelScale,\n scale,\n}) {\n return h(\"g.package\", { transform: `translate(0 ${offset})` }, [\n // Disable the SVG overlay for now\n //h(PackageSVGOverlay, { data, columnSpacing }),\n h(\"g.column-units\", [\n columnData.map((data, i) => {\n return h(Column, {\n units: data.units,\n unitComponent,\n width: columnWidth,\n key: i,\n domain,\n pixelScale,\n scale,\n offsetLeft: i * (columnWidth + columnSpacing),\n });\n }),\n ]),\n ]);\n}\n\ninterface ColumnProps {\n units: ExtUnit[];\n unitComponent?: React.FunctionComponent<any>;\n unitComponentProps?: any;\n showLabels?: boolean;\n width?: number;\n columnWidth?: number;\n columnSpacing?: number;\n targetUnitHeight?: number;\n offsetLeft?: number;\n domain: [number, number];\n pixelScale: number;\n scale?: ScaleContinuousNumeric<number, number>;\n}\n\nfunction Column(props: ColumnProps) {\n const {\n units,\n width = 150,\n offsetLeft,\n domain,\n pixelScale,\n scale,\n unitComponent = ColoredUnitComponent,\n } = props;\n\n const columnWidth = width;\n\n if (units.length == 0) {\n return null;\n }\n\n return h(\n \"g.section\",\n {\n transform: `translate(${offsetLeft} 0)`,\n },\n h(\n ColumnProvider,\n {\n // Need to tighten up types here...\n divisions: units as any[],\n range: domain,\n scale,\n pixelsPerMeter: pixelScale, // Actually pixels per myr\n axisType: ColumnAxisType.AGE,\n },\n h(UnitBoxes, {\n unitComponent,\n unitComponentProps: {\n nColumns: 2,\n width: columnWidth,\n showLabel: false,\n },\n }),\n ),\n );\n}\n\nfunction PackageSVGOverlay({ data, columnWidth = 100, columnSpacing = 0 }) {\n const { b_age, t_age, bestPixelScale, columnData } = data;\n\n const width = (columnWidth + columnSpacing) * columnData.length;\n const height = Math.ceil((b_age - t_age) * bestPixelScale) + 2;\n\n const extensiveUnits = findLaterallyExtensiveUnits(data);\n\n const scale = (val: number) => {\n return (val - t_age) * bestPixelScale;\n };\n\n return h(\n \"div.package-overlay\",\n { style: { width, height } },\n extensiveUnits.map((d) => {\n return h(LaterallyExtensiveUnit, {\n data: d,\n scale,\n pixelScale: bestPixelScale,\n columnSpacing,\n });\n }),\n );\n}\n\nfunction LaterallyExtensiveUnit({ data, scale, pixelScale, columnSpacing }) {\n const { b_age, t_age, strat_name_long, units } = data;\n // Build boxes by column groups\n const boxes: UnitGroupBox[] = splitStratIntoBoxes(data);\n\n return h(\n \"div.laterally-extensive-unit\",\n boxes.map((d, i) => {\n return h(StratColSpan, {\n scale,\n data: d,\n pixelScale,\n key: i,\n columnSpacing,\n });\n }),\n );\n}\n\nfunction StratColSpan({\n data,\n scale,\n columnWidth = 100,\n columnSpacing = 0,\n pixelScale = 1,\n}) {\n const { startCol, endCol, strat_name_long, t_age, b_age } = data;\n const top = scale(t_age);\n const left = startCol * (columnWidth + columnSpacing);\n const width = (endCol - startCol + 1) * (columnWidth + columnSpacing);\n const height = (b_age - t_age) * pixelScale;\n return h(\n \"div.strat-col-span\",\n { style: { top, height, width, left } },\n strat_name_long,\n );\n}\n\nfunction ChartArea({ children }) {\n const setSelectedUnit = useUnitSelectionDispatch();\n\n return h(\n \"div.correlation-chart-inner\",\n {\n onClick() {\n setSelectedUnit(null, null);\n },\n },\n children,\n );\n}\n\ninterface TimescaleColumnProps {\n scaleInfo: CompositeStratigraphicScaleInfo;\n showLabels?: boolean;\n unconformityLabels?: boolean;\n}\n\nfunction TimescaleColumn(props: TimescaleColumnProps) {\n const { scaleInfo, unconformityLabels = true } = props;\n return h(\"div.column-container.age-axis-container\", [\n h(CompositeAgeAxisCore, { ...scaleInfo }),\n h(CompositeTimescaleCore, { ...scaleInfo, unconformityLabels }),\n ]);\n}\n"],"names":["hyper","styles"],"mappings":";;;;;;;;;;;;;;;;AAsCA,MAAM,IAAIA,IAAM,OAAOC,GAAM;AAc7B,SAAS,cAAc,EAAE,YAAY;AACnC,QAAM,YAAY,aAAA;AAClB,SAAO,EAAE,kBAAkB,EAAE,KAAK,UAAA,GAAa,QAAQ;AACzD;AAEA,MAAM,0CAA0B,IAAI;AAAA,EAClC,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,mBAAmB;AACrB,CAAC;AAEM,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,qBAAqB;AAAA,EAC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,QACP;AAAA,QACA,gBAAgB;AAAA;AAAA,QAChB,UAAU,eAAe;AAAA,MAAA;AAAA,MAE3B,EAAE,WAAW;AAAA,QACX;AAAA,QACA,oBAAoB;AAAA,UAClB,UAAU;AAAA,UACV,OAAO;AAAA,UACP,WAAW;AAAA,QAAA;AAAA,MACb,CACD;AAAA,IAAA;AAAA,EACH;AAEJ;AAkEA,SAAS,UAAU,EAAE,YAAY;AAC/B,QAAM,kBAAkB,yBAAA;AAExB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,UAAU;AACR,wBAAgB,MAAM,IAAI;AAAA,MAC5B;AAAA,IAAA;AAAA,IAEF;AAAA,EAAA;AAEJ;AAQA,SAAS,gBAAgB,OAA6B;AACpD,QAAM,EAAE,WAAW,qBAAqB,KAAA,IAAS;AACjD,SAAO,EAAE,2CAA2C;AAAA,IAClD,EAAE,sBAAsB,EAAE,GAAG,WAAW;AAAA,IACxC,EAAE,wBAAwB,EAAE,GAAG,WAAW,oBAAoB;AAAA,EAAA,CAC/D;AACH;"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const h$1 = require("@macrostrat/hyper");
|
|
4
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
5
|
+
const h__default = /* @__PURE__ */ _interopDefault(h$1);
|
|
3
6
|
const assistant = "_assistant_jnc7r_26";
|
|
4
7
|
const styles = {
|
|
5
8
|
"page-header": "_page-header_jnc7r_1",
|
|
@@ -23,6 +26,8 @@ const styles = {
|
|
|
23
26
|
"correlation-chart-inner": "_correlation-chart-inner_jnc7r_112",
|
|
24
27
|
"age-axis-container": "_age-axis-container_jnc7r_118"
|
|
25
28
|
};
|
|
29
|
+
let h = h__default.default.styled(styles);
|
|
30
|
+
Object.assign(h, styles);
|
|
26
31
|
exports.assistant = assistant;
|
|
27
|
-
exports.default =
|
|
32
|
+
exports.default = h;
|
|
28
33
|
//# sourceMappingURL=main.module.sass.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import h$1 from "@macrostrat/hyper";
|
|
1
2
|
const assistant = "_assistant_jnc7r_26";
|
|
2
3
|
const styles = {
|
|
3
4
|
"page-header": "_page-header_jnc7r_1",
|
|
@@ -21,8 +22,10 @@ const styles = {
|
|
|
21
22
|
"correlation-chart-inner": "_correlation-chart-inner_jnc7r_112",
|
|
22
23
|
"age-axis-container": "_age-axis-container_jnc7r_118"
|
|
23
24
|
};
|
|
25
|
+
let h = h$1.styled(styles);
|
|
26
|
+
Object.assign(h, styles);
|
|
24
27
|
export {
|
|
25
28
|
assistant,
|
|
26
|
-
|
|
29
|
+
h as default
|
|
27
30
|
};
|
|
28
31
|
//# sourceMappingURL=main.module.sass.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -130,7 +130,7 @@ function MacrostratColumnProvider(props) {
|
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
132
|
function LithologiesProvider({ children }) {
|
|
133
|
-
useEffect(() => {
|
|
133
|
+
React.useEffect(() => {
|
|
134
134
|
console.warn(
|
|
135
135
|
"LithologiesProvider is deprecated. Replace with MacrostratDataProvider"
|
|
136
136
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.cjs","sources":["../../src/data-provider/store.ts"],"sourcesContent":["import { createContext, ReactNode, useContext, useMemo } from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport {\n CompositeColumnScale,\n createCompositeScale,\n} from \"../prepare-units/composite-scale\";\nimport { ColumnAxisType, ColumnProvider } from \"@macrostrat/column-components\";\nimport type { ExtUnit, PackageLayoutData } from \"../prepare-units\";\nimport {\n allowUnitSelectionAtom,\n selectedUnitIDAtom,\n UnitSelectionCallbacks,\n UnitSelectionCallbackManager,\n} from \"./unit-selection\";\nimport type { BaseUnit } from \"@macrostrat/api-types\";\nimport { type AtomMap, createScopedStore } from \"@macrostrat/data-components\";\nimport { atom } from \"jotai\";\n\nexport const scope = createScopedStore();\n\nexport const columnUnitsAtom = atom<BaseUnit[]>();\n\nexport const columnUnitsMapAtom = atom<Map<number, BaseUnit> | null>((get) => {\n const units = get(columnUnitsAtom);\n if (!units) return null;\n const unitMap = new Map<number, BaseUnit>();\n units.forEach((unit) => {\n unitMap.set(unit.unit_id, unit);\n });\n return unitMap;\n});\n\nexport interface ColumnStateProviderProps<\n T extends BaseUnit,\n> extends Partial<UnitSelectionCallbacks> {\n children: ReactNode;\n units: T[];\n selectedUnit: number | null;\n allowUnitSelection?: boolean;\n}\n\nexport function MacrostratColumnStateProvider<T extends BaseUnit>({\n children,\n units,\n allowUnitSelection = false,\n onUnitSelected,\n selectedUnit,\n}: ColumnStateProviderProps<T>) {\n /** Top-level provider for Macrostrat column data.\n * It is either provided by the Column component itself, or\n * can be hoisted higher in the tree to provide a common data context\n */\n\n /* By default, unit selection is disabled. However, if any related props are passed,\n we enable it.\n */\n const _allowSelection = useMemo(() => {\n if (allowUnitSelection) {\n return true;\n }\n return selectedUnit != null || onUnitSelected != null;\n }, []);\n\n const atomMap: AtomMap = [\n [columnUnitsAtom, units],\n [allowUnitSelectionAtom, _allowSelection],\n [selectedUnitIDAtom, selectedUnit],\n ];\n\n let selectionHandlers: ReactNode = null;\n if (_allowSelection) {\n selectionHandlers = h(UnitSelectionCallbackManager, { onUnitSelected });\n }\n\n return h(\n scope.Provider,\n {\n atoms: atomMap,\n keepUpdated: true,\n inherit: true,\n },\n [selectionHandlers, children],\n );\n}\n\nexport interface MacrostratColumnDataContext<T extends BaseUnit> {\n units: T[];\n sections: PackageLayoutData[];\n totalHeight?: number;\n axisType?: ColumnAxisType;\n allowUnitSelection?: boolean;\n}\n\nexport interface ColumnDataProviderProps<T extends BaseUnit>\n extends MacrostratColumnDataContext<T>, ColumnStateProviderProps<T> {\n children: ReactNode;\n}\n\nconst MacrostratColumnDataContext =\n createContext<MacrostratColumnDataContext<any>>(null);\n\nexport function MacrostratColumnDataProvider<T extends BaseUnit>({\n children,\n units,\n sections,\n totalHeight,\n axisType,\n allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n}: ColumnDataProviderProps<T>) {\n /** Internal provider for Macrostrat column data.\n * As a general rule, we want to provide data and column-axis\n * height calculations through the context, since these need to\n * be accessed by any component that lays out information on the\n * column.\n *\n * Cross-axis layout and view configuration (e.g., showing and hiding\n * of different components or labels) should be handled through passing\n * props to the components themselves.\n * */\n\n const value = useMemo(() => {\n // For now, change ordinal axis types to age axis types\n return {\n units,\n sections,\n totalHeight,\n axisType,\n };\n }, [units, sections, totalHeight, axisType]);\n\n return h(\n MacrostratColumnStateProvider,\n {\n units,\n allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n },\n h(MacrostratColumnDataContext.Provider, { value }, children),\n );\n}\n\nexport function UnitSelectionProvider(props: ColumnStateProviderProps<any>) {\n /* A basic unit selection provider without column data context.\n Mostly for use with the CorrelationChart component.\n */\n return h(MacrostratColumnStateProvider, {\n ...props,\n allowUnitSelection: true,\n });\n}\n\nexport function useMacrostratColumnData() {\n const ctx = useContext(MacrostratColumnDataContext);\n if (!ctx) {\n throw new Error(\n \"useMacrostratColumnData must be used within a MacrostratColumnDataProvider\",\n );\n }\n return ctx;\n}\n\nexport function useMacrostratUnits() {\n return scope.useAtomValue(columnUnitsAtom);\n}\n\nexport function useColumnUnitsMap(): Map<number, ExtUnit> | null {\n try {\n return scope.useAtomValue(columnUnitsMapAtom) as Map<number, ExtUnit>;\n } catch {\n return null;\n }\n}\n\nexport function useCompositeScale(): CompositeColumnScale {\n const ctx = useMacrostratColumnData();\n return useMemo(\n () => createCompositeScale(ctx.sections, true),\n [ctx.sections],\n );\n}\n\nexport function MacrostratColumnProvider(props) {\n /** A column provider specialized the Macrostrat API. Maps more\n * generic concepts to Macrostrat-specific ones.\n */\n\n const { axisType } = useMacrostratColumnData();\n const { units, domain, pixelScale, scale, children } = props;\n return h(\n ColumnProvider,\n {\n axisType,\n divisions: units,\n range: domain,\n pixelsPerMeter: pixelScale,\n scale,\n },\n children,\n );\n}\n\n/** This is now a legacy provider */\nexport function LithologiesProvider({ children }) {\n useEffect(() => {\n console.warn(\n \"LithologiesProvider is deprecated. Replace with MacrostratDataProvider\",\n );\n }, []);\n return children;\n}\n"],"names":["createScopedStore","atom","useMemo","allowUnitSelectionAtom","selectedUnitIDAtom","h","UnitSelectionCallbackManager","createContext","useContext","createCompositeScale","ColumnProvider"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"store.cjs","sources":["../../src/data-provider/store.ts"],"sourcesContent":["import { createContext, ReactNode, useContext, useMemo } from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport {\n CompositeColumnScale,\n createCompositeScale,\n} from \"../prepare-units/composite-scale\";\nimport { ColumnAxisType, ColumnProvider } from \"@macrostrat/column-components\";\nimport type { ExtUnit, PackageLayoutData } from \"../prepare-units\";\nimport {\n allowUnitSelectionAtom,\n selectedUnitIDAtom,\n UnitSelectionCallbacks,\n UnitSelectionCallbackManager,\n} from \"./unit-selection\";\nimport type { BaseUnit } from \"@macrostrat/api-types\";\nimport { type AtomMap, createScopedStore } from \"@macrostrat/data-components\";\nimport { atom } from \"jotai\";\nimport { useEffect } from \"react\";\n\nexport const scope = createScopedStore();\n\nexport const columnUnitsAtom = atom<BaseUnit[]>();\n\nexport const columnUnitsMapAtom = atom<Map<number, BaseUnit> | null>((get) => {\n const units = get(columnUnitsAtom);\n if (!units) return null;\n const unitMap = new Map<number, BaseUnit>();\n units.forEach((unit) => {\n unitMap.set(unit.unit_id, unit);\n });\n return unitMap;\n});\n\nexport interface ColumnStateProviderProps<\n T extends BaseUnit,\n> extends Partial<UnitSelectionCallbacks> {\n children: ReactNode;\n units: T[];\n selectedUnit: number | null;\n allowUnitSelection?: boolean;\n}\n\nexport function MacrostratColumnStateProvider<T extends BaseUnit>({\n children,\n units,\n allowUnitSelection = false,\n onUnitSelected,\n selectedUnit,\n}: ColumnStateProviderProps<T>) {\n /** Top-level provider for Macrostrat column data.\n * It is either provided by the Column component itself, or\n * can be hoisted higher in the tree to provide a common data context\n */\n\n /* By default, unit selection is disabled. However, if any related props are passed,\n we enable it.\n */\n const _allowSelection = useMemo(() => {\n if (allowUnitSelection) {\n return true;\n }\n return selectedUnit != null || onUnitSelected != null;\n }, []);\n\n const atomMap: AtomMap = [\n [columnUnitsAtom, units],\n [allowUnitSelectionAtom, _allowSelection],\n [selectedUnitIDAtom, selectedUnit],\n ];\n\n let selectionHandlers: ReactNode = null;\n if (_allowSelection) {\n selectionHandlers = h(UnitSelectionCallbackManager, { onUnitSelected });\n }\n\n return h(\n scope.Provider,\n {\n atoms: atomMap,\n keepUpdated: true,\n inherit: true,\n },\n [selectionHandlers, children],\n );\n}\n\nexport interface MacrostratColumnDataContext<T extends BaseUnit> {\n units: T[];\n sections: PackageLayoutData[];\n totalHeight?: number;\n axisType?: ColumnAxisType;\n allowUnitSelection?: boolean;\n}\n\nexport interface ColumnDataProviderProps<T extends BaseUnit>\n extends MacrostratColumnDataContext<T>, ColumnStateProviderProps<T> {\n children: ReactNode;\n}\n\nconst MacrostratColumnDataContext =\n createContext<MacrostratColumnDataContext<any>>(null);\n\nexport function MacrostratColumnDataProvider<T extends BaseUnit>({\n children,\n units,\n sections,\n totalHeight,\n axisType,\n allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n}: ColumnDataProviderProps<T>) {\n /** Internal provider for Macrostrat column data.\n * As a general rule, we want to provide data and column-axis\n * height calculations through the context, since these need to\n * be accessed by any component that lays out information on the\n * column.\n *\n * Cross-axis layout and view configuration (e.g., showing and hiding\n * of different components or labels) should be handled through passing\n * props to the components themselves.\n * */\n\n const value = useMemo(() => {\n // For now, change ordinal axis types to age axis types\n return {\n units,\n sections,\n totalHeight,\n axisType,\n };\n }, [units, sections, totalHeight, axisType]);\n\n return h(\n MacrostratColumnStateProvider,\n {\n units,\n allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n },\n h(MacrostratColumnDataContext.Provider, { value }, children),\n );\n}\n\nexport function UnitSelectionProvider(props: ColumnStateProviderProps<any>) {\n /* A basic unit selection provider without column data context.\n Mostly for use with the CorrelationChart component.\n */\n return h(MacrostratColumnStateProvider, {\n ...props,\n allowUnitSelection: true,\n });\n}\n\nexport function useMacrostratColumnData() {\n const ctx = useContext(MacrostratColumnDataContext);\n if (!ctx) {\n throw new Error(\n \"useMacrostratColumnData must be used within a MacrostratColumnDataProvider\",\n );\n }\n return ctx;\n}\n\nexport function useMacrostratUnits() {\n return scope.useAtomValue(columnUnitsAtom);\n}\n\nexport function useColumnUnitsMap(): Map<number, ExtUnit> | null {\n try {\n return scope.useAtomValue(columnUnitsMapAtom) as Map<number, ExtUnit>;\n } catch {\n return null;\n }\n}\n\nexport function useCompositeScale(): CompositeColumnScale {\n const ctx = useMacrostratColumnData();\n return useMemo(\n () => createCompositeScale(ctx.sections, true),\n [ctx.sections],\n );\n}\n\nexport function MacrostratColumnProvider(props) {\n /** A column provider specialized the Macrostrat API. Maps more\n * generic concepts to Macrostrat-specific ones.\n */\n\n const { axisType } = useMacrostratColumnData();\n const { units, domain, pixelScale, scale, children } = props;\n return h(\n ColumnProvider,\n {\n axisType,\n divisions: units,\n range: domain,\n pixelsPerMeter: pixelScale,\n scale,\n },\n children,\n );\n}\n\n/** This is now a legacy provider */\nexport function LithologiesProvider({ children }) {\n useEffect(() => {\n console.warn(\n \"LithologiesProvider is deprecated. Replace with MacrostratDataProvider\",\n );\n }, []);\n return children;\n}\n"],"names":["createScopedStore","atom","useMemo","allowUnitSelectionAtom","selectedUnitIDAtom","h","UnitSelectionCallbackManager","createContext","useContext","createCompositeScale","ColumnProvider","useEffect"],"mappings":";;;;;;;;;;;AAmBO,MAAM,QAAQA,eAAAA,kBAAA;AAEd,MAAM,kBAAkBC,MAAAA,KAAA;AAExB,MAAM,qBAAqBA,MAAAA,KAAmC,CAAC,QAAQ;AAC5E,QAAM,QAAQ,IAAI,eAAe;AACjC,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,8BAAc,IAAA;AACpB,QAAM,QAAQ,CAAC,SAAS;AACtB,YAAQ,IAAI,KAAK,SAAS,IAAI;AAAA,EAChC,CAAC;AACD,SAAO;AACT,CAAC;AAWM,SAAS,8BAAkD;AAAA,EAChE;AAAA,EACA;AAAA,EACA,qBAAqB;AAAA,EACrB;AAAA,EACA;AACF,GAAgC;AAS9B,QAAM,kBAAkBC,MAAAA,QAAQ,MAAM;AACpC,QAAI,oBAAoB;AACtB,aAAO;AAAA,IACT;AACA,WAAO,gBAAgB,QAAQ,kBAAkB;AAAA,EACnD,GAAG,CAAA,CAAE;AAEL,QAAM,UAAmB;AAAA,IACvB,CAAC,iBAAiB,KAAK;AAAA,IACvB,CAACC,cAAAA,wBAAwB,eAAe;AAAA,IACxC,CAACC,cAAAA,oBAAoB,YAAY;AAAA,EAAA;AAGnC,MAAI,oBAA+B;AACnC,MAAI,iBAAiB;AACnB,wBAAoBC,WAAAA,QAAEC,4CAA8B,EAAE,eAAA,CAAgB;AAAA,EACxE;AAEA,SAAOD,WAAAA;AAAAA,IACL,MAAM;AAAA,IACN;AAAA,MACE,OAAO;AAAA,MACP,aAAa;AAAA,MACb,SAAS;AAAA,IAAA;AAAA,IAEX,CAAC,mBAAmB,QAAQ;AAAA,EAAA;AAEhC;AAeA,MAAM,8BACJE,MAAAA,cAAgD,IAAI;AAE/C,SAAS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AAA,IACA;AAAA,MACE;AAAA,MACA,WAAW;AAAA,MACX,OAAO;AAAA,MACP,gBAAgB;AAAA,MAChB;AAAA,IAAA;AAAA,IAEF;AAAA,EAAA;AAEJ;AAGO,SAAS,oBAAoB,EAAE,YAAY;AAChDC,QAAAA,UAAU,MAAM;AACd,YAAQ;AAAA,MACN;AAAA,IAAA;AAAA,EAEJ,GAAG,CAAA,CAAE;AACL,SAAO;AACT;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMemo, useContext, createContext } from "react";
|
|
1
|
+
import { useEffect, useMemo, useContext, createContext } from "react";
|
|
2
2
|
import h from "@macrostrat/hyper";
|
|
3
3
|
import { createCompositeScale } from "../prepare-units/composite-scale.js";
|
|
4
4
|
import { ColumnProvider } from "@macrostrat/column-components";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sources":["../../src/data-provider/store.ts"],"sourcesContent":["import { createContext, ReactNode, useContext, useMemo } from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport {\n CompositeColumnScale,\n createCompositeScale,\n} from \"../prepare-units/composite-scale\";\nimport { ColumnAxisType, ColumnProvider } from \"@macrostrat/column-components\";\nimport type { ExtUnit, PackageLayoutData } from \"../prepare-units\";\nimport {\n allowUnitSelectionAtom,\n selectedUnitIDAtom,\n UnitSelectionCallbacks,\n UnitSelectionCallbackManager,\n} from \"./unit-selection\";\nimport type { BaseUnit } from \"@macrostrat/api-types\";\nimport { type AtomMap, createScopedStore } from \"@macrostrat/data-components\";\nimport { atom } from \"jotai\";\n\nexport const scope = createScopedStore();\n\nexport const columnUnitsAtom = atom<BaseUnit[]>();\n\nexport const columnUnitsMapAtom = atom<Map<number, BaseUnit> | null>((get) => {\n const units = get(columnUnitsAtom);\n if (!units) return null;\n const unitMap = new Map<number, BaseUnit>();\n units.forEach((unit) => {\n unitMap.set(unit.unit_id, unit);\n });\n return unitMap;\n});\n\nexport interface ColumnStateProviderProps<\n T extends BaseUnit,\n> extends Partial<UnitSelectionCallbacks> {\n children: ReactNode;\n units: T[];\n selectedUnit: number | null;\n allowUnitSelection?: boolean;\n}\n\nexport function MacrostratColumnStateProvider<T extends BaseUnit>({\n children,\n units,\n allowUnitSelection = false,\n onUnitSelected,\n selectedUnit,\n}: ColumnStateProviderProps<T>) {\n /** Top-level provider for Macrostrat column data.\n * It is either provided by the Column component itself, or\n * can be hoisted higher in the tree to provide a common data context\n */\n\n /* By default, unit selection is disabled. However, if any related props are passed,\n we enable it.\n */\n const _allowSelection = useMemo(() => {\n if (allowUnitSelection) {\n return true;\n }\n return selectedUnit != null || onUnitSelected != null;\n }, []);\n\n const atomMap: AtomMap = [\n [columnUnitsAtom, units],\n [allowUnitSelectionAtom, _allowSelection],\n [selectedUnitIDAtom, selectedUnit],\n ];\n\n let selectionHandlers: ReactNode = null;\n if (_allowSelection) {\n selectionHandlers = h(UnitSelectionCallbackManager, { onUnitSelected });\n }\n\n return h(\n scope.Provider,\n {\n atoms: atomMap,\n keepUpdated: true,\n inherit: true,\n },\n [selectionHandlers, children],\n );\n}\n\nexport interface MacrostratColumnDataContext<T extends BaseUnit> {\n units: T[];\n sections: PackageLayoutData[];\n totalHeight?: number;\n axisType?: ColumnAxisType;\n allowUnitSelection?: boolean;\n}\n\nexport interface ColumnDataProviderProps<T extends BaseUnit>\n extends MacrostratColumnDataContext<T>, ColumnStateProviderProps<T> {\n children: ReactNode;\n}\n\nconst MacrostratColumnDataContext =\n createContext<MacrostratColumnDataContext<any>>(null);\n\nexport function MacrostratColumnDataProvider<T extends BaseUnit>({\n children,\n units,\n sections,\n totalHeight,\n axisType,\n allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n}: ColumnDataProviderProps<T>) {\n /** Internal provider for Macrostrat column data.\n * As a general rule, we want to provide data and column-axis\n * height calculations through the context, since these need to\n * be accessed by any component that lays out information on the\n * column.\n *\n * Cross-axis layout and view configuration (e.g., showing and hiding\n * of different components or labels) should be handled through passing\n * props to the components themselves.\n * */\n\n const value = useMemo(() => {\n // For now, change ordinal axis types to age axis types\n return {\n units,\n sections,\n totalHeight,\n axisType,\n };\n }, [units, sections, totalHeight, axisType]);\n\n return h(\n MacrostratColumnStateProvider,\n {\n units,\n allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n },\n h(MacrostratColumnDataContext.Provider, { value }, children),\n );\n}\n\nexport function UnitSelectionProvider(props: ColumnStateProviderProps<any>) {\n /* A basic unit selection provider without column data context.\n Mostly for use with the CorrelationChart component.\n */\n return h(MacrostratColumnStateProvider, {\n ...props,\n allowUnitSelection: true,\n });\n}\n\nexport function useMacrostratColumnData() {\n const ctx = useContext(MacrostratColumnDataContext);\n if (!ctx) {\n throw new Error(\n \"useMacrostratColumnData must be used within a MacrostratColumnDataProvider\",\n );\n }\n return ctx;\n}\n\nexport function useMacrostratUnits() {\n return scope.useAtomValue(columnUnitsAtom);\n}\n\nexport function useColumnUnitsMap(): Map<number, ExtUnit> | null {\n try {\n return scope.useAtomValue(columnUnitsMapAtom) as Map<number, ExtUnit>;\n } catch {\n return null;\n }\n}\n\nexport function useCompositeScale(): CompositeColumnScale {\n const ctx = useMacrostratColumnData();\n return useMemo(\n () => createCompositeScale(ctx.sections, true),\n [ctx.sections],\n );\n}\n\nexport function MacrostratColumnProvider(props) {\n /** A column provider specialized the Macrostrat API. Maps more\n * generic concepts to Macrostrat-specific ones.\n */\n\n const { axisType } = useMacrostratColumnData();\n const { units, domain, pixelScale, scale, children } = props;\n return h(\n ColumnProvider,\n {\n axisType,\n divisions: units,\n range: domain,\n pixelsPerMeter: pixelScale,\n scale,\n },\n children,\n );\n}\n\n/** This is now a legacy provider */\nexport function LithologiesProvider({ children }) {\n useEffect(() => {\n console.warn(\n \"LithologiesProvider is deprecated. Replace with MacrostratDataProvider\",\n );\n }, []);\n return children;\n}\n"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"store.js","sources":["../../src/data-provider/store.ts"],"sourcesContent":["import { createContext, ReactNode, useContext, useMemo } from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport {\n CompositeColumnScale,\n createCompositeScale,\n} from \"../prepare-units/composite-scale\";\nimport { ColumnAxisType, ColumnProvider } from \"@macrostrat/column-components\";\nimport type { ExtUnit, PackageLayoutData } from \"../prepare-units\";\nimport {\n allowUnitSelectionAtom,\n selectedUnitIDAtom,\n UnitSelectionCallbacks,\n UnitSelectionCallbackManager,\n} from \"./unit-selection\";\nimport type { BaseUnit } from \"@macrostrat/api-types\";\nimport { type AtomMap, createScopedStore } from \"@macrostrat/data-components\";\nimport { atom } from \"jotai\";\nimport { useEffect } from \"react\";\n\nexport const scope = createScopedStore();\n\nexport const columnUnitsAtom = atom<BaseUnit[]>();\n\nexport const columnUnitsMapAtom = atom<Map<number, BaseUnit> | null>((get) => {\n const units = get(columnUnitsAtom);\n if (!units) return null;\n const unitMap = new Map<number, BaseUnit>();\n units.forEach((unit) => {\n unitMap.set(unit.unit_id, unit);\n });\n return unitMap;\n});\n\nexport interface ColumnStateProviderProps<\n T extends BaseUnit,\n> extends Partial<UnitSelectionCallbacks> {\n children: ReactNode;\n units: T[];\n selectedUnit: number | null;\n allowUnitSelection?: boolean;\n}\n\nexport function MacrostratColumnStateProvider<T extends BaseUnit>({\n children,\n units,\n allowUnitSelection = false,\n onUnitSelected,\n selectedUnit,\n}: ColumnStateProviderProps<T>) {\n /** Top-level provider for Macrostrat column data.\n * It is either provided by the Column component itself, or\n * can be hoisted higher in the tree to provide a common data context\n */\n\n /* By default, unit selection is disabled. However, if any related props are passed,\n we enable it.\n */\n const _allowSelection = useMemo(() => {\n if (allowUnitSelection) {\n return true;\n }\n return selectedUnit != null || onUnitSelected != null;\n }, []);\n\n const atomMap: AtomMap = [\n [columnUnitsAtom, units],\n [allowUnitSelectionAtom, _allowSelection],\n [selectedUnitIDAtom, selectedUnit],\n ];\n\n let selectionHandlers: ReactNode = null;\n if (_allowSelection) {\n selectionHandlers = h(UnitSelectionCallbackManager, { onUnitSelected });\n }\n\n return h(\n scope.Provider,\n {\n atoms: atomMap,\n keepUpdated: true,\n inherit: true,\n },\n [selectionHandlers, children],\n );\n}\n\nexport interface MacrostratColumnDataContext<T extends BaseUnit> {\n units: T[];\n sections: PackageLayoutData[];\n totalHeight?: number;\n axisType?: ColumnAxisType;\n allowUnitSelection?: boolean;\n}\n\nexport interface ColumnDataProviderProps<T extends BaseUnit>\n extends MacrostratColumnDataContext<T>, ColumnStateProviderProps<T> {\n children: ReactNode;\n}\n\nconst MacrostratColumnDataContext =\n createContext<MacrostratColumnDataContext<any>>(null);\n\nexport function MacrostratColumnDataProvider<T extends BaseUnit>({\n children,\n units,\n sections,\n totalHeight,\n axisType,\n allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n}: ColumnDataProviderProps<T>) {\n /** Internal provider for Macrostrat column data.\n * As a general rule, we want to provide data and column-axis\n * height calculations through the context, since these need to\n * be accessed by any component that lays out information on the\n * column.\n *\n * Cross-axis layout and view configuration (e.g., showing and hiding\n * of different components or labels) should be handled through passing\n * props to the components themselves.\n * */\n\n const value = useMemo(() => {\n // For now, change ordinal axis types to age axis types\n return {\n units,\n sections,\n totalHeight,\n axisType,\n };\n }, [units, sections, totalHeight, axisType]);\n\n return h(\n MacrostratColumnStateProvider,\n {\n units,\n allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n },\n h(MacrostratColumnDataContext.Provider, { value }, children),\n );\n}\n\nexport function UnitSelectionProvider(props: ColumnStateProviderProps<any>) {\n /* A basic unit selection provider without column data context.\n Mostly for use with the CorrelationChart component.\n */\n return h(MacrostratColumnStateProvider, {\n ...props,\n allowUnitSelection: true,\n });\n}\n\nexport function useMacrostratColumnData() {\n const ctx = useContext(MacrostratColumnDataContext);\n if (!ctx) {\n throw new Error(\n \"useMacrostratColumnData must be used within a MacrostratColumnDataProvider\",\n );\n }\n return ctx;\n}\n\nexport function useMacrostratUnits() {\n return scope.useAtomValue(columnUnitsAtom);\n}\n\nexport function useColumnUnitsMap(): Map<number, ExtUnit> | null {\n try {\n return scope.useAtomValue(columnUnitsMapAtom) as Map<number, ExtUnit>;\n } catch {\n return null;\n }\n}\n\nexport function useCompositeScale(): CompositeColumnScale {\n const ctx = useMacrostratColumnData();\n return useMemo(\n () => createCompositeScale(ctx.sections, true),\n [ctx.sections],\n );\n}\n\nexport function MacrostratColumnProvider(props) {\n /** A column provider specialized the Macrostrat API. Maps more\n * generic concepts to Macrostrat-specific ones.\n */\n\n const { axisType } = useMacrostratColumnData();\n const { units, domain, pixelScale, scale, children } = props;\n return h(\n ColumnProvider,\n {\n axisType,\n divisions: units,\n range: domain,\n pixelsPerMeter: pixelScale,\n scale,\n },\n children,\n );\n}\n\n/** This is now a legacy provider */\nexport function LithologiesProvider({ children }) {\n useEffect(() => {\n console.warn(\n \"LithologiesProvider is deprecated. Replace with MacrostratDataProvider\",\n );\n }, []);\n return children;\n}\n"],"names":[],"mappings":";;;;;;;AAmBO,MAAM,QAAQ,kBAAA;AAEd,MAAM,kBAAkB,KAAA;AAExB,MAAM,qBAAqB,KAAmC,CAAC,QAAQ;AAC5E,QAAM,QAAQ,IAAI,eAAe;AACjC,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,8BAAc,IAAA;AACpB,QAAM,QAAQ,CAAC,SAAS;AACtB,YAAQ,IAAI,KAAK,SAAS,IAAI;AAAA,EAChC,CAAC;AACD,SAAO;AACT,CAAC;AAWM,SAAS,8BAAkD;AAAA,EAChE;AAAA,EACA;AAAA,EACA,qBAAqB;AAAA,EACrB;AAAA,EACA;AACF,GAAgC;AAS9B,QAAM,kBAAkB,QAAQ,MAAM;AACpC,QAAI,oBAAoB;AACtB,aAAO;AAAA,IACT;AACA,WAAO,gBAAgB,QAAQ,kBAAkB;AAAA,EACnD,GAAG,CAAA,CAAE;AAEL,QAAM,UAAmB;AAAA,IACvB,CAAC,iBAAiB,KAAK;AAAA,IACvB,CAAC,wBAAwB,eAAe;AAAA,IACxC,CAAC,oBAAoB,YAAY;AAAA,EAAA;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,IACL,MAAM,qBAAqB,IAAI,UAAU,IAAI;AAAA,IAC7C,CAAC,IAAI,QAAQ;AAAA,EAAA;AAEjB;AAEO,SAAS,yBAAyB,OAAO;AAK9C,QAAM,EAAE,SAAA,IAAa,wBAAA;AACrB,QAAM,EAAE,OAAO,QAAQ,YAAY,OAAO,aAAa;AACvD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE;AAAA,MACA,WAAW;AAAA,MACX,OAAO;AAAA,MACP,gBAAgB;AAAA,MAChB;AAAA,IAAA;AAAA,IAEF;AAAA,EAAA;AAEJ;AAGO,SAAS,oBAAoB,EAAE,YAAY;AAChD,YAAU,MAAM;AACd,YAAQ;AAAA,MACN;AAAA,IAAA;AAAA,EAEJ,GAAG,CAAA,CAAE;AACL,SAAO;AACT;"}
|
|
@@ -6,10 +6,10 @@ import { useMeasurementData } from "./data-provider.js";
|
|
|
6
6
|
import { IsotopesDataArea, IsotopeDataPoint } from "./data-area.js";
|
|
7
7
|
import { referenceMeasuresToColumn } from "@macrostrat/stratigraphy-utils";
|
|
8
8
|
import { SVG, ColumnLayoutProvider, useColumnLayout } from "@macrostrat/column-components";
|
|
9
|
-
import
|
|
9
|
+
import h$2 from "./isotopes-column.module.sass.js";
|
|
10
10
|
import { scaleLinear } from "d3-scale";
|
|
11
11
|
import { useMacrostratColumnData, useMacrostratUnits } from "../../data-provider/store.js";
|
|
12
|
-
const h = h$1.styled(
|
|
12
|
+
const h = h$1.styled(h$2);
|
|
13
13
|
function ScaleLine(props) {
|
|
14
14
|
let { value, className, labelBottom, labelOffset, ...rest } = props;
|
|
15
15
|
const { sections } = useMacrostratColumnData();
|