Skip to content

Commit 8f3762b

Browse files
authored
Fix default props (again) (#75)
* Fix default props (again) * bump version
1 parent 49cc227 commit 8f3762b

10 files changed

+91
-54
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"examples/*"
55
],
66
"name": "@geoarrow/deck.gl-layers",
7-
"version": "0.3.0-beta.5",
7+
"version": "0.3.0-beta.6",
88
"type": "module",
99
"description": "",
1010
"source": "src/index.ts",

src/arc-layer.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,14 @@ const {
9797
..._defaultProps
9898
} = ArcLayer.defaultProps;
9999

100+
// Default props added by us
101+
const ourDefaultProps = {
102+
_validate: true,
103+
};
104+
100105
const defaultProps: DefaultProps<GeoArrowArcLayerProps> = {
101106
..._defaultProps,
102-
_validate: true,
107+
...ourDefaultProps,
103108
};
104109

105110
export class GeoArrowArcLayer<
@@ -151,9 +156,8 @@ export class GeoArrowArcLayer<
151156

152157
const props: ArcLayerProps = {
153158
// Note: because this is a composite layer and not doing the rendering
154-
// itself, we still have to pass in defaultProps as the default in this
155-
// props object
156-
...defaultProps,
159+
// itself, we still have to pass in our defaultProps
160+
...ourDefaultProps,
157161
...otherProps,
158162

159163
// @ts-expect-error used for picking purposes

src/column-layer.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,14 @@ const {
8989
..._defaultProps
9090
} = ColumnLayer.defaultProps;
9191

92+
// Default props added by us
93+
const ourDefaultProps = {
94+
_validate: true,
95+
};
96+
9297
const defaultProps: DefaultProps<GeoArrowColumnLayerProps> = {
9398
..._defaultProps,
94-
_validate: true,
99+
...ourDefaultProps,
95100
};
96101

97102
/**
@@ -151,9 +156,8 @@ export class GeoArrowColumnLayer<
151156

152157
const props: ColumnLayerProps = {
153158
// Note: because this is a composite layer and not doing the rendering
154-
// itself, we still have to pass in defaultProps as the default in this
155-
// props object
156-
...defaultProps,
159+
// itself, we still have to pass in our defaultProps
160+
...ourDefaultProps,
157161
...otherProps,
158162

159163
// @ts-expect-error used for picking purposes

src/h3-hexagon-layer.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,14 @@ const {
4545
..._defaultProps
4646
} = H3HexagonLayer.defaultProps;
4747

48+
// Default props added by us
49+
const ourDefaultProps = {
50+
_validate: true,
51+
};
52+
4853
const defaultProps: DefaultProps<GeoArrowH3HexagonLayerProps> = {
4954
..._defaultProps,
50-
_validate: true,
55+
...ourDefaultProps,
5156
};
5257

5358
export class GeoArrowH3HexagonLayer<
@@ -87,9 +92,8 @@ export class GeoArrowH3HexagonLayer<
8792

8893
const props: H3HexagonLayerProps = {
8994
// Note: because this is a composite layer and not doing the rendering
90-
// itself, we still have to pass in defaultProps as the default in this
91-
// props object
92-
...defaultProps,
95+
// itself, we still have to pass in our defaultProps
96+
...ourDefaultProps,
9397
...otherProps,
9498

9599
// @ts-expect-error used for picking purposes

src/heatmap-layer.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,14 @@ const {
5959
..._defaultProps
6060
} = HeatmapLayer.defaultProps;
6161

62+
// Default props added by us
63+
const ourDefaultProps = {
64+
_validate: true,
65+
};
66+
6267
const defaultProps: DefaultProps<GeoArrowHeatmapLayerProps> = {
6368
..._defaultProps,
64-
_validate: true,
69+
...ourDefaultProps,
6570
};
6671

6772
export class GeoArrowHeatmapLayer<
@@ -113,9 +118,8 @@ export class GeoArrowHeatmapLayer<
113118

114119
const props: HeatmapLayerProps = {
115120
// Note: because this is a composite layer and not doing the rendering
116-
// itself, we still have to pass in defaultProps as the default in this
117-
// props object
118-
...defaultProps,
121+
// itself, we still have to pass in our defaultProps
122+
...ourDefaultProps,
119123
...otherProps,
120124

121125
// @ts-expect-error used for picking purposes

src/path-layer.ts

+18-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
Accessor,
23
CompositeLayer,
34
CompositeLayerProps,
45
DefaultProps,
@@ -76,15 +77,21 @@ const {
7677
..._defaultProps
7778
} = PathLayer.defaultProps;
7879

80+
// Default props added by us
81+
const ourDefaultProps: Pick<GeoArrowPathLayerProps, "_pathType" | "_validate"> =
82+
{
83+
// Note: this diverges from upstream, where here we _default into_ binary
84+
// rendering
85+
// This instructs the layer to skip normalization and use the binary
86+
// as-is
87+
_pathType: "open",
88+
_validate: true,
89+
};
90+
91+
// @ts-expect-error not sure why this is failing
7992
const defaultProps: DefaultProps<GeoArrowPathLayerProps> = {
8093
..._defaultProps,
81-
getWidth: { type: "accessor", value: 1 },
82-
// Note: this diverges from upstream, where here we _default into_ binary
83-
// rendering
84-
// This instructs the layer to skip normalization and use the binary
85-
// as-is
86-
_pathType: "open",
87-
_validate: true,
94+
...ourDefaultProps,
8895
};
8996

9097
/**
@@ -163,9 +170,8 @@ export class GeoArrowPathLayer<
163170

164171
const props: PathLayerProps = {
165172
// Note: because this is a composite layer and not doing the rendering
166-
// itself, we still have to pass in defaultProps as the default in this
167-
// props object
168-
...defaultProps,
173+
// itself, we still have to pass in our defaultProps
174+
...ourDefaultProps,
169175
...otherProps,
170176

171177
// used for picking purposes
@@ -237,9 +243,8 @@ export class GeoArrowPathLayer<
237243

238244
const props: PathLayerProps = {
239245
// Note: because this is a composite layer and not doing the rendering
240-
// itself, we still have to pass in defaultProps as the default in this
241-
// props object
242-
...defaultProps,
246+
// itself, we still have to pass in our defaultProps
247+
...ourDefaultProps,
243248
...otherProps,
244249

245250
// used for picking purposes

src/scatterplot-layer.ts

+12-9
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,19 @@ type _GeoArrowScatterplotLayerProps = {
8383
const {
8484
data: _data,
8585
getPosition: _getPosition,
86-
..._defaultProps
86+
..._upstreamDefaultProps
8787
} = ScatterplotLayer.defaultProps;
8888

89-
const defaultProps: DefaultProps<GeoArrowScatterplotLayerProps> = {
90-
..._defaultProps,
89+
// Default props added by us
90+
const ourDefaultProps = {
9191
_validate: true,
9292
};
9393

94+
const defaultProps: DefaultProps<GeoArrowScatterplotLayerProps> = {
95+
..._upstreamDefaultProps,
96+
...ourDefaultProps,
97+
};
98+
9499
export class GeoArrowScatterplotLayer<
95100
ExtraProps extends {} = {}
96101
> extends CompositeLayer<Required<GeoArrowScatterplotLayerProps> & ExtraProps> {
@@ -156,9 +161,8 @@ export class GeoArrowScatterplotLayer<
156161

157162
const props: ScatterplotLayerProps = {
158163
// Note: because this is a composite layer and not doing the rendering
159-
// itself, we still have to pass in defaultProps as the default in this
160-
// props object
161-
...defaultProps,
164+
// itself, we still have to pass in our defaultProps
165+
...ourDefaultProps,
162166
...otherProps,
163167

164168
// @ts-expect-error used for picking purposes
@@ -223,9 +227,8 @@ export class GeoArrowScatterplotLayer<
223227

224228
const props: ScatterplotLayerProps = {
225229
// Note: because this is a composite layer and not doing the rendering
226-
// itself, we still have to pass in defaultProps as the default in this
227-
// props object
228-
...defaultProps,
230+
// itself, we still have to pass in our defaultProps
231+
...ourDefaultProps,
229232
...otherProps,
230233

231234
// @ts-expect-error used for picking purposes

src/solid-polygon-layer.ts

+14-8
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,11 @@ const {
8181
..._defaultProps
8282
} = SolidPolygonLayer.defaultProps;
8383

84-
const defaultProps: DefaultProps<GeoArrowSolidPolygonLayerProps> = {
85-
..._defaultProps,
84+
// Default props added by us
85+
const ourDefaultProps: Pick<
86+
GeoArrowSolidPolygonLayerProps,
87+
"_normalize" | "_windingOrder" | "_validate"
88+
> = {
8689
// Note: this diverges from upstream, where here we default to no
8790
// normalization
8891
_normalize: false,
@@ -92,6 +95,11 @@ const defaultProps: DefaultProps<GeoArrowSolidPolygonLayerProps> = {
9295
_validate: true,
9396
};
9497

98+
const defaultProps: DefaultProps<GeoArrowSolidPolygonLayerProps> = {
99+
..._defaultProps,
100+
...ourDefaultProps,
101+
};
102+
95103
export class GeoArrowSolidPolygonLayer<
96104
ExtraProps extends {} = {}
97105
> extends CompositeLayer<
@@ -170,9 +178,8 @@ export class GeoArrowSolidPolygonLayer<
170178

171179
const props: SolidPolygonLayerProps = {
172180
// Note: because this is a composite layer and not doing the rendering
173-
// itself, we still have to pass in defaultProps as the default in this
174-
// props object
175-
...defaultProps,
181+
// itself, we still have to pass in our defaultProps
182+
...ourDefaultProps,
176183
...otherProps,
177184

178185
// used for picking purposes
@@ -261,9 +268,8 @@ export class GeoArrowSolidPolygonLayer<
261268

262269
const props: SolidPolygonLayerProps = {
263270
// Note: because this is a composite layer and not doing the rendering
264-
// itself, we still have to pass in defaultProps as the default in this
265-
// props object
266-
...defaultProps,
271+
// itself, we still have to pass in our defaultProps
272+
...ourDefaultProps,
267273
...otherProps,
268274

269275
// used for picking purposes

src/text-layer.ts

+12-5
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,22 @@ const {
125125
..._defaultProps
126126
} = TextLayer.defaultProps;
127127

128-
const defaultProps: DefaultProps<GeoArrowTextLayerProps> = {
129-
..._defaultProps,
128+
// Default props added by us
129+
const ourDefaultProps: Pick<
130+
GeoArrowTextLayerProps,
131+
"getTextAnchor" | "getAlignmentBaseline" | "getPixelOffset" | "_validate"
132+
> = {
130133
getTextAnchor: "middle",
131134
getAlignmentBaseline: "center",
132135
getPixelOffset: [0, 0],
133136
_validate: true,
134137
};
135138

139+
const defaultProps: DefaultProps<GeoArrowTextLayerProps> = {
140+
..._defaultProps,
141+
...ourDefaultProps,
142+
};
143+
136144
export class GeoArrowTextLayer<
137145
ExtraProps extends {} = {}
138146
> extends CompositeLayer<Required<GeoArrowTextLayerProps> & ExtraProps> {
@@ -191,9 +199,8 @@ export class GeoArrowTextLayer<
191199

192200
const props: TextLayerProps = {
193201
// Note: because this is a composite layer and not doing the rendering
194-
// itself, we still have to pass in defaultProps as the default in this
195-
// props object
196-
...defaultProps,
202+
// itself, we still have to pass in our defaultProps
203+
...ourDefaultProps,
197204
...otherProps,
198205

199206
// // @ts-expect-error used for picking purposes

0 commit comments

Comments
 (0)