@itwin/ecschema-rpcinterface-tests 5.2.0-dev.34 → 5.2.0-dev.36

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.
@@ -43505,17 +43505,17 @@ class TextBlockComponent {
43505
43505
  _styleOverrides;
43506
43506
  /** @internal */
43507
43507
  constructor(props) {
43508
- this._styleOverrides = _TextStyle__WEBPACK_IMPORTED_MODULE_0__.TextStyleSettings.cloneProps(props?.styleOverrides ?? {});
43508
+ this._styleOverrides = structuredClone(props?.styleOverrides ?? {});
43509
43509
  }
43510
43510
  /** Deviations in individual properties of the [[TextStyleSettings]] in the [AnnotationTextStyle]($backend).
43511
- * For example, if the style uses the "Arial" font, you can override that by settings `styleOverrides.fontName` to "Comic Sans".
43511
+ * For example, if the style uses the "Arial" font, you can override that by settings `styleOverrides.font.name` to "Comic Sans".
43512
43512
  * @see [[clearStyleOverrides]] to reset this to an empty object.
43513
43513
  */
43514
43514
  get styleOverrides() {
43515
43515
  return this._styleOverrides;
43516
43516
  }
43517
43517
  set styleOverrides(overrides) {
43518
- this._styleOverrides = _TextStyle__WEBPACK_IMPORTED_MODULE_0__.TextStyleSettings.cloneProps(overrides);
43518
+ this._styleOverrides = structuredClone(overrides);
43519
43519
  }
43520
43520
  /** Reset any [[styleOverrides]] applied to this component. */
43521
43521
  clearStyleOverrides(_options) {
@@ -43536,23 +43536,14 @@ class TextBlockComponent {
43536
43536
  /** Convert this component to its JSON representation. */
43537
43537
  toJSON() {
43538
43538
  return {
43539
- styleOverrides: _TextStyle__WEBPACK_IMPORTED_MODULE_0__.TextStyleSettings.cloneProps(this.styleOverrides),
43539
+ styleOverrides: structuredClone(this.styleOverrides),
43540
43540
  };
43541
43541
  }
43542
43542
  /** Returns true if `this` is equivalent to `other`. */
43543
43543
  equals(other) {
43544
- const myKeys = Object.keys(this.styleOverrides);
43545
- const yrKeys = Object.keys(other._styleOverrides);
43546
- if (myKeys.length !== yrKeys.length) {
43547
- return false;
43548
- }
43549
- for (const name of myKeys) {
43550
- const key = name;
43551
- if (this.styleOverrides[key] !== other.styleOverrides[key]) {
43552
- return false;
43553
- }
43554
- }
43555
- return true;
43544
+ const mySettings = _TextStyle__WEBPACK_IMPORTED_MODULE_0__.TextStyleSettings.fromJSON(this.styleOverrides);
43545
+ const otherSettings = _TextStyle__WEBPACK_IMPORTED_MODULE_0__.TextStyleSettings.fromJSON(other.styleOverrides);
43546
+ return mySettings.equals(otherSettings);
43556
43547
  }
43557
43548
  }
43558
43549
  /** A sequence of characters within a [[Paragraph]] that share a single style. Runs are the leaf nodes of a [[TextBlock]] document. When laid out for display, a single run may span
@@ -43920,7 +43911,6 @@ class List extends TextBlockComponent {
43920
43911
  return (other instanceof List) && super.equals(other);
43921
43912
  }
43922
43913
  }
43923
- ;
43924
43914
  /** Represents a formatted text document consisting of a series of [[Paragraph]]s, each laid out on a separate line and containing their own content.
43925
43915
  * No word-wrapping is applied to the document unless a [[width]] greater than zero is specified.
43926
43916
  * @see [[TextAnnotation]] to position a text block as an annotation in 2d or 3d space.
@@ -43933,21 +43923,9 @@ class TextBlock extends TextBlockComponent {
43933
43923
  * Default: 0
43934
43924
  */
43935
43925
  width;
43936
- /** The alignment of the document's content. */
43937
- justification;
43938
- /** The margins of the document. */
43939
- margins;
43940
43926
  constructor(props) {
43941
43927
  super(props);
43942
43928
  this.width = props.width ?? 0;
43943
- this.justification = props.justification ?? "left";
43944
- // Assign default margins if not provided
43945
- this.margins = {
43946
- left: props.margins?.left ?? 0,
43947
- right: props.margins?.right ?? 0,
43948
- top: props.margins?.top ?? 0,
43949
- bottom: props.margins?.bottom ?? 0,
43950
- };
43951
43929
  this.children = props?.children?.map((para) => Paragraph.create(para)) ?? [];
43952
43930
  }
43953
43931
  clearStyleOverrides(options) {
@@ -43957,8 +43935,6 @@ class TextBlock extends TextBlockComponent {
43957
43935
  return {
43958
43936
  ...super.toJSON(),
43959
43937
  width: this.width,
43960
- justification: this.justification,
43961
- margins: this.margins,
43962
43938
  children: this.children.map((x) => x.toJSON()),
43963
43939
  };
43964
43940
  }
@@ -44003,12 +43979,9 @@ class TextBlock extends TextBlockComponent {
44003
43979
  if (!super.equals(other)) {
44004
43980
  return false;
44005
43981
  }
44006
- if (this.width !== other.width || this.justification !== other.justification) {
43982
+ if (this.width !== other.width) {
44007
43983
  return false;
44008
43984
  }
44009
- const marginsAreEqual = Object.entries(this.margins).every(([key, value]) => value === other.margins[key]);
44010
- if (!marginsAreEqual)
44011
- return false;
44012
43985
  if (this.children && other.children) {
44013
43986
  if (this.children.length !== other.children.length) {
44014
43987
  return false;
@@ -44173,6 +44146,7 @@ __webpack_require__.r(__webpack_exports__);
44173
44146
  /* harmony export */ textAnnotationFrameShapes: () => (/* binding */ textAnnotationFrameShapes)
44174
44147
  /* harmony export */ });
44175
44148
  /* harmony import */ var _ColorDef__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ColorDef */ "../../core/common/lib/esm/ColorDef.js");
44149
+ /* harmony import */ var _Fonts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Fonts */ "../../core/common/lib/esm/Fonts.js");
44176
44150
  /*---------------------------------------------------------------------------------------------
44177
44151
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
44178
44152
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -44181,6 +44155,7 @@ __webpack_require__.r(__webpack_exports__);
44181
44155
  * @module Annotation
44182
44156
  */
44183
44157
 
44158
+
44184
44159
  /** Predefined markers for list items in text annotations.
44185
44160
  * These values control the appearance of list item markers (e.g., bullet, circle, square, dash, number) that denote the start of a list item in a list.
44186
44161
  * @beta
@@ -44202,6 +44177,7 @@ var ListMarkerEnumerator;
44202
44177
  */
44203
44178
  const textAnnotationFrameShapes = ["none", "line", "rectangle", "circle", "equilateralTriangle", "diamond", "square", "pentagon", "hexagon", "octagon", "capsule", "roundedRectangle"];
44204
44179
  ;
44180
+ ;
44205
44181
  function deepFreeze(obj) {
44206
44182
  if (obj === null || typeof obj !== "object" || Object.isFrozen(obj))
44207
44183
  return;
@@ -44222,20 +44198,20 @@ function deepFreeze(obj) {
44222
44198
  class TextStyleSettings {
44223
44199
  /** The color of the text. */
44224
44200
  color;
44225
- /** The name of a font stored in an iModel, used to draw the contents of a [[TextRun]].
44201
+ /** The font stored in an iModel, used to draw the contents of a [[TextRun]].
44226
44202
  */
44227
- fontName;
44228
- /** The height each line of text, in meters. Many other settings use the line height as the basis for computing their own values.
44229
- * For example, the height and offset from baseline of a subscript [[TextRun]] are computed as lineHeight * [[subScriptScale]] and
44230
- * lineHeight * [[subScriptOffsetFactor]], respectively.
44203
+ font;
44204
+ /** The height of the text, in meters. Many other settings use the text height as the basis for computing their own values.
44205
+ * For example, the height and offset from baseline of a subscript [[TextRun]] are computed as textHeight * [[subScriptScale]] and
44206
+ * textHeight * [[subScriptOffsetFactor]], respectively.
44231
44207
  */
44232
- lineHeight;
44208
+ textHeight;
44233
44209
  /** Multiplier used to compute the vertical distance between two lines of text.
44234
- * The distance is computed in meters as lineSpacingFactor * [[lineHeight]].
44210
+ * The distance is computed in meters as lineSpacingFactor * [[textHeight]] of the [[TextBlock]].
44235
44211
  */
44236
44212
  lineSpacingFactor;
44237
44213
  /** Multiplier used to compute the vertical distance between two paragraphs of text.
44238
- * The distance is computed in meters as paragraphSpacingFactor * [[lineHeight]].
44214
+ * The distance is computed in meters as paragraphSpacingFactor * the [[TextBlock]]'s [[textHeight]].
44239
44215
  */
44240
44216
  paragraphSpacingFactor;
44241
44217
  /** Specifies whether the content of a [[TextRun]] should be rendered **bold**. */
@@ -44245,28 +44221,28 @@ class TextStyleSettings {
44245
44221
  /** Specifies whether the content of a [[TextRun]] should be underlined. */
44246
44222
  isUnderlined;
44247
44223
  /** Multiplier used to compute the height of both the numerator and denominator of a [[FractionRun]].
44248
- * The height is computed in meters as stackedFractionScale * [[lineHeight]].
44224
+ * The height is computed in meters as stackedFractionScale * [[textHeight]].
44249
44225
  */
44250
44226
  stackedFractionScale;
44251
44227
  /** Specifies how to separate the numerator and denominator of a [[FractionRun]]. */
44252
44228
  stackedFractionType;
44253
44229
  /** Multiplier used to compute the vertical offset from the baseline for a subscript [[TextRun]].
44254
- * The offset is computed in meters as subScriptOffsetFactor * [[lineHeight]].
44230
+ * The offset is computed in meters as subScriptOffsetFactor * [[textHeight]].
44255
44231
  */
44256
44232
  subScriptOffsetFactor;
44257
44233
  /** Multiplier used to compute the height of a subscript [[TextRun]].
44258
- * The height is computed as subScriptScale * [[lineHeight]].
44234
+ * The height is computed as subScriptScale * [[textHeight]].
44259
44235
  */
44260
44236
  subScriptScale;
44261
44237
  /** Multiplier used to compute the vertical offset from the baseline for a super [[TextRun]].
44262
- * The offset is computed in meters as superScriptOffsetFactor * [[lineHeight]].
44238
+ * The offset is computed in meters as superScriptOffsetFactor * [[textHeight]].
44263
44239
  */
44264
44240
  superScriptOffsetFactor;
44265
44241
  /** Multiplier used to compute the height of a superscript [[TextRun]].
44266
- * The height is computed as superScriptScale * [[lineHeight]].
44242
+ * The height is computed as superScriptScale * [[textHeight]].
44267
44243
  */
44268
44244
  superScriptScale;
44269
- /** Multiplier used to compute the width of each glyph, relative to [[lineHeight]]. */
44245
+ /** Multiplier used to compute the width of each glyph, relative to [[textHeight]]. */
44270
44246
  widthFactor;
44271
44247
  /** Properties describing appearance of leaders in a [[TextAnnotation]].
44272
44248
  * Used when producing geometry for [[TextAnnotation]].
@@ -44291,11 +44267,15 @@ class TextStyleSettings {
44291
44267
  listMarker;
44292
44268
  /** The frame settings of the [[TextAnnotation]]. */
44293
44269
  frame;
44294
- /** A fully-populated JSON representation of the default settings. A real `fontName` must be provided before use. */
44270
+ /** The margins to surround the document content. */
44271
+ margins;
44272
+ /** The alignment of the text content. */
44273
+ justification;
44274
+ /** A fully-populated JSON representation of the default settings. A real `font` must be provided before use. */
44295
44275
  static defaultProps = {
44296
44276
  color: "subcategory",
44297
- fontName: "",
44298
- lineHeight: 1,
44277
+ font: { name: "", type: _Fonts__WEBPACK_IMPORTED_MODULE_1__.FontType.TrueType },
44278
+ textHeight: 1,
44299
44279
  lineSpacingFactor: 0.5,
44300
44280
  paragraphSpacingFactor: 0.5,
44301
44281
  isBold: false,
@@ -44320,10 +44300,17 @@ class TextStyleSettings {
44320
44300
  listMarker: { enumerator: "1", terminator: "period", case: "lower" },
44321
44301
  frame: {
44322
44302
  shape: "none",
44323
- fill: "none",
44324
- border: _ColorDef__WEBPACK_IMPORTED_MODULE_0__.ColorDef.black.toJSON(),
44303
+ fillColor: "none",
44304
+ borderColor: _ColorDef__WEBPACK_IMPORTED_MODULE_0__.ColorDef.black.toJSON(),
44325
44305
  borderWeight: 1,
44326
44306
  },
44307
+ margins: {
44308
+ left: 0,
44309
+ right: 0,
44310
+ top: 0,
44311
+ bottom: 0
44312
+ },
44313
+ justification: "left",
44327
44314
  };
44328
44315
  /** Settings initialized to all default values. */
44329
44316
  static defaults = new TextStyleSettings({});
@@ -44332,8 +44319,12 @@ class TextStyleSettings {
44332
44319
  defaults = TextStyleSettings.defaultProps;
44333
44320
  }
44334
44321
  this.color = props.color ?? defaults.color;
44335
- this.fontName = props.fontName ?? defaults.fontName;
44336
- this.lineHeight = props.lineHeight ?? defaults.lineHeight;
44322
+ const font = {
44323
+ name: props.font?.name ?? defaults.font.name,
44324
+ type: props.font?.type ?? defaults.font.type,
44325
+ };
44326
+ this.font = Object.freeze(font);
44327
+ this.textHeight = props.textHeight ?? defaults.textHeight;
44337
44328
  this.lineSpacingFactor = props.lineSpacingFactor ?? defaults.lineSpacingFactor;
44338
44329
  this.paragraphSpacingFactor = props.paragraphSpacingFactor ?? defaults.paragraphSpacingFactor;
44339
44330
  this.isBold = props.isBold ?? defaults.isBold;
@@ -44359,34 +44350,30 @@ class TextStyleSettings {
44359
44350
  this.listMarker = props.listMarker ?? defaults.listMarker;
44360
44351
  const frame = {
44361
44352
  shape: props.frame?.shape ?? defaults.frame.shape,
44362
- fill: props.frame?.fill ?? defaults.frame.fill,
44363
- border: props.frame?.border ?? defaults.frame.border,
44353
+ fillColor: props.frame?.fillColor ?? defaults.frame.fillColor,
44354
+ borderColor: props.frame?.borderColor ?? defaults.frame.borderColor,
44364
44355
  borderWeight: props.frame?.borderWeight ?? defaults.frame.borderWeight,
44365
44356
  };
44366
44357
  // Cast to indicate to TypeScript that the frame properties are all defined
44367
44358
  this.frame = Object.freeze(frame);
44359
+ this.margins = Object.freeze({
44360
+ left: props.margins?.left ?? defaults.margins.left,
44361
+ right: props.margins?.right ?? defaults.margins.right,
44362
+ top: props.margins?.top ?? defaults.margins.top,
44363
+ bottom: props.margins?.bottom ?? defaults.margins.bottom,
44364
+ });
44365
+ this.justification = props.justification ?? defaults.justification;
44368
44366
  }
44369
44367
  /** Create a copy of these settings, modified according to the properties defined by `alteredProps`. */
44370
44368
  clone(alteredProps) {
44371
44369
  return alteredProps ? new TextStyleSettings(alteredProps, this) : this;
44372
44370
  }
44373
- /** Creates a deep copy of the `TextStyleSettingsProps`. */
44374
- static cloneProps(props) {
44375
- const copy = { ...props };
44376
- if (props.leader) {
44377
- copy.leader = { ...props.leader };
44378
- }
44379
- if (props.frame) {
44380
- copy.frame = { ...props.frame };
44381
- }
44382
- return copy;
44383
- }
44384
44371
  /** Create settings from their JSON representation. */
44385
44372
  static fromJSON(props) {
44386
44373
  return props ? new TextStyleSettings(props) : TextStyleSettings.defaults;
44387
44374
  }
44388
44375
  toJSON() {
44389
- return { ...this };
44376
+ return structuredClone(this);
44390
44377
  }
44391
44378
  /** Compare two [[TextLeaderStyleProps]] for equality.
44392
44379
  * @param other The other leader style properties to compare against.
@@ -44399,21 +44386,27 @@ class TextStyleSettings {
44399
44386
  }
44400
44387
  frameEquals(other) {
44401
44388
  return this.frame?.shape === other.shape
44402
- && this.frame?.fill === other.fill
44403
- && this.frame?.border === other.border
44389
+ && this.frame?.fillColor === other.fillColor
44390
+ && this.frame?.borderColor === other.borderColor
44404
44391
  && this.frame?.borderWeight === other.borderWeight;
44405
44392
  }
44393
+ marginsEqual(other) {
44394
+ return Object.entries(this.margins).every(([key, value]) => value === other[key]);
44395
+ }
44406
44396
  equals(other) {
44407
- return this.color === other.color && this.fontName === other.fontName
44408
- && this.lineHeight === other.lineHeight && this.lineSpacingFactor === other.lineSpacingFactor && this.paragraphSpacingFactor === other.paragraphSpacingFactor && this.widthFactor === other.widthFactor
44397
+ return this.color === other.color && this.font.name === other.font.name && this.font.type === other.font.type
44398
+ && this.textHeight === other.textHeight && this.widthFactor === other.widthFactor
44399
+ && this.lineSpacingFactor === other.lineSpacingFactor && this.paragraphSpacingFactor === other.paragraphSpacingFactor
44409
44400
  && this.isBold === other.isBold && this.isItalic === other.isItalic && this.isUnderlined === other.isUnderlined
44410
44401
  && this.stackedFractionType === other.stackedFractionType && this.stackedFractionScale === other.stackedFractionScale
44411
44402
  && this.subScriptOffsetFactor === other.subScriptOffsetFactor && this.subScriptScale === other.subScriptScale
44412
44403
  && this.superScriptOffsetFactor === other.superScriptOffsetFactor && this.superScriptScale === other.superScriptScale
44413
44404
  && this.tabInterval === other.tabInterval && this.indentation === other.indentation
44414
44405
  && this.listMarker.case === other.listMarker.case && this.listMarker.enumerator === other.listMarker.enumerator && this.listMarker.terminator === other.listMarker.terminator
44406
+ && this.justification === other.justification
44415
44407
  && this.leaderEquals(other.leader)
44416
- && this.frameEquals(other.frame);
44408
+ && this.frameEquals(other.frame)
44409
+ && this.marginsEqual(other.margins);
44417
44410
  }
44418
44411
  /**
44419
44412
  * Returns a list of validation errors for this instance.
@@ -44427,11 +44420,11 @@ class TextStyleSettings {
44427
44420
  */
44428
44421
  getValidationErrors() {
44429
44422
  const errorMessages = [];
44430
- if (this.fontName.trim() === "") {
44431
- errorMessages.push("fontName must be provided");
44423
+ if (this.font.name.trim() === "") {
44424
+ errorMessages.push("font name must be provided");
44432
44425
  }
44433
- if (this.lineHeight <= 0) {
44434
- errorMessages.push("lineHeight must be greater than 0");
44426
+ if (this.textHeight <= 0) {
44427
+ errorMessages.push("textHeight must be greater than 0");
44435
44428
  }
44436
44429
  if (this.stackedFractionScale <= 0) {
44437
44430
  errorMessages.push("stackedFractionScale must be greater than 0");
@@ -155670,10 +155663,14 @@ class StandardQuantityTypeDefinition {
155670
155663
  */
155671
155664
  class QuantityTypeFormatsProvider {
155672
155665
  onFormatsChanged = new _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
155666
+ _removeListeners = [];
155673
155667
  constructor() {
155674
- _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(() => {
155668
+ this._removeListeners.push(_IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(() => {
155675
155669
  this.onFormatsChanged.raiseEvent({ formatsChanged: "all" });
155676
- });
155670
+ }));
155671
+ }
155672
+ [Symbol.dispose]() {
155673
+ this._removeListeners.forEach(listener => listener());
155677
155674
  }
155678
155675
  _kindOfQuantityMap = new Map([
155679
155676
  ["AecUnits.LENGTH", QuantityType.Length],
@@ -305315,8 +305312,8 @@ class Formatter {
305315
305312
  */
305316
305313
  static formatComposite(magnitude, spec) {
305317
305314
  const compositeStrings = [];
305318
- // Caller will deal with appending +||-||() value sign as specified by formatting options so just format positive value
305319
- let posMagnitude = Math.abs(magnitude);
305315
+ let isNegative = false;
305316
+ let remainingMagnitude = magnitude;
305320
305317
  for (let i = 0; i < spec.unitConversions.length; i++) {
305321
305318
  const currentLabel = spec.unitConversions[i].label;
305322
305319
  const unitConversion = spec.unitConversions[i].conversion;
@@ -305326,40 +305323,43 @@ class Formatter {
305326
305323
  throw new _Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityError(_Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityStatus.InvalidCompositeFormat, `The Format ${spec.format.name} has a invalid unit specification.`);
305327
305324
  let unitValue = 0.0;
305328
305325
  if (spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Ratio) {
305329
- if (1 !== spec.format.units.length)
305326
+ if (1 !== (spec.format.units?.length ?? 0))
305330
305327
  throw new _Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityError(_Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityStatus.InvalidCompositeFormat, `The Format '${spec.format.name}' with type 'ratio' must have exactly one unit.`);
305331
305328
  try {
305332
- unitValue = (0,_Quantity__WEBPACK_IMPORTED_MODULE_3__.applyConversion)(posMagnitude, unitConversion) + this.FPV_MINTHRESHOLD;
305329
+ unitValue = (0,_Quantity__WEBPACK_IMPORTED_MODULE_3__.applyConversion)(remainingMagnitude, unitConversion) + this.FPV_MINTHRESHOLD;
305333
305330
  }
305334
305331
  catch (e) {
305335
305332
  // The "InvertingZero" error is thrown when the value is zero and the conversion factor is inverted.
305336
305333
  // For ratio, we actually want to support this corner case and return "1:0" as the formatted value.
305337
305334
  if (e instanceof _Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityError && e.errorNumber === _Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityStatus.InvertingZero) {
305338
- return "1:0";
305335
+ return { componentText: "1:0", isNegative: false };
305339
305336
  }
305340
305337
  }
305341
305338
  compositeStrings.push(this.formatRatio(unitValue, spec));
305339
+ isNegative = unitValue < 0;
305342
305340
  continue;
305343
305341
  }
305344
- unitValue = (0,_Quantity__WEBPACK_IMPORTED_MODULE_3__.applyConversion)(posMagnitude, unitConversion) + this.FPV_MINTHRESHOLD;
305342
+ unitValue = (0,_Quantity__WEBPACK_IMPORTED_MODULE_3__.applyConversion)(remainingMagnitude, unitConversion) + this.FPV_MINTHRESHOLD;
305345
305343
  if (0 === i) {
305344
+ // Only set isNegative from the first (major) unit conversion
305345
+ isNegative = unitValue < 0;
305346
305346
  const precisionScale = Math.pow(10, 8); // use a fixed round off precision of 8 to avoid loss of precision in actual magnitude
305347
305347
  unitValue = Math.floor(unitValue * precisionScale + FPV_ROUNDFACTOR) / precisionScale;
305348
305348
  if ((Math.abs(unitValue) < 0.0001) && spec.format.hasFormatTraitSet(_FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatTraits.ZeroEmpty))
305349
- return "";
305349
+ return { componentText: "", isNegative: false };
305350
305350
  }
305351
- if (i < spec.format.units.length - 1) {
305352
- const wholePart = Math.floor(unitValue);
305353
- const componentText = Formatter.formatCompositePart(wholePart, false, currentLabel, spec);
305354
- posMagnitude = unitValue - wholePart;
305351
+ if (i < (spec.format.units?.length ?? 0) - 1) {
305352
+ const wholePart = Math.trunc(unitValue);
305353
+ const componentText = Formatter.formatCompositePart(Math.abs(wholePart), false, currentLabel, spec);
305354
+ remainingMagnitude = unitValue - wholePart;
305355
305355
  compositeStrings.push(componentText);
305356
305356
  }
305357
305357
  else {
305358
- const componentText = Formatter.formatCompositePart(unitValue, true, currentLabel, spec);
305358
+ const componentText = Formatter.formatCompositePart(Math.abs(unitValue), true, currentLabel, spec);
305359
305359
  compositeStrings.push(componentText);
305360
305360
  }
305361
305361
  }
305362
- return compositeStrings.join(spec.format.spacerOrDefault);
305362
+ return { componentText: compositeStrings.join(spec.format.spacerOrDefault), isNegative };
305363
305363
  }
305364
305364
  /** Format a quantity value into a single text string. Imitate how formatting done by server method NumericFormatSpec::FormatDouble.
305365
305365
  * @param magnitude quantity value
@@ -305488,45 +305488,58 @@ class Formatter {
305488
305488
  }
305489
305489
  return value;
305490
305490
  }
305491
- /** Format a quantity value into a single text string based on the current format specification of this class.
305492
- * @param magnitude defines the value to spec.format.
305493
- * @param spec A FormatterSpec object the defines specification for the magnitude and unit conversions for the formatter.
305491
+ /** Helper function to apply sign formatting based on showSignOption
305492
+ * @param isNegative whether the value should be treated as negative
305493
+ * @param showSignOption the sign display option
305494
+ * @param formatType the format type (to handle bearing/azimuth exceptions)
305495
+ * @returns object containing prefix and suffix strings
305494
305496
  */
305495
- static formatQuantity(magnitude, spec) {
305496
- const valueIsNegative = magnitude < 0.0;
305497
+ static applySignFormatting(isNegative, showSignOption, formatType) {
305497
305498
  let prefix = "";
305498
305499
  let suffix = "";
305499
- let formattedValue = "";
305500
- if (spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Bearing || spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Azimuth) {
305501
- const result = this.processBearingAndAzimuth(magnitude, spec);
305502
- magnitude = result.magnitude;
305503
- prefix = result.prefix ?? "";
305504
- suffix = result.suffix ?? "";
305505
- }
305506
- switch (spec.format.showSignOption) {
305500
+ switch (showSignOption) {
305507
305501
  case _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.ShowSignOption.NegativeParentheses:
305508
- if (valueIsNegative) {
305509
- prefix += "(";
305510
- suffix = `)${suffix}`;
305502
+ if (isNegative) {
305503
+ prefix = "(";
305504
+ suffix = ")";
305511
305505
  }
305512
305506
  break;
305513
305507
  case _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.ShowSignOption.OnlyNegative:
305514
- if (valueIsNegative && spec.format.type !== _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Bearing && spec.format.type !== _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Azimuth)
305515
- prefix += "-";
305508
+ if (isNegative && formatType !== _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Bearing && formatType !== _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Azimuth) {
305509
+ prefix = "-";
305510
+ }
305516
305511
  break;
305517
305512
  case _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.ShowSignOption.SignAlways:
305518
- if (valueIsNegative)
305519
- prefix += "-";
305520
- else
305521
- prefix += "+";
305513
+ prefix = isNegative ? "-" : "+";
305522
305514
  break;
305523
305515
  case _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.ShowSignOption.NoSign:
305524
305516
  default:
305525
305517
  break;
305526
305518
  }
305519
+ return { prefix, suffix };
305520
+ }
305521
+ /** Format a quantity value into a single text string based on the current format specification of this class.
305522
+ * @param magnitude defines the value to spec.format.
305523
+ * @param spec A FormatterSpec object the defines specification for the magnitude and unit conversions for the formatter.
305524
+ */
305525
+ static formatQuantity(magnitude, spec) {
305526
+ let valueIsNegative = magnitude < 0.0;
305527
+ let prefix = "";
305528
+ let suffix = "";
305529
+ let formattedValue = "";
305530
+ // Handle bearing/azimuth special formatting
305531
+ if (spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Bearing || spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Azimuth) {
305532
+ const result = this.processBearingAndAzimuth(magnitude, spec);
305533
+ magnitude = result.magnitude;
305534
+ prefix = result.prefix ?? "";
305535
+ suffix = result.suffix ?? "";
305536
+ }
305527
305537
  let formattedMagnitude = "";
305528
305538
  if (spec.format.hasUnits) {
305529
- formattedMagnitude = Formatter.formatComposite(magnitude, spec);
305539
+ const compositeResult = Formatter.formatComposite(magnitude, spec);
305540
+ formattedMagnitude = compositeResult.componentText;
305541
+ // Override the sign detection with the composite conversion result
305542
+ valueIsNegative = compositeResult.isNegative;
305530
305543
  }
305531
305544
  else {
305532
305545
  // unitless quantity
@@ -305537,7 +305550,12 @@ class Formatter {
305537
305550
  else
305538
305551
  formattedMagnitude = formattedMagnitude + spec.format.uomSeparator + spec.unitConversions[0].label;
305539
305552
  }
305553
+ // For unitless quantities, keep original sign detection
305540
305554
  }
305555
+ // Apply sign formatting based on the final determined sign
305556
+ const signFormatting = this.applySignFormatting(valueIsNegative, spec.format.showSignOption, spec.format.type);
305557
+ prefix += signFormatting.prefix;
305558
+ suffix = signFormatting.suffix + suffix;
305541
305559
  // add Sign prefix and suffix as necessary
305542
305560
  if ((prefix.length > 0 || suffix.length > 0) && formattedMagnitude.length > 0)
305543
305561
  formattedValue = prefix + formattedMagnitude + suffix;
@@ -305558,7 +305576,8 @@ class Formatter {
305558
305576
  magnitude -= quarterRevolution;
305559
305577
  quadrant++;
305560
305578
  }
305561
- let prefix, suffix;
305579
+ let prefix = "";
305580
+ let suffix = "";
305562
305581
  // Quadrants are
305563
305582
  // 3 0
305564
305583
  // 2 1
@@ -305585,7 +305604,7 @@ class Formatter {
305585
305604
  prefix = "N";
305586
305605
  }
305587
305606
  }
305588
- return { magnitude, prefix, suffix: suffix };
305607
+ return { magnitude, prefix, suffix };
305589
305608
  }
305590
305609
  if (type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Azimuth) {
305591
305610
  let azimuthBase = 0; // default base is North
@@ -307786,10 +307805,10 @@ class Settings {
307786
307805
  });
307787
307806
  }
307788
307807
  toString() {
307789
- return `Configurations:
307790
- oidc client id: ${this.oidcClientId},
307791
- oidc scopes: ${this.oidcScopes},
307792
- applicationId: ${this.gprid},
307808
+ return `Configurations:
307809
+ oidc client id: ${this.oidcClientId},
307810
+ oidc scopes: ${this.oidcScopes},
307811
+ applicationId: ${this.gprid},
307793
307812
  log level: ${this.logLevel}`;
307794
307813
  }
307795
307814
  }
@@ -320733,7 +320752,7 @@ var loadLanguages = instance.loadLanguages;
320733
320752
  /***/ ((module) => {
320734
320753
 
320735
320754
  "use strict";
320736
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.2.0-dev.34","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 && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers && npm run -s copy:draco","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 ES2022 --outDir lib/esm","clean":"rimraf -g 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","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","copy:draco":"cpx \\"./node_modules/@loaders.gl/draco/dist/libs/*\\" ./lib/public/scripts","docs":"betools docs --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/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-inline-config -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -f visualstudio \\"./src/**/*.ts\\" 1>&2","lint-deprecation":"eslint --fix -f visualstudio --no-inline-config -c ../../common/config/eslint/eslint.config.deprecation-policy.js \\"./src/**/*.ts\\"","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run webpackTestWorker && vitest --run","cover":"npm run webpackTestWorker && vitest --run","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*"},"//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/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*","@itwin/eslint-plugin":"5.2.2-dev.2","@types/chai-as-promised":"^7","@types/draco3d":"^1.4.10","@types/sinon":"^17.0.2","@vitest/browser":"^3.0.6","@vitest/coverage-v8":"^3.0.6","cpx2":"^8.0.0","eslint":"^9.31.0","glob":"^10.3.12","playwright":"~1.47.1","rimraf":"^6.0.1","sinon":"^17.0.2","source-map-loader":"^5.0.0","typescript":"~5.6.2","typemoq":"^2.1.0","vitest":"^3.0.6","vite-multiple-assets":"^1.3.1","vite-plugin-static-copy":"2.2.0","webpack":"^5.97.1"},"//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/cloud-agnostic-core":"^2.2.4","@itwin/object-storage-core":"^2.3.0","@itwin/core-i18n":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^4.3.4","@loaders.gl/draco":"^4.3.4","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"}}');
320755
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.2.0-dev.36","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 && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers && npm run -s copy:draco","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 ES2022 --outDir lib/esm","clean":"rimraf -g 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","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","copy:draco":"cpx \\"./node_modules/@loaders.gl/draco/dist/libs/*\\" ./lib/public/scripts","docs":"betools docs --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/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-inline-config -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -f visualstudio \\"./src/**/*.ts\\" 1>&2","lint-deprecation":"eslint --fix -f visualstudio --no-inline-config -c ../../common/config/eslint/eslint.config.deprecation-policy.js \\"./src/**/*.ts\\"","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run webpackTestWorker && vitest --run","cover":"npm run webpackTestWorker && vitest --run","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*"},"//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/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*","@itwin/eslint-plugin":"5.2.2-dev.2","@types/chai-as-promised":"^7","@types/draco3d":"^1.4.10","@types/sinon":"^17.0.2","@vitest/browser":"^3.0.6","@vitest/coverage-v8":"^3.0.6","cpx2":"^8.0.0","eslint":"^9.31.0","glob":"^10.3.12","playwright":"~1.47.1","rimraf":"^6.0.1","sinon":"^17.0.2","source-map-loader":"^5.0.0","typescript":"~5.6.2","typemoq":"^2.1.0","vitest":"^3.0.6","vite-multiple-assets":"^1.3.1","vite-plugin-static-copy":"2.2.0","webpack":"^5.97.1"},"//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/cloud-agnostic-core":"^2.2.4","@itwin/object-storage-core":"^2.3.0","@itwin/core-i18n":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^4.3.4","@loaders.gl/draco":"^4.3.4","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"}}');
320737
320756
 
320738
320757
  /***/ })
320739
320758