@itwin/core-common 5.3.0-dev.2 → 5.3.0-dev.21
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/CHANGELOG.md +30 -1
- package/lib/cjs/ElementProps.d.ts +24 -6
- package/lib/cjs/ElementProps.d.ts.map +1 -1
- package/lib/cjs/ElementProps.js.map +1 -1
- package/lib/cjs/annotation/TextBlock.d.ts +4 -29
- package/lib/cjs/annotation/TextBlock.d.ts.map +1 -1
- package/lib/cjs/annotation/TextBlock.js +8 -35
- package/lib/cjs/annotation/TextBlock.js.map +1 -1
- package/lib/cjs/annotation/TextField.d.ts +4 -2
- package/lib/cjs/annotation/TextField.d.ts.map +1 -1
- package/lib/cjs/annotation/TextField.js.map +1 -1
- package/lib/cjs/annotation/TextStyle.d.ts +64 -36
- package/lib/cjs/annotation/TextStyle.d.ts.map +1 -1
- package/lib/cjs/annotation/TextStyle.js +63 -44
- package/lib/cjs/annotation/TextStyle.js.map +1 -1
- package/lib/esm/ElementProps.d.ts +24 -6
- package/lib/esm/ElementProps.d.ts.map +1 -1
- package/lib/esm/ElementProps.js.map +1 -1
- package/lib/esm/annotation/TextBlock.d.ts +4 -29
- package/lib/esm/annotation/TextBlock.d.ts.map +1 -1
- package/lib/esm/annotation/TextBlock.js +8 -35
- package/lib/esm/annotation/TextBlock.js.map +1 -1
- package/lib/esm/annotation/TextField.d.ts +4 -2
- package/lib/esm/annotation/TextField.d.ts.map +1 -1
- package/lib/esm/annotation/TextField.js.map +1 -1
- package/lib/esm/annotation/TextStyle.d.ts +64 -36
- package/lib/esm/annotation/TextStyle.d.ts.map +1 -1
- package/lib/esm/annotation/TextStyle.js +63 -44
- package/lib/esm/annotation/TextStyle.js.map +1 -1
- package/package.json +7 -7
|
@@ -65,7 +65,7 @@ export declare abstract class TextBlockComponent {
|
|
|
65
65
|
/** @internal */
|
|
66
66
|
protected constructor(props?: TextBlockComponentProps);
|
|
67
67
|
/** Deviations in individual properties of the [[TextStyleSettings]] in the [AnnotationTextStyle]($backend).
|
|
68
|
-
* For example, if the style uses the "Arial" font, you can override that by settings `styleOverrides.
|
|
68
|
+
* For example, if the style uses the "Arial" font, you can override that by settings `styleOverrides.font.name` to "Comic Sans".
|
|
69
69
|
* @see [[clearStyleOverrides]] to reset this to an empty object.
|
|
70
70
|
*/
|
|
71
71
|
get styleOverrides(): TextStyleSettingsProps;
|
|
@@ -265,13 +265,13 @@ export declare class FieldRun extends TextBlockComponent {
|
|
|
265
265
|
/** Discriminator field for the [[Run]] union. */
|
|
266
266
|
readonly type = "field";
|
|
267
267
|
/** The element and BIS class containing the property described by [[propertyPath]]. */
|
|
268
|
-
|
|
268
|
+
propertyHost: FieldPropertyHost;
|
|
269
269
|
/** Describes how to obtain the property value from [[propertyHost]]. */
|
|
270
|
-
|
|
270
|
+
propertyPath: FieldPropertyPath;
|
|
271
271
|
/** Specifies how to format the property value obtained from [[propertyPath]] into a string to be stored in [[cachedContent]].
|
|
272
272
|
* The specific options used depend upon the [[FieldPropertyType]].
|
|
273
273
|
*/
|
|
274
|
-
|
|
274
|
+
formatOptions?: FieldFormatOptions;
|
|
275
275
|
private _cachedContent;
|
|
276
276
|
/** The field's most recently evaluated display string. */
|
|
277
277
|
get cachedContent(): string;
|
|
@@ -339,23 +339,6 @@ export declare class List extends TextBlockComponent {
|
|
|
339
339
|
stringify(options?: TextBlockStringifyOptions, context?: TextBlockStringifyContext): string;
|
|
340
340
|
equals(other: TextBlockComponent): boolean;
|
|
341
341
|
}
|
|
342
|
-
/** Describes the relative alignment of the content of a [[TextBlock]].
|
|
343
|
-
* @beta
|
|
344
|
-
*/
|
|
345
|
-
export type TextBlockJustification = "left" | "center" | "right";
|
|
346
|
-
/** Describes the margins around the content inside a [[TextBlock]]. It's measured in meters.
|
|
347
|
-
* @beta
|
|
348
|
-
*/
|
|
349
|
-
export interface TextBlockMargins {
|
|
350
|
-
/** The left margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */
|
|
351
|
-
left: number;
|
|
352
|
-
/** The right margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */
|
|
353
|
-
right: number;
|
|
354
|
-
/** The top margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */
|
|
355
|
-
top: number;
|
|
356
|
-
/** The bottom margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */
|
|
357
|
-
bottom: number;
|
|
358
|
-
}
|
|
359
342
|
/** JSON representation of a [[TextBlock]].
|
|
360
343
|
* @beta
|
|
361
344
|
*/
|
|
@@ -365,10 +348,6 @@ export interface TextBlockProps extends TextBlockComponentProps {
|
|
|
365
348
|
* Default: 0
|
|
366
349
|
*/
|
|
367
350
|
width?: number;
|
|
368
|
-
/** The alignment of the document content. Default: "left". */
|
|
369
|
-
justification?: TextBlockJustification;
|
|
370
|
-
/** The margins to surround the document content. Default: 0 margins on all sides */
|
|
371
|
-
margins?: Partial<TextBlockMargins>;
|
|
372
351
|
children?: ParagraphProps[];
|
|
373
352
|
}
|
|
374
353
|
/** Represents a formatted text document consisting of a series of [[Paragraph]]s, each laid out on a separate line and containing their own content.
|
|
@@ -383,10 +362,6 @@ export declare class TextBlock extends TextBlockComponent {
|
|
|
383
362
|
* Default: 0
|
|
384
363
|
*/
|
|
385
364
|
width: number;
|
|
386
|
-
/** The alignment of the document's content. */
|
|
387
|
-
justification: TextBlockJustification;
|
|
388
|
-
/** The margins of the document. */
|
|
389
|
-
margins: TextBlockMargins;
|
|
390
365
|
private constructor();
|
|
391
366
|
clearStyleOverrides(options?: ClearTextStyleOptions): void;
|
|
392
367
|
toJSON(): TextBlockProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextBlock.d.ts","sourceRoot":"","sources":["../../../src/annotation/TextBlock.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAA2C,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1G,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,iBA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,MAAM,CAAC,GAAG,SAAS;IAIrE,mEAAmE;IACnE,IAAoB,OAAO,IAAI,OAAO,CAErC;IAEe,KAAK,IAAI,SAAS;IAIlC,qMAAqM;IAC9L,SAAS,CAAC,OAAO,CAAC,EAAE,yBAAyB,GAAG,MAAM;IAI7D;;;;OAIG;IACI,eAAe,CAAC,KAAK,CAAC,EAAE,cAAc,EAAE,YAAY,UAAQ,GAAG,SAAS;IAQ/E;;OAEG;IACI,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI;IAKhB,MAAM,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO;CAuB3D;AAED;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,CAAC;AAExE;;;;;;;GAOG;AACH,wBAAiB,0BAA0B,CAAC,MAAM,EAAE,4BAA4B,GAAG,gBAAgB,CAAC;IAAE,MAAM,EAAE,4BAA4B,CAAC;IAAC,KAAK,EAAE,IAAI,GAAG,SAAS,GAAG,GAAG,CAAA;CAAE,CAAC,CAO3K;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CA0BrE"}
|
|
@@ -24,17 +24,17 @@ export class TextBlockComponent {
|
|
|
24
24
|
_styleOverrides;
|
|
25
25
|
/** @internal */
|
|
26
26
|
constructor(props) {
|
|
27
|
-
this._styleOverrides =
|
|
27
|
+
this._styleOverrides = structuredClone(props?.styleOverrides ?? {});
|
|
28
28
|
}
|
|
29
29
|
/** Deviations in individual properties of the [[TextStyleSettings]] in the [AnnotationTextStyle]($backend).
|
|
30
|
-
* For example, if the style uses the "Arial" font, you can override that by settings `styleOverrides.
|
|
30
|
+
* For example, if the style uses the "Arial" font, you can override that by settings `styleOverrides.font.name` to "Comic Sans".
|
|
31
31
|
* @see [[clearStyleOverrides]] to reset this to an empty object.
|
|
32
32
|
*/
|
|
33
33
|
get styleOverrides() {
|
|
34
34
|
return this._styleOverrides;
|
|
35
35
|
}
|
|
36
36
|
set styleOverrides(overrides) {
|
|
37
|
-
this._styleOverrides =
|
|
37
|
+
this._styleOverrides = structuredClone(overrides);
|
|
38
38
|
}
|
|
39
39
|
/** Reset any [[styleOverrides]] applied to this component. */
|
|
40
40
|
clearStyleOverrides(_options) {
|
|
@@ -55,23 +55,14 @@ export class TextBlockComponent {
|
|
|
55
55
|
/** Convert this component to its JSON representation. */
|
|
56
56
|
toJSON() {
|
|
57
57
|
return {
|
|
58
|
-
styleOverrides:
|
|
58
|
+
styleOverrides: structuredClone(this.styleOverrides),
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
/** Returns true if `this` is equivalent to `other`. */
|
|
62
62
|
equals(other) {
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
for (const name of myKeys) {
|
|
69
|
-
const key = name;
|
|
70
|
-
if (this.styleOverrides[key] !== other.styleOverrides[key]) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return true;
|
|
63
|
+
const mySettings = TextStyleSettings.fromJSON(this.styleOverrides);
|
|
64
|
+
const otherSettings = TextStyleSettings.fromJSON(other.styleOverrides);
|
|
65
|
+
return mySettings.equals(otherSettings);
|
|
75
66
|
}
|
|
76
67
|
}
|
|
77
68
|
/** 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
|
|
@@ -439,7 +430,6 @@ export class List extends TextBlockComponent {
|
|
|
439
430
|
return (other instanceof List) && super.equals(other);
|
|
440
431
|
}
|
|
441
432
|
}
|
|
442
|
-
;
|
|
443
433
|
/** Represents a formatted text document consisting of a series of [[Paragraph]]s, each laid out on a separate line and containing their own content.
|
|
444
434
|
* No word-wrapping is applied to the document unless a [[width]] greater than zero is specified.
|
|
445
435
|
* @see [[TextAnnotation]] to position a text block as an annotation in 2d or 3d space.
|
|
@@ -452,21 +442,9 @@ export class TextBlock extends TextBlockComponent {
|
|
|
452
442
|
* Default: 0
|
|
453
443
|
*/
|
|
454
444
|
width;
|
|
455
|
-
/** The alignment of the document's content. */
|
|
456
|
-
justification;
|
|
457
|
-
/** The margins of the document. */
|
|
458
|
-
margins;
|
|
459
445
|
constructor(props) {
|
|
460
446
|
super(props);
|
|
461
447
|
this.width = props.width ?? 0;
|
|
462
|
-
this.justification = props.justification ?? "left";
|
|
463
|
-
// Assign default margins if not provided
|
|
464
|
-
this.margins = {
|
|
465
|
-
left: props.margins?.left ?? 0,
|
|
466
|
-
right: props.margins?.right ?? 0,
|
|
467
|
-
top: props.margins?.top ?? 0,
|
|
468
|
-
bottom: props.margins?.bottom ?? 0,
|
|
469
|
-
};
|
|
470
448
|
this.children = props?.children?.map((para) => Paragraph.create(para)) ?? [];
|
|
471
449
|
}
|
|
472
450
|
clearStyleOverrides(options) {
|
|
@@ -476,8 +454,6 @@ export class TextBlock extends TextBlockComponent {
|
|
|
476
454
|
return {
|
|
477
455
|
...super.toJSON(),
|
|
478
456
|
width: this.width,
|
|
479
|
-
justification: this.justification,
|
|
480
|
-
margins: this.margins,
|
|
481
457
|
children: this.children.map((x) => x.toJSON()),
|
|
482
458
|
};
|
|
483
459
|
}
|
|
@@ -522,12 +498,9 @@ export class TextBlock extends TextBlockComponent {
|
|
|
522
498
|
if (!super.equals(other)) {
|
|
523
499
|
return false;
|
|
524
500
|
}
|
|
525
|
-
if (this.width !== other.width
|
|
501
|
+
if (this.width !== other.width) {
|
|
526
502
|
return false;
|
|
527
503
|
}
|
|
528
|
-
const marginsAreEqual = Object.entries(this.margins).every(([key, value]) => value === other.margins[key]);
|
|
529
|
-
if (!marginsAreEqual)
|
|
530
|
-
return false;
|
|
531
504
|
if (this.children && other.children) {
|
|
532
505
|
if (this.children.length !== other.children.length) {
|
|
533
506
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextBlock.js","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AAE,CAAC;IAEzG,OAAO,GAAG,YAAY,GAAG,UAAU,EAAE,CAAC;AACxC,CAAC;AAED;;;;;GAKG;AACH,SAAS,cAAc,CAAC,GAAW;IACjC,MAAM,MAAM,GACV,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACzD,MAAM,OAAO,GACX,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IAC1E,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,OAAO,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;YACxB,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;YACpB,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,SAAS,cAAc,CAAC,GAAW;IACjC,MAAM,YAAY,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IACpC,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,EAAE,GAAG,YAAY,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Annotation\n */\n\nimport { ListMarker, ListMarkerEnumerator, TextStyleSettings, TextStyleSettingsProps } from \"./TextStyle\";\nimport { FieldFormatOptions, FieldPropertyHost, FieldPropertyPath } from \"./TextField\";\n\n/** Options supplied to [[TextBlockComponent.clearStyleOverrides]] to control how the style overrides are cleared on the component and its child components.\n * @beta\n */\nexport interface ClearTextStyleOptions {\n /** Controls whether the styleOverrides of any child components are retained.\n * By default, all overrides are cleared.\n */\n preserveChildrenOverrides?: boolean;\n}\n\n/** The JSON representation of a [[TextBlockComponent]].\n * @beta\n */\nexport interface TextBlockComponentProps {\n /** Deviations from the base [[TextStyleSettings]] defined by the [AnnotationTextStyle]($backend) applied to this component.\n * This permits you to, e.g., create a [[TextBlock]] using \"Arial\" font and override one of its [[TextRun]]s to use \"Comic Sans\" instead.\n */\n styleOverrides?: TextStyleSettingsProps;\n}\n\n/** Options supplied to [[TextBlockComponent.stringify]] to control how the content is formatted.\n * @beta\n */\nexport interface TextBlockStringifyOptions {\n /** A string to insert in between each [[Paragraph]].\n * Default: \" \" - a single space.\n */\n paragraphBreak?: string;\n /** A string to insert for each [[LineBreakRun]].\n * Default: \" \" - a single space.\n */\n lineBreak?: string;\n /** A string to insert between the numerator and denominator of each [[FractionRun]].\n * Default: \"/\"\n */\n fractionSeparator?: string;\n /** The number of spaces to use for tabs. If not provided, tabs will be represented by a tab character: \"\\t\".\n * Default: \"undefined\" - use \"\\t\".\n */\n tabsAsSpaces?: number;\n /** A string to insert in between the list marker and the list item.\n * Default: \" \" - a single space.\n */\n listMarkerBreak?: string;\n}\n\n/**\n * Context information that may be useful when converting a [[TextBlock]] to a string.\n * @beta\n */\nexport interface TextBlockStringifyContext {\n /** The current depth of the text block in the document structure. */\n depth: number;\n}\n\nfunction clearStyleOverrides(component: StructuralTextBlockComponent, options?: ClearTextStyleOptions): void {\n component.styleOverrides = {};\n if (!options?.preserveChildrenOverrides) {\n for (const child of component.children) {\n child.clearStyleOverrides(options);\n }\n }\n}\n\n/**\n * Abstract representation of any of the building blocks that make up a [[TextBlock]] document - namely [[Run]]s and [[StructuralTextBlockComponent]]s.\n * The [[TextBlock]] can specify an [AnnotationTextStyle]($backend) that formats its contents.\n * Each component can specify an optional [[styleOverrides]] to customize that formatting.\n * @beta\n */\nexport abstract class TextBlockComponent {\n private _styleOverrides: TextStyleSettingsProps;\n\n /** @internal */\n protected constructor(props?: TextBlockComponentProps) {\n this._styleOverrides = TextStyleSettings.cloneProps(props?.styleOverrides ?? {});\n }\n\n /** Deviations in individual properties of the [[TextStyleSettings]] in the [AnnotationTextStyle]($backend).\n * For example, if the style uses the \"Arial\" font, you can override that by settings `styleOverrides.fontName` to \"Comic Sans\".\n * @see [[clearStyleOverrides]] to reset this to an empty object.\n */\n public get styleOverrides(): TextStyleSettingsProps {\n return this._styleOverrides;\n }\n\n public set styleOverrides(overrides: TextStyleSettingsProps) {\n this._styleOverrides = TextStyleSettings.cloneProps(overrides);\n }\n\n /** Reset any [[styleOverrides]] applied to this component. */\n public clearStyleOverrides(_options?: ClearTextStyleOptions): void {\n this.styleOverrides = {};\n }\n\n /** Returns true if [[styleOverrides]] specifies any deviations from the [[TextBlock]]'s [AnnotationTextStyle]($backend). */\n public get overridesStyle(): boolean {\n return Object.keys(this.styleOverrides).length > 0;\n }\n\n /** Create a deep copy of this component. */\n public abstract clone(): TextBlockComponent;\n\n /** Compute a string representation of the contents of this component and all of its sub-components. */\n public abstract stringify(options?: TextBlockStringifyOptions, context?: TextBlockStringifyContext): string;\n\n /** Returns true if this component has no content or children. */\n public abstract get isEmpty(): boolean;\n\n /**\n * Returns true if the string representation of this component consists only of whitespace characters.\n * Useful for checking if the component is visually empty (producing no graphics) or contains only spaces, tabs, or line breaks.\n */\n public get isWhitespace(): boolean {\n return /^\\s*$/g.test(this.stringify());\n };\n\n /** Convert this component to its JSON representation. */\n public toJSON(): TextBlockComponentProps {\n return {\n styleOverrides: TextStyleSettings.cloneProps(this.styleOverrides),\n };\n }\n\n /** Returns true if `this` is equivalent to `other`. */\n public equals(other: TextBlockComponent): boolean {\n const myKeys = Object.keys(this.styleOverrides);\n const yrKeys = Object.keys(other._styleOverrides);\n if (myKeys.length !== yrKeys.length) {\n return false;\n }\n\n for (const name of myKeys) {\n const key = name as keyof TextStyleSettingsProps;\n if (this.styleOverrides[key] !== other.styleOverrides[key]) {\n return false;\n }\n }\n\n return true;\n }\n}\n\n/** [[TextBlockComponent]]s contained within a [[Paragraph]].\n * @beta\n */\nexport type Run = TextRun | FractionRun | TabRun | LineBreakRun | FieldRun;\n\n/** The JSON representation of a [[Run]].\n * Use the `type` field to discriminate between the different kinds of runs.\n * @beta\n */\nexport type RunProps = TextRunProps | FractionRunProps | TabRunProps | LineBreakRunProps | FieldRunProps;\n\n/** 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\n * multiple lines, but it will never contain different styling.\n * Use the `type` field to discriminate between the different kinds of runs.\n * @beta\n */\nexport namespace Run { // eslint-disable-line @typescript-eslint/no-redeclare\n /** Create a run from its JSON representation.\n * @see [[TextRun.create]], [[FractionRun.create]], [[FieldRun.create]], [[TabRun.create]], and [[LineBreakRun.create]] to create a run directly.\n */\n export function fromJSON(props: RunProps): Run {\n switch (props.type) {\n case \"field\": return FieldRun.create(props);\n case \"fraction\": return FractionRun.create(props);\n case \"linebreak\": return LineBreakRun.create(props);\n case \"tab\": return TabRun.create(props);\n case \"text\": return TextRun.create(props);\n }\n }\n}\n\n/** Describes whether the characters of a [[TextRun]] should be displayed normally, in subscript, or in superscript.\n * [[TextStyleSettings.superScriptScale]], [[TextStyleSettings.subScriptScale]], [[TextStyleSettings.superScriptOffsetFactor]], and [[TextStyleSettings.subScriptOffsetFactor]]\n * affect how the content is rendered.\n * @beta\n */\nexport type BaselineShift = \"subscript\" | \"superscript\" | \"none\";\n\n/** JSON representation of a [[TextRun]].\n * @beta\n */\nexport interface TextRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"text\";\n /** The characters displayed by the run.\n * Default: an empty string.\n */\n content?: string;\n /** Whether to display [[content]] as a subscript, superscript, or normally.\n * Default: \"none\"\n */\n baselineShift?: BaselineShift;\n}\n\n/** The most common type of [[Run]], containing a sequence of characters to be displayed using a single style.\n * @beta\n */\nexport class TextRun extends TextBlockComponent {\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"text\";\n /** The sequence of characters to be displayed by the run. */\n public content: string;\n /** Whether to display [[content]] as a subscript, superscript, or normally. */\n public baselineShift: BaselineShift;\n\n private constructor(props: TextRunProps) {\n super(props);\n this.content = props?.content ?? \"\";\n this.baselineShift = props?.baselineShift ?? \"none\";\n }\n\n public override clone(): TextRun {\n return new TextRun(this.toJSON());\n }\n\n public override toJSON(): TextRunProps {\n return {\n ...super.toJSON(),\n type: \"text\",\n content: this.content,\n baselineShift: this.baselineShift,\n };\n }\n\n public static create(props?: Omit<TextRunProps, \"type\">): TextRun {\n return new TextRun({ ...props, type: \"text\" });\n }\n\n public override get isEmpty(): boolean {\n return this.stringify().length === 0;\n }\n\n /** Simply returns [[content]]. */\n public override stringify(): string {\n return this.content;\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return other instanceof TextRun && this.content === other.content && this.baselineShift === other.baselineShift && super.equals(other);\n }\n}\n\n/** JSON representation of a [[FractionRun]].\n * @beta\n */\nexport interface FractionRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"fraction\";\n /** The text displayed before or above the fraction separator, depending on [[TextStyleSettings.stackedFractionType]]. Default: an empty string. */\n numerator?: string;\n /** The text displayed after or below the fraction separator, depending on [[TextStyleSettings.stackedFractionType]]. Default: an empty string. */\n denominator?: string;\n}\n\n/** A [[Run]] containing a numeric ratio to be displayed as a numerator and denominator separated by a horizontal or diagonal bar.\n * @note The [[numerator]] and [[denominator]] are stored as strings. They are not technically required to contain a numeric representation.\n * @beta\n */\nexport class FractionRun extends TextBlockComponent {\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"fraction\";\n /** The fraction's numerator. */\n public numerator: string;\n /** The fraction's denominator. */\n public denominator: string;\n\n private constructor(props: FractionRunProps) {\n super(props);\n this.numerator = props?.numerator ?? \"\";\n this.denominator = props?.denominator ?? \"\";\n }\n\n public override toJSON(): FractionRunProps {\n return {\n ...super.toJSON(),\n type: \"fraction\",\n numerator: this.numerator,\n denominator: this.denominator,\n };\n }\n\n public override clone(): FractionRun {\n return new FractionRun(this.toJSON());\n }\n\n public static create(props?: Omit<FractionRunProps, \"type\">): FractionRun {\n return new FractionRun({ ...props, type: \"fraction\" });\n }\n\n public override get isEmpty(): boolean {\n return this.stringify().length === 0;\n }\n\n /** Formats the fraction as a string with the [[numerator]] and [[denominator]] separated by [[TextBlockStringifyOptions.fractionSeparator]]. */\n public override stringify(options?: TextBlockStringifyOptions): string {\n const sep = options?.fractionSeparator ?? \"/\";\n return `${this.numerator}${sep}${this.denominator}`;\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return other instanceof FractionRun && this.numerator === other.numerator && this.denominator === other.denominator && super.equals(other);\n }\n}\n\n/** JSON representation of a [[LineBreakRun]].\n * @beta\n */\nexport interface LineBreakRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"linebreak\";\n}\n\n/** A [[Run]] that represents the end of a line of text within a [[Paragraph]]. It contains no content of its own - it simply causes subsequent content to display on a new line.\n * @beta\n */\nexport class LineBreakRun extends TextBlockComponent {\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"linebreak\";\n\n private constructor(props: LineBreakRunProps) {\n super(props);\n }\n\n public override toJSON(): LineBreakRunProps {\n return {\n ...super.toJSON(),\n type: \"linebreak\",\n };\n }\n\n public static create(props?: Omit<LineBreakRunProps, \"type\">) {\n return new LineBreakRun({ ...props, type: \"linebreak\" });\n }\n\n public override clone(): LineBreakRun {\n return new LineBreakRun(this.toJSON());\n }\n\n public override get isEmpty(): boolean {\n return this.stringify().length === 0;\n }\n\n /** Simply returns [[TextBlockStringifyOptions.lineBreak]]. */\n public override stringify(options?: TextBlockStringifyOptions): string {\n return options?.lineBreak ?? \" \";\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return other instanceof LineBreakRun && super.equals(other);\n }\n}\n\n/** JSON representation of a [[TabRun]].\n * @beta\n */\nexport interface TabRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"tab\";\n}\n\n/** A [[TabRun]] is used to shift the next tab stop.\n * @note Only left-justified tabs are supported at this tab.\n * @beta\n */\nexport class TabRun extends TextBlockComponent {\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"tab\";\n\n public override toJSON(): TabRunProps {\n return {\n ...super.toJSON(),\n type: \"tab\",\n };\n }\n\n public override clone(): TabRun {\n return new TabRun(this.toJSON());\n }\n\n public static create(props?: Omit<TabRunProps, \"type\">): TabRun {\n return new TabRun(props);\n }\n\n public override get isEmpty(): boolean {\n return this.stringify().length === 0;\n }\n\n /**\n * Converts a [[TabRun]] to its string representation.\n * If the `tabsAsSpaces` option is provided, returns a string of spaces of the specified length.\n * Otherwise, returns a tab character (\"\\t\").\n */\n public override stringify(options?: TextBlockStringifyOptions): string {\n if (options?.tabsAsSpaces) {\n return \" \".repeat(options.tabsAsSpaces);\n }\n\n return \"\\t\";\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return other instanceof TabRun && super.equals(other);\n }\n}\n\n/** JSON representation of a [[FieldRun]].\n * @beta\n */\nexport interface FieldRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"field\";\n /** The element and BIS class containing the property described by [[propertyPath]]. */\n propertyHost: FieldPropertyHost;\n /** Describes how to obtain the property value from [[propertyHost]]. */\n propertyPath: FieldPropertyPath;\n /** Specifies how to format the property value obtained from [[propertyPath]] into a string to be stored in [[cachedContent]].\n * The specific options used depend upon the field's [[propertyType]].\n */\n formatOptions?: FieldFormatOptions;\n /** The field's most recently evaluated display string.\n * @note It is unnecessary to specify this when creating a field as part of an element like a [[TextAnnotation2d]], because\n * all of the element's fields will be re-evaluated when inserting or updating the element in the iModel.\n */\n cachedContent?: string;\n}\n\n/** A [[Run]] that displays the formatted value of a property of some [Element]($backend).\n * When a [[TextBlock]] containing a [[FieldRun]] is written into the iModel as an [ITextAnnotation]($backend) element,\n * a dependency is established between the two elements via the [ElementDrivesTextAnnotation]($backend) relationship such that\n * whenever the source element specified by [[propertyHost]] is modified or the `ITextAnnotation` element is inserted or updated in the iModel,\n * the field(s) in the `ITextAnnotation` element are automatically\n * recalculated, causing their [[cachedContent]] to update. If the field's display string cannot be evaluated (for example, because the specified element or\n * property does not exist), then its cached content is set to [[FieldRun.invalidContentIndicator]].\n * A [[FieldRun]] displays its [[cachedContent]] in the same way that [[TextRun]]s display their `content`, including word wrapping where appropriate.\n * @beta\n */\nexport class FieldRun extends TextBlockComponent {\n /** Display string used to signal an error in computing the field's value. */\n public static invalidContentIndicator = \"####\";\n\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"field\";\n /** The element and BIS class containing the property described by [[propertyPath]]. */\n public readonly propertyHost: Readonly<FieldPropertyHost>;\n /** Describes how to obtain the property value from [[propertyHost]]. */\n public readonly propertyPath: Readonly<FieldPropertyPath>;\n /** Specifies how to format the property value obtained from [[propertyPath]] into a string to be stored in [[cachedContent]].\n * The specific options used depend upon the [[FieldPropertyType]].\n */\n public readonly formatOptions?: FieldFormatOptions;\n private _cachedContent: string;\n\n /** The field's most recently evaluated display string. */\n public get cachedContent(): string {\n return this._cachedContent;\n }\n\n /** @internal Used by core-backend when re-evaluating field content. */\n public setCachedContent(content: string | undefined): void {\n this._cachedContent = content ?? FieldRun.invalidContentIndicator;\n }\n\n private constructor(props: FieldRunProps) {\n super(props);\n\n this._cachedContent = props.cachedContent ?? FieldRun.invalidContentIndicator;\n this.propertyHost = props.propertyHost\n this.propertyPath = props.propertyPath;\n this.formatOptions = props.formatOptions;\n }\n\n /** Create a FieldRun from its JSON representation. */\n public static create(props: Omit<FieldRunProps, \"type\">): FieldRun {\n return new FieldRun({\n ...props,\n propertyHost: { ...props.propertyHost },\n propertyPath: structuredClone(props.propertyPath),\n formatOptions: structuredClone(props.formatOptions),\n type: \"field\",\n });\n }\n\n /** Convert the FieldRun to its JSON representation. */\n public override toJSON(): FieldRunProps {\n const json: FieldRunProps = {\n ...super.toJSON(),\n type: \"field\",\n propertyHost: { ...this.propertyHost },\n propertyPath: structuredClone(this.propertyPath),\n };\n\n if (this.cachedContent !== FieldRun.invalidContentIndicator) {\n json.cachedContent = this.cachedContent;\n }\n\n if (this.formatOptions) {\n json.formatOptions = structuredClone(this.formatOptions);\n }\n\n return json;\n }\n\n /** Create a deep copy of this FieldRun. */\n public override clone(): FieldRun {\n return new FieldRun(this.toJSON());\n }\n\n public override get isEmpty(): boolean {\n return this.stringify().length === 0;\n }\n\n /** Convert this FieldRun to a simple string representation. */\n public override stringify(): string {\n return this.cachedContent;\n }\n\n /** Returns true if `this` is equivalent to `other`. */\n public override equals(other: TextBlockComponent): boolean {\n if (!(other instanceof FieldRun) || !super.equals(other)) {\n return false;\n }\n\n if (\n this.propertyHost.elementId !== other.propertyHost.elementId ||\n this.propertyHost.className !== other.propertyHost.className ||\n this.propertyHost.schemaName !== other.propertyHost.schemaName\n ) {\n return false;\n }\n\n if (this.propertyPath.propertyName !== other.propertyPath.propertyName) {\n return false;\n }\n\n const thisAccessors = this.propertyPath.accessors ?? [];\n const otherAccessors = other.propertyPath.accessors ?? [];\n\n if (thisAccessors.length !== otherAccessors.length) {\n return false;\n }\n\n if (!thisAccessors.every((value, index) => value === otherAccessors[index])) {\n return false;\n }\n\n if (this.formatOptions && other.formatOptions) {\n // We anticipate new formatting options being added in the future.\n // So to account for properties we don't know about, just compare the string representations.\n if (JSON.stringify(this.formatOptions) !== JSON.stringify(other.formatOptions)) {\n return false;\n }\n } else if (this.formatOptions || other.formatOptions) {\n return false;\n }\n\n return true;\n }\n}\n\n/** JSON representation of a [[Paragraph]].\n * @beta\n */\nexport interface ParagraphProps extends TextBlockComponentProps {\n children?: Array<ListProps | RunProps>;\n}\n\n/** A collection of [[Run]]s and [[List]]s. Paragraphs can be appended to [[List]]s and [[TextBlock]]s.\n * Each paragraph is laid out on a separate line. If included in a [[List]], the paragraph will be treated as a list item.\n * @beta\n */\nexport class Paragraph extends TextBlockComponent {\n public readonly type = \"paragraph\";\n public readonly children: Array<List | Run>;\n\n private constructor(props?: ParagraphProps) {\n super(props);\n\n this.children = props?.children?.map((child) =>\n child.type === \"list\" ? List.create(child) : Run.fromJSON(child)\n ) ?? [];\n }\n\n /** Create a paragraph from its JSON representation. */\n public static create(props?: Omit<ParagraphProps, \"type\">): Paragraph {\n return new Paragraph(props);\n }\n\n public override clearStyleOverrides(options?: ClearTextStyleOptions): void {\n clearStyleOverrides(this, options);\n }\n\n public override get isEmpty() {\n return this.children.length === 0;\n }\n\n public override clone(): Paragraph {\n return new Paragraph(this.toJSON());\n }\n\n public override toJSON(): ParagraphProps {\n return {\n ...super.toJSON(),\n children: this.children.map((child) => child.toJSON()),\n };\n }\n\n /** Compute a string representation of this paragraph by concatenating the string representations of all of its children. */\n public override stringify(options?: TextBlockStringifyOptions, context?: TextBlockStringifyContext): string {\n return this.children.map((x, index) => (index > 0 && x.type === \"list\") ? `${options?.paragraphBreak ?? \" \"}${x.stringify(options, context)}` : x.stringify(options, context)).join(\"\") ?? \"\";\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return (other instanceof Paragraph) && super.equals(other);\n }\n}\n\n/** JSON representation of a [[List]].\n * @beta\n */\nexport interface ListProps extends TextBlockComponentProps {\n readonly type: \"list\";\n children?: ParagraphProps[];\n}\n\n/** A collection of list items ([[Paragraph]]s). Lists can be appended to [[Paragraph]]s.\n * Lists will be laid out on a new line. Each item in a list is laid out on a separate line.\n * @beta\n */\nexport class List extends TextBlockComponent {\n public readonly type = \"list\";\n public readonly children: Paragraph[];\n\n protected constructor(props?: ListProps) {\n super(props);\n\n this.children = props?.children?.map((child) => Paragraph.create(child)) ?? [];\n }\n\n /** Create a list from its JSON representation. */\n public static create(props?: Omit<ListProps, \"type\">): List {\n return new List({ ...props, type: \"list\" });\n }\n\n public override clearStyleOverrides(options?: ClearTextStyleOptions): void {\n clearStyleOverrides(this, options);\n }\n\n public override get isEmpty() {\n return this.children.length === 0;\n }\n\n public override clone(): List {\n return new List(this.toJSON());\n }\n\n public override toJSON(): ListProps {\n return {\n ...super.toJSON(),\n type: \"list\",\n children: this.children.map((run) => run.toJSON()),\n };\n }\n\n /** Compute a string representation of this list by concatenating the string representations of all of its [[children]]. */\n public override stringify(options?: TextBlockStringifyOptions, context?: TextBlockStringifyContext): string {\n const children = this.children.map((x, index) => {\n const depth = context?.depth ?? 0;\n const marker = getMarkerText(this.styleOverrides.listMarker ?? TextStyleSettings.defaultProps.listMarker, index + 1);\n const tab = (options?.tabsAsSpaces ? \" \".repeat(options.tabsAsSpaces) : \"\\t\").repeat(depth);\n return `${tab}${marker}${options?.listMarkerBreak ?? \" \"}${x.stringify(options, { depth: depth + 1 })}`;\n });\n return children.join(options?.paragraphBreak ?? \" \") ?? \"\";\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return (other instanceof List) && super.equals(other);\n }\n}\n\n\n/** Describes the relative alignment of the content of a [[TextBlock]].\n * @beta\n */\nexport type TextBlockJustification = \"left\" | \"center\" | \"right\";\n\n/** Describes the margins around the content inside a [[TextBlock]]. It's measured in meters.\n * @beta\n */\nexport interface TextBlockMargins {\n /** The left margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n left: number;\n /** The right margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n right: number;\n /** The top margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n top: number;\n /** The bottom margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n bottom: number;\n};\n\n/** JSON representation of a [[TextBlock]].\n * @beta\n */\nexport interface TextBlockProps extends TextBlockComponentProps {\n /** The width of the document in meters. Lines that would exceed this width are instead wrapped around to the next line if possible.\n * A value less than or equal to zero indicates no wrapping is to be applied.\n * Default: 0\n */\n width?: number;\n /** The alignment of the document content. Default: \"left\". */\n justification?: TextBlockJustification;\n /** The margins to surround the document content. Default: 0 margins on all sides */\n margins?: Partial<TextBlockMargins>;\n children?: ParagraphProps[];\n}\n\n/** Represents a formatted text document consisting of a series of [[Paragraph]]s, each laid out on a separate line and containing their own content.\n * No word-wrapping is applied to the document unless a [[width]] greater than zero is specified.\n * @see [[TextAnnotation]] to position a text block as an annotation in 2d or 3d space.\n * @beta\n */\nexport class TextBlock extends TextBlockComponent {\n public readonly children: Paragraph[];\n\n /** The width of the document in meters. Lines that would exceed this width are instead wrapped around to the next line if possible.\n * A value less than or equal to zero indicates no wrapping is to be applied.\n * Default: 0\n */\n public width: number;\n /** The alignment of the document's content. */\n public justification: TextBlockJustification;\n /** The margins of the document. */\n public margins: TextBlockMargins;\n\n private constructor(props: TextBlockProps) {\n super(props);\n this.width = props.width ?? 0;\n this.justification = props.justification ?? \"left\";\n\n // Assign default margins if not provided\n this.margins = {\n left: props.margins?.left ?? 0,\n right: props.margins?.right ?? 0,\n top: props.margins?.top ?? 0,\n bottom: props.margins?.bottom ?? 0,\n };\n\n this.children = props?.children?.map((para) => Paragraph.create(para)) ?? [];\n }\n\n public override clearStyleOverrides(options?: ClearTextStyleOptions): void {\n clearStyleOverrides(this, options);\n }\n\n public override toJSON(): TextBlockProps {\n return {\n ...super.toJSON(),\n width: this.width,\n justification: this.justification,\n margins: this.margins,\n children: this.children.map((x) => x.toJSON()),\n };\n }\n\n /** Create a text block from its JSON representation. */\n public static create(props?: Omit<TextBlockProps, \"type\">): TextBlock {\n return new TextBlock(props ?? {});\n }\n\n /** Returns true if every paragraph in this text block is empty. */\n public override get isEmpty(): boolean {\n return !this.children || this.children.every((child) => child.isEmpty);\n }\n\n public override clone(): TextBlock {\n return new TextBlock(this.toJSON());\n }\n\n /** Compute a string representation of the document's contents by concatenating the string representations of each of its [[children]], separated by [[TextBlockStringifyOptions.paragraphBreak]]. */\n public stringify(options?: TextBlockStringifyOptions): string {\n return this.children.map((x) => x.stringify(options)).join(options?.paragraphBreak ?? \" \") || \"\";\n }\n\n /** Add and return a new paragraph.\n * By default, the paragraph will be created with no [[styleOverrides]], so that it inherits the style of this block.\n * @param seedFromLast If true and [[children]] is not empty, the new paragraph will inherit the style overrides of the last child in this block.\n * @note Be sure you pass in [[ParagraphProps]] and not [[Paragraph]] or style overrides will be ignored.\n */\n public appendParagraph(props?: ParagraphProps, seedFromLast = false): Paragraph {\n const seed = seedFromLast ? this.children[this.children.length - 1] : undefined;\n const styleOverrides = { ...seed?.styleOverrides, ...props?.styleOverrides };\n const paragraph = Paragraph.create({ ...props, styleOverrides });\n this.children.push(paragraph);\n return paragraph;\n }\n\n /** Append a run to the last [[Paragraph]] in this block.\n * If the block contains no [[children]], a new [[Paragraph]] will first be created using [[appendParagraph]].\n */\n public appendRun(run: Run): void {\n const paragraph = this.children[this.children.length - 1] ?? this.appendParagraph();\n paragraph.children.push(run);\n }\n\n public override equals(other: TextBlockComponent): boolean {\n if (!(other instanceof TextBlock)) {\n return false;\n }\n\n if (!super.equals(other)) {\n return false;\n }\n\n if (this.width !== other.width || this.justification !== other.justification) {\n return false;\n }\n\n const marginsAreEqual = Object.entries(this.margins).every(([key, value]) =>\n value === (other.margins as any)[key]\n );\n\n if (!marginsAreEqual) return false;\n\n if (this.children && other.children) {\n if (this.children.length !== other.children.length) {\n return false;\n }\n\n return this.children.every((child, index) => other.children && child.equals(other.children[index]));\n }\n\n return true;\n }\n}\n\n/**\n * A union of all the [[TextBlockComponent]]s that can contain other components.\n * @beta\n */\nexport type StructuralTextBlockComponent = List | Paragraph | TextBlock;\n\n/**\n * Recursively traverses a [[StructuralTextBlockComponent]] tree, yielding each child component along with its parent container.\n * This generator enables depth-first iteration over all components in a text block structure, including paragraphs, lists, and runs.\n *\n * @param parent The root container whose children should be traversed.\n * @returns An IterableIterator yielding objects with the child component and its parent container.\n * @beta\n */\nexport function* traverseTextBlockComponent(parent: StructuralTextBlockComponent): IterableIterator<{ parent: StructuralTextBlockComponent, child: List | Paragraph | Run }> {\n for (const child of parent.children) {\n yield { parent, child };\n if (child.type === \"list\" || child.type === \"paragraph\") {\n yield* traverseTextBlockComponent(child);\n }\n }\n}\n\n/**\n * Returns the formatted marker text for a list item based on the marker type and item number.\n * Supports ordered and unordered list markers, including alphabetic, Roman numeral, and numeric formats.\n * @param marker The type of list marker to use.\n * @param num The item number in the list.\n * @returns The formatted marker string for the list item.\n * @beta\n */\nexport function getMarkerText(marker: ListMarker, num: number): string {\n let markerString = \"\";\n\n switch (marker.enumerator) {\n case undefined:\n case ListMarkerEnumerator.Number:\n markerString = `${num}`;\n break;\n case ListMarkerEnumerator.Letter:\n markerString = integerToAlpha(num);\n break;\n case ListMarkerEnumerator.RomanNumeral:\n markerString = integerToRoman(num);\n break;\n default:\n markerString = marker.enumerator;\n break;\n }\n\n if (marker.case) {\n markerString = marker.case === \"upper\" ? markerString.toUpperCase() : markerString.toLowerCase();\n }\n\n const terminator = marker.terminator === \"period\" ? \".\" : marker.terminator === \"parenthesis\" ? \")\" : \"\";\n\n return `${markerString}${terminator}`;\n}\n\n/**\n * Converts an integer to its Roman numeral representation.\n * Supports numbers from 1 and above.\n * @param num The integer to convert.\n * @returns The Roman numeral string.\n */\nfunction integerToRoman(num: number): string {\n const values =\n [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];\n const symbols =\n ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'];\n let roman = '';\n for (let i = 0; i < values.length; i++) {\n while (num >= values[i]) {\n roman += symbols[i];\n num -= values[i];\n }\n }\n\n return roman;\n}\n\n/**\n * Converts an integer to its alphabetic representation (A-Z, AA-ZZ, etc.).\n * Used for ordered list markers with alphabetic styles.\n * @param num The integer to convert (1-based).\n * @returns The alphabetic string for the given number.\n */\nfunction integerToAlpha(num: number): string {\n const letterOffset = (num - 1) % 26;\n const letter = String.fromCharCode(65 + letterOffset);\n const depth = Math.ceil(num / 26);\n return letter.repeat(depth);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TextBlock.js","sourceRoot":"","sources":["../../../src/annotation/TextBlock.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAc,oBAAoB,EAAE,iBAAiB,EAA0B,MAAM,aAAa,CAAC;AA0D1G,SAAS,mBAAmB,CAAC,SAAuC,EAAE,OAA+B;IACnG,SAAS,CAAC,cAAc,GAAG,EAAE,CAAC;IAC9B,IAAI,CAAC,OAAO,EAAE,yBAAyB,EAAE,CAAC;QACxC,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;YACvC,KAAK,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAgB,kBAAkB;IAC9B,eAAe,CAAyB;IAEhD,gBAAgB;IAChB,YAAsB,KAA+B;QACnD,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC,KAAK,EAAE,cAAc,IAAI,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACH,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,IAAW,cAAc,CAAC,SAAiC;QACzD,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;IAED,8DAA8D;IACvD,mBAAmB,CAAC,QAAgC;QACzD,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;IAC3B,CAAC;IAED,4HAA4H;IAC5H,IAAW,cAAc;QACvB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,C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,CAAC,CAAC,GAAG,EAAE,CAAC;IACpC,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,EAAE,GAAG,YAAY,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Annotation\n */\n\nimport { ListMarker, ListMarkerEnumerator, TextStyleSettings, TextStyleSettingsProps } from \"./TextStyle\";\nimport { FieldFormatOptions, FieldPropertyHost, FieldPropertyPath } from \"./TextField\";\n\n/** Options supplied to [[TextBlockComponent.clearStyleOverrides]] to control how the style overrides are cleared on the component and its child components.\n * @beta\n */\nexport interface ClearTextStyleOptions {\n /** Controls whether the styleOverrides of any child components are retained.\n * By default, all overrides are cleared.\n */\n preserveChildrenOverrides?: boolean;\n}\n\n/** The JSON representation of a [[TextBlockComponent]].\n * @beta\n */\nexport interface TextBlockComponentProps {\n /** Deviations from the base [[TextStyleSettings]] defined by the [AnnotationTextStyle]($backend) applied to this component.\n * This permits you to, e.g., create a [[TextBlock]] using \"Arial\" font and override one of its [[TextRun]]s to use \"Comic Sans\" instead.\n */\n styleOverrides?: TextStyleSettingsProps;\n}\n\n/** Options supplied to [[TextBlockComponent.stringify]] to control how the content is formatted.\n * @beta\n */\nexport interface TextBlockStringifyOptions {\n /** A string to insert in between each [[Paragraph]].\n * Default: \" \" - a single space.\n */\n paragraphBreak?: string;\n /** A string to insert for each [[LineBreakRun]].\n * Default: \" \" - a single space.\n */\n lineBreak?: string;\n /** A string to insert between the numerator and denominator of each [[FractionRun]].\n * Default: \"/\"\n */\n fractionSeparator?: string;\n /** The number of spaces to use for tabs. If not provided, tabs will be represented by a tab character: \"\\t\".\n * Default: \"undefined\" - use \"\\t\".\n */\n tabsAsSpaces?: number;\n /** A string to insert in between the list marker and the list item.\n * Default: \" \" - a single space.\n */\n listMarkerBreak?: string;\n}\n\n/**\n * Context information that may be useful when converting a [[TextBlock]] to a string.\n * @beta\n */\nexport interface TextBlockStringifyContext {\n /** The current depth of the text block in the document structure. */\n depth: number;\n}\n\nfunction clearStyleOverrides(component: StructuralTextBlockComponent, options?: ClearTextStyleOptions): void {\n component.styleOverrides = {};\n if (!options?.preserveChildrenOverrides) {\n for (const child of component.children) {\n child.clearStyleOverrides(options);\n }\n }\n}\n\n/**\n * Abstract representation of any of the building blocks that make up a [[TextBlock]] document - namely [[Run]]s and [[StructuralTextBlockComponent]]s.\n * The [[TextBlock]] can specify an [AnnotationTextStyle]($backend) that formats its contents.\n * Each component can specify an optional [[styleOverrides]] to customize that formatting.\n * @beta\n */\nexport abstract class TextBlockComponent {\n private _styleOverrides: TextStyleSettingsProps;\n\n /** @internal */\n protected constructor(props?: TextBlockComponentProps) {\n this._styleOverrides = structuredClone(props?.styleOverrides ?? {});\n }\n\n /** Deviations in individual properties of the [[TextStyleSettings]] in the [AnnotationTextStyle]($backend).\n * For example, if the style uses the \"Arial\" font, you can override that by settings `styleOverrides.font.name` to \"Comic Sans\".\n * @see [[clearStyleOverrides]] to reset this to an empty object.\n */\n public get styleOverrides(): TextStyleSettingsProps {\n return this._styleOverrides;\n }\n\n public set styleOverrides(overrides: TextStyleSettingsProps) {\n this._styleOverrides = structuredClone(overrides);\n }\n\n /** Reset any [[styleOverrides]] applied to this component. */\n public clearStyleOverrides(_options?: ClearTextStyleOptions): void {\n this.styleOverrides = {};\n }\n\n /** Returns true if [[styleOverrides]] specifies any deviations from the [[TextBlock]]'s [AnnotationTextStyle]($backend). */\n public get overridesStyle(): boolean {\n return Object.keys(this.styleOverrides).length > 0;\n }\n\n /** Create a deep copy of this component. */\n public abstract clone(): TextBlockComponent;\n\n /** Compute a string representation of the contents of this component and all of its sub-components. */\n public abstract stringify(options?: TextBlockStringifyOptions, context?: TextBlockStringifyContext): string;\n\n /** Returns true if this component has no content or children. */\n public abstract get isEmpty(): boolean;\n\n /**\n * Returns true if the string representation of this component consists only of whitespace characters.\n * Useful for checking if the component is visually empty (producing no graphics) or contains only spaces, tabs, or line breaks.\n */\n public get isWhitespace(): boolean {\n return /^\\s*$/g.test(this.stringify());\n };\n\n /** Convert this component to its JSON representation. */\n public toJSON(): TextBlockComponentProps {\n return {\n styleOverrides: structuredClone(this.styleOverrides),\n };\n }\n\n /** Returns true if `this` is equivalent to `other`. */\n public equals(other: TextBlockComponent): boolean {\n const mySettings = TextStyleSettings.fromJSON(this.styleOverrides);\n const otherSettings = TextStyleSettings.fromJSON(other.styleOverrides);\n return mySettings.equals(otherSettings);\n }\n}\n\n/** [[TextBlockComponent]]s contained within a [[Paragraph]].\n * @beta\n */\nexport type Run = TextRun | FractionRun | TabRun | LineBreakRun | FieldRun;\n\n/** The JSON representation of a [[Run]].\n * Use the `type` field to discriminate between the different kinds of runs.\n * @beta\n */\nexport type RunProps = TextRunProps | FractionRunProps | TabRunProps | LineBreakRunProps | FieldRunProps;\n\n/** 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\n * multiple lines, but it will never contain different styling.\n * Use the `type` field to discriminate between the different kinds of runs.\n * @beta\n */\nexport namespace Run { // eslint-disable-line @typescript-eslint/no-redeclare\n /** Create a run from its JSON representation.\n * @see [[TextRun.create]], [[FractionRun.create]], [[FieldRun.create]], [[TabRun.create]], and [[LineBreakRun.create]] to create a run directly.\n */\n export function fromJSON(props: RunProps): Run {\n switch (props.type) {\n case \"field\": return FieldRun.create(props);\n case \"fraction\": return FractionRun.create(props);\n case \"linebreak\": return LineBreakRun.create(props);\n case \"tab\": return TabRun.create(props);\n case \"text\": return TextRun.create(props);\n }\n }\n}\n\n/** Describes whether the characters of a [[TextRun]] should be displayed normally, in subscript, or in superscript.\n * [[TextStyleSettings.superScriptScale]], [[TextStyleSettings.subScriptScale]], [[TextStyleSettings.superScriptOffsetFactor]], and [[TextStyleSettings.subScriptOffsetFactor]]\n * affect how the content is rendered.\n * @beta\n */\nexport type BaselineShift = \"subscript\" | \"superscript\" | \"none\";\n\n/** JSON representation of a [[TextRun]].\n * @beta\n */\nexport interface TextRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"text\";\n /** The characters displayed by the run.\n * Default: an empty string.\n */\n content?: string;\n /** Whether to display [[content]] as a subscript, superscript, or normally.\n * Default: \"none\"\n */\n baselineShift?: BaselineShift;\n}\n\n/** The most common type of [[Run]], containing a sequence of characters to be displayed using a single style.\n * @beta\n */\nexport class TextRun extends TextBlockComponent {\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"text\";\n /** The sequence of characters to be displayed by the run. */\n public content: string;\n /** Whether to display [[content]] as a subscript, superscript, or normally. */\n public baselineShift: BaselineShift;\n\n private constructor(props: TextRunProps) {\n super(props);\n this.content = props?.content ?? \"\";\n this.baselineShift = props?.baselineShift ?? \"none\";\n }\n\n public override clone(): TextRun {\n return new TextRun(this.toJSON());\n }\n\n public override toJSON(): TextRunProps {\n return {\n ...super.toJSON(),\n type: \"text\",\n content: this.content,\n baselineShift: this.baselineShift,\n };\n }\n\n public static create(props?: Omit<TextRunProps, \"type\">): TextRun {\n return new TextRun({ ...props, type: \"text\" });\n }\n\n public override get isEmpty(): boolean {\n return this.stringify().length === 0;\n }\n\n /** Simply returns [[content]]. */\n public override stringify(): string {\n return this.content;\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return other instanceof TextRun && this.content === other.content && this.baselineShift === other.baselineShift && super.equals(other);\n }\n}\n\n/** JSON representation of a [[FractionRun]].\n * @beta\n */\nexport interface FractionRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"fraction\";\n /** The text displayed before or above the fraction separator, depending on [[TextStyleSettings.stackedFractionType]]. Default: an empty string. */\n numerator?: string;\n /** The text displayed after or below the fraction separator, depending on [[TextStyleSettings.stackedFractionType]]. Default: an empty string. */\n denominator?: string;\n}\n\n/** A [[Run]] containing a numeric ratio to be displayed as a numerator and denominator separated by a horizontal or diagonal bar.\n * @note The [[numerator]] and [[denominator]] are stored as strings. They are not technically required to contain a numeric representation.\n * @beta\n */\nexport class FractionRun extends TextBlockComponent {\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"fraction\";\n /** The fraction's numerator. */\n public numerator: string;\n /** The fraction's denominator. */\n public denominator: string;\n\n private constructor(props: FractionRunProps) {\n super(props);\n this.numerator = props?.numerator ?? \"\";\n this.denominator = props?.denominator ?? \"\";\n }\n\n public override toJSON(): FractionRunProps {\n return {\n ...super.toJSON(),\n type: \"fraction\",\n numerator: this.numerator,\n denominator: this.denominator,\n };\n }\n\n public override clone(): FractionRun {\n return new FractionRun(this.toJSON());\n }\n\n public static create(props?: Omit<FractionRunProps, \"type\">): FractionRun {\n return new FractionRun({ ...props, type: \"fraction\" });\n }\n\n public override get isEmpty(): boolean {\n return this.stringify().length === 0;\n }\n\n /** Formats the fraction as a string with the [[numerator]] and [[denominator]] separated by [[TextBlockStringifyOptions.fractionSeparator]]. */\n public override stringify(options?: TextBlockStringifyOptions): string {\n const sep = options?.fractionSeparator ?? \"/\";\n return `${this.numerator}${sep}${this.denominator}`;\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return other instanceof FractionRun && this.numerator === other.numerator && this.denominator === other.denominator && super.equals(other);\n }\n}\n\n/** JSON representation of a [[LineBreakRun]].\n * @beta\n */\nexport interface LineBreakRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"linebreak\";\n}\n\n/** A [[Run]] that represents the end of a line of text within a [[Paragraph]]. It contains no content of its own - it simply causes subsequent content to display on a new line.\n * @beta\n */\nexport class LineBreakRun extends TextBlockComponent {\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"linebreak\";\n\n private constructor(props: LineBreakRunProps) {\n super(props);\n }\n\n public override toJSON(): LineBreakRunProps {\n return {\n ...super.toJSON(),\n type: \"linebreak\",\n };\n }\n\n public static create(props?: Omit<LineBreakRunProps, \"type\">) {\n return new LineBreakRun({ ...props, type: \"linebreak\" });\n }\n\n public override clone(): LineBreakRun {\n return new LineBreakRun(this.toJSON());\n }\n\n public override get isEmpty(): boolean {\n return this.stringify().length === 0;\n }\n\n /** Simply returns [[TextBlockStringifyOptions.lineBreak]]. */\n public override stringify(options?: TextBlockStringifyOptions): string {\n return options?.lineBreak ?? \" \";\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return other instanceof LineBreakRun && super.equals(other);\n }\n}\n\n/** JSON representation of a [[TabRun]].\n * @beta\n */\nexport interface TabRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"tab\";\n}\n\n/** A [[TabRun]] is used to shift the next tab stop.\n * @note Only left-justified tabs are supported at this tab.\n * @beta\n */\nexport class TabRun extends TextBlockComponent {\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"tab\";\n\n public override toJSON(): TabRunProps {\n return {\n ...super.toJSON(),\n type: \"tab\",\n };\n }\n\n public override clone(): TabRun {\n return new TabRun(this.toJSON());\n }\n\n public static create(props?: Omit<TabRunProps, \"type\">): TabRun {\n return new TabRun(props);\n }\n\n public override get isEmpty(): boolean {\n return this.stringify().length === 0;\n }\n\n /**\n * Converts a [[TabRun]] to its string representation.\n * If the `tabsAsSpaces` option is provided, returns a string of spaces of the specified length.\n * Otherwise, returns a tab character (\"\\t\").\n */\n public override stringify(options?: TextBlockStringifyOptions): string {\n if (options?.tabsAsSpaces) {\n return \" \".repeat(options.tabsAsSpaces);\n }\n\n return \"\\t\";\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return other instanceof TabRun && super.equals(other);\n }\n}\n\n/** JSON representation of a [[FieldRun]].\n * @beta\n */\nexport interface FieldRunProps extends TextBlockComponentProps {\n /** Discriminator field for the [[RunProps]] union. */\n readonly type: \"field\";\n /** The element and BIS class containing the property described by [[propertyPath]]. */\n propertyHost: FieldPropertyHost;\n /** Describes how to obtain the property value from [[propertyHost]]. */\n propertyPath: FieldPropertyPath;\n /** Specifies how to format the property value obtained from [[propertyPath]] into a string to be stored in [[cachedContent]].\n * The specific options used depend upon the field's [[propertyType]].\n */\n formatOptions?: FieldFormatOptions;\n /** The field's most recently evaluated display string.\n * @note It is unnecessary to specify this when creating a field as part of an element like a [[TextAnnotation2d]], because\n * all of the element's fields will be re-evaluated when inserting or updating the element in the iModel.\n */\n cachedContent?: string;\n}\n\n/** A [[Run]] that displays the formatted value of a property of some [Element]($backend).\n * When a [[TextBlock]] containing a [[FieldRun]] is written into the iModel as an [ITextAnnotation]($backend) element,\n * a dependency is established between the two elements via the [ElementDrivesTextAnnotation]($backend) relationship such that\n * whenever the source element specified by [[propertyHost]] is modified or the `ITextAnnotation` element is inserted or updated in the iModel,\n * the field(s) in the `ITextAnnotation` element are automatically\n * recalculated, causing their [[cachedContent]] to update. If the field's display string cannot be evaluated (for example, because the specified element or\n * property does not exist), then its cached content is set to [[FieldRun.invalidContentIndicator]].\n * A [[FieldRun]] displays its [[cachedContent]] in the same way that [[TextRun]]s display their `content`, including word wrapping where appropriate.\n * @beta\n */\nexport class FieldRun extends TextBlockComponent {\n /** Display string used to signal an error in computing the field's value. */\n public static invalidContentIndicator = \"####\";\n\n /** Discriminator field for the [[Run]] union. */\n public readonly type = \"field\";\n /** The element and BIS class containing the property described by [[propertyPath]]. */\n public propertyHost: FieldPropertyHost;\n /** Describes how to obtain the property value from [[propertyHost]]. */\n public propertyPath: FieldPropertyPath;\n /** Specifies how to format the property value obtained from [[propertyPath]] into a string to be stored in [[cachedContent]].\n * The specific options used depend upon the [[FieldPropertyType]].\n */\n public formatOptions?: FieldFormatOptions;\n private _cachedContent: string;\n\n /** The field's most recently evaluated display string. */\n public get cachedContent(): string {\n return this._cachedContent;\n }\n\n /** @internal Used by core-backend when re-evaluating field content. */\n public setCachedContent(content: string | undefined): void {\n this._cachedContent = content ?? FieldRun.invalidContentIndicator;\n }\n\n private constructor(props: FieldRunProps) {\n super(props);\n\n this._cachedContent = props.cachedContent ?? FieldRun.invalidContentIndicator;\n this.propertyHost = props.propertyHost\n this.propertyPath = props.propertyPath;\n this.formatOptions = props.formatOptions;\n }\n\n /** Create a FieldRun from its JSON representation. */\n public static create(props: Omit<FieldRunProps, \"type\">): FieldRun {\n return new FieldRun({\n ...props,\n propertyHost: { ...props.propertyHost },\n propertyPath: structuredClone(props.propertyPath),\n formatOptions: structuredClone(props.formatOptions),\n type: \"field\",\n });\n }\n\n /** Convert the FieldRun to its JSON representation. */\n public override toJSON(): FieldRunProps {\n const json: FieldRunProps = {\n ...super.toJSON(),\n type: \"field\",\n propertyHost: { ...this.propertyHost },\n propertyPath: structuredClone(this.propertyPath),\n };\n\n if (this.cachedContent !== FieldRun.invalidContentIndicator) {\n json.cachedContent = this.cachedContent;\n }\n\n if (this.formatOptions) {\n json.formatOptions = structuredClone(this.formatOptions);\n }\n\n return json;\n }\n\n /** Create a deep copy of this FieldRun. */\n public override clone(): FieldRun {\n return new FieldRun(this.toJSON());\n }\n\n public override get isEmpty(): boolean {\n return this.stringify().length === 0;\n }\n\n /** Convert this FieldRun to a simple string representation. */\n public override stringify(): string {\n return this.cachedContent;\n }\n\n /** Returns true if `this` is equivalent to `other`. */\n public override equals(other: TextBlockComponent): boolean {\n if (!(other instanceof FieldRun) || !super.equals(other)) {\n return false;\n }\n\n if (\n this.propertyHost.elementId !== other.propertyHost.elementId ||\n this.propertyHost.className !== other.propertyHost.className ||\n this.propertyHost.schemaName !== other.propertyHost.schemaName\n ) {\n return false;\n }\n\n if (this.propertyPath.propertyName !== other.propertyPath.propertyName) {\n return false;\n }\n\n const thisAccessors = this.propertyPath.accessors ?? [];\n const otherAccessors = other.propertyPath.accessors ?? [];\n\n if (thisAccessors.length !== otherAccessors.length) {\n return false;\n }\n\n if (!thisAccessors.every((value, index) => value === otherAccessors[index])) {\n return false;\n }\n\n if (this.formatOptions && other.formatOptions) {\n // We anticipate new formatting options being added in the future.\n // So to account for properties we don't know about, just compare the string representations.\n if (JSON.stringify(this.formatOptions) !== JSON.stringify(other.formatOptions)) {\n return false;\n }\n } else if (this.formatOptions || other.formatOptions) {\n return false;\n }\n\n return true;\n }\n}\n\n/** JSON representation of a [[Paragraph]].\n * @beta\n */\nexport interface ParagraphProps extends TextBlockComponentProps {\n children?: Array<ListProps | RunProps>;\n}\n\n/** A collection of [[Run]]s and [[List]]s. Paragraphs can be appended to [[List]]s and [[TextBlock]]s.\n * Each paragraph is laid out on a separate line. If included in a [[List]], the paragraph will be treated as a list item.\n * @beta\n */\nexport class Paragraph extends TextBlockComponent {\n public readonly type = \"paragraph\";\n public readonly children: Array<List | Run>;\n\n private constructor(props?: ParagraphProps) {\n super(props);\n\n this.children = props?.children?.map((child) =>\n child.type === \"list\" ? List.create(child) : Run.fromJSON(child)\n ) ?? [];\n }\n\n /** Create a paragraph from its JSON representation. */\n public static create(props?: Omit<ParagraphProps, \"type\">): Paragraph {\n return new Paragraph(props);\n }\n\n public override clearStyleOverrides(options?: ClearTextStyleOptions): void {\n clearStyleOverrides(this, options);\n }\n\n public override get isEmpty() {\n return this.children.length === 0;\n }\n\n public override clone(): Paragraph {\n return new Paragraph(this.toJSON());\n }\n\n public override toJSON(): ParagraphProps {\n return {\n ...super.toJSON(),\n children: this.children.map((child) => child.toJSON()),\n };\n }\n\n /** Compute a string representation of this paragraph by concatenating the string representations of all of its children. */\n public override stringify(options?: TextBlockStringifyOptions, context?: TextBlockStringifyContext): string {\n return this.children.map((x, index) => (index > 0 && x.type === \"list\") ? `${options?.paragraphBreak ?? \" \"}${x.stringify(options, context)}` : x.stringify(options, context)).join(\"\") ?? \"\";\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return (other instanceof Paragraph) && super.equals(other);\n }\n}\n\n/** JSON representation of a [[List]].\n * @beta\n */\nexport interface ListProps extends TextBlockComponentProps {\n readonly type: \"list\";\n children?: ParagraphProps[];\n}\n\n/** A collection of list items ([[Paragraph]]s). Lists can be appended to [[Paragraph]]s.\n * Lists will be laid out on a new line. Each item in a list is laid out on a separate line.\n * @beta\n */\nexport class List extends TextBlockComponent {\n public readonly type = \"list\";\n public readonly children: Paragraph[];\n\n protected constructor(props?: ListProps) {\n super(props);\n\n this.children = props?.children?.map((child) => Paragraph.create(child)) ?? [];\n }\n\n /** Create a list from its JSON representation. */\n public static create(props?: Omit<ListProps, \"type\">): List {\n return new List({ ...props, type: \"list\" });\n }\n\n public override clearStyleOverrides(options?: ClearTextStyleOptions): void {\n clearStyleOverrides(this, options);\n }\n\n public override get isEmpty() {\n return this.children.length === 0;\n }\n\n public override clone(): List {\n return new List(this.toJSON());\n }\n\n public override toJSON(): ListProps {\n return {\n ...super.toJSON(),\n type: \"list\",\n children: this.children.map((run) => run.toJSON()),\n };\n }\n\n /** Compute a string representation of this list by concatenating the string representations of all of its [[children]]. */\n public override stringify(options?: TextBlockStringifyOptions, context?: TextBlockStringifyContext): string {\n const children = this.children.map((x, index) => {\n const depth = context?.depth ?? 0;\n const marker = getMarkerText(this.styleOverrides.listMarker ?? TextStyleSettings.defaultProps.listMarker, index + 1);\n const tab = (options?.tabsAsSpaces ? \" \".repeat(options.tabsAsSpaces) : \"\\t\").repeat(depth);\n return `${tab}${marker}${options?.listMarkerBreak ?? \" \"}${x.stringify(options, { depth: depth + 1 })}`;\n });\n return children.join(options?.paragraphBreak ?? \" \") ?? \"\";\n }\n\n public override equals(other: TextBlockComponent): boolean {\n return (other instanceof List) && super.equals(other);\n }\n}\n\n/** JSON representation of a [[TextBlock]].\n * @beta\n */\nexport interface TextBlockProps extends TextBlockComponentProps {\n /** The width of the document in meters. Lines that would exceed this width are instead wrapped around to the next line if possible.\n * A value less than or equal to zero indicates no wrapping is to be applied.\n * Default: 0\n */\n width?: number;\n children?: ParagraphProps[];\n}\n\n/** Represents a formatted text document consisting of a series of [[Paragraph]]s, each laid out on a separate line and containing their own content.\n * No word-wrapping is applied to the document unless a [[width]] greater than zero is specified.\n * @see [[TextAnnotation]] to position a text block as an annotation in 2d or 3d space.\n * @beta\n */\nexport class TextBlock extends TextBlockComponent {\n public readonly children: Paragraph[];\n\n /** The width of the document in meters. Lines that would exceed this width are instead wrapped around to the next line if possible.\n * A value less than or equal to zero indicates no wrapping is to be applied.\n * Default: 0\n */\n public width: number;\n\n private constructor(props: TextBlockProps) {\n super(props);\n this.width = props.width ?? 0;\n\n this.children = props?.children?.map((para) => Paragraph.create(para)) ?? [];\n }\n\n public override clearStyleOverrides(options?: ClearTextStyleOptions): void {\n clearStyleOverrides(this, options);\n }\n\n public override toJSON(): TextBlockProps {\n return {\n ...super.toJSON(),\n width: this.width,\n children: this.children.map((x) => x.toJSON()),\n };\n }\n\n /** Create a text block from its JSON representation. */\n public static create(props?: Omit<TextBlockProps, \"type\">): TextBlock {\n return new TextBlock(props ?? {});\n }\n\n /** Returns true if every paragraph in this text block is empty. */\n public override get isEmpty(): boolean {\n return !this.children || this.children.every((child) => child.isEmpty);\n }\n\n public override clone(): TextBlock {\n return new TextBlock(this.toJSON());\n }\n\n /** Compute a string representation of the document's contents by concatenating the string representations of each of its [[children]], separated by [[TextBlockStringifyOptions.paragraphBreak]]. */\n public stringify(options?: TextBlockStringifyOptions): string {\n return this.children.map((x) => x.stringify(options)).join(options?.paragraphBreak ?? \" \") || \"\";\n }\n\n /** Add and return a new paragraph.\n * By default, the paragraph will be created with no [[styleOverrides]], so that it inherits the style of this block.\n * @param seedFromLast If true and [[children]] is not empty, the new paragraph will inherit the style overrides of the last child in this block.\n * @note Be sure you pass in [[ParagraphProps]] and not [[Paragraph]] or style overrides will be ignored.\n */\n public appendParagraph(props?: ParagraphProps, seedFromLast = false): Paragraph {\n const seed = seedFromLast ? this.children[this.children.length - 1] : undefined;\n const styleOverrides = { ...seed?.styleOverrides, ...props?.styleOverrides };\n const paragraph = Paragraph.create({ ...props, styleOverrides });\n this.children.push(paragraph);\n return paragraph;\n }\n\n /** Append a run to the last [[Paragraph]] in this block.\n * If the block contains no [[children]], a new [[Paragraph]] will first be created using [[appendParagraph]].\n */\n public appendRun(run: Run): void {\n const paragraph = this.children[this.children.length - 1] ?? this.appendParagraph();\n paragraph.children.push(run);\n }\n\n public override equals(other: TextBlockComponent): boolean {\n if (!(other instanceof TextBlock)) {\n return false;\n }\n\n if (!super.equals(other)) {\n return false;\n }\n\n if (this.width !== other.width) {\n return false;\n }\n\n if (this.children && other.children) {\n if (this.children.length !== other.children.length) {\n return false;\n }\n\n return this.children.every((child, index) => other.children && child.equals(other.children[index]));\n }\n\n return true;\n }\n}\n\n/**\n * A union of all the [[TextBlockComponent]]s that can contain other components.\n * @beta\n */\nexport type StructuralTextBlockComponent = List | Paragraph | TextBlock;\n\n/**\n * Recursively traverses a [[StructuralTextBlockComponent]] tree, yielding each child component along with its parent container.\n * This generator enables depth-first iteration over all components in a text block structure, including paragraphs, lists, and runs.\n *\n * @param parent The root container whose children should be traversed.\n * @returns An IterableIterator yielding objects with the child component and its parent container.\n * @beta\n */\nexport function* traverseTextBlockComponent(parent: StructuralTextBlockComponent): IterableIterator<{ parent: StructuralTextBlockComponent, child: List | Paragraph | Run }> {\n for (const child of parent.children) {\n yield { parent, child };\n if (child.type === \"list\" || child.type === \"paragraph\") {\n yield* traverseTextBlockComponent(child);\n }\n }\n}\n\n/**\n * Returns the formatted marker text for a list item based on the marker type and item number.\n * Supports ordered and unordered list markers, including alphabetic, Roman numeral, and numeric formats.\n * @param marker The type of list marker to use.\n * @param num The item number in the list.\n * @returns The formatted marker string for the list item.\n * @beta\n */\nexport function getMarkerText(marker: ListMarker, num: number): string {\n let markerString = \"\";\n\n switch (marker.enumerator) {\n case undefined:\n case ListMarkerEnumerator.Number:\n markerString = `${num}`;\n break;\n case ListMarkerEnumerator.Letter:\n markerString = integerToAlpha(num);\n break;\n case ListMarkerEnumerator.RomanNumeral:\n markerString = integerToRoman(num);\n break;\n default:\n markerString = marker.enumerator;\n break;\n }\n\n if (marker.case) {\n markerString = marker.case === \"upper\" ? markerString.toUpperCase() : markerString.toLowerCase();\n }\n\n const terminator = marker.terminator === \"period\" ? \".\" : marker.terminator === \"parenthesis\" ? \")\" : \"\";\n\n return `${markerString}${terminator}`;\n}\n\n/**\n * Converts an integer to its Roman numeral representation.\n * Supports numbers from 1 and above.\n * @param num The integer to convert.\n * @returns The Roman numeral string.\n */\nfunction integerToRoman(num: number): string {\n const values =\n [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];\n const symbols =\n ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'];\n let roman = '';\n for (let i = 0; i < values.length; i++) {\n while (num >= values[i]) {\n roman += symbols[i];\n num -= values[i];\n }\n }\n\n return roman;\n}\n\n/**\n * Converts an integer to its alphabetic representation (A-Z, AA-ZZ, etc.).\n * Used for ordered list markers with alphabetic styles.\n * @param num The integer to convert (1-based).\n * @returns The alphabetic string for the given number.\n */\nfunction integerToAlpha(num: number): string {\n const letterOffset = (num - 1) % 26;\n const letter = String.fromCharCode(65 + letterOffset);\n const depth = Math.ceil(num / 26);\n return letter.repeat(depth);\n}\n"]}
|
|
@@ -40,8 +40,10 @@ export interface FieldPropertyPath {
|
|
|
40
40
|
accessors?: Array<string | number>;
|
|
41
41
|
}
|
|
42
42
|
/** Describes the source of the property value against which a [[FieldPropertyPath]] is evaluated.
|
|
43
|
-
* A field property is always hosted by an [Element]($backend). It may
|
|
44
|
-
*
|
|
43
|
+
* A field property is always hosted by an [Element]($backend). It may refer to a property belonging to any of the following:
|
|
44
|
+
* - The element's BIS class itself;
|
|
45
|
+
* - One of the element's [ElementAspect]($backend)s;
|
|
46
|
+
* - Or an [EC view]($docs/learning/ECSqlReference/Views.md) with the same ECInstanceId as the element.
|
|
45
47
|
* The [[schemaName]] and [[className]] should always identify the exact class that contains [[FieldPropertyPath.propertyName]] - not a subclass thereof.
|
|
46
48
|
* @beta
|
|
47
49
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/annotation/TextField.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,CAAC;AAE3H;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,iBAAiB;IAChC,qGAAqG;IACrG,YAAY,EAAE,MAAM,CAAC;IACrB,kHAAkH;IAClH,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CACpC;AAED
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/annotation/TextField.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,CAAC;AAE3H;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,iBAAiB;IAChC,qGAAqG;IACrG,YAAY,EAAE,MAAM,CAAC;IACrB,kHAAkH;IAClH,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,SAAS,EAAE,UAAU,CAAC;IACtB,+EAA+E;IAC/E,UAAU,EAAE,MAAM,CAAC;IACnB,6HAA6H;IAC7H,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC,4BAA4B,CAAC;IAC3C,mDAAmD;IACnD,aAAa,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;CAC5C;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,8FAA8F;IAC9F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6FAA6F;IAC7F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,0BAA0B,CAAC;CACvC"}
|
|
@@ -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
|
|
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"]}
|