@macrostrat/column-views 3.12.0 → 3.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/age-axis.cjs +1 -2
- package/dist/age-axis.cjs.map +1 -1
- package/dist/age-axis.js +1 -2
- package/dist/age-axis.js.map +1 -1
- package/dist/age-model/details.cjs +2 -3
- package/dist/age-model/details.cjs.map +1 -1
- package/dist/age-model/details.js +2 -3
- package/dist/age-model/details.js.map +1 -1
- package/dist/age-model/surfaces.cjs +1 -2
- package/dist/age-model/surfaces.cjs.map +1 -1
- package/dist/age-model/surfaces.js +1 -2
- package/dist/age-model/surfaces.js.map +1 -1
- package/dist/column-views.css +17 -17
- package/dist/index.cjs +25 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/unit-details/age-range.cjs +14 -44
- package/dist/unit-details/age-range.cjs.map +1 -1
- package/dist/unit-details/age-range.d.ts +2 -18
- package/dist/unit-details/age-range.js +6 -44
- package/dist/unit-details/age-range.js.map +1 -1
- package/dist/unit-details/utils.cjs +0 -5
- package/dist/unit-details/utils.cjs.map +1 -1
- package/dist/unit-details/utils.js +0 -5
- package/dist/unit-details/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/age-model/details.ts +2 -2
- package/src/age-model/surfaces.ts +2 -2
- package/src/unit-details/age-range.ts +13 -59
package/dist/column-views.css
CHANGED
|
@@ -74,23 +74,6 @@
|
|
|
74
74
|
position: relative;
|
|
75
75
|
display: flex;
|
|
76
76
|
flex-direction: row;
|
|
77
|
-
}._interval-proportions_1ibvp_1 {
|
|
78
|
-
display: inline-flex;
|
|
79
|
-
flex-flow: row wrap;
|
|
80
|
-
gap: 0.5em;
|
|
81
|
-
text-align: right;
|
|
82
|
-
align-items: baseline;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
._interval-proportions_1ibvp_1, ._discourage-break_1ibvp_9 {
|
|
86
|
-
align-items: baseline;
|
|
87
|
-
white-space: nowrap;
|
|
88
|
-
display: inline-flex;
|
|
89
|
-
gap: 0.5em;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
._sep_1ibvp_16 {
|
|
93
|
-
color: var(--secondary-color);
|
|
94
77
|
}._column-container_hmbev_1, body.light-mode ._column-container_hmbev_1 {
|
|
95
78
|
--column-selection-color: var(--column-cursor-color, var(--pz-accent-color, #7961db));
|
|
96
79
|
--column-background-color: var(--background-color, #fff);
|
|
@@ -322,6 +305,23 @@ body.dark-mode ._column-container_hmbev_1 svg pattern image {
|
|
|
322
305
|
gap: 1em;
|
|
323
306
|
justify-content: space-between;
|
|
324
307
|
align-items: baseline;
|
|
308
|
+
}._interval-proportions_1ibvp_1 {
|
|
309
|
+
display: inline-flex;
|
|
310
|
+
flex-flow: row wrap;
|
|
311
|
+
gap: 0.5em;
|
|
312
|
+
text-align: right;
|
|
313
|
+
align-items: baseline;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
._interval-proportions_1ibvp_1, ._discourage-break_1ibvp_9 {
|
|
317
|
+
align-items: baseline;
|
|
318
|
+
white-space: nowrap;
|
|
319
|
+
display: inline-flex;
|
|
320
|
+
gap: 0.5em;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
._sep_1ibvp_16 {
|
|
324
|
+
color: var(--secondary-color);
|
|
325
325
|
}._popover-main_4jzei_1 {
|
|
326
326
|
position: absolute;
|
|
327
327
|
pointer-events: none;
|
package/dist/index.cjs
CHANGED
|
@@ -11,11 +11,11 @@ const notes = require("./notes.cjs");
|
|
|
11
11
|
const mapViews = require("@macrostrat/map-views");
|
|
12
12
|
const data = require("./age-model/data.cjs");
|
|
13
13
|
const ageRange = require("./unit-details/age-range.cjs");
|
|
14
|
+
const dataComponents = require("@macrostrat/data-components");
|
|
14
15
|
const ageWindowTag = require("./unit-details/age-window-tag.cjs");
|
|
15
16
|
const composite = require("./units/composite.cjs");
|
|
16
17
|
const base = require("./facets/measurements/base.cjs");
|
|
17
18
|
const legacy = require("./age-model/legacy.cjs");
|
|
18
|
-
const dataComponents = require("@macrostrat/data-components");
|
|
19
19
|
const columnNav = require("./data-provider/column-nav.cjs");
|
|
20
20
|
const surfaces = require("./age-model/surfaces.cjs");
|
|
21
21
|
const main = require("./correlation-chart/main.cjs");
|
|
@@ -68,13 +68,34 @@ exports.AGE_MODEL_ROUTE = data.AGE_MODEL_ROUTE;
|
|
|
68
68
|
exports.useColumnAgeModel = data.useColumnAgeModel;
|
|
69
69
|
exports.useColumnSurfaces = data.useColumnSurfaces;
|
|
70
70
|
exports.AgeField = ageRange.AgeField;
|
|
71
|
-
exports.AgeLabel = ageRange.AgeLabel;
|
|
72
71
|
exports.AgeRange = ageRange.AgeRange;
|
|
73
72
|
exports.Duration = ageRange.Duration;
|
|
74
73
|
exports.IntervalProportions = ageRange.IntervalProportions;
|
|
75
|
-
exports.Proportion = ageRange.Proportion;
|
|
76
|
-
exports.getAge = ageRange.getAge;
|
|
77
74
|
exports.getAgeRange = ageRange.getAgeRange;
|
|
75
|
+
Object.defineProperty(exports, "AgeLabel", {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: () => dataComponents.AgeLabel
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, "ClickableText", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: () => dataComponents.ClickableText
|
|
82
|
+
});
|
|
83
|
+
Object.defineProperty(exports, "Identifier", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
get: () => dataComponents.Identifier
|
|
86
|
+
});
|
|
87
|
+
Object.defineProperty(exports, "Proportion", {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: () => dataComponents.IntervalProportion
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(exports, "UnitIdentifier", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: () => dataComponents.UnitIdentifier
|
|
94
|
+
});
|
|
95
|
+
Object.defineProperty(exports, "getAge", {
|
|
96
|
+
enumerable: true,
|
|
97
|
+
get: () => dataComponents.getAge
|
|
98
|
+
});
|
|
78
99
|
exports.AgeWindowTag = ageWindowTag.AgeWindowTag;
|
|
79
100
|
exports.intervalShortFromTimescale = ageWindowTag.intervalShortFromTimescale;
|
|
80
101
|
exports.AnnotatedUnitsColumn = composite.AnnotatedUnitsColumn;
|
|
@@ -91,18 +112,6 @@ exports.mergeHeightRanges = base.mergeHeightRanges;
|
|
|
91
112
|
exports.standardizeMeasurementHeight = base.standardizeMeasurementHeight;
|
|
92
113
|
exports.BoundaryAgeModelOverlay = legacy.BoundaryAgeModelOverlay;
|
|
93
114
|
exports.ComputedSurfacesOverlay = legacy.ComputedSurfacesOverlay;
|
|
94
|
-
Object.defineProperty(exports, "ClickableText", {
|
|
95
|
-
enumerable: true,
|
|
96
|
-
get: () => dataComponents.ClickableText
|
|
97
|
-
});
|
|
98
|
-
Object.defineProperty(exports, "Identifier", {
|
|
99
|
-
enumerable: true,
|
|
100
|
-
get: () => dataComponents.Identifier
|
|
101
|
-
});
|
|
102
|
-
Object.defineProperty(exports, "UnitIdentifier", {
|
|
103
|
-
enumerable: true,
|
|
104
|
-
get: () => dataComponents.UnitIdentifier
|
|
105
|
-
});
|
|
106
115
|
exports.ColumnNavProvider = columnNav.ColumnNavProvider;
|
|
107
116
|
exports.useColumnNav = columnNav.useColumnNav;
|
|
108
117
|
exports.ColumnSurfaceLabels = surfaces.ColumnSurfaceLabels;
|
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
|
@@ -8,12 +8,12 @@ import { CompositeTimescale, CompositeTimescaleCore } from "./section.js";
|
|
|
8
8
|
import { ColumnNotes } from "./notes.js";
|
|
9
9
|
export * from "@macrostrat/map-views";
|
|
10
10
|
import { AGE_MODEL_ROUTE, useColumnAgeModel, useColumnSurfaces } from "./age-model/data.js";
|
|
11
|
-
import { AgeField,
|
|
11
|
+
import { AgeField, AgeRange, Duration, IntervalProportions, getAgeRange } from "./unit-details/age-range.js";
|
|
12
|
+
import { AgeLabel, ClickableText, Identifier, IntervalProportion, UnitIdentifier, getAge } from "@macrostrat/data-components";
|
|
12
13
|
import { AgeWindowTag, intervalShortFromTimescale } from "./unit-details/age-window-tag.js";
|
|
13
14
|
import { AnnotatedUnitsColumn, ColumnNotesProvider, CompositeUnitComponent, CompositeUnitsColumn, LabelTrackerProvider, SectionLabelsColumn, TrackedLabeledUnit } from "./units/composite.js";
|
|
14
15
|
import { BaseMeasurementsColumn, TruncatedList, groupNotesByPixelDistance, mergeHeightRanges, standardizeMeasurementHeight } from "./facets/measurements/base.js";
|
|
15
16
|
import { BoundaryAgeModelOverlay, ComputedSurfacesOverlay } from "./age-model/legacy.js";
|
|
16
|
-
import { ClickableText, Identifier, UnitIdentifier } from "@macrostrat/data-components";
|
|
17
17
|
import { ColumnNavProvider, useColumnNav } from "./data-provider/column-nav.js";
|
|
18
18
|
import { ColumnSurfaceLabels, ColumnSurfaceLines, ColumnSurfaces, surfaceClasses } from "./age-model/surfaces.js";
|
|
19
19
|
import { CorrelationChart } from "./correlation-chart/main.js";
|
|
@@ -92,7 +92,7 @@ export {
|
|
|
92
92
|
MergeSectionsMode,
|
|
93
93
|
PBDBFossilsColumn,
|
|
94
94
|
PBDBOccurrencesMatrix,
|
|
95
|
-
Proportion,
|
|
95
|
+
IntervalProportion as Proportion,
|
|
96
96
|
ReferencesField,
|
|
97
97
|
SGPMeasurementsColumn,
|
|
98
98
|
SectionLabelsColumn,
|
|
@@ -32,19 +32,6 @@ function AgeRange({
|
|
|
32
32
|
className
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
function AgeLabel({
|
|
36
|
-
age,
|
|
37
|
-
maximumFractionDigits = 2,
|
|
38
|
-
minimumFractionDigits = 0,
|
|
39
|
-
className
|
|
40
|
-
}) {
|
|
41
|
-
const [value, unit] = getAge(age);
|
|
42
|
-
const _value = value.toLocaleString("en-US", {
|
|
43
|
-
maximumFractionDigits,
|
|
44
|
-
minimumFractionDigits
|
|
45
|
-
});
|
|
46
|
-
return ageRange_module.default(dataComponents.Value, { value: _value, unit, className });
|
|
47
|
-
}
|
|
48
35
|
function Duration({
|
|
49
36
|
value,
|
|
50
37
|
maximumFractionDigits = 2,
|
|
@@ -110,9 +97,9 @@ function IntervalProportions({
|
|
|
110
97
|
let p0 = null;
|
|
111
98
|
let p1 = null;
|
|
112
99
|
if (_showProps !== false) {
|
|
113
|
-
p1 = ageRange_module.default(
|
|
100
|
+
p1 = ageRange_module.default(dataComponents.IntervalProportion, { value: t_prop });
|
|
114
101
|
if (i0 !== i1 || b_prop !== 0 || t_prop !== 1) {
|
|
115
|
-
p0 = ageRange_module.default(
|
|
102
|
+
p0 = ageRange_module.default(dataComponents.IntervalProportion, { value: b_prop });
|
|
116
103
|
}
|
|
117
104
|
if (i0 === i1 && (b_prop !== 0 || t_prop !== 1)) {
|
|
118
105
|
p0 = ageRange_module.default("span.joint-proportion", [p0, " ", ageRange_module.default("span.sep", "to"), " ", p1]);
|
|
@@ -145,17 +132,6 @@ function IntervalProportions({
|
|
|
145
132
|
function getProportion(age, interval) {
|
|
146
133
|
return (interval.b_age - age) / (interval.b_age - interval.t_age);
|
|
147
134
|
}
|
|
148
|
-
function Proportion({ value }) {
|
|
149
|
-
let content = null;
|
|
150
|
-
if (value == 0) {
|
|
151
|
-
content = "base";
|
|
152
|
-
} else if (value == 1) {
|
|
153
|
-
content = "top";
|
|
154
|
-
} else {
|
|
155
|
-
content = utils.formatProportion(value * 100) + "%";
|
|
156
|
-
}
|
|
157
|
-
return ageRange_module.default("span.proportion", content);
|
|
158
|
-
}
|
|
159
135
|
function getAgeRange(_unit) {
|
|
160
136
|
let b_age = _unit.b_age;
|
|
161
137
|
let t_age = _unit.t_age;
|
|
@@ -171,27 +147,21 @@ function getAgeRange(_unit) {
|
|
|
171
147
|
}
|
|
172
148
|
return [b_age, t_age, unit];
|
|
173
149
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
return [value, unit];
|
|
188
|
-
}
|
|
150
|
+
Object.defineProperty(exports, "AgeLabel", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: () => dataComponents.AgeLabel
|
|
153
|
+
});
|
|
154
|
+
Object.defineProperty(exports, "Proportion", {
|
|
155
|
+
enumerable: true,
|
|
156
|
+
get: () => dataComponents.IntervalProportion
|
|
157
|
+
});
|
|
158
|
+
Object.defineProperty(exports, "getAge", {
|
|
159
|
+
enumerable: true,
|
|
160
|
+
get: () => dataComponents.getAge
|
|
161
|
+
});
|
|
189
162
|
exports.AgeField = AgeField;
|
|
190
|
-
exports.AgeLabel = AgeLabel;
|
|
191
163
|
exports.AgeRange = AgeRange;
|
|
192
164
|
exports.Duration = Duration;
|
|
193
165
|
exports.IntervalProportions = IntervalProportions;
|
|
194
|
-
exports.Proportion = Proportion;
|
|
195
|
-
exports.getAge = getAge;
|
|
196
166
|
exports.getAgeRange = getAgeRange;
|
|
197
167
|
//# sourceMappingURL=age-range.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"age-range.cjs","sources":["../../src/unit-details/age-range.ts"],"sourcesContent":["import {\n DataField,\n IntervalShort,\n IntervalTag,\n type IntervalTagProps,\n ItemList,\n Value,\n} from \"@macrostrat/data-components\";\nimport { useMacrostratDefs } from \"@macrostrat/data-provider\";\nimport h from \"./age-range.module.sass\";\nimport { formatProportion, formatRange } from \"./utils\";\nimport classNames from \"classnames\";\nimport { ReactNode, useMemo } from \"react\";\n\nexport function AgeField({ unit, children, ...rest }) {\n const [_b_age, _t_age, _unit] = getAgeRange(unit);\n\n return h(\n DataField,\n {\n label: \"Age\",\n value: formatRange(_b_age, _t_age),\n unit: _unit,\n ...rest,\n },\n children,\n );\n}\n\nexport function AgeRange({\n data,\n className,\n}: {\n data: {\n t_age: number;\n b_age: number;\n };\n className?: string;\n}) {\n const [_b_age, _t_age, _unit] = getAgeRange(data);\n\n return h(Value, {\n value: formatRange(_b_age, _t_age),\n unit: _unit,\n className,\n });\n}\n\nexport function AgeLabel({\n age,\n maximumFractionDigits = 2,\n minimumFractionDigits = 0,\n className,\n}: {\n age: number;\n className?: string;\n maximumFractionDigits?: number;\n minimumFractionDigits?: number;\n}) {\n /** Component to display a single age value with unit conversion from\n * Ma to ka or Ga as appropriate.\n */\n const [value, unit] = getAge(age);\n\n const _value = value.toLocaleString(\"en-US\", {\n maximumFractionDigits,\n minimumFractionDigits,\n });\n\n return h(Value, { value: _value, unit, className });\n}\n\nexport function Duration({\n value,\n maximumFractionDigits = 2,\n minimumFractionDigits = 0,\n}) {\n let unit = \"Myr\";\n if (value < 0.8) {\n unit = \"kyr\";\n value *= 1000;\n if (value < 5) {\n unit = \"yr\";\n value *= 1000;\n }\n } else if (value > 1000) {\n unit = \"Gyr\";\n value /= 1000;\n }\n\n let _value = value.toLocaleString(\"en-US\", {\n maximumFractionDigits,\n minimumFractionDigits,\n });\n\n return h(Value, { value: _value, unit });\n}\n\ninterface UnitIntervalConstraints {\n b_int_id?: number;\n t_int_id?: number;\n b_prop?: number;\n t_prop?: number;\n b_int_name?: string;\n t_int_name?: string;\n b_age?: number;\n t_age?: number;\n}\n\nexport interface IntervalProportionsProps extends Omit<\n IntervalTagProps,\n \"interval\"\n> {\n unit: UnitIntervalConstraints;\n showProportions?: boolean;\n calculateProportionsFromAges?: boolean;\n onClickItem?: any;\n}\n\nexport function IntervalProportions({\n unit,\n className,\n showProportions,\n calculateProportionsFromAges = true,\n ...rest\n}: IntervalProportionsProps) {\n /** Display the proportions of the unit that belong to the base and top intervals, if they are different */\n if (unit.b_int_id == null && unit.t_int_id == null) return null;\n\n let _showProps = showProportions;\n\n const i0 = unit.b_int_id;\n const i1 = unit.t_int_id;\n\n const ints = new Set([i0, i1]);\n\n /** Get interval information */\n const intervalMap = useMacrostratDefs(\"intervals\", Array.from(ints), null);\n const [int0, int1] = useMemo(() => {\n const int0 = intervalMap?.get(i0) ?? {};\n if (i0 === i1) {\n return [int0, int0];\n }\n const int1 = intervalMap?.get(i1) ?? {};\n return [int0, int1];\n }, [intervalMap, i0, i1]);\n\n const interval0: IntervalShort = {\n id: i0,\n name: unit.b_int_name,\n ...int0,\n };\n\n let b_prop = unit.b_prop;\n let t_prop = unit.t_prop;\n\n // If we have b_age and t_age, then we can calculate proportions if they are not given\n if (b_prop == null && unit.b_age != null && calculateProportionsFromAges) {\n b_prop = getProportion(unit.b_age, int0);\n }\n if (t_prop == null && unit.t_age != null && calculateProportionsFromAges) {\n t_prop = getProportion(unit.t_age, int1);\n }\n\n // If there are no proportions given and we are not explicitly directed to show them,\n // then we set them to hidden.\n if (b_prop == null && t_prop == null) {\n _showProps ??= false;\n }\n\n /*\n Set default proportions to 0 and 1 if they are not given,\n so that we can display \"base\" and \"top\" labels\n */\n b_prop ??= 0;\n t_prop ??= 1;\n\n let p0: any = null;\n let p1: any = null;\n\n if (_showProps !== false) {\n p1 = h(Proportion, { value: t_prop });\n\n if (i0 !== i1 || b_prop !== 0 || t_prop !== 1) {\n // We have a single interval with undefined proportions\n p0 = h(Proportion, { value: b_prop });\n }\n\n if (i0 === i1 && (b_prop !== 0 || t_prop !== 1)) {\n p0 = h(\"span.joint-proportion\", [p0, \" \", h(\"span.sep\", \"to\"), \" \", p1]);\n }\n }\n\n return h(\n ItemList,\n { className: classNames(\"interval-proportions\", className) },\n [\n h(IntervalTag, {\n interval: interval0,\n prefix: p0,\n ...rest,\n }),\n h.if(i0 != i1)(\"span.discourage-break\", [\n h(\"span.sep\", \" to \"),\n h(IntervalTag, {\n interval: {\n id: i1,\n name: unit.t_int_name,\n ...int1,\n },\n prefix: p1,\n ...rest,\n }),\n ]),\n ],\n );\n}\n\nfunction getProportion(age: number, interval: IntervalShort): number | null {\n /** Get proportion with the age */\n return (interval.b_age - age) / (interval.b_age - interval.t_age);\n}\n\nexport function Proportion({ value }: { value: number }) {\n let content: ReactNode | null = null;\n if (value == 0) {\n content = \"base\";\n } else if (value == 1) {\n content = \"top\";\n } else {\n content = formatProportion(value * 100) + \"%\";\n }\n\n return h(\"span.proportion\", content);\n}\n\nexport function getAgeRange(_unit) {\n let b_age = _unit.b_age;\n let t_age = _unit.t_age;\n let unit = \"Ma\";\n\n if (b_age < 0.8 && t_age < 1.2) {\n b_age *= 1000;\n t_age *= 1000;\n unit = \"ka\";\n } else if (b_age > 800 && t_age > 1200) {\n b_age /= 1000;\n t_age /= 1000;\n unit = \"Ga\";\n }\n\n return [b_age, t_age, unit];\n}\n\nexport function getAge(value) {\n /** Get the age value in Ma, ka, or Ga as appropriate */\n let unit = \"Ma\";\n if (value < 0.8) {\n unit = \"ka\";\n value *= 1000;\n if (value < 5) {\n unit = \"yr\";\n value *= 1000;\n }\n } else if (value > 1000) {\n unit = \"Ga\";\n value /= 1000;\n }\n\n return [value, unit];\n}\n"],"names":["h","DataField","formatRange","Value","useMacrostratDefs","useMemo","int0","int1","ItemList","classNames","IntervalTag","formatProportion"],"mappings":";;;;;;;;;;AAcO,SAAS,SAAS,EAAE,MAAM,UAAU,GAAG,QAAQ;AACpD,QAAM,CAAC,QAAQ,QAAQ,KAAK,IAAI,YAAY,IAAI;AAEhD,SAAOA,gBAAAA;AAAAA,IACLC,e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AAQ,MAAM;AACtC,aAAS;AACT,aAAS;AACT,WAAO;AAAA,EACT;AAEA,SAAO,CAAC,OAAO,OAAO,IAAI;AAC5B;AAEO,SAAS,OAAO,OAAO;AAE5B,MAAI,OAAO;AACX,MAAI,QAAQ,KAAK;AACf,WAAO;AACP,aAAS;AACT,QAAI,QAAQ,GAAG;AACb,aAAO;AACP,eAAS;AAAA,IACX;AAAA,EACF,WAAW,QAAQ,KAAM;AACvB,WAAO;AACP,aAAS;AAAA,EACX;AAEA,SAAO,CAAC,OAAO,IAAI;AACrB;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"age-range.cjs","sources":["../../src/unit-details/age-range.ts"],"sourcesContent":["import {\n DataField,\n IntervalProportion,\n IntervalShort,\n IntervalTag,\n type IntervalTagProps,\n ItemList,\n Value,\n} from \"@macrostrat/data-components\";\nimport { useMacrostratDefs } from \"@macrostrat/data-provider\";\nimport h from \"./age-range.module.sass\";\nimport { formatRange } from \"./utils\";\nimport classNames from \"classnames\";\nimport { useMemo } from \"react\";\n\n// The interval tag, its proportion and single-age label live in\n// `@macrostrat/data-components`; re-exported under their names here.\nexport {\n AgeLabel,\n getAge,\n IntervalProportion as Proportion,\n} from \"@macrostrat/data-components\";\n\nexport function AgeField({ unit, children, ...rest }) {\n const [_b_age, _t_age, _unit] = getAgeRange(unit);\n\n return h(\n DataField,\n {\n label: \"Age\",\n value: formatRange(_b_age, _t_age),\n unit: _unit,\n ...rest,\n },\n children,\n );\n}\n\nexport function AgeRange({\n data,\n className,\n}: {\n data: {\n t_age: number;\n b_age: number;\n };\n className?: string;\n}) {\n const [_b_age, _t_age, _unit] = getAgeRange(data);\n\n return h(Value, {\n value: formatRange(_b_age, _t_age),\n unit: _unit,\n className,\n });\n}\n\nexport function Duration({\n value,\n maximumFractionDigits = 2,\n minimumFractionDigits = 0,\n}) {\n let unit = \"Myr\";\n if (value < 0.8) {\n unit = \"kyr\";\n value *= 1000;\n if (value < 5) {\n unit = \"yr\";\n value *= 1000;\n }\n } else if (value > 1000) {\n unit = \"Gyr\";\n value /= 1000;\n }\n\n let _value = value.toLocaleString(\"en-US\", {\n maximumFractionDigits,\n minimumFractionDigits,\n });\n\n return h(Value, { value: _value, unit });\n}\n\ninterface UnitIntervalConstraints {\n b_int_id?: number;\n t_int_id?: number;\n b_prop?: number;\n t_prop?: number;\n b_int_name?: string;\n t_int_name?: string;\n b_age?: number;\n t_age?: number;\n}\n\nexport interface IntervalProportionsProps extends Omit<\n IntervalTagProps,\n \"interval\"\n> {\n unit: UnitIntervalConstraints;\n showProportions?: boolean;\n calculateProportionsFromAges?: boolean;\n onClickItem?: any;\n}\n\nexport function IntervalProportions({\n unit,\n className,\n showProportions,\n calculateProportionsFromAges = true,\n ...rest\n}: IntervalProportionsProps) {\n /** Display the proportions of the unit that belong to the base and top intervals, if they are different */\n if (unit.b_int_id == null && unit.t_int_id == null) return null;\n\n let _showProps = showProportions;\n\n const i0 = unit.b_int_id;\n const i1 = unit.t_int_id;\n\n const ints = new Set([i0, i1]);\n\n /** Get interval information */\n const intervalMap = useMacrostratDefs(\"intervals\", Array.from(ints), null);\n const [int0, int1] = useMemo(() => {\n const int0 = intervalMap?.get(i0) ?? {};\n if (i0 === i1) {\n return [int0, int0];\n }\n const int1 = intervalMap?.get(i1) ?? {};\n return [int0, int1];\n }, [intervalMap, i0, i1]);\n\n const interval0: IntervalShort = {\n id: i0,\n name: unit.b_int_name,\n ...int0,\n };\n\n let b_prop = unit.b_prop;\n let t_prop = unit.t_prop;\n\n // If we have b_age and t_age, then we can calculate proportions if they are not given\n if (b_prop == null && unit.b_age != null && calculateProportionsFromAges) {\n b_prop = getProportion(unit.b_age, int0);\n }\n if (t_prop == null && unit.t_age != null && calculateProportionsFromAges) {\n t_prop = getProportion(unit.t_age, int1);\n }\n\n // If there are no proportions given and we are not explicitly directed to show them,\n // then we set them to hidden.\n if (b_prop == null && t_prop == null) {\n _showProps ??= false;\n }\n\n /*\n Set default proportions to 0 and 1 if they are not given,\n so that we can display \"base\" and \"top\" labels\n */\n b_prop ??= 0;\n t_prop ??= 1;\n\n let p0: any = null;\n let p1: any = null;\n\n if (_showProps !== false) {\n p1 = h(IntervalProportion, { value: t_prop });\n\n if (i0 !== i1 || b_prop !== 0 || t_prop !== 1) {\n // We have a single interval with undefined proportions\n p0 = h(IntervalProportion, { value: b_prop });\n }\n\n if (i0 === i1 && (b_prop !== 0 || t_prop !== 1)) {\n p0 = h(\"span.joint-proportion\", [p0, \" \", h(\"span.sep\", \"to\"), \" \", p1]);\n }\n }\n\n return h(\n ItemList,\n { className: classNames(\"interval-proportions\", className) },\n [\n h(IntervalTag, {\n interval: interval0,\n prefix: p0,\n ...rest,\n }),\n h.if(i0 != i1)(\"span.discourage-break\", [\n h(\"span.sep\", \" to \"),\n h(IntervalTag, {\n interval: {\n id: i1,\n name: unit.t_int_name,\n ...int1,\n },\n prefix: p1,\n ...rest,\n }),\n ]),\n ],\n );\n}\n\nfunction getProportion(age: number, interval: IntervalShort): number | null {\n /** Get proportion with the age */\n return (interval.b_age - age) / (interval.b_age - interval.t_age);\n}\n\nexport function getAgeRange(_unit) {\n let b_age = _unit.b_age;\n let t_age = _unit.t_age;\n let unit = \"Ma\";\n\n if (b_age < 0.8 && t_age < 1.2) {\n b_age *= 1000;\n t_age *= 1000;\n unit = \"ka\";\n } else if (b_age > 800 && t_age > 1200) {\n b_age /= 1000;\n t_age /= 1000;\n unit = \"Ga\";\n }\n\n return [b_age, t_age, unit];\n}\n"],"names":["h","DataField","formatRange","Value","useMacrostratDefs","useMemo","int0","int1","IntervalProportion","ItemList","classNames","IntervalTag"],"mappings":";;;;;;;;;;AAuBO,SAAS,SAAS,EAAE,MAAM,UAAU,GAAG,QAAQ;AACpD,QAAM,CAAC,QAAQ,QAAQ,KAAK,IAAI,YAAY,IAAI;AAEhD,SAAOA,gBAAAA;AAAAA,IACLC,eAAAA;AAAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,OAAOC,MAAAA,YAAY,QAAQ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AAA,MAAA,CACJ;AAAA,MACDX,gBAAAA,QAAE,GAAG,MAAM,EAAE,EAAE,yBAAyB;AAAA,QACtCA,gBAAAA,QAAE,YAAY,MAAM;AAAA,QACpBA,gBAAAA,QAAEW,eAAAA,aAAa;AAAA,UACb,UAAU;AAAA,YACR,IAAI;AAAA,YACJ,MAAM,KAAK;AAAA,YACX,GAAG;AAAA,UAAA;AAAA,UAEL,QAAQ;AAAA,UACR,GAAG;AAAA,QAAA,CACJ;AAAA,MAAA,CACF;AAAA,IAAA;AAAA,EACH;AAEJ;AAEA,SAAS,cAAc,KAAa,UAAwC;AAE1E,UAAQ,SAAS,QAAQ,QAAQ,SAAS,QAAQ,SAAS;AAC7D;AAEO,SAAS,YAAY,OAAO;AACjC,MAAI,QAAQ,MAAM;AAClB,MAAI,QAAQ,MAAM;AAClB,MAAI,OAAO;AAEX,MAAI,QAAQ,OAAO,QAAQ,KAAK;AAC9B,aAAS;AACT,aAAS;AACT,WAAO;AAAA,EACT,WAAW,QAAQ,OAAO,QAAQ,MAAM;AACtC,aAAS;AACT,aAAS;AACT,WAAO;AAAA,EACT;AAEA,SAAO,CAAC,OAAO,OAAO,IAAI;AAC5B;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IntervalTagProps } from '@macrostrat/data-components';
|
|
2
|
-
|
|
2
|
+
export { AgeLabel, getAge, IntervalProportion as Proportion, } from '@macrostrat/data-components';
|
|
3
3
|
export declare function AgeField({ unit, children, ...rest }: {
|
|
4
4
|
[x: string]: any;
|
|
5
5
|
unit: any;
|
|
@@ -26,17 +26,6 @@ export declare function AgeRange({ data, className, }: {
|
|
|
26
26
|
children?: any;
|
|
27
27
|
className?: string;
|
|
28
28
|
}>;
|
|
29
|
-
export declare function AgeLabel({ age, maximumFractionDigits, minimumFractionDigits, className, }: {
|
|
30
|
-
age: number;
|
|
31
|
-
className?: string;
|
|
32
|
-
maximumFractionDigits?: number;
|
|
33
|
-
minimumFractionDigits?: number;
|
|
34
|
-
}): import('react').FunctionComponentElement<{
|
|
35
|
-
value?: any;
|
|
36
|
-
unit?: string;
|
|
37
|
-
children?: any;
|
|
38
|
-
className?: string;
|
|
39
|
-
}>;
|
|
40
29
|
export declare function Duration({ value, maximumFractionDigits, minimumFractionDigits, }: {
|
|
41
30
|
value: any;
|
|
42
31
|
maximumFractionDigits?: number | undefined;
|
|
@@ -64,12 +53,7 @@ export interface IntervalProportionsProps extends Omit<IntervalTagProps, "interv
|
|
|
64
53
|
onClickItem?: any;
|
|
65
54
|
}
|
|
66
55
|
export declare function IntervalProportions({ unit, className, showProportions, calculateProportionsFromAges, ...rest }: IntervalProportionsProps): import('react').FunctionComponentElement<{
|
|
67
|
-
children?: ReactNode;
|
|
56
|
+
children?: import('react').ReactNode;
|
|
68
57
|
className: string;
|
|
69
58
|
}> | null;
|
|
70
|
-
export declare function Proportion({ value }: {
|
|
71
|
-
value: number;
|
|
72
|
-
}): import('react').DOMElement<import('react').DOMAttributes<Element>, Element>;
|
|
73
59
|
export declare function getAgeRange(_unit: any): any[];
|
|
74
|
-
export declare function getAge(value: any): any[];
|
|
75
|
-
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { DataField, Value, ItemList, IntervalTag } from "@macrostrat/data-components";
|
|
1
|
+
import { DataField, Value, IntervalProportion, ItemList, IntervalTag } from "@macrostrat/data-components";
|
|
2
|
+
import { AgeLabel, IntervalProportion as IntervalProportion2, getAge } from "@macrostrat/data-components";
|
|
2
3
|
import { useMacrostratDefs } from "@macrostrat/data-provider";
|
|
3
4
|
import h from "./age-range.module.sass.js";
|
|
4
|
-
import { formatRange
|
|
5
|
+
import { formatRange } from "./utils.js";
|
|
5
6
|
import classNames from "classnames";
|
|
6
7
|
import { useMemo } from "react";
|
|
7
8
|
function AgeField({ unit, children, ...rest }) {
|
|
@@ -28,19 +29,6 @@ function AgeRange({
|
|
|
28
29
|
className
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
|
-
function AgeLabel({
|
|
32
|
-
age,
|
|
33
|
-
maximumFractionDigits = 2,
|
|
34
|
-
minimumFractionDigits = 0,
|
|
35
|
-
className
|
|
36
|
-
}) {
|
|
37
|
-
const [value, unit] = getAge(age);
|
|
38
|
-
const _value = value.toLocaleString("en-US", {
|
|
39
|
-
maximumFractionDigits,
|
|
40
|
-
minimumFractionDigits
|
|
41
|
-
});
|
|
42
|
-
return h(Value, { value: _value, unit, className });
|
|
43
|
-
}
|
|
44
32
|
function Duration({
|
|
45
33
|
value,
|
|
46
34
|
maximumFractionDigits = 2,
|
|
@@ -106,9 +94,9 @@ function IntervalProportions({
|
|
|
106
94
|
let p0 = null;
|
|
107
95
|
let p1 = null;
|
|
108
96
|
if (_showProps !== false) {
|
|
109
|
-
p1 = h(
|
|
97
|
+
p1 = h(IntervalProportion, { value: t_prop });
|
|
110
98
|
if (i0 !== i1 || b_prop !== 0 || t_prop !== 1) {
|
|
111
|
-
p0 = h(
|
|
99
|
+
p0 = h(IntervalProportion, { value: b_prop });
|
|
112
100
|
}
|
|
113
101
|
if (i0 === i1 && (b_prop !== 0 || t_prop !== 1)) {
|
|
114
102
|
p0 = h("span.joint-proportion", [p0, " ", h("span.sep", "to"), " ", p1]);
|
|
@@ -141,17 +129,6 @@ function IntervalProportions({
|
|
|
141
129
|
function getProportion(age, interval) {
|
|
142
130
|
return (interval.b_age - age) / (interval.b_age - interval.t_age);
|
|
143
131
|
}
|
|
144
|
-
function Proportion({ value }) {
|
|
145
|
-
let content = null;
|
|
146
|
-
if (value == 0) {
|
|
147
|
-
content = "base";
|
|
148
|
-
} else if (value == 1) {
|
|
149
|
-
content = "top";
|
|
150
|
-
} else {
|
|
151
|
-
content = formatProportion(value * 100) + "%";
|
|
152
|
-
}
|
|
153
|
-
return h("span.proportion", content);
|
|
154
|
-
}
|
|
155
132
|
function getAgeRange(_unit) {
|
|
156
133
|
let b_age = _unit.b_age;
|
|
157
134
|
let t_age = _unit.t_age;
|
|
@@ -167,28 +144,13 @@ function getAgeRange(_unit) {
|
|
|
167
144
|
}
|
|
168
145
|
return [b_age, t_age, unit];
|
|
169
146
|
}
|
|
170
|
-
function getAge(value) {
|
|
171
|
-
let unit = "Ma";
|
|
172
|
-
if (value < 0.8) {
|
|
173
|
-
unit = "ka";
|
|
174
|
-
value *= 1e3;
|
|
175
|
-
if (value < 5) {
|
|
176
|
-
unit = "yr";
|
|
177
|
-
value *= 1e3;
|
|
178
|
-
}
|
|
179
|
-
} else if (value > 1e3) {
|
|
180
|
-
unit = "Ga";
|
|
181
|
-
value /= 1e3;
|
|
182
|
-
}
|
|
183
|
-
return [value, unit];
|
|
184
|
-
}
|
|
185
147
|
export {
|
|
186
148
|
AgeField,
|
|
187
149
|
AgeLabel,
|
|
188
150
|
AgeRange,
|
|
189
151
|
Duration,
|
|
190
152
|
IntervalProportions,
|
|
191
|
-
Proportion,
|
|
153
|
+
IntervalProportion2 as Proportion,
|
|
192
154
|
getAge,
|
|
193
155
|
getAgeRange
|
|
194
156
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"age-range.js","sources":["../../src/unit-details/age-range.ts"],"sourcesContent":["import {\n DataField,\n IntervalShort,\n IntervalTag,\n type IntervalTagProps,\n ItemList,\n Value,\n} from \"@macrostrat/data-components\";\nimport { useMacrostratDefs } from \"@macrostrat/data-provider\";\nimport h from \"./age-range.module.sass\";\nimport {
|
|
1
|
+
{"version":3,"file":"age-range.js","sources":["../../src/unit-details/age-range.ts"],"sourcesContent":["import {\n DataField,\n IntervalProportion,\n IntervalShort,\n IntervalTag,\n type IntervalTagProps,\n ItemList,\n Value,\n} from \"@macrostrat/data-components\";\nimport { useMacrostratDefs } from \"@macrostrat/data-provider\";\nimport h from \"./age-range.module.sass\";\nimport { formatRange } from \"./utils\";\nimport classNames from \"classnames\";\nimport { useMemo } from \"react\";\n\n// The interval tag, its proportion and single-age label live in\n// `@macrostrat/data-components`; re-exported under their names here.\nexport {\n AgeLabel,\n getAge,\n IntervalProportion as Proportion,\n} from \"@macrostrat/data-components\";\n\nexport function AgeField({ unit, children, ...rest }) {\n const [_b_age, _t_age, _unit] = getAgeRange(unit);\n\n return h(\n DataField,\n {\n label: \"Age\",\n value: formatRange(_b_age, _t_age),\n unit: _unit,\n ...rest,\n },\n children,\n );\n}\n\nexport function AgeRange({\n data,\n className,\n}: {\n data: {\n t_age: number;\n b_age: number;\n };\n className?: string;\n}) {\n const [_b_age, _t_age, _unit] = getAgeRange(data);\n\n return h(Value, {\n value: formatRange(_b_age, _t_age),\n unit: _unit,\n className,\n });\n}\n\nexport function Duration({\n value,\n maximumFractionDigits = 2,\n minimumFractionDigits = 0,\n}) {\n let unit = \"Myr\";\n if (value < 0.8) {\n unit = \"kyr\";\n value *= 1000;\n if (value < 5) {\n unit = \"yr\";\n value *= 1000;\n }\n } else if (value > 1000) {\n unit = \"Gyr\";\n value /= 1000;\n }\n\n let _value = value.toLocaleString(\"en-US\", {\n maximumFractionDigits,\n minimumFractionDigits,\n });\n\n return h(Value, { value: _value, unit });\n}\n\ninterface UnitIntervalConstraints {\n b_int_id?: number;\n t_int_id?: number;\n b_prop?: number;\n t_prop?: number;\n b_int_name?: string;\n t_int_name?: string;\n b_age?: number;\n t_age?: number;\n}\n\nexport interface IntervalProportionsProps extends Omit<\n IntervalTagProps,\n \"interval\"\n> {\n unit: UnitIntervalConstraints;\n showProportions?: boolean;\n calculateProportionsFromAges?: boolean;\n onClickItem?: any;\n}\n\nexport function IntervalProportions({\n unit,\n className,\n showProportions,\n calculateProportionsFromAges = true,\n ...rest\n}: IntervalProportionsProps) {\n /** Display the proportions of the unit that belong to the base and top intervals, if they are different */\n if (unit.b_int_id == null && unit.t_int_id == null) return null;\n\n let _showProps = showProportions;\n\n const i0 = unit.b_int_id;\n const i1 = unit.t_int_id;\n\n const ints = new Set([i0, i1]);\n\n /** Get interval information */\n const intervalMap = useMacrostratDefs(\"intervals\", Array.from(ints), null);\n const [int0, int1] = useMemo(() => {\n const int0 = intervalMap?.get(i0) ?? {};\n if (i0 === i1) {\n return [int0, int0];\n }\n const int1 = intervalMap?.get(i1) ?? {};\n return [int0, int1];\n }, [intervalMap, i0, i1]);\n\n const interval0: IntervalShort = {\n id: i0,\n name: unit.b_int_name,\n ...int0,\n };\n\n let b_prop = unit.b_prop;\n let t_prop = unit.t_prop;\n\n // If we have b_age and t_age, then we can calculate proportions if they are not given\n if (b_prop == null && unit.b_age != null && calculateProportionsFromAges) {\n b_prop = getProportion(unit.b_age, int0);\n }\n if (t_prop == null && unit.t_age != null && calculateProportionsFromAges) {\n t_prop = getProportion(unit.t_age, int1);\n }\n\n // If there are no proportions given and we are not explicitly directed to show them,\n // then we set them to hidden.\n if (b_prop == null && t_prop == null) {\n _showProps ??= false;\n }\n\n /*\n Set default proportions to 0 and 1 if they are not given,\n so that we can display \"base\" and \"top\" labels\n */\n b_prop ??= 0;\n t_prop ??= 1;\n\n let p0: any = null;\n let p1: any = null;\n\n if (_showProps !== false) {\n p1 = h(IntervalProportion, { value: t_prop });\n\n if (i0 !== i1 || b_prop !== 0 || t_prop !== 1) {\n // We have a single interval with undefined proportions\n p0 = h(IntervalProportion, { value: b_prop });\n }\n\n if (i0 === i1 && (b_prop !== 0 || t_prop !== 1)) {\n p0 = h(\"span.joint-proportion\", [p0, \" \", h(\"span.sep\", \"to\"), \" \", p1]);\n }\n }\n\n return h(\n ItemList,\n { className: classNames(\"interval-proportions\", className) },\n [\n h(IntervalTag, {\n interval: interval0,\n prefix: p0,\n ...rest,\n }),\n h.if(i0 != i1)(\"span.discourage-break\", [\n h(\"span.sep\", \" to \"),\n h(IntervalTag, {\n interval: {\n id: i1,\n name: unit.t_int_name,\n ...int1,\n },\n prefix: p1,\n ...rest,\n }),\n ]),\n ],\n );\n}\n\nfunction getProportion(age: number, interval: IntervalShort): number | null {\n /** Get proportion with the age */\n return (interval.b_age - age) / (interval.b_age - interval.t_age);\n}\n\nexport function getAgeRange(_unit) {\n let b_age = _unit.b_age;\n let t_age = _unit.t_age;\n let unit = \"Ma\";\n\n if (b_age < 0.8 && t_age < 1.2) {\n b_age *= 1000;\n t_age *= 1000;\n unit = \"ka\";\n } else if (b_age > 800 && t_age > 1200) {\n b_age /= 1000;\n t_age /= 1000;\n unit = \"Ga\";\n }\n\n return [b_age, t_age, unit];\n}\n"],"names":["int0","int1"],"mappings":";;;;;;;AAuBO,SAAS,SAAS,EAAE,MAAM,UAAU,GAAG,QAAQ;AACpD,QAAM,CAAC,QAAQ,QAAQ,KAAK,IAAI,YAAY,IAAI;AAEhD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,OAAO,YAAY,QAAQ,MAAM;AAAA,MACjC,MAAM;AAAA,MACN,GAAG;AAAA,IAAA;AAAA,IAEL;AAAA,EAAA;AAEJ;AAEO,SAAS,SAAS;AAAA,EACvB;AAAA,EACA;AACF,GAMG;AACD,QAAM,CAAC,QAAQ,QAAQ,KAAK,IAAI,YAAY,IAAI;AAEhD,SAAO,EAAE,OAAO;AAAA,IACd,OAAO,YAAY,QAAQ,MAAM;AAAA,IACjC,MAAM;AAAA,IACN;AAAA,EAAA,CACD;AACH;AAEO,SAAS,SAAS;AAAA,EACvB;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAC1B,GAAG;AACD,MAAI,OAAO;AACX,MAAI,QAAQ,KAAK;AACf,WAAO;AACP,aAAS;AACT,QAAI,QAAQ,GAAG;AACb,aAAO;AACP,eAAS;AAAA,IACX;AAAA,EACF,WAAW,QAAQ,KAAM;AACvB,WAAO;AACP,aAAS;AAAA,EACX;AAEA,MAAI,SAAS,MAAM,eAAe,SAAS;AAAA,IACzC;AAAA,IACA;AAAA,EAAA,CACD;AAED,SAAO,EAAE,OAAO,EAAE,OAAO,QAAQ,MAAM;AACzC;AAuBO,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA,+BAA+B;AAAA,EAC/B,GAAG;AACL,GAA6B;AAE3B,MAAI,K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yBAAyB,CAAC,IAAI,KAAK,EAAE,YAAY,IAAI,GAAG,KAAK,EAAE,CAAC;AAAA,IACzE;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA,EAAE,WAAW,WAAW,wBAAwB,SAAS,EAAA;AAAA,IACzD;AAAA,MACE,EAAE,aAAa;AAAA,QACb,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,GAAG;AAAA,MAAA,CACJ;AAAA,MACD,EAAE,GAAG,MAAM,EAAE,EAAE,yBAAyB;AAAA,QACtC,EAAE,YAAY,MAAM;AAAA,QACpB,EAAE,aAAa;AAAA,UACb,UAAU;AAAA,YACR,IAAI;AAAA,YACJ,MAAM,KAAK;AAAA,YACX,GAAG;AAAA,UAAA;AAAA,UAEL,QAAQ;AAAA,UACR,GAAG;AAAA,QAAA,CACJ;AAAA,MAAA,CACF;AAAA,IAAA;AAAA,EACH;AAEJ;AAEA,SAAS,cAAc,KAAa,UAAwC;AAE1E,UAAQ,SAAS,QAAQ,QAAQ,SAAS,QAAQ,SAAS;AAC7D;AAEO,SAAS,YAAY,OAAO;AACjC,MAAI,QAAQ,MAAM;AAClB,MAAI,QAAQ,MAAM;AAClB,MAAI,OAAO;AAEX,MAAI,QAAQ,OAAO,QAAQ,KAAK;AAC9B,aAAS;AACT,aAAS;AACT,WAAO;AAAA,EACT,WAAW,QAAQ,OAAO,QAAQ,MAAM;AACtC,aAAS;AACT,aAAS;AACT,WAAO;AAAA,EACT;AAEA,SAAO,CAAC,OAAO,OAAO,IAAI;AAC5B;"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const formatProportion = (d) => {
|
|
4
|
-
if (d == null) return null;
|
|
5
|
-
return d.toFixed(1);
|
|
6
|
-
};
|
|
7
3
|
function formatRange(min, max, precision = null) {
|
|
8
4
|
if (min == null || max == null) return null;
|
|
9
5
|
if (min === max) {
|
|
@@ -25,7 +21,6 @@ function formatSignificance(value, precision = null) {
|
|
|
25
21
|
return (value / Math.pow(10, -precision)).toFixed(0) + "0".repeat(-precision);
|
|
26
22
|
}
|
|
27
23
|
}
|
|
28
|
-
exports.formatProportion = formatProportion;
|
|
29
24
|
exports.formatRange = formatRange;
|
|
30
25
|
exports.formatSignificance = formatSignificance;
|
|
31
26
|
//# sourceMappingURL=utils.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","sources":["../../src/unit-details/utils.ts"],"sourcesContent":["export const formatProportion = (d) => {\n if (d == null) return null;\n return d.toFixed(1);\n};\n\nexport function formatRange(min, max, precision = null) {\n if (min == null || max == null) return null;\n if (min === max) {\n return min.toFixed(precision);\n }\n\n return `${formatSignificance(min, precision)}–${formatSignificance(\n max,\n precision,\n )}`;\n}\n\nexport function formatSignificance(value, precision = null) {\n // Format to preserve a reasonable number of significant figures\n // this could be done with an easier algorithm, probably:\n\n if (precision == null) {\n return value.toLocaleString();\n }\n if (precision >= 0) {\n return value.toFixed(precision);\n }\n if (precision < 0) {\n return (\n (value / Math.pow(10, -precision)).toFixed(0) + \"0\".repeat(-precision)\n );\n }\n}\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":["../../src/unit-details/utils.ts"],"sourcesContent":["export const formatProportion = (d) => {\n if (d == null) return null;\n return d.toFixed(1);\n};\n\nexport function formatRange(min, max, precision = null) {\n if (min == null || max == null) return null;\n if (min === max) {\n return min.toFixed(precision);\n }\n\n return `${formatSignificance(min, precision)}–${formatSignificance(\n max,\n precision,\n )}`;\n}\n\nexport function formatSignificance(value, precision = null) {\n // Format to preserve a reasonable number of significant figures\n // this could be done with an easier algorithm, probably:\n\n if (precision == null) {\n return value.toLocaleString();\n }\n if (precision >= 0) {\n return value.toFixed(precision);\n }\n if (precision < 0) {\n return (\n (value / Math.pow(10, -precision)).toFixed(0) + \"0\".repeat(-precision)\n );\n }\n}\n"],"names":[],"mappings":";;AAKO,SAAS,YAAY,KAAK,KAAK,YAAY,MAAM;AACtD,MAAI,OAAO,QAAQ,OAAO,KAAM,QAAO;AACvC,MAAI,QAAQ,KAAK;AACf,WAAO,IAAI,QAAQ,SAAS;AAAA,EAC9B;AAEA,SAAO,GAAG,mBAAmB,KAAK,SAAS,CAAC,IAAI;AAAA,IAC9C;AAAA,IACA;AAAA,EAAA,CACD;AACH;AAEO,SAAS,mBAAmB,OAAO,YAAY,MAAM;AAI1D,MAAI,aAAa,MAAM;AACrB,WAAO,MAAM,eAAA;AAAA,EACf;AACA,MAAI,aAAa,GAAG;AAClB,WAAO,MAAM,QAAQ,SAAS;AAAA,EAChC;AACA,MAAI,YAAY,GAAG;AACjB,YACG,QAAQ,KAAK,IAAI,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,SAAS;AAAA,EAEzE;AACF;;;"}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
const formatProportion = (d) => {
|
|
2
|
-
if (d == null) return null;
|
|
3
|
-
return d.toFixed(1);
|
|
4
|
-
};
|
|
5
1
|
function formatRange(min, max, precision = null) {
|
|
6
2
|
if (min == null || max == null) return null;
|
|
7
3
|
if (min === max) {
|
|
@@ -24,7 +20,6 @@ function formatSignificance(value, precision = null) {
|
|
|
24
20
|
}
|
|
25
21
|
}
|
|
26
22
|
export {
|
|
27
|
-
formatProportion,
|
|
28
23
|
formatRange,
|
|
29
24
|
formatSignificance
|
|
30
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/unit-details/utils.ts"],"sourcesContent":["export const formatProportion = (d) => {\n if (d == null) return null;\n return d.toFixed(1);\n};\n\nexport function formatRange(min, max, precision = null) {\n if (min == null || max == null) return null;\n if (min === max) {\n return min.toFixed(precision);\n }\n\n return `${formatSignificance(min, precision)}–${formatSignificance(\n max,\n precision,\n )}`;\n}\n\nexport function formatSignificance(value, precision = null) {\n // Format to preserve a reasonable number of significant figures\n // this could be done with an easier algorithm, probably:\n\n if (precision == null) {\n return value.toLocaleString();\n }\n if (precision >= 0) {\n return value.toFixed(precision);\n }\n if (precision < 0) {\n return (\n (value / Math.pow(10, -precision)).toFixed(0) + \"0\".repeat(-precision)\n );\n }\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/unit-details/utils.ts"],"sourcesContent":["export const formatProportion = (d) => {\n if (d == null) return null;\n return d.toFixed(1);\n};\n\nexport function formatRange(min, max, precision = null) {\n if (min == null || max == null) return null;\n if (min === max) {\n return min.toFixed(precision);\n }\n\n return `${formatSignificance(min, precision)}–${formatSignificance(\n max,\n precision,\n )}`;\n}\n\nexport function formatSignificance(value, precision = null) {\n // Format to preserve a reasonable number of significant figures\n // this could be done with an easier algorithm, probably:\n\n if (precision == null) {\n return value.toLocaleString();\n }\n if (precision >= 0) {\n return value.toFixed(precision);\n }\n if (precision < 0) {\n return (\n (value / Math.pow(10, -precision)).toFixed(0) + \"0\".repeat(-precision)\n );\n }\n}\n"],"names":[],"mappings":"AAKO,SAAS,YAAY,KAAK,KAAK,YAAY,MAAM;AACtD,MAAI,OAAO,QAAQ,OAAO,KAAM,QAAO;AACvC,MAAI,QAAQ,KAAK;AACf,WAAO,IAAI,QAAQ,SAAS;AAAA,EAC9B;AAEA,SAAO,GAAG,mBAAmB,KAAK,SAAS,CAAC,IAAI;AAAA,IAC9C;AAAA,IACA;AAAA,EAAA,CACD;AACH;AAEO,SAAS,mBAAmB,OAAO,YAAY,MAAM;AAI1D,MAAI,aAAa,MAAM;AACrB,WAAO,MAAM,eAAA;AAAA,EACf;AACA,MAAI,aAAa,GAAG;AAClB,WAAO,MAAM,QAAQ,SAAS;AAAA,EAChC;AACA,MAAI,YAAY,GAAG;AACjB,YACG,QAAQ,KAAK,IAAI,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,SAAS;AAAA,EAEzE;AACF;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@macrostrat/column-views",
|
|
3
|
-
"version": "3.12.
|
|
3
|
+
"version": "3.12.1",
|
|
4
4
|
"description": "Data views for Macrostrat stratigraphic columns",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"@macrostrat/api-types": "^1.4.0",
|
|
50
50
|
"@macrostrat/color-utils": "^1.2.2",
|
|
51
51
|
"@macrostrat/column-components": "^2.2.0",
|
|
52
|
-
"@macrostrat/data-components": "^1.
|
|
53
|
-
"@macrostrat/data-provider": "^1.
|
|
52
|
+
"@macrostrat/data-components": "^1.7.0",
|
|
53
|
+
"@macrostrat/data-provider": "^1.4.0",
|
|
54
54
|
"@macrostrat/hyper": "^3.1.1",
|
|
55
55
|
"@macrostrat/map-views": "^1.1.1",
|
|
56
56
|
"@macrostrat/scoped-store": "^1.1.0",
|
package/src/age-model/details.ts
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import { useMacrostratDefs } from "@macrostrat/data-provider";
|
|
16
16
|
import type { UnitLong } from "@macrostrat/api-types";
|
|
17
17
|
import { useColumnUnitsMap } from "../data-provider";
|
|
18
|
-
import { AgeLabel
|
|
18
|
+
import { AgeLabel } from "../unit-details/age-range";
|
|
19
19
|
import { formatRange } from "../unit-details/utils";
|
|
20
20
|
import { ReferencesField } from "../unit-details/panel";
|
|
21
21
|
import { surfaceClasses } from "./surfaces";
|
|
@@ -187,7 +187,7 @@ function SurfaceCalibrationField({ surface }: { surface: ColumnSurface }) {
|
|
|
187
187
|
"div.calibration-interval",
|
|
188
188
|
h(IntervalTag, {
|
|
189
189
|
interval,
|
|
190
|
-
|
|
190
|
+
proportion,
|
|
191
191
|
}),
|
|
192
192
|
),
|
|
193
193
|
]);
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
useMacrostratColumnData,
|
|
31
31
|
} from "../data-provider";
|
|
32
32
|
import { ColumnNotes } from "../notes";
|
|
33
|
-
import { AgeLabel
|
|
33
|
+
import { AgeLabel } from "../unit-details/age-range";
|
|
34
34
|
import columnStyles from "../column.module.sass";
|
|
35
35
|
import styles from "./surfaces.module.sass";
|
|
36
36
|
import {
|
|
@@ -351,7 +351,7 @@ function SurfaceNoteLabel({ note }: { note: SurfaceNote }) {
|
|
|
351
351
|
primary = h(IntervalTag, {
|
|
352
352
|
interval,
|
|
353
353
|
size: TagSize.Small,
|
|
354
|
-
|
|
354
|
+
proportion: surface.proportion,
|
|
355
355
|
className: "surface-interval-tag",
|
|
356
356
|
});
|
|
357
357
|
} else {
|