@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
package/src/units/boxes.ts
CHANGED
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
ColumnAxisType,
|
|
3
3
|
ColumnContext,
|
|
4
4
|
ColumnLayoutContext,
|
|
5
|
+
ClippableRect,
|
|
5
6
|
ForeignObject,
|
|
6
7
|
PatternDefsProvider,
|
|
7
8
|
useColumn,
|
|
8
9
|
useGeologicPattern,
|
|
9
|
-
zigZagBoxPath,
|
|
10
10
|
} from "@macrostrat/column-components";
|
|
11
11
|
import { SizeAwareLabel, Clickable } from "@macrostrat/ui-components";
|
|
12
12
|
import hyper from "@macrostrat/hyper";
|
|
13
|
-
import {
|
|
13
|
+
import { ReactNode, useContext, useMemo } from "react";
|
|
14
14
|
import { resolveID, scalePattern } from "./resolvers";
|
|
15
15
|
import { useUnitSelectionTarget } from "../data-provider";
|
|
16
16
|
import { useLithologies } from "@macrostrat/data-provider";
|
|
@@ -23,6 +23,12 @@ import type { RectBounds } from "./types";
|
|
|
23
23
|
|
|
24
24
|
const h = hyper.styled(styles);
|
|
25
25
|
|
|
26
|
+
/** Resolve a class name through this file's CSS module exactly as the styled
|
|
27
|
+
* `h` would (module-scoped classes are hashed; unknown/global classes pass
|
|
28
|
+
* through). Needed because `ClippableRect` renders the element in
|
|
29
|
+
* `@macrostrat/column-components`, so class resolution must happen here. */
|
|
30
|
+
const cls = (name: string): string => (styles as any)[name] ?? name;
|
|
31
|
+
|
|
26
32
|
interface UnitRectOptions {
|
|
27
33
|
widthFraction?: number;
|
|
28
34
|
axisType?: ColumnAxisType;
|
|
@@ -100,7 +106,7 @@ export function MinimalUnit(props) {
|
|
|
100
106
|
|
|
101
107
|
const backgroundColor = getMixedUnitColor(d, lithMap, null, false);
|
|
102
108
|
|
|
103
|
-
const [ref, selected, onClick] = useUnitSelectionTarget(d);
|
|
109
|
+
const [ref, selected, onClick, linked] = useUnitSelectionTarget(d);
|
|
104
110
|
|
|
105
111
|
return h(
|
|
106
112
|
"g.unit",
|
|
@@ -120,6 +126,7 @@ export function MinimalUnit(props) {
|
|
|
120
126
|
stroke: backgroundColor,
|
|
121
127
|
onClick,
|
|
122
128
|
}),
|
|
129
|
+
h.if(linked)("rect.linked-overlay", bounds),
|
|
123
130
|
h.if(selected)("rect.selection-overlay", bounds),
|
|
124
131
|
],
|
|
125
132
|
);
|
|
@@ -158,7 +165,7 @@ function Unit(props: UnitProps) {
|
|
|
158
165
|
|
|
159
166
|
const _className = classNames(className, { colored: hasBackgroundColor });
|
|
160
167
|
|
|
161
|
-
const [ref, selected, onClick] = useUnitSelectionTarget(d);
|
|
168
|
+
const [ref, selected, onClick, linked] = useUnitSelectionTarget(d);
|
|
162
169
|
|
|
163
170
|
return h(
|
|
164
171
|
"g.unit",
|
|
@@ -169,69 +176,34 @@ function Unit(props: UnitProps) {
|
|
|
169
176
|
},
|
|
170
177
|
},
|
|
171
178
|
[
|
|
172
|
-
h(
|
|
179
|
+
h(ClippableRect, {
|
|
173
180
|
...bounds,
|
|
174
181
|
fill: backgroundColor,
|
|
175
182
|
onClick,
|
|
176
|
-
className: "background",
|
|
183
|
+
className: cls("background"),
|
|
177
184
|
}),
|
|
178
|
-
h(
|
|
185
|
+
h(ClippableRect, {
|
|
179
186
|
ref,
|
|
180
187
|
...bounds,
|
|
181
188
|
fill: _fill,
|
|
182
189
|
//mask,
|
|
183
190
|
onClick,
|
|
184
|
-
className: "unit",
|
|
191
|
+
className: cls("unit"),
|
|
192
|
+
}),
|
|
193
|
+
h.if(linked)(ClippableRect, {
|
|
194
|
+
...bounds,
|
|
195
|
+
className: cls("linked-overlay"),
|
|
196
|
+
}),
|
|
197
|
+
h.if(selected)(ClippableRect, {
|
|
198
|
+
...bounds,
|
|
199
|
+
className: cls("selection-overlay"),
|
|
185
200
|
}),
|
|
186
|
-
h.if(selected)(UnitRect, { ...bounds, className: "selection-overlay" }),
|
|
187
201
|
//defs,
|
|
188
202
|
children,
|
|
189
203
|
],
|
|
190
204
|
);
|
|
191
205
|
}
|
|
192
206
|
|
|
193
|
-
interface UnitRectProps {
|
|
194
|
-
x: number;
|
|
195
|
-
y: number;
|
|
196
|
-
width: number;
|
|
197
|
-
height: number;
|
|
198
|
-
className: string;
|
|
199
|
-
// Used to determine if the rect should have a zig-zag edge on the top or bottom
|
|
200
|
-
overflowTop?: boolean;
|
|
201
|
-
overflowBottom?: boolean;
|
|
202
|
-
[key: string]: any;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const UnitRect = forwardRef((props: UnitRectProps, ref) => {
|
|
206
|
-
const {
|
|
207
|
-
x,
|
|
208
|
-
y,
|
|
209
|
-
width,
|
|
210
|
-
height,
|
|
211
|
-
overflowTop = false,
|
|
212
|
-
overflowBottom = false,
|
|
213
|
-
...rest
|
|
214
|
-
} = props;
|
|
215
|
-
|
|
216
|
-
if (!overflowTop && !overflowBottom) {
|
|
217
|
-
return h("rect", {
|
|
218
|
-
x,
|
|
219
|
-
y,
|
|
220
|
-
width,
|
|
221
|
-
height,
|
|
222
|
-
ref,
|
|
223
|
-
...rest,
|
|
224
|
-
});
|
|
225
|
-
} else {
|
|
226
|
-
const d = zigZagBoxPath(x, y, width, height, overflowTop, overflowBottom);
|
|
227
|
-
return h("path", {
|
|
228
|
-
d,
|
|
229
|
-
ref,
|
|
230
|
-
...rest,
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
|
|
235
207
|
function LabeledUnit(props: LabeledUnitProps) {
|
|
236
208
|
const {
|
|
237
209
|
division,
|
|
@@ -245,12 +217,17 @@ function LabeledUnit(props: LabeledUnitProps) {
|
|
|
245
217
|
...baseBounds
|
|
246
218
|
} = props;
|
|
247
219
|
|
|
248
|
-
const { axisType } =
|
|
220
|
+
const { axisType, isTransitioning, hideLabelsWhileTransitioning } =
|
|
221
|
+
useColumn();
|
|
249
222
|
const bounds = {
|
|
250
223
|
...useUnitRect(division, { widthFraction, axisType }),
|
|
251
224
|
...baseBounds,
|
|
252
225
|
};
|
|
253
226
|
const { width, height } = bounds;
|
|
227
|
+
// Labels stay visible through the animation by default. `hideLabelsWhileTransitioning`
|
|
228
|
+
// is a perf escape hatch: when set, the `foreignObject` label (whose HTML
|
|
229
|
+
// reflows on every size change) is skipped mid-transition and restored on settle.
|
|
230
|
+
const skipLabel = isTransitioning && hideLabelsWhileTransitioning;
|
|
254
231
|
return h(
|
|
255
232
|
Unit,
|
|
256
233
|
{
|
|
@@ -261,7 +238,7 @@ function LabeledUnit(props: LabeledUnitProps) {
|
|
|
261
238
|
...bounds,
|
|
262
239
|
},
|
|
263
240
|
[
|
|
264
|
-
h.if(showLabel)(
|
|
241
|
+
h.if(showLabel && !skipLabel)(
|
|
265
242
|
ForeignObject,
|
|
266
243
|
{ ...bounds, className: "unit-label-container" },
|
|
267
244
|
h(SizeAwareLabel, {
|
|
@@ -269,6 +246,9 @@ function LabeledUnit(props: LabeledUnitProps) {
|
|
|
269
246
|
labelClassName: "unit-label",
|
|
270
247
|
style: { width, height },
|
|
271
248
|
label,
|
|
249
|
+
// Re-fit the label when a transition settles (isTransitioning flips),
|
|
250
|
+
// not on every intermediate frame.
|
|
251
|
+
remeasureKey: isTransitioning,
|
|
272
252
|
onVisibilityChanged(viz) {
|
|
273
253
|
onLabelUpdated(label, viz);
|
|
274
254
|
},
|
package/src/units/composite.ts
CHANGED
|
@@ -42,23 +42,32 @@ export function LabelTrackerProvider(props) {
|
|
|
42
42
|
BaseUnit[] | null
|
|
43
43
|
>(null);
|
|
44
44
|
const labelTrackerRef = useRef<LabelTracker>({});
|
|
45
|
+
|
|
46
|
+
const recompute = useCallback(() => {
|
|
47
|
+
// Recompute over the *current* unit set (which changes as the column zooms).
|
|
48
|
+
// The tracker ref accumulates entries for units seen at any zoom level, so
|
|
49
|
+
// we gate on whether every currently-visible unit has reported — not on the
|
|
50
|
+
// total number of tracked units, which would go stale and freeze the notes.
|
|
51
|
+
const tracker = labelTrackerRef.current;
|
|
52
|
+
const allReported = units.every((d) => findUnitID(d) in tracker);
|
|
53
|
+
if (!allReported) return;
|
|
54
|
+
setUnlabeledDivisions(units.filter((d) => tracker[findUnitID(d)] === false));
|
|
55
|
+
}, [units, findUnitID]);
|
|
56
|
+
|
|
45
57
|
const trackLabelVisibility = useCallback(
|
|
46
58
|
(div, visible) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (Object.keys(labelTrackerRef.current).length == units.length) {
|
|
50
|
-
setUnlabeledDivisions(
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
units.filter((d) => {
|
|
53
|
-
const id = findUnitID(d);
|
|
54
|
-
return labelTrackerRef.current[id] == false;
|
|
55
|
-
}),
|
|
56
|
-
);
|
|
57
|
-
}
|
|
59
|
+
labelTrackerRef.current[findUnitID(div)] = visible;
|
|
60
|
+
recompute();
|
|
58
61
|
},
|
|
59
|
-
[
|
|
62
|
+
[recompute, findUnitID],
|
|
60
63
|
);
|
|
61
64
|
|
|
65
|
+
// Re-sync when the visible unit set changes (e.g. on zoom), so a unit whose
|
|
66
|
+
// label now fits inline stops also rendering as a note, and vice versa.
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
recompute();
|
|
69
|
+
}, [recompute]);
|
|
70
|
+
|
|
62
71
|
const value = trackLabelVisibility;
|
|
63
72
|
return h(
|
|
64
73
|
LabelTrackerContext.Provider,
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const dataComponents = require("@macrostrat/data-components");
|
|
4
|
-
const panel_module = require("./panel.module.sass.cjs");
|
|
5
|
-
const classNames = require("classnames");
|
|
6
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
7
|
-
const classNames__default = /* @__PURE__ */ _interopDefault(classNames);
|
|
8
|
-
function ClickableText({
|
|
9
|
-
className,
|
|
10
|
-
...rest
|
|
11
|
-
}) {
|
|
12
|
-
const clickable = dataComponents.isClickable(rest);
|
|
13
|
-
const tag = clickable ? "a" : "span";
|
|
14
|
-
return panel_module.default(tag, { className: classNames__default.default(className, { clickable }), ...rest });
|
|
15
|
-
}
|
|
16
|
-
function Identifier({
|
|
17
|
-
id,
|
|
18
|
-
className,
|
|
19
|
-
...rest
|
|
20
|
-
}) {
|
|
21
|
-
return panel_module.default(
|
|
22
|
-
ClickableText,
|
|
23
|
-
{
|
|
24
|
-
className: classNames__default.default("identifier", className),
|
|
25
|
-
...rest
|
|
26
|
-
},
|
|
27
|
-
id
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
function UnitIdentifier({
|
|
31
|
-
unitID,
|
|
32
|
-
colID,
|
|
33
|
-
name,
|
|
34
|
-
...interactionProps
|
|
35
|
-
}) {
|
|
36
|
-
if (name != null) {
|
|
37
|
-
return panel_module.default(
|
|
38
|
-
ClickableText,
|
|
39
|
-
{
|
|
40
|
-
className: "unit-name",
|
|
41
|
-
...interactionProps
|
|
42
|
-
},
|
|
43
|
-
name
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
return panel_module.default(Identifier, {
|
|
47
|
-
className: "unit-id",
|
|
48
|
-
key: unitID,
|
|
49
|
-
id: unitID,
|
|
50
|
-
...interactionProps
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
exports.ClickableText = ClickableText;
|
|
54
|
-
exports.Identifier = Identifier;
|
|
55
|
-
exports.UnitIdentifier = UnitIdentifier;
|
|
56
|
-
//# sourceMappingURL=identifiers.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifiers.cjs","sources":["../../src/unit-details/identifiers.ts"],"sourcesContent":["import { isClickable, ItemInteractionProps } from \"@macrostrat/data-components\";\nimport h from \"./panel.module.sass\";\nimport { ReactNode } from \"react\";\nimport classNames from \"classnames\";\n\nexport function ClickableText({\n className,\n ...rest\n}: {\n className?: string;\n children: ReactNode;\n} & ItemInteractionProps) {\n /** An optionally clickable text element */\n const clickable = isClickable(rest);\n const tag = clickable ? \"a\" : \"span\";\n return h(tag, { className: classNames(className, { clickable }), ...rest });\n}\n\nexport function Identifier({\n id,\n className,\n ...rest\n}: {\n id: number | string;\n className?: string;\n} & ItemInteractionProps) {\n /** An item that displays a numeric identifier, optionally clickable */\n return h(\n ClickableText,\n {\n className: classNames(\"identifier\", className),\n ...rest,\n },\n id,\n );\n}\n\nexport type UnitInfo = {\n unitID: number;\n colID?: number;\n name?: string;\n};\n\nexport function UnitIdentifier({\n unitID,\n colID,\n name,\n ...interactionProps\n}: UnitInfo & ItemInteractionProps) {\n if (name != null) {\n return h(\n ClickableText,\n {\n className: \"unit-name\",\n ...interactionProps,\n },\n name,\n );\n }\n\n return h(Identifier, {\n className: \"unit-id\",\n key: unitID,\n id: unitID,\n ...interactionProps,\n });\n}\n"],"names":["isClickable","h","classNames"],"mappings":";;;;;;;AAKO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,GAAG;AACL,GAG0B;AAExB,QAAM,YAAYA,eAAAA,YAAY,IAAI;AAClC,QAAM,MAAM,YAAY,MAAM;AAC9B,SAAOC,qBAAE,KAAK,EAAE,WAAWC,oBAAAA,QAAW,WAAW,EAAE,UAAA,CAAW,GAAG,GAAG,MAAM;AAC5E;AAEO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAG0B;AAExB,SAAOD,aAAAA;AAAAA,IACL;AAAA,IACA;AAAA,MACE,WAAWC,oBAAAA,QAAW,cAAc,SAAS;AAAA,MAC7C,GAAG;AAAA,IAAA;AAAA,IAEL;AAAA,EAAA;AAEJ;AAQO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAoC;AAClC,MAAI,QAAQ,MAAM;AAChB,WAAOD,aAAAA;AAAAA,MACL;AAAA,MACA;AAAA,QACE,WAAW;AAAA,QACX,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,IAAA;AAAA,EAEJ;AAEA,SAAOA,aAAAA,QAAE,YAAY;AAAA,IACnB,WAAW;AAAA,IACX,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,GAAG;AAAA,EAAA,CACJ;AACH;;;;"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ItemInteractionProps } from '@macrostrat/data-components';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
export declare function ClickableText({ className, ...rest }: {
|
|
4
|
-
className?: string;
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
} & ItemInteractionProps): import('react').ReactElement<{
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
href?: string | null;
|
|
9
|
-
target?: string;
|
|
10
|
-
onClick?: (event: MouseEvent) => void;
|
|
11
|
-
className: string;
|
|
12
|
-
}, string | import('react').JSXElementConstructor<any>>;
|
|
13
|
-
export declare function Identifier({ id, className, ...rest }: {
|
|
14
|
-
id: number | string;
|
|
15
|
-
className?: string;
|
|
16
|
-
} & ItemInteractionProps): import('react').FunctionComponentElement<{
|
|
17
|
-
className?: string;
|
|
18
|
-
children: ReactNode;
|
|
19
|
-
} & ItemInteractionProps>;
|
|
20
|
-
export type UnitInfo = {
|
|
21
|
-
unitID: number;
|
|
22
|
-
colID?: number;
|
|
23
|
-
name?: string;
|
|
24
|
-
};
|
|
25
|
-
export declare function UnitIdentifier({ unitID, colID, name, ...interactionProps }: UnitInfo & ItemInteractionProps): import('react').FunctionComponentElement<{
|
|
26
|
-
className?: string;
|
|
27
|
-
children: ReactNode;
|
|
28
|
-
} & ItemInteractionProps> | import('react').FunctionComponentElement<{
|
|
29
|
-
id: number | string;
|
|
30
|
-
className?: string;
|
|
31
|
-
} & ItemInteractionProps>;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { isClickable } from "@macrostrat/data-components";
|
|
2
|
-
import h from "./panel.module.sass.js";
|
|
3
|
-
import classNames from "classnames";
|
|
4
|
-
function ClickableText({
|
|
5
|
-
className,
|
|
6
|
-
...rest
|
|
7
|
-
}) {
|
|
8
|
-
const clickable = isClickable(rest);
|
|
9
|
-
const tag = clickable ? "a" : "span";
|
|
10
|
-
return h(tag, { className: classNames(className, { clickable }), ...rest });
|
|
11
|
-
}
|
|
12
|
-
function Identifier({
|
|
13
|
-
id,
|
|
14
|
-
className,
|
|
15
|
-
...rest
|
|
16
|
-
}) {
|
|
17
|
-
return h(
|
|
18
|
-
ClickableText,
|
|
19
|
-
{
|
|
20
|
-
className: classNames("identifier", className),
|
|
21
|
-
...rest
|
|
22
|
-
},
|
|
23
|
-
id
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
function UnitIdentifier({
|
|
27
|
-
unitID,
|
|
28
|
-
colID,
|
|
29
|
-
name,
|
|
30
|
-
...interactionProps
|
|
31
|
-
}) {
|
|
32
|
-
if (name != null) {
|
|
33
|
-
return h(
|
|
34
|
-
ClickableText,
|
|
35
|
-
{
|
|
36
|
-
className: "unit-name",
|
|
37
|
-
...interactionProps
|
|
38
|
-
},
|
|
39
|
-
name
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
return h(Identifier, {
|
|
43
|
-
className: "unit-id",
|
|
44
|
-
key: unitID,
|
|
45
|
-
id: unitID,
|
|
46
|
-
...interactionProps
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
export {
|
|
50
|
-
ClickableText,
|
|
51
|
-
Identifier,
|
|
52
|
-
UnitIdentifier
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=identifiers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifiers.js","sources":["../../src/unit-details/identifiers.ts"],"sourcesContent":["import { isClickable, ItemInteractionProps } from \"@macrostrat/data-components\";\nimport h from \"./panel.module.sass\";\nimport { ReactNode } from \"react\";\nimport classNames from \"classnames\";\n\nexport function ClickableText({\n className,\n ...rest\n}: {\n className?: string;\n children: ReactNode;\n} & ItemInteractionProps) {\n /** An optionally clickable text element */\n const clickable = isClickable(rest);\n const tag = clickable ? \"a\" : \"span\";\n return h(tag, { className: classNames(className, { clickable }), ...rest });\n}\n\nexport function Identifier({\n id,\n className,\n ...rest\n}: {\n id: number | string;\n className?: string;\n} & ItemInteractionProps) {\n /** An item that displays a numeric identifier, optionally clickable */\n return h(\n ClickableText,\n {\n className: classNames(\"identifier\", className),\n ...rest,\n },\n id,\n );\n}\n\nexport type UnitInfo = {\n unitID: number;\n colID?: number;\n name?: string;\n};\n\nexport function UnitIdentifier({\n unitID,\n colID,\n name,\n ...interactionProps\n}: UnitInfo & ItemInteractionProps) {\n if (name != null) {\n return h(\n ClickableText,\n {\n className: \"unit-name\",\n ...interactionProps,\n },\n name,\n );\n }\n\n return h(Identifier, {\n className: \"unit-id\",\n key: unitID,\n id: unitID,\n ...interactionProps,\n });\n}\n"],"names":[],"mappings":";;;AAKO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,GAAG;AACL,GAG0B;AAExB,QAAM,YAAY,YAAY,IAAI;AAClC,QAAM,MAAM,YAAY,MAAM;AAC9B,SAAO,EAAE,KAAK,EAAE,WAAW,WAAW,WAAW,EAAE,UAAA,CAAW,GAAG,GAAG,MAAM;AAC5E;AAEO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAG0B;AAExB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,WAAW,WAAW,cAAc,SAAS;AAAA,MAC7C,GAAG;AAAA,IAAA;AAAA,IAEL;AAAA,EAAA;AAEJ;AAQO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAoC;AAClC,MAAI,QAAQ,MAAM;AAChB,WAAO;AAAA,MACL;AAAA,MACA;AAAA,QACE,WAAW;AAAA,QACX,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,IAAA;AAAA,EAEJ;AAEA,SAAO,EAAE,YAAY;AAAA,IACnB,WAAW;AAAA,IACX,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,GAAG;AAAA,EAAA,CACJ;AACH;"}
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import { Meta } from "@storybook/react-vite";
|
|
2
|
-
import "@macrostrat/style-system";
|
|
3
|
-
import { useCorrelationLine } from "./utils";
|
|
4
|
-
import {
|
|
5
|
-
ColumnCorrelationMap,
|
|
6
|
-
ColumnCorrelationProvider,
|
|
7
|
-
MergeSectionsMode,
|
|
8
|
-
useCorrelationMapStore,
|
|
9
|
-
} from "../..";
|
|
10
|
-
import { hyperStyled } from "@macrostrat/hyper";
|
|
11
|
-
import {
|
|
12
|
-
MacrostratDataProvider,
|
|
13
|
-
fetchUnits,
|
|
14
|
-
useMacrostratFetch,
|
|
15
|
-
} from "@macrostrat/data-provider";
|
|
16
|
-
|
|
17
|
-
import styles from "./stories.module.sass";
|
|
18
|
-
import { CorrelationChart, CorrelationChartProps } from "../main";
|
|
19
|
-
import { ErrorBoundary, useAsyncMemo } from "@macrostrat/ui-components";
|
|
20
|
-
import { OverlaysProvider } from "@blueprintjs/core";
|
|
21
|
-
import { EnvironmentColoredUnitComponent } from "../../units";
|
|
22
|
-
import { scaleLinear, scalePow } from "d3-scale";
|
|
23
|
-
import { MacrostratInteractionProvider } from "@macrostrat/data-components";
|
|
24
|
-
|
|
25
|
-
const mapboxToken = import.meta.env.VITE_MAPBOX_API_TOKEN;
|
|
26
|
-
|
|
27
|
-
const h = hyperStyled(styles);
|
|
28
|
-
|
|
29
|
-
function CorrelationStoryUI({
|
|
30
|
-
focusedLine,
|
|
31
|
-
setFocusedLine,
|
|
32
|
-
columnID,
|
|
33
|
-
setColumn,
|
|
34
|
-
selectedUnit,
|
|
35
|
-
setSelectedUnit,
|
|
36
|
-
inProcess,
|
|
37
|
-
projectID,
|
|
38
|
-
...rest
|
|
39
|
-
}: any) {
|
|
40
|
-
const domain = "https://dev.macrostrat.org";
|
|
41
|
-
return h(
|
|
42
|
-
MacrostratDataProvider,
|
|
43
|
-
{ baseURL: domain + "/api/v2" },
|
|
44
|
-
h(
|
|
45
|
-
MacrostratInteractionProvider,
|
|
46
|
-
{ linkDomain: domain },
|
|
47
|
-
h(
|
|
48
|
-
ColumnCorrelationProvider,
|
|
49
|
-
{
|
|
50
|
-
focusedLine,
|
|
51
|
-
columns: null,
|
|
52
|
-
projectID,
|
|
53
|
-
onSelectColumns(cols, line) {
|
|
54
|
-
setFocusedLine(line);
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
h("div.correlation-ui", [
|
|
58
|
-
h("div.correlation-container", h(CorrelationDiagramWrapper, rest)),
|
|
59
|
-
h("div.right-column", [
|
|
60
|
-
h(ColumnCorrelationMap, {
|
|
61
|
-
accessToken: mapboxToken,
|
|
62
|
-
className: "correlation-map",
|
|
63
|
-
//showLogo: false,
|
|
64
|
-
}),
|
|
65
|
-
]),
|
|
66
|
-
]),
|
|
67
|
-
),
|
|
68
|
-
),
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function CorrelationDiagramWrapper(props: Omit<CorrelationChartProps, "data">) {
|
|
73
|
-
/** This state management is a bit too complicated, but it does kinda sorta work */
|
|
74
|
-
|
|
75
|
-
const fetch = useMacrostratFetch();
|
|
76
|
-
|
|
77
|
-
// Sync focused columns with map
|
|
78
|
-
const focusedColumns = useCorrelationMapStore(
|
|
79
|
-
(state) => state.focusedColumns,
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
const columnUnits = useAsyncMemo(async () => {
|
|
83
|
-
const col_ids = focusedColumns.map((col) => col.properties.col_id);
|
|
84
|
-
return await fetchUnits(col_ids, fetch);
|
|
85
|
-
}, [focusedColumns]);
|
|
86
|
-
|
|
87
|
-
return h("div.correlation-diagram", [
|
|
88
|
-
h(
|
|
89
|
-
ErrorBoundary,
|
|
90
|
-
h(OverlaysProvider, [
|
|
91
|
-
h(CorrelationChart, { data: columnUnits, ...props }),
|
|
92
|
-
]),
|
|
93
|
-
),
|
|
94
|
-
]);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export default {
|
|
98
|
-
title: "Column views/Correlation chart",
|
|
99
|
-
component: CorrelationStoryUI,
|
|
100
|
-
parameters: {
|
|
101
|
-
layout: "fullscreen",
|
|
102
|
-
docs: {
|
|
103
|
-
description: {
|
|
104
|
-
component: "Correlation chart for Macrostrat columns",
|
|
105
|
-
},
|
|
106
|
-
story: {
|
|
107
|
-
inline: false,
|
|
108
|
-
iframeHeight: 500,
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
args: {
|
|
113
|
-
focusedLine: "-100,45 -90,50",
|
|
114
|
-
columnSpacing: 0,
|
|
115
|
-
columnWidth: 100,
|
|
116
|
-
collapseSmallUnconformities: true,
|
|
117
|
-
targetUnitHeight: 20,
|
|
118
|
-
},
|
|
119
|
-
argTypes: {
|
|
120
|
-
selectedUnit: {
|
|
121
|
-
control: {
|
|
122
|
-
type: "number",
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
t_age: {
|
|
126
|
-
control: {
|
|
127
|
-
type: "number",
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
b_age: {
|
|
131
|
-
control: {
|
|
132
|
-
type: "number",
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
columnSpacing: {
|
|
136
|
-
control: {
|
|
137
|
-
type: "number",
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
columnWidth: {
|
|
141
|
-
control: {
|
|
142
|
-
type: "number",
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
mergeSections: {
|
|
146
|
-
options: ["all", "overlapping", null],
|
|
147
|
-
control: { type: "radio" },
|
|
148
|
-
},
|
|
149
|
-
pixelScale: {
|
|
150
|
-
control: {
|
|
151
|
-
type: "number",
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
collapseSmallUnconformities: {
|
|
155
|
-
control: {
|
|
156
|
-
type: "boolean",
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
minSectionHeight: {
|
|
160
|
-
control: {
|
|
161
|
-
type: "number",
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
targetUnitHeight: {
|
|
165
|
-
control: {
|
|
166
|
-
type: "number",
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
showLabelColumn: {
|
|
170
|
-
control: {
|
|
171
|
-
type: "boolean",
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
maxInternalColumns: {
|
|
175
|
-
control: {
|
|
176
|
-
type: "number",
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
projectID: {
|
|
180
|
-
control: {
|
|
181
|
-
type: "number",
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
} as Meta<typeof CorrelationStoryUI>;
|
|
186
|
-
|
|
187
|
-
function Template(args) {
|
|
188
|
-
return h(CorrelationStoryUI, {
|
|
189
|
-
...args,
|
|
190
|
-
...useCorrelationLine(),
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export const Primary = Template.bind({});
|
|
195
|
-
|
|
196
|
-
export const ColoredByEnvironment = Template.bind({});
|
|
197
|
-
ColoredByEnvironment.args = {
|
|
198
|
-
unitComponent: EnvironmentColoredUnitComponent,
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
export const RestrictedAgeRange = Template.bind({});
|
|
202
|
-
RestrictedAgeRange.args = {
|
|
203
|
-
t_age: 100,
|
|
204
|
-
b_age: 300,
|
|
205
|
-
focusedLine: "-114.29,42.74 -104.59,39.21",
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
export const WithFixedScale = Template.bind({});
|
|
209
|
-
WithFixedScale.args = {
|
|
210
|
-
scale: scaleLinear().domain([0, 2500]).range([0, 1000]),
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
export const WithPowerScale = Template.bind({});
|
|
214
|
-
WithPowerScale.args = {
|
|
215
|
-
scale: scalePow().exponent(0.3).domain([0, 2500]).range([0, 1000]),
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
export const WithPowerScaleMerged = Template.bind({});
|
|
219
|
-
WithPowerScaleMerged.args = {
|
|
220
|
-
scale: scalePow().exponent(0.3).domain([0, 2500]).range([0, 1000]),
|
|
221
|
-
mergeSections: MergeSectionsMode.ALL,
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
export const eODPCorrelationChart = Template.bind({});
|
|
225
|
-
eODPCorrelationChart.args = {
|
|
226
|
-
focusedLine: "-125,38 -120,32",
|
|
227
|
-
projectID: 3,
|
|
228
|
-
};
|