@macrostrat/column-views 3.6.1 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +144 -0
- package/dist/animated-age-window.cjs +51 -0
- package/dist/animated-age-window.cjs.map +1 -0
- package/dist/animated-age-window.d.ts +51 -0
- package/dist/animated-age-window.js +51 -0
- package/dist/animated-age-window.js.map +1 -0
- package/dist/column-views.css +118 -89
- package/dist/column.cjs +12 -3
- package/dist/column.cjs.map +1 -1
- package/dist/column.d.ts +11 -0
- package/dist/column.js +12 -3
- package/dist/column.js.map +1 -1
- package/dist/column.module.sass.cjs +15 -15
- package/dist/column.module.sass.js +15 -15
- package/dist/correlation-chart/main.cjs +156 -42
- package/dist/correlation-chart/main.cjs.map +1 -1
- package/dist/correlation-chart/main.d.ts +40 -2
- package/dist/correlation-chart/main.js +138 -23
- package/dist/correlation-chart/main.js.map +1 -1
- package/dist/correlation-chart/main.module.sass.cjs +23 -20
- package/dist/correlation-chart/main.module.sass.cjs.map +1 -1
- package/dist/correlation-chart/main.module.sass.js +23 -20
- package/dist/correlation-chart/main.module.sass.js.map +1 -1
- package/dist/correlation-chart/prepare-data.cjs +0 -1
- package/dist/correlation-chart/prepare-data.cjs.map +1 -1
- package/dist/correlation-chart/prepare-data.js +0 -1
- package/dist/correlation-chart/prepare-data.js.map +1 -1
- package/dist/data-provider/store.cjs +17 -4
- package/dist/data-provider/store.cjs.map +1 -1
- package/dist/data-provider/store.d.ts +6 -1
- package/dist/data-provider/store.js +17 -4
- package/dist/data-provider/store.js.map +1 -1
- package/dist/data-provider/unit-selection.cjs +4 -1
- package/dist/data-provider/unit-selection.cjs.map +1 -1
- package/dist/data-provider/unit-selection.d.ts +1 -1
- package/dist/data-provider/unit-selection.js +4 -1
- package/dist/data-provider/unit-selection.js.map +1 -1
- package/dist/index.cjs +16 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/maps/column-correlation/core.cjs +127 -6
- package/dist/maps/column-correlation/core.cjs.map +1 -1
- package/dist/maps/column-correlation/core.js +128 -7
- package/dist/maps/column-correlation/core.js.map +1 -1
- package/dist/maps/column-correlation/state.cjs +63 -2
- package/dist/maps/column-correlation/state.cjs.map +1 -1
- package/dist/maps/column-correlation/state.d.ts +31 -1
- package/dist/maps/column-correlation/state.js +63 -2
- package/dist/maps/column-correlation/state.js.map +1 -1
- package/dist/maps/layers/columns.cjs +5 -1
- package/dist/maps/layers/columns.cjs.map +1 -1
- package/dist/maps/layers/columns.js +5 -1
- package/dist/maps/layers/columns.js.map +1 -1
- package/dist/prepare-units/composite-scale.cjs +94 -8
- package/dist/prepare-units/composite-scale.cjs.map +1 -1
- package/dist/prepare-units/composite-scale.d.ts +39 -0
- package/dist/prepare-units/composite-scale.js +96 -10
- package/dist/prepare-units/composite-scale.js.map +1 -1
- package/dist/prepare-units/helpers.cjs +0 -1
- package/dist/prepare-units/helpers.cjs.map +1 -1
- package/dist/prepare-units/helpers.js +0 -1
- package/dist/prepare-units/helpers.js.map +1 -1
- package/dist/prepare-units/index.cjs +33 -12
- package/dist/prepare-units/index.cjs.map +1 -1
- package/dist/prepare-units/index.js +34 -13
- 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 +13 -0
- package/dist/prepare-units/types.js.map +1 -1
- package/dist/section.cjs +10 -2
- package/dist/section.cjs.map +1 -1
- package/dist/section.d.ts +5 -0
- package/dist/section.js +10 -2
- package/dist/section.js.map +1 -1
- package/dist/unit-details/age-range.cjs +2 -1
- package/dist/unit-details/age-range.cjs.map +1 -1
- package/dist/unit-details/age-range.js +2 -1
- package/dist/unit-details/age-range.js.map +1 -1
- package/dist/unit-details/index.d.ts +1 -1
- package/dist/unit-details/panel.cjs +2 -3
- package/dist/unit-details/panel.cjs.map +1 -1
- package/dist/unit-details/panel.js +1 -2
- package/dist/unit-details/panel.js.map +1 -1
- package/dist/unit-details/panel.module.sass.cjs +18 -22
- package/dist/unit-details/panel.module.sass.cjs.map +1 -1
- package/dist/unit-details/panel.module.sass.js +18 -22
- package/dist/unit-details/panel.module.sass.js.map +1 -1
- package/dist/unit-details/strat-names.cjs +1 -2
- package/dist/unit-details/strat-names.cjs.map +1 -1
- package/dist/unit-details/strat-names.js +1 -2
- package/dist/unit-details/strat-names.js.map +1 -1
- package/dist/units/boxes.cjs +20 -36
- package/dist/units/boxes.cjs.map +1 -1
- package/dist/units/boxes.js +22 -38
- package/dist/units/boxes.js.map +1 -1
- package/dist/units/composite.cjs +12 -12
- package/dist/units/composite.cjs.map +1 -1
- package/dist/units/composite.js +12 -12
- package/dist/units/composite.js.map +1 -1
- package/package.json +9 -9
- package/src/animated-age-window.ts +120 -0
- package/src/column.module.sass +6 -0
- package/src/column.ts +24 -0
- package/src/correlation-chart/main.module.sass +46 -2
- package/src/correlation-chart/main.ts +210 -17
- package/src/correlation-chart/prepare-data.ts +0 -1
- package/src/data-provider/store.ts +21 -2
- package/src/data-provider/unit-selection.ts +13 -2
- package/src/index.ts +1 -0
- package/src/maps/column-correlation/column-correlation-map.stories.ts +12 -0
- package/src/maps/column-correlation/core.ts +155 -9
- package/src/maps/column-correlation/state.ts +110 -2
- package/src/maps/layers/columns.ts +7 -1
- package/src/prepare-units/composite-scale.ts +210 -10
- package/src/prepare-units/helpers.ts +0 -2
- package/src/prepare-units/index.ts +68 -14
- package/src/prepare-units/types.ts +13 -0
- package/src/section.ts +15 -1
- package/src/unit-details/age-range.ts +3 -1
- package/src/unit-details/index.ts +7 -1
- package/src/unit-details/panel.module.sass +0 -8
- package/src/unit-details/panel.ts +6 -6
- package/src/unit-details/strat-names.ts +1 -1
- package/src/units/boxes.ts +33 -53
- package/src/units/composite.ts +21 -12
- package/dist/correlation-chart/stories/utils.d.ts +0 -6
- package/dist/unit-details/identifiers.cjs +0 -56
- package/dist/unit-details/identifiers.cjs.map +0 -1
- package/dist/unit-details/identifiers.d.ts +0 -31
- package/dist/unit-details/identifiers.js +0 -54
- package/dist/unit-details/identifiers.js.map +0 -1
- package/src/correlation-chart/stories/correlation-chart.stories.ts +0 -228
- package/src/correlation-chart/stories/namibia-correlation.stories.ts +0 -151
- package/src/correlation-chart/stories/stories.module.sass +0 -18
- package/src/correlation-chart/stories/utils.ts +0 -24
- package/src/unit-details/identifiers.ts +0 -67
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import "@macrostrat/style-system";
|
|
2
|
-
import { MergeSectionsMode, UnitComponent } from "../..";
|
|
3
|
-
import { Meta } from "@storybook/react-vite";
|
|
4
|
-
|
|
5
|
-
import h from "./stories.module.sass";
|
|
6
|
-
import { CorrelationChart } from "../main";
|
|
7
|
-
import { BaseUnit } from "@macrostrat/api-types";
|
|
8
|
-
import { useGeologicPattern } from "@macrostrat/column-components";
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
title: "Column views/Correlation chart",
|
|
12
|
-
component: CorrelationChart,
|
|
13
|
-
parameters: {
|
|
14
|
-
layout: "fullscreen",
|
|
15
|
-
docs: {
|
|
16
|
-
description: {
|
|
17
|
-
component: "Correlation chart for Macrostrat columns",
|
|
18
|
-
},
|
|
19
|
-
story: {
|
|
20
|
-
inline: false,
|
|
21
|
-
iframeHeight: 500,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
args: {},
|
|
26
|
-
} as Meta<typeof CorrelationChart>;
|
|
27
|
-
|
|
28
|
-
const nosib = {
|
|
29
|
-
b_age: 900,
|
|
30
|
-
t_age: 800,
|
|
31
|
-
name: "Nosib",
|
|
32
|
-
color: "#ffd4ba",
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const namUnits: (BaseUnit | BaseUnit[])[] = [
|
|
36
|
-
[
|
|
37
|
-
nosib,
|
|
38
|
-
{ b_age: 746, t_age: 720, name: "Chuos", color: "#d0b4ff" },
|
|
39
|
-
{
|
|
40
|
-
b_age: 720,
|
|
41
|
-
t_age: 600,
|
|
42
|
-
name: "Otavi",
|
|
43
|
-
color: "dodgerblue",
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
[
|
|
47
|
-
nosib,
|
|
48
|
-
{
|
|
49
|
-
b_age: 740,
|
|
50
|
-
t_age: 600,
|
|
51
|
-
name: "Swakop",
|
|
52
|
-
color: "#aaa",
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
[
|
|
56
|
-
nosib,
|
|
57
|
-
{
|
|
58
|
-
b_age: 670,
|
|
59
|
-
t_age: 580,
|
|
60
|
-
name: "Witvlei",
|
|
61
|
-
color: "#fffc4e",
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
[
|
|
65
|
-
{
|
|
66
|
-
b_age: 610,
|
|
67
|
-
t_age: 575,
|
|
68
|
-
name: "Zebra Series",
|
|
69
|
-
color: "#fdbcf0",
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
b_age: 660,
|
|
73
|
-
t_age: 610,
|
|
74
|
-
name: "Naukluft complex",
|
|
75
|
-
color: "#fdbcbc",
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
{
|
|
79
|
-
b_age: 550,
|
|
80
|
-
t_age: 520,
|
|
81
|
-
name: "Nama",
|
|
82
|
-
color: "#baf1a7",
|
|
83
|
-
},
|
|
84
|
-
// {
|
|
85
|
-
// unit_id: 0,
|
|
86
|
-
// b_age: 900,
|
|
87
|
-
// t_age: 0,
|
|
88
|
-
// unit_name: "",
|
|
89
|
-
// column: 8,
|
|
90
|
-
// },
|
|
91
|
-
];
|
|
92
|
-
|
|
93
|
-
export function NamibiaCorrelationChart() {
|
|
94
|
-
return h(
|
|
95
|
-
"div",
|
|
96
|
-
{
|
|
97
|
-
style: {
|
|
98
|
-
"--column-unit-font-size": "14px",
|
|
99
|
-
"--column-unit-font-style": "bold",
|
|
100
|
-
"--column-text-color": "white",
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
[
|
|
104
|
-
h(CorrelationChart, {
|
|
105
|
-
id: 432,
|
|
106
|
-
data: namUnits.map((u, i) => {
|
|
107
|
-
let units: any = null;
|
|
108
|
-
if (Array.isArray(u)) {
|
|
109
|
-
units = u.map((u) => buildUnit(u, i));
|
|
110
|
-
} else {
|
|
111
|
-
units = [buildUnit(u, i)];
|
|
112
|
-
}
|
|
113
|
-
return {
|
|
114
|
-
columnID: i,
|
|
115
|
-
units,
|
|
116
|
-
};
|
|
117
|
-
}),
|
|
118
|
-
columnSpacing: 10,
|
|
119
|
-
t_age: 450,
|
|
120
|
-
b_age: 850,
|
|
121
|
-
//width: 400,
|
|
122
|
-
//columnWidth: 400,
|
|
123
|
-
pixelScale: 2,
|
|
124
|
-
//showLabelColumn: false,
|
|
125
|
-
mergeSections: MergeSectionsMode.ALL,
|
|
126
|
-
unitComponent: ProvidedColorUnitComponent,
|
|
127
|
-
}),
|
|
128
|
-
],
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function buildUnit(unit, i) {
|
|
133
|
-
return {
|
|
134
|
-
unit_id: i,
|
|
135
|
-
col_id: i,
|
|
136
|
-
...unit,
|
|
137
|
-
unit_name: unit.name,
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function ProvidedColorUnitComponent(props) {
|
|
142
|
-
/** A unit component that is colored by its own properties. */
|
|
143
|
-
|
|
144
|
-
const fill = useGeologicPattern(props.division.patternID);
|
|
145
|
-
|
|
146
|
-
return h(UnitComponent, {
|
|
147
|
-
fill,
|
|
148
|
-
backgroundColor: props.division.color ?? null,
|
|
149
|
-
...props,
|
|
150
|
-
});
|
|
151
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
.column-ui
|
|
2
|
-
height: 100%
|
|
3
|
-
width: 100%
|
|
4
|
-
overflow: scroll
|
|
5
|
-
|
|
6
|
-
.correlation-container
|
|
7
|
-
padding: 2em calc(350px + 2em) 2em 2em
|
|
8
|
-
width: fit-content
|
|
9
|
-
|
|
10
|
-
.right-column
|
|
11
|
-
width: 350px
|
|
12
|
-
position: fixed
|
|
13
|
-
top: 0
|
|
14
|
-
right: 0
|
|
15
|
-
padding: 1em
|
|
16
|
-
|
|
17
|
-
.column-selector-map, .correlation-map
|
|
18
|
-
height: 350px
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useArgs } from "storybook/preview-api";
|
|
2
|
-
import { useCallback } from "react";
|
|
3
|
-
import { parseLineFromString, stringifyLine } from "../hash-string";
|
|
4
|
-
|
|
5
|
-
export function useCorrelationLine() {
|
|
6
|
-
const [{ focusedLine, selectedUnit }, updateArgs] = useArgs();
|
|
7
|
-
const setFocusedLine = (line) => {
|
|
8
|
-
updateArgs({ focusedLine: stringifyLine(line) });
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const setSelectedUnit = useCallback(
|
|
12
|
-
(selectedUnit) => {
|
|
13
|
-
updateArgs({ selectedUnit });
|
|
14
|
-
},
|
|
15
|
-
[updateArgs],
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
focusedLine: parseLineFromString(focusedLine),
|
|
20
|
-
setFocusedLine,
|
|
21
|
-
selectedUnit,
|
|
22
|
-
setSelectedUnit,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { isClickable, ItemInteractionProps } from "@macrostrat/data-components";
|
|
2
|
-
import h from "./panel.module.sass";
|
|
3
|
-
import { ReactNode } from "react";
|
|
4
|
-
import classNames from "classnames";
|
|
5
|
-
|
|
6
|
-
export function ClickableText({
|
|
7
|
-
className,
|
|
8
|
-
...rest
|
|
9
|
-
}: {
|
|
10
|
-
className?: string;
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
} & ItemInteractionProps) {
|
|
13
|
-
/** An optionally clickable text element */
|
|
14
|
-
const clickable = isClickable(rest);
|
|
15
|
-
const tag = clickable ? "a" : "span";
|
|
16
|
-
return h(tag, { className: classNames(className, { clickable }), ...rest });
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function Identifier({
|
|
20
|
-
id,
|
|
21
|
-
className,
|
|
22
|
-
...rest
|
|
23
|
-
}: {
|
|
24
|
-
id: number | string;
|
|
25
|
-
className?: string;
|
|
26
|
-
} & ItemInteractionProps) {
|
|
27
|
-
/** An item that displays a numeric identifier, optionally clickable */
|
|
28
|
-
return h(
|
|
29
|
-
ClickableText,
|
|
30
|
-
{
|
|
31
|
-
className: classNames("identifier", className),
|
|
32
|
-
...rest,
|
|
33
|
-
},
|
|
34
|
-
id,
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export type UnitInfo = {
|
|
39
|
-
unitID: number;
|
|
40
|
-
colID?: number;
|
|
41
|
-
name?: string;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export function UnitIdentifier({
|
|
45
|
-
unitID,
|
|
46
|
-
colID,
|
|
47
|
-
name,
|
|
48
|
-
...interactionProps
|
|
49
|
-
}: UnitInfo & ItemInteractionProps) {
|
|
50
|
-
if (name != null) {
|
|
51
|
-
return h(
|
|
52
|
-
ClickableText,
|
|
53
|
-
{
|
|
54
|
-
className: "unit-name",
|
|
55
|
-
...interactionProps,
|
|
56
|
-
},
|
|
57
|
-
name,
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return h(Identifier, {
|
|
62
|
-
className: "unit-id",
|
|
63
|
-
key: unitID,
|
|
64
|
-
id: unitID,
|
|
65
|
-
...interactionProps,
|
|
66
|
-
});
|
|
67
|
-
}
|