Skip to content

Commit a72877c

Browse files
committed
Merge branch 'svg-map-updates'
* svg-map-updates: Updated svg map components and column components Updated to new D3 dependencies
2 parents f47f056 + a8924e1 commit a72877c

File tree

15 files changed

+265
-296
lines changed

15 files changed

+265
-296
lines changed

packages/column-components/CHANGELOG.md

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

7+
## [1.0.1] - 2025-02-14
8+
9+
- Update d3 dependencies to [v6](https://observablehq.com/@d3/d3v6-migration-guide)
10+
- Remove `prop-types` dependency
11+
712
## [1.0.0] - 2025-02-14
813

914
- First full release of the `@macrostrat/column-components` library

packages/column-components/package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@macrostrat/column-components",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "React rendering primitives for stratigraphic columns",
55
"keywords": [
66
"geology",
@@ -45,16 +45,14 @@
4545
"@macrostrat/ui-components": "workspace:^",
4646
"chroma-js": "^2.1.0",
4747
"classnames": "^2.2.6",
48-
"d3-axis": "^1.0.12",
49-
"d3-format": "^1.4.3",
50-
"d3-path": "^1.0.9",
48+
"d3-axis": "^3.0.0",
49+
"d3-format": "^3.1.0",
50+
"d3-path": "^3.1.0",
5151
"d3-scale": "^3.2.1",
52-
"d3-selection": "^1.4.1",
52+
"d3-selection": "^3.0.0",
5353
"fscreen": "^1.0.2",
54-
"geologic-patterns": "2.0.0-dev1",
5554
"immutability-helper": "^3.0.2",
5655
"labella": "^1.1.4",
57-
"prop-types": "^15.7.2",
5856
"react-color": "^2.18.0",
5957
"react-draggable": "^4.4.5",
6058
"react-images": "^1.1.0-beta.1",

packages/column-components/src/context/model-editor.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,23 @@ import {
44
useState,
55
useEffect,
66
useCallback,
7+
ReactNode,
78
} from "react";
89
import update from "immutability-helper";
910
import h from "@macrostrat/hyper";
10-
import T from "prop-types";
1111

1212
const ModelEditorContext = createContext(null);
1313

14-
const ModelEditorProvider = function (props) {
14+
interface ModelEditorProviderProps {
15+
model: any;
16+
onConfirmChanges: (model: any) => void;
17+
onDelete: (model: any) => void;
18+
logUpdates?: boolean;
19+
alwaysConfirm?: boolean;
20+
children: ReactNode;
21+
}
22+
23+
function ModelEditorProvider(props: ModelEditorProviderProps) {
1524
/*
1625
Context to assist with editing a model
1726
*/
@@ -70,12 +79,7 @@ const ModelEditorProvider = function (props) {
7079
confirmChanges,
7180
};
7281
return h(ModelEditorContext.Provider, { value }, children);
73-
};
74-
75-
ModelEditorProvider.propTypes = {
76-
onConfirmChanges: T.func.isRequired,
77-
onDelete: T.func.isRequired,
78-
};
82+
}
7983

8084
const useModelEditor = () => useContext(ModelEditorContext);
8185

packages/column-components/src/editor/types.ts

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

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

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { Component, useContext } from "react";
22
import h from "@macrostrat/hyper";
33
import classNames from "classnames";
4-
import T from "prop-types";
54
import {
65
SimpleFrame,
76
GrainsizeFrame,
@@ -95,10 +94,6 @@ class ColumnRect extends Component<ColumnRectProps> {
9594
padWidth: false,
9695
};
9796

98-
constructor(props) {
99-
super(props);
100-
}
101-
10297
render() {
10398
const { scale } = this.context;
10499
let { division: d, padWidth, key, width, ...rest } = this.props;
@@ -137,9 +132,15 @@ const expandDivisionsByKey = function (
137132
}
138133
};
139134

140-
const ParameterIntervals = function (props) {
135+
interface ParameterIntervalsProps {
136+
padWidth: number;
137+
parameter: string;
138+
fillForInterval(param: any, division: ColumnDivision): any;
139+
}
140+
141+
function ParameterIntervals(props: ParameterIntervalsProps) {
141142
const { divisions, width } = useContext(ColumnLayoutContext);
142-
const { padWidth, parameter: key, fillForInterval, minimumHeight } = props;
143+
const { padWidth, parameter: key, fillForInterval } = props;
143144
const newDivisions = expandDivisionsByKey(divisions, key);
144145
if (newDivisions.length === 1) {
145146
return null;
@@ -157,13 +158,7 @@ const ParameterIntervals = function (props) {
157158
})
158159
)
159160
);
160-
};
161-
162-
ParameterIntervals.propTypes = {
163-
padWidth: T.number,
164-
parameter: T.string.isRequired,
165-
fillForInterval: T.func.isRequired,
166-
};
161+
}
167162

168163
const FaciesIntervals = function (props) {
169164
const { getFaciesColor } = useContext(FaciesContext) as any;

packages/column-components/src/notes/defs.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
/*
2-
* decaffeinate suggestions:
3-
* DS102: Remove unnecessary code created because of implicit returns
4-
* DS207: Consider shorter variations of null checks
5-
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
6-
*/
7-
import { findDOMNode } from "react-dom";
8-
import { Component, createElement } from "react";
91
import h from "@macrostrat/hyper";
10-
import T from "prop-types";
112

123
const ArrowMarker = function ({ id, orient, size: sz, fill }) {
134
if (fill == null) {
Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
1-
/*
2-
* decaffeinate suggestions:
3-
* DS102: Remove unnecessary code created because of implicit returns
4-
* DS207: Consider shorter variations of null checks
5-
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
6-
*/
71
import { useContext } from "react";
82
import h from "../hyper";
9-
import T from "prop-types";
103
import { NoteLayoutContext } from "./layout";
114

12-
const HeightRangeAnnotation = function(props) {
5+
interface HeightRangeAnnotationProps {
6+
height: number;
7+
top_height?: number;
8+
offsetX?: number;
9+
color?: string;
10+
lineInset?: number;
11+
}
12+
13+
function HeightRangeAnnotation(props: HeightRangeAnnotationProps) {
1314
const { scale } = useContext(NoteLayoutContext);
14-
const { height, top_height, offsetX, color, lineInset = 2.5, ...rest } = props;
15+
const {
16+
height,
17+
top_height,
18+
offsetX = 0,
19+
color,
20+
lineInset = 2.5,
21+
...rest
22+
} = props;
1523

1624
const bottomHeight = scale(height);
1725
let pxHeight = 0;
@@ -20,7 +28,7 @@ const HeightRangeAnnotation = function(props) {
2028
}
2129
const topHeight = bottomHeight - pxHeight;
2230

23-
const isLine = pxHeight > 2*lineInset;
31+
const isLine = pxHeight > 2 * lineInset;
2432

2533
const transform = `translate(${offsetX},${topHeight})`;
2634

@@ -29,20 +37,13 @@ const HeightRangeAnnotation = function(props) {
2937
x1: 0,
3038
x2: 0,
3139
y1: lineInset,
32-
y2: pxHeight - lineInset
40+
y2: pxHeight - lineInset,
41+
}),
42+
h.if(!isLine)("circle", {
43+
r: 2,
44+
transform: `translate(0,${pxHeight / 2})`,
3345
}),
34-
h.if(!isLine)("circle", { r: 2, transform: `translate(0,${pxHeight/2})`}),
3546
]);
36-
};
37-
38-
HeightRangeAnnotation.propTypes = {
39-
height: T.number.isRequired,
40-
top_height: T.number,
41-
offsetX: T.number
42-
};
43-
44-
HeightRangeAnnotation.defaultProps = {
45-
offsetX: 0
46-
};
47+
}
4748

4849
export { HeightRangeAnnotation };

packages/column-components/src/symbol-column.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
AssetPathCtx,
1010
} from "./context";
1111
import { UUIDComponent } from "./frame";
12-
import T from "prop-types";
1312

1413
const symbolIndex = {
1514
"Hummocky cross-stratified": "hcs.svg",

packages/svg-map-components/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
## Changelog
22

3+
### [1.0.2] - 2025-02-14
4+
5+
- Fix an issue with map sizing (height was mistakenly set to width).
6+
- Upgrade D3 dependencies to latest [v6](https://observablehq.com/@d3/d3v6-migration-guide) versions
7+
38
### [1.0.1] - 2025-02-14
49

510
- Added `src` files to deployment package.

packages/svg-map-components/package.json

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@macrostrat/svg-map-components",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "React components for vector maps",
55
"keywords": [
66
"gis",
@@ -22,33 +22,27 @@
2222
"url": "https://github.com/UW-Macrostrat/web-components.git",
2323
"directory": "packages/svg-map-components"
2424
},
25-
"license": "MIT",
26-
"engines": {
27-
"node": ">=6.0.0"
28-
},
2925
"scripts": {
3026
"build": "rm -rf dist && parcel build"
3127
},
3228
"dependencies": {
3329
"@macrostrat/hyper": "^3.0.6",
3430
"@macrostrat/ui-components": "workspace:^",
35-
"@swc/helpers": "^0.5.15",
36-
"@types/d3-array": "^2.0.0",
37-
"@types/d3-drag": "^1.2.3",
38-
"@types/d3-geo": "^1.12.3",
39-
"@types/d3-selection": "^1.4.2",
40-
"@types/d3-zoom": "^1.7.4",
31+
"@types/d3-array": "^3.0.0",
32+
"@types/d3-drag": "^3.0.0",
33+
"@types/d3-geo": "^3.0.0",
34+
"@types/d3-selection": "^3.0.0",
35+
"@types/d3-zoom": "^3.0.0",
4136
"@types/geojson": "^7946.0.8",
4237
"@types/react-dom": "^16.9.8||^17.0.6||^18.0.0",
4338
"axios": "^1.7.9",
4439
"d3-array": "^3.2.4",
45-
"d3-drag": "^1.2.5",
46-
"d3-geo": "^1.11.9",
47-
"d3-selection": "^1.4.1",
48-
"d3-zoom": "^1.8.3",
40+
"d3-drag": "^3.0.0",
41+
"d3-geo": "^3.1.1",
42+
"d3-selection": "^3.0.0",
43+
"d3-zoom": "^3.0.0",
4944
"kld-intersections": "^0.7.0",
5045
"kld-path-parser": "^0.2.1",
51-
"prop-types": "^15.8.1",
5246
"topojson-client": "^3.1.0"
5347
},
5448
"peerDependencies": {
@@ -63,7 +57,6 @@
6357
}
6458
},
6559
"devDependencies": {
66-
"@types/prop-types": "^15",
6760
"parcel": "^2.13.3"
6861
}
6962
}

0 commit comments

Comments
 (0)