@deck.gl/core 9.2.0 → 9.2.2
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/dist/dist.dev.js +18 -11
- package/dist/index.cjs +18 -11
- package/dist/index.cjs.map +3 -3
- package/dist/lib/deck.d.ts +1 -1
- package/dist/lib/deck.d.ts.map +1 -1
- package/dist/lib/init.js +2 -2
- package/dist/lib/tooltip-widget.js +1 -1
- package/dist/lib/tooltip-widget.js.map +1 -1
- package/dist/lib/widget-manager.d.ts.map +1 -1
- package/dist/lib/widget-manager.js +1 -2
- package/dist/lib/widget-manager.js.map +1 -1
- package/dist/lib/widget.d.ts +13 -6
- package/dist/lib/widget.d.ts.map +1 -1
- package/dist/lib/widget.js +15 -6
- package/dist/lib/widget.js.map +1 -1
- package/dist.min.js +27 -27
- package/package.json +2 -2
- package/src/lib/deck.ts +1 -1
- package/src/lib/tooltip-widget.ts +1 -1
- package/src/lib/widget-manager.ts +1 -2
- package/src/lib/widget.ts +20 -9
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "deck.gl core library",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "9.2.
|
|
6
|
+
"version": "9.2.2",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"gl-matrix": "^3.0.0",
|
|
59
59
|
"mjolnir.js": "^3.0.0"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "9e183d2ce23bb21d655752ed614da0ce5a6a0458"
|
|
62
62
|
}
|
package/src/lib/deck.ts
CHANGED
|
@@ -93,7 +93,7 @@ export type DeckProps<ViewsT extends ViewOrViews = null> = {
|
|
|
93
93
|
/** Controls the resolution of drawing buffer used for rendering.
|
|
94
94
|
* @default `true` (use browser devicePixelRatio)
|
|
95
95
|
*/
|
|
96
|
-
useDevicePixels?: boolean;
|
|
96
|
+
useDevicePixels?: boolean | number;
|
|
97
97
|
/** Extra pixels around the pointer to include while picking.
|
|
98
98
|
* @default `0`
|
|
99
99
|
*/
|
|
@@ -201,12 +201,11 @@ export class WidgetManager {
|
|
|
201
201
|
widget.deck = this.deck;
|
|
202
202
|
|
|
203
203
|
// Create an attach the HTML root element
|
|
204
|
-
widget.rootElement = widget.
|
|
204
|
+
widget.rootElement = widget._onAdd({deck: this.deck, viewId});
|
|
205
205
|
if (widget.rootElement) {
|
|
206
206
|
this._getContainer(viewId, placement).append(widget.rootElement);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
widget.onAdd?.({deck: this.deck, viewId});
|
|
210
209
|
widget.updateHTML();
|
|
211
210
|
}
|
|
212
211
|
|
package/src/lib/widget.ts
CHANGED
|
@@ -50,8 +50,12 @@ export abstract class Widget<
|
|
|
50
50
|
deck?: Deck<ViewsT>;
|
|
51
51
|
rootElement?: HTMLDivElement | null;
|
|
52
52
|
|
|
53
|
-
constructor(props: PropsT
|
|
54
|
-
this.props = {
|
|
53
|
+
constructor(props: PropsT) {
|
|
54
|
+
this.props = {
|
|
55
|
+
// @ts-expect-error `defaultProps` may not exist on constructor
|
|
56
|
+
...(this.constructor.defaultProps as Required<PropsT>),
|
|
57
|
+
...props
|
|
58
|
+
};
|
|
55
59
|
// @ts-expect-error TODO(ib) - why is id considered optional even though we use Required<>
|
|
56
60
|
this.id = this.props.id;
|
|
57
61
|
}
|
|
@@ -86,16 +90,14 @@ export abstract class Widget<
|
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
92
|
|
|
89
|
-
// WIDGET LIFECYCLE
|
|
90
|
-
|
|
91
93
|
// @note empty method calls have an overhead in V8 but it is very low, ~1ns
|
|
92
94
|
|
|
93
95
|
/**
|
|
94
|
-
*
|
|
96
|
+
* Common utility to create the root DOM element for this widget
|
|
95
97
|
* Configures the top-level styles and adds basic class names for theming
|
|
96
|
-
* @returns an
|
|
98
|
+
* @returns an UI element that should be appended to the Deck container
|
|
97
99
|
*/
|
|
98
|
-
onCreateRootElement(): HTMLDivElement {
|
|
100
|
+
protected onCreateRootElement(): HTMLDivElement {
|
|
99
101
|
const CLASS_NAMES = [
|
|
100
102
|
// Add class names for theming
|
|
101
103
|
'deck-widget',
|
|
@@ -112,16 +114,25 @@ export abstract class Widget<
|
|
|
112
114
|
return element;
|
|
113
115
|
}
|
|
114
116
|
|
|
117
|
+
// WIDGET LIFECYCLE
|
|
118
|
+
|
|
115
119
|
/** Called to render HTML into the root element */
|
|
116
120
|
abstract onRenderHTML(rootElement: HTMLElement): void;
|
|
117
121
|
|
|
118
|
-
/**
|
|
122
|
+
/** Internal API called by Deck when the widget is first added to a Deck instance */
|
|
123
|
+
_onAdd(params: {deck: Deck<any>; viewId: string | null}): HTMLDivElement {
|
|
124
|
+
return this.onAdd(params) ?? this.onCreateRootElement();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Overridable by subclass - called when the widget is first added to a Deck instance
|
|
128
|
+
* @returns an optional UI element that should be appended to the Deck container
|
|
129
|
+
*/
|
|
119
130
|
onAdd(params: {
|
|
120
131
|
/** The Deck instance that the widget is attached to */
|
|
121
132
|
deck: Deck<any>;
|
|
122
133
|
/** The id of the view that the widget is attached to */
|
|
123
134
|
viewId: string | null;
|
|
124
|
-
}) {}
|
|
135
|
+
}): HTMLDivElement | void {}
|
|
125
136
|
|
|
126
137
|
/** Called when the widget is removed */
|
|
127
138
|
onRemove(): void {}
|