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.
@@ -1,6 +1,6 @@
1
1
  import * as Cesium from 'cesium';
2
- import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, DistanceDisplayCondition, HeightReference, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, ShadowMode, Cartesian3, ClassificationType, Model, JulianDate, Quaternion, Matrix4, ArcType, CornerType, ConstantPositionProperty, HorizontalOrigin, VerticalOrigin, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, IonResource, Cesium3DTileset, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, BoundingSphere, Intersect, OrthographicFrustum, EasingFunction, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, CesiumInspector, ClockRange, GeometryInstance, CustomDataSource, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
- import { Cartes, Entity as Entity$1, ENVIRONMENT, Calculator, ClientFile, EntityLod, EntityTag, EntityType, LRUCache, ObjectUtils, Style, Carto, Geometry, Api, Bounds, Color as Color$1, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, BruceEvent, EntityCoords, DataLab, DelayQueue, EntityHistoricData, AccountConcept, RecordChangeFeed, EntityRelation, BruceApi, ProgramKey, EntitySource, ProjectViewLegacyTile, ProjectViewTile, Camera, Account, AccountLimits, Session, UrlUtils, ProjectViewBookmarkGroup, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, EntityRelationType } from 'bruce-models';
2
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, DistanceDisplayCondition, HeightReference, HorizontalOrigin, VerticalOrigin, ClassificationType, ConstantPositionProperty, ColorBlendMode, ShadowMode, Model, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, HeadingPitchRange, Cesium3DTileStyle, Cesium3DTileColorBlendMode, Ion, IonResource, Cesium3DTileset, BoundingSphere, Intersect, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, CustomDataSource, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, CesiumInspector, ClockRange, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
+ import { Cartes, Entity as Entity$1, ENVIRONMENT, Api, Calculator, ClientFile, EntityTag, EntityType, LRUCache, ObjectUtils, Style, EntityLod, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, Bounds, Color as Color$1, Geometry, BruceEvent, EntityCoords, Carto, DataLab, DelayQueue, EntityHistoricData, AccountConcept, RecordChangeFeed, EntityRelation, BruceApi, ProgramKey, EntitySource, ProjectViewTile, Camera, ProjectViewLegacyTile, Account, AccountLimits, Session, UrlUtils, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, ProjectViewBookmarkGroup, EntityRelationType } from 'bruce-models';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -24927,6 +24927,8 @@ const TILESET_TYPES = [
24927
24927
  MenuItem.EType.GooglePhotoTileset
24928
24928
  ];
24929
24929
  const OPEN_STATE_STORAGE_PREFIX$1 = "NextspaceMenuItemOpen_";
24930
+ // How long to wait for a view before declaring there isn't one.
24931
+ const NO_VIEW_GRACE_MS = 5000;
24930
24932
  const PANEL_WIDTH_STORAGE_KEY = "NextspaceMenuItemsPanelWidth";
24931
24933
  // Matches the panel's resize range in the full Navigator experience.
24932
24934
  const PANEL_DEFAULT_WIDTH = 320;
@@ -24942,6 +24944,10 @@ class WidgetLeftPanelTabMenuItems extends WidgetLeftPanelTab.ATab {
24942
24944
  super(params);
24943
24945
  this.STYLESHEET_ID = "nextspace-left-panel-tab-menu-items-stylesheet";
24944
24946
  this._menuItems = [];
24947
+ // Every menu item the manager has rendered while this tab has been alive.
24948
+ this._managerItems = new Map();
24949
+ // Set once the grace period for a view to appear has elapsed.
24950
+ this._waitedForView = false;
24945
24951
  this._rows = new Map();
24946
24952
  // Identifies the newest load, so a slow response for an older view can't overwrite a newer one.
24947
24953
  this._loadToken = 0;
@@ -24962,18 +24968,31 @@ class WidgetLeftPanelTabMenuItems extends WidgetLeftPanelTab.ATab {
24962
24968
  const manager = (_c = this._widget) === null || _c === void 0 ? void 0 : _c._getManager();
24963
24969
  if (manager) {
24964
24970
  this._menuUpdateRemoval = manager.OnUpdate.Subscribe(() => {
24971
+ // A newly rendered item can add a row, not just change an existing one's state.
24972
+ if (this._snapshotManagerItems() && !this._menuItems.length) {
24973
+ this._renderTree();
24974
+ }
24965
24975
  this._stateQueue.Call();
24966
24976
  });
24967
24977
  this._visualUpdateRemoval = (_d = manager.VisualsRegister) === null || _d === void 0 ? void 0 : _d.OnUpdate.Subscribe(() => {
24968
24978
  this._countQueue.Call();
24969
24979
  });
24970
24980
  }
24981
+ this._snapshotManagerItems();
24971
24982
  this._loadMenuItems();
24972
24983
  this._applyPanelWidth(this._getStoredWidth());
24984
+ // Without a view we can't tell "still starting up" from "there is no view", so give it a moment.
24985
+ this._noViewTimer = setTimeout(() => {
24986
+ this._waitedForView = true;
24987
+ if (!this._disposed && !this._menuItems.length && !this._managerItems.size) {
24988
+ this._renderTree();
24989
+ }
24990
+ }, NO_VIEW_GRACE_MS);
24973
24991
  }
24974
24992
  Dispose() {
24975
24993
  var _a, _b, _c, _d, _e;
24976
24994
  this._disposed = true;
24995
+ clearTimeout(this._noViewTimer);
24977
24996
  this._endResize();
24978
24997
  // The panel container is shared with the other tabs, so its overrides don't outlive this one.
24979
24998
  if (this.Container) {
@@ -25291,23 +25310,59 @@ class WidgetLeftPanelTabMenuItems extends WidgetLeftPanelTab.ATab {
25291
25310
  this._updateStates();
25292
25311
  this._updateCounts();
25293
25312
  }
25313
+ /**
25314
+ * Records any menu items the manager has rendered that we haven't seen before.
25315
+ * Returns whether anything new was added.
25316
+ */
25317
+ _snapshotManagerItems() {
25318
+ var _a, _b, _c;
25319
+ const manager = (_a = this._widget) === null || _a === void 0 ? void 0 : _a._getManager();
25320
+ if (!manager) {
25321
+ return false;
25322
+ }
25323
+ let added = false;
25324
+ for (const id of (_b = manager.GetEnabledItemIds()) !== null && _b !== void 0 ? _b : []) {
25325
+ if (this._managerItems.has(id)) {
25326
+ continue;
25327
+ }
25328
+ const item = (_c = manager.GetEnabledItem(id)) === null || _c === void 0 ? void 0 : _c.item;
25329
+ if (item === null || item === void 0 ? void 0 : item.id) {
25330
+ this._managerItems.set(id, item);
25331
+ added = true;
25332
+ }
25333
+ }
25334
+ return added;
25335
+ }
25336
+ /**
25337
+ * The view's menu items once there are any, otherwise whatever the manager has rendered.
25338
+ */
25339
+ _getTreeItems() {
25340
+ if (this._menuItems.length) {
25341
+ return this._menuItems;
25342
+ }
25343
+ return Array.from(this._managerItems.values());
25344
+ }
25294
25345
  _renderTree() {
25295
- var _a;
25296
25346
  this._rows.clear();
25297
25347
  this._scrollBox.innerHTML = "";
25298
- if (!this._menuItems.length) {
25299
- // The panel can be opened before any view has rendered, so say so rather than claiming it's empty.
25300
- this._tip.textContent = ((_a = this._widget) === null || _a === void 0 ? void 0 : _a.ViewId)
25301
- ? "This project view has no menu items."
25302
- : "Waiting for a view to load...";
25348
+ const items = this._getTreeItems();
25349
+ if (!items.length) {
25350
+ this._tip.textContent = this._getEmptyText();
25303
25351
  this._tip.style.display = "block";
25304
25352
  return;
25305
25353
  }
25306
25354
  this._tip.style.display = "none";
25307
- for (const item of this._menuItems) {
25355
+ for (const item of items) {
25308
25356
  this._renderRow(item, 0, this._scrollBox);
25309
25357
  }
25310
25358
  }
25359
+ _getEmptyText() {
25360
+ var _a;
25361
+ if ((_a = this._widget) === null || _a === void 0 ? void 0 : _a.ViewId) {
25362
+ return "This project view has no menu items.";
25363
+ }
25364
+ return this._waitedForView ? "No view is loaded." : "Loading..";
25365
+ }
25311
25366
  _renderRow(item, depth, parent) {
25312
25367
  var _a;
25313
25368
  if (!(item === null || item === void 0 ? void 0 : item.id)) {
@@ -25769,11 +25824,20 @@ class WidgetLeftPanelTabDashboard extends WidgetLeftPanelTab.ATab {
25769
25824
  padding: 24px;
25770
25825
  }
25771
25826
 
25772
- .NextspaceLeftPanelTabDashboardBranding >svg {
25773
- height: max-content;
25827
+ /* Matches the svg through its click wrapper, so the artwork's intrinsic size can't win. */
25828
+ .NextspaceLeftPanelTabDashboardLogo {
25829
+ cursor: pointer;
25830
+ display: block;
25774
25831
  max-width: 220px;
25775
25832
  }
25776
25833
 
25834
+ .NextspaceLeftPanelTabDashboardLogo >svg {
25835
+ display: block;
25836
+ height: auto;
25837
+ max-width: 100%;
25838
+ width: 100%;
25839
+ }
25840
+
25777
25841
  .NextspaceLeftPanelTabDashboardLinks {
25778
25842
  align-items: center;
25779
25843
  display: flex;
@@ -25893,8 +25957,8 @@ class WidgetLeftPanelTabDashboard extends WidgetLeftPanelTab.ATab {
25893
25957
  // Once an account or view brands the panel, the Nextspace mark steps back to "powered by".
25894
25958
  const hasCustomBranding = !!(this._accountBrandingUrl || this._viewBrandingUrl);
25895
25959
  const logo = document.createElement("div");
25960
+ logo.className = "NextspaceLeftPanelTabDashboardLogo";
25896
25961
  logo.innerHTML = hasCustomBranding ? ICON_NEXTSPACE_POWERED : ICON_NEXTSPACE_LEAF;
25897
- logo.style.cursor = "pointer";
25898
25962
  logo.title = "Nextspace";
25899
25963
  logo.onclick = () => {
25900
25964
  window.open(NEXTSPACE_URL, "_blank");
@@ -42205,7 +42269,7 @@ var StyleUtils;
42205
42269
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
42206
42270
  })(StyleUtils || (StyleUtils = {}));
42207
42271
 
42208
- const VERSION = "7.1.1";
42272
+ const VERSION = "7.1.3";
42209
42273
  /**
42210
42274
  * Updates the environment instance used by bruce-cesium to one specified.
42211
42275
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.