@macrostrat/column-views 3.2.0 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/age-axis.cjs +2 -2
- package/dist/age-axis.cjs.map +1 -1
- package/dist/age-axis.js +1 -1
- package/dist/column-views.css +130 -125
- package/dist/index.cjs +15 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/section.cjs +2 -2
- package/dist/section.cjs.map +1 -1
- package/dist/section.js +1 -1
- package/dist/unit-details/age-range.cjs +153 -0
- package/dist/unit-details/age-range.cjs.map +1 -0
- package/dist/unit-details/age-range.d.ts +43 -0
- package/dist/unit-details/age-range.js +153 -0
- package/dist/unit-details/age-range.js.map +1 -0
- package/dist/unit-details/age-range.module.sass.cjs +16 -0
- package/dist/unit-details/age-range.module.sass.cjs.map +1 -0
- package/dist/unit-details/age-range.module.sass.js +14 -0
- package/dist/unit-details/age-range.module.sass.js.map +1 -0
- package/dist/unit-details/index.d.ts +1 -0
- package/dist/unit-details/panel.cjs +17 -173
- package/dist/unit-details/panel.cjs.map +1 -1
- package/dist/unit-details/panel.js +12 -168
- package/dist/unit-details/panel.js.map +1 -1
- package/dist/unit-details/panel.module.sass.cjs +20 -22
- package/dist/unit-details/panel.module.sass.cjs.map +1 -1
- package/dist/unit-details/panel.module.sass.js +20 -22
- package/dist/unit-details/panel.module.sass.js.map +1 -1
- package/dist/unit-details/utils.cjs +31 -0
- package/dist/unit-details/utils.cjs.map +1 -0
- package/dist/unit-details/utils.d.ts +3 -0
- package/dist/unit-details/utils.js +31 -0
- package/dist/unit-details/utils.js.map +1 -0
- package/package.json +5 -5
- package/src/unit-details/age-range.module.sass +15 -0
- package/src/unit-details/age-range.ts +191 -0
- package/src/unit-details/index.ts +1 -0
- package/src/unit-details/panel.module.sass +0 -9
- package/src/unit-details/panel.ts +13 -227
- package/src/unit-details/utils.ts +33 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@ 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.2] - 2026-02-09
|
|
8
|
+
|
|
9
|
+
- Move `AgeField` and `AgeRange` to separate exports
|
|
10
|
+
- Improve handling of interval ranges
|
|
11
|
+
|
|
12
|
+
## [3.2.1] - 2026-02-08
|
|
13
|
+
|
|
14
|
+
- Export `ThicknessField` for unit details panels
|
|
15
|
+
|
|
7
16
|
## [3.2.0] - 2026-02-06
|
|
8
17
|
|
|
9
18
|
- Update Mapbox dependency to v3
|
package/dist/age-axis.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const columnComponents = require("@macrostrat/column-components");
|
|
|
5
5
|
require("react");
|
|
6
6
|
const ageAxis_module = require("./age-axis.module.sass.cjs");
|
|
7
7
|
const dataComponents = require("@macrostrat/data-components");
|
|
8
|
-
const
|
|
8
|
+
const ageRange = require("./unit-details/age-range.cjs");
|
|
9
9
|
const store = require("./data-provider/store.cjs");
|
|
10
10
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
11
11
|
const h__default = /* @__PURE__ */ _interopDefault(h$1);
|
|
@@ -114,7 +114,7 @@ function AgeCursor({ age }) {
|
|
|
114
114
|
top: heightPx
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
|
-
[h("div.line"), h(
|
|
117
|
+
[h("div.line"), h(ageRange.AgeLabel, { age, className: "label" })]
|
|
118
118
|
);
|
|
119
119
|
}
|
|
120
120
|
exports.AgeCursor = AgeCursor;
|
package/dist/age-axis.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"age-axis.cjs","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","Parenthetical","useMacrostratColumnData","ColumnAxisType","SVG","AgeAxis","useCompositeScale","AgeLabel"],"mappings":";;;;;;;;;;;AAeA,MAAM,IAAIA,WAAAA,QAAM,OAAOC,sBAAM;AAetB,SAAS,kBAAkB,OAAO;AACvC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O;AAAA,EACT;AAEA,MAAI,aAAqB,aAAa;AACtC,MAAI,YAAY,YAAY;AAC5B,MAAI,YAAYA,iBAAAA,eAAe,OAAO;AACpC,iBAAa;AACb,gBAAY;AAAA,EACd,WAAW,YAAYA,iBAAAA,eAAe,QAAQ;AAC5C,iBAAa;AACb,gBAAY;AAAA,EACd;AAEA,SAAO,EAAE,0BAA0B,MAAM;AAAA,IACvC,EAAE,mBAAmB;AAAA,MACnB,OAAO;AAAA,MACP,MAAM;AAAA,MACN,QAAQ;AAAA,IAAA,CACT;AAAA,IACD;AAAA,MACEC,iBAAAA;AAAAA,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,EAAEC,iBAAAA,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,QAAQC,MAAAA,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,EAAEC,
|
|
1
|
+
{"version":3,"file":"age-axis.cjs","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","Parenthetical","useMacrostratColumnData","ColumnAxisType","SVG","AgeAxis","useCompositeScale","AgeLabel"],"mappings":";;;;;;;;;;;AAeA,MAAM,IAAIA,WAAAA,QAAM,OAAOC,sBAAM;AAetB,SAAS,kBAAkB,OAAO;AACvC,QAAM,EAAE,QAAQ,OAAO,OAAO,MAAM,WAAW,WAAW;AAC1D,SAAO;AAAA,IACL;AAAA,IACA,E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AAA,eAAe,OAAO;AACpC,iBAAa;AACb,gBAAY;AAAA,EACd,WAAW,YAAYA,iBAAAA,eAAe,QAAQ;AAC5C,iBAAa;AACb,gBAAY;AAAA,EACd;AAEA,SAAO,EAAE,0BAA0B,MAAM;AAAA,IACvC,EAAE,mBAAmB;AAAA,MACnB,OAAO;AAAA,MACP,MAAM;AAAA,MACN,QAAQ;AAAA,IAAA,CACT;AAAA,IACD;AAAA,MACEC,iBAAAA;AAAAA,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,EAAEC,iBAAAA,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,QAAQC,MAAAA,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,EAAEC,SAAAA,UAAU,EAAE,KAAK,WAAW,SAAS,CAAC;AAAA,EAAA;AAE5D;;;;;;"}
|
package/dist/age-axis.js
CHANGED
|
@@ -3,7 +3,7 @@ import { ColumnAxisType, SVG, AgeAxis } from "@macrostrat/column-components";
|
|
|
3
3
|
import "react";
|
|
4
4
|
import h$2 from "./age-axis.module.sass.js";
|
|
5
5
|
import { Parenthetical } from "@macrostrat/data-components";
|
|
6
|
-
import { AgeLabel } from "./unit-details/
|
|
6
|
+
import { AgeLabel } from "./unit-details/age-range.js";
|
|
7
7
|
import { useCompositeScale, useMacrostratColumnData } from "./data-provider/store.js";
|
|
8
8
|
const h = h$1.styled(h$2);
|
|
9
9
|
function VerticalAxisLabel(props) {
|
package/dist/column-views.css
CHANGED
|
@@ -74,138 +74,23 @@
|
|
|
74
74
|
position: relative;
|
|
75
75
|
display: flex;
|
|
76
76
|
flex-direction: row;
|
|
77
|
-
}.
|
|
78
|
-
display: flex;
|
|
79
|
-
|
|
80
|
-
align-items: center;
|
|
81
|
-
gap: 0.5em;
|
|
82
|
-
border-bottom: 1px solid var(--panel-rule-color);
|
|
83
|
-
position: sticky;
|
|
84
|
-
top: 0;
|
|
85
|
-
background-color: var(--panel-secondary-background-color);
|
|
86
|
-
padding: 0.5em 1em;
|
|
87
|
-
z-index: 50;
|
|
88
|
-
min-height: 45px;
|
|
89
|
-
overflow: hidden;
|
|
90
|
-
}
|
|
91
|
-
._legend-panel-header_128wy_1 ._title-container_128wy_15 {
|
|
77
|
+
}._interval-proportions_1ibvp_1 {
|
|
78
|
+
display: inline-flex;
|
|
79
|
+
flex-flow: row wrap;
|
|
92
80
|
gap: 0.5em;
|
|
81
|
+
text-align: right;
|
|
93
82
|
align-items: baseline;
|
|
94
|
-
margin: 0;
|
|
95
|
-
flex-grow: 1;
|
|
96
|
-
z-index: 5;
|
|
97
|
-
}
|
|
98
|
-
._legend-panel-header_128wy_1 ._title-container_128wy_15:hover ._hidden-actions-container_128wy_22 {
|
|
99
|
-
visibility: visible;
|
|
100
|
-
}
|
|
101
|
-
._legend-panel-header_128wy_1 ._title-container_128wy_15 h1, ._legend-panel-header_128wy_1 ._title-container_128wy_15 h2, ._legend-panel-header_128wy_1 ._title-container_128wy_15 h3 {
|
|
102
|
-
display: inline;
|
|
103
|
-
margin: 0;
|
|
104
|
-
}
|
|
105
|
-
._legend-panel-header_128wy_1 ._title-container_128wy_15 ._hidden-actions-container_128wy_22 {
|
|
106
|
-
visibility: hidden;
|
|
107
|
-
}
|
|
108
|
-
._legend-panel-header_128wy_1 ._title-container_128wy_15 button {
|
|
109
|
-
transform: translateY(0px);
|
|
110
|
-
}
|
|
111
|
-
._legend-panel-header_128wy_1 code {
|
|
112
|
-
font-size: 0.9em;
|
|
113
|
-
color: var(--secondary-color);
|
|
114
|
-
}
|
|
115
|
-
._legend-panel-header_128wy_1 ._unit-id_128wy_39:before {
|
|
116
|
-
content: "#";
|
|
117
|
-
color: var(--secondary-color);
|
|
118
|
-
}
|
|
119
|
-
._legend-panel-header_128wy_1 ._spacer_128wy_43 {
|
|
120
|
-
flex: 1;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
._unit-details-panel_128wy_47 {
|
|
124
|
-
display: flex;
|
|
125
|
-
flex-direction: column;
|
|
126
|
-
}
|
|
127
|
-
._unit-details-panel_128wy_47 ._unit-details-content-holder_128wy_51 {
|
|
128
|
-
flex: 1;
|
|
129
|
-
overflow-y: scroll;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
._unit-details-content_128wy_51 {
|
|
133
|
-
position: relative;
|
|
134
|
-
margin: 1em;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
._units-list_128wy_61 ._item_128wy_61:after {
|
|
138
|
-
content: ", ";
|
|
139
|
-
}
|
|
140
|
-
._units-list_128wy_61 ._item_128wy_61:last-child:after {
|
|
141
|
-
content: "";
|
|
142
83
|
}
|
|
143
84
|
|
|
144
|
-
.
|
|
145
|
-
|
|
146
|
-
font-style: italic;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
._strat-name-id_128wy_73, ._identifier_128wy_73 {
|
|
150
|
-
font-family: var(--monospace-font);
|
|
151
|
-
color: var(--secondary-color);
|
|
152
|
-
}
|
|
153
|
-
._strat-name-id_128wy_73::before, ._identifier_128wy_73::before {
|
|
154
|
-
content: "#";
|
|
155
|
-
color: var(--tertiary-color);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
._color-swatch_128wy_82 {
|
|
159
|
-
width: 1em;
|
|
160
|
-
height: 1em;
|
|
161
|
-
border-radius: 0.2em;
|
|
162
|
-
margin-right: 0.2em;
|
|
163
|
-
border: 1px solid var(--panel-rule-color);
|
|
164
|
-
display: inline-block;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
._refs_128wy_91 {
|
|
168
|
-
list-style: none;
|
|
169
|
-
margin: 0;
|
|
170
|
-
padding-left: 0;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
._interval-proportions_128wy_97 {
|
|
174
|
-
flex-grow: 1;
|
|
175
|
-
width: 100%;
|
|
176
|
-
text-align: right;
|
|
177
|
-
}
|
|
178
|
-
._interval-proportions_128wy_97 ._discourage-break_128wy_102 {
|
|
85
|
+
._interval-proportions_1ibvp_1, ._discourage-break_1ibvp_9 {
|
|
86
|
+
align-items: baseline;
|
|
179
87
|
white-space: nowrap;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
margin: 0 0.3em;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
._clickable_128wy_109 {
|
|
186
|
-
cursor: pointer;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
._hidden-actions-container_128wy_22 {
|
|
190
|
-
min-width: 0;
|
|
191
|
-
display: inline-block;
|
|
192
|
-
width: 0;
|
|
193
|
-
position: relative;
|
|
88
|
+
display: inline-flex;
|
|
89
|
+
gap: 0.5em;
|
|
194
90
|
}
|
|
195
91
|
|
|
196
|
-
.
|
|
197
|
-
|
|
198
|
-
width: fit-content;
|
|
199
|
-
display: flex;
|
|
200
|
-
align-items: center;
|
|
201
|
-
gap: 0.25em;
|
|
202
|
-
background-color: var(--panel-secondary-background-color);
|
|
203
|
-
z-index: 50;
|
|
204
|
-
position: relative;
|
|
205
|
-
bottom: 0;
|
|
206
|
-
}
|
|
207
|
-
._hidden-actions_128wy_22 button {
|
|
208
|
-
color: var(--secondary-color) !important;
|
|
92
|
+
._sep_1ibvp_16 {
|
|
93
|
+
color: var(--secondary-color);
|
|
209
94
|
}._column-container_15bga_1, body.light-mode ._column-container_15bga_1 {
|
|
210
95
|
--column-background-color: var(--background-color, #fff);
|
|
211
96
|
--column-stroke-color: var(--text-emphasized-color, #000);
|
|
@@ -428,6 +313,126 @@ body.dark-mode ._column-container_15bga_1 svg pattern image {
|
|
|
428
313
|
._legend-json-view_4jzei_30 {
|
|
429
314
|
padding-left: 0;
|
|
430
315
|
margin-left: -0.5em;
|
|
316
|
+
}._legend-panel-header_ue390_1 {
|
|
317
|
+
display: flex;
|
|
318
|
+
justify-content: space-between;
|
|
319
|
+
align-items: center;
|
|
320
|
+
gap: 0.5em;
|
|
321
|
+
border-bottom: 1px solid var(--panel-rule-color);
|
|
322
|
+
position: sticky;
|
|
323
|
+
top: 0;
|
|
324
|
+
background-color: var(--panel-secondary-background-color);
|
|
325
|
+
padding: 0.5em 1em;
|
|
326
|
+
z-index: 50;
|
|
327
|
+
min-height: 45px;
|
|
328
|
+
overflow: hidden;
|
|
329
|
+
}
|
|
330
|
+
._legend-panel-header_ue390_1 ._title-container_ue390_15 {
|
|
331
|
+
gap: 0.5em;
|
|
332
|
+
align-items: baseline;
|
|
333
|
+
margin: 0;
|
|
334
|
+
flex-grow: 1;
|
|
335
|
+
z-index: 5;
|
|
336
|
+
}
|
|
337
|
+
._legend-panel-header_ue390_1 ._title-container_ue390_15:hover ._hidden-actions-container_ue390_22 {
|
|
338
|
+
visibility: visible;
|
|
339
|
+
}
|
|
340
|
+
._legend-panel-header_ue390_1 ._title-container_ue390_15 h1, ._legend-panel-header_ue390_1 ._title-container_ue390_15 h2, ._legend-panel-header_ue390_1 ._title-container_ue390_15 h3 {
|
|
341
|
+
display: inline;
|
|
342
|
+
margin: 0;
|
|
343
|
+
}
|
|
344
|
+
._legend-panel-header_ue390_1 ._title-container_ue390_15 ._hidden-actions-container_ue390_22 {
|
|
345
|
+
visibility: hidden;
|
|
346
|
+
}
|
|
347
|
+
._legend-panel-header_ue390_1 ._title-container_ue390_15 button {
|
|
348
|
+
transform: translateY(0px);
|
|
349
|
+
}
|
|
350
|
+
._legend-panel-header_ue390_1 code {
|
|
351
|
+
font-size: 0.9em;
|
|
352
|
+
color: var(--secondary-color);
|
|
353
|
+
}
|
|
354
|
+
._legend-panel-header_ue390_1 ._unit-id_ue390_39:before {
|
|
355
|
+
content: "#";
|
|
356
|
+
color: var(--secondary-color);
|
|
357
|
+
}
|
|
358
|
+
._legend-panel-header_ue390_1 ._spacer_ue390_43 {
|
|
359
|
+
flex: 1;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
._unit-details-panel_ue390_47 {
|
|
363
|
+
display: flex;
|
|
364
|
+
flex-direction: column;
|
|
365
|
+
}
|
|
366
|
+
._unit-details-panel_ue390_47 ._unit-details-content-holder_ue390_51 {
|
|
367
|
+
flex: 1;
|
|
368
|
+
overflow-y: scroll;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
._unit-details-content_ue390_51 {
|
|
372
|
+
position: relative;
|
|
373
|
+
margin: 1em;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
._units-list_ue390_61 ._item_ue390_61:after {
|
|
377
|
+
content: ", ";
|
|
378
|
+
}
|
|
379
|
+
._units-list_ue390_61 ._item_ue390_61:last-child:after {
|
|
380
|
+
content: "";
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
._proportion_ue390_68, ._sep_ue390_68, ._no-units_ue390_68, ._strat-name-text_ue390_68 {
|
|
384
|
+
color: var(--secondary-color);
|
|
385
|
+
font-style: italic;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
._strat-name-id_ue390_73, ._identifier_ue390_73 {
|
|
389
|
+
font-family: var(--monospace-font);
|
|
390
|
+
color: var(--secondary-color);
|
|
391
|
+
}
|
|
392
|
+
._strat-name-id_ue390_73::before, ._identifier_ue390_73::before {
|
|
393
|
+
content: "#";
|
|
394
|
+
color: var(--tertiary-color);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
._color-swatch_ue390_82 {
|
|
398
|
+
width: 1em;
|
|
399
|
+
height: 1em;
|
|
400
|
+
border-radius: 0.2em;
|
|
401
|
+
margin-right: 0.2em;
|
|
402
|
+
border: 1px solid var(--panel-rule-color);
|
|
403
|
+
display: inline-block;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
._refs_ue390_91 {
|
|
407
|
+
list-style: none;
|
|
408
|
+
margin: 0;
|
|
409
|
+
padding-left: 0;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
._clickable_ue390_97 {
|
|
413
|
+
cursor: pointer;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
._hidden-actions-container_ue390_22 {
|
|
417
|
+
min-width: 0;
|
|
418
|
+
display: inline-block;
|
|
419
|
+
width: 0;
|
|
420
|
+
position: relative;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
._hidden-actions_ue390_22 {
|
|
424
|
+
padding-left: 1em;
|
|
425
|
+
width: fit-content;
|
|
426
|
+
display: flex;
|
|
427
|
+
align-items: center;
|
|
428
|
+
gap: 0.25em;
|
|
429
|
+
background-color: var(--panel-secondary-background-color);
|
|
430
|
+
z-index: 50;
|
|
431
|
+
position: relative;
|
|
432
|
+
bottom: 0;
|
|
433
|
+
}
|
|
434
|
+
._hidden-actions_ue390_22 button {
|
|
435
|
+
color: var(--secondary-color) !important;
|
|
431
436
|
}._boundary-age-model_16scl_1 {
|
|
432
437
|
top: 0;
|
|
433
438
|
left: 0;
|
package/dist/index.cjs
CHANGED
|
@@ -6,9 +6,10 @@ const index$6 = require("./prepare-units/index.cjs");
|
|
|
6
6
|
const column = require("./column.cjs");
|
|
7
7
|
const ageModelOverlay = require("./age-model-overlay.cjs");
|
|
8
8
|
const notes = require("./notes.cjs");
|
|
9
|
-
const
|
|
9
|
+
const ageRange = require("./unit-details/age-range.cjs");
|
|
10
10
|
const composite = require("./units/composite.cjs");
|
|
11
11
|
const base = require("./facets/measurements/base.cjs");
|
|
12
|
+
const panel = require("./unit-details/panel.cjs");
|
|
12
13
|
const layers = require("./maps/column-navigation/svg/layers.cjs");
|
|
13
14
|
const core = require("./maps/column-correlation/core.cjs");
|
|
14
15
|
const state = require("./maps/column-correlation/state.cjs");
|
|
@@ -56,14 +57,12 @@ exports.ColumnContainer = column.ColumnContainer;
|
|
|
56
57
|
exports.BoundaryAgeModelOverlay = ageModelOverlay.BoundaryAgeModelOverlay;
|
|
57
58
|
exports.ComputedSurfacesOverlay = ageModelOverlay.ComputedSurfacesOverlay;
|
|
58
59
|
exports.ColumnNotes = notes.ColumnNotes;
|
|
59
|
-
exports.
|
|
60
|
-
exports.
|
|
61
|
-
exports.Duration =
|
|
62
|
-
exports.
|
|
63
|
-
exports.
|
|
64
|
-
exports.
|
|
65
|
-
exports.UnitDetailsFeature = panel.UnitDetailsFeature;
|
|
66
|
-
exports.UnitDetailsPanel = panel.UnitDetailsPanel;
|
|
60
|
+
exports.AgeField = ageRange.AgeField;
|
|
61
|
+
exports.AgeLabel = ageRange.AgeLabel;
|
|
62
|
+
exports.Duration = ageRange.Duration;
|
|
63
|
+
exports.IntervalProportions = ageRange.IntervalProportions;
|
|
64
|
+
exports.getAge = ageRange.getAge;
|
|
65
|
+
exports.getAgeRange = ageRange.getAgeRange;
|
|
67
66
|
exports.AnnotatedUnitsColumn = composite.AnnotatedUnitsColumn;
|
|
68
67
|
exports.ColumnNotesProvider = composite.ColumnNotesProvider;
|
|
69
68
|
exports.CompositeUnitComponent = composite.CompositeUnitComponent;
|
|
@@ -76,6 +75,13 @@ exports.TruncatedList = base.TruncatedList;
|
|
|
76
75
|
exports.groupNotesByPixelDistance = base.groupNotesByPixelDistance;
|
|
77
76
|
exports.mergeHeightRanges = base.mergeHeightRanges;
|
|
78
77
|
exports.standardizeMeasurementHeight = base.standardizeMeasurementHeight;
|
|
78
|
+
exports.ClickableText = panel.ClickableText;
|
|
79
|
+
exports.Identifier = panel.Identifier;
|
|
80
|
+
exports.LegendPanelHeader = panel.LegendPanelHeader;
|
|
81
|
+
exports.ReferencesField = panel.ReferencesField;
|
|
82
|
+
exports.ThicknessField = panel.ThicknessField;
|
|
83
|
+
exports.UnitDetailsFeature = panel.UnitDetailsFeature;
|
|
84
|
+
exports.UnitDetailsPanel = panel.UnitDetailsPanel;
|
|
79
85
|
exports.ColumnCenters = layers.ColumnCenters;
|
|
80
86
|
exports.ColumnFeatures = layers.ColumnFeatures;
|
|
81
87
|
exports.ColumnKeyboardNavigation = layers.ColumnKeyboardNavigation;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,10 @@ import { prepareColumnUnits, usePreparedColumnUnits } from "./prepare-units/inde
|
|
|
4
4
|
import { Column, ColumnBasicInfo, ColumnContainer } from "./column.js";
|
|
5
5
|
import { BoundaryAgeModelOverlay, ComputedSurfacesOverlay } from "./age-model-overlay.js";
|
|
6
6
|
import { ColumnNotes } from "./notes.js";
|
|
7
|
-
import {
|
|
7
|
+
import { AgeField, AgeLabel, Duration, IntervalProportions, getAge, getAgeRange } from "./unit-details/age-range.js";
|
|
8
8
|
import { AnnotatedUnitsColumn, ColumnNotesProvider, CompositeUnitComponent, CompositeUnitsColumn, LabelTrackerProvider, SectionLabelsColumn, TrackedLabeledUnit } from "./units/composite.js";
|
|
9
9
|
import { BaseMeasurementsColumn, TruncatedList, groupNotesByPixelDistance, mergeHeightRanges, standardizeMeasurementHeight } from "./facets/measurements/base.js";
|
|
10
|
+
import { ClickableText, Identifier, LegendPanelHeader, ReferencesField, ThicknessField, UnitDetailsFeature, UnitDetailsPanel } from "./unit-details/panel.js";
|
|
10
11
|
import { ColumnCenters, ColumnFeatures, ColumnKeyboardNavigation, Columns, CurrentColumn, MeasurementsLayer } from "./maps/column-navigation/svg/layers.js";
|
|
11
12
|
import { ColumnCorrelationMap } from "./maps/column-correlation/core.js";
|
|
12
13
|
import { ColumnCorrelationProvider, useCorrelationMapStore } from "./maps/column-correlation/state.js";
|
|
@@ -35,6 +36,7 @@ import { parseLineFromString, stringifyLine } from "./correlation-chart/hash-str
|
|
|
35
36
|
import { preprocessUnits } from "./prepare-units/helpers.js";
|
|
36
37
|
export {
|
|
37
38
|
AgeCursor,
|
|
39
|
+
AgeField,
|
|
38
40
|
AgeLabel,
|
|
39
41
|
AnnotatedUnitsColumn,
|
|
40
42
|
ApproximateHeightAxis,
|
|
@@ -73,6 +75,7 @@ export {
|
|
|
73
75
|
HybridScaleType,
|
|
74
76
|
Identifier,
|
|
75
77
|
InsetMap,
|
|
78
|
+
IntervalProportions,
|
|
76
79
|
IsotopesColumn,
|
|
77
80
|
IsotopesDataset,
|
|
78
81
|
LabelTrackerProvider,
|
|
@@ -93,6 +96,7 @@ export {
|
|
|
93
96
|
SGPMeasurementsColumn,
|
|
94
97
|
SectionLabelsColumn,
|
|
95
98
|
SimpleUnitsColumn,
|
|
99
|
+
ThicknessField,
|
|
96
100
|
TrackedLabeledUnit,
|
|
97
101
|
TruncatedList,
|
|
98
102
|
UnitComponent,
|
|
@@ -116,6 +120,8 @@ export {
|
|
|
116
120
|
ensureArray,
|
|
117
121
|
ensureRealFloat,
|
|
118
122
|
flattenLithologies,
|
|
123
|
+
getAge,
|
|
124
|
+
getAgeRange,
|
|
119
125
|
getMixedColorForData,
|
|
120
126
|
getMixedUnitColor,
|
|
121
127
|
getPositionWithinUnit,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/section.cjs
CHANGED
|
@@ -9,7 +9,7 @@ const dataProvider = require("@macrostrat/data-provider");
|
|
|
9
9
|
const dataComponents = require("@macrostrat/data-components");
|
|
10
10
|
const store = require("./data-provider/store.cjs");
|
|
11
11
|
const composite = require("./units/composite.cjs");
|
|
12
|
-
const
|
|
12
|
+
const ageRange = require("./unit-details/age-range.cjs");
|
|
13
13
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
14
14
|
const h__default = /* @__PURE__ */ _interopDefault(h$1);
|
|
15
15
|
const h = h__default.default.styled(column_module.default);
|
|
@@ -254,7 +254,7 @@ function Unconformity({
|
|
|
254
254
|
const _txt = ageGap.toLocaleString("en-US", { maximumFractionDigits });
|
|
255
255
|
val = h(dataComponents.Value, { value: _txt, unit: "m" });
|
|
256
256
|
} else {
|
|
257
|
-
val = h(
|
|
257
|
+
val = h(ageRange.Duration, { value: ageGap, maximumFractionDigits });
|
|
258
258
|
}
|
|
259
259
|
let prefix = null;
|
|
260
260
|
if (verbose) {
|
package/dist/section.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section.cjs","sources":["../src/section.ts"],"sourcesContent":["import {\n CompositeUnitsColumn,\n LabelTrackerProvider,\n SectionLabelsColumn,\n} from \"./units\";\nimport { ReactNode, FunctionComponent, useMemo } from \"react\";\nimport {\n Timescale,\n TimescaleOrientation,\n useMacrostratIntervals,\n} from \"@macrostrat/timescale\";\nimport { ColumnAxisType, SVG } from \"@macrostrat/column-components\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./column.module.sass\";\nimport {\n useMacrostratColumnData,\n useMacrostratUnits,\n MacrostratColumnProvider,\n} from \"./data-provider\";\nimport { useMacrostratBaseURL } from \"@macrostrat/data-provider\";\nimport { Duration } from \"./unit-details\";\nimport { Value } from \"@macrostrat/data-components\";\nimport type { ExtUnit, PackageScaleLayoutData } from \"./prepare-units/types\";\n\nconst h = hyper.styled(styles);\n\nexport interface SectionSharedProps {\n unitComponent?: FunctionComponent<any>;\n unitComponentProps?: any;\n showLabels?: boolean;\n width?: number;\n columnWidth?: number;\n children?: ReactNode;\n showLabelColumn?: boolean;\n axisType?: ColumnAxisType;\n className?: string;\n clipUnits?: boolean;\n maxInternalColumns?: number;\n // Space between sections\n verticalSpacing?: number;\n // Whether to render unconformity labels\n unconformityLabels?: boolean;\n}\n\nexport interface SectionProps extends SectionSharedProps {\n units: ExtUnit[];\n scaleInfo: PackageScaleLayoutData;\n}\n\nexport function SectionsColumn(props: SectionSharedProps) {\n const {\n unconformityLabels = true,\n unitComponent,\n unitComponentProps,\n showLabels = true,\n width = 300,\n columnWidth = 150,\n showLabelColumn = true,\n clipUnits = true,\n maxInternalColumns,\n } = props;\n\n const units = useMacrostratUnits();\n\n // Get a unique key for the column\n const key = units[0]?.col_id;\n\n return h(LabelTrackerProvider, { units, key }, [\n h(SectionUnitsColumn, {\n width: columnWidth,\n unitComponent,\n unitComponentProps,\n showLabels,\n clipUnits,\n maxInternalColumns,\n unconformityLabels,\n }),\n h.if(showLabelColumn)(SectionLabelsColumn, {\n width: width - columnWidth,\n }),\n ]);\n}\n\nfunction SectionUnitsColumn(props: SectionSharedProps) {\n const {\n width,\n showLabels,\n unitComponent,\n unitComponentProps,\n clipUnits,\n maxInternalColumns,\n axisType,\n unconformityLabels = true,\n } = props;\n\n const { sections, totalHeight } = useMacrostratColumnData();\n\n const scaleData: PackageScaleLayoutData[] = sections.map((section) => {\n return section.scaleInfo;\n });\n\n const innerWidth = width - 2;\n\n return h(\"div.section-units-container\", { style: { width } }, [\n h(\n SVG,\n {\n className: \"sections\",\n height: totalHeight,\n innerWidth,\n paddingH: 1,\n },\n sections.map((group) => {\n const { units, scaleInfo, section_id } = group;\n\n const key = `section-${section_id}`;\n return h(\n SectionUnits,\n {\n units,\n scaleInfo,\n key,\n unitComponent,\n unitComponentProps,\n showLabels,\n width: innerWidth,\n clipUnits,\n maxInternalColumns,\n }, // This unconformity is with the section _above_\n );\n }),\n ),\n h.if(unconformityLabels)(UnconformityLabels, {\n width,\n sections: scaleData,\n verbose: false,\n }),\n ]);\n}\n\nfunction SectionUnits(props: SectionProps) {\n // Section with \"squishy\" timescale\n const {\n units,\n scaleInfo,\n unitComponent,\n showLabels = true,\n width = 300,\n unitComponentProps,\n className,\n clipUnits = true,\n maxInternalColumns,\n } = props;\n\n const { domain, pixelScale, pixelHeight, scale } = scaleInfo;\n\n /** Ensure that we can arrange units into the maximum number\n * of columns defined by unitComponentProps, but that we don't\n * use more than necessary.\n */\n const _unitComponentProps = useMemo(() => {\n return {\n ...unitComponentProps,\n nColumns: Math.min(\n maxInternalColumns ?? Math.floor(width / 10),\n unitComponentProps?.nColumns ?? Infinity,\n Math.max(...units.map((d) => d.column)) + 1,\n ),\n //axisType,\n };\n }, [units, unitComponentProps, maxInternalColumns, width]);\n\n const style = {\n \"--section-height\": `${pixelHeight}px`,\n \"--section-width\": `${width}px`,\n };\n\n return h(\n \"g.section\",\n { className, style, transform: `translate(0 ${scaleInfo.offset})` },\n h(\n MacrostratColumnProvider,\n {\n units,\n domain,\n pixelScale, // Actually pixels per myr,\n scale,\n },\n h(CompositeUnitsColumn, {\n width,\n showLabels,\n unitComponent,\n unitComponentProps: _unitComponentProps,\n clipToFrame: clipUnits,\n }),\n ),\n );\n}\n\ninterface CompositeTimescaleProps {\n levels?: [number, number] | number;\n unconformityLabels?: boolean;\n}\n\nexport function CompositeTimescale(props: CompositeTimescaleProps) {\n const { sections } = useMacrostratColumnData();\n const sectionScales = sections.map((section) => {\n return section.scaleInfo;\n });\n\n return h(CompositeTimescaleCore, {\n packages: sectionScales,\n ...props,\n });\n}\n\ntype CompositeTimescaleCoreProps = CompositeTimescaleProps & {\n packages: PackageScaleLayoutData[];\n};\n\nexport function CompositeTimescaleCore(props: CompositeTimescaleCoreProps) {\n const { levels = 3, packages, unconformityLabels = false } = props;\n\n // Use intervals from Macrostrat API\n const baseURL = useMacrostratBaseURL();\n const intervals = useMacrostratIntervals(baseURL);\n\n let _levels: [number, number];\n if (typeof levels === \"number\") {\n // If levels is a number, use the most common starting level\n _levels = [2, Math.max(2 + Math.min(levels, 5) - 1, 1)];\n } else {\n _levels = levels;\n }\n\n const nCols = _levels[1] - _levels[0] + 1;\n\n return h(\"div.timescale-column\", [\n h(\n \"div.timescales\",\n packages.map((group) => {\n const { pixelHeight, paddingTop, key, scale } = group;\n return h(\n \"div.timescale-container\",\n { style: { paddingTop, \"--timescale-level-count\": nCols }, key },\n [\n h(Timescale, {\n orientation: TimescaleOrientation.VERTICAL,\n length: pixelHeight,\n levels: _levels,\n absoluteAgeScale: true,\n showAgeAxis: false,\n scale,\n intervals,\n }),\n ],\n );\n }),\n ),\n h.if(unconformityLabels)(UnconformityLabels, {\n width: \"100%\",\n sections: packages,\n className: \"unconformity-labels\",\n axisType: ColumnAxisType.AGE,\n }),\n ]);\n}\n\nexport function UnconformityLabels(props: {\n width: string | number;\n sections: PackageScaleLayoutData[];\n axisType?: ColumnAxisType;\n className?: string;\n verbose?: boolean;\n}) {\n const { width, sections, className, axisType, verbose } = props;\n\n return h(\n \"div.unconformity-labels\",\n {\n style: {\n width,\n },\n className,\n },\n sections.map((scaleInfo, i) => {\n const lastGroup = sections[i - 1];\n const top = scaleInfo.offset - scaleInfo.paddingTop;\n const upperAge = lastGroup?.domain[0];\n const lowerAge = scaleInfo.domain[1];\n return h(Unconformity, {\n axisType,\n upperAge,\n lowerAge,\n style: {\n width,\n height: scaleInfo.paddingTop,\n top,\n },\n verbose,\n });\n }),\n );\n}\n\nfunction Unconformity({\n upperAge,\n lowerAge,\n style,\n axisType,\n verbose = false,\n}) {\n if (upperAge == null || lowerAge == null) {\n return null;\n }\n\n const ageGap = Math.abs(upperAge - lowerAge);\n\n let maximumFractionDigits = 0;\n\n let className: string = null;\n if (ageGap > 1000) {\n className = \"giga\";\n } else if (ageGap > 100) {\n className = \"mega\";\n } else if (ageGap > 10) {\n className = \"large\";\n } else if (ageGap < 1) {\n className = \"small\";\n maximumFractionDigits = 2;\n } else {\n maximumFractionDigits = 1;\n }\n\n let val: ReactNode;\n if (axisType === ColumnAxisType.DEPTH || axisType === ColumnAxisType.HEIGHT) {\n const _txt = ageGap.toLocaleString(\"en-US\", { maximumFractionDigits });\n val = h(Value, { value: _txt, unit: \"m\" });\n } else {\n val = h(Duration, { value: ageGap, maximumFractionDigits });\n }\n\n let prefix: ReactNode = null;\n if (verbose) {\n prefix = h([\" \", h(\"span.prefix\", \" gap\")]);\n }\n\n return h(\"div.unconformity\", { style, className }, [\n h(\"div.unconformity-inner\", h(\"div.unconformity-text\", [val, prefix])),\n ]);\n}\n"],"names":["hyper","styles","useMacrostratUnits","LabelTrackerProvider","SectionLabelsColumn","useMacrostratColumnData","SVG","useMemo","MacrostratColumnProvider","CompositeUnitsColumn","useMacrostratBaseURL","useMacrostratIntervals","Timescale","TimescaleOrientation","ColumnAxisType","Value","Duration"],"mappings":";;;;;;;;;;;;;;AAwBA,MAAM,IAAIA,WAAAA,QAAM,OAAOC,qBAAM;AAyBtB,SAAS,eAAe,OAA2B;AACxD,QAAM;AAAA,IACJ,qBAAqB;AAAA,IACrB;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,kBAAkB;AAAA,IAClB,YAAY;AAAA,IACZ;AAAA,EAAA,IACE;AAEJ,QAAM,QAAQC,MAAAA,mBAAA;AAGd,QAAM,MAAM,MAAM,CAAC,GAAG;AAEtB,SAAO,EAAEC,UAAAA,sBAAsB,EAAE,OAAO,OAAO;AAAA,IAC7C,EAAE,oBAAoB;AAAA,MACpB,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,CACD;AAAA,I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AA,QACA,OAAO;AAAA,UACL;AAAA,UACA,QAAQ,UAAU;AAAA,UAClB;AAAA,QAAA;AAAA,QAEF;AAAA,MAAA,CACD;AAAA,IACH,CAAC;AAAA,EAAA;AAEL;AAEA,SAAS,aAAa;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AACZ,GAAG;AACD,MAAI,YAAY,QAAQ,YAAY,MAAM;AACxC,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,KAAK,IAAI,WAAW,QAAQ;AAE3C,MAAI,wBAAwB;AAE5B,MAAI,YAAoB;AACxB,MAAI,SAAS,KAAM;AACjB,gBAAY;AAAA,EACd,WAAW,SAAS,KAAK;AACvB,gBAAY;AAAA,EACd,WAAW,SAAS,IAAI;AACtB,gBAAY;AAAA,EACd,WAAW,SAAS,GAAG;AACrB,gBAAY;AACZ,4BAAwB;AAAA,EAC1B,OAAO;AACL,4BAAwB;AAAA,EAC1B;AAEA,MAAI;AACJ,MAAI,aAAaA,iBAAAA,eAAe,SAAS,aAAaA,iBAAAA,eAAe,QAAQ;AAC3E,UAAM,OAAO,OAAO,eAAe,SAAS,EAAE,uBAAuB;AACrE,UAAM,EAAEC,sBAAO,EAAE,OAAO,MAAM,MAAM,KAAK;AAAA,EAC3C,OAAO;AACL,UAAM,EAAEC,MAAAA,UAAU,EAAE,OAAO,QAAQ,uBAAuB;AAAA,EAC5D;AAEA,MAAI,SAAoB;AACxB,MAAI,SAAS;AACX,aAAS,EAAE,CAAC,KAAK,EAAE,eAAe,MAAM,CAAC,CAAC;AAAA,EAC5C;AAEA,SAAO,EAAE,oBAAoB,EAAE,OAAO,aAAa;AAAA,IACjD,EAAE,0BAA0B,EAAE,yBAAyB,CAAC,KAAK,MAAM,CAAC,CAAC;AAAA,EAAA,CACtE;AACH;;;;;"}
|
|
1
|
+
{"version":3,"file":"section.cjs","sources":["../src/section.ts"],"sourcesContent":["import {\n CompositeUnitsColumn,\n LabelTrackerProvider,\n SectionLabelsColumn,\n} from \"./units\";\nimport { ReactNode, FunctionComponent, useMemo } from \"react\";\nimport {\n Timescale,\n TimescaleOrientation,\n useMacrostratIntervals,\n} from \"@macrostrat/timescale\";\nimport { ColumnAxisType, SVG } from \"@macrostrat/column-components\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./column.module.sass\";\nimport {\n useMacrostratColumnData,\n useMacrostratUnits,\n MacrostratColumnProvider,\n} from \"./data-provider\";\nimport { useMacrostratBaseURL } from \"@macrostrat/data-provider\";\nimport { Duration } from \"./unit-details\";\nimport { Value } from \"@macrostrat/data-components\";\nimport type { ExtUnit, PackageScaleLayoutData } from \"./prepare-units/types\";\n\nconst h = hyper.styled(styles);\n\nexport interface SectionSharedProps {\n unitComponent?: FunctionComponent<any>;\n unitComponentProps?: any;\n showLabels?: boolean;\n width?: number;\n columnWidth?: number;\n children?: ReactNode;\n showLabelColumn?: boolean;\n axisType?: ColumnAxisType;\n className?: string;\n clipUnits?: boolean;\n maxInternalColumns?: number;\n // Space between sections\n verticalSpacing?: number;\n // Whether to render unconformity labels\n unconformityLabels?: boolean;\n}\n\nexport interface SectionProps extends SectionSharedProps {\n units: ExtUnit[];\n scaleInfo: PackageScaleLayoutData;\n}\n\nexport function SectionsColumn(props: SectionSharedProps) {\n const {\n unconformityLabels = true,\n unitComponent,\n unitComponentProps,\n showLabels = true,\n width = 300,\n columnWidth = 150,\n showLabelColumn = true,\n clipUnits = true,\n maxInternalColumns,\n } = props;\n\n const units = useMacrostratUnits();\n\n // Get a unique key for the column\n const key = units[0]?.col_id;\n\n return h(LabelTrackerProvider, { units, key }, [\n h(SectionUnitsColumn, {\n width: columnWidth,\n unitComponent,\n unitComponentProps,\n showLabels,\n clipUnits,\n maxInternalColumns,\n unconformityLabels,\n }),\n h.if(showLabelColumn)(SectionLabelsColumn, {\n width: width - columnWidth,\n }),\n ]);\n}\n\nfunction SectionUnitsColumn(props: SectionSharedProps) {\n const {\n width,\n showLabels,\n unitComponent,\n unitComponentProps,\n clipUnits,\n maxInternalColumns,\n axisType,\n unconformityLabels = true,\n } = props;\n\n const { sections, totalHeight } = useMacrostratColumnData();\n\n const scaleData: PackageScaleLayoutData[] = sections.map((section) => {\n return section.scaleInfo;\n });\n\n const innerWidth = width - 2;\n\n return h(\"div.section-units-container\", { style: { width } }, [\n h(\n SVG,\n {\n className: \"sections\",\n height: totalHeight,\n innerWidth,\n paddingH: 1,\n },\n sections.map((group) => {\n const { units, scaleInfo, section_id } = group;\n\n const key = `section-${section_id}`;\n return h(\n SectionUnits,\n {\n units,\n scaleInfo,\n key,\n unitComponent,\n unitComponentProps,\n showLabels,\n width: innerWidth,\n clipUnits,\n maxInternalColumns,\n }, // This unconformity is with the section _above_\n );\n }),\n ),\n h.if(unconformityLabels)(UnconformityLabels, {\n width,\n sections: scaleData,\n verbose: false,\n }),\n ]);\n}\n\nfunction SectionUnits(props: SectionProps) {\n // Section with \"squishy\" timescale\n const {\n units,\n scaleInfo,\n unitComponent,\n showLabels = true,\n width = 300,\n unitComponentProps,\n className,\n clipUnits = true,\n maxInternalColumns,\n } = props;\n\n const { domain, pixelScale, pixelHeight, scale } = scaleInfo;\n\n /** Ensure that we can arrange units into the maximum number\n * of columns defined by unitComponentProps, but that we don't\n * use more than necessary.\n */\n const _unitComponentProps = useMemo(() => {\n return {\n ...unitComponentProps,\n nColumns: Math.min(\n maxInternalColumns ?? Math.floor(width / 10),\n unitComponentProps?.nColumns ?? Infinity,\n Math.max(...units.map((d) => d.column)) + 1,\n ),\n //axisType,\n };\n }, [units, unitComponentProps, maxInternalColumns, width]);\n\n const style = {\n \"--section-height\": `${pixelHeight}px`,\n \"--section-width\": `${width}px`,\n };\n\n return h(\n \"g.section\",\n { className, style, transform: `translate(0 ${scaleInfo.offset})` },\n h(\n MacrostratColumnProvider,\n {\n units,\n domain,\n pixelScale, // Actually pixels per myr,\n scale,\n },\n h(CompositeUnitsColumn, {\n width,\n showLabels,\n unitComponent,\n unitComponentProps: _unitComponentProps,\n clipToFrame: clipUnits,\n }),\n ),\n );\n}\n\ninterface CompositeTimescaleProps {\n levels?: [number, number] | number;\n unconformityLabels?: boolean;\n}\n\nexport function CompositeTimescale(props: CompositeTimescaleProps) {\n const { sections } = useMacrostratColumnData();\n const sectionScales = sections.map((section) => {\n return section.scaleInfo;\n });\n\n return h(CompositeTimescaleCore, {\n packages: sectionScales,\n ...props,\n });\n}\n\ntype CompositeTimescaleCoreProps = CompositeTimescaleProps & {\n packages: PackageScaleLayoutData[];\n};\n\nexport function CompositeTimescaleCore(props: CompositeTimescaleCoreProps) {\n const { levels = 3, packages, unconformityLabels = false } = props;\n\n // Use intervals from Macrostrat API\n const baseURL = useMacrostratBaseURL();\n const intervals = useMacrostratIntervals(baseURL);\n\n let _levels: [number, number];\n if (typeof levels === \"number\") {\n // If levels is a number, use the most common starting level\n _levels = [2, Math.max(2 + Math.min(levels, 5) - 1, 1)];\n } else {\n _levels = levels;\n }\n\n const nCols = _levels[1] - _levels[0] + 1;\n\n return h(\"div.timescale-column\", [\n h(\n \"div.timescales\",\n packages.map((group) => {\n const { pixelHeight, paddingTop, key, scale } = group;\n return h(\n \"div.timescale-container\",\n { style: { paddingTop, \"--timescale-level-count\": nCols }, key },\n [\n h(Timescale, {\n orientation: TimescaleOrientation.VERTICAL,\n length: pixelHeight,\n levels: _levels,\n absoluteAgeScale: true,\n showAgeAxis: false,\n scale,\n intervals,\n }),\n ],\n );\n }),\n ),\n h.if(unconformityLabels)(UnconformityLabels, {\n width: \"100%\",\n sections: packages,\n className: \"unconformity-labels\",\n axisType: ColumnAxisType.AGE,\n }),\n ]);\n}\n\nexport function UnconformityLabels(props: {\n width: string | number;\n sections: PackageScaleLayoutData[];\n axisType?: ColumnAxisType;\n className?: string;\n verbose?: boolean;\n}) {\n const { width, sections, className, axisType, verbose } = props;\n\n return h(\n \"div.unconformity-labels\",\n {\n style: {\n width,\n },\n className,\n },\n sections.map((scaleInfo, i) => {\n const lastGroup = sections[i - 1];\n const top = scaleInfo.offset - scaleInfo.paddingTop;\n const upperAge = lastGroup?.domain[0];\n const lowerAge = scaleInfo.domain[1];\n return h(Unconformity, {\n axisType,\n upperAge,\n lowerAge,\n style: {\n width,\n height: scaleInfo.paddingTop,\n top,\n },\n verbose,\n });\n }),\n );\n}\n\nfunction Unconformity({\n upperAge,\n lowerAge,\n style,\n axisType,\n verbose = false,\n}) {\n if (upperAge == null || lowerAge == null) {\n return null;\n }\n\n const ageGap = Math.abs(upperAge - lowerAge);\n\n let maximumFractionDigits = 0;\n\n let className: string = null;\n if (ageGap > 1000) {\n className = \"giga\";\n } else if (ageGap > 100) {\n className = \"mega\";\n } else if (ageGap > 10) {\n className = \"large\";\n } else if (ageGap < 1) {\n className = \"small\";\n maximumFractionDigits = 2;\n } else {\n maximumFractionDigits = 1;\n }\n\n let val: ReactNode;\n if (axisType === ColumnAxisType.DEPTH || axisType === ColumnAxisType.HEIGHT) {\n const _txt = ageGap.toLocaleString(\"en-US\", { maximumFractionDigits });\n val = h(Value, { value: _txt, unit: \"m\" });\n } else {\n val = h(Duration, { value: ageGap, maximumFractionDigits });\n }\n\n let prefix: ReactNode = null;\n if (verbose) {\n prefix = h([\" \", h(\"span.prefix\", \" gap\")]);\n }\n\n return h(\"div.unconformity\", { style, className }, [\n h(\"div.unconformity-inner\", h(\"div.unconformity-text\", [val, prefix])),\n ]);\n}\n"],"names":["hyper","styles","useMacrostratUnits","LabelTrackerProvider","SectionLabelsColumn","useMacrostratColumnData","SVG","useMemo","MacrostratColumnProvider","CompositeUnitsColumn","useMacrostratBaseURL","useMacrostratIntervals","Timescale","TimescaleOrientation","ColumnAxisType","Value","Duration"],"mappings":";;;;;;;;;;;;;;AAwBA,MAAM,IAAIA,WAAAA,QAAM,OAAOC,qBAAM;AAyBtB,SAAS,eAAe,OAA2B;AACxD,QAAM;AAAA,IACJ,qBAAqB;AAAA,IACrB;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,cAAc;AAAA,I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;AACX,aAAS,EAAE,CAAC,KAAK,EAAE,eAAe,MAAM,CAAC,CAAC;AAAA,EAC5C;AAEA,SAAO,EAAE,oBAAoB,EAAE,OAAO,aAAa;AAAA,IACjD,EAAE,0BAA0B,EAAE,yBAAyB,CAAC,KAAK,MAAM,CAAC,CAAC;AAAA,EAAA,CACtE;AACH;;;;;"}
|
package/dist/section.js
CHANGED
|
@@ -7,7 +7,7 @@ import { useMacrostratBaseURL } from "@macrostrat/data-provider";
|
|
|
7
7
|
import { Value } from "@macrostrat/data-components";
|
|
8
8
|
import { useMacrostratColumnData, useMacrostratUnits, MacrostratColumnProvider } from "./data-provider/store.js";
|
|
9
9
|
import { LabelTrackerProvider, SectionLabelsColumn, CompositeUnitsColumn } from "./units/composite.js";
|
|
10
|
-
import { Duration } from "./unit-details/
|
|
10
|
+
import { Duration } from "./unit-details/age-range.js";
|
|
11
11
|
const h = h$1.styled(h$2);
|
|
12
12
|
function SectionsColumn(props) {
|
|
13
13
|
const {
|