@itwin/ecschema-rpcinterface-tests 3.5.1 → 3.5.2
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/dist/_cb67.bundled-tests.js.map +1 -1
- package/lib/dist/bundled-tests.js +445 -353
- package/lib/dist/bundled-tests.js.map +1 -1
- package/lib/dist/core_frontend_lib_esm_ApproximateTerrainHeightsProps_js.bundled-tests.js.map +1 -1
- package/lib/dist/object-storage.bundled-tests.js.map +1 -1
- package/lib/dist/vendors-common_temp_node_modules_pnpm_itwin_object-storage-azure_1_4_0_node_modules_itwin_obj-3576c6.bundled-tests.js.map +1 -1
- package/lib/dist/vendors-common_temp_node_modules_pnpm_loaders_gl_draco_3_2_12_node_modules_loaders_gl_draco_d-b19815.bundled-tests.js.map +1 -1
- package/lib/dist/vendors-common_temp_node_modules_pnpm_reflect-metadata_0_1_13_node_modules_reflect-metadata_R-610cb3.bundled-tests.js.map +1 -1
- package/package.json +16 -16
|
@@ -132982,7 +132982,6 @@ class RealityMeshParamsBuilder {
|
|
|
132982
132982
|
* @returns the index of the new vertex in [[positions]].
|
|
132983
132983
|
*/
|
|
132984
132984
|
addQuantizedVertex(position, uv, normal) {
|
|
132985
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(this.positions.length < 0xffff, "RealityMeshParams supports no more than 64k vertices");
|
|
132986
132985
|
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)((undefined === normal) === (undefined === this.normals), "RealityMeshParams requires all vertices to have normals, or none.");
|
|
132987
132986
|
this.positions.push(position);
|
|
132988
132987
|
this.uvs.push(uv);
|
|
@@ -133009,7 +133008,6 @@ class RealityMeshParamsBuilder {
|
|
|
133009
133008
|
this.addIndex(index);
|
|
133010
133009
|
}
|
|
133011
133010
|
addIndex(index) {
|
|
133012
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(index <= 0xffff, "RealityMeshParams supports no more than 64k vertices");
|
|
133013
133011
|
this.indices.push(index);
|
|
133014
133012
|
}
|
|
133015
133013
|
/** Extract the finished [[RealityMeshParams]]. */
|
|
@@ -139814,6 +139812,7 @@ class BranchState {
|
|
|
139814
139812
|
get viewFlags() { return this._opts.viewFlags; }
|
|
139815
139813
|
set viewFlags(vf) { this._opts.viewFlags = vf.normalize(); }
|
|
139816
139814
|
get clipVolume() { return this._opts.clipVolume; }
|
|
139815
|
+
get forceViewCoords() { return true === this._opts.forceViewCoords; }
|
|
139817
139816
|
get planarClassifier() { return this._opts.planarClassifier; }
|
|
139818
139817
|
get textureDrape() { return this._opts.textureDrape; }
|
|
139819
139818
|
get edgeSettings() { return this._opts.edgeSettings; }
|
|
@@ -139845,6 +139844,7 @@ class BranchState {
|
|
|
139845
139844
|
planarClassifier: (undefined !== branch.planarClassifier && undefined !== branch.planarClassifier.texture) ? branch.planarClassifier : prev.planarClassifier,
|
|
139846
139845
|
textureDrape: (_c = branch.textureDrape) !== null && _c !== void 0 ? _c : prev.textureDrape,
|
|
139847
139846
|
clipVolume: branch.clips,
|
|
139847
|
+
forceViewCoords: prev.forceViewCoords,
|
|
139848
139848
|
edgeSettings: (_d = branch.edgeSettings) !== null && _d !== void 0 ? _d : prev.edgeSettings,
|
|
139849
139849
|
is3d: (_f = (_e = branch.frustum) === null || _e === void 0 ? void 0 : _e.is3d) !== null && _f !== void 0 ? _f : prev.is3d,
|
|
139850
139850
|
frustumScale: (_h = (_g = branch.frustum) === null || _g === void 0 ? void 0 : _g.scale) !== null && _h !== void 0 ? _h : prev.frustumScale,
|
|
@@ -139863,6 +139863,9 @@ class BranchState {
|
|
|
139863
139863
|
const vf = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.ViewFlags({ renderMode: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.RenderMode.SmoothShade, lighting: false, whiteOnWhiteReversal: false });
|
|
139864
139864
|
return new BranchState({ viewFlags: vf, transform: _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_0__.Transform.createIdentity(), symbologyOverrides: new _FeatureSymbology__WEBPACK_IMPORTED_MODULE_2__.FeatureSymbology.Overrides(), edgeSettings: _EdgeSettings__WEBPACK_IMPORTED_MODULE_3__.EdgeSettings.create(undefined), is3d: true });
|
|
139865
139865
|
}
|
|
139866
|
+
withViewCoords() {
|
|
139867
|
+
return new BranchState({ ...this._opts, forceViewCoords: true });
|
|
139868
|
+
}
|
|
139866
139869
|
}
|
|
139867
139870
|
|
|
139868
139871
|
|
|
@@ -141763,7 +141766,9 @@ class DrawParams {
|
|
|
141763
141766
|
get target() { return this.programParams.target; }
|
|
141764
141767
|
get renderPass() { return this.programParams.renderPass; }
|
|
141765
141768
|
get projectionMatrix() { return this.programParams.projectionMatrix; }
|
|
141766
|
-
get isViewCoords() {
|
|
141769
|
+
get isViewCoords() {
|
|
141770
|
+
return this.programParams.isViewCoords || this.target.currentBranch.forceViewCoords;
|
|
141771
|
+
}
|
|
141767
141772
|
get isOverlayPass() { return this.programParams.isOverlayPass; }
|
|
141768
141773
|
get context() { return this.programParams.context; }
|
|
141769
141774
|
init(programParams, geometry) {
|
|
@@ -148680,18 +148685,26 @@ class RenderCommands {
|
|
|
148680
148685
|
this._commands.forEach((cmds) => cmds.splice(0));
|
|
148681
148686
|
this._layers.clear();
|
|
148682
148687
|
}
|
|
148683
|
-
|
|
148688
|
+
initForPickOverlayDecorations(overlays) {
|
|
148689
|
+
for (const overlay of overlays) {
|
|
148690
|
+
const gf = overlay;
|
|
148691
|
+
if (gf.isPickable)
|
|
148692
|
+
gf.addCommands(this);
|
|
148693
|
+
}
|
|
148694
|
+
}
|
|
148695
|
+
initForPickOverlays(sceneOverlays, worldOverlayDecorations, viewOverlayDecorations) {
|
|
148684
148696
|
this._clearCommands();
|
|
148685
148697
|
this._addTranslucentAsOpaque = true;
|
|
148686
148698
|
for (const sceneGf of sceneOverlays)
|
|
148687
148699
|
sceneGf.addCommands(this);
|
|
148688
|
-
if (
|
|
148700
|
+
if (worldOverlayDecorations === null || worldOverlayDecorations === void 0 ? void 0 : worldOverlayDecorations.length) {
|
|
148689
148701
|
this.pushAndPopState(this.target.decorationsState, () => {
|
|
148690
|
-
|
|
148691
|
-
|
|
148692
|
-
|
|
148693
|
-
|
|
148694
|
-
|
|
148702
|
+
this.initForPickOverlayDecorations(worldOverlayDecorations);
|
|
148703
|
+
});
|
|
148704
|
+
}
|
|
148705
|
+
if (viewOverlayDecorations === null || viewOverlayDecorations === void 0 ? void 0 : viewOverlayDecorations.length) {
|
|
148706
|
+
this.pushAndPopState(this.target.decorationsState.withViewCoords(), () => {
|
|
148707
|
+
this.initForPickOverlayDecorations(viewOverlayDecorations);
|
|
148695
148708
|
});
|
|
148696
148709
|
}
|
|
148697
148710
|
this._addTranslucentAsOpaque = false;
|
|
@@ -150274,7 +150287,7 @@ class Compositor extends SceneCompositor {
|
|
|
150274
150287
|
this.target.popViewClip();
|
|
150275
150288
|
}
|
|
150276
150289
|
get fullHeight() { return this.target.viewRect.height; }
|
|
150277
|
-
drawForReadPixels(commands, sceneOverlays,
|
|
150290
|
+
drawForReadPixels(commands, sceneOverlays, worldOverlayDecorations, viewOverlayDecorations) {
|
|
150278
150291
|
this.target.beginPerfMetricRecord("Render Background", true);
|
|
150279
150292
|
if (!this.preDraw()) {
|
|
150280
150293
|
this.target.endPerfMetricRecord(true); // End Render Background record if returning
|
|
@@ -150315,11 +150328,11 @@ class Compositor extends SceneCompositor {
|
|
|
150315
150328
|
this.target.endPerfMetricRecord(true);
|
|
150316
150329
|
this.target.popViewClip();
|
|
150317
150330
|
}
|
|
150318
|
-
if (
|
|
150331
|
+
if (!sceneOverlays.length && !(worldOverlayDecorations === null || worldOverlayDecorations === void 0 ? void 0 : worldOverlayDecorations.length) && !(viewOverlayDecorations === null || viewOverlayDecorations === void 0 ? void 0 : viewOverlayDecorations.length))
|
|
150319
150332
|
return;
|
|
150320
150333
|
// Now populate the opaque passes with any pickable world overlays
|
|
150321
150334
|
this.target.beginPerfMetricRecord("Overlay Draws", true);
|
|
150322
|
-
commands.initForPickOverlays(sceneOverlays,
|
|
150335
|
+
commands.initForPickOverlays(sceneOverlays, worldOverlayDecorations, viewOverlayDecorations);
|
|
150323
150336
|
if (commands.isEmpty) {
|
|
150324
150337
|
this.target.endPerfMetricRecord(true); // End Overlay Draws record if returning
|
|
150325
150338
|
return;
|
|
@@ -155850,7 +155863,7 @@ class Target extends _RenderTarget__WEBPACK_IMPORTED_MODULE_8__.RenderTarget {
|
|
|
155850
155863
|
get frameStatsCollector() { return this._frameStatsCollector; }
|
|
155851
155864
|
assignFrameStatsCollector(collector) { this._frameStatsCollector = collector; }
|
|
155852
155865
|
paintScene(sceneMilSecElapsed) {
|
|
155853
|
-
var _a;
|
|
155866
|
+
var _a, _b;
|
|
155854
155867
|
if (!this._dcAssigned)
|
|
155855
155868
|
return;
|
|
155856
155869
|
this._frameStatsCollector.beginTime("totalFrameTime");
|
|
@@ -155865,7 +155878,7 @@ class Target extends _RenderTarget__WEBPACK_IMPORTED_MODULE_8__.RenderTarget {
|
|
|
155865
155878
|
// Set this to true to visualize the output of readPixels()...useful for debugging pick.
|
|
155866
155879
|
if (this.drawForReadPixels) {
|
|
155867
155880
|
this.beginReadPixels(_Pixel__WEBPACK_IMPORTED_MODULE_6__.Pixel.Selector.Feature);
|
|
155868
|
-
this.compositor.drawForReadPixels(this._renderCommands, this.graphics.overlays, (_a = this.graphics.decorations) === null || _a === void 0 ? void 0 : _a.worldOverlay);
|
|
155881
|
+
this.compositor.drawForReadPixels(this._renderCommands, this.graphics.overlays, (_a = this.graphics.decorations) === null || _a === void 0 ? void 0 : _a.worldOverlay, (_b = this.graphics.decorations) === null || _b === void 0 ? void 0 : _b.viewOverlay);
|
|
155869
155882
|
this.endReadPixels();
|
|
155870
155883
|
}
|
|
155871
155884
|
else {
|
|
@@ -156051,7 +156064,7 @@ class Target extends _RenderTarget__WEBPACK_IMPORTED_MODULE_8__.RenderTarget {
|
|
|
156051
156064
|
this._isReadPixelsInProgress = false;
|
|
156052
156065
|
}
|
|
156053
156066
|
readPixelsFromFbo(rect, selector) {
|
|
156054
|
-
var _a;
|
|
156067
|
+
var _a, _b;
|
|
156055
156068
|
// Create a culling frustum based on the input rect. We can't do this if a screen-space effect is going to move pixels around.
|
|
156056
156069
|
let rectFrust;
|
|
156057
156070
|
if (!this.renderSystem.screenSpaceEffects.shouldApply(this)) {
|
|
@@ -156082,7 +156095,7 @@ class Target extends _RenderTarget__WEBPACK_IMPORTED_MODULE_8__.RenderTarget {
|
|
|
156082
156095
|
}
|
|
156083
156096
|
this.beginReadPixels(selector, rectFrust);
|
|
156084
156097
|
// Draw the scene
|
|
156085
|
-
this.compositor.drawForReadPixels(this._renderCommands, this.graphics.overlays, (_a = this.graphics.decorations) === null || _a === void 0 ? void 0 : _a.worldOverlay);
|
|
156098
|
+
this.compositor.drawForReadPixels(this._renderCommands, this.graphics.overlays, (_a = this.graphics.decorations) === null || _a === void 0 ? void 0 : _a.worldOverlay, (_b = this.graphics.decorations) === null || _b === void 0 ? void 0 : _b.viewOverlay);
|
|
156086
156099
|
if (this.performanceMetrics && !this.performanceMetrics.gatherCurPerformanceMetrics) { // Only collect readPixels data if in disp-perf-test-app
|
|
156087
156100
|
this.performanceMetrics.endOperation(); // End the 'CPU Total Time' operation
|
|
156088
156101
|
if (this.performanceMetrics.gatherGlFinish && !this.renderSystem.isGLTimerSupported) {
|
|
@@ -259413,6 +259426,85 @@ class PolyfaceQuery {
|
|
|
259413
259426
|
const inertiaProducts = PolyfaceQuery.sumFacetSecondVolumeMomentProducts(source, origin);
|
|
259414
259427
|
return _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_7__.MomentData.inertiaProductsToPrincipalAxes(origin, inertiaProducts);
|
|
259415
259428
|
}
|
|
259429
|
+
/**
|
|
259430
|
+
* Test for convex volume by dihedral angle tests on all edges.
|
|
259431
|
+
* * This tests if all dihedral angles are positive.
|
|
259432
|
+
* * In a closed solid, this is a strong test for overall convexity.
|
|
259433
|
+
* * With `ignoreBoundaries` true, this may be a useful test when all the facets are in a single edge-connected component, such as a pyramid with no underside.
|
|
259434
|
+
* * It is not a correct test if there are multiple, disjoint components.
|
|
259435
|
+
* * Take the above-mentioned pyramid with no underside.
|
|
259436
|
+
* * Within the same mesh, have a second pyramid placed to the side, still facing upward.
|
|
259437
|
+
* * The angles will pass the dihedral convexity test, but the composite thing surely is not convex.
|
|
259438
|
+
* @param source mesh to examine
|
|
259439
|
+
* @param ignoreBoundaries if true, ignore simple boundary edges, i.e. allow unclosed meshes.
|
|
259440
|
+
* @returns true if the mesh is closed and has all dihedral angles (angle across edge) positive
|
|
259441
|
+
*/
|
|
259442
|
+
static isConvexByDihedralAngleCount(source, ignoreBoundaries = false) {
|
|
259443
|
+
return this.dihedralAngleSummary(source, ignoreBoundaries) > 0;
|
|
259444
|
+
}
|
|
259445
|
+
/**
|
|
259446
|
+
* Compute a number summarizing the dihedral angles in the mesh.
|
|
259447
|
+
* @see [[isConvexByDihedralAngleCount]] for comments about ignoreBoundaries===true when there are multiple connected components.
|
|
259448
|
+
* @param source mesh to examine
|
|
259449
|
+
* @param ignoreBoundaries if true, ignore simple boundary edges, i.e. allow unclosed meshes.
|
|
259450
|
+
* @returns a number summarizing the dihedral angles in the mesh.
|
|
259451
|
+
* * Return 1 if all angles are positive or planar. The mesh is probably convex with outward normals.
|
|
259452
|
+
* * Return -1 if all angles are negative or planar. The mesh is probably convex with inward normals.
|
|
259453
|
+
* * Return 0 if
|
|
259454
|
+
* * angles area mixed
|
|
259455
|
+
* * any edge has other than 1 incident facet or more than 2 incident facets.
|
|
259456
|
+
* * (but null edges are permitted -- These occur naturally at edges of quads at north or south pole)
|
|
259457
|
+
*/
|
|
259458
|
+
static dihedralAngleSummary(source, ignoreBoundaries = false) {
|
|
259459
|
+
const edges = new _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_9__.IndexedEdgeMatcher();
|
|
259460
|
+
const visitor = source.createVisitor(1);
|
|
259461
|
+
visitor.reset();
|
|
259462
|
+
const centroidNormal = [];
|
|
259463
|
+
let normalCounter = 0;
|
|
259464
|
+
while (visitor.moveToNextFacet()) {
|
|
259465
|
+
const numEdges = visitor.pointCount - 1;
|
|
259466
|
+
const normal = _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_4__.PolygonOps.centroidAreaNormal(visitor.point);
|
|
259467
|
+
if (normal === undefined)
|
|
259468
|
+
return 0;
|
|
259469
|
+
centroidNormal.push(normal);
|
|
259470
|
+
for (let i = 0; i < numEdges; i++) {
|
|
259471
|
+
edges.addEdge(visitor.clientPointIndex(i), visitor.clientPointIndex(i + 1), normalCounter);
|
|
259472
|
+
}
|
|
259473
|
+
normalCounter++;
|
|
259474
|
+
}
|
|
259475
|
+
const badClusters = [];
|
|
259476
|
+
const manifoldClusters = [];
|
|
259477
|
+
edges.sortAndCollectClusters(manifoldClusters, ignoreBoundaries ? undefined : badClusters, undefined, badClusters);
|
|
259478
|
+
if (badClusters.length > 0)
|
|
259479
|
+
return 0;
|
|
259480
|
+
let numPositive = 0;
|
|
259481
|
+
let numPlanar = 0;
|
|
259482
|
+
let numNegative = 0;
|
|
259483
|
+
const edgeVector = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_6__.Vector3d.create();
|
|
259484
|
+
for (const cluster of manifoldClusters) {
|
|
259485
|
+
const sideA = cluster.at(0);
|
|
259486
|
+
const sideB = cluster.at(1);
|
|
259487
|
+
if (sideA instanceof _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_9__.SortableEdge
|
|
259488
|
+
&& sideB instanceof _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_9__.SortableEdge
|
|
259489
|
+
&& source.data.point.vectorIndexIndex(sideA.vertexIndexA, sideA.vertexIndexB, edgeVector)) {
|
|
259490
|
+
const dihedralAngle = centroidNormal[sideA.facetIndex].direction.signedAngleTo(centroidNormal[sideB.facetIndex].direction, edgeVector);
|
|
259491
|
+
if (dihedralAngle.isAlmostZero)
|
|
259492
|
+
numPlanar++;
|
|
259493
|
+
else if (dihedralAngle.radians > 0.0)
|
|
259494
|
+
numPositive++;
|
|
259495
|
+
else
|
|
259496
|
+
numNegative++;
|
|
259497
|
+
}
|
|
259498
|
+
}
|
|
259499
|
+
if (numPositive > 0 && numNegative === 0)
|
|
259500
|
+
return 1;
|
|
259501
|
+
if (numNegative > 0 && numPositive === 0)
|
|
259502
|
+
return -1;
|
|
259503
|
+
// problem case: if all edges have zero dihedral angle, record it as convex.
|
|
259504
|
+
if (numPlanar > 0 && numPositive === 0 && numNegative === 0)
|
|
259505
|
+
return 1;
|
|
259506
|
+
return 0;
|
|
259507
|
+
}
|
|
259416
259508
|
/**
|
|
259417
259509
|
* Test if the facets in `source` occur in perfectly mated pairs, as is required for a closed manifold volume.
|
|
259418
259510
|
*/
|
|
@@ -280383,230 +280475,230 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
280383
280475
|
/* harmony import */ var i18next_browser_languagedetector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! i18next-browser-languagedetector */ "../../common/temp/node_modules/.pnpm/i18next-browser-languagedetector@6.1.8/node_modules/i18next-browser-languagedetector/dist/esm/i18nextBrowserLanguageDetector.js");
|
|
280384
280476
|
/* harmony import */ var i18next_http_backend__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! i18next-http-backend */ "../../common/temp/node_modules/.pnpm/i18next-http-backend@1.4.5/node_modules/i18next-http-backend/esm/index.js");
|
|
280385
280477
|
/* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
280386
|
-
/*---------------------------------------------------------------------------------------------
|
|
280387
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
280388
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
280389
|
-
*--------------------------------------------------------------------------------------------*/
|
|
280390
|
-
/** @packageDocumentation
|
|
280391
|
-
* @module Localization
|
|
280392
|
-
*/
|
|
280393
|
-
|
|
280394
|
-
|
|
280395
|
-
|
|
280396
|
-
|
|
280397
|
-
const DEFAULT_MAX_RETRIES = 1; // a low number prevents wasted time and potential timeouts when requesting localization files throws an error
|
|
280398
|
-
/** Supplies localizations for iTwin.js
|
|
280399
|
-
* @note this class uses the [i18next](https://www.i18next.com/) package.
|
|
280400
|
-
* @public
|
|
280401
|
-
*/
|
|
280402
|
-
class ITwinLocalization {
|
|
280403
|
-
constructor(options) {
|
|
280404
|
-
var _a, _b, _c;
|
|
280405
|
-
this._namespaces = new Map();
|
|
280406
|
-
this.i18next = i18next__WEBPACK_IMPORTED_MODULE_0__["default"].createInstance();
|
|
280407
|
-
this._backendOptions = {
|
|
280408
|
-
loadPath: (_a = options === null || options === void 0 ? void 0 : options.urlTemplate) !== null && _a !== void 0 ? _a : "locales/{{lng}}/{{ns}}.json",
|
|
280409
|
-
crossDomain: true,
|
|
280410
|
-
...options === null || options === void 0 ? void 0 : options.backendHttpOptions,
|
|
280411
|
-
};
|
|
280412
|
-
this._detectionOptions = {
|
|
280413
|
-
order: ["querystring", "navigator", "htmlTag"],
|
|
280414
|
-
lookupQuerystring: "lng",
|
|
280415
|
-
caches: [],
|
|
280416
|
-
...options === null || options === void 0 ? void 0 : options.detectorOptions,
|
|
280417
|
-
};
|
|
280418
|
-
this._initOptions = {
|
|
280419
|
-
interpolation: { escapeValue: true },
|
|
280420
|
-
fallbackLng: "en",
|
|
280421
|
-
maxRetries: DEFAULT_MAX_RETRIES,
|
|
280422
|
-
backend: this._backendOptions,
|
|
280423
|
-
detection: this._detectionOptions,
|
|
280424
|
-
...options === null || options === void 0 ? void 0 : options.initOptions,
|
|
280425
|
-
};
|
|
280426
|
-
this.i18next
|
|
280427
|
-
.use((_b = options === null || options === void 0 ? void 0 : options.detectorPlugin) !== null && _b !== void 0 ? _b : i18next_browser_languagedetector__WEBPACK_IMPORTED_MODULE_1__["default"])
|
|
280428
|
-
.use((_c = options === null || options === void 0 ? void 0 : options.backendPlugin) !== null && _c !== void 0 ? _c : i18next_http_backend__WEBPACK_IMPORTED_MODULE_2__["default"])
|
|
280429
|
-
.use(TranslationLogger);
|
|
280430
|
-
}
|
|
280431
|
-
async initialize(namespaces) {
|
|
280432
|
-
var _a;
|
|
280433
|
-
// Also consider namespaces passed into constructor
|
|
280434
|
-
const initNamespaces = [this._initOptions.ns || []].flat();
|
|
280435
|
-
const combinedNamespaces = new Set([...namespaces, ...initNamespaces]); // without duplicates
|
|
280436
|
-
const defaultNamespace = (_a = this._initOptions.defaultNS) !== null && _a !== void 0 ? _a : namespaces[0];
|
|
280437
|
-
if (defaultNamespace)
|
|
280438
|
-
combinedNamespaces.add(defaultNamespace); // Make sure default namespace is in namespaces list
|
|
280439
|
-
const initOptions = {
|
|
280440
|
-
...this._initOptions,
|
|
280441
|
-
defaultNS: defaultNamespace,
|
|
280442
|
-
ns: [...combinedNamespaces],
|
|
280443
|
-
};
|
|
280444
|
-
// if in a development environment, set debugging
|
|
280445
|
-
if (false)
|
|
280446
|
-
{}
|
|
280447
|
-
const initPromise = this.i18next.init(initOptions);
|
|
280448
|
-
for (const ns of namespaces)
|
|
280449
|
-
this._namespaces.set(ns, initPromise);
|
|
280450
|
-
return initPromise;
|
|
280451
|
-
}
|
|
280452
|
-
/** Replace all instances of `%{key}` within a string with the translations of those keys.
|
|
280453
|
-
* For example:
|
|
280454
|
-
* ``` ts
|
|
280455
|
-
* "MyKeys": {
|
|
280456
|
-
* "Key1": "First value",
|
|
280457
|
-
* "Key2": "Second value"
|
|
280458
|
-
* }
|
|
280459
|
-
* ```
|
|
280460
|
-
*
|
|
280461
|
-
* ``` ts
|
|
280462
|
-
* i18.translateKeys("string with %{MyKeys.Key1} followed by %{MyKeys.Key2}!"") // returns "string with First Value followed by Second Value!"
|
|
280463
|
-
* ```
|
|
280464
|
-
* @param line The input line, potentially containing %{keys}.
|
|
280465
|
-
* @returns The line with all %{keys} translated
|
|
280466
|
-
* @public
|
|
280467
|
-
*/
|
|
280468
|
-
getLocalizedKeys(line) {
|
|
280469
|
-
return line.replace(/\%\{(.+?)\}/g, (_match, tag) => this.getLocalizedString(tag));
|
|
280470
|
-
}
|
|
280471
|
-
/** Return the translated value of a key.
|
|
280472
|
-
* @param key - the key that matches a property in the JSON localization file.
|
|
280473
|
-
* @note The key includes the namespace, which identifies the particular localization file that contains the property,
|
|
280474
|
-
* followed by a colon, followed by the property in the JSON file.
|
|
280475
|
-
* For example:
|
|
280476
|
-
* ``` ts
|
|
280477
|
-
* const dataString: string = IModelApp.localization.getLocalizedString("iModelJs:BackgroundMap.BingDataAttribution");
|
|
280478
|
-
* ```
|
|
280479
|
-
* assigns to dataString the string with property BackgroundMap.BingDataAttribution from the iModelJs.json localization file.
|
|
280480
|
-
* @returns The string corresponding to the first key that resolves.
|
|
280481
|
-
* @throws Error if no keys resolve to a string.
|
|
280482
|
-
* @public
|
|
280483
|
-
*/
|
|
280484
|
-
getLocalizedString(key, options) {
|
|
280485
|
-
if ((options === null || options === void 0 ? void 0 : options.returnDetails) || (options === null || options === void 0 ? void 0 : options.returnObjects)) {
|
|
280486
|
-
throw new Error("Translation key must map to a string, but the given options will result in an object");
|
|
280487
|
-
}
|
|
280488
|
-
const value = this.i18next.t(key, options);
|
|
280489
|
-
if (typeof value !== "string") {
|
|
280490
|
-
throw new Error("Translation key(s) string not found");
|
|
280491
|
-
}
|
|
280492
|
-
return value;
|
|
280493
|
-
}
|
|
280494
|
-
/** Similar to `getLocalizedString` but the default namespace is a separate parameter and the key does not need
|
|
280495
|
-
* to include a namespace. If a key includes a namespace, that namespace will be used for interpolating that key.
|
|
280496
|
-
* @param namespace - the namespace that identifies the particular localization file that contains the property.
|
|
280497
|
-
* @param key - the key that matches a property in the JSON localization file.
|
|
280498
|
-
* @returns The string corresponding to the first key that resolves.
|
|
280499
|
-
* @throws Error if no keys resolve to a string.
|
|
280500
|
-
* @internal
|
|
280501
|
-
*/
|
|
280502
|
-
getLocalizedStringWithNamespace(namespace, key, options) {
|
|
280503
|
-
let fullKey = "";
|
|
280504
|
-
if (typeof key === "string") {
|
|
280505
|
-
fullKey = `${namespace}:${key}`;
|
|
280506
|
-
}
|
|
280507
|
-
else {
|
|
280508
|
-
fullKey = key.map((subKey) => {
|
|
280509
|
-
return `${namespace}:${subKey}`;
|
|
280510
|
-
});
|
|
280511
|
-
}
|
|
280512
|
-
return this.getLocalizedString(fullKey, options);
|
|
280513
|
-
}
|
|
280514
|
-
/** Gets the English translation.
|
|
280515
|
-
* @param namespace - the namespace that identifies the particular localization file that contains the property.
|
|
280516
|
-
* @param key - the key that matches a property in the JSON localization file.
|
|
280517
|
-
* @returns The string corresponding to the first key that resolves.
|
|
280518
|
-
* @throws Error if no keys resolve to a string.
|
|
280519
|
-
* @internal
|
|
280520
|
-
*/
|
|
280521
|
-
getEnglishString(namespace, key, options) {
|
|
280522
|
-
if ((options === null || options === void 0 ? void 0 : options.returnDetails) || (options === null || options === void 0 ? void 0 : options.returnObjects)) {
|
|
280523
|
-
throw new Error("Translation key must map to a string, but the given options will result in an object");
|
|
280524
|
-
}
|
|
280525
|
-
options = {
|
|
280526
|
-
...options,
|
|
280527
|
-
ns: namespace, // ensure namespace argument is used
|
|
280528
|
-
};
|
|
280529
|
-
const en = this.i18next.getFixedT("en", namespace);
|
|
280530
|
-
const str = en(key, options);
|
|
280531
|
-
if (typeof str !== "string")
|
|
280532
|
-
throw new Error("Translation key(s) not found");
|
|
280533
|
-
return str;
|
|
280534
|
-
}
|
|
280535
|
-
/** Get the promise for an already registered Namespace.
|
|
280536
|
-
* @param name - the name of the namespace
|
|
280537
|
-
* @public
|
|
280538
|
-
*/
|
|
280539
|
-
getNamespacePromise(name) {
|
|
280540
|
-
return this._namespaces.get(name);
|
|
280541
|
-
}
|
|
280542
|
-
/** @internal */
|
|
280543
|
-
getLanguageList() {
|
|
280544
|
-
return this.i18next.languages;
|
|
280545
|
-
}
|
|
280546
|
-
/** override the language detected in the browser */
|
|
280547
|
-
async changeLanguage(language) {
|
|
280548
|
-
return this.i18next.changeLanguage(language);
|
|
280549
|
-
}
|
|
280550
|
-
/** Register a new Namespace and return it. If the namespace is already registered, it will be returned.
|
|
280551
|
-
* @param name - the name of the namespace, which is the base name of the JSON file that contains the localization properties.
|
|
280552
|
-
* @note - The registerNamespace method starts fetching the appropriate version of the JSON localization file from the server,
|
|
280553
|
-
* based on the current locale. To make sure that fetch is complete before performing translations from this namespace, await
|
|
280554
|
-
* fulfillment of the readPromise Promise property of the returned LocalizationNamespace.
|
|
280555
|
-
* @see [Localization in iTwin.js]($docs/learning/frontend/Localization.md)
|
|
280556
|
-
* @public
|
|
280557
|
-
*/
|
|
280558
|
-
async registerNamespace(name) {
|
|
280559
|
-
const existing = this._namespaces.get(name);
|
|
280560
|
-
if (existing !== undefined)
|
|
280561
|
-
return existing;
|
|
280562
|
-
const theReadPromise = new Promise((resolve) => {
|
|
280563
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
280564
|
-
this.i18next.loadNamespaces(name, (err) => {
|
|
280565
|
-
if (!err)
|
|
280566
|
-
return resolve();
|
|
280567
|
-
// Here we got a non-null err object.
|
|
280568
|
-
// This method is called when the system has attempted to load the resources for the namespaces for each possible locale.
|
|
280569
|
-
// For example 'fr-ca' might be the most specific locale, in which case 'fr' and 'en' are fallback locales.
|
|
280570
|
-
// Using Backend from i18next-http-backend, err will be an array of strings of each namespace it tried to read and its locale.
|
|
280571
|
-
// There might be errs for some other namespaces as well as this one. We resolve the promise unless there's an error for each possible locale.
|
|
280572
|
-
let locales = this.getLanguageList().map((thisLocale) => `/${thisLocale}/`);
|
|
280573
|
-
try {
|
|
280574
|
-
for (const thisError of err) {
|
|
280575
|
-
if (typeof thisError === "string")
|
|
280576
|
-
locales = locales.filter((thisLocale) => !thisError.includes(thisLocale));
|
|
280577
|
-
}
|
|
280578
|
-
}
|
|
280579
|
-
catch (e) {
|
|
280580
|
-
locales = [];
|
|
280581
|
-
}
|
|
280582
|
-
// if we removed every locale from the array, it wasn't loaded.
|
|
280583
|
-
if (locales.length === 0)
|
|
280584
|
-
_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_3__.Logger.logError("i18n", `No resources for namespace ${name} could be loaded`);
|
|
280585
|
-
resolve();
|
|
280586
|
-
});
|
|
280587
|
-
});
|
|
280588
|
-
this._namespaces.set(name, theReadPromise);
|
|
280589
|
-
return theReadPromise;
|
|
280590
|
-
}
|
|
280591
|
-
/** @internal */
|
|
280592
|
-
unregisterNamespace(name) {
|
|
280593
|
-
this._namespaces.delete(name);
|
|
280594
|
-
}
|
|
280595
|
-
}
|
|
280596
|
-
class TranslationLogger {
|
|
280597
|
-
log(args) { _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_3__.Logger.logInfo("i18n", this.createLogMessage(args)); }
|
|
280598
|
-
warn(args) { _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_3__.Logger.logWarning("i18n", this.createLogMessage(args)); }
|
|
280599
|
-
error(args) { _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_3__.Logger.logError("i18n", this.createLogMessage(args)); }
|
|
280600
|
-
createLogMessage(args) {
|
|
280601
|
-
let message = args[0];
|
|
280602
|
-
for (let i = 1; i < args.length; ++i) {
|
|
280603
|
-
if (typeof args[i] === "string")
|
|
280604
|
-
message += `\n ${args[i]}`;
|
|
280605
|
-
}
|
|
280606
|
-
return message;
|
|
280607
|
-
}
|
|
280608
|
-
}
|
|
280609
|
-
TranslationLogger.type = "logger";
|
|
280478
|
+
/*---------------------------------------------------------------------------------------------
|
|
280479
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
280480
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
280481
|
+
*--------------------------------------------------------------------------------------------*/
|
|
280482
|
+
/** @packageDocumentation
|
|
280483
|
+
* @module Localization
|
|
280484
|
+
*/
|
|
280485
|
+
|
|
280486
|
+
|
|
280487
|
+
|
|
280488
|
+
|
|
280489
|
+
const DEFAULT_MAX_RETRIES = 1; // a low number prevents wasted time and potential timeouts when requesting localization files throws an error
|
|
280490
|
+
/** Supplies localizations for iTwin.js
|
|
280491
|
+
* @note this class uses the [i18next](https://www.i18next.com/) package.
|
|
280492
|
+
* @public
|
|
280493
|
+
*/
|
|
280494
|
+
class ITwinLocalization {
|
|
280495
|
+
constructor(options) {
|
|
280496
|
+
var _a, _b, _c;
|
|
280497
|
+
this._namespaces = new Map();
|
|
280498
|
+
this.i18next = i18next__WEBPACK_IMPORTED_MODULE_0__["default"].createInstance();
|
|
280499
|
+
this._backendOptions = {
|
|
280500
|
+
loadPath: (_a = options === null || options === void 0 ? void 0 : options.urlTemplate) !== null && _a !== void 0 ? _a : "locales/{{lng}}/{{ns}}.json",
|
|
280501
|
+
crossDomain: true,
|
|
280502
|
+
...options === null || options === void 0 ? void 0 : options.backendHttpOptions,
|
|
280503
|
+
};
|
|
280504
|
+
this._detectionOptions = {
|
|
280505
|
+
order: ["querystring", "navigator", "htmlTag"],
|
|
280506
|
+
lookupQuerystring: "lng",
|
|
280507
|
+
caches: [],
|
|
280508
|
+
...options === null || options === void 0 ? void 0 : options.detectorOptions,
|
|
280509
|
+
};
|
|
280510
|
+
this._initOptions = {
|
|
280511
|
+
interpolation: { escapeValue: true },
|
|
280512
|
+
fallbackLng: "en",
|
|
280513
|
+
maxRetries: DEFAULT_MAX_RETRIES,
|
|
280514
|
+
backend: this._backendOptions,
|
|
280515
|
+
detection: this._detectionOptions,
|
|
280516
|
+
...options === null || options === void 0 ? void 0 : options.initOptions,
|
|
280517
|
+
};
|
|
280518
|
+
this.i18next
|
|
280519
|
+
.use((_b = options === null || options === void 0 ? void 0 : options.detectorPlugin) !== null && _b !== void 0 ? _b : i18next_browser_languagedetector__WEBPACK_IMPORTED_MODULE_1__["default"])
|
|
280520
|
+
.use((_c = options === null || options === void 0 ? void 0 : options.backendPlugin) !== null && _c !== void 0 ? _c : i18next_http_backend__WEBPACK_IMPORTED_MODULE_2__["default"])
|
|
280521
|
+
.use(TranslationLogger);
|
|
280522
|
+
}
|
|
280523
|
+
async initialize(namespaces) {
|
|
280524
|
+
var _a;
|
|
280525
|
+
// Also consider namespaces passed into constructor
|
|
280526
|
+
const initNamespaces = [this._initOptions.ns || []].flat();
|
|
280527
|
+
const combinedNamespaces = new Set([...namespaces, ...initNamespaces]); // without duplicates
|
|
280528
|
+
const defaultNamespace = (_a = this._initOptions.defaultNS) !== null && _a !== void 0 ? _a : namespaces[0];
|
|
280529
|
+
if (defaultNamespace)
|
|
280530
|
+
combinedNamespaces.add(defaultNamespace); // Make sure default namespace is in namespaces list
|
|
280531
|
+
const initOptions = {
|
|
280532
|
+
...this._initOptions,
|
|
280533
|
+
defaultNS: defaultNamespace,
|
|
280534
|
+
ns: [...combinedNamespaces],
|
|
280535
|
+
};
|
|
280536
|
+
// if in a development environment, set debugging
|
|
280537
|
+
if (false)
|
|
280538
|
+
{}
|
|
280539
|
+
const initPromise = this.i18next.init(initOptions);
|
|
280540
|
+
for (const ns of namespaces)
|
|
280541
|
+
this._namespaces.set(ns, initPromise);
|
|
280542
|
+
return initPromise;
|
|
280543
|
+
}
|
|
280544
|
+
/** Replace all instances of `%{key}` within a string with the translations of those keys.
|
|
280545
|
+
* For example:
|
|
280546
|
+
* ``` ts
|
|
280547
|
+
* "MyKeys": {
|
|
280548
|
+
* "Key1": "First value",
|
|
280549
|
+
* "Key2": "Second value"
|
|
280550
|
+
* }
|
|
280551
|
+
* ```
|
|
280552
|
+
*
|
|
280553
|
+
* ``` ts
|
|
280554
|
+
* i18.translateKeys("string with %{MyKeys.Key1} followed by %{MyKeys.Key2}!"") // returns "string with First Value followed by Second Value!"
|
|
280555
|
+
* ```
|
|
280556
|
+
* @param line The input line, potentially containing %{keys}.
|
|
280557
|
+
* @returns The line with all %{keys} translated
|
|
280558
|
+
* @public
|
|
280559
|
+
*/
|
|
280560
|
+
getLocalizedKeys(line) {
|
|
280561
|
+
return line.replace(/\%\{(.+?)\}/g, (_match, tag) => this.getLocalizedString(tag));
|
|
280562
|
+
}
|
|
280563
|
+
/** Return the translated value of a key.
|
|
280564
|
+
* @param key - the key that matches a property in the JSON localization file.
|
|
280565
|
+
* @note The key includes the namespace, which identifies the particular localization file that contains the property,
|
|
280566
|
+
* followed by a colon, followed by the property in the JSON file.
|
|
280567
|
+
* For example:
|
|
280568
|
+
* ``` ts
|
|
280569
|
+
* const dataString: string = IModelApp.localization.getLocalizedString("iModelJs:BackgroundMap.BingDataAttribution");
|
|
280570
|
+
* ```
|
|
280571
|
+
* assigns to dataString the string with property BackgroundMap.BingDataAttribution from the iModelJs.json localization file.
|
|
280572
|
+
* @returns The string corresponding to the first key that resolves.
|
|
280573
|
+
* @throws Error if no keys resolve to a string.
|
|
280574
|
+
* @public
|
|
280575
|
+
*/
|
|
280576
|
+
getLocalizedString(key, options) {
|
|
280577
|
+
if ((options === null || options === void 0 ? void 0 : options.returnDetails) || (options === null || options === void 0 ? void 0 : options.returnObjects)) {
|
|
280578
|
+
throw new Error("Translation key must map to a string, but the given options will result in an object");
|
|
280579
|
+
}
|
|
280580
|
+
const value = this.i18next.t(key, options);
|
|
280581
|
+
if (typeof value !== "string") {
|
|
280582
|
+
throw new Error("Translation key(s) string not found");
|
|
280583
|
+
}
|
|
280584
|
+
return value;
|
|
280585
|
+
}
|
|
280586
|
+
/** Similar to `getLocalizedString` but the default namespace is a separate parameter and the key does not need
|
|
280587
|
+
* to include a namespace. If a key includes a namespace, that namespace will be used for interpolating that key.
|
|
280588
|
+
* @param namespace - the namespace that identifies the particular localization file that contains the property.
|
|
280589
|
+
* @param key - the key that matches a property in the JSON localization file.
|
|
280590
|
+
* @returns The string corresponding to the first key that resolves.
|
|
280591
|
+
* @throws Error if no keys resolve to a string.
|
|
280592
|
+
* @internal
|
|
280593
|
+
*/
|
|
280594
|
+
getLocalizedStringWithNamespace(namespace, key, options) {
|
|
280595
|
+
let fullKey = "";
|
|
280596
|
+
if (typeof key === "string") {
|
|
280597
|
+
fullKey = `${namespace}:${key}`;
|
|
280598
|
+
}
|
|
280599
|
+
else {
|
|
280600
|
+
fullKey = key.map((subKey) => {
|
|
280601
|
+
return `${namespace}:${subKey}`;
|
|
280602
|
+
});
|
|
280603
|
+
}
|
|
280604
|
+
return this.getLocalizedString(fullKey, options);
|
|
280605
|
+
}
|
|
280606
|
+
/** Gets the English translation.
|
|
280607
|
+
* @param namespace - the namespace that identifies the particular localization file that contains the property.
|
|
280608
|
+
* @param key - the key that matches a property in the JSON localization file.
|
|
280609
|
+
* @returns The string corresponding to the first key that resolves.
|
|
280610
|
+
* @throws Error if no keys resolve to a string.
|
|
280611
|
+
* @internal
|
|
280612
|
+
*/
|
|
280613
|
+
getEnglishString(namespace, key, options) {
|
|
280614
|
+
if ((options === null || options === void 0 ? void 0 : options.returnDetails) || (options === null || options === void 0 ? void 0 : options.returnObjects)) {
|
|
280615
|
+
throw new Error("Translation key must map to a string, but the given options will result in an object");
|
|
280616
|
+
}
|
|
280617
|
+
options = {
|
|
280618
|
+
...options,
|
|
280619
|
+
ns: namespace, // ensure namespace argument is used
|
|
280620
|
+
};
|
|
280621
|
+
const en = this.i18next.getFixedT("en", namespace);
|
|
280622
|
+
const str = en(key, options);
|
|
280623
|
+
if (typeof str !== "string")
|
|
280624
|
+
throw new Error("Translation key(s) not found");
|
|
280625
|
+
return str;
|
|
280626
|
+
}
|
|
280627
|
+
/** Get the promise for an already registered Namespace.
|
|
280628
|
+
* @param name - the name of the namespace
|
|
280629
|
+
* @public
|
|
280630
|
+
*/
|
|
280631
|
+
getNamespacePromise(name) {
|
|
280632
|
+
return this._namespaces.get(name);
|
|
280633
|
+
}
|
|
280634
|
+
/** @internal */
|
|
280635
|
+
getLanguageList() {
|
|
280636
|
+
return this.i18next.languages;
|
|
280637
|
+
}
|
|
280638
|
+
/** override the language detected in the browser */
|
|
280639
|
+
async changeLanguage(language) {
|
|
280640
|
+
return this.i18next.changeLanguage(language);
|
|
280641
|
+
}
|
|
280642
|
+
/** Register a new Namespace and return it. If the namespace is already registered, it will be returned.
|
|
280643
|
+
* @param name - the name of the namespace, which is the base name of the JSON file that contains the localization properties.
|
|
280644
|
+
* @note - The registerNamespace method starts fetching the appropriate version of the JSON localization file from the server,
|
|
280645
|
+
* based on the current locale. To make sure that fetch is complete before performing translations from this namespace, await
|
|
280646
|
+
* fulfillment of the readPromise Promise property of the returned LocalizationNamespace.
|
|
280647
|
+
* @see [Localization in iTwin.js]($docs/learning/frontend/Localization.md)
|
|
280648
|
+
* @public
|
|
280649
|
+
*/
|
|
280650
|
+
async registerNamespace(name) {
|
|
280651
|
+
const existing = this._namespaces.get(name);
|
|
280652
|
+
if (existing !== undefined)
|
|
280653
|
+
return existing;
|
|
280654
|
+
const theReadPromise = new Promise((resolve) => {
|
|
280655
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
280656
|
+
this.i18next.loadNamespaces(name, (err) => {
|
|
280657
|
+
if (!err)
|
|
280658
|
+
return resolve();
|
|
280659
|
+
// Here we got a non-null err object.
|
|
280660
|
+
// This method is called when the system has attempted to load the resources for the namespaces for each possible locale.
|
|
280661
|
+
// For example 'fr-ca' might be the most specific locale, in which case 'fr' and 'en' are fallback locales.
|
|
280662
|
+
// Using Backend from i18next-http-backend, err will be an array of strings of each namespace it tried to read and its locale.
|
|
280663
|
+
// There might be errs for some other namespaces as well as this one. We resolve the promise unless there's an error for each possible locale.
|
|
280664
|
+
let locales = this.getLanguageList().map((thisLocale) => `/${thisLocale}/`);
|
|
280665
|
+
try {
|
|
280666
|
+
for (const thisError of err) {
|
|
280667
|
+
if (typeof thisError === "string")
|
|
280668
|
+
locales = locales.filter((thisLocale) => !thisError.includes(thisLocale));
|
|
280669
|
+
}
|
|
280670
|
+
}
|
|
280671
|
+
catch (e) {
|
|
280672
|
+
locales = [];
|
|
280673
|
+
}
|
|
280674
|
+
// if we removed every locale from the array, it wasn't loaded.
|
|
280675
|
+
if (locales.length === 0)
|
|
280676
|
+
_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_3__.Logger.logError("i18n", `No resources for namespace ${name} could be loaded`);
|
|
280677
|
+
resolve();
|
|
280678
|
+
});
|
|
280679
|
+
});
|
|
280680
|
+
this._namespaces.set(name, theReadPromise);
|
|
280681
|
+
return theReadPromise;
|
|
280682
|
+
}
|
|
280683
|
+
/** @internal */
|
|
280684
|
+
unregisterNamespace(name) {
|
|
280685
|
+
this._namespaces.delete(name);
|
|
280686
|
+
}
|
|
280687
|
+
}
|
|
280688
|
+
class TranslationLogger {
|
|
280689
|
+
log(args) { _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_3__.Logger.logInfo("i18n", this.createLogMessage(args)); }
|
|
280690
|
+
warn(args) { _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_3__.Logger.logWarning("i18n", this.createLogMessage(args)); }
|
|
280691
|
+
error(args) { _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_3__.Logger.logError("i18n", this.createLogMessage(args)); }
|
|
280692
|
+
createLogMessage(args) {
|
|
280693
|
+
let message = args[0];
|
|
280694
|
+
for (let i = 1; i < args.length; ++i) {
|
|
280695
|
+
if (typeof args[i] === "string")
|
|
280696
|
+
message += `\n ${args[i]}`;
|
|
280697
|
+
}
|
|
280698
|
+
return message;
|
|
280699
|
+
}
|
|
280700
|
+
}
|
|
280701
|
+
TranslationLogger.type = "logger";
|
|
280610
280702
|
|
|
280611
280703
|
|
|
280612
280704
|
/***/ }),
|
|
@@ -280623,17 +280715,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
280623
280715
|
/* harmony export */ "ITwinLocalization": () => (/* reexport safe */ _ITwinLocalization__WEBPACK_IMPORTED_MODULE_0__.ITwinLocalization)
|
|
280624
280716
|
/* harmony export */ });
|
|
280625
280717
|
/* harmony import */ var _ITwinLocalization__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ITwinLocalization */ "../../core/i18n/lib/esm/ITwinLocalization.js");
|
|
280626
|
-
/*---------------------------------------------------------------------------------------------
|
|
280627
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
280628
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
280629
|
-
*--------------------------------------------------------------------------------------------*/
|
|
280630
|
-
|
|
280631
|
-
/** @docs-package-description
|
|
280632
|
-
* The core-i18n package contains classes related to internationalization and localization.
|
|
280633
|
-
*/
|
|
280634
|
-
/** @docs-group-description Localization
|
|
280635
|
-
* Classes for internationalization and localization of your app.
|
|
280636
|
-
*/
|
|
280718
|
+
/*---------------------------------------------------------------------------------------------
|
|
280719
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
280720
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
280721
|
+
*--------------------------------------------------------------------------------------------*/
|
|
280722
|
+
|
|
280723
|
+
/** @docs-package-description
|
|
280724
|
+
* The core-i18n package contains classes related to internationalization and localization.
|
|
280725
|
+
*/
|
|
280726
|
+
/** @docs-group-description Localization
|
|
280727
|
+
* Classes for internationalization and localization of your app.
|
|
280728
|
+
*/
|
|
280637
280729
|
|
|
280638
280730
|
|
|
280639
280731
|
/***/ }),
|
|
@@ -299872,83 +299964,83 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
299872
299964
|
/* harmony export */ });
|
|
299873
299965
|
/* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
299874
299966
|
/* harmony import */ var _TelemetryClientLoggerCategory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TelemetryClientLoggerCategory */ "../../core/telemetry/lib/esm/TelemetryClientLoggerCategory.js");
|
|
299875
|
-
/*---------------------------------------------------------------------------------------------
|
|
299876
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
299877
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
299878
|
-
*--------------------------------------------------------------------------------------------*/
|
|
299879
|
-
/** @packageDocumentation
|
|
299880
|
-
* @module Telemetry
|
|
299881
|
-
*/
|
|
299882
|
-
|
|
299883
|
-
|
|
299884
|
-
/**
|
|
299885
|
-
* @alpha
|
|
299886
|
-
* Represents a particular occurrence of an event that can be tracked through various telemetry services
|
|
299887
|
-
*/
|
|
299888
|
-
class TelemetryEvent {
|
|
299889
|
-
constructor(
|
|
299890
|
-
/** Human-readable name for the event being tracked */
|
|
299891
|
-
eventName,
|
|
299892
|
-
/**
|
|
299893
|
-
* Optional Guid that can be used to more accurately identify the telemetry event.
|
|
299894
|
-
* This field is required when posting a telemetry event as feature usage to ULAS.
|
|
299895
|
-
*/
|
|
299896
|
-
eventId,
|
|
299897
|
-
/** iModel parent iTwin id */
|
|
299898
|
-
iTwinId, iModelId, changeSetId, time,
|
|
299899
|
-
/** Custom properties */
|
|
299900
|
-
additionalProperties = {}) {
|
|
299901
|
-
this.eventName = eventName;
|
|
299902
|
-
this.eventId = eventId;
|
|
299903
|
-
this.iTwinId = iTwinId;
|
|
299904
|
-
this.iModelId = iModelId;
|
|
299905
|
-
this.changeSetId = changeSetId;
|
|
299906
|
-
this.time = time;
|
|
299907
|
-
this.additionalProperties = additionalProperties;
|
|
299908
|
-
}
|
|
299909
|
-
/**
|
|
299910
|
-
* Returns all properties as a new object
|
|
299911
|
-
*/
|
|
299912
|
-
getProperties() {
|
|
299913
|
-
const properties = {
|
|
299914
|
-
eventName: this.eventName,
|
|
299915
|
-
eventId: this.eventId,
|
|
299916
|
-
iTwinId: this.iTwinId,
|
|
299917
|
-
iModelId: this.iModelId,
|
|
299918
|
-
changeSetId: this.changeSetId,
|
|
299919
|
-
time: this.time,
|
|
299920
|
-
additionalProperties: this.additionalProperties,
|
|
299921
|
-
};
|
|
299922
|
-
return properties;
|
|
299923
|
-
}
|
|
299924
|
-
}
|
|
299925
|
-
/** @alpha */
|
|
299926
|
-
class TelemetryManager {
|
|
299927
|
-
constructor(...clients) {
|
|
299928
|
-
this._clients = new Set(clients);
|
|
299929
|
-
}
|
|
299930
|
-
async postTelemetry(requestContext, telemetryEvent) {
|
|
299931
|
-
const postPerClient = async (subClient) => {
|
|
299932
|
-
try {
|
|
299933
|
-
await subClient.postTelemetry(requestContext, telemetryEvent);
|
|
299934
|
-
}
|
|
299935
|
-
catch (err) {
|
|
299936
|
-
_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Logger.logError(_TelemetryClientLoggerCategory__WEBPACK_IMPORTED_MODULE_1__.TelemetryClientLoggerCategory.Telemetry, `Failed to post telemetry via subclient`, () => _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.BentleyError.getErrorProps(err));
|
|
299937
|
-
}
|
|
299938
|
-
};
|
|
299939
|
-
const subClientPromises = [];
|
|
299940
|
-
for (const subClient of this._clients) {
|
|
299941
|
-
subClientPromises.push(postPerClient(subClient));
|
|
299942
|
-
}
|
|
299943
|
-
await Promise.all(subClientPromises);
|
|
299944
|
-
}
|
|
299945
|
-
addClient(client) {
|
|
299946
|
-
this._clients.add(client);
|
|
299947
|
-
}
|
|
299948
|
-
hasClient(client) {
|
|
299949
|
-
return this._clients.has(client);
|
|
299950
|
-
}
|
|
299951
|
-
}
|
|
299967
|
+
/*---------------------------------------------------------------------------------------------
|
|
299968
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
299969
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
299970
|
+
*--------------------------------------------------------------------------------------------*/
|
|
299971
|
+
/** @packageDocumentation
|
|
299972
|
+
* @module Telemetry
|
|
299973
|
+
*/
|
|
299974
|
+
|
|
299975
|
+
|
|
299976
|
+
/**
|
|
299977
|
+
* @alpha
|
|
299978
|
+
* Represents a particular occurrence of an event that can be tracked through various telemetry services
|
|
299979
|
+
*/
|
|
299980
|
+
class TelemetryEvent {
|
|
299981
|
+
constructor(
|
|
299982
|
+
/** Human-readable name for the event being tracked */
|
|
299983
|
+
eventName,
|
|
299984
|
+
/**
|
|
299985
|
+
* Optional Guid that can be used to more accurately identify the telemetry event.
|
|
299986
|
+
* This field is required when posting a telemetry event as feature usage to ULAS.
|
|
299987
|
+
*/
|
|
299988
|
+
eventId,
|
|
299989
|
+
/** iModel parent iTwin id */
|
|
299990
|
+
iTwinId, iModelId, changeSetId, time,
|
|
299991
|
+
/** Custom properties */
|
|
299992
|
+
additionalProperties = {}) {
|
|
299993
|
+
this.eventName = eventName;
|
|
299994
|
+
this.eventId = eventId;
|
|
299995
|
+
this.iTwinId = iTwinId;
|
|
299996
|
+
this.iModelId = iModelId;
|
|
299997
|
+
this.changeSetId = changeSetId;
|
|
299998
|
+
this.time = time;
|
|
299999
|
+
this.additionalProperties = additionalProperties;
|
|
300000
|
+
}
|
|
300001
|
+
/**
|
|
300002
|
+
* Returns all properties as a new object
|
|
300003
|
+
*/
|
|
300004
|
+
getProperties() {
|
|
300005
|
+
const properties = {
|
|
300006
|
+
eventName: this.eventName,
|
|
300007
|
+
eventId: this.eventId,
|
|
300008
|
+
iTwinId: this.iTwinId,
|
|
300009
|
+
iModelId: this.iModelId,
|
|
300010
|
+
changeSetId: this.changeSetId,
|
|
300011
|
+
time: this.time,
|
|
300012
|
+
additionalProperties: this.additionalProperties,
|
|
300013
|
+
};
|
|
300014
|
+
return properties;
|
|
300015
|
+
}
|
|
300016
|
+
}
|
|
300017
|
+
/** @alpha */
|
|
300018
|
+
class TelemetryManager {
|
|
300019
|
+
constructor(...clients) {
|
|
300020
|
+
this._clients = new Set(clients);
|
|
300021
|
+
}
|
|
300022
|
+
async postTelemetry(requestContext, telemetryEvent) {
|
|
300023
|
+
const postPerClient = async (subClient) => {
|
|
300024
|
+
try {
|
|
300025
|
+
await subClient.postTelemetry(requestContext, telemetryEvent);
|
|
300026
|
+
}
|
|
300027
|
+
catch (err) {
|
|
300028
|
+
_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Logger.logError(_TelemetryClientLoggerCategory__WEBPACK_IMPORTED_MODULE_1__.TelemetryClientLoggerCategory.Telemetry, `Failed to post telemetry via subclient`, () => _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.BentleyError.getErrorProps(err));
|
|
300029
|
+
}
|
|
300030
|
+
};
|
|
300031
|
+
const subClientPromises = [];
|
|
300032
|
+
for (const subClient of this._clients) {
|
|
300033
|
+
subClientPromises.push(postPerClient(subClient));
|
|
300034
|
+
}
|
|
300035
|
+
await Promise.all(subClientPromises);
|
|
300036
|
+
}
|
|
300037
|
+
addClient(client) {
|
|
300038
|
+
this._clients.add(client);
|
|
300039
|
+
}
|
|
300040
|
+
hasClient(client) {
|
|
300041
|
+
return this._clients.has(client);
|
|
300042
|
+
}
|
|
300043
|
+
}
|
|
299952
300044
|
|
|
299953
300045
|
|
|
299954
300046
|
/***/ }),
|
|
@@ -299964,23 +300056,23 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
299964
300056
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
299965
300057
|
/* harmony export */ "TelemetryClientLoggerCategory": () => (/* binding */ TelemetryClientLoggerCategory)
|
|
299966
300058
|
/* harmony export */ });
|
|
299967
|
-
/*---------------------------------------------------------------------------------------------
|
|
299968
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
299969
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
299970
|
-
*--------------------------------------------------------------------------------------------*/
|
|
299971
|
-
/** @packageDocumentation
|
|
299972
|
-
* @module Logging
|
|
299973
|
-
*/
|
|
299974
|
-
/** Logger categories used by this package
|
|
299975
|
-
* @note All logger categories in this package start with the `telemetry-client` prefix.
|
|
299976
|
-
* @see [Logger]($bentley)
|
|
299977
|
-
* @alpha
|
|
299978
|
-
*/
|
|
299979
|
-
var TelemetryClientLoggerCategory;
|
|
299980
|
-
(function (TelemetryClientLoggerCategory) {
|
|
299981
|
-
/** The logger category used for Telemetry */
|
|
299982
|
-
TelemetryClientLoggerCategory["Telemetry"] = "telemetry-client.Telemetry";
|
|
299983
|
-
})(TelemetryClientLoggerCategory || (TelemetryClientLoggerCategory = {}));
|
|
300059
|
+
/*---------------------------------------------------------------------------------------------
|
|
300060
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
300061
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
300062
|
+
*--------------------------------------------------------------------------------------------*/
|
|
300063
|
+
/** @packageDocumentation
|
|
300064
|
+
* @module Logging
|
|
300065
|
+
*/
|
|
300066
|
+
/** Logger categories used by this package
|
|
300067
|
+
* @note All logger categories in this package start with the `telemetry-client` prefix.
|
|
300068
|
+
* @see [Logger]($bentley)
|
|
300069
|
+
* @alpha
|
|
300070
|
+
*/
|
|
300071
|
+
var TelemetryClientLoggerCategory;
|
|
300072
|
+
(function (TelemetryClientLoggerCategory) {
|
|
300073
|
+
/** The logger category used for Telemetry */
|
|
300074
|
+
TelemetryClientLoggerCategory["Telemetry"] = "telemetry-client.Telemetry";
|
|
300075
|
+
})(TelemetryClientLoggerCategory || (TelemetryClientLoggerCategory = {}));
|
|
299984
300076
|
|
|
299985
300077
|
|
|
299986
300078
|
/***/ }),
|
|
@@ -300000,12 +300092,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
300000
300092
|
/* harmony export */ });
|
|
300001
300093
|
/* harmony import */ var _TelemetryClient__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TelemetryClient */ "../../core/telemetry/lib/esm/TelemetryClient.js");
|
|
300002
300094
|
/* harmony import */ var _TelemetryClientLoggerCategory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TelemetryClientLoggerCategory */ "../../core/telemetry/lib/esm/TelemetryClientLoggerCategory.js");
|
|
300003
|
-
/*---------------------------------------------------------------------------------------------
|
|
300004
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
300005
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
300006
|
-
*--------------------------------------------------------------------------------------------*/
|
|
300007
|
-
|
|
300008
|
-
|
|
300095
|
+
/*---------------------------------------------------------------------------------------------
|
|
300096
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
300097
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
300098
|
+
*--------------------------------------------------------------------------------------------*/
|
|
300099
|
+
|
|
300100
|
+
|
|
300009
300101
|
|
|
300010
300102
|
|
|
300011
300103
|
/***/ }),
|
|
@@ -311251,7 +311343,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
|
|
|
311251
311343
|
/***/ ((module) => {
|
|
311252
311344
|
|
|
311253
311345
|
"use strict";
|
|
311254
|
-
module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"3.5.
|
|
311346
|
+
module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"3.5.2","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs","build:ci":"npm run -s build && npm run -s build:esm","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2020 --outDir lib/esm","clean":"rimraf lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","docs":"betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/primitives,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-eslintrc -c \\"../../tools/eslint-plugin/dist/configs/extension-exports-config.js\\" \\"./src/**/*.ts\\" 1>&2","lint":"eslint -f visualstudio \\"./src/**/*.ts\\" 1>&2","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run -s webpackTests && certa -r chrome","cover":"npm -s test","test:debug":"certa -r chrome --debug","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core/tree/master/core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:^3.5.2","@itwin/core-bentley":"workspace:^3.5.2","@itwin/core-common":"workspace:^3.5.2","@itwin/core-geometry":"workspace:^3.5.2","@itwin/core-orbitgt":"workspace:^3.5.2","@itwin/core-quantity":"workspace:^3.5.2","@itwin/webgl-compatibility":"workspace:^3.5.2"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/certa":"workspace:*","@itwin/eslint-plugin":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@types/chai":"4.3.1","@types/chai-as-promised":"^7","@types/deep-assign":"^0.1.0","@types/lodash":"^4.14.0","@types/mocha":"^8.2.2","@types/node":"18.11.5","@types/qs":"^6.5.0","@types/semver":"7.3.10","@types/superagent":"^4.1.14","@types/sinon":"^9.0.0","babel-loader":"~8.2.5","babel-plugin-istanbul":"~6.1.1","chai":"^4.1.2","chai-as-promised":"^7","cpx2":"^3.0.0","eslint":"^7.11.0","glob":"^7.1.2","mocha":"^10.0.0","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^9.0.2","source-map-loader":"^4.0.0","typescript":"~4.4.0","webpack":"^5.64.4"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/object-storage-azure":"~1.4.0","@itwin/cloud-agnostic-core":"~1.4.0","@itwin/object-storage-core":"~1.4.0","@itwin/core-i18n":"workspace:*","@itwin/core-telemetry":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","deep-assign":"^2.0.0","fuse.js":"^3.3.0","lodash":"^4.17.10","qs":"^6.5.3","semver":"^7.3.5","superagent":"^7.1.5","wms-capabilities":"0.4.0","xml-js":"~1.6.11","reflect-metadata":"0.1.13"},"nyc":{"extends":"./node_modules/@itwin/build-tools/.nycrc"},"eslintConfig":{"plugins":["@itwin"],"extends":"plugin:@itwin/itwinjs-recommended","rules":{"@itwin/no-internal-barrel-imports":["error",{"required-barrel-modules":["./src/tile/internal.ts"]}],"@itwin/public-extension-exports":["error",{"releaseTags":["public","preview"],"outputApiFile":false}]},"overrides":[{"files":["*.test.ts","*.test.tsx","**/test/**/*.ts"],"rules":{"@itwin/no-internal-barrel-imports":"off"}}]}}');
|
|
311255
311347
|
|
|
311256
311348
|
/***/ })
|
|
311257
311349
|
|