@macrostrat/column-views 3.11.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 +184 -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/data.cjs +57 -0
- package/dist/age-model/data.cjs.map +1 -0
- package/dist/age-model/data.d.ts +29 -0
- package/dist/age-model/data.js +57 -0
- package/dist/age-model/data.js.map +1 -0
- package/dist/age-model/details.cjs +260 -0
- package/dist/age-model/details.cjs.map +1 -0
- package/dist/age-model/details.d.ts +39 -0
- package/dist/age-model/details.js +257 -0
- package/dist/age-model/details.js.map +1 -0
- package/dist/age-model/details.module.sass.cjs +42 -0
- package/dist/age-model/details.module.sass.cjs.map +1 -0
- package/dist/age-model/details.module.sass.js +40 -0
- package/dist/age-model/details.module.sass.js.map +1 -0
- package/dist/age-model/index.d.ts +5 -0
- package/dist/age-model/legacy.cjs +28 -0
- package/dist/age-model/legacy.cjs.map +1 -0
- package/dist/age-model/legacy.d.ts +6 -0
- package/dist/age-model/legacy.js +26 -0
- package/dist/age-model/legacy.js.map +1 -0
- package/dist/age-model/surfaces.cjs +354 -0
- package/dist/age-model/surfaces.cjs.map +1 -0
- package/dist/age-model/surfaces.d.ts +68 -0
- package/dist/age-model/surfaces.js +351 -0
- package/dist/age-model/surfaces.js.map +1 -0
- package/dist/age-model/surfaces.module.sass.cjs +45 -0
- package/dist/age-model/surfaces.module.sass.cjs.map +1 -0
- package/dist/age-model/surfaces.module.sass.js +43 -0
- package/dist/age-model/surfaces.module.sass.js.map +1 -0
- package/dist/age-model/types.cjs +229 -0
- package/dist/age-model/types.cjs.map +1 -0
- package/dist/age-model/types.d.ts +112 -0
- package/dist/age-model/types.js +229 -0
- package/dist/age-model/types.js.map +1 -0
- package/dist/column-views.css +406 -74
- package/dist/column.cjs +20 -13
- package/dist/column.cjs.map +1 -1
- package/dist/column.d.ts +21 -6
- package/dist/column.js +21 -14
- package/dist/column.js.map +1 -1
- package/dist/column.module.sass.cjs +19 -15
- package/dist/column.module.sass.cjs.map +1 -1
- package/dist/column.module.sass.js +19 -15
- package/dist/column.module.sass.js.map +1 -1
- package/dist/data-provider/store.cjs +34 -1
- package/dist/data-provider/store.cjs.map +1 -1
- package/dist/data-provider/store.d.ts +5 -0
- package/dist/data-provider/store.js +35 -2
- package/dist/data-provider/store.js.map +1 -1
- package/dist/index.cjs +78 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +55 -4
- package/dist/index.js.map +1 -1
- package/dist/notes.cjs +11 -2
- package/dist/notes.cjs.map +1 -1
- package/dist/notes.d.ts +11 -1
- package/dist/notes.js +11 -2
- package/dist/notes.js.map +1 -1
- package/dist/prepare-units/composite-scale.cjs +18 -16
- package/dist/prepare-units/composite-scale.cjs.map +1 -1
- package/dist/prepare-units/composite-scale.js +18 -16
- package/dist/prepare-units/composite-scale.js.map +1 -1
- package/dist/prepare-units/density.cjs +83 -0
- package/dist/prepare-units/density.cjs.map +1 -0
- package/dist/prepare-units/density.d.ts +92 -0
- package/dist/prepare-units/density.js +83 -0
- package/dist/prepare-units/density.js.map +1 -0
- package/dist/prepare-units/index.cjs +15 -7
- package/dist/prepare-units/index.cjs.map +1 -1
- package/dist/prepare-units/index.d.ts +1 -0
- package/dist/prepare-units/index.js +15 -7
- package/dist/prepare-units/index.js.map +1 -1
- package/dist/prepare-units/types.cjs.map +1 -1
- package/dist/prepare-units/types.d.ts +34 -13
- package/dist/prepare-units/types.js.map +1 -1
- package/dist/section.cjs +108 -24
- package/dist/section.cjs.map +1 -1
- package/dist/section.d.ts +66 -6
- package/dist/section.js +109 -25
- package/dist/section.js.map +1 -1
- package/dist/timescale-zoom.cjs +191 -0
- package/dist/timescale-zoom.cjs.map +1 -0
- package/dist/timescale-zoom.d.ts +74 -0
- package/dist/timescale-zoom.js +191 -0
- package/dist/timescale-zoom.js.map +1 -0
- package/dist/unit-details/age-range.cjs +14 -43
- package/dist/unit-details/age-range.cjs.map +1 -1
- package/dist/unit-details/age-range.d.ts +1 -13
- package/dist/unit-details/age-range.js +6 -43
- 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/dist/units/composite.cjs +4 -1
- package/dist/units/composite.cjs.map +1 -1
- package/dist/units/composite.d.ts +2 -0
- package/dist/units/composite.js +4 -1
- package/dist/units/composite.js.map +1 -1
- package/package.json +8 -8
- package/src/age-model/data.ts +98 -0
- package/src/age-model/details.module.sass +108 -0
- package/src/age-model/details.ts +333 -0
- package/src/age-model/index.ts +5 -0
- package/src/age-model/legacy.ts +30 -0
- package/src/age-model/surfaces.module.sass +168 -0
- package/src/age-model/surfaces.ts +568 -0
- package/src/age-model/types.ts +392 -0
- package/src/column.module.sass +59 -8
- package/src/column.ts +49 -23
- package/src/data-provider/store.ts +50 -1
- package/src/index.ts +5 -1
- package/src/notes.ts +20 -2
- package/src/prepare-units/composite-scale.ts +34 -31
- package/src/prepare-units/density.ts +197 -0
- package/src/prepare-units/index.ts +25 -6
- package/src/prepare-units/types.ts +34 -13
- package/src/section.ts +219 -33
- package/src/timescale-zoom.ts +341 -0
- package/src/unit-details/age-range.ts +12 -58
- package/src/units/composite.ts +11 -0
- package/dist/age-model-overlay.cjs +0 -50
- package/dist/age-model-overlay.cjs.map +0 -1
- package/dist/age-model-overlay.d.ts +0 -24
- package/dist/age-model-overlay.js +0 -48
- package/dist/age-model-overlay.js.map +0 -1
- package/dist/age-model-overlay.module.sass.cjs +0 -12
- package/dist/age-model-overlay.module.sass.cjs.map +0 -1
- package/dist/age-model-overlay.module.sass.js +0 -11
- package/dist/age-model-overlay.module.sass.js.map +0 -1
- package/src/age-model-overlay.module.sass +0 -11
- package/src/age-model-overlay.ts +0 -96
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DataField,
|
|
3
|
+
IntervalProportion,
|
|
3
4
|
IntervalShort,
|
|
4
5
|
IntervalTag,
|
|
5
6
|
type IntervalTagProps,
|
|
@@ -8,10 +9,18 @@ import {
|
|
|
8
9
|
} from "@macrostrat/data-components";
|
|
9
10
|
import { useMacrostratDefs } from "@macrostrat/data-provider";
|
|
10
11
|
import h from "./age-range.module.sass";
|
|
11
|
-
import {
|
|
12
|
+
import { formatRange } from "./utils";
|
|
12
13
|
import classNames from "classnames";
|
|
13
14
|
import { useMemo } from "react";
|
|
14
15
|
|
|
16
|
+
// The interval tag, its proportion and single-age label live in
|
|
17
|
+
// `@macrostrat/data-components`; re-exported under their names here.
|
|
18
|
+
export {
|
|
19
|
+
AgeLabel,
|
|
20
|
+
getAge,
|
|
21
|
+
IntervalProportion as Proportion,
|
|
22
|
+
} from "@macrostrat/data-components";
|
|
23
|
+
|
|
15
24
|
export function AgeField({ unit, children, ...rest }) {
|
|
16
25
|
const [_b_age, _t_age, _unit] = getAgeRange(unit);
|
|
17
26
|
|
|
@@ -46,30 +55,6 @@ export function AgeRange({
|
|
|
46
55
|
});
|
|
47
56
|
}
|
|
48
57
|
|
|
49
|
-
export function AgeLabel({
|
|
50
|
-
age,
|
|
51
|
-
maximumFractionDigits = 2,
|
|
52
|
-
minimumFractionDigits = 0,
|
|
53
|
-
className,
|
|
54
|
-
}: {
|
|
55
|
-
age: number;
|
|
56
|
-
className?: string;
|
|
57
|
-
maximumFractionDigits?: number;
|
|
58
|
-
minimumFractionDigits?: number;
|
|
59
|
-
}) {
|
|
60
|
-
/** Component to display a single age value with unit conversion from
|
|
61
|
-
* Ma to ka or Ga as appropriate.
|
|
62
|
-
*/
|
|
63
|
-
const [value, unit] = getAge(age);
|
|
64
|
-
|
|
65
|
-
const _value = value.toLocaleString("en-US", {
|
|
66
|
-
maximumFractionDigits,
|
|
67
|
-
minimumFractionDigits,
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
return h(Value, { value: _value, unit, className });
|
|
71
|
-
}
|
|
72
|
-
|
|
73
58
|
export function Duration({
|
|
74
59
|
value,
|
|
75
60
|
maximumFractionDigits = 2,
|
|
@@ -179,11 +164,11 @@ export function IntervalProportions({
|
|
|
179
164
|
let p1: any = null;
|
|
180
165
|
|
|
181
166
|
if (_showProps !== false) {
|
|
182
|
-
p1 = h(
|
|
167
|
+
p1 = h(IntervalProportion, { value: t_prop });
|
|
183
168
|
|
|
184
169
|
if (i0 !== i1 || b_prop !== 0 || t_prop !== 1) {
|
|
185
170
|
// We have a single interval with undefined proportions
|
|
186
|
-
p0 = h(
|
|
171
|
+
p0 = h(IntervalProportion, { value: b_prop });
|
|
187
172
|
}
|
|
188
173
|
|
|
189
174
|
if (i0 === i1 && (b_prop !== 0 || t_prop !== 1)) {
|
|
@@ -221,19 +206,6 @@ function getProportion(age: number, interval: IntervalShort): number | null {
|
|
|
221
206
|
return (interval.b_age - age) / (interval.b_age - interval.t_age);
|
|
222
207
|
}
|
|
223
208
|
|
|
224
|
-
function Proportion({ value }) {
|
|
225
|
-
let content = null;
|
|
226
|
-
if (value == 0) {
|
|
227
|
-
content = "base";
|
|
228
|
-
} else if (value == 1) {
|
|
229
|
-
content = "top";
|
|
230
|
-
} else {
|
|
231
|
-
content = formatProportion(value * 100) + "%";
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return h("span.proportion", content);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
209
|
export function getAgeRange(_unit) {
|
|
238
210
|
let b_age = _unit.b_age;
|
|
239
211
|
let t_age = _unit.t_age;
|
|
@@ -251,21 +223,3 @@ export function getAgeRange(_unit) {
|
|
|
251
223
|
|
|
252
224
|
return [b_age, t_age, unit];
|
|
253
225
|
}
|
|
254
|
-
|
|
255
|
-
export function getAge(value) {
|
|
256
|
-
/** Get the age value in Ma, ka, or Ga as appropriate */
|
|
257
|
-
let unit = "Ma";
|
|
258
|
-
if (value < 0.8) {
|
|
259
|
-
unit = "ka";
|
|
260
|
-
value *= 1000;
|
|
261
|
-
if (value < 5) {
|
|
262
|
-
unit = "yr";
|
|
263
|
-
value *= 1000;
|
|
264
|
-
}
|
|
265
|
-
} else if (value > 1000) {
|
|
266
|
-
unit = "Ga";
|
|
267
|
-
value /= 1000;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
return [value, unit];
|
|
271
|
-
}
|
package/src/units/composite.ts
CHANGED
|
@@ -118,6 +118,8 @@ type ICompositeUnitProps = BaseUnitProps & {
|
|
|
118
118
|
showLabelColumn?: boolean;
|
|
119
119
|
noteComponent?: React.FC<any>;
|
|
120
120
|
shouldRenderNote?: (d: any) => boolean;
|
|
121
|
+
/** Suppress the label for a unit drawn thinner than this many pixels */
|
|
122
|
+
labelSuppressHeight?: number;
|
|
121
123
|
};
|
|
122
124
|
|
|
123
125
|
interface CompositeUnitProps {
|
|
@@ -159,6 +161,13 @@ export function AnnotatedUnitsColumn(props: ICompositeUnitProps) {
|
|
|
159
161
|
return null;
|
|
160
162
|
}
|
|
161
163
|
|
|
164
|
+
/** A unit drawn thinner than this gets no label. The notes column can place
|
|
165
|
+
* a label away from its unit and run a leader line back, so a thin unit is
|
|
166
|
+
* labelable in principle — but below a pixel or two there is nothing on the
|
|
167
|
+
* page to lead back to, and a dense column spends its labels on units the
|
|
168
|
+
* reader cannot see. */
|
|
169
|
+
const DEFAULT_LABEL_SUPPRESS_HEIGHT = 2;
|
|
170
|
+
|
|
162
171
|
export function SectionLabelsColumn(props: ICompositeUnitProps) {
|
|
163
172
|
// Section with "squishy" time scale
|
|
164
173
|
const {
|
|
@@ -167,6 +176,7 @@ export function SectionLabelsColumn(props: ICompositeUnitProps) {
|
|
|
167
176
|
labelOffset = 30,
|
|
168
177
|
noteComponent,
|
|
169
178
|
shouldRenderNote,
|
|
179
|
+
labelSuppressHeight = DEFAULT_LABEL_SUPPRESS_HEIGHT,
|
|
170
180
|
} = props;
|
|
171
181
|
|
|
172
182
|
const { totalHeight, axisType } = useMacrostratColumnData();
|
|
@@ -198,6 +208,7 @@ export function SectionLabelsColumn(props: ICompositeUnitProps) {
|
|
|
198
208
|
divisions: unitsToLabel,
|
|
199
209
|
paddingLeft: labelOffset,
|
|
200
210
|
width,
|
|
211
|
+
minimumHeight: labelSuppressHeight,
|
|
201
212
|
noteComponent,
|
|
202
213
|
shouldRenderNote,
|
|
203
214
|
scale: _compositeScale,
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const h$1 = require("@macrostrat/hyper");
|
|
4
|
-
const ageModelOverlay_module = require("./age-model-overlay.module.sass.cjs");
|
|
5
|
-
const uiComponents = require("@macrostrat/ui-components");
|
|
6
|
-
const dynamicScales = require("./prepare-units/dynamic-scales.cjs");
|
|
7
|
-
const store = require("./data-provider/store.cjs");
|
|
8
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
9
|
-
const h__default = /* @__PURE__ */ _interopDefault(h$1);
|
|
10
|
-
const h = h__default.default.styled(ageModelOverlay_module);
|
|
11
|
-
function BoundaryAgeModelOverlay() {
|
|
12
|
-
const col_id = store.useMacrostratUnits()?.[0]?.col_id;
|
|
13
|
-
const scale = store.useCompositeScale();
|
|
14
|
-
const ageModel = uiComponents.useAPIResult(
|
|
15
|
-
"https://dev.macrostrat.org/api/v2/age_model",
|
|
16
|
-
{ col_id },
|
|
17
|
-
(res) => res.success.data
|
|
18
|
-
);
|
|
19
|
-
if (ageModel == null) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
return h(
|
|
23
|
-
"div.boundary-age-model",
|
|
24
|
-
ageModel.map((surface) => {
|
|
25
|
-
const height = scale(surface.model_age);
|
|
26
|
-
return h("div.boundary-age-model-surface", {
|
|
27
|
-
key: surface.boundary_id,
|
|
28
|
-
style: { top: `${height}px` }
|
|
29
|
-
});
|
|
30
|
-
})
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
function ComputedSurfacesOverlay() {
|
|
34
|
-
const units = store.useMacrostratUnits();
|
|
35
|
-
const surfaces = dynamicScales.buildColumnSurfaces(units);
|
|
36
|
-
const scale = store.useCompositeScale();
|
|
37
|
-
return h(
|
|
38
|
-
"div.boundary-age-model",
|
|
39
|
-
surfaces.map((surface) => {
|
|
40
|
-
const height = scale(surface.age);
|
|
41
|
-
return h("div.boundary-age-model-surface", {
|
|
42
|
-
key: surface.index,
|
|
43
|
-
style: { top: `${height}px` }
|
|
44
|
-
});
|
|
45
|
-
})
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
exports.BoundaryAgeModelOverlay = BoundaryAgeModelOverlay;
|
|
49
|
-
exports.ComputedSurfacesOverlay = ComputedSurfacesOverlay;
|
|
50
|
-
//# sourceMappingURL=age-model-overlay.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"age-model-overlay.cjs","sources":["../src/age-model-overlay.ts"],"sourcesContent":["/** An in-development overlay for a column's age model.\n *\n * Age model info:\n * {\n * \"boundary_id\": 8049,\n * \"col_id\": 432,\n * \"section_id\": 3104,\n * \"interval_id\": 268,\n * \"interval_name\": \"Calymmian\",\n * \"age_bottom\": 1600,\n * \"age_top\": 1400,\n * \"rel_position\": 0.85,\n * \"model_age\": 1430,\n * \"boundary_status\": \"absolute\",\n * \"boundary_type\": \"\",\n * \"boundary_position\": null,\n * \"unit_below\": 11541,\n * \"unit_above\": 0,\n * \"ref_id\": 217\n * },\n *\n * */\n\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./age-model-overlay.module.sass\";\nimport { useAPIResult } from \"@macrostrat/ui-components\";\nimport { useCompositeScale, useMacrostratUnits } from \"./data-provider\";\nimport { buildColumnSurfaces } from \"./prepare-units/dynamic-scales\";\nimport { ExtUnit } from \"./prepare-units\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nconst h = hyper.styled(styles);\n\ninterface AgeModelSurface {\n boundary_id: number;\n col_id: number;\n section_id: number;\n interval_id: number;\n interval_name: string;\n age_bottom: number;\n age_top: number;\n rel_position: number;\n model_age: number;\n boundary_status: \"absolute\" | \"relative\" | \"modeled\";\n boundary_type: string;\n boundary_position: null | number;\n unit_below: number;\n unit_above: number;\n ref_id: number;\n}\n\nexport function BoundaryAgeModelOverlay() {\n const col_id = (useMacrostratUnits() as ExtUnit[])?.[0]?.col_id;\n const scale = useCompositeScale();\n\n const ageModel = useAPIResult(\n \"https://dev.macrostrat.org/api/v2/age_model\",\n { col_id },\n (res) => res.success.data,\n );\n\n if (ageModel == null) {\n return null;\n }\n\n return h(\n \"div.boundary-age-model\",\n ageModel.map((surface) => {\n const height = scale(surface.model_age);\n\n return h(\"div.boundary-age-model-surface\", {\n key: surface.boundary_id,\n style: { top: `${height}px` },\n });\n }),\n );\n}\n\nexport function ComputedSurfacesOverlay() {\n /** Overlay showing age surfaces. This is like the boundary age model overlay but\n * it is computed on the fly from unit tops and bottoms.\n */\n const units = useMacrostratUnits() as UnitLong[];\n const surfaces = buildColumnSurfaces(units);\n const scale = useCompositeScale();\n\n return h(\n \"div.boundary-age-model\",\n surfaces.map((surface) => {\n const height = scale(surface.age);\n return h(\"div.boundary-age-model-surface\", {\n key: surface.index,\n style: { top: `${height}px` },\n });\n }),\n );\n}\n"],"names":["hyper","styles","useMacrostratUnits","useCompositeScale","useAPIResult","buildColumnSurfaces"],"mappings":";;;;;;;;;AA8BA,MAAM,IAAIA,WAAAA,QAAM,OAAOC,sBAAM;AAoBtB,SAAS,0BAA0B;AACxC,QAAM,SAAUC,MAAAA,uBAAqC,CAAC,GAAG;AACzD,QAAM,QAAQC,MAAAA,kBAAA;AAEd,QAAM,WAAWC,aAAAA;AAAAA,IACf;AAAA,IACA,EAAE,OAAA;AAAA,IACF,CAAC,QAAQ,IAAI,QAAQ;AAAA,EAAA;AAGvB,MAAI,YAAY,MAAM;AACpB,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,SAAS,IAAI,CAAC,YAAY;AACxB,YAAM,SAAS,MAAM,QAAQ,SAAS;AAEtC,aAAO,EAAE,kCAAkC;AAAA,QACzC,KAAK,QAAQ;AAAA,QACb,OAAO,EAAE,KAAK,GAAG,MAAM,KAAA;AAAA,MAAK,CAC7B;AAAA,IACH,CAAC;AAAA,EAAA;AAEL;AAEO,SAAS,0BAA0B;AAIxC,QAAM,QAAQF,MAAAA,mBAAA;AACd,QAAM,WAAWG,cAAAA,oBAAoB,KAAK;AAC1C,QAAM,QAAQF,MAAAA,kBAAA;AAEd,SAAO;AAAA,IACL;AAAA,IACA,SAAS,IAAI,CAAC,YAAY;AACxB,YAAM,SAAS,MAAM,QAAQ,GAAG;AAChC,aAAO,EAAE,kCAAkC;AAAA,QACzC,KAAK,QAAQ;AAAA,QACb,OAAO,EAAE,KAAK,GAAG,MAAM,KAAA;AAAA,MAAK,CAC7B;AAAA,IACH,CAAC;AAAA,EAAA;AAEL;;;"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** An in-development overlay for a column's age model.
|
|
2
|
-
*
|
|
3
|
-
* Age model info:
|
|
4
|
-
* {
|
|
5
|
-
* "boundary_id": 8049,
|
|
6
|
-
* "col_id": 432,
|
|
7
|
-
* "section_id": 3104,
|
|
8
|
-
* "interval_id": 268,
|
|
9
|
-
* "interval_name": "Calymmian",
|
|
10
|
-
* "age_bottom": 1600,
|
|
11
|
-
* "age_top": 1400,
|
|
12
|
-
* "rel_position": 0.85,
|
|
13
|
-
* "model_age": 1430,
|
|
14
|
-
* "boundary_status": "absolute",
|
|
15
|
-
* "boundary_type": "",
|
|
16
|
-
* "boundary_position": null,
|
|
17
|
-
* "unit_below": 11541,
|
|
18
|
-
* "unit_above": 0,
|
|
19
|
-
* "ref_id": 217
|
|
20
|
-
* },
|
|
21
|
-
*
|
|
22
|
-
* */
|
|
23
|
-
export declare function BoundaryAgeModelOverlay(): import('react').DOMElement<any, Element> | null;
|
|
24
|
-
export declare function ComputedSurfacesOverlay(): import('react').DOMElement<import('react').DOMAttributes<Element>, Element>;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import h$1 from "@macrostrat/hyper";
|
|
2
|
-
import h$2 from "./age-model-overlay.module.sass.js";
|
|
3
|
-
import { useAPIResult } from "@macrostrat/ui-components";
|
|
4
|
-
import { buildColumnSurfaces } from "./prepare-units/dynamic-scales.js";
|
|
5
|
-
import { useMacrostratUnits, useCompositeScale } from "./data-provider/store.js";
|
|
6
|
-
const h = h$1.styled(h$2);
|
|
7
|
-
function BoundaryAgeModelOverlay() {
|
|
8
|
-
const col_id = useMacrostratUnits()?.[0]?.col_id;
|
|
9
|
-
const scale = useCompositeScale();
|
|
10
|
-
const ageModel = useAPIResult(
|
|
11
|
-
"https://dev.macrostrat.org/api/v2/age_model",
|
|
12
|
-
{ col_id },
|
|
13
|
-
(res) => res.success.data
|
|
14
|
-
);
|
|
15
|
-
if (ageModel == null) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
return h(
|
|
19
|
-
"div.boundary-age-model",
|
|
20
|
-
ageModel.map((surface) => {
|
|
21
|
-
const height = scale(surface.model_age);
|
|
22
|
-
return h("div.boundary-age-model-surface", {
|
|
23
|
-
key: surface.boundary_id,
|
|
24
|
-
style: { top: `${height}px` }
|
|
25
|
-
});
|
|
26
|
-
})
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
function ComputedSurfacesOverlay() {
|
|
30
|
-
const units = useMacrostratUnits();
|
|
31
|
-
const surfaces = buildColumnSurfaces(units);
|
|
32
|
-
const scale = useCompositeScale();
|
|
33
|
-
return h(
|
|
34
|
-
"div.boundary-age-model",
|
|
35
|
-
surfaces.map((surface) => {
|
|
36
|
-
const height = scale(surface.age);
|
|
37
|
-
return h("div.boundary-age-model-surface", {
|
|
38
|
-
key: surface.index,
|
|
39
|
-
style: { top: `${height}px` }
|
|
40
|
-
});
|
|
41
|
-
})
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
export {
|
|
45
|
-
BoundaryAgeModelOverlay,
|
|
46
|
-
ComputedSurfacesOverlay
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=age-model-overlay.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"age-model-overlay.js","sources":["../src/age-model-overlay.ts"],"sourcesContent":["/** An in-development overlay for a column's age model.\n *\n * Age model info:\n * {\n * \"boundary_id\": 8049,\n * \"col_id\": 432,\n * \"section_id\": 3104,\n * \"interval_id\": 268,\n * \"interval_name\": \"Calymmian\",\n * \"age_bottom\": 1600,\n * \"age_top\": 1400,\n * \"rel_position\": 0.85,\n * \"model_age\": 1430,\n * \"boundary_status\": \"absolute\",\n * \"boundary_type\": \"\",\n * \"boundary_position\": null,\n * \"unit_below\": 11541,\n * \"unit_above\": 0,\n * \"ref_id\": 217\n * },\n *\n * */\n\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./age-model-overlay.module.sass\";\nimport { useAPIResult } from \"@macrostrat/ui-components\";\nimport { useCompositeScale, useMacrostratUnits } from \"./data-provider\";\nimport { buildColumnSurfaces } from \"./prepare-units/dynamic-scales\";\nimport { ExtUnit } from \"./prepare-units\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nconst h = hyper.styled(styles);\n\ninterface AgeModelSurface {\n boundary_id: number;\n col_id: number;\n section_id: number;\n interval_id: number;\n interval_name: string;\n age_bottom: number;\n age_top: number;\n rel_position: number;\n model_age: number;\n boundary_status: \"absolute\" | \"relative\" | \"modeled\";\n boundary_type: string;\n boundary_position: null | number;\n unit_below: number;\n unit_above: number;\n ref_id: number;\n}\n\nexport function BoundaryAgeModelOverlay() {\n const col_id = (useMacrostratUnits() as ExtUnit[])?.[0]?.col_id;\n const scale = useCompositeScale();\n\n const ageModel = useAPIResult(\n \"https://dev.macrostrat.org/api/v2/age_model\",\n { col_id },\n (res) => res.success.data,\n );\n\n if (ageModel == null) {\n return null;\n }\n\n return h(\n \"div.boundary-age-model\",\n ageModel.map((surface) => {\n const height = scale(surface.model_age);\n\n return h(\"div.boundary-age-model-surface\", {\n key: surface.boundary_id,\n style: { top: `${height}px` },\n });\n }),\n );\n}\n\nexport function ComputedSurfacesOverlay() {\n /** Overlay showing age surfaces. This is like the boundary age model overlay but\n * it is computed on the fly from unit tops and bottoms.\n */\n const units = useMacrostratUnits() as UnitLong[];\n const surfaces = buildColumnSurfaces(units);\n const scale = useCompositeScale();\n\n return h(\n \"div.boundary-age-model\",\n surfaces.map((surface) => {\n const height = scale(surface.age);\n return h(\"div.boundary-age-model-surface\", {\n key: surface.index,\n style: { top: `${height}px` },\n });\n }),\n );\n}\n"],"names":["hyper","styles"],"mappings":";;;;;AA8BA,MAAM,IAAIA,IAAM,OAAOC,GAAM;AAoBtB,SAAS,0BAA0B;AACxC,QAAM,SAAU,uBAAqC,CAAC,GAAG;AACzD,QAAM,QAAQ,kBAAA;AAEd,QAAM,WAAW;AAAA,IACf;AAAA,IACA,EAAE,OAAA;AAAA,IACF,CAAC,QAAQ,IAAI,QAAQ;AAAA,EAAA;AAGvB,MAAI,YAAY,MAAM;AACpB,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,SAAS,IAAI,CAAC,YAAY;AACxB,YAAM,SAAS,MAAM,QAAQ,SAAS;AAEtC,aAAO,EAAE,kCAAkC;AAAA,QACzC,KAAK,QAAQ;AAAA,QACb,OAAO,EAAE,KAAK,GAAG,MAAM,KAAA;AAAA,MAAK,CAC7B;AAAA,IACH,CAAC;AAAA,EAAA;AAEL;AAEO,SAAS,0BAA0B;AAIxC,QAAM,QAAQ,mBAAA;AACd,QAAM,WAAW,oBAAoB,KAAK;AAC1C,QAAM,QAAQ,kBAAA;AAEd,SAAO;AAAA,IACL;AAAA,IACA,SAAS,IAAI,CAAC,YAAY;AACxB,YAAM,SAAS,MAAM,QAAQ,GAAG;AAChC,aAAO,EAAE,kCAAkC;AAAA,QACzC,KAAK,QAAQ;AAAA,QACb,OAAO,EAAE,KAAK,GAAG,MAAM,KAAA;AAAA,MAAK,CAC7B;AAAA,IACH,CAAC;AAAA,EAAA;AAEL;"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const h$1 = require("@macrostrat/hyper");
|
|
3
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
4
|
-
const h__default = /* @__PURE__ */ _interopDefault(h$1);
|
|
5
|
-
const styles = {
|
|
6
|
-
"boundary-age-model": "_boundary-age-model_16scl_1",
|
|
7
|
-
"boundary-age-model-surface": "_boundary-age-model-surface_16scl_8"
|
|
8
|
-
};
|
|
9
|
-
let h = h__default.default.styled(styles);
|
|
10
|
-
Object.assign(h, styles);
|
|
11
|
-
module.exports = h;
|
|
12
|
-
//# sourceMappingURL=age-model-overlay.module.sass.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"age-model-overlay.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import h$1 from "@macrostrat/hyper";
|
|
2
|
-
const styles = {
|
|
3
|
-
"boundary-age-model": "_boundary-age-model_16scl_1",
|
|
4
|
-
"boundary-age-model-surface": "_boundary-age-model-surface_16scl_8"
|
|
5
|
-
};
|
|
6
|
-
let h = h$1.styled(styles);
|
|
7
|
-
Object.assign(h, styles);
|
|
8
|
-
export {
|
|
9
|
-
h as default
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=age-model-overlay.module.sass.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"age-model-overlay.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
package/src/age-model-overlay.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/** An in-development overlay for a column's age model.
|
|
2
|
-
*
|
|
3
|
-
* Age model info:
|
|
4
|
-
* {
|
|
5
|
-
* "boundary_id": 8049,
|
|
6
|
-
* "col_id": 432,
|
|
7
|
-
* "section_id": 3104,
|
|
8
|
-
* "interval_id": 268,
|
|
9
|
-
* "interval_name": "Calymmian",
|
|
10
|
-
* "age_bottom": 1600,
|
|
11
|
-
* "age_top": 1400,
|
|
12
|
-
* "rel_position": 0.85,
|
|
13
|
-
* "model_age": 1430,
|
|
14
|
-
* "boundary_status": "absolute",
|
|
15
|
-
* "boundary_type": "",
|
|
16
|
-
* "boundary_position": null,
|
|
17
|
-
* "unit_below": 11541,
|
|
18
|
-
* "unit_above": 0,
|
|
19
|
-
* "ref_id": 217
|
|
20
|
-
* },
|
|
21
|
-
*
|
|
22
|
-
* */
|
|
23
|
-
|
|
24
|
-
import hyper from "@macrostrat/hyper";
|
|
25
|
-
import styles from "./age-model-overlay.module.sass";
|
|
26
|
-
import { useAPIResult } from "@macrostrat/ui-components";
|
|
27
|
-
import { useCompositeScale, useMacrostratUnits } from "./data-provider";
|
|
28
|
-
import { buildColumnSurfaces } from "./prepare-units/dynamic-scales";
|
|
29
|
-
import { ExtUnit } from "./prepare-units";
|
|
30
|
-
import { UnitLong } from "@macrostrat/api-types";
|
|
31
|
-
const h = hyper.styled(styles);
|
|
32
|
-
|
|
33
|
-
interface AgeModelSurface {
|
|
34
|
-
boundary_id: number;
|
|
35
|
-
col_id: number;
|
|
36
|
-
section_id: number;
|
|
37
|
-
interval_id: number;
|
|
38
|
-
interval_name: string;
|
|
39
|
-
age_bottom: number;
|
|
40
|
-
age_top: number;
|
|
41
|
-
rel_position: number;
|
|
42
|
-
model_age: number;
|
|
43
|
-
boundary_status: "absolute" | "relative" | "modeled";
|
|
44
|
-
boundary_type: string;
|
|
45
|
-
boundary_position: null | number;
|
|
46
|
-
unit_below: number;
|
|
47
|
-
unit_above: number;
|
|
48
|
-
ref_id: number;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function BoundaryAgeModelOverlay() {
|
|
52
|
-
const col_id = (useMacrostratUnits() as ExtUnit[])?.[0]?.col_id;
|
|
53
|
-
const scale = useCompositeScale();
|
|
54
|
-
|
|
55
|
-
const ageModel = useAPIResult(
|
|
56
|
-
"https://dev.macrostrat.org/api/v2/age_model",
|
|
57
|
-
{ col_id },
|
|
58
|
-
(res) => res.success.data,
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
if (ageModel == null) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return h(
|
|
66
|
-
"div.boundary-age-model",
|
|
67
|
-
ageModel.map((surface) => {
|
|
68
|
-
const height = scale(surface.model_age);
|
|
69
|
-
|
|
70
|
-
return h("div.boundary-age-model-surface", {
|
|
71
|
-
key: surface.boundary_id,
|
|
72
|
-
style: { top: `${height}px` },
|
|
73
|
-
});
|
|
74
|
-
}),
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export function ComputedSurfacesOverlay() {
|
|
79
|
-
/** Overlay showing age surfaces. This is like the boundary age model overlay but
|
|
80
|
-
* it is computed on the fly from unit tops and bottoms.
|
|
81
|
-
*/
|
|
82
|
-
const units = useMacrostratUnits() as UnitLong[];
|
|
83
|
-
const surfaces = buildColumnSurfaces(units);
|
|
84
|
-
const scale = useCompositeScale();
|
|
85
|
-
|
|
86
|
-
return h(
|
|
87
|
-
"div.boundary-age-model",
|
|
88
|
-
surfaces.map((surface) => {
|
|
89
|
-
const height = scale(surface.age);
|
|
90
|
-
return h("div.boundary-age-model-surface", {
|
|
91
|
-
key: surface.index,
|
|
92
|
-
style: { top: `${height}px` },
|
|
93
|
-
});
|
|
94
|
-
}),
|
|
95
|
-
);
|
|
96
|
-
}
|