@itwin/core-common 5.1.0-dev.9 → 5.2.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +91 -1
- package/lib/cjs/BackgroundMapSettings.d.ts +2 -2
- package/lib/cjs/BackgroundMapSettings.js.map +1 -1
- package/lib/cjs/ChangesetProps.d.ts +28 -0
- package/lib/cjs/ChangesetProps.d.ts.map +1 -1
- package/lib/cjs/ChangesetProps.js.map +1 -1
- package/lib/cjs/ClipStyle.d.ts +1 -1
- package/lib/cjs/ClipStyle.d.ts.map +1 -1
- package/lib/cjs/ClipStyle.js.map +1 -1
- package/lib/cjs/CommonLoggerCategory.d.ts +2 -0
- package/lib/cjs/CommonLoggerCategory.d.ts.map +1 -1
- package/lib/cjs/CommonLoggerCategory.js +2 -0
- package/lib/cjs/CommonLoggerCategory.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.d.ts +8 -23
- package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
- package/lib/cjs/ConcurrentQuery.js +1 -11
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/ContextRealityModel.d.ts +8 -8
- package/lib/cjs/ContextRealityModel.js +8 -8
- package/lib/cjs/ContextRealityModel.js.map +1 -1
- package/lib/cjs/ElementProps.d.ts +64 -54
- package/lib/cjs/ElementProps.d.ts.map +1 -1
- package/lib/cjs/ElementProps.js +6 -6
- package/lib/cjs/ElementProps.js.map +1 -1
- package/lib/cjs/EntityProps.d.ts +10 -10
- package/lib/cjs/EntityProps.d.ts.map +1 -1
- package/lib/cjs/EntityProps.js +4 -2
- package/lib/cjs/EntityProps.js.map +1 -1
- package/lib/cjs/Fonts.d.ts +2 -2
- package/lib/cjs/Fonts.js +1 -1
- package/lib/cjs/Fonts.js.map +1 -1
- package/lib/cjs/GeoCoordinateServices.d.ts +1 -1
- package/lib/cjs/GeoCoordinateServices.js +1 -1
- package/lib/cjs/GeoCoordinateServices.js.map +1 -1
- package/lib/cjs/GeometryParams.d.ts +3 -1
- package/lib/cjs/GeometryParams.d.ts.map +1 -1
- package/lib/cjs/GeometryParams.js +3 -1
- package/lib/cjs/GeometryParams.js.map +1 -1
- package/lib/cjs/GraphicParams.d.ts +1 -0
- package/lib/cjs/GraphicParams.d.ts.map +1 -1
- package/lib/cjs/GraphicParams.js +1 -0
- package/lib/cjs/GraphicParams.js.map +1 -1
- package/lib/cjs/IModel.d.ts +3 -3
- package/lib/cjs/IModel.js.map +1 -1
- package/lib/cjs/ITwinCoreErrors.d.ts +1 -1
- package/lib/cjs/ITwinCoreErrors.d.ts.map +1 -1
- package/lib/cjs/ITwinCoreErrors.js.map +1 -1
- package/lib/cjs/MassProperties.d.ts +2 -2
- package/lib/cjs/MassProperties.js.map +1 -1
- package/lib/cjs/MaterialProps.d.ts +6 -3
- package/lib/cjs/MaterialProps.d.ts.map +1 -1
- package/lib/cjs/MaterialProps.js.map +1 -1
- package/lib/cjs/RenderSchedule.d.ts +14 -0
- package/lib/cjs/RenderSchedule.d.ts.map +1 -1
- package/lib/cjs/RenderSchedule.js +4 -0
- package/lib/cjs/RenderSchedule.js.map +1 -1
- package/lib/cjs/RenderTexture.d.ts +1 -1
- package/lib/cjs/RenderTexture.d.ts.map +1 -1
- package/lib/cjs/RenderTexture.js.map +1 -1
- package/lib/cjs/TerrainSettings.d.ts +1 -1
- package/lib/cjs/TerrainSettings.d.ts.map +1 -1
- package/lib/cjs/TerrainSettings.js.map +1 -1
- package/lib/cjs/annotation/TextAnnotation.d.ts +78 -2
- package/lib/cjs/annotation/TextAnnotation.d.ts.map +1 -1
- package/lib/cjs/annotation/TextAnnotation.js +63 -10
- package/lib/cjs/annotation/TextAnnotation.js.map +1 -1
- package/lib/cjs/annotation/TextBlock.d.ts +179 -44
- package/lib/cjs/annotation/TextBlock.d.ts.map +1 -1
- package/lib/cjs/annotation/TextBlock.js +210 -57
- package/lib/cjs/annotation/TextBlock.js.map +1 -1
- package/lib/cjs/annotation/TextBlockGeometryProps.d.ts +1 -1
- package/lib/cjs/annotation/TextBlockGeometryProps.js.map +1 -1
- package/lib/cjs/annotation/TextBlockLayoutResult.d.ts +1 -1
- package/lib/cjs/annotation/TextBlockLayoutResult.d.ts.map +1 -1
- package/lib/cjs/annotation/TextBlockLayoutResult.js.map +1 -1
- package/lib/cjs/annotation/TextStyle.d.ts +115 -34
- package/lib/cjs/annotation/TextStyle.d.ts.map +1 -1
- package/lib/cjs/annotation/TextStyle.js +118 -37
- package/lib/cjs/annotation/TextStyle.js.map +1 -1
- package/lib/cjs/geometry/AdditionalTransform.d.ts +4 -0
- package/lib/cjs/geometry/AdditionalTransform.d.ts.map +1 -1
- package/lib/cjs/geometry/AdditionalTransform.js +9 -0
- package/lib/cjs/geometry/AdditionalTransform.js.map +1 -1
- package/lib/cjs/geometry/ElementGeometry.d.ts +1 -1
- package/lib/cjs/geometry/ElementGeometry.d.ts.map +1 -1
- package/lib/cjs/geometry/ElementGeometry.js +2 -2
- package/lib/cjs/geometry/ElementGeometry.js.map +1 -1
- package/lib/cjs/internal/BackendTypes.d.ts +3 -3
- package/lib/cjs/internal/BackendTypes.d.ts.map +1 -1
- package/lib/cjs/internal/BackendTypes.js.map +1 -1
- package/lib/cjs/internal/RenderMesh.d.ts +19 -5
- package/lib/cjs/internal/RenderMesh.d.ts.map +1 -1
- package/lib/cjs/internal/RenderMesh.js +11 -8
- package/lib/cjs/internal/RenderMesh.js.map +1 -1
- package/lib/cjs/internal/cross-package.d.ts +1 -1
- package/lib/cjs/internal/cross-package.d.ts.map +1 -1
- package/lib/cjs/internal/cross-package.js.map +1 -1
- package/lib/cjs/rpc/IModelReadRpcInterface.d.ts +1 -1
- package/lib/cjs/rpc/IModelReadRpcInterface.d.ts.map +1 -1
- package/lib/cjs/rpc/IModelReadRpcInterface.js +1 -1
- package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/SnapshotIModelRpcInterface.d.ts +4 -4
- package/lib/cjs/rpc/SnapshotIModelRpcInterface.js +4 -4
- package/lib/cjs/rpc/SnapshotIModelRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/core/RpcConstants.d.ts +6 -6
- package/lib/cjs/rpc/core/RpcConstants.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcConstants.js +6 -6
- package/lib/cjs/rpc/core/RpcConstants.js.map +1 -1
- package/lib/cjs/rpc/web/OpenAPI.d.ts +1 -1
- package/lib/cjs/rpc/web/OpenAPI.js.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcLogging.js.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcProtocol.d.ts +2 -2
- package/lib/cjs/rpc/web/WebAppRpcProtocol.js.map +1 -1
- package/lib/cjs/tile/IModelTileIO.d.ts +2 -2
- package/lib/cjs/tile/IModelTileIO.js +2 -2
- package/lib/cjs/tile/IModelTileIO.js.map +1 -1
- package/lib/cjs/tile/TileMetadata.d.ts +6 -2
- package/lib/cjs/tile/TileMetadata.d.ts.map +1 -1
- package/lib/cjs/tile/TileMetadata.js +10 -4
- package/lib/cjs/tile/TileMetadata.js.map +1 -1
- package/lib/esm/BackgroundMapSettings.d.ts +2 -2
- package/lib/esm/BackgroundMapSettings.js.map +1 -1
- package/lib/esm/ChangesetProps.d.ts +28 -0
- package/lib/esm/ChangesetProps.d.ts.map +1 -1
- package/lib/esm/ChangesetProps.js.map +1 -1
- package/lib/esm/ClipStyle.d.ts +1 -1
- package/lib/esm/ClipStyle.d.ts.map +1 -1
- package/lib/esm/ClipStyle.js.map +1 -1
- package/lib/esm/CommonLoggerCategory.d.ts +2 -0
- package/lib/esm/CommonLoggerCategory.d.ts.map +1 -1
- package/lib/esm/CommonLoggerCategory.js +2 -0
- package/lib/esm/CommonLoggerCategory.js.map +1 -1
- package/lib/esm/ConcurrentQuery.d.ts +8 -23
- package/lib/esm/ConcurrentQuery.d.ts.map +1 -1
- package/lib/esm/ConcurrentQuery.js +1 -11
- package/lib/esm/ConcurrentQuery.js.map +1 -1
- package/lib/esm/ContextRealityModel.d.ts +8 -8
- package/lib/esm/ContextRealityModel.js +8 -8
- package/lib/esm/ContextRealityModel.js.map +1 -1
- package/lib/esm/ElementProps.d.ts +64 -54
- package/lib/esm/ElementProps.d.ts.map +1 -1
- package/lib/esm/ElementProps.js +6 -6
- package/lib/esm/ElementProps.js.map +1 -1
- package/lib/esm/EntityProps.d.ts +10 -10
- package/lib/esm/EntityProps.d.ts.map +1 -1
- package/lib/esm/EntityProps.js +4 -2
- package/lib/esm/EntityProps.js.map +1 -1
- package/lib/esm/Fonts.d.ts +2 -2
- package/lib/esm/Fonts.js +1 -1
- package/lib/esm/Fonts.js.map +1 -1
- package/lib/esm/GeoCoordinateServices.d.ts +1 -1
- package/lib/esm/GeoCoordinateServices.js +1 -1
- package/lib/esm/GeoCoordinateServices.js.map +1 -1
- package/lib/esm/GeometryParams.d.ts +3 -1
- package/lib/esm/GeometryParams.d.ts.map +1 -1
- package/lib/esm/GeometryParams.js +3 -1
- package/lib/esm/GeometryParams.js.map +1 -1
- package/lib/esm/GraphicParams.d.ts +1 -0
- package/lib/esm/GraphicParams.d.ts.map +1 -1
- package/lib/esm/GraphicParams.js +1 -0
- package/lib/esm/GraphicParams.js.map +1 -1
- package/lib/esm/IModel.d.ts +3 -3
- package/lib/esm/IModel.js.map +1 -1
- package/lib/esm/ITwinCoreErrors.d.ts +1 -1
- package/lib/esm/ITwinCoreErrors.d.ts.map +1 -1
- package/lib/esm/ITwinCoreErrors.js.map +1 -1
- package/lib/esm/MassProperties.d.ts +2 -2
- package/lib/esm/MassProperties.js.map +1 -1
- package/lib/esm/MaterialProps.d.ts +6 -3
- package/lib/esm/MaterialProps.d.ts.map +1 -1
- package/lib/esm/MaterialProps.js.map +1 -1
- package/lib/esm/RenderSchedule.d.ts +14 -0
- package/lib/esm/RenderSchedule.d.ts.map +1 -1
- package/lib/esm/RenderSchedule.js +4 -0
- package/lib/esm/RenderSchedule.js.map +1 -1
- package/lib/esm/RenderTexture.d.ts +1 -1
- package/lib/esm/RenderTexture.d.ts.map +1 -1
- package/lib/esm/RenderTexture.js.map +1 -1
- package/lib/esm/TerrainSettings.d.ts +1 -1
- package/lib/esm/TerrainSettings.d.ts.map +1 -1
- package/lib/esm/TerrainSettings.js.map +1 -1
- package/lib/esm/annotation/TextAnnotation.d.ts +78 -2
- package/lib/esm/annotation/TextAnnotation.d.ts.map +1 -1
- package/lib/esm/annotation/TextAnnotation.js +63 -10
- package/lib/esm/annotation/TextAnnotation.js.map +1 -1
- package/lib/esm/annotation/TextBlock.d.ts +179 -44
- package/lib/esm/annotation/TextBlock.d.ts.map +1 -1
- package/lib/esm/annotation/TextBlock.js +207 -56
- package/lib/esm/annotation/TextBlock.js.map +1 -1
- package/lib/esm/annotation/TextBlockGeometryProps.d.ts +1 -1
- package/lib/esm/annotation/TextBlockGeometryProps.js.map +1 -1
- package/lib/esm/annotation/TextBlockLayoutResult.d.ts +1 -1
- package/lib/esm/annotation/TextBlockLayoutResult.d.ts.map +1 -1
- package/lib/esm/annotation/TextBlockLayoutResult.js.map +1 -1
- package/lib/esm/annotation/TextStyle.d.ts +115 -34
- package/lib/esm/annotation/TextStyle.d.ts.map +1 -1
- package/lib/esm/annotation/TextStyle.js +116 -34
- package/lib/esm/annotation/TextStyle.js.map +1 -1
- package/lib/esm/geometry/AdditionalTransform.d.ts +4 -0
- package/lib/esm/geometry/AdditionalTransform.d.ts.map +1 -1
- package/lib/esm/geometry/AdditionalTransform.js +10 -1
- package/lib/esm/geometry/AdditionalTransform.js.map +1 -1
- package/lib/esm/geometry/ElementGeometry.d.ts +1 -1
- package/lib/esm/geometry/ElementGeometry.d.ts.map +1 -1
- package/lib/esm/geometry/ElementGeometry.js +2 -2
- package/lib/esm/geometry/ElementGeometry.js.map +1 -1
- package/lib/esm/internal/BackendTypes.d.ts +3 -3
- package/lib/esm/internal/BackendTypes.d.ts.map +1 -1
- package/lib/esm/internal/BackendTypes.js.map +1 -1
- package/lib/esm/internal/RenderMesh.d.ts +19 -5
- package/lib/esm/internal/RenderMesh.d.ts.map +1 -1
- package/lib/esm/internal/RenderMesh.js +11 -8
- package/lib/esm/internal/RenderMesh.js.map +1 -1
- package/lib/esm/internal/cross-package.d.ts +1 -1
- package/lib/esm/internal/cross-package.d.ts.map +1 -1
- package/lib/esm/internal/cross-package.js.map +1 -1
- package/lib/esm/rpc/IModelReadRpcInterface.d.ts +1 -1
- package/lib/esm/rpc/IModelReadRpcInterface.d.ts.map +1 -1
- package/lib/esm/rpc/IModelReadRpcInterface.js +1 -1
- package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
- package/lib/esm/rpc/SnapshotIModelRpcInterface.d.ts +4 -4
- package/lib/esm/rpc/SnapshotIModelRpcInterface.js +4 -4
- package/lib/esm/rpc/SnapshotIModelRpcInterface.js.map +1 -1
- package/lib/esm/rpc/core/RpcConstants.d.ts +6 -6
- package/lib/esm/rpc/core/RpcConstants.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcConstants.js +6 -6
- package/lib/esm/rpc/core/RpcConstants.js.map +1 -1
- package/lib/esm/rpc/web/OpenAPI.d.ts +1 -1
- package/lib/esm/rpc/web/OpenAPI.js.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcLogging.js.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcProtocol.d.ts +2 -2
- package/lib/esm/rpc/web/WebAppRpcProtocol.js.map +1 -1
- package/lib/esm/tile/IModelTileIO.d.ts +2 -2
- package/lib/esm/tile/IModelTileIO.js +2 -2
- package/lib/esm/tile/IModelTileIO.js.map +1 -1
- package/lib/esm/tile/TileMetadata.d.ts +6 -2
- package/lib/esm/tile/TileMetadata.d.ts.map +1 -1
- package/lib/esm/tile/TileMetadata.js +10 -4
- package/lib/esm/tile/TileMetadata.js.map +1 -1
- package/package.json +9 -8
|
@@ -7,30 +7,19 @@
|
|
|
7
7
|
* @module Annotation
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.TextBlock = exports.Paragraph = exports.LineBreakRun = exports.FractionRun = exports.TextRun = exports.Run = exports.TextBlockComponent = void 0;
|
|
10
|
+
exports.TextBlock = exports.Paragraph = exports.FieldRun = exports.TabRun = exports.LineBreakRun = exports.FractionRun = exports.TextRun = exports.Run = exports.TextBlockComponent = void 0;
|
|
11
|
+
const TextStyle_1 = require("./TextStyle");
|
|
11
12
|
/** Abstract representation of any of the building blocks that make up a [[TextBlock]] document - namely [[Run]]s, [[Paragraph]]s, and [[TextBlock]] itself.
|
|
12
|
-
*
|
|
13
|
+
* The [[TextBlock]] can specify an [AnnotationTextStyle]($backend) that formats its contents. Each component can specify an optional [[styleOverrides]] to customize that formatting.
|
|
13
14
|
* @beta
|
|
14
15
|
*/
|
|
15
16
|
class TextBlockComponent {
|
|
16
|
-
_styleName;
|
|
17
17
|
_styleOverrides;
|
|
18
18
|
/** @internal */
|
|
19
19
|
constructor(props) {
|
|
20
|
-
this.
|
|
21
|
-
this._styleOverrides = { ...props.styleOverrides };
|
|
20
|
+
this._styleOverrides = TextStyle_1.TextStyleSettings.cloneProps(props?.styleOverrides ?? {});
|
|
22
21
|
}
|
|
23
|
-
/**
|
|
24
|
-
* @note Assigning to this property is equivalent to calling [[applyStyle]] with default [[ApplyTextStyleOptions]], which propagates the style change to all of
|
|
25
|
-
* the components sub-components and clears any [[styleOverrides]].
|
|
26
|
-
*/
|
|
27
|
-
get styleName() {
|
|
28
|
-
return this._styleName;
|
|
29
|
-
}
|
|
30
|
-
set styleName(styleName) {
|
|
31
|
-
this.applyStyle(styleName);
|
|
32
|
-
}
|
|
33
|
-
/** Deviations in individual properties of the [[TextStyle]] specified by [[styleName]].
|
|
22
|
+
/** Deviations in individual properties of the [[TextStyleSettings]] in the [AnnotationTextStyle]($backend) specified by `styleId` on the [[TextBlock]].
|
|
34
23
|
* For example, if the style uses the "Arial" font, you can override that by settings `styleOverrides.fontName` to "Comic Sans".
|
|
35
24
|
* @see [[clearStyleOverrides]] to reset this to an empty object.
|
|
36
25
|
*/
|
|
@@ -38,35 +27,35 @@ class TextBlockComponent {
|
|
|
38
27
|
return this._styleOverrides;
|
|
39
28
|
}
|
|
40
29
|
set styleOverrides(overrides) {
|
|
41
|
-
this._styleOverrides =
|
|
30
|
+
this._styleOverrides = TextStyle_1.TextStyleSettings.cloneProps(overrides);
|
|
42
31
|
}
|
|
43
|
-
/** Reset any [[styleOverrides]] applied to this component
|
|
44
|
-
clearStyleOverrides() {
|
|
32
|
+
/** Reset any [[styleOverrides]] applied to this component. */
|
|
33
|
+
clearStyleOverrides(_options) {
|
|
45
34
|
this.styleOverrides = {};
|
|
46
35
|
}
|
|
47
|
-
/**
|
|
48
|
-
applyStyle(styleName, options) {
|
|
49
|
-
this._styleName = styleName;
|
|
50
|
-
if (!(options?.preserveOverrides)) {
|
|
51
|
-
this.clearStyleOverrides();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/** Returns true if [[styleOverrides]] specifies any deviations from this component's base [[TextStyle]]. */
|
|
36
|
+
/** Returns true if [[styleOverrides]] specifies any deviations from the [[TextBlock]]'s [AnnotationTextStyle]($backend). */
|
|
55
37
|
get overridesStyle() {
|
|
56
38
|
return Object.keys(this.styleOverrides).length > 0;
|
|
57
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns true if the string representation of this component consists only of whitespace characters.
|
|
42
|
+
* Useful for checking if the component is visually empty (producing no graphics) or contains only spaces, tabs, or line breaks.
|
|
43
|
+
*/
|
|
44
|
+
get isWhitespace() {
|
|
45
|
+
return /^\s*$/g.test(this.stringify());
|
|
46
|
+
}
|
|
47
|
+
;
|
|
58
48
|
/** Convert this component to its JSON representation. */
|
|
59
49
|
toJSON() {
|
|
60
50
|
return {
|
|
61
|
-
|
|
62
|
-
styleOverrides: { ...this.styleOverrides },
|
|
51
|
+
styleOverrides: TextStyle_1.TextStyleSettings.cloneProps(this.styleOverrides),
|
|
63
52
|
};
|
|
64
53
|
}
|
|
65
54
|
/** Returns true if `this` is equivalent to `other`. */
|
|
66
55
|
equals(other) {
|
|
67
56
|
const myKeys = Object.keys(this.styleOverrides);
|
|
68
57
|
const yrKeys = Object.keys(other._styleOverrides);
|
|
69
|
-
if (
|
|
58
|
+
if (myKeys.length !== yrKeys.length) {
|
|
70
59
|
return false;
|
|
71
60
|
}
|
|
72
61
|
for (const name of myKeys) {
|
|
@@ -93,7 +82,9 @@ var Run;
|
|
|
93
82
|
switch (props.type) {
|
|
94
83
|
case "text": return TextRun.create(props);
|
|
95
84
|
case "fraction": return FractionRun.create(props);
|
|
85
|
+
case "tab": return TabRun.create(props);
|
|
96
86
|
case "linebreak": return LineBreakRun.create(props);
|
|
87
|
+
case "field": return FieldRun.create(props);
|
|
97
88
|
}
|
|
98
89
|
}
|
|
99
90
|
Run.fromJSON = fromJSON;
|
|
@@ -110,8 +101,8 @@ class TextRun extends TextBlockComponent {
|
|
|
110
101
|
baselineShift;
|
|
111
102
|
constructor(props) {
|
|
112
103
|
super(props);
|
|
113
|
-
this.content = props
|
|
114
|
-
this.baselineShift = props
|
|
104
|
+
this.content = props?.content ?? "";
|
|
105
|
+
this.baselineShift = props?.baselineShift ?? "none";
|
|
115
106
|
}
|
|
116
107
|
clone() {
|
|
117
108
|
return new TextRun(this.toJSON());
|
|
@@ -149,8 +140,8 @@ class FractionRun extends TextBlockComponent {
|
|
|
149
140
|
denominator;
|
|
150
141
|
constructor(props) {
|
|
151
142
|
super(props);
|
|
152
|
-
this.numerator = props
|
|
153
|
-
this.denominator = props
|
|
143
|
+
this.numerator = props?.numerator ?? "";
|
|
144
|
+
this.denominator = props?.denominator ?? "";
|
|
154
145
|
}
|
|
155
146
|
toJSON() {
|
|
156
147
|
return {
|
|
@@ -206,6 +197,149 @@ class LineBreakRun extends TextBlockComponent {
|
|
|
206
197
|
}
|
|
207
198
|
}
|
|
208
199
|
exports.LineBreakRun = LineBreakRun;
|
|
200
|
+
/** A [[TabRun]] is used to shift the next tab stop.
|
|
201
|
+
* @note Only left-justified tabs are supported at this tab.
|
|
202
|
+
* @beta
|
|
203
|
+
*/
|
|
204
|
+
class TabRun extends TextBlockComponent {
|
|
205
|
+
/** Discriminator field for the [[Run]] union. */
|
|
206
|
+
type = "tab";
|
|
207
|
+
toJSON() {
|
|
208
|
+
return {
|
|
209
|
+
...super.toJSON(),
|
|
210
|
+
type: "tab",
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
clone() {
|
|
214
|
+
return new TabRun(this.toJSON());
|
|
215
|
+
}
|
|
216
|
+
static create(props) {
|
|
217
|
+
return new TabRun(props);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Converts a [[TabRun]] to its string representation.
|
|
221
|
+
* If the `tabsAsSpaces` option is provided, returns a string of spaces of the specified length.
|
|
222
|
+
* Otherwise, returns a tab character ("\t").
|
|
223
|
+
*/
|
|
224
|
+
stringify(options) {
|
|
225
|
+
if (options?.tabsAsSpaces) {
|
|
226
|
+
return " ".repeat(options.tabsAsSpaces);
|
|
227
|
+
}
|
|
228
|
+
return "\t";
|
|
229
|
+
}
|
|
230
|
+
equals(other) {
|
|
231
|
+
return other instanceof TabRun && super.equals(other);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
exports.TabRun = TabRun;
|
|
235
|
+
/** A [[Run]] that displays the formatted value of a property of some [Element]($backend).
|
|
236
|
+
* When a [[TextBlock]] containing a [[FieldRun]] is written into the iModel as an [ITextAnnotation]($backend) element,
|
|
237
|
+
* a dependency is established between the two elements via the [ElementDrivesTextAnnotation]($backend) relationship such that
|
|
238
|
+
* whenever the source element specified by [[propertyHost]] is modified, the field(s) in the `ITextAnnotation` element are automatically
|
|
239
|
+
* recalculated, causing their [[cachedContent]] to update. If the field's display string cannot be evaluated (for example, because the specified element or
|
|
240
|
+
* property does not exist), then its cached content is set to [[FieldRun.invalidContentIndicator]].
|
|
241
|
+
* A [[FieldRun]] displays its [[cachedContent]] in the same way that [[TextRun]]s display their `content`, including word wrapping where appropriate.
|
|
242
|
+
* @beta
|
|
243
|
+
*/
|
|
244
|
+
class FieldRun extends TextBlockComponent {
|
|
245
|
+
/** Display string used to signal an error in computing the field's value. */
|
|
246
|
+
static invalidContentIndicator = "####";
|
|
247
|
+
/** Discriminator field for the [[Run]] union. */
|
|
248
|
+
type = "field";
|
|
249
|
+
/** The element and BIS class containing the property described by [[propertyPath]]. */
|
|
250
|
+
propertyHost;
|
|
251
|
+
/** Describes how to obtain the property value from [[propertyHost]]. */
|
|
252
|
+
propertyPath;
|
|
253
|
+
/** Specifies how to format the property value obtained from [[propertyPath]] into a string to be stored in [[cachedContent]]. */
|
|
254
|
+
formatter;
|
|
255
|
+
_cachedContent;
|
|
256
|
+
/** The field's most recently evaluated display string. */
|
|
257
|
+
get cachedContent() {
|
|
258
|
+
return this._cachedContent;
|
|
259
|
+
}
|
|
260
|
+
/** @internal Used by core-backend when re-evaluating field content. */
|
|
261
|
+
setCachedContent(content) {
|
|
262
|
+
this._cachedContent = content ?? FieldRun.invalidContentIndicator;
|
|
263
|
+
}
|
|
264
|
+
constructor(props) {
|
|
265
|
+
super(props);
|
|
266
|
+
this._cachedContent = props.cachedContent ?? FieldRun.invalidContentIndicator;
|
|
267
|
+
this.propertyHost = props.propertyHost;
|
|
268
|
+
this.propertyPath = props.propertyPath;
|
|
269
|
+
this.formatter = props.formatter;
|
|
270
|
+
}
|
|
271
|
+
/** Create a FieldRun from its JSON representation. */
|
|
272
|
+
static create(props) {
|
|
273
|
+
return new FieldRun({
|
|
274
|
+
...props,
|
|
275
|
+
propertyHost: { ...props.propertyHost },
|
|
276
|
+
propertyPath: structuredClone(props.propertyPath),
|
|
277
|
+
formatter: structuredClone(props.formatter),
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
/** Convert the FieldRun to its JSON representation. */
|
|
281
|
+
toJSON() {
|
|
282
|
+
const json = {
|
|
283
|
+
...super.toJSON(),
|
|
284
|
+
type: "field",
|
|
285
|
+
propertyHost: { ...this.propertyHost },
|
|
286
|
+
propertyPath: structuredClone(this.propertyPath),
|
|
287
|
+
};
|
|
288
|
+
if (this.cachedContent !== FieldRun.invalidContentIndicator) {
|
|
289
|
+
json.cachedContent = this.cachedContent;
|
|
290
|
+
}
|
|
291
|
+
if (this.formatter) {
|
|
292
|
+
json.formatter = structuredClone(this.formatter);
|
|
293
|
+
}
|
|
294
|
+
return json;
|
|
295
|
+
}
|
|
296
|
+
/** Create a deep copy of this FieldRun. */
|
|
297
|
+
clone() {
|
|
298
|
+
return new FieldRun(this.toJSON());
|
|
299
|
+
}
|
|
300
|
+
/** Convert this FieldRun to a simple string representation. */
|
|
301
|
+
stringify() {
|
|
302
|
+
return this.cachedContent;
|
|
303
|
+
}
|
|
304
|
+
/** Returns true if `this` is equivalent to `other`. */
|
|
305
|
+
equals(other) {
|
|
306
|
+
if (!(other instanceof FieldRun) || !super.equals(other)) {
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
if (this.propertyHost.elementId !== other.propertyHost.elementId ||
|
|
310
|
+
this.propertyHost.className !== other.propertyHost.className ||
|
|
311
|
+
this.propertyHost.schemaName !== other.propertyHost.schemaName) {
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
if (this.propertyPath.propertyName !== other.propertyPath.propertyName) {
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
const thisAccessors = this.propertyPath.accessors ?? [];
|
|
318
|
+
const otherAccessors = other.propertyPath.accessors ?? [];
|
|
319
|
+
const thisJsonAccessors = this.propertyPath.jsonAccessors ?? [];
|
|
320
|
+
const otherJsonAccessors = other.propertyPath.jsonAccessors ?? [];
|
|
321
|
+
if (thisAccessors.length !== otherAccessors.length || thisJsonAccessors.length !== otherJsonAccessors.length) {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
if (!thisAccessors.every((value, index) => value === otherAccessors[index])) {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
if (!thisJsonAccessors.every((value, index) => value === otherJsonAccessors[index])) {
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
if (this.formatter && other.formatter) {
|
|
331
|
+
// ###TODO better comparison of formatter objects.
|
|
332
|
+
if (JSON.stringify(this.formatter) !== JSON.stringify(other.formatter)) {
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
else if (this.formatter || other.formatter) {
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
return true;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
exports.FieldRun = FieldRun;
|
|
209
343
|
/** A collection of [[Run]]s within a [[TextBlock]]. Each paragraph within a text block is laid out on a separate line.
|
|
210
344
|
* @beta
|
|
211
345
|
*/
|
|
@@ -214,7 +348,7 @@ class Paragraph extends TextBlockComponent {
|
|
|
214
348
|
runs;
|
|
215
349
|
constructor(props) {
|
|
216
350
|
super(props);
|
|
217
|
-
this.runs = props
|
|
351
|
+
this.runs = props?.runs?.map((run) => Run.fromJSON(run)) ?? [];
|
|
218
352
|
}
|
|
219
353
|
toJSON() {
|
|
220
354
|
return {
|
|
@@ -229,13 +363,16 @@ class Paragraph extends TextBlockComponent {
|
|
|
229
363
|
clone() {
|
|
230
364
|
return new Paragraph(this.toJSON());
|
|
231
365
|
}
|
|
232
|
-
/**
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
366
|
+
/**
|
|
367
|
+
* Clears any [[styleOverrides]] applied to this Paragraph.
|
|
368
|
+
* Will also clear [[styleOverrides]] from all child components unless [[ClearTextStyleOptions.preserveChildrenOverrides]] is `true`.
|
|
369
|
+
*/
|
|
370
|
+
clearStyleOverrides(options) {
|
|
371
|
+
super.clearStyleOverrides();
|
|
372
|
+
if (options?.preserveChildrenOverrides)
|
|
373
|
+
return;
|
|
374
|
+
for (const run of this.runs) {
|
|
375
|
+
run.clearStyleOverrides();
|
|
239
376
|
}
|
|
240
377
|
}
|
|
241
378
|
/** Compute a string representation of this paragraph by concatenating the string representations of all of its [[runs]]. */
|
|
@@ -261,6 +398,11 @@ exports.Paragraph = Paragraph;
|
|
|
261
398
|
* @beta
|
|
262
399
|
*/
|
|
263
400
|
class TextBlock extends TextBlockComponent {
|
|
401
|
+
/** The ID of the [AnnotationTextStyle]($backend) that provides the base formatting for the contents of this TextBlock.
|
|
402
|
+
* @note Assigning to this property retains all style overrides on the TextBlock and its child components.
|
|
403
|
+
* Call [[clearStyleOverrides]] to clear the TextBlock's and optionally all children's style overrides.
|
|
404
|
+
*/
|
|
405
|
+
styleId;
|
|
264
406
|
/** The width of the document in meters. Lines that would exceed this width are instead wrapped around to the next line if possible.
|
|
265
407
|
* A value less than or equal to zero indicates no wrapping is to be applied.
|
|
266
408
|
* Default: 0
|
|
@@ -274,6 +416,7 @@ class TextBlock extends TextBlockComponent {
|
|
|
274
416
|
paragraphs;
|
|
275
417
|
constructor(props) {
|
|
276
418
|
super(props);
|
|
419
|
+
this.styleId = props.styleId;
|
|
277
420
|
this.width = props.width ?? 0;
|
|
278
421
|
this.justification = props.justification ?? "left";
|
|
279
422
|
// Assign default margins if not provided
|
|
@@ -288,6 +431,7 @@ class TextBlock extends TextBlockComponent {
|
|
|
288
431
|
toJSON() {
|
|
289
432
|
return {
|
|
290
433
|
...super.toJSON(),
|
|
434
|
+
styleId: this.styleId,
|
|
291
435
|
width: this.width,
|
|
292
436
|
justification: this.justification,
|
|
293
437
|
margins: this.margins,
|
|
@@ -298,9 +442,9 @@ class TextBlock extends TextBlockComponent {
|
|
|
298
442
|
static create(props) {
|
|
299
443
|
return new TextBlock(props);
|
|
300
444
|
}
|
|
301
|
-
/** Create an empty text block containing no [[paragraphs]] and an empty [[
|
|
445
|
+
/** Create an empty text block containing no [[paragraphs]] and an empty [[styleId]]. */
|
|
302
446
|
static createEmpty() {
|
|
303
|
-
return TextBlock.create({
|
|
447
|
+
return TextBlock.create({ styleId: "" });
|
|
304
448
|
}
|
|
305
449
|
/** Returns true if every paragraph in this text block is empty. */
|
|
306
450
|
get isEmpty() {
|
|
@@ -309,13 +453,16 @@ class TextBlock extends TextBlockComponent {
|
|
|
309
453
|
clone() {
|
|
310
454
|
return new TextBlock(this.toJSON());
|
|
311
455
|
}
|
|
312
|
-
/**
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
456
|
+
/**
|
|
457
|
+
* Clears any [[styleOverrides]] applied to this TextBlock.
|
|
458
|
+
* Will also clear [[styleOverrides]] from all child components unless [[ClearTextStyleOptions.preserveChildrenOverrides]] is `true`.
|
|
459
|
+
*/
|
|
460
|
+
clearStyleOverrides(options) {
|
|
461
|
+
super.clearStyleOverrides();
|
|
462
|
+
if (options?.preserveChildrenOverrides)
|
|
463
|
+
return;
|
|
464
|
+
for (const paragraph of this.paragraphs) {
|
|
465
|
+
paragraph.clearStyleOverrides();
|
|
319
466
|
}
|
|
320
467
|
}
|
|
321
468
|
/** Compute a string representation of the document's contents by concatenating the string representations of each of its [[paragraphs]], separated by [[TextBlockStringifyOptions.paragraphBreak]]. */
|
|
@@ -323,14 +470,17 @@ class TextBlock extends TextBlockComponent {
|
|
|
323
470
|
return this.paragraphs.map((x) => x.stringify(options)).join(options?.paragraphBreak ?? " ");
|
|
324
471
|
}
|
|
325
472
|
/** Add and return a new paragraph.
|
|
326
|
-
*
|
|
327
|
-
* the paragraph will inherit
|
|
473
|
+
* By default, the paragraph will be created with no [[styleOverrides]], so that it inherits the style of this block.
|
|
474
|
+
* @param seedFromLast If true and [[paragraphs]] is not empty, the new paragraph will inherit the style overrides of the last [[Paragraph]] in this block.
|
|
328
475
|
*/
|
|
329
|
-
appendParagraph() {
|
|
330
|
-
|
|
476
|
+
appendParagraph(seedFromLast = false) {
|
|
477
|
+
let styleOverrides = {};
|
|
478
|
+
if (seedFromLast && this.paragraphs.length > 0) {
|
|
479
|
+
const seed = this.paragraphs[this.paragraphs.length - 1];
|
|
480
|
+
styleOverrides = { ...seed.styleOverrides };
|
|
481
|
+
}
|
|
331
482
|
const paragraph = Paragraph.create({
|
|
332
|
-
|
|
333
|
-
styleOverrides: seed?.styleOverrides ?? undefined,
|
|
483
|
+
styleOverrides
|
|
334
484
|
});
|
|
335
485
|
this.paragraphs.push(paragraph);
|
|
336
486
|
return paragraph;
|
|
@@ -346,6 +496,9 @@ class TextBlock extends TextBlockComponent {
|
|
|
346
496
|
if (!(other instanceof TextBlock)) {
|
|
347
497
|
return false;
|
|
348
498
|
}
|
|
499
|
+
if (this.styleId !== other.styleId || !super.equals(other)) {
|
|
500
|
+
return false;
|
|
501
|
+
}
|
|
349
502
|
if (this.width !== other.width || this.justification !== other.justification || this.paragraphs.length !== other.paragraphs.length) {
|
|
350
503
|
return false;
|
|
351
504
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextBlock.js","sourceRoot":"","sources":["../../../src/annotation/TextBlock.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAgDH;;;GAGG;AACH,MAAsB,kBAAkB;IAC9B,UAAU,CAAS;IACnB,eAAe,CAAyB;IAEhD,gBAAgB;IAChB,YAAsB,KAA8B;QAClD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,eAAe,GAAG,EAAE,GAAG,KAAK,CAAC,cAAc,EAAE,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,IAAW,SAAS,CAAC,SAAiB;QACpC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAC7B,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,GAAG,SAAS,EAAE,CAAC;IAC1C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AAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAChG,CAAC;CACF;AAjHD,8BAiHC","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 { TextStyleSettingsProps } from \"./TextStyle\";\n\n/** Options supplied to [[TextBlockComponent.applyStyle]] to control how the style is applied to the component and its child components.\n * @beta\n */\nexport interface ApplyTextStyleOptions {\n /** Controls whether any deviations from the style's settings stored in [[TextBlockComponent.styleOverrides]] are retained.\n * By default, all overrides are cleared.\n */\n preserveOverrides?: boolean;\n /** Controls whether the style should be recursively applied to the [[Paragraph]]s belonging to a [[TextBlock]] and the [[Run]]s belonging to a [[Paragraph]].\n * By default, the style change propagates to child components.\n */\n preventPropagation?: boolean;\n}\n\n/** The JSON representation of a [[TextBlockComponent]].\n * @beta\n */\nexport interface TextBlockComponentProps {\n /** The name of a [[TextStyle]] stored in a [Workspace]($backend) from which the base [[TextStyleSettings]] applied to the component originates. */\n styleName: string;\n /** Deviations from the base [[TextStyleSettings]] defined by the [[TextStyle]] applied to this component.\n * This permits you to, e.g., create a [[TextRun]] using \"Arial\" font and override it 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}\n\n/** Abstract representation of any of the building blocks that make up a [[TextBlock]] document - namely [[Run]]s, [[Paragraph]]s, and [[TextBlock]] itself.\n * Each component can specify a [[TextStyle]] that formats its contents and optional [[styleOverrides]] to customize that formatting.\n * @beta\n */\nexport abstract class TextBlockComponent {\n private _styleName: string;\n private _styleOverrides: TextStyleSettingsProps;\n\n /** @internal */\n protected constructor(props: TextBlockComponentProps) {\n this._styleName = props.styleName;\n this._styleOverrides = { ...props.styleOverrides };\n }\n\n /** The name of the [[TextStyle]] that provides the base formatting for the contents of this component.\n * @note Assigning to this property is equivalent to calling [[applyStyle]] with default [[ApplyTextStyleOptions]], which propagates the style change to all of\n * the components sub-components and clears any [[styleOverrides]].\n */\n public get styleName(): string {\n return this._styleName;\n }\n\n public set styleName(styleName: string) {\n this.applyStyle(styleName);\n }\n\n /** Deviations in individual properties of the [[TextStyle]] specified by [[styleName]].\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 = { ...overrides };\n }\n\n /** Reset any [[styleOverrides]] applied to this component's [[TextStyle]]. */\n public clearStyleOverrides(): void {\n this.styleOverrides = { };\n }\n\n /** Apply the [[TextStyle]] specified by `styleName` to this component, optionally preserving [[styleOverrides]] and/or preventing propagation to sub-components. */\n public applyStyle(styleName: string, options?: ApplyTextStyleOptions): void {\n this._styleName = styleName;\n\n if (!(options?.preserveOverrides)) {\n this.clearStyleOverrides();\n }\n }\n\n /** Returns true if [[styleOverrides]] specifies any deviations from this component's base [[TextStyle]]. */\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): string;\n\n /** Convert this component to its JSON representation. */\n public toJSON(): TextBlockComponentProps {\n return {\n styleName: this.styleName,\n styleOverrides: { ...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 (this.styleName !== other.styleName || 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/**\n * @beta\n */\nexport type Run = TextRun | FractionRun | LineBreakRun;\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 | LineBreakRunProps;\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]], and [[LineBreakRun.create]] to create a run directly.\n */\n export function fromJSON(props: RunProps): Run {\n switch (props.type) {\n case \"text\": return TextRun.create(props);\n case \"fraction\": return FractionRun.create(props);\n case \"linebreak\": return LineBreakRun.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: Omit<TextRunProps, \"type\">) {\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);\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 [[TextStyle.stackedFractionType]]. Default: an empty string. */\n numerator?: string;\n /** The text displayed after or below the fraction separator, depending on [[TextStyle.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: Omit<FractionRunProps, \"type\">) {\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);\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: TextBlockComponentProps) {\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: TextBlockComponentProps) {\n return new LineBreakRun(props);\n }\n\n public override clone(): LineBreakRun {\n return new LineBreakRun(this.toJSON());\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 [[Paragraph]].\n * @beta\n */\nexport interface ParagraphProps extends TextBlockComponentProps {\n /** The collection of [[Run]]s within the paragraph.\n * Default: an empty array.\n */\n runs?: RunProps[];\n}\n\n/** A collection of [[Run]]s within a [[TextBlock]]. Each paragraph within a text block is laid out on a separate line.\n * @beta\n */\nexport class Paragraph extends TextBlockComponent {\n /** The runs within the paragraph. You can modify the contents of this array to change the content of the paragraph. */\n public readonly runs: Run[];\n\n private constructor(props: ParagraphProps) {\n super(props);\n this.runs = props.runs?.map((run) => Run.fromJSON(run)) ?? [];\n }\n\n public override toJSON(): ParagraphProps {\n return {\n ...super.toJSON(),\n runs: this.runs.map((run) => run.toJSON()),\n };\n }\n\n /** Create a paragraph from its JSON representation. */\n public static create(props: ParagraphProps): Paragraph {\n return new Paragraph(props);\n }\n\n public override clone(): Paragraph {\n return new Paragraph(this.toJSON());\n }\n\n /** Apply the specified style to this [[Paragraph]], and - unless [[ApplyTextStyleOptions.preventPropagation]] is `true` - to all of its [[runs]]. */\n public override applyStyle(styleName: string, options?: ApplyTextStyleOptions): void {\n super.applyStyle(styleName, options);\n if (!(options?.preventPropagation)) {\n for (const run of this.runs) {\n run.applyStyle(styleName, options);\n }\n }\n }\n\n /** Compute a string representation of this paragraph by concatenating the string representations of all of its [[runs]]. */\n public override stringify(options?: TextBlockStringifyOptions): string {\n return this.runs.map((x) => x.stringify(options)).join(\"\");\n }\n\n public override equals(other: TextBlockComponent): boolean {\n if (!(other instanceof Paragraph)) {\n return false;\n }\n\n if (this.runs.length !== other.runs.length || !super.equals(other)) {\n return false;\n }\n\n return this.runs.every((run, index) => run.equals(other.runs[index]));\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 /** The paragraphs within the text block. Default: an empty array. */\n paragraphs?: 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 in the form of [[Run]]s.\n * You can change the content of the document by directly modifying the contents of its [[paragraphs]], or via [[appendParagraph]] and [[appendRun]].\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 /** 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 /** The ordered list of paragraphs within the document. */\n public readonly paragraphs: Paragraph[];\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.paragraphs = props.paragraphs?.map((x) => Paragraph.create(x)) ?? [];\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 paragraphs: this.paragraphs.map((x) => x.toJSON()),\n };\n }\n\n /** Create a text block from its JSON representation. */\n public static create(props: TextBlockProps): TextBlock {\n return new TextBlock(props);\n }\n\n /** Create an empty text block containing no [[paragraphs]] and an empty [[styleName]]. */\n public static createEmpty(): TextBlock {\n return TextBlock.create({ styleName: \"\" });\n }\n\n /** Returns true if every paragraph in this text block is empty. */\n public get isEmpty(): boolean {\n return this.paragraphs.every((p) => p.runs.length === 0);\n }\n\n public override clone(): TextBlock {\n return new TextBlock(this.toJSON());\n }\n\n /** Apply the specified style to this block and - unless [[ApplyTextStyleOptions.preventPropagation]] is `true` - to all of its [[paragraphs]]. */\n public override applyStyle(styleName: string, options?: ApplyTextStyleOptions): void {\n super.applyStyle(styleName, options);\n if (!(options?.preventPropagation)) {\n for (const paragraph of this.paragraphs) {\n paragraph.applyStyle(styleName, options);\n }\n }\n }\n\n /** Compute a string representation of the document's contents by concatenating the string representations of each of its [[paragraphs]], separated by [[TextBlockStringifyOptions.paragraphBreak]]. */\n public stringify(options?: TextBlockStringifyOptions): string {\n return this.paragraphs.map((x) => x.stringify(options)).join(options?.paragraphBreak ?? \" \");\n }\n\n /** Add and return a new paragraph.\n * If [[paragraphs]] is not empty, the style and overrides of the last [[Paragraph]] in the block will be applied to the new paragraph; otherwise,\n * the paragraph will inherit this block's style with no overrides.\n */\n public appendParagraph(): Paragraph {\n const seed = this.paragraphs[0];\n const paragraph = Paragraph.create({\n styleName: seed?.styleName ?? this.styleName,\n styleOverrides: seed?.styleOverrides ?? undefined,\n });\n\n this.paragraphs.push(paragraph);\n return paragraph;\n }\n\n /** Append a run to the last [[Paragraph]] in this block.\n * If the block contains no [[paragraphs]], a new one will first be created using [[appendParagraph]].\n */\n public appendRun(run: Run): void {\n const paragraph = this.paragraphs[this.paragraphs.length - 1] ?? this.appendParagraph();\n paragraph.runs.push(run);\n }\n\n public override equals(other: TextBlockComponent): boolean {\n if (!(other instanceof TextBlock)) {\n return false;\n }\n\n if (this.width !== other.width || this.justification !== other.justification || this.paragraphs.length !== other.paragraphs.length) {\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 return this.paragraphs.every((paragraph, index) => paragraph.equals(other.paragraphs[index]));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TextBlock.js","sourceRoot":"","sources":["../../../src/annotation/TextBlock.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,2CAAwE;AA4CxE;;;GAGG;AACH,MAAsB,kBAAkB;IAC9B,eAAe,CAAyB;IAEhD,gBAAgB;IAChB,YAAsB,KAA+B;QACnD,IAAI,CAAC,eAAe,GAAG,6BAAiB,CAAC,UAAU,CAAC,KAAK,EAAE,cAAc,IAAI,EAAE,CAAC,CAAC;IACnF,CAAC;IAED;;;OAGG;IACH,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,IAAW,cAAc,CAAC,SAAiC;QACzD,IAAI,CAAC,eAAe,GAAG,6BAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACjE,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,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACrD,CAAC;IAQD;;;MAGE;IACF,IAAW,YAAY;QACrB,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IACzC,CAAC;IAAA,CAAC;IAEF,yDAAyD;IAClD,MAAM;QACX,OAAO;YACL,cAAc,EAAE,6BAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC;SAClE,CAAC;IACJ,CAAC;IAED,uDA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AAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAC1E,KAAK,KAAM,KAAK,CAAC,OAAe,CAAC,GAAG,CAAC,CACtC,CAAC;QAEF,IAAI,CAAC,eAAe;YAAE,OAAO,KAAK,CAAC;QAEnC,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAChG,CAAC;CACF;AArID,8BAqIC","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\";\nimport { TextStyleSettings, TextStyleSettingsProps } from \"./TextStyle\";\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}\n\n/** Abstract representation of any of the building blocks that make up a [[TextBlock]] document - namely [[Run]]s, [[Paragraph]]s, and [[TextBlock]] itself.\n * The [[TextBlock]] can specify an [AnnotationTextStyle]($backend) that formats its contents. 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) specified by `styleId` on the [[TextBlock]].\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): string;\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]], and [[LineBreakRun.create]] to create a run directly.\n */\n export function fromJSON(props: RunProps): Run {\n switch (props.type) {\n case \"text\": return TextRun.create(props);\n case \"fraction\": return FractionRun.create(props);\n case \"tab\": return TabRun.create(props);\n case \"linebreak\": return LineBreakRun.create(props);\n case \"field\": return FieldRun.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?: Omit<TextRunProps, \"type\">) {\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);\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?: Omit<FractionRunProps, \"type\">) {\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);\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?: TextBlockComponentProps) {\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?: TextBlockComponentProps) {\n return new LineBreakRun(props);\n }\n\n public override clone(): LineBreakRun {\n return new LineBreakRun(this.toJSON());\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 /**\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/** 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 * If `propertyName` (including any [[accessors]]) resolves to a JSON property, then additional [[jsonAccessors]] are required to identify a specific value within the JSON.\n * Some examples:\n * ```\n * | Access String | propertyName | accessors | jsonAccessors |\n * | ------------- | ------------ | --------- | ------------- |\n * | name | \"name\" | undefined | undefined |\n * | spouse.name | \"spouse\" | [name] | undefined |\n * | colors[2] | \"colors\" | [2] | undefined |\n * | spouse.favoriteRestaurants[1].address | \"spouse\" | [\"favoriteRestaurants\", 1, \"address\"] | undefined |\n * | jsonProperties.contactInfo.email | \"jsonProperties\" | undefined | [\"contactInfo\", \"email\"] |\n * | spouse.jsonProperties.contactInfo.phoneNumbers[0].areaCode | \"spouse\" | [\"jsonProperties\"] | [\"contactInfo\", \"phoneNumbers\", 0, \"areaCode\"] |\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 /** If [[propertyName]] and [[accessors]] (if defined) resolve to a BIS property of extended type `Json`, property names and/or\n * array indices for selecting a primitive value within the JSON.\n */\n jsonAccessors?: 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/** Placeholder type for a description of how to format the raw property value resolved by a [[FieldPropertyPath]] into a [[FieldRun]]'s display string.\n * *** COMING SOON ***\n * @beta\n */\nexport interface FieldFormatter { [k: string]: any }\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 formatter?: FieldFormatter;\n /** The field's most recently evaluated display string. */\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, 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 public readonly formatter?: FieldFormatter;\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: Omit<FieldRunProps, \"type\">) {\n super(props);\n\n this._cachedContent = props.cachedContent ?? FieldRun.invalidContentIndicator;\n this.propertyHost = props.propertyHost\n this.propertyPath = props.propertyPath;\n this.formatter = props.formatter;\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 formatter: structuredClone(props.formatter),\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.formatter) {\n json.formatter = structuredClone(this.formatter);\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 /** 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 const thisJsonAccessors = this.propertyPath.jsonAccessors ?? [];\n const otherJsonAccessors = other.propertyPath.jsonAccessors ?? [];\n\n if (thisAccessors.length !== otherAccessors.length || thisJsonAccessors.length !== otherJsonAccessors.length) {\n return false;\n }\n\n if (!thisAccessors.every((value, index) => value === otherAccessors[index])) {\n return false;\n }\n\n if (!thisJsonAccessors.every((value, index) => value === otherJsonAccessors[index])) {\n return false;\n }\n\n if (this.formatter && other.formatter) {\n // ###TODO better comparison of formatter objects.\n if (JSON.stringify(this.formatter) !== JSON.stringify(other.formatter)) {\n return false;\n }\n } else if (this.formatter || other.formatter) {\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 /** The collection of [[Run]]s within the paragraph.\n * Default: an empty array.\n */\n runs?: RunProps[];\n}\n\n/** A collection of [[Run]]s within a [[TextBlock]]. Each paragraph within a text block is laid out on a separate line.\n * @beta\n */\nexport class Paragraph extends TextBlockComponent {\n /** The runs within the paragraph. You can modify the contents of this array to change the content of the paragraph. */\n public readonly runs: Run[];\n\n private constructor(props?: ParagraphProps) {\n super(props);\n this.runs = props?.runs?.map((run) => Run.fromJSON(run)) ?? [];\n }\n\n public override toJSON(): ParagraphProps {\n return {\n ...super.toJSON(),\n runs: this.runs.map((run) => run.toJSON()),\n };\n }\n\n /** Create a paragraph from its JSON representation. */\n public static create(props?: ParagraphProps): Paragraph {\n return new Paragraph(props);\n }\n\n public override clone(): Paragraph {\n return new Paragraph(this.toJSON());\n }\n\n /**\n * Clears any [[styleOverrides]] applied to this Paragraph.\n * Will also clear [[styleOverrides]] from all child components unless [[ClearTextStyleOptions.preserveChildrenOverrides]] is `true`.\n */\n public override clearStyleOverrides(options?: ClearTextStyleOptions): void {\n super.clearStyleOverrides();\n if (options?.preserveChildrenOverrides)\n return;\n\n for (const run of this.runs) {\n run.clearStyleOverrides();\n }\n }\n\n /** Compute a string representation of this paragraph by concatenating the string representations of all of its [[runs]]. */\n public override stringify(options?: TextBlockStringifyOptions): string {\n return this.runs.map((x) => x.stringify(options)).join(\"\");\n }\n\n public override equals(other: TextBlockComponent): boolean {\n if (!(other instanceof Paragraph)) {\n return false;\n }\n\n if (this.runs.length !== other.runs.length || !super.equals(other)) {\n return false;\n }\n\n return this.runs.every((run, index) => run.equals(other.runs[index]));\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 ID of an [AnnotationTextStyle]($backend) stored in the iModel from which the base [[TextStyleSettings]] applied to the [[TextBlock]] originates. */\n styleId: Id64String;\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 /** The paragraphs within the text block. Default: an empty array. */\n paragraphs?: 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 in the form of [[Run]]s.\n * You can change the content of the document by directly modifying the contents of its [[paragraphs]], or via [[appendParagraph]] and [[appendRun]].\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 /** The ID of the [AnnotationTextStyle]($backend) that provides the base formatting for the contents of this TextBlock.\n * @note Assigning to this property retains all style overrides on the TextBlock and its child components.\n * Call [[clearStyleOverrides]] to clear the TextBlock's and optionally all children's style overrides.\n */\n public styleId: Id64String;\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 /** The ordered list of paragraphs within the document. */\n public readonly paragraphs: Paragraph[];\n\n private constructor(props: TextBlockProps) {\n super(props);\n this.styleId = props.styleId;\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.paragraphs = props.paragraphs?.map((x) => Paragraph.create(x)) ?? [];\n }\n\n public override toJSON(): TextBlockProps {\n return {\n ...super.toJSON(),\n styleId: this.styleId,\n width: this.width,\n justification: this.justification,\n margins: this.margins,\n paragraphs: this.paragraphs.map((x) => x.toJSON()),\n };\n }\n\n /** Create a text block from its JSON representation. */\n public static create(props: TextBlockProps): TextBlock {\n return new TextBlock(props);\n }\n\n /** Create an empty text block containing no [[paragraphs]] and an empty [[styleId]]. */\n public static createEmpty(): TextBlock {\n return TextBlock.create({ styleId: \"\" });\n }\n\n /** Returns true if every paragraph in this text block is empty. */\n public get isEmpty(): boolean {\n return this.paragraphs.every((p) => p.runs.length === 0);\n }\n\n public override clone(): TextBlock {\n return new TextBlock(this.toJSON());\n }\n\n /**\n * Clears any [[styleOverrides]] applied to this TextBlock.\n * Will also clear [[styleOverrides]] from all child components unless [[ClearTextStyleOptions.preserveChildrenOverrides]] is `true`.\n */\n public override clearStyleOverrides(options?: ClearTextStyleOptions): void {\n super.clearStyleOverrides();\n if (options?.preserveChildrenOverrides)\n return;\n\n for (const paragraph of this.paragraphs) {\n paragraph.clearStyleOverrides();\n }\n }\n\n /** Compute a string representation of the document's contents by concatenating the string representations of each of its [[paragraphs]], separated by [[TextBlockStringifyOptions.paragraphBreak]]. */\n public stringify(options?: TextBlockStringifyOptions): string {\n return this.paragraphs.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 [[paragraphs]] is not empty, the new paragraph will inherit the style overrides of the last [[Paragraph]] in this block.\n */\n public appendParagraph(seedFromLast: boolean = false): Paragraph {\n let styleOverrides: TextStyleSettingsProps = {};\n\n if (seedFromLast && this.paragraphs.length > 0) {\n const seed = this.paragraphs[this.paragraphs.length - 1];\n styleOverrides = { ...seed.styleOverrides };\n }\n\n const paragraph = Paragraph.create({\n styleOverrides\n });\n\n this.paragraphs.push(paragraph);\n return paragraph;\n }\n\n /** Append a run to the last [[Paragraph]] in this block.\n * If the block contains no [[paragraphs]], a new one will first be created using [[appendParagraph]].\n */\n public appendRun(run: Run): void {\n const paragraph = this.paragraphs[this.paragraphs.length - 1] ?? this.appendParagraph();\n paragraph.runs.push(run);\n }\n\n public override equals(other: TextBlockComponent): boolean {\n if (!(other instanceof TextBlock)) {\n return false;\n }\n\n if (this.styleId !== other.styleId || !super.equals(other)) {\n return false;\n }\n\n if (this.width !== other.width || this.justification !== other.justification || this.paragraphs.length !== other.paragraphs.length) {\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 return this.paragraphs.every((paragraph, index) => paragraph.equals(other.paragraphs[index]));\n }\n}\n"]}
|
|
@@ -29,7 +29,7 @@ export type TextBlockGeometryPropsEntry = {
|
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* JSON representation of the geometric primitives that can be used to display a [[TextBlock]].
|
|
32
|
-
* @see [
|
|
32
|
+
* @see [appendTextAnnotationGeometry]($backend) to convert an annotation to its geometric representation.
|
|
33
33
|
* @see [[GeometryStreamBuilder.appendTextBlock]] to add a block of text to a [GeometryStream]($docs/learning/common/GeometryStream.md).
|
|
34
34
|
* @beta
|
|
35
35
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextBlockGeometryProps.js","sourceRoot":"","sources":["../../../src/annotation/TextBlockGeometryProps.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 { XYZProps } from \"@itwin/core-geometry\";\nimport { TextStringProps } from \"../geometry/TextString\";\nimport { TextStyleColor } from \"./TextStyle\";\n\n/**\n * A single entry in a [[TextBlockGeometryProps]], representing one of the following primitive types:\n * - A [[TextString]],\n * - A fraction separator described by a [LineSegment3d]($geometry), or\n * - A change in color, to be applied to all subsequent primitives.\n * @beta\n */\nexport type TextBlockGeometryPropsEntry = {\n text: TextStringProps;\n separator?: never;\n color?: never;\n} | {\n text?: never;\n separator: {\n startPoint: XYZProps;\n endPoint: XYZProps;\n };\n color?: never;\n} | {\n text?: never;\n separator?: never;\n color: TextStyleColor;\n};\n\n/**\n * JSON representation of the geometric primitives that can be used to display a [[TextBlock]].\n * @see [
|
|
1
|
+
{"version":3,"file":"TextBlockGeometryProps.js","sourceRoot":"","sources":["../../../src/annotation/TextBlockGeometryProps.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 { XYZProps } from \"@itwin/core-geometry\";\nimport { TextStringProps } from \"../geometry/TextString\";\nimport { TextStyleColor } from \"./TextStyle\";\n\n/**\n * A single entry in a [[TextBlockGeometryProps]], representing one of the following primitive types:\n * - A [[TextString]],\n * - A fraction separator described by a [LineSegment3d]($geometry), or\n * - A change in color, to be applied to all subsequent primitives.\n * @beta\n */\nexport type TextBlockGeometryPropsEntry = {\n text: TextStringProps;\n separator?: never;\n color?: never;\n} | {\n text?: never;\n separator: {\n startPoint: XYZProps;\n endPoint: XYZProps;\n };\n color?: never;\n} | {\n text?: never;\n separator?: never;\n color: TextStyleColor;\n};\n\n/**\n * JSON representation of the geometric primitives that can be used to display a [[TextBlock]].\n * @see [appendTextAnnotationGeometry]($backend) to convert an annotation to its geometric representation.\n * @see [[GeometryStreamBuilder.appendTextBlock]] to add a block of text to a [GeometryStream]($docs/learning/common/GeometryStream.md).\n * @beta\n */\nexport interface TextBlockGeometryProps {\n /** The set of geometric primitives representing the contents of the [[TextBlock]]. */\n entries: TextBlockGeometryPropsEntry[];\n}\n"]}
|
|
@@ -25,7 +25,7 @@ export interface RunLayoutResult {
|
|
|
25
25
|
offsetFromLine: XAndY;
|
|
26
26
|
/** Bounding box enclosing this RunLayoutResult's content. */
|
|
27
27
|
range: Range2dProps;
|
|
28
|
-
/** The [[TextStyleSettings]] for the run. */
|
|
28
|
+
/** The resolved [[TextStyleSettings]] for the run. Takes into account overrides and styles on the parent classes. */
|
|
29
29
|
textStyle: TextStyleSettingsProps;
|
|
30
30
|
/** Bounding box used when justifying the run. This may be smaller than [[range]]. */
|
|
31
31
|
justificationRange?: Range2dProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextBlockLayoutResult.d.ts","sourceRoot":"","sources":["../../../src/annotation/TextBlockLayoutResult.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,0FAA0F;IAC1F,cAAc,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf;;;MAGE;IACF,eAAe,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,cAAc,EAAE,MAAM,CAAC;IACvB,0FAA0F;IAC1F,cAAc,EAAE,KAAK,CAAC;IACtB,6DAA6D;IAC7D,KAAK,EAAE,YAAY,CAAC;IACpB,
|
|
1
|
+
{"version":3,"file":"TextBlockLayoutResult.d.ts","sourceRoot":"","sources":["../../../src/annotation/TextBlockLayoutResult.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,0FAA0F;IAC1F,cAAc,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf;;;MAGE;IACF,eAAe,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,cAAc,EAAE,MAAM,CAAC;IACvB,0FAA0F;IAC1F,cAAc,EAAE,KAAK,CAAC;IACtB,6DAA6D;IAC7D,KAAK,EAAE,YAAY,CAAC;IACpB,qHAAqH;IACrH,SAAS,EAAE,sBAAsB,CAAC;IAClC,qFAAqF;IACrF,kBAAkB,CAAC,EAAE,YAAY,CAAC;IAClC,4EAA4E;IAC5E,cAAc,CAAC,EAAE,YAAY,CAAC;IAC9B,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,YAAY,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uGAAuG;IACvG,oBAAoB,EAAE,MAAM,CAAC;IAC7B,sCAAsC;IACtC,IAAI,EAAE,eAAe,EAAE,CAAC;IACxB,qDAAqD;IACrD,KAAK,EAAE,YAAY,CAAC;IACpB,sFAAsF;IACtF,kBAAkB,EAAE,YAAY,CAAC;IACjC,yEAAyE;IACzE,kBAAkB,EAAE,KAAK,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,6CAA6C;IAC7C,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,4DAA4D;IAC5D,KAAK,EAAE,YAAY,CAAC;CACrB"}
|