@itwin/core-frontend 3.1.0-dev.34 → 3.1.0-dev.37
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 +7 -1
- package/lib/cjs/IModelApp.d.ts.map +1 -1
- package/lib/cjs/IModelApp.js +10 -2
- package/lib/cjs/IModelApp.js.map +1 -1
- package/lib/cjs/core-frontend.d.ts +5 -4
- package/lib/cjs/core-frontend.d.ts.map +1 -1
- package/lib/cjs/core-frontend.js +8 -7
- package/lib/cjs/core-frontend.js.map +1 -1
- package/lib/cjs/extension/Extension.d.ts +48 -0
- package/lib/cjs/extension/Extension.d.ts.map +1 -0
- package/lib/cjs/extension/Extension.js +18 -0
- package/lib/cjs/extension/Extension.js.map +1 -0
- package/lib/cjs/extension/ExtensionAdmin.d.ts +64 -0
- package/lib/cjs/extension/ExtensionAdmin.d.ts.map +1 -0
- package/lib/cjs/extension/ExtensionAdmin.js +106 -0
- package/lib/cjs/extension/ExtensionAdmin.js.map +1 -0
- package/lib/cjs/extension/ExtensionHost.d.ts +23 -0
- package/lib/cjs/extension/ExtensionHost.d.ts.map +1 -0
- package/lib/cjs/extension/ExtensionHost.js +26 -0
- package/lib/cjs/extension/ExtensionHost.js.map +1 -0
- package/lib/cjs/extension/ExtensionImpl.d.ts +21 -0
- package/lib/cjs/extension/ExtensionImpl.d.ts.map +1 -0
- package/lib/cjs/extension/ExtensionImpl.js +45 -0
- package/lib/cjs/extension/ExtensionImpl.js.map +1 -0
- package/lib/cjs/extension/ExtensionLoader.d.ts +26 -0
- package/lib/cjs/extension/ExtensionLoader.d.ts.map +1 -0
- package/lib/cjs/extension/ExtensionLoader.js +10 -0
- package/lib/cjs/extension/ExtensionLoader.js.map +1 -0
- package/lib/cjs/extension/ExtensionRuntime.d.ts +5 -0
- package/lib/cjs/extension/ExtensionRuntime.d.ts.map +1 -0
- package/lib/cjs/extension/ExtensionRuntime.js +86 -0
- package/lib/cjs/extension/ExtensionRuntime.js.map +1 -0
- package/lib/cjs/extension/extensions.d.ts +19 -0
- package/lib/cjs/extension/extensions.d.ts.map +1 -0
- package/lib/cjs/extension/extensions.js +36 -0
- package/lib/cjs/extension/extensions.js.map +1 -0
- package/lib/esm/IModelApp.d.ts +7 -1
- package/lib/esm/IModelApp.d.ts.map +1 -1
- package/lib/esm/IModelApp.js +10 -2
- package/lib/esm/IModelApp.js.map +1 -1
- package/lib/esm/core-frontend.d.ts +5 -4
- package/lib/esm/core-frontend.d.ts.map +1 -1
- package/lib/esm/core-frontend.js +8 -7
- package/lib/esm/core-frontend.js.map +1 -1
- package/lib/esm/extension/Extension.d.ts +48 -0
- package/lib/esm/extension/Extension.d.ts.map +1 -0
- package/lib/esm/extension/Extension.js +15 -0
- package/lib/esm/extension/Extension.js.map +1 -0
- package/lib/esm/extension/ExtensionAdmin.d.ts +64 -0
- package/lib/esm/extension/ExtensionAdmin.d.ts.map +1 -0
- package/lib/esm/extension/ExtensionAdmin.js +102 -0
- package/lib/esm/extension/ExtensionAdmin.js.map +1 -0
- package/lib/esm/extension/ExtensionHost.d.ts +23 -0
- package/lib/esm/extension/ExtensionHost.d.ts.map +1 -0
- package/lib/esm/extension/ExtensionHost.js +22 -0
- package/lib/esm/extension/ExtensionHost.js.map +1 -0
- package/lib/esm/extension/ExtensionImpl.d.ts +21 -0
- package/lib/esm/extension/ExtensionImpl.d.ts.map +1 -0
- package/lib/esm/extension/ExtensionImpl.js +40 -0
- package/lib/esm/extension/ExtensionImpl.js.map +1 -0
- package/lib/esm/extension/ExtensionLoader.d.ts +26 -0
- package/lib/esm/extension/ExtensionLoader.d.ts.map +1 -0
- package/lib/esm/extension/ExtensionLoader.js +9 -0
- package/lib/esm/extension/ExtensionLoader.js.map +1 -0
- package/lib/esm/extension/ExtensionRuntime.d.ts +5 -0
- package/lib/esm/extension/ExtensionRuntime.d.ts.map +1 -0
- package/lib/esm/extension/ExtensionRuntime.js +84 -0
- package/lib/esm/extension/ExtensionRuntime.js.map +1 -0
- package/lib/esm/extension/extensions.d.ts +19 -0
- package/lib/esm/extension/extensions.d.ts.map +1 -0
- package/lib/esm/extension/extensions.js +24 -0
- package/lib/esm/extension/extensions.js.map +1 -0
- package/package.json +20 -20
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Extension.d.ts","sourceRoot":"","sources":["../../../src/extension/Extension.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,oBAAY,eAAe;IACzB,SAAS,cAAc;CACxB;AAED;;GAEG;AACH,oBAAY,WAAW,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;AAE7C;;EAEE;AACF,MAAM,WAAW,iBAAiB;IAChC,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,4BAA4B;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gCAAgC;IAChC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,QAAQ,CAAC,gBAAgB,EAAE,eAAe,EAAE,CAAC;CAC9C;AAED,aAAa;AACb,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC/D;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;EAEE;AACF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC;CACjC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Extensions
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ActivationEvent = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* @alpha
|
|
13
|
+
*/
|
|
14
|
+
var ActivationEvent;
|
|
15
|
+
(function (ActivationEvent) {
|
|
16
|
+
ActivationEvent["onStartup"] = "onStartup";
|
|
17
|
+
})(ActivationEvent = exports.ActivationEvent || (exports.ActivationEvent = {}));
|
|
18
|
+
//# sourceMappingURL=Extension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Extension.js","sourceRoot":"","sources":["../../../src/extension/Extension.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,IAAY,eAEX;AAFD,WAAY,eAAe;IACzB,0CAAuB,CAAA;AACzB,CAAC,EAFW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAE1B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Extensions\r\n */\r\n\r\n/**\r\n * @alpha\r\n */\r\nexport enum ActivationEvent {\r\n onStartup = \"onStartup\",\r\n}\r\n\r\n/**\r\n * @alpha\r\n */\r\nexport type ResolveFunc = () => Promise<any>;\r\n\r\n/** Defines the format of an Extension manifest\r\n * @alpha\r\n*/\r\nexport interface ExtensionManifest {\r\n /** The extension name */\r\n readonly name: string;\r\n /** The extension display name */\r\n readonly displayName?: string;\r\n /** The extension version */\r\n readonly version: string;\r\n /** The extension description */\r\n readonly description?: string;\r\n /** The main module file to load. This should be a path to the javascript file\r\n * e.g \"./lib/main.js\"\r\n */\r\n readonly main: string;\r\n /** List of activation events this Extension supports. */\r\n readonly activationEvents: ActivationEvent[];\r\n}\r\n\r\n/** @alpha */\r\nexport interface BuildExtensionManifest extends ExtensionManifest {\r\n /** Only valid when the Extension is loaded at build-time.\r\n *\r\n * Defines the main ES module that will be imported\r\n */\r\n readonly module: string;\r\n}\r\n\r\n/** Describes an Extension that has already been downloaded and has a location files can be easily executed.\r\n * @alpha\r\n*/\r\nexport interface LocalExtensionProps {\r\n readonly manifest: ExtensionManifest;\r\n readonly mainFunc?: ResolveFunc;\r\n}\r\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Extensions
|
|
3
|
+
*/
|
|
4
|
+
import { BuildExtensionManifest, ResolveFunc } from "./Extension";
|
|
5
|
+
import { ExtensionLoader } from "./ExtensionLoader";
|
|
6
|
+
/** The Extensions loading system has the following goals:
|
|
7
|
+
* 1. Only fetch what is needed when it is required
|
|
8
|
+
* 1. Load a manifest file
|
|
9
|
+
* 2. Load the the main module when necessary
|
|
10
|
+
* 2. Download the extension's files
|
|
11
|
+
*
|
|
12
|
+
* 2 ways to load an Extension into the system:
|
|
13
|
+
*
|
|
14
|
+
* 1. At build-time provide the function to load both the Extension Manifest and import the main module of the extension.
|
|
15
|
+
* The main module must contain the activate() function.
|
|
16
|
+
* 2. A minimum set of ExtensionLoaderProps that provide enough information to get the manifest
|
|
17
|
+
*
|
|
18
|
+
* An Extension can be in 3 different states:
|
|
19
|
+
* - Known
|
|
20
|
+
* - The Extension Admin has the minimal information needed to fetch the manifest for the Extension.
|
|
21
|
+
* knows the Extension exists but has not yet loaded the manifest
|
|
22
|
+
* - Installed
|
|
23
|
+
* - The Extension has the full manifest loaded and can be executed on the activation events
|
|
24
|
+
* - Disabled
|
|
25
|
+
* - The Extension has the full manifest but is not currently enabled and will not be executed based on the
|
|
26
|
+
* activation events.
|
|
27
|
+
*/
|
|
28
|
+
/** The Extension Admin controls the list of currently known, loaded and executing an Extension.
|
|
29
|
+
* Handles the loading of Extensions and maintains a list of the currently loaded Extensions.
|
|
30
|
+
*
|
|
31
|
+
* @alpha
|
|
32
|
+
*/
|
|
33
|
+
export declare class ExtensionAdmin {
|
|
34
|
+
/** The list of places to download an Extension. */
|
|
35
|
+
private _extensionLoaders;
|
|
36
|
+
/** Defines the set of extensions that are currently known and can be invoked during activation events. */
|
|
37
|
+
private _installedExtensions;
|
|
38
|
+
/** Fired when an Extension has been added or removed.
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
onStartup: () => Promise<void>;
|
|
42
|
+
constructor();
|
|
43
|
+
/** Add an ExtensionLoader to the front of the list of extension loaders. Extension loaders are invoked front to back.
|
|
44
|
+
* @param extensionLoader Extension loader to add
|
|
45
|
+
*/
|
|
46
|
+
addExtensionLoaderFront(extensionLoader: ExtensionLoader): void;
|
|
47
|
+
/** Add an ExtensionLoader to the list of extension loaders in use.
|
|
48
|
+
* @param extensionLoader Extension loader to add
|
|
49
|
+
*/
|
|
50
|
+
addExtensionLoader(extensionLoader: ExtensionLoader): void;
|
|
51
|
+
/** Add an Extension intend to be bundled during compilation.
|
|
52
|
+
* @param manifestLoader A function that loads the manifest file.
|
|
53
|
+
* @param mainFunc The main function to be executed upon
|
|
54
|
+
*/
|
|
55
|
+
addBuildExtension(manifestPromise: Promise<BuildExtensionManifest>, mainFunc?: ResolveFunc): Promise<void>;
|
|
56
|
+
/** Loops over all enabled Extensions and triggers each one if the provided event is defined. */
|
|
57
|
+
private activateExtensionEvents;
|
|
58
|
+
/** Resolves an import function provided for build-time Extensions that should return a valid
|
|
59
|
+
* Extension Manifest.
|
|
60
|
+
*/
|
|
61
|
+
private getManifest;
|
|
62
|
+
private execute;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=ExtensionAdmin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtensionAdmin.d.ts","sourceRoot":"","sources":["../../../src/extension/ExtensionAdmin.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAmB,sBAAsB,EAA0C,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3H,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;GAIG;AACH,qBAAa,cAAc;IACzB,oDAAoD;IACpD,OAAO,CAAC,iBAAiB,CAAyB;IAElD,2GAA2G;IAC3G,OAAO,CAAC,oBAAoB,CAA4E;IAExG;;OAEG;IACI,SAAS,sBAEd;;IAMF;;OAEG;IACI,uBAAuB,CAAC,eAAe,EAAE,eAAe;IAI/D;;OAEG;IACI,kBAAkB,CAAC,eAAe,EAAE,eAAe;IAI1D;;;OAGG;IACU,iBAAiB,CAAC,eAAe,EAAE,OAAO,CAAC,sBAAsB,CAAC,EAAE,QAAQ,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvH,gGAAgG;YAClF,uBAAuB;IAYrC;;OAEG;YACW,WAAW;YAYX,OAAO;CAKtB"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Extensions
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ExtensionAdmin = void 0;
|
|
11
|
+
const IModelApp_1 = require("../IModelApp");
|
|
12
|
+
const Extension_1 = require("./Extension");
|
|
13
|
+
/** The Extensions loading system has the following goals:
|
|
14
|
+
* 1. Only fetch what is needed when it is required
|
|
15
|
+
* 1. Load a manifest file
|
|
16
|
+
* 2. Load the the main module when necessary
|
|
17
|
+
* 2. Download the extension's files
|
|
18
|
+
*
|
|
19
|
+
* 2 ways to load an Extension into the system:
|
|
20
|
+
*
|
|
21
|
+
* 1. At build-time provide the function to load both the Extension Manifest and import the main module of the extension.
|
|
22
|
+
* The main module must contain the activate() function.
|
|
23
|
+
* 2. A minimum set of ExtensionLoaderProps that provide enough information to get the manifest
|
|
24
|
+
*
|
|
25
|
+
* An Extension can be in 3 different states:
|
|
26
|
+
* - Known
|
|
27
|
+
* - The Extension Admin has the minimal information needed to fetch the manifest for the Extension.
|
|
28
|
+
* knows the Extension exists but has not yet loaded the manifest
|
|
29
|
+
* - Installed
|
|
30
|
+
* - The Extension has the full manifest loaded and can be executed on the activation events
|
|
31
|
+
* - Disabled
|
|
32
|
+
* - The Extension has the full manifest but is not currently enabled and will not be executed based on the
|
|
33
|
+
* activation events.
|
|
34
|
+
*/
|
|
35
|
+
/** The Extension Admin controls the list of currently known, loaded and executing an Extension.
|
|
36
|
+
* Handles the loading of Extensions and maintains a list of the currently loaded Extensions.
|
|
37
|
+
*
|
|
38
|
+
* @alpha
|
|
39
|
+
*/
|
|
40
|
+
class ExtensionAdmin {
|
|
41
|
+
constructor() {
|
|
42
|
+
/** The list of places to download an Extension. */
|
|
43
|
+
this._extensionLoaders = [];
|
|
44
|
+
/** Defines the set of extensions that are currently known and can be invoked during activation events. */
|
|
45
|
+
this._installedExtensions = new Map();
|
|
46
|
+
/** Fired when an Extension has been added or removed.
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
this.onStartup = async () => {
|
|
50
|
+
await this.activateExtensionEvents(Extension_1.ActivationEvent.onStartup);
|
|
51
|
+
};
|
|
52
|
+
IModelApp_1.IModelApp.onAfterStartup.addListener(this.onStartup);
|
|
53
|
+
}
|
|
54
|
+
/** Add an ExtensionLoader to the front of the list of extension loaders. Extension loaders are invoked front to back.
|
|
55
|
+
* @param extensionLoader Extension loader to add
|
|
56
|
+
*/
|
|
57
|
+
addExtensionLoaderFront(extensionLoader) {
|
|
58
|
+
this._extensionLoaders.unshift(extensionLoader);
|
|
59
|
+
}
|
|
60
|
+
/** Add an ExtensionLoader to the list of extension loaders in use.
|
|
61
|
+
* @param extensionLoader Extension loader to add
|
|
62
|
+
*/
|
|
63
|
+
addExtensionLoader(extensionLoader) {
|
|
64
|
+
this._extensionLoaders.push(extensionLoader);
|
|
65
|
+
}
|
|
66
|
+
/** Add an Extension intend to be bundled during compilation.
|
|
67
|
+
* @param manifestLoader A function that loads the manifest file.
|
|
68
|
+
* @param mainFunc The main function to be executed upon
|
|
69
|
+
*/
|
|
70
|
+
async addBuildExtension(manifestPromise, mainFunc) {
|
|
71
|
+
const manifest = await this.getManifest(manifestPromise);
|
|
72
|
+
this._installedExtensions.set(manifest.name, { manifest, mainFunc });
|
|
73
|
+
}
|
|
74
|
+
/** Loops over all enabled Extensions and triggers each one if the provided event is defined. */
|
|
75
|
+
async activateExtensionEvents(event) {
|
|
76
|
+
for (const extension of this._installedExtensions.values()) {
|
|
77
|
+
if (!extension.manifest.activationEvents)
|
|
78
|
+
continue;
|
|
79
|
+
for (const activationEvent of extension.manifest.activationEvents) {
|
|
80
|
+
if (activationEvent === event) {
|
|
81
|
+
this.execute(extension); // eslint-disable-line @typescript-eslint/no-floating-promises
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/** Resolves an import function provided for build-time Extensions that should return a valid
|
|
87
|
+
* Extension Manifest.
|
|
88
|
+
*/
|
|
89
|
+
async getManifest(loader) {
|
|
90
|
+
const manifest = await loader;
|
|
91
|
+
return manifest;
|
|
92
|
+
}
|
|
93
|
+
// Important: The Function constructor is used here to isolate the context in which the Extension javascript has access.
|
|
94
|
+
// By using the Function constructor to create and then execute the extension it will only have access to two scopes:
|
|
95
|
+
// 1. It's own function scope
|
|
96
|
+
// 2. The global scope
|
|
97
|
+
//
|
|
98
|
+
// The global scope is important for an Extension as that is where the reference to the Extension Implementation is supplied
|
|
99
|
+
// from the application side.
|
|
100
|
+
async execute(extension) {
|
|
101
|
+
if (extension.mainFunc)
|
|
102
|
+
return extension.mainFunc();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.ExtensionAdmin = ExtensionAdmin;
|
|
106
|
+
//# sourceMappingURL=ExtensionAdmin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtensionAdmin.js","sourceRoot":"","sources":["../../../src/extension/ExtensionAdmin.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,4CAAyC;AACzC,2CAA2H;AAG3H;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;GAIG;AACH,MAAa,cAAc;IAczB;QAbA,oDAAoD;QAC5C,sBAAiB,GAAsB,EAAE,CAAC;QAElD,2GAA2G;QACnG,yBAAoB,GAAqC,IAAI,GAAG,EAA+B,CAAC;QAExG;;WAEG;QACI,cAAS,GAAG,KAAK,IAAI,EAAE;YAC5B,MAAM,IAAI,CAAC,uBAAuB,CAAC,2BAAe,CAAC,SAAS,CAAC,CAAC;QAChE,CAAC,CAAC;QAGA,qBAAS,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACI,uBAAuB,CAAC,eAAgC;QAC7D,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAClD,CAAC;IAED;;OAEG;IACI,kBAAkB,CAAC,eAAgC;QACxD,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,iBAAiB,CAAC,eAAgD,EAAE,QAAsB;QACrG,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;QACzD,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;IACvE,CAAC;IAED,gGAAgG;IACxF,KAAK,CAAC,uBAAuB,CAAC,KAAa;QACjD,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,EAAE;YAC1D,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,gBAAgB;gBACtC,SAAS;YACX,KAAK,MAAM,eAAe,IAAI,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE;gBACjE,IAAI,eAAe,KAAK,KAAK,EAAE;oBAC7B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,8DAA8D;iBACxF;aACF;SACF;IACH,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,WAAW,CAAC,MAAkC;QAC1D,MAAM,QAAQ,GAAI,MAAM,MAAM,CAAC;QAC/B,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,wHAAwH;IACxH,qHAAqH;IACrH,8BAA8B;IAC9B,uBAAuB;IACvB,EAAE;IACF,4HAA4H;IAC5H,6BAA6B;IACrB,KAAK,CAAC,OAAO,CAAC,SAA8B;QAClD,IAAI,SAAS,CAAC,QAAQ;YACpB,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;IAChC,CAAC;CAEF;AA1ED,wCA0EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Extensions\r\n */\r\n\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { ActivationEvent, BuildExtensionManifest, ExtensionManifest, LocalExtensionProps, ResolveFunc } from \"./Extension\";\r\nimport { ExtensionLoader } from \"./ExtensionLoader\";\r\n\r\n/** The Extensions loading system has the following goals:\r\n * 1. Only fetch what is needed when it is required\r\n * 1. Load a manifest file\r\n * 2. Load the the main module when necessary\r\n * 2. Download the extension's files\r\n *\r\n * 2 ways to load an Extension into the system:\r\n *\r\n * 1. At build-time provide the function to load both the Extension Manifest and import the main module of the extension.\r\n * The main module must contain the activate() function.\r\n * 2. A minimum set of ExtensionLoaderProps that provide enough information to get the manifest\r\n *\r\n * An Extension can be in 3 different states:\r\n * - Known\r\n * - The Extension Admin has the minimal information needed to fetch the manifest for the Extension.\r\n * knows the Extension exists but has not yet loaded the manifest\r\n * - Installed\r\n * - The Extension has the full manifest loaded and can be executed on the activation events\r\n * - Disabled\r\n * - The Extension has the full manifest but is not currently enabled and will not be executed based on the\r\n * activation events.\r\n */\r\n\r\n/** The Extension Admin controls the list of currently known, loaded and executing an Extension.\r\n * Handles the loading of Extensions and maintains a list of the currently loaded Extensions.\r\n *\r\n * @alpha\r\n */\r\nexport class ExtensionAdmin {\r\n /** The list of places to download an Extension. */\r\n private _extensionLoaders: ExtensionLoader[] = [];\r\n\r\n /** Defines the set of extensions that are currently known and can be invoked during activation events. */\r\n private _installedExtensions: Map<string, LocalExtensionProps> = new Map<string, LocalExtensionProps>();\r\n\r\n /** Fired when an Extension has been added or removed.\r\n * @internal\r\n */\r\n public onStartup = async () => {\r\n await this.activateExtensionEvents(ActivationEvent.onStartup);\r\n };\r\n\r\n public constructor() {\r\n IModelApp.onAfterStartup.addListener(this.onStartup);\r\n }\r\n\r\n /** Add an ExtensionLoader to the front of the list of extension loaders. Extension loaders are invoked front to back.\r\n * @param extensionLoader Extension loader to add\r\n */\r\n public addExtensionLoaderFront(extensionLoader: ExtensionLoader) {\r\n this._extensionLoaders.unshift(extensionLoader);\r\n }\r\n\r\n /** Add an ExtensionLoader to the list of extension loaders in use.\r\n * @param extensionLoader Extension loader to add\r\n */\r\n public addExtensionLoader(extensionLoader: ExtensionLoader) {\r\n this._extensionLoaders.push(extensionLoader);\r\n }\r\n\r\n /** Add an Extension intend to be bundled during compilation.\r\n * @param manifestLoader A function that loads the manifest file.\r\n * @param mainFunc The main function to be executed upon\r\n */\r\n public async addBuildExtension(manifestPromise: Promise<BuildExtensionManifest>, mainFunc?: ResolveFunc): Promise<void> {\r\n const manifest = await this.getManifest(manifestPromise);\r\n this._installedExtensions.set(manifest.name, { manifest, mainFunc });\r\n }\r\n\r\n /** Loops over all enabled Extensions and triggers each one if the provided event is defined. */\r\n private async activateExtensionEvents(event: string) {\r\n for (const extension of this._installedExtensions.values()) {\r\n if (!extension.manifest.activationEvents)\r\n continue;\r\n for (const activationEvent of extension.manifest.activationEvents) {\r\n if (activationEvent === event) {\r\n this.execute(extension); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** Resolves an import function provided for build-time Extensions that should return a valid\r\n * Extension Manifest.\r\n */\r\n private async getManifest(loader: Promise<ExtensionManifest>): Promise<ExtensionManifest> {\r\n const manifest = await loader;\r\n return manifest;\r\n }\r\n\r\n // Important: The Function constructor is used here to isolate the context in which the Extension javascript has access.\r\n // By using the Function constructor to create and then execute the extension it will only have access to two scopes:\r\n // 1. It's own function scope\r\n // 2. The global scope\r\n //\r\n // The global scope is important for an Extension as that is where the reference to the Extension Implementation is supplied\r\n // from the application side.\r\n private async execute(extension: LocalExtensionProps): Promise<void> {\r\n if (extension.mainFunc)\r\n return extension.mainFunc();\r\n }\r\n\r\n}\r\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Extensions
|
|
3
|
+
*/
|
|
4
|
+
import type { ToolAdmin } from "../tools/ToolAdmin";
|
|
5
|
+
import type { AccuSnap } from "../AccuSnap";
|
|
6
|
+
import type { NotificationManager } from "../NotificationManager";
|
|
7
|
+
import type { ViewManager } from "../ViewManager";
|
|
8
|
+
import type { ElementLocateManager } from "../ElementLocateManager";
|
|
9
|
+
import type { RenderSystem } from "../render/RenderSystem";
|
|
10
|
+
/**
|
|
11
|
+
* Subset of IModelApp exposed to Extensions
|
|
12
|
+
* @alpha
|
|
13
|
+
*/
|
|
14
|
+
export declare class ExtensionHost {
|
|
15
|
+
protected constructor();
|
|
16
|
+
static get toolAdmin(): ToolAdmin;
|
|
17
|
+
static get notifications(): NotificationManager;
|
|
18
|
+
static get viewManager(): ViewManager;
|
|
19
|
+
static get locateManager(): ElementLocateManager;
|
|
20
|
+
static get accuSnap(): AccuSnap;
|
|
21
|
+
static get renderSystem(): RenderSystem;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ExtensionHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtensionHost.d.ts","sourceRoot":"","sources":["../../../src/extension/ExtensionHost.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;GAGG;AACH,qBAAa,aAAa;IACxB,SAAS;IAET,WAAkB,SAAS,IAAI,SAAS,CAAgC;IACxE,WAAkB,aAAa,IAAI,mBAAmB,CAAoC;IAC1F,WAAkB,WAAW,IAAI,WAAW,CAAkC;IAC9E,WAAkB,aAAa,IAAI,oBAAoB,CAAoC;IAC3F,WAAkB,QAAQ,IAAI,QAAQ,CAA+B;IACrE,WAAkB,YAAY,IAAI,YAAY,CAAmC;CAClF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Extensions
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ExtensionHost = void 0;
|
|
11
|
+
const IModelApp_1 = require("../IModelApp");
|
|
12
|
+
/**
|
|
13
|
+
* Subset of IModelApp exposed to Extensions
|
|
14
|
+
* @alpha
|
|
15
|
+
*/
|
|
16
|
+
class ExtensionHost {
|
|
17
|
+
constructor() { }
|
|
18
|
+
static get toolAdmin() { return IModelApp_1.IModelApp.toolAdmin; }
|
|
19
|
+
static get notifications() { return IModelApp_1.IModelApp.notifications; }
|
|
20
|
+
static get viewManager() { return IModelApp_1.IModelApp.viewManager; }
|
|
21
|
+
static get locateManager() { return IModelApp_1.IModelApp.locateManager; } // internal ?
|
|
22
|
+
static get accuSnap() { return IModelApp_1.IModelApp.accuSnap; }
|
|
23
|
+
static get renderSystem() { return IModelApp_1.IModelApp.renderSystem; } // re think this, should be smaller interface
|
|
24
|
+
}
|
|
25
|
+
exports.ExtensionHost = ExtensionHost;
|
|
26
|
+
//# sourceMappingURL=ExtensionHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtensionHost.js","sourceRoot":"","sources":["../../../src/extension/ExtensionHost.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,4CAAyC;AAQzC;;;GAGG;AACH,MAAa,aAAa;IACxB,gBAA0B,CAAC;IAEpB,MAAM,KAAK,SAAS,KAAgB,OAAO,qBAAS,CAAC,SAAS,CAAC,CAAC,CAAC;IACjE,MAAM,KAAK,aAAa,KAA0B,OAAO,qBAAS,CAAC,aAAa,CAAC,CAAC,CAAC;IACnF,MAAM,KAAK,WAAW,KAAkB,OAAO,qBAAS,CAAC,WAAW,CAAC,CAAC,CAAC;IACvE,MAAM,KAAK,aAAa,KAA2B,OAAO,qBAAS,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa;IAClG,MAAM,KAAK,QAAQ,KAAe,OAAO,qBAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9D,MAAM,KAAK,YAAY,KAAmB,OAAO,qBAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,6CAA6C;CAChI;AATD,sCASC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Extensions\r\n */\r\n\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport type { ToolAdmin } from \"../tools/ToolAdmin\";\r\nimport type { AccuSnap } from \"../AccuSnap\";\r\nimport type { NotificationManager } from \"../NotificationManager\";\r\nimport type { ViewManager } from \"../ViewManager\";\r\nimport type { ElementLocateManager } from \"../ElementLocateManager\";\r\nimport type { RenderSystem } from \"../render/RenderSystem\";\r\n\r\n/**\r\n * Subset of IModelApp exposed to Extensions\r\n * @alpha\r\n */\r\nexport class ExtensionHost {\r\n protected constructor() { }\r\n\r\n public static get toolAdmin(): ToolAdmin { return IModelApp.toolAdmin; }\r\n public static get notifications(): NotificationManager { return IModelApp.notifications; }\r\n public static get viewManager(): ViewManager { return IModelApp.viewManager; }\r\n public static get locateManager(): ElementLocateManager { return IModelApp.locateManager; } // internal ?\r\n public static get accuSnap(): AccuSnap { return IModelApp.accuSnap; }\r\n public static get renderSystem(): RenderSystem { return IModelApp.renderSystem; } // re think this, should be smaller interface\r\n}\r\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Extensions
|
|
3
|
+
*/
|
|
4
|
+
import { ToolType } from "../tools/Tool";
|
|
5
|
+
import { CommonToolbarItem, ToolbarOrientation, ToolbarUsage, UiItemsProvider } from "@itwin/appui-abstract";
|
|
6
|
+
/** @alpha */
|
|
7
|
+
export declare class ToolProvider implements UiItemsProvider {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
private _toolId;
|
|
10
|
+
private _toolIcon;
|
|
11
|
+
private _toolLabel;
|
|
12
|
+
constructor(tool: ToolType);
|
|
13
|
+
provideToolbarButtonItems(_stageId: string, stageUsage: string, toolbarUsage: ToolbarUsage, toolbarOrientation: ToolbarOrientation): CommonToolbarItem[];
|
|
14
|
+
}
|
|
15
|
+
/** @alpha */
|
|
16
|
+
export declare class ExtensionImpl {
|
|
17
|
+
private _id;
|
|
18
|
+
constructor(_id: string);
|
|
19
|
+
registerTool(tool: ToolType, onRegistered?: () => any): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=ExtensionImpl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtensionImpl.d.ts","sourceRoot":"","sources":["../../../src/extension/ExtensionImpl.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAoC,kBAAkB,EAAE,YAAY,EAAkB,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE/J,aAAa;AACb,qBAAa,YAAa,YAAW,eAAe;IAClD,SAAgB,EAAE,SAAC;IACnB,OAAO,CAAC,OAAO,CAAM;IACrB,OAAO,CAAC,SAAS,CAAC;IAClB,OAAO,CAAC,UAAU,CAAC;gBAEA,IAAI,EAAE,QAAQ;IAO1B,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,GAAG,iBAAiB,EAAE;CAIhK;AAED,aAAa;AACb,qBAAa,aAAa;IACZ,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,MAAM;IAElB,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CASnF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Extensions
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ExtensionImpl = exports.ToolProvider = void 0;
|
|
11
|
+
const IModelApp_1 = require("../IModelApp");
|
|
12
|
+
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
13
|
+
/** @alpha */
|
|
14
|
+
class ToolProvider {
|
|
15
|
+
constructor(tool) {
|
|
16
|
+
this._toolId = "";
|
|
17
|
+
this.id = `ToolProvider:${tool.toolId}`;
|
|
18
|
+
this._toolId = tool.toolId;
|
|
19
|
+
this._toolIcon = tool.iconSpec;
|
|
20
|
+
this._toolLabel = tool.description;
|
|
21
|
+
}
|
|
22
|
+
provideToolbarButtonItems(_stageId, stageUsage, toolbarUsage, toolbarOrientation) {
|
|
23
|
+
const toolbarItem = appui_abstract_1.ToolbarItemUtilities.createActionButton(this._toolId, 0, this._toolIcon, this._toolLabel, async () => { await IModelApp_1.IModelApp.tools.run(this._toolId); });
|
|
24
|
+
return stageUsage === appui_abstract_1.StageUsage.General && toolbarUsage === appui_abstract_1.ToolbarUsage.ContentManipulation && toolbarOrientation === appui_abstract_1.ToolbarOrientation.Vertical ? [toolbarItem] : [];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.ToolProvider = ToolProvider;
|
|
28
|
+
/** @alpha */
|
|
29
|
+
class ExtensionImpl {
|
|
30
|
+
constructor(_id) {
|
|
31
|
+
this._id = _id;
|
|
32
|
+
}
|
|
33
|
+
async registerTool(tool, onRegistered) {
|
|
34
|
+
try {
|
|
35
|
+
IModelApp_1.IModelApp.tools.register(tool);
|
|
36
|
+
appui_abstract_1.UiItemsManager.register(new ToolProvider(tool));
|
|
37
|
+
onRegistered === null || onRegistered === void 0 ? void 0 : onRegistered();
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
console.log(`Error registering tool: ${e}`); // eslint-disable-line
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.ExtensionImpl = ExtensionImpl;
|
|
45
|
+
//# sourceMappingURL=ExtensionImpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtensionImpl.js","sourceRoot":"","sources":["../../../src/extension/ExtensionImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,4CAAyC;AACzC,0DAA+J;AAE/J,aAAa;AACb,MAAa,YAAY;IAMvB,YAAmB,IAAc;QAJzB,YAAO,GAAG,EAAE,CAAC;QAKnB,IAAI,CAAC,EAAE,GAAG,gBAAgB,IAAI,CAAC,MAAM,EAAE,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;IACrC,CAAC;IAEM,yBAAyB,CAAC,QAAgB,EAAE,UAAkB,EAAE,YAA0B,EAAE,kBAAsC;QACvI,MAAM,WAAW,GAAG,qCAAoB,CAAC,kBAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,IAAI,EAAE,GAAG,MAAM,qBAAS,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxK,OAAO,UAAU,KAAK,2BAAU,CAAC,OAAO,IAAI,YAAY,KAAK,6BAAY,CAAC,mBAAmB,IAAI,kBAAkB,KAAK,mCAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3K,CAAC;CACF;AAjBD,oCAiBC;AAED,aAAa;AACb,MAAa,aAAa;IACxB,YAAoB,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAAI,CAAC;IAE7B,KAAK,CAAC,YAAY,CAAC,IAAc,EAAE,YAAwB;QAChE,IAAI;YACF,qBAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC/B,+BAAc,CAAC,QAAQ,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;YAChD,YAAY,aAAZ,YAAY,uBAAZ,YAAY,EAAI,CAAC;SAClB;QAAC,OAAO,CAAM,EAAE;YACf,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,EAAE,CAAC,CAAC,CAAC,sBAAsB;SACpE;IACH,CAAC;CACF;AAZD,sCAYC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Extensions\r\n */\r\n\r\nimport { ToolType } from \"../tools/Tool\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { CommonToolbarItem, StageUsage, ToolbarItemUtilities, ToolbarOrientation, ToolbarUsage, UiItemsManager, UiItemsProvider } from \"@itwin/appui-abstract\";\r\n\r\n/** @alpha */\r\nexport class ToolProvider implements UiItemsProvider {\r\n public readonly id;\r\n private _toolId = \"\";\r\n private _toolIcon;\r\n private _toolLabel;\r\n\r\n public constructor(tool: ToolType) {\r\n this.id = `ToolProvider:${tool.toolId}`;\r\n this._toolId = tool.toolId;\r\n this._toolIcon = tool.iconSpec;\r\n this._toolLabel = tool.description;\r\n }\r\n\r\n public provideToolbarButtonItems(_stageId: string, stageUsage: string, toolbarUsage: ToolbarUsage, toolbarOrientation: ToolbarOrientation): CommonToolbarItem[] {\r\n const toolbarItem = ToolbarItemUtilities.createActionButton(this._toolId, 0, this._toolIcon, this._toolLabel, async () => { await IModelApp.tools.run(this._toolId); });\r\n return stageUsage === StageUsage.General && toolbarUsage === ToolbarUsage.ContentManipulation && toolbarOrientation === ToolbarOrientation.Vertical ? [toolbarItem] : [];\r\n }\r\n}\r\n\r\n/** @alpha */\r\nexport class ExtensionImpl {\r\n constructor(private _id: string) { }\r\n\r\n public async registerTool(tool: ToolType, onRegistered?: () => any): Promise<void> {\r\n try {\r\n IModelApp.tools.register(tool);\r\n UiItemsManager.register(new ToolProvider(tool));\r\n onRegistered?.();\r\n } catch (e: any) {\r\n console.log(`Error registering tool: ${e}`); // eslint-disable-line\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Extensions
|
|
3
|
+
*/
|
|
4
|
+
import { ExtensionManifest, LocalExtensionProps, ResolveFunc } from "./Extension";
|
|
5
|
+
/** The minimum information required to download an Extension
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
export interface ExtensionLoaderProps {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
}
|
|
12
|
+
/** @alpha */
|
|
13
|
+
export interface BuiltInExtensionLoaderProps {
|
|
14
|
+
manifest: Promise<any>;
|
|
15
|
+
loader: ResolveFunc;
|
|
16
|
+
}
|
|
17
|
+
/** Describes what is needed in order to write an Extension Loader.
|
|
18
|
+
* @alpha
|
|
19
|
+
*/
|
|
20
|
+
export interface ExtensionLoader {
|
|
21
|
+
/** Retrieves an Extension manifest for the provided Extension identifier */
|
|
22
|
+
getManifest(arg: ExtensionLoaderProps): Promise<ExtensionManifest>;
|
|
23
|
+
/** Downloads an Extension provided the name of the Extension */
|
|
24
|
+
downloadExtension(arg: ExtensionLoaderProps): Promise<LocalExtensionProps>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=ExtensionLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtensionLoader.d.ts","sourceRoot":"","sources":["../../../src/extension/ExtensionLoader.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAElF;;EAEE;AACF,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,aAAa;AACb,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IACvB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,WAAW,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACnE,gEAAgE;IAChE,iBAAiB,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC5E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Extensions
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
//# sourceMappingURL=ExtensionLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtensionLoader.js","sourceRoot":"","sources":["../../../src/extension/ExtensionLoader.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Extensions\r\n */\r\n\r\nimport { ExtensionManifest, LocalExtensionProps, ResolveFunc } from \"./Extension\";\r\n\r\n/** The minimum information required to download an Extension\r\n * @alpha\r\n*/\r\nexport interface ExtensionLoaderProps {\r\n name: string;\r\n version: string;\r\n}\r\n\r\n/** @alpha */\r\nexport interface BuiltInExtensionLoaderProps {\r\n manifest: Promise<any>;\r\n loader: ResolveFunc;\r\n}\r\n\r\n/** Describes what is needed in order to write an Extension Loader.\r\n * @alpha\r\n */\r\nexport interface ExtensionLoader {\r\n /** Retrieves an Extension manifest for the provided Extension identifier */\r\n getManifest(arg: ExtensionLoaderProps): Promise<ExtensionManifest>;\r\n /** Downloads an Extension provided the name of the Extension */\r\n downloadExtension(arg: ExtensionLoaderProps): Promise<LocalExtensionProps>;\r\n}\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtensionRuntime.d.ts","sourceRoot":"","sources":["../../../src/extension/ExtensionRuntime.ts"],"names":[],"mappings":"AAIA;;GAEG"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Extensions
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
11
|
+
const core_common_1 = require("@itwin/core-common");
|
|
12
|
+
const ExtensionImpl_1 = require("./ExtensionImpl");
|
|
13
|
+
const ExtensionHost_1 = require("./ExtensionHost");
|
|
14
|
+
const AccuDraw_1 = require("../AccuDraw");
|
|
15
|
+
const AuxCoordSys_1 = require("../AuxCoordSys");
|
|
16
|
+
const CoordSystem_1 = require("../CoordSystem");
|
|
17
|
+
const ElementLocateManager_1 = require("../ElementLocateManager");
|
|
18
|
+
const FlashSettings_1 = require("../FlashSettings");
|
|
19
|
+
const FrontendLoggerCategory_1 = require("../FrontendLoggerCategory");
|
|
20
|
+
const HitDetail_1 = require("../HitDetail");
|
|
21
|
+
const NotificationManager_1 = require("../NotificationManager");
|
|
22
|
+
const SelectionSet_1 = require("../SelectionSet");
|
|
23
|
+
const StandardView_1 = require("../StandardView");
|
|
24
|
+
const ViewRect_1 = require("../ViewRect");
|
|
25
|
+
const ViewStatus_1 = require("../ViewStatus");
|
|
26
|
+
const Viewport_1 = require("../Viewport");
|
|
27
|
+
const GraphicBuilder_1 = require("../render/GraphicBuilder");
|
|
28
|
+
const Pixel_1 = require("../render/Pixel");
|
|
29
|
+
const ScreenSpaceEffectBuilder_1 = require("../render/ScreenSpaceEffectBuilder");
|
|
30
|
+
const internal_1 = require("../tile/internal");
|
|
31
|
+
const ClipViewTool_1 = require("../tools/ClipViewTool");
|
|
32
|
+
const PrimitiveTool_1 = require("../tools/PrimitiveTool");
|
|
33
|
+
const SelectTool_1 = require("../tools/SelectTool");
|
|
34
|
+
const Tool_1 = require("../tools/Tool");
|
|
35
|
+
const ToolAdmin_1 = require("../tools/ToolAdmin");
|
|
36
|
+
const ToolAssistance_1 = require("../tools/ToolAssistance");
|
|
37
|
+
const ViewTool_1 = require("../tools/ViewTool");
|
|
38
|
+
const EditManipulator_1 = require("../tools/EditManipulator");
|
|
39
|
+
const EmphasizeElements_1 = require("../EmphasizeElements");
|
|
40
|
+
const FeatureSymbology_1 = require("../render/FeatureSymbology");
|
|
41
|
+
const GraphicBranch_1 = require("../render/GraphicBranch");
|
|
42
|
+
const ImageUtil_1 = require("../ImageUtil");
|
|
43
|
+
const ViewGlobalLocation_1 = require("../ViewGlobalLocation");
|
|
44
|
+
const BingLocation_1 = require("../BingLocation");
|
|
45
|
+
const FrustumAnimator_1 = require("../FrustumAnimator");
|
|
46
|
+
const GlobeAnimator_1 = require("../GlobeAnimator");
|
|
47
|
+
const MarginPercent_1 = require("../MarginPercent");
|
|
48
|
+
const Marker_1 = require("../Marker");
|
|
49
|
+
const globalSymbol = Symbol.for("itwin.core.frontend.globals");
|
|
50
|
+
if (globalThis[globalSymbol])
|
|
51
|
+
throw new Error("Multiple @itwin/core-frontend imports detected!");
|
|
52
|
+
const getExtensionApi = (id) => {
|
|
53
|
+
return {
|
|
54
|
+
exports: {
|
|
55
|
+
// Tools
|
|
56
|
+
InteractiveTool: Tool_1.InteractiveTool, PrimitiveTool: PrimitiveTool_1.PrimitiveTool, ViewTool: ViewTool_1.ViewTool, Tool: Tool_1.Tool,
|
|
57
|
+
ToolAssistance: ToolAssistance_1.ToolAssistance, BeButtonEvent: Tool_1.BeButtonEvent, ViewRect: ViewRect_1.ViewRect, Pixel: Pixel_1.Pixel, LocateResponse: ElementLocateManager_1.LocateResponse, EditManipulator: EditManipulator_1.EditManipulator, AccuDrawHintBuilder: AccuDraw_1.AccuDrawHintBuilder, EmphasizeElements: EmphasizeElements_1.EmphasizeElements, FeatureSymbology: FeatureSymbology_1.FeatureSymbology, GraphicBranch: GraphicBranch_1.GraphicBranch, NotifyMessageDetails: NotificationManager_1.NotifyMessageDetails,
|
|
58
|
+
ColorDef: core_common_1.ColorDef,
|
|
59
|
+
// Frontend functions
|
|
60
|
+
getCompressedJpegFromCanvas: ImageUtil_1.getCompressedJpegFromCanvas, getImageSourceFormatForMimeType: ImageUtil_1.getImageSourceFormatForMimeType, getImageSourceMimeType: ImageUtil_1.getImageSourceMimeType, imageBufferToBase64EncodedPng: ImageUtil_1.imageBufferToBase64EncodedPng, imageBufferToCanvas: ImageUtil_1.imageBufferToCanvas, imageBufferToPngDataUrl: ImageUtil_1.imageBufferToPngDataUrl,
|
|
61
|
+
imageElementFromImageSource: ImageUtil_1.imageElementFromImageSource, imageElementFromUrl: ImageUtil_1.imageElementFromUrl, queryTerrainElevationOffset: ViewGlobalLocation_1.queryTerrainElevationOffset, readElementGraphics: internal_1.readElementGraphics, canvasToImageBuffer: ImageUtil_1.canvasToImageBuffer, canvasToResizedCanvasWithBars: ImageUtil_1.canvasToResizedCanvasWithBars, extractImageSourceDimensions: ImageUtil_1.extractImageSourceDimensions,
|
|
62
|
+
// Frontend classes
|
|
63
|
+
BingElevationProvider: internal_1.BingElevationProvider, BingLocationProvider: BingLocation_1.BingLocationProvider, InputCollector: Tool_1.InputCollector, FrustumAnimator: FrustumAnimator_1.FrustumAnimator, GlobeAnimator: GlobeAnimator_1.GlobeAnimator, MarginPercent: MarginPercent_1.MarginPercent, Marker: Marker_1.Marker, Cluster: Marker_1.Cluster,
|
|
64
|
+
ExtensionHost: ExtensionHost_1.ExtensionHost,
|
|
65
|
+
ACSDisplayOptions: AuxCoordSys_1.ACSDisplayOptions, ACSType: AuxCoordSys_1.ACSType, ActivityMessageEndReason: NotificationManager_1.ActivityMessageEndReason, BeButton: Tool_1.BeButton, BeModifierKeys: Tool_1.BeModifierKeys, ClipEventType: ClipViewTool_1.ClipEventType, ContextRotationId: AccuDraw_1.ContextRotationId, CoordinateLockOverrides: Tool_1.CoordinateLockOverrides,
|
|
66
|
+
CoordSource: Tool_1.CoordSource, CoordSystem: CoordSystem_1.CoordSystem, DepthPointSource: Viewport_1.DepthPointSource, EventHandled: Tool_1.EventHandled, FlashMode: FlashSettings_1.FlashMode, FrontendLoggerCategory: FrontendLoggerCategory_1.FrontendLoggerCategory, GraphicType: GraphicBuilder_1.GraphicType, HitDetailType: HitDetail_1.HitDetailType, HitGeomType: HitDetail_1.HitGeomType,
|
|
67
|
+
HitParentGeomType: HitDetail_1.HitParentGeomType, HitPriority: HitDetail_1.HitPriority, HitSource: HitDetail_1.HitSource, InputSource: Tool_1.InputSource, KeyinParseError: Tool_1.KeyinParseError, LocateAction: ElementLocateManager_1.LocateAction, LocateFilterStatus: ElementLocateManager_1.LocateFilterStatus, ManipulatorToolEvent: ToolAdmin_1.ManipulatorToolEvent,
|
|
68
|
+
MessageBoxIconType: NotificationManager_1.MessageBoxIconType, MessageBoxType: NotificationManager_1.MessageBoxType, MessageBoxValue: NotificationManager_1.MessageBoxValue, OutputMessageAlert: NotificationManager_1.OutputMessageAlert, OutputMessagePriority: NotificationManager_1.OutputMessagePriority, OutputMessageType: NotificationManager_1.OutputMessageType, ParseAndRunResult: Tool_1.ParseAndRunResult,
|
|
69
|
+
SelectionMethod: SelectTool_1.SelectionMethod, SelectionMode: SelectTool_1.SelectionMode, SelectionProcessing: SelectTool_1.SelectionProcessing, SelectionSetEventType: SelectionSet_1.SelectionSetEventType, SnapHeat: HitDetail_1.SnapHeat, SnapMode: HitDetail_1.SnapMode, SnapStatus: ElementLocateManager_1.SnapStatus, StandardViewId: StandardView_1.StandardViewId, StartOrResume: ToolAdmin_1.StartOrResume,
|
|
70
|
+
TextureTransparency: core_common_1.TextureTransparency, TileBoundingBoxes: internal_1.TileBoundingBoxes, TileGraphicType: internal_1.TileGraphicType, TileLoadPriority: internal_1.TileLoadPriority, TileLoadStatus: internal_1.TileLoadStatus, TileTreeLoadStatus: internal_1.TileTreeLoadStatus, TileVisibility: internal_1.TileVisibility,
|
|
71
|
+
ToolAssistanceImage: ToolAssistance_1.ToolAssistanceImage, ToolAssistanceInputMethod: ToolAssistance_1.ToolAssistanceInputMethod, UniformType: ScreenSpaceEffectBuilder_1.UniformType, VaryingType: ScreenSpaceEffectBuilder_1.VaryingType, ViewStatus: ViewStatus_1.ViewStatus, ViewUndoEvent: Viewport_1.ViewUndoEvent,
|
|
72
|
+
BackgroundFill: core_common_1.BackgroundFill, BackgroundMapType: core_common_1.BackgroundMapType, BatchType: core_common_1.BatchType, BisCodeSpec: core_common_1.BisCodeSpec, BriefcaseIdValue: core_common_1.BriefcaseIdValue, ChangedValueState: core_common_1.ChangedValueState, ChangeOpCode: core_common_1.ChangeOpCode, ChangesetType: core_common_1.ChangesetType, ColorByName: core_common_1.ColorByName,
|
|
73
|
+
CommonLoggerCategory: core_common_1.CommonLoggerCategory, ECSqlSystemProperty: core_common_1.ECSqlSystemProperty, ECSqlValueType: core_common_1.ECSqlValueType, ElementGeometryOpcode: core_common_1.ElementGeometryOpcode, FeatureOverrideType: core_common_1.FeatureOverrideType, FillDisplay: core_common_1.FillDisplay, FillFlags: core_common_1.FillFlags, FontType: core_common_1.FontType,
|
|
74
|
+
GeoCoordStatus: core_common_1.GeoCoordStatus, GeometryClass: core_common_1.GeometryClass, GeometryStreamFlags: core_common_1.GeometryStreamFlags, GeometrySummaryVerbosity: core_common_1.GeometrySummaryVerbosity, GlobeMode: core_common_1.GlobeMode, GridOrientationType: core_common_1.GridOrientationType, HSVConstants: core_common_1.HSVConstants, ImageBufferFormat: core_common_1.ImageBufferFormat,
|
|
75
|
+
ImageSourceFormat: core_common_1.ImageSourceFormat, LinePixels: core_common_1.LinePixels, MassPropertiesOperation: core_common_1.MassPropertiesOperation, MonochromeMode: core_common_1.MonochromeMode, Npc: core_common_1.Npc, PlanarClipMaskMode: core_common_1.PlanarClipMaskMode, PlanarClipMaskPriority: core_common_1.PlanarClipMaskPriority, QueryRowFormat: core_common_1.QueryRowFormat, Rank: core_common_1.Rank,
|
|
76
|
+
RenderMode: core_common_1.RenderMode, SectionType: core_common_1.SectionType,
|
|
77
|
+
SpatialClassifierInsideDisplay: core_common_1.SpatialClassifierInsideDisplay, SpatialClassifierOutsideDisplay: core_common_1.SpatialClassifierOutsideDisplay, SyncMode: core_common_1.SyncMode, TerrainHeightOriginMode: core_common_1.TerrainHeightOriginMode, TextureMapUnits: core_common_1.TextureMapUnits,
|
|
78
|
+
ThematicDisplayMode: core_common_1.ThematicDisplayMode, ThematicGradientColorScheme: core_common_1.ThematicGradientColorScheme, ThematicGradientMode: core_common_1.ThematicGradientMode, TxnAction: core_common_1.TxnAction, TypeOfChange: core_common_1.TypeOfChange,
|
|
79
|
+
},
|
|
80
|
+
api: new ExtensionImpl_1.ExtensionImpl(id),
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
globalThis[globalSymbol] = {
|
|
84
|
+
getExtensionApi,
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=ExtensionRuntime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtensionRuntime.js","sourceRoot":"","sources":["../../../src/extension/ExtensionRuntime.ts"],"names":[],"mappings":"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","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Extensions\r\n */\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\n\r\nimport {\r\n BackgroundFill, BackgroundMapType, BatchType, BisCodeSpec, BriefcaseIdValue, ChangedValueState, ChangeOpCode, ChangesetType, ColorByName, ColorDef, CommonLoggerCategory,\r\n ECSqlSystemProperty, ECSqlValueType, ElementGeometryOpcode, FeatureOverrideType, FillDisplay, FillFlags, FontType, GeoCoordStatus, GeometryClass, GeometryStreamFlags,\r\n GeometrySummaryVerbosity, GlobeMode, GridOrientationType, HSVConstants, ImageBufferFormat, ImageSourceFormat, LinePixels, MassPropertiesOperation, MonochromeMode,\r\n Npc, PlanarClipMaskMode, PlanarClipMaskPriority, QueryRowFormat, Rank, RenderMode, SectionType, SpatialClassifierInsideDisplay, SpatialClassifierOutsideDisplay, SyncMode,\r\n TerrainHeightOriginMode, TextureMapUnits, TextureTransparency, ThematicDisplayMode, ThematicGradientColorScheme, ThematicGradientMode, TxnAction, TypeOfChange,\r\n} from \"@itwin/core-common\";\r\nimport { ExtensionImpl } from \"./ExtensionImpl\";\r\nimport { ExtensionHost } from \"./ExtensionHost\";\r\n\r\nimport { AccuDrawHintBuilder, ContextRotationId } from \"../AccuDraw\";\r\nimport { ACSDisplayOptions, ACSType } from \"../AuxCoordSys\";\r\nimport { CoordSystem } from \"../CoordSystem\";\r\nimport { LocateAction, LocateFilterStatus, LocateResponse, SnapStatus } from \"../ElementLocateManager\";\r\nimport { FlashMode } from \"../FlashSettings\";\r\nimport { FrontendLoggerCategory } from \"../FrontendLoggerCategory\";\r\nimport { HitDetailType, HitGeomType, HitParentGeomType, HitPriority, HitSource, SnapHeat, SnapMode } from \"../HitDetail\";\r\nimport { ActivityMessageEndReason, MessageBoxIconType, MessageBoxType, MessageBoxValue, NotifyMessageDetails, OutputMessageAlert, OutputMessagePriority, OutputMessageType } from \"../NotificationManager\";\r\nimport { SelectionSetEventType } from \"../SelectionSet\";\r\nimport { StandardViewId } from \"../StandardView\";\r\nimport { ViewRect } from \"../ViewRect\";\r\nimport { ViewStatus } from \"../ViewStatus\";\r\nimport { DepthPointSource, ViewUndoEvent } from \"../Viewport\";\r\nimport { GraphicType } from \"../render/GraphicBuilder\";\r\nimport { Pixel } from \"../render/Pixel\";\r\nimport { UniformType, VaryingType } from \"../render/ScreenSpaceEffectBuilder\";\r\nimport { BingElevationProvider, readElementGraphics, TileBoundingBoxes, TileGraphicType, TileLoadPriority, TileLoadStatus, TileTreeLoadStatus, TileVisibility } from \"../tile/internal\";\r\nimport { ClipEventType } from \"../tools/ClipViewTool\";\r\nimport { PrimitiveTool } from \"../tools/PrimitiveTool\";\r\nimport { SelectionMethod, SelectionMode, SelectionProcessing } from \"../tools/SelectTool\";\r\nimport { BeButton, BeButtonEvent, BeModifierKeys, CoordinateLockOverrides, CoordSource, EventHandled, InputCollector, InputSource, InteractiveTool, KeyinParseError, ParseAndRunResult, Tool } from \"../tools/Tool\";\r\nimport { ManipulatorToolEvent, StartOrResume } from \"../tools/ToolAdmin\";\r\nimport { ToolAssistance, ToolAssistanceImage, ToolAssistanceInputMethod } from \"../tools/ToolAssistance\";\r\nimport { ViewTool } from \"../tools/ViewTool\";\r\nimport { EditManipulator } from \"../tools/EditManipulator\";\r\nimport { EmphasizeElements } from \"../EmphasizeElements\";\r\nimport { FeatureSymbology } from \"../render/FeatureSymbology\";\r\nimport { GraphicBranch } from \"../render/GraphicBranch\";\r\nimport { canvasToImageBuffer, canvasToResizedCanvasWithBars, extractImageSourceDimensions, getCompressedJpegFromCanvas, getImageSourceFormatForMimeType, getImageSourceMimeType,\r\n imageBufferToBase64EncodedPng, imageBufferToCanvas, imageBufferToPngDataUrl, imageElementFromImageSource, imageElementFromUrl } from \"../ImageUtil\";\r\nimport { queryTerrainElevationOffset } from \"../ViewGlobalLocation\";\r\nimport { BingLocationProvider } from \"../BingLocation\";\r\nimport { FrustumAnimator } from \"../FrustumAnimator\";\r\nimport { GlobeAnimator } from \"../GlobeAnimator\";\r\nimport { MarginPercent } from \"../MarginPercent\";\r\nimport { Cluster, Marker } from \"../Marker\";\r\n\r\nconst globalSymbol = Symbol.for(\"itwin.core.frontend.globals\");\r\nif ((globalThis as any)[globalSymbol])\r\n throw new Error(\"Multiple @itwin/core-frontend imports detected!\");\r\n\r\nconst getExtensionApi = (id: string) => {\r\n return {\r\n exports: {\r\n // Tools\r\n InteractiveTool, PrimitiveTool, ViewTool, Tool,\r\n\r\n ToolAssistance, BeButtonEvent, ViewRect, Pixel, LocateResponse, EditManipulator, AccuDrawHintBuilder, EmphasizeElements, FeatureSymbology, GraphicBranch, NotifyMessageDetails,\r\n\r\n ColorDef,\r\n\r\n // Frontend functions\r\n getCompressedJpegFromCanvas, getImageSourceFormatForMimeType, getImageSourceMimeType, imageBufferToBase64EncodedPng, imageBufferToCanvas, imageBufferToPngDataUrl,\r\n imageElementFromImageSource, imageElementFromUrl, queryTerrainElevationOffset, readElementGraphics, canvasToImageBuffer, canvasToResizedCanvasWithBars, extractImageSourceDimensions,\r\n\r\n // Frontend classes\r\n BingElevationProvider, BingLocationProvider, InputCollector, FrustumAnimator, GlobeAnimator, MarginPercent, Marker, Cluster,\r\n\r\n ExtensionHost,\r\n\r\n ACSDisplayOptions, ACSType, ActivityMessageEndReason, BeButton, BeModifierKeys, ClipEventType, ContextRotationId, CoordinateLockOverrides,\r\n CoordSource, CoordSystem, DepthPointSource, EventHandled, FlashMode, FrontendLoggerCategory, GraphicType, HitDetailType, HitGeomType,\r\n HitParentGeomType, HitPriority, HitSource, InputSource, KeyinParseError, LocateAction, LocateFilterStatus, ManipulatorToolEvent,\r\n MessageBoxIconType, MessageBoxType, MessageBoxValue, OutputMessageAlert, OutputMessagePriority, OutputMessageType, ParseAndRunResult,\r\n SelectionMethod, SelectionMode, SelectionProcessing, SelectionSetEventType, SnapHeat, SnapMode, SnapStatus, StandardViewId, StartOrResume,\r\n TextureTransparency, TileBoundingBoxes, TileGraphicType, TileLoadPriority, TileLoadStatus, TileTreeLoadStatus, TileVisibility,\r\n ToolAssistanceImage, ToolAssistanceInputMethod, UniformType, VaryingType, ViewStatus, ViewUndoEvent,\r\n\r\n BackgroundFill, BackgroundMapType, BatchType, BisCodeSpec, BriefcaseIdValue, ChangedValueState, ChangeOpCode, ChangesetType, ColorByName,\r\n CommonLoggerCategory, ECSqlSystemProperty, ECSqlValueType, ElementGeometryOpcode, FeatureOverrideType, FillDisplay, FillFlags, FontType,\r\n GeoCoordStatus, GeometryClass, GeometryStreamFlags, GeometrySummaryVerbosity, GlobeMode, GridOrientationType, HSVConstants, ImageBufferFormat,\r\n ImageSourceFormat, LinePixels, MassPropertiesOperation, MonochromeMode, Npc, PlanarClipMaskMode, PlanarClipMaskPriority, QueryRowFormat, Rank,\r\n RenderMode, SectionType,\r\n SpatialClassifierInsideDisplay, SpatialClassifierOutsideDisplay, SyncMode, TerrainHeightOriginMode, TextureMapUnits,\r\n ThematicDisplayMode, ThematicGradientColorScheme, ThematicGradientMode, TxnAction, TypeOfChange,\r\n },\r\n api: new ExtensionImpl(id),\r\n };\r\n};\r\n\r\n(globalThis as any)[globalSymbol] = {\r\n getExtensionApi,\r\n};\r\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Extension framework is made up of multiple pieces:
|
|
3
|
+
*
|
|
4
|
+
* - Extension API
|
|
5
|
+
* - The Extension API defines all of the types and API that can be used by an Extension.
|
|
6
|
+
* - Extension Impl
|
|
7
|
+
* - The current implementation of the Extension API
|
|
8
|
+
* - Extension Admin
|
|
9
|
+
* - Handles loading and managing Extensions
|
|
10
|
+
* - Extension Hooks
|
|
11
|
+
* - Defines the contribution points for Extensions
|
|
12
|
+
*/
|
|
13
|
+
export * from "./Extension";
|
|
14
|
+
export * from "./ExtensionAdmin";
|
|
15
|
+
export * from "./ExtensionImpl";
|
|
16
|
+
export * from "./ExtensionLoader";
|
|
17
|
+
export * from "./ExtensionHost";
|
|
18
|
+
import "./ExtensionRuntime";
|
|
19
|
+
//# sourceMappingURL=extensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../../src/extension/extensions.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,OAAO,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// Barrel file for all extension related files.
|
|
18
|
+
/**
|
|
19
|
+
* The Extension framework is made up of multiple pieces:
|
|
20
|
+
*
|
|
21
|
+
* - Extension API
|
|
22
|
+
* - The Extension API defines all of the types and API that can be used by an Extension.
|
|
23
|
+
* - Extension Impl
|
|
24
|
+
* - The current implementation of the Extension API
|
|
25
|
+
* - Extension Admin
|
|
26
|
+
* - Handles loading and managing Extensions
|
|
27
|
+
* - Extension Hooks
|
|
28
|
+
* - Defines the contribution points for Extensions
|
|
29
|
+
*/
|
|
30
|
+
__exportStar(require("./Extension"), exports);
|
|
31
|
+
__exportStar(require("./ExtensionAdmin"), exports);
|
|
32
|
+
__exportStar(require("./ExtensionImpl"), exports);
|
|
33
|
+
__exportStar(require("./ExtensionLoader"), exports);
|
|
34
|
+
__exportStar(require("./ExtensionHost"), exports);
|
|
35
|
+
require("./ExtensionRuntime");
|
|
36
|
+
//# sourceMappingURL=extensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.js","sourceRoot":"","sources":["../../../src/extension/extensions.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;AAE/F,+CAA+C;AAE/C;;;;;;;;;;;GAWG;AAEH,8CAA4B;AAC5B,mDAAiC;AACjC,kDAAgC;AAChC,oDAAkC;AAClC,kDAAgC;AAChC,8BAA4B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n// Barrel file for all extension related files.\r\n\r\n/**\r\n * The Extension framework is made up of multiple pieces:\r\n *\r\n * - Extension API\r\n * - The Extension API defines all of the types and API that can be used by an Extension.\r\n * - Extension Impl\r\n * - The current implementation of the Extension API\r\n * - Extension Admin\r\n * - Handles loading and managing Extensions\r\n * - Extension Hooks\r\n * - Defines the contribution points for Extensions\r\n */\r\n\r\nexport * from \"./Extension\";\r\nexport * from \"./ExtensionAdmin\";\r\nexport * from \"./ExtensionImpl\";\r\nexport * from \"./ExtensionLoader\";\r\nexport * from \"./ExtensionHost\";\r\nimport \"./ExtensionRuntime\";\r\n"]}
|