@itwin/core-common 5.3.0-dev.2 → 5.3.0-dev.23

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/lib/cjs/ElementProps.d.ts +24 -6
  3. package/lib/cjs/ElementProps.d.ts.map +1 -1
  4. package/lib/cjs/ElementProps.js.map +1 -1
  5. package/lib/cjs/annotation/TextBlock.d.ts +4 -29
  6. package/lib/cjs/annotation/TextBlock.d.ts.map +1 -1
  7. package/lib/cjs/annotation/TextBlock.js +8 -35
  8. package/lib/cjs/annotation/TextBlock.js.map +1 -1
  9. package/lib/cjs/annotation/TextField.d.ts +4 -2
  10. package/lib/cjs/annotation/TextField.d.ts.map +1 -1
  11. package/lib/cjs/annotation/TextField.js.map +1 -1
  12. package/lib/cjs/annotation/TextStyle.d.ts +64 -36
  13. package/lib/cjs/annotation/TextStyle.d.ts.map +1 -1
  14. package/lib/cjs/annotation/TextStyle.js +63 -44
  15. package/lib/cjs/annotation/TextStyle.js.map +1 -1
  16. package/lib/cjs/tile/GltfTileIO.d.ts +9 -0
  17. package/lib/cjs/tile/GltfTileIO.d.ts.map +1 -1
  18. package/lib/cjs/tile/GltfTileIO.js +44 -1
  19. package/lib/cjs/tile/GltfTileIO.js.map +1 -1
  20. package/lib/esm/ElementProps.d.ts +24 -6
  21. package/lib/esm/ElementProps.d.ts.map +1 -1
  22. package/lib/esm/ElementProps.js.map +1 -1
  23. package/lib/esm/annotation/TextBlock.d.ts +4 -29
  24. package/lib/esm/annotation/TextBlock.d.ts.map +1 -1
  25. package/lib/esm/annotation/TextBlock.js +8 -35
  26. package/lib/esm/annotation/TextBlock.js.map +1 -1
  27. package/lib/esm/annotation/TextField.d.ts +4 -2
  28. package/lib/esm/annotation/TextField.d.ts.map +1 -1
  29. package/lib/esm/annotation/TextField.js.map +1 -1
  30. package/lib/esm/annotation/TextStyle.d.ts +64 -36
  31. package/lib/esm/annotation/TextStyle.d.ts.map +1 -1
  32. package/lib/esm/annotation/TextStyle.js +63 -44
  33. package/lib/esm/annotation/TextStyle.js.map +1 -1
  34. package/lib/esm/tile/GltfTileIO.d.ts +9 -0
  35. package/lib/esm/tile/GltfTileIO.d.ts.map +1 -1
  36. package/lib/esm/tile/GltfTileIO.js +42 -0
  37. package/lib/esm/tile/GltfTileIO.js.map +1 -1
  38. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../../src/annotation/TextField.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*----------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Annotation\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\n\n/** Enumerates the different kinds of [Property]($ecschema-metadata) values that can be used as the basis for a [[FieldRun]]'s display string.\n * A field's property type is derived from the property's [PrimitiveType]($ecschema-metadata) and other attributes like its [PrimitiveOrEnumPropertyBase.extendedTypeName]($ecschema-metadata).\n * The conversion of the raw property value into a display string can be customized by different [[FieldFormatOptions]] based on its type.\n * The following types are currently recognized:\n * - \"quantity\": an often-unitized scalar value like a distance or area, formatted using a quantity [Format]($core-quantity).\n * - \"coordinate\": a 2- or 3-dimensional point, with each component formatted as a \"quantity\".\n * - \"boolean\": a true or false value.\n * - \"datetime\": an ECMAScript [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).\n * - \"int-enum\": an integer [EnumerationProperty]($ecschema-metadata) formatted using the enum value's display label.\n * - \"string-enum\": a string [EnumerationProperty]($ecschema-metadata) formatted using the enum value's display label.\n * - \"string\": a value convertible to a string.\n * @note Currently, only formatting of \"string\" and \"datetime\" types is implemented. Other types are converted to and formatted as \"string\".\n * @beta\n */\nexport type FieldPropertyType = \"quantity\" | \"coordinate\" | \"string\" | \"boolean\" | \"datetime\" | \"int-enum\" | \"string-enum\";\n\n/** A chain of property accesses that resolves to a primitive value that forms the basis of the displayed content\n * of a [[FieldRun]].\n * The simplest property paths consist of a [[propertyName]] and nothing else, where `propertyName` identifies\n * a primitive property.\n * If `propertyName` identifies a struct or array property, then additional [[accessors]] are required to identify the specific value.\n * Some examples:\n * ```\n * | Access String | propertyName | accessors |\n * | ------------- | ------------ | --------- |\n * | name | \"name\" | undefined |\n * | spouse.name | \"spouse\" | [name] |\n * | colors[2] | \"colors\" | [2] |\n * | spouse.favoriteRestaurants[1].address | \"spouse\" | [\"favoriteRestaurants\", 1, \"address\"] |\n * ```\n * @beta\n */\nexport interface FieldPropertyPath {\n /** The name of the BIS property of the [[FieldPropertyHost]] that serves as the root of the path. */\n propertyName: string;\n /** Property names and/or array indices describing the path from [[propertyName]] to the ultimate BIS property. */\n accessors?: Array<string | number>;\n}\n\n/** Describes the source of the property value against which a [[FieldPropertyPath]] is evaluated.\n * A field property is always hosted by an [Element]($backend). It may be a property of the element's BIS class itself,\n * or that of one of its [ElementAspect]($backend)s.\n * The [[schemaName]] and [[className]] should always identify the exact class that contains [[FieldPropertyPath.propertyName]] - not a subclass thereof.\n * @beta\n */\nexport interface FieldPropertyHost {\n /** The Id of the [Element]($backend) that hosts the property. */\n elementId: Id64String;\n /** The name of the schema containing the class identified by [[className]]. */\n schemaName: string;\n /** The name of the exact class (not a subclass) containing the property identified by [[FieldPropertyPath.propertyName]]. */\n className: string;\n}\n\n/** As part of [[FieldFormatOptions]], specifies how to modify the case of the display string.\n * \"as-is\" leaves it unmodified. \"upper\" and \"lower\" convert it to all upper-case or all lower-case, respectively.\n * @beta\n */\nexport type FieldCase = \"as-is\" | \"upper\" | \"lower\";\n\n/** As part of a [[FieldFormatOptions]], specifies how to format properties of [[FieldPropertyType]] \"datetime\".\n * @beta\n */\nexport interface DateTimeFieldFormatOptions {\n /** The locale with which to localize the display string.\n * Default: \"en-US\".\n */\n locale?: Intl.UnicodeBCP47LocaleIdentifier;\n /** Describes how to produce the display string. */\n formatOptions?: Intl.DateTimeFormatOptions;\n}\n\n/** Customizes how to format the raw property value resolved by a [[FieldPropertyPath]] into a [[FieldRun]]'s display string.\n * The exact options used depend upon the [[FieldPropertyType]].\n * @beta\n */\nexport interface FieldFormatOptions {\n /** A string inserted before the formatted string. This string is not affected by [[case]]. */\n prefix?: string;\n /** A string inserted after the formatted string. This string is not affected by [[case]]. */\n suffix?: string;\n /** Modifies the case of the formatted string. */\n case?: FieldCase;\n /** Formatting options for [[FieldPropertyType]] \"datetime\". */\n dateTime?: DateTimeFieldFormatOptions;\n}\n"]}
1
+ {"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../../src/annotation/TextField.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*----------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Annotation\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\n\n/** Enumerates the different kinds of [Property]($ecschema-metadata) values that can be used as the basis for a [[FieldRun]]'s display string.\n * A field's property type is derived from the property's [PrimitiveType]($ecschema-metadata) and other attributes like its [PrimitiveOrEnumPropertyBase.extendedTypeName]($ecschema-metadata).\n * The conversion of the raw property value into a display string can be customized by different [[FieldFormatOptions]] based on its type.\n * The following types are currently recognized:\n * - \"quantity\": an often-unitized scalar value like a distance or area, formatted using a quantity [Format]($core-quantity).\n * - \"coordinate\": a 2- or 3-dimensional point, with each component formatted as a \"quantity\".\n * - \"boolean\": a true or false value.\n * - \"datetime\": an ECMAScript [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).\n * - \"int-enum\": an integer [EnumerationProperty]($ecschema-metadata) formatted using the enum value's display label.\n * - \"string-enum\": a string [EnumerationProperty]($ecschema-metadata) formatted using the enum value's display label.\n * - \"string\": a value convertible to a string.\n * @note Currently, only formatting of \"string\" and \"datetime\" types is implemented. Other types are converted to and formatted as \"string\".\n * @beta\n */\nexport type FieldPropertyType = \"quantity\" | \"coordinate\" | \"string\" | \"boolean\" | \"datetime\" | \"int-enum\" | \"string-enum\";\n\n/** A chain of property accesses that resolves to a primitive value that forms the basis of the displayed content\n * of a [[FieldRun]].\n * The simplest property paths consist of a [[propertyName]] and nothing else, where `propertyName` identifies\n * a primitive property.\n * If `propertyName` identifies a struct or array property, then additional [[accessors]] are required to identify the specific value.\n * Some examples:\n * ```\n * | Access String | propertyName | accessors |\n * | ------------- | ------------ | --------- |\n * | name | \"name\" | undefined |\n * | spouse.name | \"spouse\" | [name] |\n * | colors[2] | \"colors\" | [2] |\n * | spouse.favoriteRestaurants[1].address | \"spouse\" | [\"favoriteRestaurants\", 1, \"address\"] |\n * ```\n * @beta\n */\nexport interface FieldPropertyPath {\n /** The name of the BIS property of the [[FieldPropertyHost]] that serves as the root of the path. */\n propertyName: string;\n /** Property names and/or array indices describing the path from [[propertyName]] to the ultimate BIS property. */\n accessors?: Array<string | number>;\n}\n\n/** Describes the source of the property value against which a [[FieldPropertyPath]] is evaluated.\n * A field property is always hosted by an [Element]($backend). It may refer to a property belonging to any of the following:\n * - The element's BIS class itself;\n * - One of the element's [ElementAspect]($backend)s;\n * - Or an [EC view]($docs/learning/ECSqlReference/Views.md) with the same ECInstanceId as the element.\n * The [[schemaName]] and [[className]] should always identify the exact class that contains [[FieldPropertyPath.propertyName]] - not a subclass thereof.\n * @beta\n */\nexport interface FieldPropertyHost {\n /** The Id of the [Element]($backend) that hosts the property. */\n elementId: Id64String;\n /** The name of the schema containing the class identified by [[className]]. */\n schemaName: string;\n /** The name of the exact class (not a subclass) containing the property identified by [[FieldPropertyPath.propertyName]]. */\n className: string;\n}\n\n/** As part of [[FieldFormatOptions]], specifies how to modify the case of the display string.\n * \"as-is\" leaves it unmodified. \"upper\" and \"lower\" convert it to all upper-case or all lower-case, respectively.\n * @beta\n */\nexport type FieldCase = \"as-is\" | \"upper\" | \"lower\";\n\n/** As part of a [[FieldFormatOptions]], specifies how to format properties of [[FieldPropertyType]] \"datetime\".\n * @beta\n */\nexport interface DateTimeFieldFormatOptions {\n /** The locale with which to localize the display string.\n * Default: \"en-US\".\n */\n locale?: Intl.UnicodeBCP47LocaleIdentifier;\n /** Describes how to produce the display string. */\n formatOptions?: Intl.DateTimeFormatOptions;\n}\n\n/** Customizes how to format the raw property value resolved by a [[FieldPropertyPath]] into a [[FieldRun]]'s display string.\n * The exact options used depend upon the [[FieldPropertyType]].\n * @beta\n */\nexport interface FieldFormatOptions {\n /** A string inserted before the formatted string. This string is not affected by [[case]]. */\n prefix?: string;\n /** A string inserted after the formatted string. This string is not affected by [[case]]. */\n suffix?: string;\n /** Modifies the case of the formatted string. */\n case?: FieldCase;\n /** Formatting options for [[FieldPropertyType]] \"datetime\". */\n dateTime?: DateTimeFieldFormatOptions;\n}\n"]}
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { DeepReadonlyObject, DeepRequiredObject } from "@itwin/core-bentley";
5
5
  import { ColorDefProps } from "../ColorDef";
6
+ import { FontFamilySelector } from "../Fonts";
6
7
  /** Predefined markers for list items in text annotations.
7
8
  * 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.
8
9
  * @beta
@@ -44,6 +45,24 @@ export type TextAnnotationFrameShape = typeof textAnnotationFrameShapes[number];
44
45
  * @beta
45
46
  */
46
47
  export type TextAnnotationFillColor = TextStyleColor | "background" | "none";
48
+ /** Describes the margins around the content inside a [[TextBlock]], measured in meters.
49
+ * All margins default to zero if `undefined`.
50
+ * @beta
51
+ */
52
+ export interface TextBlockMargins {
53
+ /** The left margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */
54
+ left?: number;
55
+ /** The right margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */
56
+ right?: number;
57
+ /** The top margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */
58
+ top?: number;
59
+ /** The bottom margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */
60
+ bottom?: number;
61
+ }
62
+ /** Describes the relative alignment of text.
63
+ * @beta
64
+ */
65
+ export type TextJustification = "left" | "center" | "right";
47
66
  /** Specifies how to separate the numerator and denominator of a [[FractionRun]], by either a horizontal or diagonal bar.
48
67
  * @see [[TextStyleSettingsProps.stackedFractionType]] and [[TextStyleSettings.stackedFractionType]].
49
68
  * @beta
@@ -65,9 +84,9 @@ export interface TextFrameStyleProps {
65
84
  /** Shape of the frame. Default: "none" */
66
85
  shape?: TextAnnotationFrameShape;
67
86
  /** The color to fill the shape of the text frame. This fill is applied using [[FillDisplay.Blanking]]. Default: "none" */
68
- fill?: TextAnnotationFillColor;
87
+ fillColor?: TextAnnotationFillColor;
69
88
  /** The color of the text frame's outline. Default: black */
70
- border?: TextStyleColor;
89
+ borderColor?: TextStyleColor;
71
90
  /** This will be used to set the [[GeometryParams.weight]] property of the frame (in pixels). Default: 1px */
72
91
  borderWeight?: number;
73
92
  }
@@ -86,17 +105,17 @@ export interface TextLeaderStyleProps {
86
105
  */
87
106
  wantElbow?: boolean;
88
107
  /** Multiplier used to compute length of the elbow in the leader.
89
- * The elbowLength is computed in meters as elbowLength * [[lineHeight]].
108
+ * The elbowLength is computed in meters as elbowLength * [[textHeight]].
90
109
  * Default: 1.0
91
110
  */
92
111
  elbowLength?: number;
93
112
  /** Multiplier to compute height of the leader terminator.
94
- * The terminator height is computed in meters as terminatorHeight * [[lineHeight]].
113
+ * The terminator height is computed in meters as terminatorHeight * [[textHeight]].
95
114
  * Default: 1.0
96
115
  */
97
116
  terminatorHeightFactor?: number;
98
117
  /** Multiplier to compute width of the leader terminator.
99
- * The terminator width is computed in meters as terminatorWidth * [[lineHeight]].
118
+ * The terminator width is computed in meters as terminatorWidth * [[textHeight]].
100
119
  * Default: 1.0
101
120
  */
102
121
  terminatorWidthFactor?: number;
@@ -109,22 +128,22 @@ export interface TextStyleSettingsProps {
109
128
  * Default: "subcategory".
110
129
  */
111
130
  color?: TextStyleColor;
112
- /** The name of a font stored in an iModel, used to draw the contents of a [[TextRun]].
113
- * Default: "" (an invalid font name).
131
+ /** The font stored in an iModel, used to draw the contents of a [[TextRun]].
132
+ * Default: { name: "" } (an invalid font name).
114
133
  */
115
- fontName?: string;
116
- /** The height each line of text, in meters. Many other settings use the line height as the basis for computing their own values.
117
- * For example, the height and offset from baseline of a subscript [[TextRun]] are computed as lineHeight * [[subScriptScale]] and
118
- * lineHeight * [[subScriptOffsetFactor]], respectively.
134
+ font?: FontFamilySelector;
135
+ /** The height of the text, in meters. Many other settings use the text height as the basis for computing their own values.
136
+ * For example, the height and offset from baseline of a subscript [[TextRun]] are computed as textHeight * [[subScriptScale]] and
137
+ * textHeight * [[subScriptOffsetFactor]], respectively.
119
138
  * Default: 1.0. */
120
- lineHeight?: number;
139
+ textHeight?: number;
121
140
  /** Multiplier used to compute the vertical distance between two lines of text.
122
- * The distance is computed in meters as lineSpacingFactor * [[lineHeight]].
141
+ * The distance is computed in meters as lineSpacingFactor * [[textHeight]].
123
142
  * Default: 0.5.
124
143
  */
125
144
  lineSpacingFactor?: number;
126
145
  /** Multiplier used to compute the vertical distance between two paragraphs of text.
127
- * The distance is computed in meters as paragraphSpacingFactor * [[lineHeight]].
146
+ * The distance is computed in meters as paragraphSpacingFactor * [[textHeight]].
128
147
  * Default: 0.5.
129
148
  */
130
149
  paragraphSpacingFactor?: number;
@@ -141,7 +160,7 @@ export interface TextStyleSettingsProps {
141
160
  */
142
161
  isUnderlined?: boolean;
143
162
  /** Multiplier used to compute the height of both the numerator and denominator of a [[FractionRun]].
144
- * The height is computed in meters as stackedFractionScale * [[lineHeight]].
163
+ * The height is computed in meters as stackedFractionScale * [[textHeight]].
145
164
  * Default: 0.7.
146
165
  */
147
166
  stackedFractionScale?: number;
@@ -150,22 +169,22 @@ export interface TextStyleSettingsProps {
150
169
  */
151
170
  stackedFractionType?: StackedFractionType;
152
171
  /** Multiplier used to compute the vertical offset from the baseline for a subscript [[TextRun]].
153
- * The offset is computed in meters as subScriptOffsetFactor * [[lineHeight]].
172
+ * The offset is computed in meters as subScriptOffsetFactor * [[textHeight]].
154
173
  * Default: -0.15.
155
174
  */
156
175
  subScriptOffsetFactor?: number;
157
176
  /** Multiplier used to compute the height of a subscript [[TextRun]].
158
- * The height is computed as subScriptScale * [[lineHeight]].
177
+ * The height is computed as subScriptScale * [[textHeight]].
159
178
  * Default: 2/3
160
179
  */
161
180
  subScriptScale?: number;
162
181
  /** Multiplier used to compute the vertical offset from the baseline for a super [[TextRun]].
163
- * The offset is computed in meters as superScriptOffsetFactor * [[lineHeight]].
182
+ * The offset is computed in meters as superScriptOffsetFactor * [[textHeight]].
164
183
  * Default: -0.5.
165
184
  */
166
185
  superScriptOffsetFactor?: number;
167
186
  /** Multiplier used to compute the height of a superscript [[TextRun]].
168
- * The height is computed as superScriptScale * [[lineHeight]].
187
+ * The height is computed as superScriptScale * [[textHeight]].
169
188
  * Default: 2/3
170
189
  */
171
190
  superScriptScale?: number;
@@ -192,6 +211,9 @@ export interface TextStyleSettingsProps {
192
211
  * Default: {shape: "none", fill: "none", border: black, borderWeight: 1} for no frame.
193
212
  */
194
213
  frame?: TextFrameStyleProps;
214
+ /** The margins to surround the document content.
215
+ * Default: 0 margins on all sides */
216
+ margins?: TextBlockMargins;
195
217
  /** The offset (in meters) from the left edge of the text block to the start of the line of text.
196
218
  * In lists, the indentation is added to offset of list items.
197
219
  * The [[listMarker]] is right justified on [[indentation]] + [[tabInterval]]*(depth - 1/2).
@@ -203,6 +225,9 @@ export interface TextStyleSettingsProps {
203
225
  * Default: "1.".
204
226
  */
205
227
  listMarker?: ListMarker;
228
+ /** The alignment of the text content.
229
+ * Default: "left". */
230
+ justification?: TextJustification;
206
231
  }
207
232
  /** A description of the formatting to be applied to a [[TextBlockComponent]].
208
233
  * Named instances of these settings can be stored as [AnnotationTextStyle]($backend)s in an iModel.
@@ -213,20 +238,20 @@ export interface TextStyleSettingsProps {
213
238
  export declare class TextStyleSettings {
214
239
  /** The color of the text. */
215
240
  readonly color: TextStyleColor;
216
- /** The name of a font stored in an iModel, used to draw the contents of a [[TextRun]].
241
+ /** The font stored in an iModel, used to draw the contents of a [[TextRun]].
217
242
  */
218
- readonly fontName: string;
219
- /** The height each line of text, in meters. Many other settings use the line height as the basis for computing their own values.
220
- * For example, the height and offset from baseline of a subscript [[TextRun]] are computed as lineHeight * [[subScriptScale]] and
221
- * lineHeight * [[subScriptOffsetFactor]], respectively.
243
+ readonly font: Readonly<Required<FontFamilySelector>>;
244
+ /** The height of the text, in meters. Many other settings use the text height as the basis for computing their own values.
245
+ * For example, the height and offset from baseline of a subscript [[TextRun]] are computed as textHeight * [[subScriptScale]] and
246
+ * textHeight * [[subScriptOffsetFactor]], respectively.
222
247
  */
223
- readonly lineHeight: number;
248
+ readonly textHeight: number;
224
249
  /** Multiplier used to compute the vertical distance between two lines of text.
225
- * The distance is computed in meters as lineSpacingFactor * [[lineHeight]].
250
+ * The distance is computed in meters as lineSpacingFactor * [[textHeight]] of the [[TextBlock]].
226
251
  */
227
252
  readonly lineSpacingFactor: number;
228
253
  /** Multiplier used to compute the vertical distance between two paragraphs of text.
229
- * The distance is computed in meters as paragraphSpacingFactor * [[lineHeight]].
254
+ * The distance is computed in meters as paragraphSpacingFactor * the [[TextBlock]]'s [[textHeight]].
230
255
  */
231
256
  readonly paragraphSpacingFactor: number;
232
257
  /** Specifies whether the content of a [[TextRun]] should be rendered **bold**. */
@@ -236,28 +261,28 @@ export declare class TextStyleSettings {
236
261
  /** Specifies whether the content of a [[TextRun]] should be underlined. */
237
262
  readonly isUnderlined: boolean;
238
263
  /** Multiplier used to compute the height of both the numerator and denominator of a [[FractionRun]].
239
- * The height is computed in meters as stackedFractionScale * [[lineHeight]].
264
+ * The height is computed in meters as stackedFractionScale * [[textHeight]].
240
265
  */
241
266
  readonly stackedFractionScale: number;
242
267
  /** Specifies how to separate the numerator and denominator of a [[FractionRun]]. */
243
268
  readonly stackedFractionType: StackedFractionType;
244
269
  /** Multiplier used to compute the vertical offset from the baseline for a subscript [[TextRun]].
245
- * The offset is computed in meters as subScriptOffsetFactor * [[lineHeight]].
270
+ * The offset is computed in meters as subScriptOffsetFactor * [[textHeight]].
246
271
  */
247
272
  readonly subScriptOffsetFactor: number;
248
273
  /** Multiplier used to compute the height of a subscript [[TextRun]].
249
- * The height is computed as subScriptScale * [[lineHeight]].
274
+ * The height is computed as subScriptScale * [[textHeight]].
250
275
  */
251
276
  readonly subScriptScale: number;
252
277
  /** Multiplier used to compute the vertical offset from the baseline for a super [[TextRun]].
253
- * The offset is computed in meters as superScriptOffsetFactor * [[lineHeight]].
278
+ * The offset is computed in meters as superScriptOffsetFactor * [[textHeight]].
254
279
  */
255
280
  readonly superScriptOffsetFactor: number;
256
281
  /** Multiplier used to compute the height of a superscript [[TextRun]].
257
- * The height is computed as superScriptScale * [[lineHeight]].
282
+ * The height is computed as superScriptScale * [[textHeight]].
258
283
  */
259
284
  readonly superScriptScale: number;
260
- /** Multiplier used to compute the width of each glyph, relative to [[lineHeight]]. */
285
+ /** Multiplier used to compute the width of each glyph, relative to [[textHeight]]. */
261
286
  readonly widthFactor: number;
262
287
  /** Properties describing appearance of leaders in a [[TextAnnotation]].
263
288
  * Used when producing geometry for [[TextAnnotation]].
@@ -282,15 +307,17 @@ export declare class TextStyleSettings {
282
307
  readonly listMarker: ListMarker;
283
308
  /** The frame settings of the [[TextAnnotation]]. */
284
309
  readonly frame: Readonly<Required<TextFrameStyleProps>>;
285
- /** A fully-populated JSON representation of the default settings. A real `fontName` must be provided before use. */
310
+ /** The margins to surround the document content. */
311
+ readonly margins: Readonly<Required<TextBlockMargins>>;
312
+ /** The alignment of the text content. */
313
+ readonly justification: TextJustification;
314
+ /** A fully-populated JSON representation of the default settings. A real `font` must be provided before use. */
286
315
  static defaultProps: DeepReadonlyObject<DeepRequiredObject<TextStyleSettingsProps>>;
287
316
  /** Settings initialized to all default values. */
288
317
  static defaults: TextStyleSettings;
289
318
  private constructor();
290
319
  /** Create a copy of these settings, modified according to the properties defined by `alteredProps`. */
291
320
  clone(alteredProps?: TextStyleSettingsProps): TextStyleSettings;
292
- /** Creates a deep copy of the `TextStyleSettingsProps`. */
293
- static cloneProps(props: TextStyleSettingsProps): TextStyleSettingsProps;
294
321
  /** Create settings from their JSON representation. */
295
322
  static fromJSON(props?: TextStyleSettingsProps): TextStyleSettings;
296
323
  toJSON(): TextStyleSettingsProps;
@@ -300,6 +327,7 @@ export declare class TextStyleSettings {
300
327
  */
301
328
  leaderEquals(other: TextLeaderStyleProps): boolean;
302
329
  frameEquals(other: TextFrameStyleProps): boolean;
330
+ marginsEqual(other: TextBlockMargins): boolean;
303
331
  equals(other: TextStyleSettings): boolean;
304
332
  /**
305
333
  * Returns a list of validation errors for this instance.
@@ -1 +1 @@
1
- {"version":3,"file":"TextStyle.d.ts","sourceRoot":"","sources":["../../../src/annotation/TextStyle.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAY,aAAa,EAAE,MAAM,aAAa,CAAC;AAEtD;;;GAGG;AACH,oBAAY,oBAAoB;IAC9B,uBAAuB;IACvB,MAAM,MAAM;IACZ,YAAY,MAAM;IAClB,MAAM,MAAM;IACZ,MAAM,WAAM;IACZ,MAAM,WAAM;IACZ,MAAM,WAAM;IACZ,cAAc;IACd,IAAI,WAAM;CACX;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,6GAA6G;IAC7G,UAAU,EAAE,oBAAoB,GAAG,MAAM,CAAC;IAC1C,gDAAgD;IAChD,UAAU,CAAC,EAAE,aAAa,GAAG,QAAQ,CAAC;IACtC,oJAAoJ;IACpJ,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;CAC1B;AAED;;EAEE;AACF,eAAO,MAAM,yBAAyB,+JAAgK,C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AAO;IAMlD,WAAW,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO;IAOhD,YAAY,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO;IAM9C,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO;IAgBhD;;;;;;;;;OASG;IACI,mBAAmB,IAAI,MAAM,EAAE;CAgBvC"}
@@ -6,6 +6,7 @@
6
6
  * @module Annotation
7
7
  */
8
8
  import { ColorDef } from "../ColorDef";
9
+ import { FontType } from "../Fonts";
9
10
  /** Predefined markers for list items in text annotations.
10
11
  * 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.
11
12
  * @beta
@@ -27,6 +28,7 @@ export var ListMarkerEnumerator;
27
28
  */
28
29
  export const textAnnotationFrameShapes = ["none", "line", "rectangle", "circle", "equilateralTriangle", "diamond", "square", "pentagon", "hexagon", "octagon", "capsule", "roundedRectangle"];
29
30
  ;
31
+ ;
30
32
  function deepFreeze(obj) {
31
33
  if (obj === null || typeof obj !== "object" || Object.isFrozen(obj))
32
34
  return;
@@ -47,20 +49,20 @@ function deepFreeze(obj) {
47
49
  export class TextStyleSettings {
48
50
  /** The color of the text. */
49
51
  color;
50
- /** The name of a font stored in an iModel, used to draw the contents of a [[TextRun]].
52
+ /** The font stored in an iModel, used to draw the contents of a [[TextRun]].
51
53
  */
52
- fontName;
53
- /** The height each line of text, in meters. Many other settings use the line height as the basis for computing their own values.
54
- * For example, the height and offset from baseline of a subscript [[TextRun]] are computed as lineHeight * [[subScriptScale]] and
55
- * lineHeight * [[subScriptOffsetFactor]], respectively.
54
+ font;
55
+ /** The height of the text, in meters. Many other settings use the text height as the basis for computing their own values.
56
+ * For example, the height and offset from baseline of a subscript [[TextRun]] are computed as textHeight * [[subScriptScale]] and
57
+ * textHeight * [[subScriptOffsetFactor]], respectively.
56
58
  */
57
- lineHeight;
59
+ textHeight;
58
60
  /** Multiplier used to compute the vertical distance between two lines of text.
59
- * The distance is computed in meters as lineSpacingFactor * [[lineHeight]].
61
+ * The distance is computed in meters as lineSpacingFactor * [[textHeight]] of the [[TextBlock]].
60
62
  */
61
63
  lineSpacingFactor;
62
64
  /** Multiplier used to compute the vertical distance between two paragraphs of text.
63
- * The distance is computed in meters as paragraphSpacingFactor * [[lineHeight]].
65
+ * The distance is computed in meters as paragraphSpacingFactor * the [[TextBlock]]'s [[textHeight]].
64
66
  */
65
67
  paragraphSpacingFactor;
66
68
  /** Specifies whether the content of a [[TextRun]] should be rendered **bold**. */
@@ -70,28 +72,28 @@ export class TextStyleSettings {
70
72
  /** Specifies whether the content of a [[TextRun]] should be underlined. */
71
73
  isUnderlined;
72
74
  /** Multiplier used to compute the height of both the numerator and denominator of a [[FractionRun]].
73
- * The height is computed in meters as stackedFractionScale * [[lineHeight]].
75
+ * The height is computed in meters as stackedFractionScale * [[textHeight]].
74
76
  */
75
77
  stackedFractionScale;
76
78
  /** Specifies how to separate the numerator and denominator of a [[FractionRun]]. */
77
79
  stackedFractionType;
78
80
  /** Multiplier used to compute the vertical offset from the baseline for a subscript [[TextRun]].
79
- * The offset is computed in meters as subScriptOffsetFactor * [[lineHeight]].
81
+ * The offset is computed in meters as subScriptOffsetFactor * [[textHeight]].
80
82
  */
81
83
  subScriptOffsetFactor;
82
84
  /** Multiplier used to compute the height of a subscript [[TextRun]].
83
- * The height is computed as subScriptScale * [[lineHeight]].
85
+ * The height is computed as subScriptScale * [[textHeight]].
84
86
  */
85
87
  subScriptScale;
86
88
  /** Multiplier used to compute the vertical offset from the baseline for a super [[TextRun]].
87
- * The offset is computed in meters as superScriptOffsetFactor * [[lineHeight]].
89
+ * The offset is computed in meters as superScriptOffsetFactor * [[textHeight]].
88
90
  */
89
91
  superScriptOffsetFactor;
90
92
  /** Multiplier used to compute the height of a superscript [[TextRun]].
91
- * The height is computed as superScriptScale * [[lineHeight]].
93
+ * The height is computed as superScriptScale * [[textHeight]].
92
94
  */
93
95
  superScriptScale;
94
- /** Multiplier used to compute the width of each glyph, relative to [[lineHeight]]. */
96
+ /** Multiplier used to compute the width of each glyph, relative to [[textHeight]]. */
95
97
  widthFactor;
96
98
  /** Properties describing appearance of leaders in a [[TextAnnotation]].
97
99
  * Used when producing geometry for [[TextAnnotation]].
@@ -116,11 +118,15 @@ export class TextStyleSettings {
116
118
  listMarker;
117
119
  /** The frame settings of the [[TextAnnotation]]. */
118
120
  frame;
119
- /** A fully-populated JSON representation of the default settings. A real `fontName` must be provided before use. */
121
+ /** The margins to surround the document content. */
122
+ margins;
123
+ /** The alignment of the text content. */
124
+ justification;
125
+ /** A fully-populated JSON representation of the default settings. A real `font` must be provided before use. */
120
126
  static defaultProps = {
121
127
  color: "subcategory",
122
- fontName: "",
123
- lineHeight: 1,
128
+ font: { name: "", type: FontType.TrueType },
129
+ textHeight: 1,
124
130
  lineSpacingFactor: 0.5,
125
131
  paragraphSpacingFactor: 0.5,
126
132
  isBold: false,
@@ -145,10 +151,17 @@ export class TextStyleSettings {
145
151
  listMarker: { enumerator: "1", terminator: "period", case: "lower" },
146
152
  frame: {
147
153
  shape: "none",
148
- fill: "none",
149
- border: ColorDef.black.toJSON(),
154
+ fillColor: "none",
155
+ borderColor: ColorDef.black.toJSON(),
150
156
  borderWeight: 1,
151
157
  },
158
+ margins: {
159
+ left: 0,
160
+ right: 0,
161
+ top: 0,
162
+ bottom: 0
163
+ },
164
+ justification: "left",
152
165
  };
153
166
  /** Settings initialized to all default values. */
154
167
  static defaults = new TextStyleSettings({});
@@ -157,8 +170,12 @@ export class TextStyleSettings {
157
170
  defaults = TextStyleSettings.defaultProps;
158
171
  }
159
172
  this.color = props.color ?? defaults.color;
160
- this.fontName = props.fontName ?? defaults.fontName;
161
- this.lineHeight = props.lineHeight ?? defaults.lineHeight;
173
+ const font = {
174
+ name: props.font?.name ?? defaults.font.name,
175
+ type: props.font?.type ?? defaults.font.type,
176
+ };
177
+ this.font = Object.freeze(font);
178
+ this.textHeight = props.textHeight ?? defaults.textHeight;
162
179
  this.lineSpacingFactor = props.lineSpacingFactor ?? defaults.lineSpacingFactor;
163
180
  this.paragraphSpacingFactor = props.paragraphSpacingFactor ?? defaults.paragraphSpacingFactor;
164
181
  this.isBold = props.isBold ?? defaults.isBold;
@@ -184,34 +201,30 @@ export class TextStyleSettings {
184
201
  this.listMarker = props.listMarker ?? defaults.listMarker;
185
202
  const frame = {
186
203
  shape: props.frame?.shape ?? defaults.frame.shape,
187
- fill: props.frame?.fill ?? defaults.frame.fill,
188
- border: props.frame?.border ?? defaults.frame.border,
204
+ fillColor: props.frame?.fillColor ?? defaults.frame.fillColor,
205
+ borderColor: props.frame?.borderColor ?? defaults.frame.borderColor,
189
206
  borderWeight: props.frame?.borderWeight ?? defaults.frame.borderWeight,
190
207
  };
191
208
  // Cast to indicate to TypeScript that the frame properties are all defined
192
209
  this.frame = Object.freeze(frame);
210
+ this.margins = Object.freeze({
211
+ left: props.margins?.left ?? defaults.margins.left,
212
+ right: props.margins?.right ?? defaults.margins.right,
213
+ top: props.margins?.top ?? defaults.margins.top,
214
+ bottom: props.margins?.bottom ?? defaults.margins.bottom,
215
+ });
216
+ this.justification = props.justification ?? defaults.justification;
193
217
  }
194
218
  /** Create a copy of these settings, modified according to the properties defined by `alteredProps`. */
195
219
  clone(alteredProps) {
196
220
  return alteredProps ? new TextStyleSettings(alteredProps, this) : this;
197
221
  }
198
- /** Creates a deep copy of the `TextStyleSettingsProps`. */
199
- static cloneProps(props) {
200
- const copy = { ...props };
201
- if (props.leader) {
202
- copy.leader = { ...props.leader };
203
- }
204
- if (props.frame) {
205
- copy.frame = { ...props.frame };
206
- }
207
- return copy;
208
- }
209
222
  /** Create settings from their JSON representation. */
210
223
  static fromJSON(props) {
211
224
  return props ? new TextStyleSettings(props) : TextStyleSettings.defaults;
212
225
  }
213
226
  toJSON() {
214
- return { ...this };
227
+ return structuredClone(this);
215
228
  }
216
229
  /** Compare two [[TextLeaderStyleProps]] for equality.
217
230
  * @param other The other leader style properties to compare against.
@@ -224,21 +237,27 @@ export class TextStyleSettings {
224
237
  }
225
238
  frameEquals(other) {
226
239
  return this.frame?.shape === other.shape
227
- && this.frame?.fill === other.fill
228
- && this.frame?.border === other.border
240
+ && this.frame?.fillColor === other.fillColor
241
+ && this.frame?.borderColor === other.borderColor
229
242
  && this.frame?.borderWeight === other.borderWeight;
230
243
  }
244
+ marginsEqual(other) {
245
+ return Object.entries(this.margins).every(([key, value]) => value === other[key]);
246
+ }
231
247
  equals(other) {
232
- return this.color === other.color && this.fontName === other.fontName
233
- && this.lineHeight === other.lineHeight && this.lineSpacingFactor === other.lineSpacingFactor && this.paragraphSpacingFactor === other.paragraphSpacingFactor && this.widthFactor === other.widthFactor
248
+ return this.color === other.color && this.font.name === other.font.name && this.font.type === other.font.type
249
+ && this.textHeight === other.textHeight && this.widthFactor === other.widthFactor
250
+ && this.lineSpacingFactor === other.lineSpacingFactor && this.paragraphSpacingFactor === other.paragraphSpacingFactor
234
251
  && this.isBold === other.isBold && this.isItalic === other.isItalic && this.isUnderlined === other.isUnderlined
235
252
  && this.stackedFractionType === other.stackedFractionType && this.stackedFractionScale === other.stackedFractionScale
236
253
  && this.subScriptOffsetFactor === other.subScriptOffsetFactor && this.subScriptScale === other.subScriptScale
237
254
  && this.superScriptOffsetFactor === other.superScriptOffsetFactor && this.superScriptScale === other.superScriptScale
238
255
  && this.tabInterval === other.tabInterval && this.indentation === other.indentation
239
256
  && this.listMarker.case === other.listMarker.case && this.listMarker.enumerator === other.listMarker.enumerator && this.listMarker.terminator === other.listMarker.terminator
257
+ && this.justification === other.justification
240
258
  && this.leaderEquals(other.leader)
241
- && this.frameEquals(other.frame);
259
+ && this.frameEquals(other.frame)
260
+ && this.marginsEqual(other.margins);
242
261
  }
243
262
  /**
244
263
  * Returns a list of validation errors for this instance.
@@ -252,11 +271,11 @@ export class TextStyleSettings {
252
271
  */
253
272
  getValidationErrors() {
254
273
  const errorMessages = [];
255
- if (this.fontName.trim() === "") {
256
- errorMessages.push("fontName must be provided");
274
+ if (this.font.name.trim() === "") {
275
+ errorMessages.push("font name must be provided");
257
276
  }
258
- if (this.lineHeight <= 0) {
259
- errorMessages.push("lineHeight must be greater than 0");
277
+ if (this.textHeight <= 0) {
278
+ errorMessages.push("textHeight must be greater than 0");
260
279
  }
261
280
  if (this.stackedFractionScale <= 0) {
262
281
  errorMessages.push("stackedFractionScale must be greater than 0");