@itwin/core-frontend 5.1.0-dev.13 → 5.1.0-dev.15
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/lib/cjs/IModelApp.d.ts +15 -0
- package/lib/cjs/IModelApp.d.ts.map +1 -1
- package/lib/cjs/IModelApp.js +19 -1
- package/lib/cjs/IModelApp.js.map +1 -1
- package/lib/cjs/IpcApp.d.ts +1 -0
- package/lib/cjs/IpcApp.d.ts.map +1 -1
- package/lib/cjs/IpcApp.js +3 -1
- package/lib/cjs/IpcApp.js.map +1 -1
- package/lib/cjs/extension/providers/ExtensionLoadScript.js.map +1 -1
- package/lib/cjs/internal/tile/ClassifierTileTree.js +3 -1
- package/lib/cjs/internal/tile/ClassifierTileTree.js.map +1 -1
- package/lib/cjs/internal/tile/PrimaryTileTree.d.ts.map +1 -1
- package/lib/cjs/internal/tile/PrimaryTileTree.js +4 -3
- package/lib/cjs/internal/tile/PrimaryTileTree.js.map +1 -1
- package/lib/cjs/quantity-formatting/QuantityFormatter.d.ts +76 -7
- package/lib/cjs/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
- package/lib/cjs/quantity-formatting/QuantityFormatter.js +126 -23
- package/lib/cjs/quantity-formatting/QuantityFormatter.js.map +1 -1
- package/lib/cjs/tile/TileAdmin.d.ts +10 -0
- package/lib/cjs/tile/TileAdmin.d.ts.map +1 -1
- package/lib/cjs/tile/TileAdmin.js +3 -0
- package/lib/cjs/tile/TileAdmin.js.map +1 -1
- package/lib/cjs/tools/MeasureTool.d.ts +9 -0
- package/lib/cjs/tools/MeasureTool.d.ts.map +1 -1
- package/lib/cjs/tools/MeasureTool.js +53 -22
- package/lib/cjs/tools/MeasureTool.js.map +1 -1
- package/lib/esm/IModelApp.d.ts +15 -0
- package/lib/esm/IModelApp.d.ts.map +1 -1
- package/lib/esm/IModelApp.js +20 -2
- package/lib/esm/IModelApp.js.map +1 -1
- package/lib/esm/IpcApp.d.ts +1 -0
- package/lib/esm/IpcApp.d.ts.map +1 -1
- package/lib/esm/IpcApp.js +3 -1
- package/lib/esm/IpcApp.js.map +1 -1
- package/lib/esm/extension/providers/ExtensionLoadScript.js +1 -1
- package/lib/esm/extension/providers/ExtensionLoadScript.js.map +1 -1
- package/lib/esm/internal/tile/ClassifierTileTree.js +3 -1
- package/lib/esm/internal/tile/ClassifierTileTree.js.map +1 -1
- package/lib/esm/internal/tile/PrimaryTileTree.d.ts.map +1 -1
- package/lib/esm/internal/tile/PrimaryTileTree.js +4 -3
- package/lib/esm/internal/tile/PrimaryTileTree.js.map +1 -1
- package/lib/esm/quantity-formatting/QuantityFormatter.d.ts +76 -7
- package/lib/esm/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
- package/lib/esm/quantity-formatting/QuantityFormatter.js +124 -23
- package/lib/esm/quantity-formatting/QuantityFormatter.js.map +1 -1
- package/lib/esm/tile/TileAdmin.d.ts +10 -0
- package/lib/esm/tile/TileAdmin.d.ts.map +1 -1
- package/lib/esm/tile/TileAdmin.js +3 -0
- package/lib/esm/tile/TileAdmin.js.map +1 -1
- package/lib/esm/tools/MeasureTool.d.ts +9 -0
- package/lib/esm/tools/MeasureTool.d.ts.map +1 -1
- package/lib/esm/tools/MeasureTool.js +53 -22
- package/lib/esm/tools/MeasureTool.js.map +1 -1
- package/lib/public/scripts/parse-imdl-worker.js +1 -1
- package/lib/workers/webpack/parse-imdl-worker.js +1 -1
- package/package.json +20 -20
package/lib/esm/IModelApp.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare const ITWINJS_CORE_VERSION: string;
|
|
|
6
6
|
import { UiAdmin } from "@itwin/appui-abstract";
|
|
7
7
|
import { AccessToken, BeDuration, BeEvent, GuidString } from "@itwin/core-bentley";
|
|
8
8
|
import { AuthorizationClient, Localization, RealityDataAccess, RpcInterfaceDefinition } from "@itwin/core-common";
|
|
9
|
+
import { FormatsProvider } from "@itwin/core-quantity";
|
|
9
10
|
import { WebGLRenderCompatibilityInfo } from "@itwin/webgl-compatibility";
|
|
10
11
|
import { AccuDraw } from "./AccuDraw";
|
|
11
12
|
import { AccuSnap } from "./AccuSnap";
|
|
@@ -87,6 +88,8 @@ export interface IModelAppOptions {
|
|
|
87
88
|
renderSys?: RenderSystem | RenderSystem.Options;
|
|
88
89
|
/** If present, supplies the [[UiAdmin]] for this session. */
|
|
89
90
|
uiAdmin?: UiAdmin;
|
|
91
|
+
/** If present, supplies the [[FormatsProvider]] for this session. */
|
|
92
|
+
formatsProvider?: FormatsProvider;
|
|
90
93
|
/** If present, determines whether iModelApp is a NoRenderApp
|
|
91
94
|
* @internal
|
|
92
95
|
*/
|
|
@@ -165,6 +168,7 @@ export declare class IModelApp {
|
|
|
165
168
|
private static _hubAccess?;
|
|
166
169
|
private static _realityDataAccess?;
|
|
167
170
|
private static _publicPath;
|
|
171
|
+
private static _formatsProviderManager;
|
|
168
172
|
protected constructor();
|
|
169
173
|
/** Event raised just before the frontend IModelApp is to be [[shutdown]]. */
|
|
170
174
|
static readonly onBeforeShutdown: BeEvent<() => void>;
|
|
@@ -236,6 +240,12 @@ export declare class IModelApp {
|
|
|
236
240
|
* The path should always end with a trailing `/`.
|
|
237
241
|
*/
|
|
238
242
|
static get publicPath(): string;
|
|
243
|
+
/** The [[FormatsProvider]] for this session.
|
|
244
|
+
* @param provider The provider to use for formatting quantities.
|
|
245
|
+
* @beta
|
|
246
|
+
*/
|
|
247
|
+
static get formatsProvider(): FormatsProvider;
|
|
248
|
+
static set formatsProvider(provider: FormatsProvider);
|
|
239
249
|
/** @alpha */
|
|
240
250
|
static readonly extensionAdmin: ExtensionAdmin;
|
|
241
251
|
/** Map of classFullName to EntityState class */
|
|
@@ -350,6 +360,11 @@ export declare class IModelApp {
|
|
|
350
360
|
* @beta
|
|
351
361
|
*/
|
|
352
362
|
static translateStatus(status: number): string;
|
|
363
|
+
/**
|
|
364
|
+
* Resets the formatsProvider back to the default [[QuantityTypeFormatsProvider]].
|
|
365
|
+
* @beta
|
|
366
|
+
*/
|
|
367
|
+
static resetFormatsProvider(): void;
|
|
353
368
|
/**
|
|
354
369
|
* Creates an instance of the ExtensionAdmin
|
|
355
370
|
* and registers an event to execute after startup is complete
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelApp.d.ts","sourceRoot":"","sources":["../../src/IModelApp.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,cAAc;AACd,eAAO,MAAM,oBAAoB,EAA0B,MAAM,CAAC;AAGlE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAA0C,UAAU,EAAyC,MAAM,qBAAqB,CAAC;AAClK,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,iBAAiB,EAAoB,sBAAsB,EAAqC,MAAM,oBAAoB,CAAC;AAEvK,OAAO,EAA4B,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,
|
|
1
|
+
{"version":3,"file":"IModelApp.d.ts","sourceRoot":"","sources":["../../src/IModelApp.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,cAAc;AACd,eAAO,MAAM,oBAAoB,EAA0B,MAAM,CAAC;AAGlE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAA0C,UAAU,EA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AAC,EAAE,WAAW,CAAC;QACrB,4CAA4C;QAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,qCAAqC;QACrC,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,wCAAwC;QACxC,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,wCAAwC;QACxC,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;IAiBD;;;OAGG;WACW,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,WAAW;IAyC9D;;OAEG;IACH,OAAc,mBAAmB,CAAC,EAAE,MAAM,mBAAmB,CAAC;IAE9D;;;OAGG;WACW,YAAY,CACxB,IAAI,EAAE;QACJ,2FAA2F;QAC3F,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC;QAC9B,kEAAkE;QAClE,OAAO,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;QACpC,sEAAsE;QACtE,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,yEAAyE;QACzE,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;KAC/B,GAAG,mBAAmB;IA4BzB;;OAEG;WACW,oBAAoB;IAQlC;;OAEG;WACW,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,WAAW;IAQ9D;;;;OAIG;WACW,eAAe,CAAC,MAAM,EAAE,MAAM;IAiB5C;;;OAGG;WACW,oBAAoB;IAIlC;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;CAKrC"}
|
package/lib/esm/IModelApp.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import packageJson from "../../package.json";
|
|
11
11
|
/** @public */
|
|
12
12
|
export const ITWINJS_CORE_VERSION = packageJson.version;
|
|
13
|
-
const COPYRIGHT_NOTICE =
|
|
13
|
+
const COPYRIGHT_NOTICE = `Copyright © 2017-${new Date().getFullYear()} <a href="https://www.bentley.com" target="_blank" rel="noopener noreferrer">Bentley Systems, Inc.</a>`;
|
|
14
14
|
import { UiAdmin } from "@itwin/appui-abstract";
|
|
15
15
|
import { BeDuration, BeEvent, BentleyStatus, DbResult, dispose, Guid, IModelStatus, Logger, ProcessDetector } from "@itwin/core-bentley";
|
|
16
16
|
import { RpcConfiguration } from "@itwin/core-common";
|
|
@@ -29,7 +29,7 @@ import { FrontendLoggerCategory } from "./common/FrontendLoggerCategory";
|
|
|
29
29
|
import * as modelselector from "./ModelSelectorState";
|
|
30
30
|
import * as modelState from "./ModelState";
|
|
31
31
|
import { NotificationManager } from "./NotificationManager";
|
|
32
|
-
import { QuantityFormatter } from "./quantity-formatting/QuantityFormatter";
|
|
32
|
+
import { FormatsProviderManager, QuantityFormatter, QuantityTypeFormatsProvider } from "./quantity-formatting/QuantityFormatter";
|
|
33
33
|
import { RenderSystem } from "./render/RenderSystem";
|
|
34
34
|
import { System } from "./internal/render/webgl/System";
|
|
35
35
|
import * as sheetState from "./SheetViewState";
|
|
@@ -86,6 +86,7 @@ export class IModelApp {
|
|
|
86
86
|
static _hubAccess;
|
|
87
87
|
static _realityDataAccess;
|
|
88
88
|
static _publicPath;
|
|
89
|
+
static _formatsProviderManager;
|
|
89
90
|
// No instances of IModelApp may be created. All members are static and must be on the singleton object IModelApp.
|
|
90
91
|
constructor() { }
|
|
91
92
|
/** Event raised just before the frontend IModelApp is to be [[shutdown]]. */
|
|
@@ -160,6 +161,14 @@ export class IModelApp {
|
|
|
160
161
|
* The path should always end with a trailing `/`.
|
|
161
162
|
*/
|
|
162
163
|
static get publicPath() { return this._publicPath; }
|
|
164
|
+
/** The [[FormatsProvider]] for this session.
|
|
165
|
+
* @param provider The provider to use for formatting quantities.
|
|
166
|
+
* @beta
|
|
167
|
+
*/
|
|
168
|
+
static get formatsProvider() { return this._formatsProviderManager; }
|
|
169
|
+
static set formatsProvider(provider) {
|
|
170
|
+
this._formatsProviderManager.formatsProvider = provider;
|
|
171
|
+
}
|
|
163
172
|
/** @alpha */
|
|
164
173
|
static extensionAdmin = this._createExtensionAdmin();
|
|
165
174
|
/** Map of classFullName to EntityState class */
|
|
@@ -263,6 +272,7 @@ export class IModelApp {
|
|
|
263
272
|
this._terrainProviderRegistry = new TerrainProviderRegistry();
|
|
264
273
|
this._realityDataSourceProviders = new RealityDataSourceProviderRegistry();
|
|
265
274
|
this._realityDataAccess = opts.realityDataAccess;
|
|
275
|
+
this._formatsProviderManager = new FormatsProviderManager(opts.formatsProvider ?? new QuantityTypeFormatsProvider());
|
|
266
276
|
this._publicPath = opts.publicPath ?? "";
|
|
267
277
|
[
|
|
268
278
|
this.renderSystem,
|
|
@@ -296,6 +306,7 @@ export class IModelApp {
|
|
|
296
306
|
this._entityClasses.clear();
|
|
297
307
|
this.authorizationClient = undefined;
|
|
298
308
|
this._initialized = false;
|
|
309
|
+
this.resetFormatsProvider();
|
|
299
310
|
this.onAfterStartup.clear();
|
|
300
311
|
}
|
|
301
312
|
/** Controls how frequently the application polls for changes that may require a new animation frame to be requested.
|
|
@@ -546,6 +557,13 @@ export class IModelApp {
|
|
|
546
557
|
}
|
|
547
558
|
return this.localization.getLocalizedString(`iModelJs:${key.scope}.${key.val}`, key);
|
|
548
559
|
}
|
|
560
|
+
/**
|
|
561
|
+
* Resets the formatsProvider back to the default [[QuantityTypeFormatsProvider]].
|
|
562
|
+
* @beta
|
|
563
|
+
*/
|
|
564
|
+
static resetFormatsProvider() {
|
|
565
|
+
this.formatsProvider = new QuantityTypeFormatsProvider();
|
|
566
|
+
}
|
|
549
567
|
/**
|
|
550
568
|
* Creates an instance of the ExtensionAdmin
|
|
551
569
|
* and registers an event to execute after startup is complete
|
package/lib/esm/IModelApp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelApp.js","sourceRoot":"","sources":["../../src/IModelApp.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,4HAA4H;AAC5H,wDAAwD;AACxD,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,cAAc;AACd,MAAM,CAAC,MAAM,oBAAo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AC,CAAC;QAC/D,OAAO,cAAc,CAAC;IACxB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module IModelApp\n */\n\n// @ts-expect-error package.json will resolve from the lib/{cjs,esm} dir without copying it into the build output we deliver\n// eslint-disable-next-line @itwin/import-within-package\nimport packageJson from \"../../package.json\";\n/** @public */\nexport const ITWINJS_CORE_VERSION = packageJson.version as string;\nconst COPYRIGHT_NOTICE = 'Copyright © 2017-2024 <a href=\"https://www.bentley.com\" target=\"_blank\" rel=\"noopener noreferrer\">Bentley Systems, Inc.</a>';\n\nimport { UiAdmin } from \"@itwin/appui-abstract\";\nimport { AccessToken, BeDuration, BeEvent, BentleyStatus, DbResult, dispose, Guid, GuidString, IModelStatus, Logger, ProcessDetector } from \"@itwin/core-bentley\";\nimport { AuthorizationClient, Localization, RealityDataAccess, RpcConfiguration, RpcInterfaceDefinition, RpcRequest, SerializedRpcActivity } from \"@itwin/core-common\";\nimport { ITwinLocalization } from \"@itwin/core-i18n\";\nimport { queryRenderCompatibility, WebGLRenderCompatibilityInfo } from \"@itwin/webgl-compatibility\";\nimport { AccuDraw } from \"./AccuDraw\";\nimport { AccuSnap } from \"./AccuSnap\";\nimport * as auxCoordState from \"./AuxCoordSys\";\nimport * as categorySelectorState from \"./CategorySelectorState\";\nimport { ExtensionAdmin } from \"./extension/ExtensionAdmin\";\nimport * as displayStyleState from \"./DisplayStyleState\";\nimport * as drawingViewState from \"./DrawingViewState\";\nimport { ElementLocateManager } from \"./ElementLocateManager\";\nimport { EntityState } from \"./EntityState\";\nimport { FrontendHubAccess } from \"./FrontendHubAccess\";\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\nimport * as modelselector from \"./ModelSelectorState\";\nimport * as modelState from \"./ModelState\";\nimport { NotificationManager } from \"./NotificationManager\";\nimport { QuantityFormatter } from \"./quantity-formatting/QuantityFormatter\";\nimport { RenderSystem } from \"./render/RenderSystem\";\nimport { System } from \"./internal/render/webgl/System\";\nimport * as sheetState from \"./SheetViewState\";\nimport * as spatialViewState from \"./SpatialViewState\";\nimport { TentativePoint } from \"./TentativePoint\";\nimport { RealityDataSourceProviderRegistry } from \"./RealityDataSource\";\nimport { MapLayerFormatRegistry, MapLayerOptions, TerrainProviderRegistry, TileAdmin } from \"./tile/internal\";\nimport * as accudrawTool from \"./tools/AccuDrawTool\";\nimport * as clipViewTool from \"./tools/ClipViewTool\";\nimport * as idleTool from \"./tools/IdleTool\";\nimport * as measureTool from \"./tools/MeasureTool\";\nimport * as selectTool from \"./tools/SelectTool\";\nimport { ToolRegistry } from \"./tools/Tool\";\nimport { ToolAdmin } from \"./tools/ToolAdmin\";\nimport * as viewTool from \"./tools/ViewTool\";\nimport { UserPreferencesAccess } from \"./UserPreferences\";\nimport { ViewManager } from \"./ViewManager\";\nimport * as viewState from \"./ViewState\";\nimport \"./IModeljs-css\";\n\n// cSpell:ignore noopener noreferrer gprid forin nbsp csrf xsrf\n\n/** Options that can be supplied with [[IModelAppOptions]] to customize frontend security.\n * @public\n * @extensions\n */\nexport interface FrontendSecurityOptions {\n /** Configures protection from Cross Site Request Forgery attacks. */\n readonly csrfProtection?: {\n /** If enabled, IModelApp will extract the CSRF token for the current session from the document's cookies and send it with each request as a header value. */\n readonly enabled: boolean;\n /** Defaults to XSRF-TOKEN. */\n readonly cookieName?: string;\n /** Defaults to X-XSRF-TOKEN. */\n readonly headerName?: string;\n };\n}\n\n/** Options that can be supplied to [[IModelApp.startup]] to customize frontend behavior.\n * @public\n */\nexport interface IModelAppOptions {\n /** If present, supplies the [[FrontendHubAccess]] for this session. */\n hubAccess?: FrontendHubAccess;\n /** If present, supplies the Id of this application. Applications must set this to the Bentley Global Product Registry Id (GPRID) for usage logging. */\n applicationId?: string;\n /** If present, supplies the version of this application. Must be set for usage logging. */\n applicationVersion?: string;\n /** If present, supplies the [[UserPreferencesAccess]] for this session.\n * @beta\n */\n userPreferences?: UserPreferencesAccess;\n /** If present, supplies the [[ViewManager]] for this session. */\n viewManager?: ViewManager;\n /** If present, supplies Map Layer Options for this session such as Azure Access Keys\n * @beta\n */\n mapLayerOptions?: MapLayerOptions;\n /** If present, supplies the properties with which to initialize the [[TileAdmin]] for this session. */\n tileAdmin?: TileAdmin.Props;\n /** If present, supplies the [[NotificationManager]] for this session. */\n notifications?: NotificationManager;\n /** If present, supplies the [[ToolAdmin]] for this session. */\n toolAdmin?: ToolAdmin;\n /** If present, supplies the [[AccuDraw]] for this session. */\n accuDraw?: AccuDraw;\n /** If present, supplies the [[AccuSnap]] for this session. */\n accuSnap?: AccuSnap;\n /** If present, supplies the [[Localization]] for this session. Defaults to [ITwinLocalization]($i18n). */\n localization?: Localization;\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\n authorizationClient?: AuthorizationClient;\n /** If present, supplies security options for the frontend. */\n security?: FrontendSecurityOptions;\n /** @internal */\n sessionId?: GuidString;\n /** @internal */\n locateManager?: ElementLocateManager;\n /** If present, supplies the [[TentativePoint]] for this session. */\n tentativePoint?: TentativePoint;\n /** @internal */\n quantityFormatter?: QuantityFormatter;\n /** If present, supplies an implementation of the render system, or options for initializing the default render system. */\n renderSys?: RenderSystem | RenderSystem.Options;\n /** If present, supplies the [[UiAdmin]] for this session. */\n uiAdmin?: UiAdmin;\n /** If present, determines whether iModelApp is a NoRenderApp\n * @internal\n */\n noRender?: boolean;\n\n /**\n * @deprecated in 3.7. Specify desired RPC interfaces in the platform-specific RPC manager call instead.\n * See [[MobileRpcManager.initializeClient]], [[ElectronRpcManager.initializeFrontend]], [[BentleyCloudRpcManager.initializeClient]].\n */\n rpcInterfaces?: RpcInterfaceDefinition[];\n\n /** @beta */\n realityDataAccess?: RealityDataAccess;\n /** If present, overrides where public assets are fetched. The default is to fetch assets relative to the current URL.\n * The path should always end with a trailing `/`.\n */\n publicPath?: string;\n}\n\n/** Options for [[IModelApp.makeModalDiv]]\n * @public\n */\nexport interface ModalOptions {\n /** Width for the Modal dialog box. */\n width?: number;\n /** The dialog should be dismissed if the user clicks anywhere or hits Enter or Escape on the keyboard. */\n autoClose?: boolean;\n /** Show an 'x' in the upper right corner to close the dialog */\n closeBox?: boolean;\n /** The parent for the semi transparent *darkening* div. If not present, use `document.body` */\n rootDiv?: HTMLElement;\n}\n\n/** Return type for [[IModelApp.makeModalDiv]]\n * @public\n */\nexport interface ModalReturn {\n /** The modal HTMLDivElement created. */\n modal: HTMLDivElement;\n /** A function that can be set as an event handler to stop the modal dialog. This can be used if [[ModalOptions.autoClose]] or [[IModalOptions.closeBox]]\n * were not enabled for the dialog.\n */\n stop: (_ev: Event) => void;\n}\n\n/** We hang the IModelApp object off the global `window` object in IModelApp.startup for debugging purposes.\n * It's removed in IModelApp.shutdown.\n */\ninterface IModelAppForDebugger {\n iModelAppForDebugger?: typeof IModelApp;\n}\n\n/**\n * Global singleton that connects the user interface with the iTwin.js services. There can be only one IModelApp active in a session. All\n * members of IModelApp are static, and it serves as a singleton object for gaining access to session information.\n *\n * Before any interactive operations may be performed by the `@itwin/core-frontend package`, [[IModelApp.startup]] must be called and awaited.\n * Applications may customize the frontend behavior of iTwin.js by supplying options to [[IModelApp.startup]].\n *\n * @public\n */\nexport class IModelApp {\n private static _initialized = false;\n private static _accuDraw: AccuDraw;\n private static _accuSnap: AccuSnap;\n private static _applicationId: string;\n private static _applicationVersion: string;\n private static _localization: Localization;\n private static _locateManager: ElementLocateManager;\n private static _notifications: NotificationManager;\n private static _quantityFormatter: QuantityFormatter;\n private static _renderSystem?: RenderSystem;\n private static _userPreferences?: UserPreferencesAccess;\n private static _tentativePoint: TentativePoint;\n private static _tileAdmin: TileAdmin;\n private static _toolAdmin: ToolAdmin;\n private static _viewManager: ViewManager;\n private static _uiAdmin: UiAdmin;\n private static _noRender: boolean;\n private static _wantEventLoop = false;\n private static _animationRequested = false;\n private static _animationInterval: BeDuration | undefined = BeDuration.fromSeconds(1);\n private static _animationIntervalId?: number;\n private static _securityOptions: FrontendSecurityOptions;\n private static _mapLayerFormatRegistry: MapLayerFormatRegistry;\n private static _terrainProviderRegistry: TerrainProviderRegistry;\n private static _realityDataSourceProviders: RealityDataSourceProviderRegistry;\n private static _hubAccess?: FrontendHubAccess;\n private static _realityDataAccess?: RealityDataAccess;\n private static _publicPath: string;\n\n // No instances of IModelApp may be created. All members are static and must be on the singleton object IModelApp.\n protected constructor() { }\n\n /** Event raised just before the frontend IModelApp is to be [[shutdown]]. */\n public static readonly onBeforeShutdown = new BeEvent<() => void>();\n\n /** Event raised after IModelApp [[startup]] completes. */\n public static readonly onAfterStartup = new BeEvent<() => void>();\n\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\n public static authorizationClient?: AuthorizationClient;\n /** The [[ToolRegistry]] for this session. */\n public static readonly tools = new ToolRegistry();\n /** A uniqueId for this session */\n public static sessionId: GuidString;\n /** The [[MapLayerFormatRegistry]] for this session. */\n public static get mapLayerFormatRegistry(): MapLayerFormatRegistry { return this._mapLayerFormatRegistry; }\n /** The [[TerrainProviderRegistry]] for this session. */\n public static get terrainProviderRegistry(): TerrainProviderRegistry { return this._terrainProviderRegistry; }\n /** The [[RealityDataSourceProviderRegistry]] for this session.\n * @alpha\n */\n public static get realityDataSourceProviders(): RealityDataSourceProviderRegistry { return this._realityDataSourceProviders; }\n /** The [[RenderSystem]] for this session. */\n public static get renderSystem(): RenderSystem { return this._renderSystem!; }\n /** The [[ViewManager]] for this session. */\n public static get viewManager(): ViewManager { return this._viewManager; }\n /** The [[NotificationManager]] for this session. */\n public static get notifications(): NotificationManager { return this._notifications; }\n /** The [[TileAdmin]] for this session. */\n public static get tileAdmin(): TileAdmin { return this._tileAdmin; }\n /** The [[QuantityFormatter]] for this session. */\n public static get quantityFormatter(): QuantityFormatter { return this._quantityFormatter; }\n /** The [[ToolAdmin]] for this session. */\n public static get toolAdmin(): ToolAdmin { return this._toolAdmin; }\n /** The [[AccuDraw]] for this session. */\n public static get accuDraw(): AccuDraw { return this._accuDraw; }\n /** The [[AccuSnap]] for this session. */\n public static get accuSnap(): AccuSnap { return this._accuSnap; }\n public static get locateManager(): ElementLocateManager { return this._locateManager; }\n /** The [[TentativePoint]] for this session]]. */\n public static get tentativePoint(): TentativePoint { return this._tentativePoint; }\n /** The [[Localization]] for this session. */\n public static get localization(): Localization { return this._localization; }\n /** The [[UserPreferencesAccess]] for this session.\n * @beta\n */\n public static get userPreferences(): UserPreferencesAccess | undefined { return this._userPreferences; }\n /** The Id of this application. Applications must set this to the Global Product Registry ID (GPRID) for usage logging. */\n public static get applicationId(): string { return this._applicationId; }\n /** The version of this application. Must be set for usage logging. */\n public static get applicationVersion(): string { return this._applicationVersion; }\n /** True after [[startup]] has been called, until [[shutdown]] is called. */\n public static get initialized() { return this._initialized; }\n\n /** Provides access to IModelHub services. */\n public static get hubAccess(): FrontendHubAccess | undefined { return this._hubAccess; }\n\n /** Provides access to the RealityData service implementation for this IModelApp\n * @beta\n */\n public static get realityDataAccess(): RealityDataAccess | undefined { return this._realityDataAccess; }\n\n /** Whether the [renderSystem[]] has been successfully initialized.\n * This will always be `false` before calling [[startup]] and after calling [[shutdown]].\n * In rare circumstances (e.g., while executing in a headless test environment) it may remain `false` due to a failure to\n * obtain a [WebGL rendering context](https://www.google.com/search?channel=fs&client=ubuntu-sn&q=mdn+webglrenderingcontext).\n * As long as you have called [[startup]], you can generally assume it to be `true`.\n */\n public static get hasRenderSystem() {\n return this._renderSystem !== undefined && this._renderSystem.isValid;\n }\n\n /** The [[UiAdmin]] for this session. */\n public static get uiAdmin() { return this._uiAdmin; }\n /** The requested security options for the frontend. */\n public static get securityOptions() { return this._securityOptions; }\n\n /** If present, overrides where public assets are fetched. The default is to fetch assets relative to the current URL.\n * The path should always end with a trailing `/`.\n */\n public static get publicPath() { return this._publicPath; }\n\n /** @alpha */\n public static readonly extensionAdmin = this._createExtensionAdmin();\n\n /** Map of classFullName to EntityState class */\n private static _entityClasses = new Map<string, typeof EntityState>();\n\n /** Register all of the subclasses of EntityState from a module.\n * @internal\n */\n public static registerModuleEntities(moduleObj: any) {\n for (const thisMember in moduleObj) { // eslint-disable-line guard-for-in\n const thisEntityState = moduleObj[thisMember];\n if (thisEntityState.prototype instanceof EntityState) {\n this.registerEntityState(thisEntityState.classFullName, thisEntityState);\n }\n }\n }\n\n /** Register an EntityState class by its classFullName\n * @internal\n */\n public static registerEntityState(classFullName: string, classType: typeof EntityState) {\n const lowerName = classFullName.toLowerCase();\n if (this._entityClasses.has(lowerName)) {\n const errMsg = `Class ${classFullName} is already registered. Make sure static schemaName and className members are correct on class ${classType.name}`;\n Logger.logError(FrontendLoggerCategory.IModelConnection, errMsg);\n throw new Error(errMsg);\n }\n\n this._entityClasses.set(lowerName, classType);\n }\n\n /** @internal */\n public static lookupEntityClass(classFullName: string) { return this._entityClasses.get(classFullName.toLowerCase()); }\n\n /**\n * Obtain WebGL rendering compatibility information for the client system. This information describes whether the client meets the\n * minimum rendering capabilities. It also describes whether the system lacks any optional capabilities that could improve quality\n * and/or performance.\n * @note As of 4.x, iTwin.js requires WebGL 2. If the client does not support WebGL 2, the `status` field of the returned compatibility info will be [WebGLRenderCompatibilityStatus.CannotCreateContext]($webgl-compatibility).\n */\n public static queryRenderCompatibility(): WebGLRenderCompatibilityInfo {\n return queryRenderCompatibility(true, (canvas, useWebGL2, inputContextAttributes) => System.createContext(canvas, useWebGL2, inputContextAttributes));\n }\n\n /**\n * This method must be called before any other `@itwin/core-frontend` methods are used.\n * Somewhere in your startup code, call [[IModelApp.startup]]. E.g.:\n * ``` ts\n * await IModelApp.startup( {applicationId: myAppId} );\n * ```\n * @param opts The options for configuring IModelApp\n */\n public static async startup(opts?: IModelAppOptions): Promise<void> {\n if (this._initialized)\n return; // we're already initialized, do nothing.\n this._initialized = true;\n\n opts = opts ?? {};\n this._securityOptions = opts.security ?? {};\n\n if (process.env.NODE_ENV === \"development\") {\n // Make IModelApp globally accessible for debugging purposes. We'll remove it on shutdown.\n (window as IModelAppForDebugger).iModelAppForDebugger = this;\n }\n\n this.sessionId = opts.sessionId ?? Guid.createValue();\n this._applicationId = opts.applicationId ?? \"2686\"; // Default to product id of iTwin.js\n this._applicationVersion = opts.applicationVersion ?? \"1.0.0\";\n this.authorizationClient = opts.authorizationClient;\n this._hubAccess = opts.hubAccess;\n this._noRender = opts.noRender ?? false;\n\n this._setupRpcRequestContext();\n\n this._localization = opts.localization ?? new ITwinLocalization();\n const toolsNs = \"CoreTools\";\n await this.localization.initialize([\"iModelJs\", toolsNs]);\n [\n selectTool,\n idleTool,\n viewTool,\n clipViewTool,\n measureTool,\n accudrawTool,\n ].forEach((tool) => this.tools.registerModule(tool, toolsNs));\n\n this.registerEntityState(EntityState.classFullName, EntityState);\n [\n modelState,\n sheetState,\n viewState,\n drawingViewState,\n spatialViewState,\n displayStyleState,\n modelselector,\n categorySelectorState,\n auxCoordState,\n ].forEach((module) => this.registerModuleEntities(module));\n\n this._renderSystem = (opts.renderSys instanceof RenderSystem) ? opts.renderSys : this.createRenderSys(opts.renderSys);\n if (opts.userPreferences)\n this._userPreferences = opts.userPreferences;\n this._viewManager = opts.viewManager ?? new ViewManager();\n this._tileAdmin = await TileAdmin.create(opts.tileAdmin);\n this._notifications = opts.notifications ?? new NotificationManager();\n this._toolAdmin = opts.toolAdmin ?? new ToolAdmin();\n this._accuDraw = opts.accuDraw ?? new AccuDraw();\n this._accuSnap = opts.accuSnap ?? new AccuSnap();\n this._locateManager = opts.locateManager ?? new ElementLocateManager();\n this._tentativePoint = opts.tentativePoint ?? new TentativePoint();\n this._quantityFormatter = opts.quantityFormatter ?? new QuantityFormatter();\n this._uiAdmin = opts.uiAdmin ?? new UiAdmin();\n this._mapLayerFormatRegistry = new MapLayerFormatRegistry(opts.mapLayerOptions);\n this._terrainProviderRegistry = new TerrainProviderRegistry();\n this._realityDataSourceProviders = new RealityDataSourceProviderRegistry();\n this._realityDataAccess = opts.realityDataAccess;\n this._publicPath = opts.publicPath ?? \"\";\n\n [\n this.renderSystem,\n this.viewManager,\n this.toolAdmin,\n this.accuDraw,\n this.accuSnap,\n this.locateManager,\n this.tentativePoint,\n this.uiAdmin,\n ].forEach((sys) => sys.onInitialized());\n\n await this.quantityFormatter.onInitialized();\n this.onAfterStartup.raiseEvent();\n }\n\n /** Must be called before the application exits to release any held resources. */\n public static async shutdown() {\n if (!this._initialized)\n return;\n\n // notify listeners that this IModelApp is about to be shut down.\n this.onBeforeShutdown.raiseEvent();\n this.onBeforeShutdown.clear();\n\n if (process.env.NODE_ENV === \"development\") {\n (window as IModelAppForDebugger).iModelAppForDebugger = undefined;\n }\n\n this._wantEventLoop = false;\n window.removeEventListener(\"resize\", () => IModelApp.requestNextAnimation());\n this.clearIntervalAnimation();\n [this.toolAdmin, this.viewManager, this.tileAdmin].forEach((sys) => sys.onShutDown());\n this.tools.shutdown();\n this._renderSystem = dispose(this._renderSystem);\n this._entityClasses.clear();\n this.authorizationClient = undefined;\n this._initialized = false;\n this.onAfterStartup.clear();\n }\n\n /** Controls how frequently the application polls for changes that may require a new animation frame to be requested.\n * Such changes include resizing a Viewport or changing the device pixel ratio by zooming in or out in the browser.\n * The default interval is 1 second. It may be desirable to override the default for specific apps and/or devices.\n * - Increasing the interval can conserve battery life on battery-powered devices at the expense of slower response to resize events.\n * - An application that only displays a single Viewport whose dimensions only change when the dimensions of the application window change, and which does not support changing application zoom level, could disable the interval altogether.\n * @param interval The interval at which to poll for changes. If undefined (or negative), the application will never poll. If zero, the application will poll as frequently as possible.\n * @beta\n */\n public static get animationInterval(): BeDuration | undefined { return IModelApp._animationInterval; }\n public static set animationInterval(interval: BeDuration | undefined) {\n if (undefined !== interval && interval.isTowardsPast)\n interval = undefined;\n\n if (interval !== IModelApp._animationInterval) {\n IModelApp._animationInterval = interval;\n if (IModelApp._wantEventLoop)\n IModelApp.requestIntervalAnimation();\n }\n }\n\n /** Request that the event loop execute on the next [animation frame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame).\n * There is generally no reason for applications to invoke this method directly.\n */\n public static requestNextAnimation() {\n // Only want to call requestAnimationFrame if it is defined. Need to check whether current iModelApp is a NoRenderApp.\n if (IModelApp._noRender)\n return;\n\n if (!IModelApp._animationRequested) {\n IModelApp._animationRequested = true;\n requestAnimationFrame(() => IModelApp.eventLoop());\n }\n }\n\n /** @internal */\n private static clearIntervalAnimation(): void {\n if (undefined !== IModelApp._animationIntervalId) {\n window.clearInterval(IModelApp._animationIntervalId);\n IModelApp._animationIntervalId = undefined;\n }\n }\n\n /** @internal */\n private static requestIntervalAnimation(): void {\n IModelApp.clearIntervalAnimation();\n\n if (undefined !== IModelApp.animationInterval)\n IModelApp._animationIntervalId = window.setInterval(() => {\n IModelApp.requestNextAnimation();\n }, IModelApp.animationInterval.milliseconds);\n }\n\n /** @internal */\n public static startEventLoop() {\n if (!IModelApp._wantEventLoop) {\n IModelApp._wantEventLoop = true;\n window.addEventListener(\"resize\", () => IModelApp.requestNextAnimation());\n IModelApp.requestIntervalAnimation();\n IModelApp.requestNextAnimation();\n }\n }\n\n /** Strictly for tests. @internal */\n public static stopEventLoop() {\n this._wantEventLoop = false;\n }\n\n /** The main event processing loop for Tools and rendering. */\n private static eventLoop() {\n IModelApp._animationRequested = false;\n if (!IModelApp._wantEventLoop) // flag turned on at startup\n return;\n\n try {\n IModelApp.toolAdmin.processEvent(); // eslint-disable-line @typescript-eslint/no-floating-promises\n IModelApp.viewManager.renderLoop();\n IModelApp.tileAdmin.process();\n } catch (exception) {\n ToolAdmin.exceptionHandler(exception); // eslint-disable-line @typescript-eslint/no-floating-promises\n\n IModelApp._wantEventLoop = false;\n IModelApp._animationRequested = true; // unrecoverable after exception, don't request any further frames.\n window.removeEventListener(\"resize\", () => IModelApp.requestNextAnimation());\n }\n }\n\n /** Get the user's access token for this IModelApp, or a blank string if none is available.\n * @note Access tokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value\n * returned by this method may change over time throughout the course of a session.\n */\n public static async getAccessToken(): Promise<AccessToken> {\n try {\n return (await this.authorizationClient?.getAccessToken()) ?? \"\";\n } catch {\n return \"\";\n }\n }\n\n /** @internal */\n public static createRenderSys(opts?: RenderSystem.Options): RenderSystem { return System.create(opts); }\n\n private static _setupRpcRequestContext() {\n RpcConfiguration.requestContext.getId = (_request: RpcRequest): string => {\n return Guid.createValue();\n };\n\n RpcConfiguration.requestContext.serialize = async (_request: RpcRequest): Promise<SerializedRpcActivity> => {\n const id = _request.id;\n const serialized: SerializedRpcActivity = {\n id,\n applicationId: this.applicationId,\n applicationVersion: this.applicationVersion,\n sessionId: this.sessionId,\n authorization: ProcessDetector.isMobileAppFrontend ? \"\" : await this.getAccessToken(),\n };\n\n const csrf = IModelApp.securityOptions.csrfProtection;\n if (csrf && csrf.enabled) {\n const cookieName = csrf.cookieName || \"XSRF-TOKEN\";\n const cookieValue = document.cookie.split(\"; \").find((r) => r.startsWith(`${cookieName}=`));\n\n if (cookieValue) {\n const headerName = csrf.headerName || \"X-XSRF-TOKEN\";\n const headerValue = cookieValue.split(\"=\")[1];\n serialized.csrfToken = { headerName, headerValue };\n }\n }\n\n return serialized;\n };\n }\n\n /** Shortcut for creating an HTMLElement with optional parent, className, id, innerHTML, innerText. */\n public static makeHTMLElement<K extends keyof HTMLElementTagNameMap>(type: K, opt?: {\n /** The parent for the new HTMLElement */\n parent?: HTMLElement;\n /** The className for the new HTMLElement */\n className?: string;\n /** The Id for the new HTMLElement */\n id?: string;\n /** innerHTML for the new HTMLElement */\n innerHTML?: string;\n /** innerText for the new HTMLElement */\n innerText?: string;\n }) {\n const el = document.createElement(type);\n if (undefined !== opt) {\n if (undefined !== opt.className)\n el.className = opt.className;\n if (undefined !== opt.id)\n el.id = opt.id;\n if (undefined !== opt.innerHTML)\n el.innerHTML = opt.innerHTML;\n if (undefined !== opt.innerText)\n el.innerText = opt.innerText;\n if (undefined !== opt.parent)\n opt.parent.appendChild(el);\n }\n return el;\n }\n\n /** Shortcut for making a modal dialog on top of the root of the application. The returned HTMLDivElement will be placed topmost, all other application\n * windows will be covered with a semi-transparent background that intercepts all key/mouse/touch events until the modal is dismissed.\n * @param options The options that describe how the modal should work.\n */\n public static makeModalDiv(options: ModalOptions): ModalReturn {\n const root = options.rootDiv ? options.rootDiv : document.body;\n // create the overlay div to \"black out\" the application to indicate everything is inactive until the modal has been dismissed.\n const overlay = IModelApp.makeHTMLElement(\"div\", { parent: root, className: \"imodeljs-modal-overlay\" });\n overlay.tabIndex = -1; // so we can catch keystroke events\n\n // function to remove modal dialog\n const stop = (ev: Event) => {\n root.removeChild(overlay);\n ev.stopPropagation();\n };\n\n if (options.autoClose) {\n overlay.onclick = overlay.oncontextmenu = stop;\n overlay.onkeydown = overlay.onkeyup = (ev: KeyboardEvent) => { // ignore all keystrokes other than enter and escape\n switch (ev.key) {\n case \"Enter\":\n case \"Escape\":\n stop(ev);\n return;\n }\n ev.stopPropagation();\n };\n overlay.focus();\n }\n\n const modal = IModelApp.makeHTMLElement(\"div\", { parent: overlay, className: \"imodeljs-modal\" });\n if (undefined !== options.width) {\n modal.style.width = `${options.width}px`;\n // allow the dialog to be smaller than the width\n modal.style.maxWidth = `min(100% - (2 * var(--width-border)), ${options.width}px)`;\n }\n if (options.closeBox) {\n const close = IModelApp.makeHTMLElement(\"p\", { parent: modal, className: \"imodeljs-modal-close\" });\n close.innerText = \"\\u00d7\"; // unicode \"times\" symbol\n close.onclick = stop;\n }\n\n return { modal, stop };\n }\n\n /** Applications may implement this method to supply a Logo Card.\n * @beta\n */\n public static applicationLogoCard?: () => HTMLTableRowElement;\n\n /** Make a new Logo Card. Call this method from your implementation of [[IModelApp.applicationLogoCard]]\n * @param opts Options for Logo Card\n * @beta\n */\n public static makeLogoCard(\n opts: {\n /** The heading to be put at the top of this logo card inside an <h2>. May include HTML. */\n heading: string | HTMLElement;\n /** The URL or HTMLImageElement for the icon on this logo card. */\n iconSrc?: string | HTMLImageElement;\n /** The width of the icon, if `iconSrc` is a string. Default is 64. */\n iconWidth?: number;\n /** A *notice* string to be shown on the logo card. May include HTML. */\n notice?: string | HTMLElement;\n }): HTMLTableRowElement {\n const card = IModelApp.makeHTMLElement(\"tr\");\n const iconCell = IModelApp.makeHTMLElement(\"td\", { parent: card, className: \"logo-card-logo\" });\n if (undefined !== opts.iconSrc) {\n if (typeof opts.iconSrc === \"string\") {\n const logo = IModelApp.makeHTMLElement(\"img\");\n logo.src = opts.iconSrc;\n logo.width = opts.iconWidth ? opts.iconWidth : 64;\n opts.iconSrc = logo;\n }\n iconCell.appendChild(opts.iconSrc);\n }\n const noticeCell = IModelApp.makeHTMLElement(\"td\", { parent: card, className: \"logo-card-message\" });\n if (undefined !== opts.heading) {\n if (typeof opts.heading === \"string\")\n IModelApp.makeHTMLElement(\"h2\", { parent: noticeCell, innerHTML: opts.heading, className: \"logo-card-header\" });\n else\n noticeCell.appendChild(opts.heading);\n }\n if (undefined !== opts.notice) {\n if (typeof opts.notice === \"string\")\n IModelApp.makeHTMLElement(\"p\", { parent: noticeCell, innerHTML: opts.notice, className: \"logo-cards\" });\n else\n noticeCell.appendChild(opts.notice);\n }\n return card;\n }\n\n /** Make the logo card for the library itself. This card gets placed at the top of the stack.\n * @internal\n */\n public static makeIModelJsLogoCard() {\n return this.makeLogoCard({\n iconSrc: `${this.publicPath}images/about-imodeljs.svg`,\n heading: `<span style=\"font-weight:normal\">${this.localization.getLocalizedString(\"iModelJs:Notices.PoweredBy\")}</span> iTwin.js`,\n notice: `${ITWINJS_CORE_VERSION}<br>${COPYRIGHT_NOTICE}`,\n });\n }\n\n /** Format the tooltip strings returned by [[IModelConnection.getToolTipMessage]].\n * @alpha\n */\n public static formatElementToolTip(msg: string[]): HTMLElement {\n let out = \"\";\n msg.forEach((line) => out += `${IModelApp.localization?.getLocalizedKeys(line)}<br>`);\n const div = document.createElement(\"div\");\n div.innerHTML = out;\n return div;\n }\n\n /** Localize an error status\n * @param status one of the status values from [BentleyStatus]($core-bentley), [IModelStatus]($core-bentley) or [DbResult]($core-bentley)\n * @returns a localized error message\n * @beta\n */\n public static translateStatus(status: number) {\n let key: { scope: string, val: string, status?: string };\n if (typeof status !== \"number\") {\n key = { scope: \"Errors\", val: \"IllegalValue\" };\n } else {\n key = { scope: \"BentleyStatus\", val: BentleyStatus[status] };\n if (!key.val)\n key = { scope: \"IModelStatus\", val: IModelStatus[status] };\n if (!key.val)\n key = { scope: \"DbResult\", val: DbResult[status] };\n if (!key.val)\n key = { scope: \"Errors\", val: \"Status\", status: status.toString() };\n }\n\n return this.localization.getLocalizedString(`iModelJs:${key.scope}.${key.val}`, key);\n }\n\n /**\n * Creates an instance of the ExtensionAdmin\n * and registers an event to execute after startup is complete\n * @returns an instance of ExtensionAdmin\n */\n private static _createExtensionAdmin(): ExtensionAdmin {\n const extensionAdmin = new ExtensionAdmin();\n IModelApp.onAfterStartup.addListener(extensionAdmin.onStartup);\n return extensionAdmin;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IModelApp.js","sourceRoot":"","sources":["../../src/IModelApp.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,4HAA4H;AAC5H,wDAAwD;AACxD,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,cAAc;AACd,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC,OAAiB,CAAC;AAClE,MAAM,gBAAgB,GAAG,oBAAoB,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,wGAAwG,CAAC;AAE9K,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAe,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAc,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAClK,OAAO,EAAwD,gBAAgB,EAA6D,MAAM,oBAAoB,CAAC;AACvK,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBA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OAIG;IACK,MAAM,CAAC,qBAAqB;QAClC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC;QAC5C,SAAS,CAAC,cAAc,CAAC,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAC/D,OAAO,cAAc,CAAC;IACxB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module IModelApp\n */\n\n// @ts-expect-error package.json will resolve from the lib/{cjs,esm} dir without copying it into the build output we deliver\n// eslint-disable-next-line @itwin/import-within-package\nimport packageJson from \"../../package.json\";\n/** @public */\nexport const ITWINJS_CORE_VERSION = packageJson.version as string;\nconst COPYRIGHT_NOTICE = `Copyright © 2017-${new Date().getFullYear()} <a href=\"https://www.bentley.com\" target=\"_blank\" rel=\"noopener noreferrer\">Bentley Systems, Inc.</a>`;\n\nimport { UiAdmin } from \"@itwin/appui-abstract\";\nimport { AccessToken, BeDuration, BeEvent, BentleyStatus, DbResult, dispose, Guid, GuidString, IModelStatus, Logger, ProcessDetector } from \"@itwin/core-bentley\";\nimport { AuthorizationClient, Localization, RealityDataAccess, RpcConfiguration, RpcInterfaceDefinition, RpcRequest, SerializedRpcActivity } from \"@itwin/core-common\";\nimport { ITwinLocalization } from \"@itwin/core-i18n\";\nimport { FormatsProvider } from \"@itwin/core-quantity\";\nimport { queryRenderCompatibility, WebGLRenderCompatibilityInfo } from \"@itwin/webgl-compatibility\";\nimport { AccuDraw } from \"./AccuDraw\";\nimport { AccuSnap } from \"./AccuSnap\";\nimport * as auxCoordState from \"./AuxCoordSys\";\nimport * as categorySelectorState from \"./CategorySelectorState\";\nimport { ExtensionAdmin } from \"./extension/ExtensionAdmin\";\nimport * as displayStyleState from \"./DisplayStyleState\";\nimport * as drawingViewState from \"./DrawingViewState\";\nimport { ElementLocateManager } from \"./ElementLocateManager\";\nimport { EntityState } from \"./EntityState\";\nimport { FrontendHubAccess } from \"./FrontendHubAccess\";\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\nimport * as modelselector from \"./ModelSelectorState\";\nimport * as modelState from \"./ModelState\";\nimport { NotificationManager } from \"./NotificationManager\";\nimport { FormatsProviderManager, QuantityFormatter, QuantityTypeFormatsProvider } from \"./quantity-formatting/QuantityFormatter\";\nimport { RenderSystem } from \"./render/RenderSystem\";\nimport { System } from \"./internal/render/webgl/System\";\nimport * as sheetState from \"./SheetViewState\";\nimport * as spatialViewState from \"./SpatialViewState\";\nimport { TentativePoint } from \"./TentativePoint\";\nimport { RealityDataSourceProviderRegistry } from \"./RealityDataSource\";\nimport { MapLayerFormatRegistry, MapLayerOptions, TerrainProviderRegistry, TileAdmin } from \"./tile/internal\";\nimport * as accudrawTool from \"./tools/AccuDrawTool\";\nimport * as clipViewTool from \"./tools/ClipViewTool\";\nimport * as idleTool from \"./tools/IdleTool\";\nimport * as measureTool from \"./tools/MeasureTool\";\nimport * as selectTool from \"./tools/SelectTool\";\nimport { ToolRegistry } from \"./tools/Tool\";\nimport { ToolAdmin } from \"./tools/ToolAdmin\";\nimport * as viewTool from \"./tools/ViewTool\";\nimport { UserPreferencesAccess } from \"./UserPreferences\";\nimport { ViewManager } from \"./ViewManager\";\nimport * as viewState from \"./ViewState\";\nimport \"./IModeljs-css\";\n\n// cSpell:ignore noopener noreferrer gprid forin nbsp csrf xsrf\n\n/** Options that can be supplied with [[IModelAppOptions]] to customize frontend security.\n * @public\n * @extensions\n */\nexport interface FrontendSecurityOptions {\n /** Configures protection from Cross Site Request Forgery attacks. */\n readonly csrfProtection?: {\n /** If enabled, IModelApp will extract the CSRF token for the current session from the document's cookies and send it with each request as a header value. */\n readonly enabled: boolean;\n /** Defaults to XSRF-TOKEN. */\n readonly cookieName?: string;\n /** Defaults to X-XSRF-TOKEN. */\n readonly headerName?: string;\n };\n}\n\n/** Options that can be supplied to [[IModelApp.startup]] to customize frontend behavior.\n * @public\n */\nexport interface IModelAppOptions {\n /** If present, supplies the [[FrontendHubAccess]] for this session. */\n hubAccess?: FrontendHubAccess;\n /** If present, supplies the Id of this application. Applications must set this to the Bentley Global Product Registry Id (GPRID) for usage logging. */\n applicationId?: string;\n /** If present, supplies the version of this application. Must be set for usage logging. */\n applicationVersion?: string;\n /** If present, supplies the [[UserPreferencesAccess]] for this session.\n * @beta\n */\n userPreferences?: UserPreferencesAccess;\n /** If present, supplies the [[ViewManager]] for this session. */\n viewManager?: ViewManager;\n /** If present, supplies Map Layer Options for this session such as Azure Access Keys\n * @beta\n */\n mapLayerOptions?: MapLayerOptions;\n /** If present, supplies the properties with which to initialize the [[TileAdmin]] for this session. */\n tileAdmin?: TileAdmin.Props;\n /** If present, supplies the [[NotificationManager]] for this session. */\n notifications?: NotificationManager;\n /** If present, supplies the [[ToolAdmin]] for this session. */\n toolAdmin?: ToolAdmin;\n /** If present, supplies the [[AccuDraw]] for this session. */\n accuDraw?: AccuDraw;\n /** If present, supplies the [[AccuSnap]] for this session. */\n accuSnap?: AccuSnap;\n /** If present, supplies the [[Localization]] for this session. Defaults to [ITwinLocalization]($i18n). */\n localization?: Localization;\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\n authorizationClient?: AuthorizationClient;\n /** If present, supplies security options for the frontend. */\n security?: FrontendSecurityOptions;\n /** @internal */\n sessionId?: GuidString;\n /** @internal */\n locateManager?: ElementLocateManager;\n /** If present, supplies the [[TentativePoint]] for this session. */\n tentativePoint?: TentativePoint;\n /** @internal */\n quantityFormatter?: QuantityFormatter;\n /** If present, supplies an implementation of the render system, or options for initializing the default render system. */\n renderSys?: RenderSystem | RenderSystem.Options;\n /** If present, supplies the [[UiAdmin]] for this session. */\n uiAdmin?: UiAdmin;\n /** If present, supplies the [[FormatsProvider]] for this session. */\n formatsProvider?: FormatsProvider;\n /** If present, determines whether iModelApp is a NoRenderApp\n * @internal\n */\n noRender?: boolean;\n\n /**\n * @deprecated in 3.7. Specify desired RPC interfaces in the platform-specific RPC manager call instead.\n * See [[MobileRpcManager.initializeClient]], [[ElectronRpcManager.initializeFrontend]], [[BentleyCloudRpcManager.initializeClient]].\n */\n rpcInterfaces?: RpcInterfaceDefinition[];\n\n /** @beta */\n realityDataAccess?: RealityDataAccess;\n /** If present, overrides where public assets are fetched. The default is to fetch assets relative to the current URL.\n * The path should always end with a trailing `/`.\n */\n publicPath?: string;\n}\n\n/** Options for [[IModelApp.makeModalDiv]]\n * @public\n */\nexport interface ModalOptions {\n /** Width for the Modal dialog box. */\n width?: number;\n /** The dialog should be dismissed if the user clicks anywhere or hits Enter or Escape on the keyboard. */\n autoClose?: boolean;\n /** Show an 'x' in the upper right corner to close the dialog */\n closeBox?: boolean;\n /** The parent for the semi transparent *darkening* div. If not present, use `document.body` */\n rootDiv?: HTMLElement;\n}\n\n/** Return type for [[IModelApp.makeModalDiv]]\n * @public\n */\nexport interface ModalReturn {\n /** The modal HTMLDivElement created. */\n modal: HTMLDivElement;\n /** A function that can be set as an event handler to stop the modal dialog. This can be used if [[ModalOptions.autoClose]] or [[IModalOptions.closeBox]]\n * were not enabled for the dialog.\n */\n stop: (_ev: Event) => void;\n}\n\n/** We hang the IModelApp object off the global `window` object in IModelApp.startup for debugging purposes.\n * It's removed in IModelApp.shutdown.\n */\ninterface IModelAppForDebugger {\n iModelAppForDebugger?: typeof IModelApp;\n}\n\n/**\n * Global singleton that connects the user interface with the iTwin.js services. There can be only one IModelApp active in a session. All\n * members of IModelApp are static, and it serves as a singleton object for gaining access to session information.\n *\n * Before any interactive operations may be performed by the `@itwin/core-frontend package`, [[IModelApp.startup]] must be called and awaited.\n * Applications may customize the frontend behavior of iTwin.js by supplying options to [[IModelApp.startup]].\n *\n * @public\n */\nexport class IModelApp {\n private static _initialized = false;\n private static _accuDraw: AccuDraw;\n private static _accuSnap: AccuSnap;\n private static _applicationId: string;\n private static _applicationVersion: string;\n private static _localization: Localization;\n private static _locateManager: ElementLocateManager;\n private static _notifications: NotificationManager;\n private static _quantityFormatter: QuantityFormatter;\n private static _renderSystem?: RenderSystem;\n private static _userPreferences?: UserPreferencesAccess;\n private static _tentativePoint: TentativePoint;\n private static _tileAdmin: TileAdmin;\n private static _toolAdmin: ToolAdmin;\n private static _viewManager: ViewManager;\n private static _uiAdmin: UiAdmin;\n private static _noRender: boolean;\n private static _wantEventLoop = false;\n private static _animationRequested = false;\n private static _animationInterval: BeDuration | undefined = BeDuration.fromSeconds(1);\n private static _animationIntervalId?: number;\n private static _securityOptions: FrontendSecurityOptions;\n private static _mapLayerFormatRegistry: MapLayerFormatRegistry;\n private static _terrainProviderRegistry: TerrainProviderRegistry;\n private static _realityDataSourceProviders: RealityDataSourceProviderRegistry;\n private static _hubAccess?: FrontendHubAccess;\n private static _realityDataAccess?: RealityDataAccess;\n private static _publicPath: string;\n private static _formatsProviderManager: FormatsProviderManager;\n\n // No instances of IModelApp may be created. All members are static and must be on the singleton object IModelApp.\n protected constructor() { }\n\n /** Event raised just before the frontend IModelApp is to be [[shutdown]]. */\n public static readonly onBeforeShutdown = new BeEvent<() => void>();\n\n /** Event raised after IModelApp [[startup]] completes. */\n public static readonly onAfterStartup = new BeEvent<() => void>();\n\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\n public static authorizationClient?: AuthorizationClient;\n /** The [[ToolRegistry]] for this session. */\n public static readonly tools = new ToolRegistry();\n /** A uniqueId for this session */\n public static sessionId: GuidString;\n /** The [[MapLayerFormatRegistry]] for this session. */\n public static get mapLayerFormatRegistry(): MapLayerFormatRegistry { return this._mapLayerFormatRegistry; }\n /** The [[TerrainProviderRegistry]] for this session. */\n public static get terrainProviderRegistry(): TerrainProviderRegistry { return this._terrainProviderRegistry; }\n /** The [[RealityDataSourceProviderRegistry]] for this session.\n * @alpha\n */\n public static get realityDataSourceProviders(): RealityDataSourceProviderRegistry { return this._realityDataSourceProviders; }\n /** The [[RenderSystem]] for this session. */\n public static get renderSystem(): RenderSystem { return this._renderSystem!; }\n /** The [[ViewManager]] for this session. */\n public static get viewManager(): ViewManager { return this._viewManager; }\n /** The [[NotificationManager]] for this session. */\n public static get notifications(): NotificationManager { return this._notifications; }\n /** The [[TileAdmin]] for this session. */\n public static get tileAdmin(): TileAdmin { return this._tileAdmin; }\n /** The [[QuantityFormatter]] for this session. */\n public static get quantityFormatter(): QuantityFormatter { return this._quantityFormatter; }\n /** The [[ToolAdmin]] for this session. */\n public static get toolAdmin(): ToolAdmin { return this._toolAdmin; }\n /** The [[AccuDraw]] for this session. */\n public static get accuDraw(): AccuDraw { return this._accuDraw; }\n /** The [[AccuSnap]] for this session. */\n public static get accuSnap(): AccuSnap { return this._accuSnap; }\n public static get locateManager(): ElementLocateManager { return this._locateManager; }\n /** The [[TentativePoint]] for this session]]. */\n public static get tentativePoint(): TentativePoint { return this._tentativePoint; }\n /** The [[Localization]] for this session. */\n public static get localization(): Localization { return this._localization; }\n /** The [[UserPreferencesAccess]] for this session.\n * @beta\n */\n public static get userPreferences(): UserPreferencesAccess | undefined { return this._userPreferences; }\n /** The Id of this application. Applications must set this to the Global Product Registry ID (GPRID) for usage logging. */\n public static get applicationId(): string { return this._applicationId; }\n /** The version of this application. Must be set for usage logging. */\n public static get applicationVersion(): string { return this._applicationVersion; }\n /** True after [[startup]] has been called, until [[shutdown]] is called. */\n public static get initialized() { return this._initialized; }\n\n /** Provides access to IModelHub services. */\n public static get hubAccess(): FrontendHubAccess | undefined { return this._hubAccess; }\n\n /** Provides access to the RealityData service implementation for this IModelApp\n * @beta\n */\n public static get realityDataAccess(): RealityDataAccess | undefined { return this._realityDataAccess; }\n\n /** Whether the [renderSystem[]] has been successfully initialized.\n * This will always be `false` before calling [[startup]] and after calling [[shutdown]].\n * In rare circumstances (e.g., while executing in a headless test environment) it may remain `false` due to a failure to\n * obtain a [WebGL rendering context](https://www.google.com/search?channel=fs&client=ubuntu-sn&q=mdn+webglrenderingcontext).\n * As long as you have called [[startup]], you can generally assume it to be `true`.\n */\n public static get hasRenderSystem() {\n return this._renderSystem !== undefined && this._renderSystem.isValid;\n }\n\n /** The [[UiAdmin]] for this session. */\n public static get uiAdmin() { return this._uiAdmin; }\n /** The requested security options for the frontend. */\n public static get securityOptions() { return this._securityOptions; }\n\n /** If present, overrides where public assets are fetched. The default is to fetch assets relative to the current URL.\n * The path should always end with a trailing `/`.\n */\n public static get publicPath() { return this._publicPath; }\n\n /** The [[FormatsProvider]] for this session.\n * @param provider The provider to use for formatting quantities.\n * @beta\n */\n public static get formatsProvider(): FormatsProvider { return this._formatsProviderManager; }\n public static set formatsProvider(provider: FormatsProvider) {\n this._formatsProviderManager.formatsProvider = provider;\n }\n\n /** @alpha */\n public static readonly extensionAdmin = this._createExtensionAdmin();\n\n /** Map of classFullName to EntityState class */\n private static _entityClasses = new Map<string, typeof EntityState>();\n\n /** Register all of the subclasses of EntityState from a module.\n * @internal\n */\n public static registerModuleEntities(moduleObj: any) {\n for (const thisMember in moduleObj) { // eslint-disable-line guard-for-in\n const thisEntityState = moduleObj[thisMember];\n if (thisEntityState.prototype instanceof EntityState) {\n this.registerEntityState(thisEntityState.classFullName, thisEntityState);\n }\n }\n }\n\n /** Register an EntityState class by its classFullName\n * @internal\n */\n public static registerEntityState(classFullName: string, classType: typeof EntityState) {\n const lowerName = classFullName.toLowerCase();\n if (this._entityClasses.has(lowerName)) {\n const errMsg = `Class ${classFullName} is already registered. Make sure static schemaName and className members are correct on class ${classType.name}`;\n Logger.logError(FrontendLoggerCategory.IModelConnection, errMsg);\n throw new Error(errMsg);\n }\n\n this._entityClasses.set(lowerName, classType);\n }\n\n /** @internal */\n public static lookupEntityClass(classFullName: string) { return this._entityClasses.get(classFullName.toLowerCase()); }\n\n /**\n * Obtain WebGL rendering compatibility information for the client system. This information describes whether the client meets the\n * minimum rendering capabilities. It also describes whether the system lacks any optional capabilities that could improve quality\n * and/or performance.\n * @note As of 4.x, iTwin.js requires WebGL 2. If the client does not support WebGL 2, the `status` field of the returned compatibility info will be [WebGLRenderCompatibilityStatus.CannotCreateContext]($webgl-compatibility).\n */\n public static queryRenderCompatibility(): WebGLRenderCompatibilityInfo {\n return queryRenderCompatibility(true, (canvas, useWebGL2, inputContextAttributes) => System.createContext(canvas, useWebGL2, inputContextAttributes));\n }\n\n /**\n * This method must be called before any other `@itwin/core-frontend` methods are used.\n * Somewhere in your startup code, call [[IModelApp.startup]]. E.g.:\n * ``` ts\n * await IModelApp.startup( {applicationId: myAppId} );\n * ```\n * @param opts The options for configuring IModelApp\n */\n public static async startup(opts?: IModelAppOptions): Promise<void> {\n if (this._initialized)\n return; // we're already initialized, do nothing.\n this._initialized = true;\n\n opts = opts ?? {};\n this._securityOptions = opts.security ?? {};\n\n if (process.env.NODE_ENV === \"development\") {\n // Make IModelApp globally accessible for debugging purposes. We'll remove it on shutdown.\n (window as IModelAppForDebugger).iModelAppForDebugger = this;\n }\n\n this.sessionId = opts.sessionId ?? Guid.createValue();\n this._applicationId = opts.applicationId ?? \"2686\"; // Default to product id of iTwin.js\n this._applicationVersion = opts.applicationVersion ?? \"1.0.0\";\n this.authorizationClient = opts.authorizationClient;\n this._hubAccess = opts.hubAccess;\n this._noRender = opts.noRender ?? false;\n\n this._setupRpcRequestContext();\n\n this._localization = opts.localization ?? new ITwinLocalization();\n const toolsNs = \"CoreTools\";\n await this.localization.initialize([\"iModelJs\", toolsNs]);\n [\n selectTool,\n idleTool,\n viewTool,\n clipViewTool,\n measureTool,\n accudrawTool,\n ].forEach((tool) => this.tools.registerModule(tool, toolsNs));\n\n this.registerEntityState(EntityState.classFullName, EntityState);\n [\n modelState,\n sheetState,\n viewState,\n drawingViewState,\n spatialViewState,\n displayStyleState,\n modelselector,\n categorySelectorState,\n auxCoordState,\n ].forEach((module) => this.registerModuleEntities(module));\n\n this._renderSystem = (opts.renderSys instanceof RenderSystem) ? opts.renderSys : this.createRenderSys(opts.renderSys);\n if (opts.userPreferences)\n this._userPreferences = opts.userPreferences;\n this._viewManager = opts.viewManager ?? new ViewManager();\n this._tileAdmin = await TileAdmin.create(opts.tileAdmin);\n this._notifications = opts.notifications ?? new NotificationManager();\n this._toolAdmin = opts.toolAdmin ?? new ToolAdmin();\n this._accuDraw = opts.accuDraw ?? new AccuDraw();\n this._accuSnap = opts.accuSnap ?? new AccuSnap();\n this._locateManager = opts.locateManager ?? new ElementLocateManager();\n this._tentativePoint = opts.tentativePoint ?? new TentativePoint();\n this._quantityFormatter = opts.quantityFormatter ?? new QuantityFormatter();\n this._uiAdmin = opts.uiAdmin ?? new UiAdmin();\n this._mapLayerFormatRegistry = new MapLayerFormatRegistry(opts.mapLayerOptions);\n this._terrainProviderRegistry = new TerrainProviderRegistry();\n this._realityDataSourceProviders = new RealityDataSourceProviderRegistry();\n this._realityDataAccess = opts.realityDataAccess;\n this._formatsProviderManager = new FormatsProviderManager(opts.formatsProvider ?? new QuantityTypeFormatsProvider());\n\n this._publicPath = opts.publicPath ?? \"\";\n\n [\n this.renderSystem,\n this.viewManager,\n this.toolAdmin,\n this.accuDraw,\n this.accuSnap,\n this.locateManager,\n this.tentativePoint,\n this.uiAdmin,\n ].forEach((sys) => sys.onInitialized());\n\n await this.quantityFormatter.onInitialized();\n this.onAfterStartup.raiseEvent();\n }\n\n /** Must be called before the application exits to release any held resources. */\n public static async shutdown() {\n if (!this._initialized)\n return;\n\n // notify listeners that this IModelApp is about to be shut down.\n this.onBeforeShutdown.raiseEvent();\n this.onBeforeShutdown.clear();\n\n if (process.env.NODE_ENV === \"development\") {\n (window as IModelAppForDebugger).iModelAppForDebugger = undefined;\n }\n\n this._wantEventLoop = false;\n window.removeEventListener(\"resize\", () => IModelApp.requestNextAnimation());\n this.clearIntervalAnimation();\n [this.toolAdmin, this.viewManager, this.tileAdmin].forEach((sys) => sys.onShutDown());\n this.tools.shutdown();\n this._renderSystem = dispose(this._renderSystem);\n this._entityClasses.clear();\n this.authorizationClient = undefined;\n this._initialized = false;\n this.resetFormatsProvider();\n this.onAfterStartup.clear();\n }\n\n /** Controls how frequently the application polls for changes that may require a new animation frame to be requested.\n * Such changes include resizing a Viewport or changing the device pixel ratio by zooming in or out in the browser.\n * The default interval is 1 second. It may be desirable to override the default for specific apps and/or devices.\n * - Increasing the interval can conserve battery life on battery-powered devices at the expense of slower response to resize events.\n * - An application that only displays a single Viewport whose dimensions only change when the dimensions of the application window change, and which does not support changing application zoom level, could disable the interval altogether.\n * @param interval The interval at which to poll for changes. If undefined (or negative), the application will never poll. If zero, the application will poll as frequently as possible.\n * @beta\n */\n public static get animationInterval(): BeDuration | undefined { return IModelApp._animationInterval; }\n public static set animationInterval(interval: BeDuration | undefined) {\n if (undefined !== interval && interval.isTowardsPast)\n interval = undefined;\n\n if (interval !== IModelApp._animationInterval) {\n IModelApp._animationInterval = interval;\n if (IModelApp._wantEventLoop)\n IModelApp.requestIntervalAnimation();\n }\n }\n\n /** Request that the event loop execute on the next [animation frame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame).\n * There is generally no reason for applications to invoke this method directly.\n */\n public static requestNextAnimation() {\n // Only want to call requestAnimationFrame if it is defined. Need to check whether current iModelApp is a NoRenderApp.\n if (IModelApp._noRender)\n return;\n\n if (!IModelApp._animationRequested) {\n IModelApp._animationRequested = true;\n requestAnimationFrame(() => IModelApp.eventLoop());\n }\n }\n\n /** @internal */\n private static clearIntervalAnimation(): void {\n if (undefined !== IModelApp._animationIntervalId) {\n window.clearInterval(IModelApp._animationIntervalId);\n IModelApp._animationIntervalId = undefined;\n }\n }\n\n /** @internal */\n private static requestIntervalAnimation(): void {\n IModelApp.clearIntervalAnimation();\n\n if (undefined !== IModelApp.animationInterval)\n IModelApp._animationIntervalId = window.setInterval(() => {\n IModelApp.requestNextAnimation();\n }, IModelApp.animationInterval.milliseconds);\n }\n\n /** @internal */\n public static startEventLoop() {\n if (!IModelApp._wantEventLoop) {\n IModelApp._wantEventLoop = true;\n window.addEventListener(\"resize\", () => IModelApp.requestNextAnimation());\n IModelApp.requestIntervalAnimation();\n IModelApp.requestNextAnimation();\n }\n }\n\n /** Strictly for tests. @internal */\n public static stopEventLoop() {\n this._wantEventLoop = false;\n }\n\n /** The main event processing loop for Tools and rendering. */\n private static eventLoop() {\n IModelApp._animationRequested = false;\n if (!IModelApp._wantEventLoop) // flag turned on at startup\n return;\n\n try {\n IModelApp.toolAdmin.processEvent(); // eslint-disable-line @typescript-eslint/no-floating-promises\n IModelApp.viewManager.renderLoop();\n IModelApp.tileAdmin.process();\n } catch (exception) {\n ToolAdmin.exceptionHandler(exception); // eslint-disable-line @typescript-eslint/no-floating-promises\n\n IModelApp._wantEventLoop = false;\n IModelApp._animationRequested = true; // unrecoverable after exception, don't request any further frames.\n window.removeEventListener(\"resize\", () => IModelApp.requestNextAnimation());\n }\n }\n\n /** Get the user's access token for this IModelApp, or a blank string if none is available.\n * @note Access tokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value\n * returned by this method may change over time throughout the course of a session.\n */\n public static async getAccessToken(): Promise<AccessToken> {\n try {\n return (await this.authorizationClient?.getAccessToken()) ?? \"\";\n } catch {\n return \"\";\n }\n }\n\n /** @internal */\n public static createRenderSys(opts?: RenderSystem.Options): RenderSystem { return System.create(opts); }\n\n private static _setupRpcRequestContext() {\n RpcConfiguration.requestContext.getId = (_request: RpcRequest): string => {\n return Guid.createValue();\n };\n\n RpcConfiguration.requestContext.serialize = async (_request: RpcRequest): Promise<SerializedRpcActivity> => {\n const id = _request.id;\n const serialized: SerializedRpcActivity = {\n id,\n applicationId: this.applicationId,\n applicationVersion: this.applicationVersion,\n sessionId: this.sessionId,\n authorization: ProcessDetector.isMobileAppFrontend ? \"\" : await this.getAccessToken(),\n };\n\n const csrf = IModelApp.securityOptions.csrfProtection;\n if (csrf && csrf.enabled) {\n const cookieName = csrf.cookieName || \"XSRF-TOKEN\";\n const cookieValue = document.cookie.split(\"; \").find((r) => r.startsWith(`${cookieName}=`));\n\n if (cookieValue) {\n const headerName = csrf.headerName || \"X-XSRF-TOKEN\";\n const headerValue = cookieValue.split(\"=\")[1];\n serialized.csrfToken = { headerName, headerValue };\n }\n }\n\n return serialized;\n };\n }\n\n /** Shortcut for creating an HTMLElement with optional parent, className, id, innerHTML, innerText. */\n public static makeHTMLElement<K extends keyof HTMLElementTagNameMap>(type: K, opt?: {\n /** The parent for the new HTMLElement */\n parent?: HTMLElement;\n /** The className for the new HTMLElement */\n className?: string;\n /** The Id for the new HTMLElement */\n id?: string;\n /** innerHTML for the new HTMLElement */\n innerHTML?: string;\n /** innerText for the new HTMLElement */\n innerText?: string;\n }) {\n const el = document.createElement(type);\n if (undefined !== opt) {\n if (undefined !== opt.className)\n el.className = opt.className;\n if (undefined !== opt.id)\n el.id = opt.id;\n if (undefined !== opt.innerHTML)\n el.innerHTML = opt.innerHTML;\n if (undefined !== opt.innerText)\n el.innerText = opt.innerText;\n if (undefined !== opt.parent)\n opt.parent.appendChild(el);\n }\n return el;\n }\n\n /** Shortcut for making a modal dialog on top of the root of the application. The returned HTMLDivElement will be placed topmost, all other application\n * windows will be covered with a semi-transparent background that intercepts all key/mouse/touch events until the modal is dismissed.\n * @param options The options that describe how the modal should work.\n */\n public static makeModalDiv(options: ModalOptions): ModalReturn {\n const root = options.rootDiv ? options.rootDiv : document.body;\n // create the overlay div to \"black out\" the application to indicate everything is inactive until the modal has been dismissed.\n const overlay = IModelApp.makeHTMLElement(\"div\", { parent: root, className: \"imodeljs-modal-overlay\" });\n overlay.tabIndex = -1; // so we can catch keystroke events\n\n // function to remove modal dialog\n const stop = (ev: Event) => {\n root.removeChild(overlay);\n ev.stopPropagation();\n };\n\n if (options.autoClose) {\n overlay.onclick = overlay.oncontextmenu = stop;\n overlay.onkeydown = overlay.onkeyup = (ev: KeyboardEvent) => { // ignore all keystrokes other than enter and escape\n switch (ev.key) {\n case \"Enter\":\n case \"Escape\":\n stop(ev);\n return;\n }\n ev.stopPropagation();\n };\n overlay.focus();\n }\n\n const modal = IModelApp.makeHTMLElement(\"div\", { parent: overlay, className: \"imodeljs-modal\" });\n if (undefined !== options.width) {\n modal.style.width = `${options.width}px`;\n // allow the dialog to be smaller than the width\n modal.style.maxWidth = `min(100% - (2 * var(--width-border)), ${options.width}px)`;\n }\n if (options.closeBox) {\n const close = IModelApp.makeHTMLElement(\"p\", { parent: modal, className: \"imodeljs-modal-close\" });\n close.innerText = \"\\u00d7\"; // unicode \"times\" symbol\n close.onclick = stop;\n }\n\n return { modal, stop };\n }\n\n /** Applications may implement this method to supply a Logo Card.\n * @beta\n */\n public static applicationLogoCard?: () => HTMLTableRowElement;\n\n /** Make a new Logo Card. Call this method from your implementation of [[IModelApp.applicationLogoCard]]\n * @param opts Options for Logo Card\n * @beta\n */\n public static makeLogoCard(\n opts: {\n /** The heading to be put at the top of this logo card inside an <h2>. May include HTML. */\n heading: string | HTMLElement;\n /** The URL or HTMLImageElement for the icon on this logo card. */\n iconSrc?: string | HTMLImageElement;\n /** The width of the icon, if `iconSrc` is a string. Default is 64. */\n iconWidth?: number;\n /** A *notice* string to be shown on the logo card. May include HTML. */\n notice?: string | HTMLElement;\n }): HTMLTableRowElement {\n const card = IModelApp.makeHTMLElement(\"tr\");\n const iconCell = IModelApp.makeHTMLElement(\"td\", { parent: card, className: \"logo-card-logo\" });\n if (undefined !== opts.iconSrc) {\n if (typeof opts.iconSrc === \"string\") {\n const logo = IModelApp.makeHTMLElement(\"img\");\n logo.src = opts.iconSrc;\n logo.width = opts.iconWidth ? opts.iconWidth : 64;\n opts.iconSrc = logo;\n }\n iconCell.appendChild(opts.iconSrc);\n }\n const noticeCell = IModelApp.makeHTMLElement(\"td\", { parent: card, className: \"logo-card-message\" });\n if (undefined !== opts.heading) {\n if (typeof opts.heading === \"string\")\n IModelApp.makeHTMLElement(\"h2\", { parent: noticeCell, innerHTML: opts.heading, className: \"logo-card-header\" });\n else\n noticeCell.appendChild(opts.heading);\n }\n if (undefined !== opts.notice) {\n if (typeof opts.notice === \"string\")\n IModelApp.makeHTMLElement(\"p\", { parent: noticeCell, innerHTML: opts.notice, className: \"logo-cards\" });\n else\n noticeCell.appendChild(opts.notice);\n }\n return card;\n }\n\n /** Make the logo card for the library itself. This card gets placed at the top of the stack.\n * @internal\n */\n public static makeIModelJsLogoCard() {\n return this.makeLogoCard({\n iconSrc: `${this.publicPath}images/about-imodeljs.svg`,\n heading: `<span style=\"font-weight:normal\">${this.localization.getLocalizedString(\"iModelJs:Notices.PoweredBy\")}</span> iTwin.js`,\n notice: `${ITWINJS_CORE_VERSION}<br>${COPYRIGHT_NOTICE}`,\n });\n }\n\n /** Format the tooltip strings returned by [[IModelConnection.getToolTipMessage]].\n * @alpha\n */\n public static formatElementToolTip(msg: string[]): HTMLElement {\n let out = \"\";\n msg.forEach((line) => out += `${IModelApp.localization?.getLocalizedKeys(line)}<br>`);\n const div = document.createElement(\"div\");\n div.innerHTML = out;\n return div;\n }\n\n /** Localize an error status\n * @param status one of the status values from [BentleyStatus]($core-bentley), [IModelStatus]($core-bentley) or [DbResult]($core-bentley)\n * @returns a localized error message\n * @beta\n */\n public static translateStatus(status: number) {\n let key: { scope: string, val: string, status?: string };\n if (typeof status !== \"number\") {\n key = { scope: \"Errors\", val: \"IllegalValue\" };\n } else {\n key = { scope: \"BentleyStatus\", val: BentleyStatus[status] };\n if (!key.val)\n key = { scope: \"IModelStatus\", val: IModelStatus[status] };\n if (!key.val)\n key = { scope: \"DbResult\", val: DbResult[status] };\n if (!key.val)\n key = { scope: \"Errors\", val: \"Status\", status: status.toString() };\n }\n\n return this.localization.getLocalizedString(`iModelJs:${key.scope}.${key.val}`, key);\n }\n\n /**\n * Resets the formatsProvider back to the default [[QuantityTypeFormatsProvider]].\n * @beta\n */\n public static resetFormatsProvider() {\n this.formatsProvider = new QuantityTypeFormatsProvider();\n }\n\n /**\n * Creates an instance of the ExtensionAdmin\n * and registers an event to execute after startup is complete\n * @returns an instance of ExtensionAdmin\n */\n private static _createExtensionAdmin(): ExtensionAdmin {\n const extensionAdmin = new ExtensionAdmin();\n IModelApp.onAfterStartup.addListener(extensionAdmin.onStartup);\n return extensionAdmin;\n }\n}\n"]}
|
package/lib/esm/IpcApp.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface IpcAppOptions {
|
|
|
18
18
|
*/
|
|
19
19
|
export declare class IpcApp {
|
|
20
20
|
private static _ipc;
|
|
21
|
+
private static _removeAppNotify;
|
|
21
22
|
/** Get the implementation of the [[IpcSocketFrontend]] interface. */
|
|
22
23
|
private static get ipc();
|
|
23
24
|
/** Determine whether Ipc is available for this frontend. This will only be true if [[startup]] has been called on this class. */
|
package/lib/esm/IpcApp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IpcApp.d.ts","sourceRoot":"","sources":["../../src/IpcApp.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAyC,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EACsC,eAAe,EAAwC,WAAW,EAAE,iBAAiB,EAChI,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAa,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AAED;;;GAGG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAgC;IACnD,qEAAqE;IAErE,OAAO,CAAC,MAAM,KAAK,GAAG,GAA4C;IAElE,iIAAiI;IACjI,WAAkB,OAAO,IAAI,OAAO,CAAoC;IAExE;;;;;;;OAOG;WACW,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,cAAc;IAIhF;;;;OAIG;WACW,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW;IAInE;;;;;;;;;OASG;WACiB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAA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c,oCAAkE;IAE9F;qFACiF;WAC7D,OAAO,CAAC,GAAG,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,aAAa;IAMxE,gBAAgB;WACI,QAAQ;CAK7B;AAED;;;;;;;;;;;;;GAaG;AACH,8BAAsB,mBAAmB;IACvC,wFAAwF;IACxF,aAAoB,WAAW,IAAI,MAAM,CAAC;IAEnC,YAAY,IAAI,cAAc;IAUrC;;;;;OAKG;WACW,QAAQ,IAAI,cAAc;CAGzC"}
|
package/lib/esm/IpcApp.js
CHANGED
|
@@ -15,6 +15,7 @@ import { IModelApp } from "./IModelApp";
|
|
|
15
15
|
*/
|
|
16
16
|
export class IpcApp {
|
|
17
17
|
static _ipc;
|
|
18
|
+
static _removeAppNotify;
|
|
18
19
|
/** Get the implementation of the [[IpcSocketFrontend]] interface. */
|
|
19
20
|
static get ipc() { return this._ipc; }
|
|
20
21
|
/** Determine whether Ipc is available for this frontend. This will only be true if [[startup]] has been called on this class. */
|
|
@@ -121,11 +122,12 @@ export class IpcApp {
|
|
|
121
122
|
* @note this should not be called directly. It is called by NativeApp.startup */
|
|
122
123
|
static async startup(ipc, opts) {
|
|
123
124
|
this._ipc = ipc;
|
|
124
|
-
IpcAppNotifyHandler.register(); // receives notifications from backend
|
|
125
|
+
this._removeAppNotify = IpcAppNotifyHandler.register(); // receives notifications from backend
|
|
125
126
|
await IModelApp.startup(opts?.iModelApp);
|
|
126
127
|
}
|
|
127
128
|
/** @internal */
|
|
128
129
|
static async shutdown() {
|
|
130
|
+
this._removeAppNotify?.();
|
|
129
131
|
this._ipc = undefined;
|
|
130
132
|
await IModelApp.shutdown();
|
|
131
133
|
}
|
package/lib/esm/IpcApp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IpcApp.js","sourceRoot":"","sources":["../../src/IpcApp.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,SAA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G;AACH,MAAM,OAAgB,mBAAmB;IAIhC,YAAY;QACjB,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAW,EAAE,QAAgB,EAAE,GAAG,IAAW,EAAE,EAAE;YAC5F,MAAM,IAAI,GAAI,IAAY,CAAC,QAAQ,CAAC,CAAC;YACrC,IAAI,OAAO,IAAI,KAAK,UAAU;gBAC5B,MAAM,IAAI,WAAW,CAAC,YAAY,CAAC,gBAAgB,EAAE,WAAW,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,QAAQ,8DAA8D,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YAErL,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,QAAQ;QACpB,OAAQ,IAAK,IAAY,EAA0B,CAAC,YAAY,EAAE,CAAC,CAAC,uFAAuF;IAC7J,CAAC;CACF;AAED,wCAAwC;AACxC,MAAM,mBAAoB,SAAQ,mBAAmB;IACnD,IAAW,WAAW,KAAK,OAAO,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;IACtD,SAAS,KAAK,CAAC;CACvB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module NativeApp\n */\n\nimport { BentleyError, IModelStatus, JsonUtils, PickAsyncMethods } from \"@itwin/core-bentley\";\nimport {\n BackendError, IModelError, ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketFrontend, iTwinChannel,\n RemoveFunction,\n} from \"@itwin/core-common\";\nimport { _callIpcChannel } from \"./common/internal/Symbols\";\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\n\n/**\n * Options for [[IpcApp.startup]]\n * @public\n */\nexport interface IpcAppOptions {\n iModelApp?: IModelAppOptions;\n}\n\n/**\n * The frontend of apps with a dedicated backend that can use [Ipc]($docs/learning/IpcInterface.md).\n * @public\n */\nexport class IpcApp {\n private static _ipc: IpcSocketFrontend | undefined;\n /** Get the implementation of the [[IpcSocketFrontend]] interface. */\n\n private static get ipc(): IpcSocketFrontend { return this._ipc!; }\n\n /** Determine whether Ipc is available for this frontend. This will only be true if [[startup]] has been called on this class. */\n public static get isValid(): boolean { return undefined !== this._ipc; }\n\n /**\n * Establish a message handler function for the supplied channel over Ipc. The handler will be called when messages are sent for\n * the channel via [[BackendIpc.send]].\n * @param channel the name of the channel\n * @param handler the message handler\n * @returns A function to remove the handler\n * @note Ipc is only supported if [[isValid]] is true.\n */\n public static addListener(channel: string, handler: IpcListener): RemoveFunction {\n return this.ipc.addListener(iTwinChannel(channel), handler);\n }\n\n /**\n * Remove a previously registered listener\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\n * @param listener The function passed to [[addListener]]\n */\n public static removeListener(channel: string, listener: IpcListener) {\n this.ipc.removeListener(iTwinChannel(channel), listener);\n }\n\n /**\n * Send a message to the backend via `channel` and expect a result asynchronously. The handler must be established on the backend via [[BackendIpc.handle]]\n * @param channel The name of the channel for the method.\n * @see Electron [ipcRenderer.invoke](https://www.electronjs.org/docs/api/ipc-renderer) documentation for details.\n * Note that this interface may be implemented via Electron for desktop apps, or via\n * [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) for mobile or web-based\n * Ipc connections. In either case, the Electron documentation provides the specifications for how it works.\n * @note `args` are serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static async invoke(channel: string, ...args: any[]): Promise<any> {\n return this.ipc.invoke(iTwinChannel(channel), ...args);\n }\n\n /**\n * Send a message over the socket.\n * @param channel The name of the channel for the message.\n * @param data The optional data of the message.\n * @note `data` is serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static send(channel: string, ...data: any[]) {\n return this.ipc.send(iTwinChannel(channel), ...data);\n }\n\n /**\n * Call a method on the backend through an Ipc channel.\n * @param channelName the channel registered by the backend handler.\n * @param methodName the name of a method implemented by the backend handler.\n * @param args arguments to `methodName`\n * @return a Promise with the return value from `methodName`\n * @note If the backend implementation throws an exception, this method will throw an exception with its contents\n * @internal Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async [_callIpcChannel](channelName: string, methodName: string, ...args: any[]): Promise<any> {\n const retVal = (await this.invoke(channelName, methodName, ...args)) as IpcInvokeReturn;\n\n if (retVal.error === undefined)\n return retVal.result; // method was successful\n\n // backend threw an exception, rethrow one on frontend\n const err = retVal.error;\n if (!JsonUtils.isObject(err)) {\n // Exception wasn't an object?\n throw retVal.error; // eslint-disable-line @typescript-eslint/only-throw-error\n }\n\n // Note: for backwards compatibility, if the exception was from a BentleyError on the backend, throw an exception of type `BackendError`.\n if (!BentleyError.isError(err))\n throw Object.assign(new Error(typeof err.message === \"string\" ? err.message : \"unknown error\"), err);\n\n const trimErr = { ...err } as any;\n delete trimErr.iTwinErrorId // these are methods on BackendError and will cause Object.assign to fail.\n delete trimErr.loggingMetadata;\n throw Object.assign(new BackendError(err.errorNumber, err.iTwinErrorId.key, err.message, err.loggingMetadata), trimErr);\n }\n\n /** @internal\n * @deprecated in 4.8. Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async callIpcChannel(channelName: string, methodName: string, ...args: any[]): Promise<any> {\n return this[_callIpcChannel](channelName, methodName, ...args);\n }\n\n /** Create a type safe Proxy object to make IPC calls to a registered backend interface.\n * @param channelName the channel registered by the backend handler.\n */\n public static makeIpcProxy<K, C extends string = string>(channelName: C): PickAsyncMethods<K> {\n return new Proxy({} as PickAsyncMethods<K>, {\n get(_target, methodName: string) {\n return async (...args: any[]) =>\n IpcApp[_callIpcChannel](channelName, methodName, ...args);\n },\n });\n }\n\n /** Create a type safe Proxy object to call an IPC function on a of registered backend handler that accepts a \"methodName\" argument followed by optional arguments\n * @param channelName the channel registered by the backend handler.\n * @param functionName the function to call on the handler.\n */\n public static makeIpcFunctionProxy<K>(channelName: string, functionName: string): PickAsyncMethods<K> {\n return new Proxy({} as PickAsyncMethods<K>, {\n get(_target, methodName: string) {\n return async (...args: any[]) =>\n IpcApp[_callIpcChannel](channelName, functionName, methodName, ...args);\n },\n });\n }\n\n /** A Proxy to call one of the [IpcAppFunctions]($common) functions via IPC. */\n public static appFunctionIpc = IpcApp.makeIpcProxy<IpcAppFunctions>(ipcAppChannels.functions);\n\n /** start an IpcApp.\n * @note this should not be called directly. It is called by NativeApp.startup */\n public static async startup(ipc: IpcSocketFrontend, opts?: IpcAppOptions) {\n this._ipc = ipc;\n IpcAppNotifyHandler.register(); // receives notifications from backend\n await IModelApp.startup(opts?.iModelApp);\n }\n\n /** @internal */\n public static async shutdown() {\n this._ipc = undefined;\n await IModelApp.shutdown();\n }\n}\n\n/**\n * Base class for all implementations of an Ipc notification response interface. This class is implemented on your frontend to supply\n * methods to receive notifications from your backend.\n *\n * Create a subclass to implement your Ipc response interface. Your class should be declared like this:\n * ```ts\n * class MyNotificationHandler extends NotificationHandler implements MyNotifications\n * ```\n * to ensure all method names and signatures are correct. Your methods cannot have a return value.\n *\n * Then, call `MyNotificationHandler.register` at startup to connect your class to your channel.\n * @public\n * @extensions\n */\nexport abstract class NotificationHandler {\n /** All subclasses must implement this method to specify their response channel name. */\n public abstract get channelName(): string;\n\n public registerImpl(): RemoveFunction {\n return IpcApp.addListener(this.channelName, (_evt: Event, funcName: string, ...args: any[]) => {\n const func = (this as any)[funcName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${this.constructor.name}.${funcName}\" not found on NotificationHandler registered for channel: ${this.channelName}`);\n\n func.call(this, ...args);\n });\n }\n\n /**\n * Register this class as the handler for notifications on its channel. This static method creates a new instance\n * that becomes the notification handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note this method should only be called once per channel. If it is called multiple times, multiple handlers are established.\n */\n public static register(): RemoveFunction {\n return (new (this as any)() as NotificationHandler).registerImpl(); // create an instance of subclass. \"as any\" is necessary because base class is abstract\n }\n}\n\n/** IpcApp notifications from backend */\nclass IpcAppNotifyHandler extends NotificationHandler implements IpcAppNotifications {\n public get channelName() { return ipcAppChannels.appNotify; }\n public notifyApp() { }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IpcApp.js","sourceRoot":"","sources":["../../src/IpcApp.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EACL,YAAY,EAAE,WAAW,EAAE,cAAc,EAAyF,YAAY,GAE/I,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAoB,MAAM,aAAa,CAAC;AAU1D;;;GAGG;AACH,MAAM,OAAO,MAAM;IACT,MAAM,CAAC,IAAI,CAAgC;IAC3C,MAAM,CAAC,gBAAgB,CAA6B;IAC5D,qEAAqE;IAE7D,MAAM,KAAK,GAAG,KAAwB,OAAO,IAAI,CAAC,IAAK,CAAC,CAAC,CAAC;IAElE,iIAAiI;IAC1H,MAAM,KAAK,OAAO,KAAc,OAAO,SAAS,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAExE;;;;;;;OAOG;IACI,MAAM,CAAC,WAAW,CAAC,OAAe,EAAE,OAAoB;QAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,cA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AC7J,CAAC;CACF;AAED,wCAAwC;AACxC,MAAM,mBAAoB,SAAQ,mBAAmB;IACnD,IAAW,WAAW,KAAK,OAAO,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;IACtD,SAAS,KAAK,CAAC;CACvB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module NativeApp\n */\n\nimport { BentleyError, IModelStatus, JsonUtils, PickAsyncMethods } from \"@itwin/core-bentley\";\nimport {\n BackendError, IModelError, ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketFrontend, iTwinChannel,\n RemoveFunction,\n} from \"@itwin/core-common\";\nimport { _callIpcChannel } from \"./common/internal/Symbols\";\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\n\n/**\n * Options for [[IpcApp.startup]]\n * @public\n */\nexport interface IpcAppOptions {\n iModelApp?: IModelAppOptions;\n}\n\n/**\n * The frontend of apps with a dedicated backend that can use [Ipc]($docs/learning/IpcInterface.md).\n * @public\n */\nexport class IpcApp {\n private static _ipc: IpcSocketFrontend | undefined;\n private static _removeAppNotify: RemoveFunction | undefined;\n /** Get the implementation of the [[IpcSocketFrontend]] interface. */\n\n private static get ipc(): IpcSocketFrontend { return this._ipc!; }\n\n /** Determine whether Ipc is available for this frontend. This will only be true if [[startup]] has been called on this class. */\n public static get isValid(): boolean { return undefined !== this._ipc; }\n\n /**\n * Establish a message handler function for the supplied channel over Ipc. The handler will be called when messages are sent for\n * the channel via [[BackendIpc.send]].\n * @param channel the name of the channel\n * @param handler the message handler\n * @returns A function to remove the handler\n * @note Ipc is only supported if [[isValid]] is true.\n */\n public static addListener(channel: string, handler: IpcListener): RemoveFunction {\n return this.ipc.addListener(iTwinChannel(channel), handler);\n }\n\n /**\n * Remove a previously registered listener\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\n * @param listener The function passed to [[addListener]]\n */\n public static removeListener(channel: string, listener: IpcListener) {\n this.ipc.removeListener(iTwinChannel(channel), listener);\n }\n\n /**\n * Send a message to the backend via `channel` and expect a result asynchronously. The handler must be established on the backend via [[BackendIpc.handle]]\n * @param channel The name of the channel for the method.\n * @see Electron [ipcRenderer.invoke](https://www.electronjs.org/docs/api/ipc-renderer) documentation for details.\n * Note that this interface may be implemented via Electron for desktop apps, or via\n * [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) for mobile or web-based\n * Ipc connections. In either case, the Electron documentation provides the specifications for how it works.\n * @note `args` are serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static async invoke(channel: string, ...args: any[]): Promise<any> {\n return this.ipc.invoke(iTwinChannel(channel), ...args);\n }\n\n /**\n * Send a message over the socket.\n * @param channel The name of the channel for the message.\n * @param data The optional data of the message.\n * @note `data` is serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static send(channel: string, ...data: any[]) {\n return this.ipc.send(iTwinChannel(channel), ...data);\n }\n\n /**\n * Call a method on the backend through an Ipc channel.\n * @param channelName the channel registered by the backend handler.\n * @param methodName the name of a method implemented by the backend handler.\n * @param args arguments to `methodName`\n * @return a Promise with the return value from `methodName`\n * @note If the backend implementation throws an exception, this method will throw an exception with its contents\n * @internal Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async [_callIpcChannel](channelName: string, methodName: string, ...args: any[]): Promise<any> {\n const retVal = (await this.invoke(channelName, methodName, ...args)) as IpcInvokeReturn;\n\n if (retVal.error === undefined)\n return retVal.result; // method was successful\n\n // backend threw an exception, rethrow one on frontend\n const err = retVal.error;\n if (!JsonUtils.isObject(err)) {\n // Exception wasn't an object?\n throw retVal.error; // eslint-disable-line @typescript-eslint/only-throw-error\n }\n\n // Note: for backwards compatibility, if the exception was from a BentleyError on the backend, throw an exception of type `BackendError`.\n if (!BentleyError.isError(err))\n throw Object.assign(new Error(typeof err.message === \"string\" ? err.message : \"unknown error\"), err);\n\n const trimErr = { ...err } as any;\n delete trimErr.iTwinErrorId // these are methods on BackendError and will cause Object.assign to fail.\n delete trimErr.loggingMetadata;\n throw Object.assign(new BackendError(err.errorNumber, err.iTwinErrorId.key, err.message, err.loggingMetadata), trimErr);\n }\n\n /** @internal\n * @deprecated in 4.8. Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async callIpcChannel(channelName: string, methodName: string, ...args: any[]): Promise<any> {\n return this[_callIpcChannel](channelName, methodName, ...args);\n }\n\n /** Create a type safe Proxy object to make IPC calls to a registered backend interface.\n * @param channelName the channel registered by the backend handler.\n */\n public static makeIpcProxy<K, C extends string = string>(channelName: C): PickAsyncMethods<K> {\n return new Proxy({} as PickAsyncMethods<K>, {\n get(_target, methodName: string) {\n return async (...args: any[]) =>\n IpcApp[_callIpcChannel](channelName, methodName, ...args);\n },\n });\n }\n\n /** Create a type safe Proxy object to call an IPC function on a of registered backend handler that accepts a \"methodName\" argument followed by optional arguments\n * @param channelName the channel registered by the backend handler.\n * @param functionName the function to call on the handler.\n */\n public static makeIpcFunctionProxy<K>(channelName: string, functionName: string): PickAsyncMethods<K> {\n return new Proxy({} as PickAsyncMethods<K>, {\n get(_target, methodName: string) {\n return async (...args: any[]) =>\n IpcApp[_callIpcChannel](channelName, functionName, methodName, ...args);\n },\n });\n }\n\n /** A Proxy to call one of the [IpcAppFunctions]($common) functions via IPC. */\n public static appFunctionIpc = IpcApp.makeIpcProxy<IpcAppFunctions>(ipcAppChannels.functions);\n\n /** start an IpcApp.\n * @note this should not be called directly. It is called by NativeApp.startup */\n public static async startup(ipc: IpcSocketFrontend, opts?: IpcAppOptions) {\n this._ipc = ipc;\n this._removeAppNotify = IpcAppNotifyHandler.register(); // receives notifications from backend\n await IModelApp.startup(opts?.iModelApp);\n }\n\n /** @internal */\n public static async shutdown() {\n this._removeAppNotify?.();\n this._ipc = undefined;\n await IModelApp.shutdown();\n }\n}\n\n/**\n * Base class for all implementations of an Ipc notification response interface. This class is implemented on your frontend to supply\n * methods to receive notifications from your backend.\n *\n * Create a subclass to implement your Ipc response interface. Your class should be declared like this:\n * ```ts\n * class MyNotificationHandler extends NotificationHandler implements MyNotifications\n * ```\n * to ensure all method names and signatures are correct. Your methods cannot have a return value.\n *\n * Then, call `MyNotificationHandler.register` at startup to connect your class to your channel.\n * @public\n * @extensions\n */\nexport abstract class NotificationHandler {\n /** All subclasses must implement this method to specify their response channel name. */\n public abstract get channelName(): string;\n\n public registerImpl(): RemoveFunction {\n return IpcApp.addListener(this.channelName, (_evt: Event, funcName: string, ...args: any[]) => {\n const func = (this as any)[funcName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${this.constructor.name}.${funcName}\" not found on NotificationHandler registered for channel: ${this.channelName}`);\n\n func.call(this, ...args);\n });\n }\n\n /**\n * Register this class as the handler for notifications on its channel. This static method creates a new instance\n * that becomes the notification handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note this method should only be called once per channel. If it is called multiple times, multiple handlers are established.\n */\n public static register(): RemoveFunction {\n return (new (this as any)() as NotificationHandler).registerImpl(); // create an instance of subclass. \"as any\" is necessary because base class is abstract\n }\n}\n\n/** IpcApp notifications from backend */\nclass IpcAppNotifyHandler extends NotificationHandler implements IpcAppNotifications {\n public get channelName() { return ipcAppChannels.appNotify; }\n public notifyApp() { }\n}\n"]}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
15
15
|
export async function loadScript(jsUrl) {
|
|
16
|
-
const module = await import(/* @vite-ignore */ jsUrl);
|
|
16
|
+
const module = await import(/* webpackIgnore: true */ /* @vite-ignore */ jsUrl);
|
|
17
17
|
return execute(module);
|
|
18
18
|
}
|
|
19
19
|
/** attempts to execute an extension module */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionLoadScript.js","sourceRoot":"","sources":["../../../../src/extension/providers/ExtensionLoadScript.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAa;IAC5C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"ExtensionLoadScript.js","sourceRoot":"","sources":["../../../../src/extension/providers/ExtensionLoadScript.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAa;IAC5C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,yBAAyB,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAChF,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;AACzB,CAAC;AAED,8CAA8C;AAC9C,SAAS,OAAO,CAAC,CAAM;IACrB,IAAI,OAAO,CAAC,KAAK,UAAU;QACzB,OAAO,CAAC,EAAE,CAAC;IACb,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU;QACxC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAClB,IAAI,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,UAAU;QAC9C,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;IACrB,MAAM,IAAI,KAAK,CACb,wEAAwE,CACzE,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/**\n * Imports and executes a bundled javascript (esm) module.\n * Used by remote and service Extensions.\n * Throws an error if no function is found to execute.\n * Looks for a function in the following order:\n * - the module itself.\n * - the module's main export.\n * - the module's default export.\n * @internal\n */\nexport async function loadScript(jsUrl: string): Promise<any> {\n const module = await import(/* webpackIgnore: true */ /* @vite-ignore */ jsUrl);\n return execute(module);\n}\n\n/** attempts to execute an extension module */\nfunction execute(m: any) {\n if (typeof m === \"function\")\n return m();\n if (m.main && typeof m.main === \"function\")\n return m.main();\n if (m.default && typeof m.default === \"function\")\n return m.default();\n throw new Error(\n `Failed to execute extension. No default function was found to execute.`,\n );\n}\n"]}
|
|
@@ -140,8 +140,9 @@ export function createClassifierTileTreeReference(classifiers, classifiedTree, i
|
|
|
140
140
|
return new ClassifierTreeReference(classifiers, classifiedTree, iModel, source);
|
|
141
141
|
}
|
|
142
142
|
function createClassifierId(classifier, source) {
|
|
143
|
+
const disablePolyfaceDecimation = IModelApp.tileAdmin.disablePolyfaceDecimation;
|
|
143
144
|
if (undefined === classifier)
|
|
144
|
-
return { modelId: Id64.invalid, type: BatchType.PlanarClassifier, expansion: 0, animationId: undefined };
|
|
145
|
+
return { modelId: Id64.invalid, type: BatchType.PlanarClassifier, expansion: 0, animationId: undefined, disablePolyfaceDecimation };
|
|
145
146
|
const type = classifier.flags.isVolumeClassifier ? BatchType.VolumeClassifier : BatchType.PlanarClassifier;
|
|
146
147
|
const scriptInfo = IModelApp.tileAdmin.getScriptInfoForTreeId(classifier.modelId, source ? source[_scheduleScriptReference] : undefined);
|
|
147
148
|
return {
|
|
@@ -150,6 +151,7 @@ function createClassifierId(classifier, source) {
|
|
|
150
151
|
expansion: classifier.expand,
|
|
151
152
|
animationId: scriptInfo?.animationId,
|
|
152
153
|
timeline: scriptInfo?.timeline,
|
|
154
|
+
disablePolyfaceDecimation,
|
|
153
155
|
};
|
|
154
156
|
}
|
|
155
157
|
//# sourceMappingURL=ClassifierTileTree.js.map
|