deck.gl 9.2.0-beta.4 → 9.2.1

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.
Files changed (3) hide show
  1. package/dist/dist.dev.js +52 -62
  2. package/dist.min.js +72 -72
  3. package/package.json +15 -15
package/dist/dist.dev.js CHANGED
@@ -42819,11 +42819,10 @@ void main() {
42819
42819
  const { viewId = null, placement = DEFAULT_PLACEMENT } = widget;
42820
42820
  widget.widgetManager = this;
42821
42821
  widget.deck = this.deck;
42822
- widget.rootElement = widget.onCreateRootElement();
42822
+ widget.rootElement = widget._onAdd({ deck: this.deck, viewId });
42823
42823
  if (widget.rootElement) {
42824
42824
  this._getContainer(viewId, placement).append(widget.rootElement);
42825
42825
  }
42826
- widget.onAdd?.({ deck: this.deck, viewId });
42827
42826
  widget.updateHTML();
42828
42827
  }
42829
42828
  /** Destroy an old widget */
@@ -42905,13 +42904,17 @@ void main() {
42905
42904
 
42906
42905
  // ../core/src/lib/widget.ts
42907
42906
  var Widget = class {
42908
- constructor(props, defaultProps49) {
42907
+ constructor(props) {
42909
42908
  /**
42910
42909
  * The view id that this widget is being attached to. Default `null`.
42911
42910
  * If assigned, this widget will only respond to events occurred inside the specific view that matches this id.
42912
42911
  */
42913
42912
  this.viewId = null;
42914
- this.props = { ...defaultProps49, ...props };
42913
+ this.props = {
42914
+ // @ts-expect-error `defaultProps` may not exist on constructor
42915
+ ...this.constructor.defaultProps,
42916
+ ...props
42917
+ };
42915
42918
  this.id = this.props.id;
42916
42919
  }
42917
42920
  /** Called to update widget options */
@@ -42937,12 +42940,11 @@ void main() {
42937
42940
  this.onRenderHTML(this.rootElement);
42938
42941
  }
42939
42942
  }
42940
- // WIDGET LIFECYCLE
42941
42943
  // @note empty method calls have an overhead in V8 but it is very low, ~1ns
42942
42944
  /**
42943
- * Called to create the root DOM element for this widget
42945
+ * Common utility to create the root DOM element for this widget
42944
42946
  * Configures the top-level styles and adds basic class names for theming
42945
- * @returns an optional UI element that should be appended to the Deck container
42947
+ * @returns an UI element that should be appended to the Deck container
42946
42948
  */
42947
42949
  onCreateRootElement() {
42948
42950
  const CLASS_NAMES = [
@@ -42959,7 +42961,13 @@ void main() {
42959
42961
  applyStyles(element, this.props.style);
42960
42962
  return element;
42961
42963
  }
42962
- /** Called after the widget is added to a Deck instance and the DOM rootElement has been created */
42964
+ /** Internal API called by Deck when the widget is first added to a Deck instance */
42965
+ _onAdd(params) {
42966
+ return this.onAdd(params) ?? this.onCreateRootElement();
42967
+ }
42968
+ /** Overridable by subclass - called when the widget is first added to a Deck instance
42969
+ * @returns an optional UI element that should be appended to the Deck container
42970
+ */
42963
42971
  onAdd(params) {
42964
42972
  }
42965
42973
  /** Called when the widget is removed */
@@ -43006,9 +43014,9 @@ void main() {
43006
43014
  left: "0",
43007
43015
  display: "none"
43008
43016
  };
43009
- var _TooltipWidget = class extends Widget {
43017
+ var TooltipWidget = class extends Widget {
43010
43018
  constructor(props = {}) {
43011
- super(props, _TooltipWidget.defaultProps);
43019
+ super(props);
43012
43020
  this.id = "default-tooltip";
43013
43021
  this.placement = "fill";
43014
43022
  this.className = "deck-tooltip";
@@ -43069,7 +43077,6 @@ void main() {
43069
43077
  }
43070
43078
  }
43071
43079
  };
43072
- var TooltipWidget = _TooltipWidget;
43073
43080
  TooltipWidget.defaultProps = {
43074
43081
  ...Widget.defaultProps
43075
43082
  };
@@ -102797,9 +102804,9 @@ void main() {
102797
102804
  };
102798
102805
 
102799
102806
  // ../widgets/src/zoom-widget.tsx
102800
- var _ZoomWidget = class extends Widget {
102807
+ var ZoomWidget = class extends Widget {
102801
102808
  constructor(props = {}) {
102802
- super(props, _ZoomWidget.defaultProps);
102809
+ super(props);
102803
102810
  this.className = "deck-widget-zoom";
102804
102811
  this.placement = "top-left";
102805
102812
  this.viewports = {};
@@ -102863,7 +102870,6 @@ void main() {
102863
102870
  this.deck._onViewStateChange({ viewId, viewState, interactionState: {} });
102864
102871
  }
102865
102872
  };
102866
- var ZoomWidget = _ZoomWidget;
102867
102873
  ZoomWidget.defaultProps = {
102868
102874
  ...Widget.defaultProps,
102869
102875
  id: "zoom",
@@ -102891,9 +102897,9 @@ void main() {
102891
102897
  };
102892
102898
 
102893
102899
  // ../widgets/src/reset-view-widget.tsx
102894
- var _ResetViewWidget = class extends Widget {
102900
+ var ResetViewWidget = class extends Widget {
102895
102901
  constructor(props = {}) {
102896
- super(props, _ResetViewWidget.defaultProps);
102902
+ super(props);
102897
102903
  this.className = "deck-widget-reset-view";
102898
102904
  this.placement = "top-left";
102899
102905
  this.setProps(this.props);
@@ -102931,7 +102937,6 @@ void main() {
102931
102937
  this.deck._onViewStateChange({ viewId, viewState: nextViewState, interactionState: {} });
102932
102938
  }
102933
102939
  };
102934
- var ResetViewWidget = _ResetViewWidget;
102935
102940
  ResetViewWidget.defaultProps = {
102936
102941
  ...Widget.defaultProps,
102937
102942
  id: "reset-view",
@@ -102942,9 +102947,9 @@ void main() {
102942
102947
  };
102943
102948
 
102944
102949
  // ../widgets/src/gimbal-widget.tsx
102945
- var _GimbalWidget = class extends Widget {
102950
+ var GimbalWidget = class extends Widget {
102946
102951
  constructor(props = {}) {
102947
- super(props, _GimbalWidget.defaultProps);
102952
+ super(props);
102948
102953
  this.className = "deck-widget-gimbal";
102949
102954
  this.placement = "top-left";
102950
102955
  this.viewports = {};
@@ -103079,7 +103084,6 @@ void main() {
103079
103084
  return viewManager;
103080
103085
  }
103081
103086
  };
103082
- var GimbalWidget = _GimbalWidget;
103083
103087
  GimbalWidget.defaultProps = {
103084
103088
  ...Widget.defaultProps,
103085
103089
  id: "gimbal",
@@ -103104,9 +103108,9 @@ void main() {
103104
103108
  }
103105
103109
 
103106
103110
  // ../widgets/src/compass-widget.tsx
103107
- var _CompassWidget = class extends Widget {
103111
+ var CompassWidget = class extends Widget {
103108
103112
  constructor(props = {}) {
103109
- super(props, _CompassWidget.defaultProps);
103113
+ super(props);
103110
103114
  this.className = "deck-widget-compass";
103111
103115
  this.placement = "top-left";
103112
103116
  this.viewports = {};
@@ -103180,7 +103184,6 @@ void main() {
103180
103184
  }
103181
103185
  }
103182
103186
  };
103183
- var CompassWidget = _CompassWidget;
103184
103187
  CompassWidget.defaultProps = {
103185
103188
  ...Widget.defaultProps,
103186
103189
  id: "compass",
@@ -103191,9 +103194,9 @@ void main() {
103191
103194
  };
103192
103195
 
103193
103196
  // ../widgets/src/scale-widget.tsx
103194
- var _ScaleWidget = class extends Widget {
103197
+ var ScaleWidget = class extends Widget {
103195
103198
  constructor(props = {}) {
103196
- super(props, _ScaleWidget.defaultProps);
103199
+ super(props);
103197
103200
  this.className = "deck-widget-scale";
103198
103201
  this.placement = "bottom-left";
103199
103202
  // The pixel width of the scale line (computed from a candidate distance)
@@ -103291,7 +103294,6 @@ void main() {
103291
103294
  handleClick() {
103292
103295
  }
103293
103296
  };
103294
- var ScaleWidget = _ScaleWidget;
103295
103297
  ScaleWidget.defaultProps = {
103296
103298
  ...Widget.defaultProps,
103297
103299
  id: "scale",
@@ -103753,9 +103755,9 @@ void main() {
103753
103755
 
103754
103756
  // ../widgets/src/geocoder-widget.tsx
103755
103757
  var CURRENT_LOCATION2 = "current";
103756
- var _GeocoderWidget = class extends Widget {
103758
+ var GeocoderWidget = class extends Widget {
103757
103759
  constructor(props = {}) {
103758
- super(props, _GeocoderWidget.defaultProps);
103760
+ super(props);
103759
103761
  this.className = "deck-widget-geocoder";
103760
103762
  this.placement = "top-left";
103761
103763
  this.geocodeHistory = new GeocoderHistory({});
@@ -103871,7 +103873,6 @@ void main() {
103871
103873
  this.viewports[viewport.id] = viewport;
103872
103874
  }
103873
103875
  };
103874
- var GeocoderWidget = _GeocoderWidget;
103875
103876
  GeocoderWidget.defaultProps = {
103876
103877
  ...Widget.defaultProps,
103877
103878
  id: "geocoder",
@@ -103905,9 +103906,9 @@ void main() {
103905
103906
  }
103906
103907
 
103907
103908
  // ../widgets/src/fullscreen-widget.tsx
103908
- var _FullscreenWidget = class extends Widget {
103909
+ var FullscreenWidget = class extends Widget {
103909
103910
  constructor(props = {}) {
103910
- super(props, _FullscreenWidget.defaultProps);
103911
+ super(props);
103911
103912
  this.className = "deck-widget-fullscreen";
103912
103913
  this.placement = "top-left";
103913
103914
  this.fullscreen = false;
@@ -103977,7 +103978,6 @@ void main() {
103977
103978
  this.getContainer()?.classList.toggle("deck-pseudo-fullscreen");
103978
103979
  }
103979
103980
  };
103980
- var FullscreenWidget = _FullscreenWidget;
103981
103981
  FullscreenWidget.defaultProps = {
103982
103982
  ...Widget.defaultProps,
103983
103983
  id: "fullscreen",
@@ -103989,9 +103989,9 @@ void main() {
103989
103989
  };
103990
103990
 
103991
103991
  // ../widgets/src/splitter-widget.tsx
103992
- var _SplitterWidget = class extends Widget {
103992
+ var SplitterWidget = class extends Widget {
103993
103993
  constructor(props) {
103994
- super(props, _SplitterWidget.defaultProps);
103994
+ super(props);
103995
103995
  this.className = "deck-widget-splitter";
103996
103996
  this.placement = "fill";
103997
103997
  }
@@ -104020,7 +104020,6 @@ void main() {
104020
104020
  );
104021
104021
  }
104022
104022
  };
104023
- var SplitterWidget = _SplitterWidget;
104024
104023
  SplitterWidget.defaultProps = {
104025
104024
  ...Widget.defaultProps,
104026
104025
  id: "splitter-widget",
@@ -104153,9 +104152,9 @@ void main() {
104153
104152
  }
104154
104153
 
104155
104154
  // ../widgets/src/view-selector-widget.tsx
104156
- var _ViewSelectorWidget = class extends Widget {
104155
+ var ViewSelectorWidget = class extends Widget {
104157
104156
  constructor(props = {}) {
104158
- super(props, _ViewSelectorWidget.defaultProps);
104157
+ super(props);
104159
104158
  this.className = "deck-widget-view-selector";
104160
104159
  this.placement = "top-left";
104161
104160
  this.handleSelectMode = (viewMode) => {
@@ -104189,7 +104188,6 @@ void main() {
104189
104188
  );
104190
104189
  }
104191
104190
  };
104192
- var ViewSelectorWidget = _ViewSelectorWidget;
104193
104191
  ViewSelectorWidget.defaultProps = {
104194
104192
  ...Widget.defaultProps,
104195
104193
  id: "view-selector",
@@ -104274,9 +104272,9 @@ void main() {
104274
104272
  ];
104275
104273
 
104276
104274
  // ../widgets/src/info-widget.tsx
104277
- var _InfoWidget = class extends Widget {
104275
+ var InfoWidget = class extends Widget {
104278
104276
  constructor(props) {
104279
- super(props, _InfoWidget.defaultProps);
104277
+ super(props);
104280
104278
  this.className = "deck-widget-info";
104281
104279
  this.placement = "fill";
104282
104280
  this.setProps(this.props);
@@ -104411,7 +104409,6 @@ void main() {
104411
104409
  });
104412
104410
  }
104413
104411
  };
104414
- var InfoWidget = _InfoWidget;
104415
104412
  InfoWidget.defaultProps = {
104416
104413
  ...Widget.defaultProps,
104417
104414
  id: "info",
@@ -104465,9 +104462,9 @@ void main() {
104465
104462
  // ../widgets/src/context-menu-widget.tsx
104466
104463
  var MOUSE_BUTTON_RIGHT = 2;
104467
104464
  var MOUSE_WHICH_RIGHT = 3;
104468
- var _ContextMenuWidget = class extends Widget {
104465
+ var ContextMenuWidget = class extends Widget {
104469
104466
  constructor(props) {
104470
- super(props, _ContextMenuWidget.defaultProps);
104467
+ super(props);
104471
104468
  this.className = "deck-widget-context-menu";
104472
104469
  this.placement = "fill";
104473
104470
  this.pickInfo = null;
@@ -104525,7 +104522,6 @@ void main() {
104525
104522
  this.setProps({ visible: false });
104526
104523
  }
104527
104524
  };
104528
- var ContextMenuWidget = _ContextMenuWidget;
104529
104525
  ContextMenuWidget.defaultProps = {
104530
104526
  ...Widget.defaultProps,
104531
104527
  id: "context",
@@ -104539,9 +104535,9 @@ void main() {
104539
104535
  };
104540
104536
 
104541
104537
  // ../widgets/src/timeline-widget.tsx
104542
- var _TimelineWidget = class extends Widget {
104538
+ var TimelineWidget = class extends Widget {
104543
104539
  constructor(props = {}) {
104544
- super(props, _TimelineWidget.defaultProps);
104540
+ super(props);
104545
104541
  this.id = "timeline";
104546
104542
  this.className = "deck-widget-timeline";
104547
104543
  this.placement = "bottom-left";
@@ -104623,7 +104619,6 @@ void main() {
104623
104619
  this.updateHTML();
104624
104620
  }
104625
104621
  };
104626
- var TimelineWidget = _TimelineWidget;
104627
104622
  TimelineWidget.defaultProps = {
104628
104623
  ...Widget.defaultProps,
104629
104624
  id: "timeline",
@@ -104638,9 +104633,9 @@ void main() {
104638
104633
  };
104639
104634
 
104640
104635
  // ../widgets/src/screenshot-widget.tsx
104641
- var _ScreenshotWidget = class extends Widget {
104636
+ var ScreenshotWidget = class extends Widget {
104642
104637
  constructor(props = {}) {
104643
- super(props, _ScreenshotWidget.defaultProps);
104638
+ super(props);
104644
104639
  this.className = "deck-widget-screenshot";
104645
104640
  this.placement = "top-left";
104646
104641
  this.setProps(this.props);
@@ -104686,7 +104681,6 @@ void main() {
104686
104681
  link.click();
104687
104682
  }
104688
104683
  };
104689
- var ScreenshotWidget = _ScreenshotWidget;
104690
104684
  ScreenshotWidget.defaultProps = {
104691
104685
  ...Widget.defaultProps,
104692
104686
  id: "screenshot",
@@ -104765,9 +104759,9 @@ void main() {
104765
104759
  };
104766
104760
 
104767
104761
  // ../widgets/src/theme-widget.tsx
104768
- var _ThemeWidget = class extends Widget {
104762
+ var ThemeWidget = class extends Widget {
104769
104763
  constructor(props = {}) {
104770
- super(props, _ThemeWidget.defaultProps);
104764
+ super(props);
104771
104765
  this.className = "deck-widget-theme";
104772
104766
  this.placement = "top-left";
104773
104767
  this.themeMode = "dark";
@@ -104833,7 +104827,6 @@ void main() {
104833
104827
  return initialThemeMode === "auto" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : initialThemeMode;
104834
104828
  }
104835
104829
  };
104836
- var ThemeWidget = _ThemeWidget;
104837
104830
  ThemeWidget.defaultProps = {
104838
104831
  ...Widget.defaultProps,
104839
104832
  id: "theme",
@@ -104847,9 +104840,9 @@ void main() {
104847
104840
  };
104848
104841
 
104849
104842
  // ../widgets/src/loading-widget.tsx
104850
- var _LoadingWidget = class extends Widget {
104843
+ var LoadingWidget = class extends Widget {
104851
104844
  constructor(props = {}) {
104852
- super(props, _LoadingWidget.defaultProps);
104845
+ super(props);
104853
104846
  this.className = "deck-widget-loading";
104854
104847
  this.placement = "top-left";
104855
104848
  this.loading = true;
@@ -104885,7 +104878,6 @@ void main() {
104885
104878
  handleClick() {
104886
104879
  }
104887
104880
  };
104888
- var LoadingWidget = _LoadingWidget;
104889
104881
  LoadingWidget.defaultProps = {
104890
104882
  ...Widget.defaultProps,
104891
104883
  id: "loading",
@@ -104895,9 +104887,9 @@ void main() {
104895
104887
  };
104896
104888
 
104897
104889
  // ../widgets/src/fps-widget.tsx
104898
- var _FpsWidget = class extends Widget {
104890
+ var FpsWidget = class extends Widget {
104899
104891
  constructor(props = {}) {
104900
- super(props, _FpsWidget.defaultProps);
104892
+ super(props);
104901
104893
  this.className = "deck-widget-fps";
104902
104894
  this.placement = "top-left";
104903
104895
  this._lastFps = -1;
@@ -104935,7 +104927,6 @@ void main() {
104935
104927
  return Math.round(this.deck?.metrics.fps ?? 0);
104936
104928
  }
104937
104929
  };
104938
- var FpsWidget = _FpsWidget;
104939
104930
  FpsWidget.defaultProps = {
104940
104931
  ...Widget.defaultProps,
104941
104932
  id: "fps",
@@ -104962,9 +104953,9 @@ void main() {
104962
104953
  fps: (stat) => `${stat.name}: ${Math.round(stat.getHz())}fps`,
104963
104954
  memory: (stat) => `${stat.name}: ${formatMemory(stat.count)}`
104964
104955
  };
104965
- var _StatsWidget = class extends Widget {
104956
+ var StatsWidget = class extends Widget {
104966
104957
  constructor(props = {}) {
104967
- super(props, _StatsWidget.defaultProps);
104958
+ super(props);
104968
104959
  this.className = "deck-widget-stats";
104969
104960
  this.placement = "top-left";
104970
104961
  this._counter = 0;
@@ -105063,7 +105054,6 @@ void main() {
105063
105054
  return formatter(stat).split("\n");
105064
105055
  }
105065
105056
  };
105066
- var StatsWidget = _StatsWidget;
105067
105057
  StatsWidget.defaultProps = {
105068
105058
  ...Widget.defaultProps,
105069
105059
  type: "deck",