Skip to content

Commit bc035a9

Browse files
committed
* 'main' of https://github.com/UW-Macrostrat/web-components: Apply formatting changes Update packaging Updated static map utils Updated timescale Static map mostly works Basic map utilities Basic static map generation module Updates to flooding-surfaces component Updated styles Updated groups Allow column heights to be rewritten Fixed frame component Size aware label fixes Removed symbol column from library
2 parents 7afac32 + 6e4f846 commit bc035a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1925
-358
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ packages/*/dist
3737

3838
.idea/workspace.xml
3939
.idea/tasks.xml
40+
.npmrc

.storybook/preview.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ export const decorators = [
6262

6363
export const tags = ["autodocs"];
6464

65+
export function resolvePattern(id: string) {
66+
return `https://dev.macrostrat.org/assets/geologic-patterns/svg/${id}.svg`;
67+
}
68+
6569
function PatternProvider({ children }) {
6670
return h(GeologicPatternProvider, {
67-
resolvePattern(id: string) {
68-
return `https://dev.macrostrat.org/assets/geologic-patterns/svg/${id}.svg`;
69-
},
71+
resolvePattern,
7072
children,
7173
});
7274
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"date-fns": "^4.1.0",
4545
"glob": "^11.0.1",
4646
"lorem-ipsum": "^2.0.8",
47+
"maplibregl-mapbox-request-transformer": "^0.0.3",
4748
"marked": "^11.0",
4849
"marked-terminal": "^7.1.0",
4950
"node-fetch": "^3.2.9",

packages/column-components/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format
44
is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this
55
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.3.0] - 2025-10-29
8+
9+
- Switch to `@visx/axis` for axis rendering
10+
- Remove `SymbolColumn` component
11+
- Simplify many components
12+
- Improve surface generation
13+
714
## [1.2.0] - 2025-06-25
815

916
Major improvement and modernization for `Note` component for section-aligned

packages/column-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@macrostrat/column-components",
3-
"version": "1.2.0",
3+
"version": "1.3.0",
44
"description": "React rendering primitives for stratigraphic columns",
55
"keywords": [
66
"geology",

packages/column-components/src/context/asset-path.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

packages/column-components/src/context/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ export * from "./layout";
33
export * from "./facies";
44
export * from "./settings";
55
export * from "./lithology";
6-
export * from "./asset-path";
76
export * from "./model-editor";

packages/column-components/src/flooding-surface.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export class TriangleBars extends UUIDComponent<TriangleBarsProps> {
109109
zigZagLine(lineWidth, -lineWidth, 0, 16, 3);
110110
_.closePath();
111111

112-
return h("g.triangle-bars", {}, [
112+
return h("g.triangle-bars", [
113113
h("defs", [
114114
createElement("clipPath", { id: this.UUID }, [
115115
h("path", { d: _.toString(), key: this.UUID + "-path" }),
@@ -128,7 +128,7 @@ export class TriangleBars extends UUIDComponent<TriangleBarsProps> {
128128
}
129129
const w = lineWidth / 2;
130130
const ol = offsetLeft + lineWidth * 2 + 5;
131-
const __ = [];
131+
const surfaces: SequenceStratSurface[] = [];
132132

133133
for (i = 0; i < divisions.length; i++) {
134134
d = divisions[i];
@@ -141,31 +141,31 @@ export class TriangleBars extends UUIDComponent<TriangleBarsProps> {
141141
}
142142
const height = scale(d.bottom);
143143
if (surface_type === "mfs") {
144-
__.push(["mfs", height]);
144+
surfaces.push(["mfs", height]);
145145
}
146146
if (surface_type === "sb") {
147-
if (__.length === 0) {
148-
__.push(["sb", height]);
147+
if (surfaces.length === 0) {
148+
surfaces.push(["sb", height]);
149149
continue;
150150
}
151-
const sz = __.length - 1;
152-
if (__[sz][0] === "sb") {
153-
__[sz][1] = height;
151+
const sz = surfaces.length - 1;
152+
if (surfaces[sz][0] === "sb") {
153+
surfaces[sz][1] = height;
154154
} else {
155-
__.push(["sb", height]);
155+
surfaces.push(["sb", height]);
156156
}
157157
}
158158
}
159159

160-
if (!__.length) {
160+
if (!surfaces.length) {
161161
return null;
162162
}
163163

164164
const _ = path();
165165
let basalMFS = null;
166166
let sequenceBoundary = null;
167-
for (i = 0; i < __.length; i++) {
168-
const top = __[i];
167+
for (i = 0; i < surfaces.length; i++) {
168+
const top = surfaces[i];
169169
if (top[0] === "mfs" && basalMFS != null) {
170170
_.moveTo(0, basalMFS[1]);
171171
if (sequenceBoundary != null) {
@@ -199,3 +199,5 @@ export class TriangleBars extends UUIDComponent<TriangleBarsProps> {
199199
);
200200
}
201201
}
202+
203+
type SequenceStratSurface = ["mfs" | "sb", number];

packages/column-components/src/frame.module.sass

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/column-components/src/frame.ts

Lines changed: 49 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ import {
66
useRef,
77
ReactNode,
88
} from "react";
9-
import hyper from "@macrostrat/hyper";
9+
import h from "@macrostrat/hyper";
1010
import { path } from "d3-path";
11-
import { ColumnLayoutContext, ColumnLayoutCtx } from "./context";
12-
import styles from "./frame.module.sass";
13-
const h = hyper.styled(styles);
11+
import {
12+
ColumnLayoutContext,
13+
ColumnLayoutCtx,
14+
useColumnLayout,
15+
} from "./context";
16+
import { drawZigZagAtConstantHeight } from "./util";
1417

1518
let sequence = 0; // Initialize a sequence counter
1619
function getUniqueIdentifier() {
@@ -72,16 +75,14 @@ function SimpleFrame(props: FrameProps) {
7275

7376
interface GrainsizeFrameProps {
7477
id: string;
78+
zigZagBottom?: boolean;
79+
zigZagTop?: boolean;
7580
}
7681

7782
function GrainsizeFrame(props: GrainsizeFrameProps) {
78-
let { id: frameID } = props;
83+
let { id: frameID, zigZagBottom = false, zigZagTop = false } = props;
7984

80-
const {
81-
scale,
82-
divisions,
83-
grainsizeScale: gs,
84-
} = useContext(ColumnLayoutContext);
85+
const { scale, divisions, grainsizeScale: gs } = useColumnLayout();
8586
if (frameID.startsWith("#")) {
8687
frameID = frameID.slice(1);
8788
}
@@ -106,7 +107,7 @@ function GrainsizeFrame(props: GrainsizeFrameProps) {
106107
return scale(bottom);
107108
};
108109

109-
const filteredDivisions = divisions.filter(function (d) {
110+
const filteredDivisions = Array.from(divisions).filter(function (d) {
110111
if (d.top <= bottomOfSection) {
111112
return false;
112113
}
@@ -116,28 +117,50 @@ function GrainsizeFrame(props: GrainsizeFrameProps) {
116117
return true;
117118
});
118119

119-
let _ = null;
120+
let d = path();
120121
let currentGrainsize = "m";
121-
let div: any = null;
122-
for (div of Array.from(filteredDivisions)) {
123-
if (_ == null) {
124-
_ = path();
125-
_.moveTo(0, bottomOf(div));
122+
let i = 0;
123+
for (const div of filteredDivisions) {
124+
if (i === 0) {
125+
// First division
126+
// start the path at the bottom
127+
const y = bottomOf(div);
128+
d.moveTo(0, y);
126129
}
127130
if (div.grainsize != null) {
128131
currentGrainsize = div.grainsize;
129132
}
130-
const x = gs(currentGrainsize);
131-
_.lineTo(x, bottomOf(div));
132-
_.lineTo(x, topOf(div));
133+
const x1 = gs(currentGrainsize);
134+
if (i === 0 && zigZagBottom) {
135+
// Draw zig-zag at bottom
136+
drawZigZagAtConstantHeight(d, 0, x1, bottomOf(div));
137+
} else {
138+
// Draw a normal line
139+
d.lineTo(x1, bottomOf(div));
140+
}
141+
142+
d.lineTo(x1, bottomOf(div));
143+
d.lineTo(x1, topOf(div));
144+
145+
if (i === filteredDivisions.length - 1) {
146+
// Last division
147+
// Draw top
148+
if (zigZagTop) {
149+
drawZigZagAtConstantHeight(d, x1, 0, topOf(div));
150+
} else {
151+
d.lineTo(0, topOf(div));
152+
}
153+
}
154+
155+
i++;
133156
}
134-
_.lineTo(0, topOf(div));
135-
_.closePath();
157+
158+
d.closePath();
136159

137160
return h("path", {
138161
id: frameID,
139162
key: frameID,
140-
d: _.toString(),
163+
d: d.toString(),
141164
});
142165
}
143166

@@ -201,7 +224,7 @@ export function ClippingFrame(props: ClipToFrameProps) {
201224
transform = `translate(${left} ${shiftY})`;
202225
}
203226

204-
const frameClassName = "frame";
227+
const frameClassName = "clip-frame column-clip-frame";
205228

206229
let _frame: ReactNode = h(frame, { id: frameID, className: frameClassName });
207230
let defs = null;
@@ -217,8 +240,9 @@ export function ClippingFrame(props: ClipToFrameProps) {
217240

218241
return h("g", { className, transform, onClick }, [
219242
defs,
220-
_frame,
221243
h("g.inner", { clipPath }, children),
244+
// Frame must go last
245+
_frame,
222246
]);
223247
}
224248

0 commit comments

Comments
 (0)