bruce-cesium 7.1.1 → 7.1.3

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.
@@ -24842,6 +24842,8 @@
24842
24842
  BModels.MenuItem.EType.GooglePhotoTileset
24843
24843
  ];
24844
24844
  const OPEN_STATE_STORAGE_PREFIX$1 = "NextspaceMenuItemOpen_";
24845
+ // How long to wait for a view before declaring there isn't one.
24846
+ const NO_VIEW_GRACE_MS = 5000;
24845
24847
  const PANEL_WIDTH_STORAGE_KEY = "NextspaceMenuItemsPanelWidth";
24846
24848
  // Matches the panel's resize range in the full Navigator experience.
24847
24849
  const PANEL_DEFAULT_WIDTH = 320;
@@ -24857,6 +24859,10 @@
24857
24859
  super(params);
24858
24860
  this.STYLESHEET_ID = "nextspace-left-panel-tab-menu-items-stylesheet";
24859
24861
  this._menuItems = [];
24862
+ // Every menu item the manager has rendered while this tab has been alive.
24863
+ this._managerItems = new Map();
24864
+ // Set once the grace period for a view to appear has elapsed.
24865
+ this._waitedForView = false;
24860
24866
  this._rows = new Map();
24861
24867
  // Identifies the newest load, so a slow response for an older view can't overwrite a newer one.
24862
24868
  this._loadToken = 0;
@@ -24877,18 +24883,31 @@
24877
24883
  const manager = (_c = this._widget) === null || _c === void 0 ? void 0 : _c._getManager();
24878
24884
  if (manager) {
24879
24885
  this._menuUpdateRemoval = manager.OnUpdate.Subscribe(() => {
24886
+ // A newly rendered item can add a row, not just change an existing one's state.
24887
+ if (this._snapshotManagerItems() && !this._menuItems.length) {
24888
+ this._renderTree();
24889
+ }
24880
24890
  this._stateQueue.Call();
24881
24891
  });
24882
24892
  this._visualUpdateRemoval = (_d = manager.VisualsRegister) === null || _d === void 0 ? void 0 : _d.OnUpdate.Subscribe(() => {
24883
24893
  this._countQueue.Call();
24884
24894
  });
24885
24895
  }
24896
+ this._snapshotManagerItems();
24886
24897
  this._loadMenuItems();
24887
24898
  this._applyPanelWidth(this._getStoredWidth());
24899
+ // Without a view we can't tell "still starting up" from "there is no view", so give it a moment.
24900
+ this._noViewTimer = setTimeout(() => {
24901
+ this._waitedForView = true;
24902
+ if (!this._disposed && !this._menuItems.length && !this._managerItems.size) {
24903
+ this._renderTree();
24904
+ }
24905
+ }, NO_VIEW_GRACE_MS);
24888
24906
  }
24889
24907
  Dispose() {
24890
24908
  var _a, _b, _c, _d, _e;
24891
24909
  this._disposed = true;
24910
+ clearTimeout(this._noViewTimer);
24892
24911
  this._endResize();
24893
24912
  // The panel container is shared with the other tabs, so its overrides don't outlive this one.
24894
24913
  if (this.Container) {
@@ -25206,23 +25225,59 @@
25206
25225
  this._updateStates();
25207
25226
  this._updateCounts();
25208
25227
  }
25228
+ /**
25229
+ * Records any menu items the manager has rendered that we haven't seen before.
25230
+ * Returns whether anything new was added.
25231
+ */
25232
+ _snapshotManagerItems() {
25233
+ var _a, _b, _c;
25234
+ const manager = (_a = this._widget) === null || _a === void 0 ? void 0 : _a._getManager();
25235
+ if (!manager) {
25236
+ return false;
25237
+ }
25238
+ let added = false;
25239
+ for (const id of (_b = manager.GetEnabledItemIds()) !== null && _b !== void 0 ? _b : []) {
25240
+ if (this._managerItems.has(id)) {
25241
+ continue;
25242
+ }
25243
+ const item = (_c = manager.GetEnabledItem(id)) === null || _c === void 0 ? void 0 : _c.item;
25244
+ if (item === null || item === void 0 ? void 0 : item.id) {
25245
+ this._managerItems.set(id, item);
25246
+ added = true;
25247
+ }
25248
+ }
25249
+ return added;
25250
+ }
25251
+ /**
25252
+ * The view's menu items once there are any, otherwise whatever the manager has rendered.
25253
+ */
25254
+ _getTreeItems() {
25255
+ if (this._menuItems.length) {
25256
+ return this._menuItems;
25257
+ }
25258
+ return Array.from(this._managerItems.values());
25259
+ }
25209
25260
  _renderTree() {
25210
- var _a;
25211
25261
  this._rows.clear();
25212
25262
  this._scrollBox.innerHTML = "";
25213
- if (!this._menuItems.length) {
25214
- // The panel can be opened before any view has rendered, so say so rather than claiming it's empty.
25215
- this._tip.textContent = ((_a = this._widget) === null || _a === void 0 ? void 0 : _a.ViewId)
25216
- ? "This project view has no menu items."
25217
- : "Waiting for a view to load...";
25263
+ const items = this._getTreeItems();
25264
+ if (!items.length) {
25265
+ this._tip.textContent = this._getEmptyText();
25218
25266
  this._tip.style.display = "block";
25219
25267
  return;
25220
25268
  }
25221
25269
  this._tip.style.display = "none";
25222
- for (const item of this._menuItems) {
25270
+ for (const item of items) {
25223
25271
  this._renderRow(item, 0, this._scrollBox);
25224
25272
  }
25225
25273
  }
25274
+ _getEmptyText() {
25275
+ var _a;
25276
+ if ((_a = this._widget) === null || _a === void 0 ? void 0 : _a.ViewId) {
25277
+ return "This project view has no menu items.";
25278
+ }
25279
+ return this._waitedForView ? "No view is loaded." : "Loading..";
25280
+ }
25226
25281
  _renderRow(item, depth, parent) {
25227
25282
  var _a;
25228
25283
  if (!(item === null || item === void 0 ? void 0 : item.id)) {
@@ -25684,11 +25739,20 @@
25684
25739
  padding: 24px;
25685
25740
  }
25686
25741
 
25687
- .NextspaceLeftPanelTabDashboardBranding >svg {
25688
- height: max-content;
25742
+ /* Matches the svg through its click wrapper, so the artwork's intrinsic size can't win. */
25743
+ .NextspaceLeftPanelTabDashboardLogo {
25744
+ cursor: pointer;
25745
+ display: block;
25689
25746
  max-width: 220px;
25690
25747
  }
25691
25748
 
25749
+ .NextspaceLeftPanelTabDashboardLogo >svg {
25750
+ display: block;
25751
+ height: auto;
25752
+ max-width: 100%;
25753
+ width: 100%;
25754
+ }
25755
+
25692
25756
  .NextspaceLeftPanelTabDashboardLinks {
25693
25757
  align-items: center;
25694
25758
  display: flex;
@@ -25808,8 +25872,8 @@
25808
25872
  // Once an account or view brands the panel, the Nextspace mark steps back to "powered by".
25809
25873
  const hasCustomBranding = !!(this._accountBrandingUrl || this._viewBrandingUrl);
25810
25874
  const logo = document.createElement("div");
25875
+ logo.className = "NextspaceLeftPanelTabDashboardLogo";
25811
25876
  logo.innerHTML = hasCustomBranding ? ICON_NEXTSPACE_POWERED : ICON_NEXTSPACE_LEAF;
25812
- logo.style.cursor = "pointer";
25813
25877
  logo.title = "Nextspace";
25814
25878
  logo.onclick = () => {
25815
25879
  window.open(NEXTSPACE_URL, "_blank");
@@ -42077,7 +42141,7 @@
42077
42141
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
42078
42142
  })(exports.StyleUtils || (exports.StyleUtils = {}));
42079
42143
 
42080
- const VERSION = "7.1.1";
42144
+ const VERSION = "7.1.3";
42081
42145
  /**
42082
42146
  * Updates the environment instance used by bruce-cesium to one specified.
42083
42147
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.