@deck.gl/widgets 9.3.0-alpha.2 → 9.3.0-alpha.5

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/index.cjs CHANGED
@@ -1163,10 +1163,13 @@ var Popover = ({ x, y, placement = "right", offset: pixelOffset = 0, arrow: arro
1163
1163
  (_a = updaterRef.current) == null ? void 0 : _a.call(updaterRef);
1164
1164
  }, [x, y, placement, arrowSize, pixelOffset]);
1165
1165
  (0, import_hooks4.useEffect)(() => {
1166
- if (contentRef.current) {
1167
- contentRef.current.style.visibility = "visible";
1166
+ const anchor = anchorRef.current;
1167
+ const content = contentRef.current;
1168
+ if (!anchor || !content) {
1169
+ return void 0;
1168
1170
  }
1169
- const cleanup = (0, import_dom.autoUpdate)(anchorRef.current, contentRef.current, () => {
1171
+ content.style.visibility = "visible";
1172
+ const cleanup = (0, import_dom.autoUpdate)(anchor, content, () => {
1170
1173
  var _a;
1171
1174
  return (_a = updaterRef.current) == null ? void 0 : _a.call(updaterRef);
1172
1175
  });
@@ -2487,6 +2490,7 @@ var StatsWidget = class extends import_core22.Widget {
2487
2490
  }
2488
2491
  const stats = this._getStats();
2489
2492
  const title = this.props.title || ("id" in stats ? stats.id : null) || "Stats";
2493
+ const deviceLabel = this._getDeviceLabel();
2490
2494
  const items = [];
2491
2495
  if (stats) {
2492
2496
  stats.forEach((stat) => {
@@ -2499,7 +2503,7 @@ var StatsWidget = class extends import_core22.Widget {
2499
2503
  });
2500
2504
  });
2501
2505
  }
2502
- (0, import_preact20.render)((0, import_jsx_runtime26.jsxs)("div", { className: "deck-widget-stats-container", style: { cursor: "default" }, children: [(0, import_jsx_runtime26.jsxs)("div", { className: "deck-widget-stats-header", style: { cursor: "pointer", pointerEvents: "auto" }, onClick: this._toggleCollapsed, children: [(0, import_jsx_runtime26.jsx)("b", { children: title }), (0, import_jsx_runtime26.jsx)("button", { className: "deck-widget-dropdown-button", children: (0, import_jsx_runtime26.jsx)("span", { className: "deck-widget-dropdown-icon open" }) })] }), (0, import_jsx_runtime26.jsx)("div", { className: "deck-widget-stats-content", children: items })] }), rootElement);
2506
+ (0, import_preact20.render)((0, import_jsx_runtime26.jsxs)("div", { className: "deck-widget-stats-container", style: { cursor: "default" }, children: [(0, import_jsx_runtime26.jsxs)("div", { className: "deck-widget-stats-header", style: { cursor: "pointer", pointerEvents: "auto" }, onClick: this._toggleCollapsed, children: [(0, import_jsx_runtime26.jsx)("b", { children: title }), deviceLabel && (0, import_jsx_runtime26.jsx)("span", { className: "deck-widget-stats-device", children: deviceLabel }), (0, import_jsx_runtime26.jsx)("button", { className: "deck-widget-dropdown-button", children: (0, import_jsx_runtime26.jsx)("span", { className: "deck-widget-dropdown-icon open" }) })] }), (0, import_jsx_runtime26.jsx)("div", { className: "deck-widget-stats-content", children: items })] }), rootElement);
2503
2507
  }
2504
2508
  onRedraw() {
2505
2509
  if (!this.collapsed) {
@@ -2527,6 +2531,21 @@ var StatsWidget = class extends import_core22.Widget {
2527
2531
  throw new Error(`Unknown stats type: ${this.props.type}`);
2528
2532
  }
2529
2533
  }
2534
+ _getDeviceLabel() {
2535
+ var _a, _b;
2536
+ const deviceType = (_b = (_a = this.deck) == null ? void 0 : _a.device) == null ? void 0 : _b.type;
2537
+ if (!deviceType) {
2538
+ return null;
2539
+ }
2540
+ switch (deviceType) {
2541
+ case "webgpu":
2542
+ return "WebGPU";
2543
+ case "webgl":
2544
+ return "WebGL";
2545
+ default:
2546
+ return String(deviceType);
2547
+ }
2548
+ }
2530
2549
  _getLines(stat) {
2531
2550
  if ("count" in stat) {
2532
2551
  const formatter = this._formatters[stat.name] || this._formatters[stat.type || ""] || DEFAULT_COUNT_FORMATTER;