@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 CHANGED
@@ -36046,11 +36046,10 @@ void main() {
36046
36046
  const { viewId = null, placement = DEFAULT_PLACEMENT } = widget;
36047
36047
  widget.widgetManager = this;
36048
36048
  widget.deck = this.deck;
36049
- widget.rootElement = widget.onCreateRootElement();
36049
+ widget.rootElement = widget._onAdd({ deck: this.deck, viewId });
36050
36050
  if (widget.rootElement) {
36051
36051
  this._getContainer(viewId, placement).append(widget.rootElement);
36052
36052
  }
36053
- widget.onAdd?.({ deck: this.deck, viewId });
36054
36053
  widget.updateHTML();
36055
36054
  }
36056
36055
  /** Destroy an old widget */
@@ -36132,13 +36131,17 @@ void main() {
36132
36131
 
36133
36132
  // src/lib/widget.ts
36134
36133
  var Widget = class {
36135
- constructor(props, defaultProps3) {
36134
+ constructor(props) {
36136
36135
  /**
36137
36136
  * The view id that this widget is being attached to. Default `null`.
36138
36137
  * If assigned, this widget will only respond to events occurred inside the specific view that matches this id.
36139
36138
  */
36140
36139
  this.viewId = null;
36141
- this.props = { ...defaultProps3, ...props };
36140
+ this.props = {
36141
+ // @ts-expect-error `defaultProps` may not exist on constructor
36142
+ ...this.constructor.defaultProps,
36143
+ ...props
36144
+ };
36142
36145
  this.id = this.props.id;
36143
36146
  }
36144
36147
  /** Called to update widget options */
@@ -36164,12 +36167,11 @@ void main() {
36164
36167
  this.onRenderHTML(this.rootElement);
36165
36168
  }
36166
36169
  }
36167
- // WIDGET LIFECYCLE
36168
36170
  // @note empty method calls have an overhead in V8 but it is very low, ~1ns
36169
36171
  /**
36170
- * Called to create the root DOM element for this widget
36172
+ * Common utility to create the root DOM element for this widget
36171
36173
  * Configures the top-level styles and adds basic class names for theming
36172
- * @returns an optional UI element that should be appended to the Deck container
36174
+ * @returns an UI element that should be appended to the Deck container
36173
36175
  */
36174
36176
  onCreateRootElement() {
36175
36177
  const CLASS_NAMES = [
@@ -36186,7 +36188,13 @@ void main() {
36186
36188
  applyStyles(element, this.props.style);
36187
36189
  return element;
36188
36190
  }
36189
- /** Called after the widget is added to a Deck instance and the DOM rootElement has been created */
36191
+ /** Internal API called by Deck when the widget is first added to a Deck instance */
36192
+ _onAdd(params) {
36193
+ return this.onAdd(params) ?? this.onCreateRootElement();
36194
+ }
36195
+ /** Overridable by subclass - called when the widget is first added to a Deck instance
36196
+ * @returns an optional UI element that should be appended to the Deck container
36197
+ */
36190
36198
  onAdd(params) {
36191
36199
  }
36192
36200
  /** Called when the widget is removed */
@@ -36233,9 +36241,9 @@ void main() {
36233
36241
  left: "0",
36234
36242
  display: "none"
36235
36243
  };
36236
- var _TooltipWidget = class extends Widget {
36244
+ var TooltipWidget = class extends Widget {
36237
36245
  constructor(props = {}) {
36238
- super(props, _TooltipWidget.defaultProps);
36246
+ super(props);
36239
36247
  this.id = "default-tooltip";
36240
36248
  this.placement = "fill";
36241
36249
  this.className = "deck-tooltip";
@@ -36296,7 +36304,6 @@ void main() {
36296
36304
  }
36297
36305
  }
36298
36306
  };
36299
- var TooltipWidget = _TooltipWidget;
36300
36307
  TooltipWidget.defaultProps = {
36301
36308
  ...Widget.defaultProps
36302
36309
  };
package/dist/index.cjs CHANGED
@@ -232,7 +232,7 @@ var json_loader_default = {
232
232
 
233
233
  // dist/lib/init.js
234
234
  function checkVersion() {
235
- const version = true ? "9.2.0" : globalThis.DECK_VERSION || "untranspiled source";
235
+ const version = true ? "9.2.2" : globalThis.DECK_VERSION || "untranspiled source";
236
236
  const existingVersion = globalThis.deck && globalThis.deck.VERSION;
237
237
  if (existingVersion && existingVersion !== version) {
238
238
  throw new Error(`deck.gl - multiple versions detected: ${existingVersion} vs ${version}`);
@@ -6470,15 +6470,13 @@ var WidgetManager = class {
6470
6470
  }
6471
6471
  /** Initialize new widget */
6472
6472
  _addWidget(widget) {
6473
- var _a;
6474
6473
  const { viewId = null, placement = DEFAULT_PLACEMENT } = widget;
6475
6474
  widget.widgetManager = this;
6476
6475
  widget.deck = this.deck;
6477
- widget.rootElement = widget.onCreateRootElement();
6476
+ widget.rootElement = widget._onAdd({ deck: this.deck, viewId });
6478
6477
  if (widget.rootElement) {
6479
6478
  this._getContainer(viewId, placement).append(widget.rootElement);
6480
6479
  }
6481
- (_a = widget.onAdd) == null ? void 0 : _a.call(widget, { deck: this.deck, viewId });
6482
6480
  widget.updateHTML();
6483
6481
  }
6484
6482
  /** Destroy an old widget */
@@ -6562,9 +6560,13 @@ function removeStyles(element, style) {
6562
6560
 
6563
6561
  // dist/lib/widget.js
6564
6562
  var Widget = class {
6565
- constructor(props, defaultProps3) {
6563
+ constructor(props) {
6566
6564
  this.viewId = null;
6567
- this.props = { ...defaultProps3, ...props };
6565
+ this.props = {
6566
+ // @ts-expect-error `defaultProps` may not exist on constructor
6567
+ ...this.constructor.defaultProps,
6568
+ ...props
6569
+ };
6568
6570
  this.id = this.props.id;
6569
6571
  }
6570
6572
  /** Called to update widget options */
@@ -6590,12 +6592,11 @@ var Widget = class {
6590
6592
  this.onRenderHTML(this.rootElement);
6591
6593
  }
6592
6594
  }
6593
- // WIDGET LIFECYCLE
6594
6595
  // @note empty method calls have an overhead in V8 but it is very low, ~1ns
6595
6596
  /**
6596
- * Called to create the root DOM element for this widget
6597
+ * Common utility to create the root DOM element for this widget
6597
6598
  * Configures the top-level styles and adds basic class names for theming
6598
- * @returns an optional UI element that should be appended to the Deck container
6599
+ * @returns an UI element that should be appended to the Deck container
6599
6600
  */
6600
6601
  onCreateRootElement() {
6601
6602
  const CLASS_NAMES = [
@@ -6610,7 +6611,13 @@ var Widget = class {
6610
6611
  applyStyles(element, this.props.style);
6611
6612
  return element;
6612
6613
  }
6613
- /** Called after the widget is added to a Deck instance and the DOM rootElement has been created */
6614
+ /** Internal API called by Deck when the widget is first added to a Deck instance */
6615
+ _onAdd(params) {
6616
+ return this.onAdd(params) ?? this.onCreateRootElement();
6617
+ }
6618
+ /** Overridable by subclass - called when the widget is first added to a Deck instance
6619
+ * @returns an optional UI element that should be appended to the Deck container
6620
+ */
6614
6621
  onAdd(params) {
6615
6622
  }
6616
6623
  /** Called when the widget is removed */
@@ -6659,7 +6666,7 @@ var defaultStyle = {
6659
6666
  };
6660
6667
  var TooltipWidget = class extends Widget {
6661
6668
  constructor(props = {}) {
6662
- super(props, TooltipWidget.defaultProps);
6669
+ super(props);
6663
6670
  this.id = "default-tooltip";
6664
6671
  this.placement = "fill";
6665
6672
  this.className = "deck-tooltip";