@itwin/core-backend 5.1.0-dev.4 → 5.1.0-dev.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/CHANGELOG.md +43 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +1 -1
  3. package/lib/cjs/BackendHubAccess.js +1 -1
  4. package/lib/cjs/BackendHubAccess.js.map +1 -1
  5. package/lib/cjs/BisCoreSchema.js +1 -1
  6. package/lib/cjs/BisCoreSchema.js.map +1 -1
  7. package/lib/cjs/BriefcaseManager.d.ts +10 -2
  8. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  9. package/lib/cjs/BriefcaseManager.js +12 -0
  10. package/lib/cjs/BriefcaseManager.js.map +1 -1
  11. package/lib/cjs/Category.d.ts +4 -4
  12. package/lib/cjs/Category.js +4 -4
  13. package/lib/cjs/Category.js.map +1 -1
  14. package/lib/cjs/ChangesetECAdaptor.d.ts +67 -8
  15. package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
  16. package/lib/cjs/ChangesetECAdaptor.js +248 -33
  17. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  18. package/lib/cjs/CloudSqlite.js +1 -1
  19. package/lib/cjs/CloudSqlite.js.map +1 -1
  20. package/lib/cjs/CodeSpecs.d.ts +1 -1
  21. package/lib/cjs/CodeSpecs.js +1 -1
  22. package/lib/cjs/CodeSpecs.js.map +1 -1
  23. package/lib/cjs/DisplayStyle.d.ts +4 -4
  24. package/lib/cjs/DisplayStyle.js +3 -3
  25. package/lib/cjs/DisplayStyle.js.map +1 -1
  26. package/lib/cjs/ECDb.d.ts +3 -3
  27. package/lib/cjs/ECDb.js +3 -3
  28. package/lib/cjs/ECDb.js.map +1 -1
  29. package/lib/cjs/ECSqlStatement.d.ts +14 -5
  30. package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
  31. package/lib/cjs/ECSqlStatement.js +17 -3
  32. package/lib/cjs/ECSqlStatement.js.map +1 -1
  33. package/lib/cjs/Element.d.ts +50 -50
  34. package/lib/cjs/Element.js +50 -50
  35. package/lib/cjs/Element.js.map +1 -1
  36. package/lib/cjs/ElementAspect.d.ts +8 -8
  37. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  38. package/lib/cjs/ElementAspect.js +8 -8
  39. package/lib/cjs/ElementAspect.js.map +1 -1
  40. package/lib/cjs/Entity.d.ts +2 -2
  41. package/lib/cjs/Entity.js +1 -1
  42. package/lib/cjs/Entity.js.map +1 -1
  43. package/lib/cjs/ExportGraphics.d.ts +54 -8
  44. package/lib/cjs/ExportGraphics.d.ts.map +1 -1
  45. package/lib/cjs/ExportGraphics.js +158 -59
  46. package/lib/cjs/ExportGraphics.js.map +1 -1
  47. package/lib/cjs/GeographicCRSServices.d.ts +6 -2
  48. package/lib/cjs/GeographicCRSServices.d.ts.map +1 -1
  49. package/lib/cjs/GeographicCRSServices.js +1 -1
  50. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  51. package/lib/cjs/IModelDb.d.ts +15 -13
  52. package/lib/cjs/IModelDb.d.ts.map +1 -1
  53. package/lib/cjs/IModelDb.js +49 -23
  54. package/lib/cjs/IModelDb.js.map +1 -1
  55. package/lib/cjs/IModelHost.d.ts +2 -2
  56. package/lib/cjs/IModelHost.js +2 -2
  57. package/lib/cjs/IModelHost.js.map +1 -1
  58. package/lib/cjs/Material.d.ts +1 -1
  59. package/lib/cjs/Material.js +1 -1
  60. package/lib/cjs/Material.js.map +1 -1
  61. package/lib/cjs/Model.d.ts +22 -22
  62. package/lib/cjs/Model.js +22 -22
  63. package/lib/cjs/Model.js.map +1 -1
  64. package/lib/cjs/SQLiteDb.d.ts +1 -1
  65. package/lib/cjs/SQLiteDb.js +1 -1
  66. package/lib/cjs/SQLiteDb.js.map +1 -1
  67. package/lib/cjs/Texture.d.ts +1 -1
  68. package/lib/cjs/Texture.js +1 -1
  69. package/lib/cjs/Texture.js.map +1 -1
  70. package/lib/cjs/TxnManager.d.ts +4 -4
  71. package/lib/cjs/TxnManager.js +1 -1
  72. package/lib/cjs/TxnManager.js.map +1 -1
  73. package/lib/cjs/ViewDefinition.d.ts +40 -14
  74. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  75. package/lib/cjs/ViewDefinition.js +42 -14
  76. package/lib/cjs/ViewDefinition.js.map +1 -1
  77. package/lib/cjs/annotations/FrameGeometry.d.ts +52 -0
  78. package/lib/cjs/annotations/FrameGeometry.d.ts.map +1 -0
  79. package/lib/cjs/annotations/FrameGeometry.js +250 -0
  80. package/lib/cjs/annotations/FrameGeometry.js.map +1 -0
  81. package/lib/cjs/{TextAnnotationElement.d.ts → annotations/TextAnnotationElement.d.ts} +6 -11
  82. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -0
  83. package/lib/cjs/{TextAnnotationElement.js → annotations/TextAnnotationElement.js} +20 -26
  84. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -0
  85. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +31 -0
  86. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -0
  87. package/lib/cjs/annotations/TextAnnotationGeometry.js +83 -0
  88. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -0
  89. package/lib/cjs/annotations/TextBlockGeometry.d.ts +16 -0
  90. package/lib/cjs/annotations/TextBlockGeometry.d.ts.map +1 -0
  91. package/lib/cjs/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +11 -68
  92. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -0
  93. package/lib/cjs/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +19 -7
  94. package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -0
  95. package/lib/cjs/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +19 -7
  96. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -0
  97. package/lib/cjs/core-backend.d.ts +5 -3
  98. package/lib/cjs/core-backend.d.ts.map +1 -1
  99. package/lib/cjs/core-backend.js +25 -6
  100. package/lib/cjs/core-backend.js.map +1 -1
  101. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
  102. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +1 -1
  103. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  104. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
  105. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  106. package/lib/esm/BackendHubAccess.d.ts +1 -1
  107. package/lib/esm/BackendHubAccess.js +1 -1
  108. package/lib/esm/BackendHubAccess.js.map +1 -1
  109. package/lib/esm/BisCoreSchema.js +1 -1
  110. package/lib/esm/BisCoreSchema.js.map +1 -1
  111. package/lib/esm/BriefcaseManager.d.ts +10 -2
  112. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  113. package/lib/esm/BriefcaseManager.js +12 -0
  114. package/lib/esm/BriefcaseManager.js.map +1 -1
  115. package/lib/esm/Category.d.ts +4 -4
  116. package/lib/esm/Category.js +4 -4
  117. package/lib/esm/Category.js.map +1 -1
  118. package/lib/esm/ChangesetECAdaptor.d.ts +67 -8
  119. package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
  120. package/lib/esm/ChangesetECAdaptor.js +248 -33
  121. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  122. package/lib/esm/CloudSqlite.js +1 -1
  123. package/lib/esm/CloudSqlite.js.map +1 -1
  124. package/lib/esm/CodeSpecs.d.ts +1 -1
  125. package/lib/esm/CodeSpecs.js +1 -1
  126. package/lib/esm/CodeSpecs.js.map +1 -1
  127. package/lib/esm/DisplayStyle.d.ts +4 -4
  128. package/lib/esm/DisplayStyle.js +3 -3
  129. package/lib/esm/DisplayStyle.js.map +1 -1
  130. package/lib/esm/ECDb.d.ts +3 -3
  131. package/lib/esm/ECDb.js +3 -3
  132. package/lib/esm/ECDb.js.map +1 -1
  133. package/lib/esm/ECSqlStatement.d.ts +14 -5
  134. package/lib/esm/ECSqlStatement.d.ts.map +1 -1
  135. package/lib/esm/ECSqlStatement.js +17 -3
  136. package/lib/esm/ECSqlStatement.js.map +1 -1
  137. package/lib/esm/Element.d.ts +50 -50
  138. package/lib/esm/Element.js +50 -50
  139. package/lib/esm/Element.js.map +1 -1
  140. package/lib/esm/ElementAspect.d.ts +8 -8
  141. package/lib/esm/ElementAspect.d.ts.map +1 -1
  142. package/lib/esm/ElementAspect.js +8 -8
  143. package/lib/esm/ElementAspect.js.map +1 -1
  144. package/lib/esm/Entity.d.ts +2 -2
  145. package/lib/esm/Entity.js +1 -1
  146. package/lib/esm/Entity.js.map +1 -1
  147. package/lib/esm/ExportGraphics.d.ts +54 -8
  148. package/lib/esm/ExportGraphics.d.ts.map +1 -1
  149. package/lib/esm/ExportGraphics.js +156 -58
  150. package/lib/esm/ExportGraphics.js.map +1 -1
  151. package/lib/esm/GeographicCRSServices.d.ts +6 -2
  152. package/lib/esm/GeographicCRSServices.d.ts.map +1 -1
  153. package/lib/esm/GeographicCRSServices.js +1 -1
  154. package/lib/esm/GeographicCRSServices.js.map +1 -1
  155. package/lib/esm/IModelDb.d.ts +15 -13
  156. package/lib/esm/IModelDb.d.ts.map +1 -1
  157. package/lib/esm/IModelDb.js +50 -24
  158. package/lib/esm/IModelDb.js.map +1 -1
  159. package/lib/esm/IModelHost.d.ts +2 -2
  160. package/lib/esm/IModelHost.js +2 -2
  161. package/lib/esm/IModelHost.js.map +1 -1
  162. package/lib/esm/Material.d.ts +1 -1
  163. package/lib/esm/Material.js +1 -1
  164. package/lib/esm/Material.js.map +1 -1
  165. package/lib/esm/Model.d.ts +22 -22
  166. package/lib/esm/Model.js +22 -22
  167. package/lib/esm/Model.js.map +1 -1
  168. package/lib/esm/SQLiteDb.d.ts +1 -1
  169. package/lib/esm/SQLiteDb.js +1 -1
  170. package/lib/esm/SQLiteDb.js.map +1 -1
  171. package/lib/esm/Texture.d.ts +1 -1
  172. package/lib/esm/Texture.js +1 -1
  173. package/lib/esm/Texture.js.map +1 -1
  174. package/lib/esm/TxnManager.d.ts +4 -4
  175. package/lib/esm/TxnManager.js +1 -1
  176. package/lib/esm/TxnManager.js.map +1 -1
  177. package/lib/esm/ViewDefinition.d.ts +40 -14
  178. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  179. package/lib/esm/ViewDefinition.js +42 -14
  180. package/lib/esm/ViewDefinition.js.map +1 -1
  181. package/lib/esm/annotations/FrameGeometry.d.ts +52 -0
  182. package/lib/esm/annotations/FrameGeometry.d.ts.map +1 -0
  183. package/lib/esm/annotations/FrameGeometry.js +245 -0
  184. package/lib/esm/annotations/FrameGeometry.js.map +1 -0
  185. package/lib/esm/{TextAnnotationElement.d.ts → annotations/TextAnnotationElement.d.ts} +6 -11
  186. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -0
  187. package/lib/esm/{TextAnnotationElement.js → annotations/TextAnnotationElement.js} +22 -28
  188. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -0
  189. package/lib/esm/annotations/TextAnnotationGeometry.d.ts +31 -0
  190. package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -0
  191. package/lib/esm/annotations/TextAnnotationGeometry.js +80 -0
  192. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -0
  193. package/lib/esm/annotations/TextBlockGeometry.d.ts +16 -0
  194. package/lib/esm/annotations/TextBlockGeometry.d.ts.map +1 -0
  195. package/lib/esm/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +11 -68
  196. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -0
  197. package/lib/esm/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +19 -7
  198. package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -0
  199. package/lib/esm/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +19 -7
  200. package/lib/esm/annotations/TextBlockLayout.js.map +1 -0
  201. package/lib/esm/core-backend.d.ts +5 -3
  202. package/lib/esm/core-backend.d.ts.map +1 -1
  203. package/lib/esm/core-backend.js +25 -3
  204. package/lib/esm/core-backend.js.map +1 -1
  205. package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
  206. package/lib/esm/rpc-impl/IModelReadRpcImpl.js +1 -1
  207. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  208. package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
  209. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  210. package/lib/esm/test/annotations/TextAnnotation.test.js +190 -1025
  211. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  212. package/lib/esm/test/annotations/TextBlock.test.d.ts +2 -0
  213. package/lib/esm/test/annotations/TextBlock.test.d.ts.map +1 -0
  214. package/lib/esm/test/annotations/TextBlock.test.js +969 -0
  215. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -0
  216. package/lib/esm/test/ecdb/ECDb.test.js +29 -8
  217. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  218. package/lib/esm/test/ecdb/ECSqlStatement.test.js +192 -0
  219. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  220. package/lib/esm/test/imodel/IModel.test.js +228 -5
  221. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  222. package/lib/esm/test/misc/GeoServices.test.js +23 -9
  223. package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
  224. package/lib/esm/test/standalone/ChangesetReader.test.js +451 -136
  225. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  226. package/lib/esm/test/standalone/ExportGraphics.test.js +53 -1
  227. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  228. package/lib/esm/test/standalone/GeometryStream.test.js +49 -1
  229. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  230. package/lib/esm/test/standalone/IModelLimits.test.d.ts +2 -0
  231. package/lib/esm/test/standalone/IModelLimits.test.d.ts.map +1 -0
  232. package/lib/esm/test/standalone/IModelLimits.test.js +103 -0
  233. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -0
  234. package/lib/esm/test/standalone/SnapshotDb.test.js +19 -1
  235. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  236. package/package.json +12 -12
  237. package/lib/cjs/TextAnnotationElement.d.ts.map +0 -1
  238. package/lib/cjs/TextAnnotationElement.js.map +0 -1
  239. package/lib/cjs/TextAnnotationGeometry.d.ts +0 -32
  240. package/lib/cjs/TextAnnotationGeometry.d.ts.map +0 -1
  241. package/lib/cjs/TextAnnotationGeometry.js.map +0 -1
  242. package/lib/cjs/TextAnnotationLayout.d.ts.map +0 -1
  243. package/lib/cjs/TextAnnotationLayout.js.map +0 -1
  244. package/lib/esm/TextAnnotationElement.d.ts.map +0 -1
  245. package/lib/esm/TextAnnotationElement.js.map +0 -1
  246. package/lib/esm/TextAnnotationGeometry.d.ts +0 -32
  247. package/lib/esm/TextAnnotationGeometry.d.ts.map +0 -1
  248. package/lib/esm/TextAnnotationGeometry.js.map +0 -1
  249. package/lib/esm/TextAnnotationLayout.d.ts.map +0 -1
  250. package/lib/esm/TextAnnotationLayout.js.map +0 -1
@@ -5,8 +5,7 @@
5
5
  /** @packageDocumentation
6
6
  * @module ElementGeometry
7
7
  */
8
- import { ColorDef, TextString } from "@itwin/core-common";
9
- import { layoutTextBlock } from "./TextAnnotationLayout";
8
+ import { TextString } from "@itwin/core-common";
10
9
  import { LineSegment3d, Point3d, Range2d, Transform, Vector2d } from "@itwin/core-geometry";
11
10
  import { assert } from "@itwin/core-bentley";
12
11
  function setColor(color, context) {
@@ -93,7 +92,15 @@ function processFractionRun(run, transform, context) {
93
92
  context.entries.push({ text: createFractionTextString(source.denominator, run, denominatorOffset, transform) });
94
93
  }
95
94
  }
96
- function produceTextBlockGeometry(layout, documentTransform, debugAnchorPt) {
95
+ /**
96
+ * Produces the geometry for a text block in a way that can be interpreted by a [[GeometryStreamBuilder]] or [[ElementBuilder.Geometry]].
97
+ * To build the geometry for a whole [[TextAnnotation]], use [[appendTextAnnotationGeometry]] instead.
98
+ * @param layout of the text block as computed by [[layoutTextBlock]].
99
+ * @param documentTransform that positions the text block in world coordinates.
100
+ * @returns TextBlockGeometryProps.
101
+ * @beta
102
+ */
103
+ export function produceTextBlockGeometry(layout, documentTransform) {
97
104
  const context = { entries: [] };
98
105
  for (const line of layout.lines) {
99
106
  const lineTrans = Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);
@@ -112,70 +119,6 @@ function produceTextBlockGeometry(layout, documentTransform, debugAnchorPt) {
112
119
  }
113
120
  }
114
121
  }
115
- if (debugAnchorPt) {
116
- context.entries.push({
117
- color: ColorDef.blue.toJSON()
118
- });
119
- // Draw a blue box to show the element's margin
120
- const marginCorners = layout.range.corners3d(true);
121
- documentTransform.multiplyPoint3dArrayInPlace(marginCorners);
122
- marginCorners.forEach((corner, index) => {
123
- const next = marginCorners[index + 1];
124
- if (!next)
125
- return;
126
- context.entries.push({
127
- separator: {
128
- startPoint: [corner.x, corner.y, 0],
129
- endPoint: [next.x, next.y, 0],
130
- },
131
- });
132
- });
133
- // Draw a blue x to show the anchor point - Rotation occurs around this point. The x will be 1 m by 1 m.
134
- context.entries.push({
135
- separator: {
136
- startPoint: [debugAnchorPt.x - 1, debugAnchorPt.y - 1, 0],
137
- endPoint: [debugAnchorPt.x + 1, debugAnchorPt.y + 1, 0],
138
- },
139
- });
140
- context.entries.push({
141
- separator: {
142
- startPoint: [debugAnchorPt.x + 1, debugAnchorPt.y - 1, 0],
143
- endPoint: [debugAnchorPt.x - 1, debugAnchorPt.y + 1, 0],
144
- },
145
- });
146
- // Draw a red box to show the text range
147
- context.entries.push({
148
- color: ColorDef.red.toJSON(),
149
- });
150
- const rangeCorners = layout.textRange.corners3d(true);
151
- documentTransform.multiplyPoint3dArrayInPlace(rangeCorners);
152
- rangeCorners.forEach((corner, index) => {
153
- const next = rangeCorners[index + 1];
154
- if (!next)
155
- return;
156
- context.entries.push({
157
- separator: {
158
- startPoint: [corner.x, corner.y, 0],
159
- endPoint: [next.x, next.y, 0],
160
- },
161
- });
162
- });
163
- }
164
122
  return { entries: context.entries };
165
123
  }
166
- /** Produce a geometric representation of a text annotation, with the annotation's anchor point at the origin.
167
- * The result can be supplied to [GeometryStreamBuilder.appendTextBlock]($common).
168
- * @see [[TextAnnotation2d.setAnnotation]] and [[TextAnnotation3d.setAnnotation]] to update the annotation, geometry, and placement of an annotation element.
169
- * @beta
170
- */
171
- export function produceTextAnnotationGeometry(args) {
172
- const layout = layoutTextBlock({
173
- ...args,
174
- textBlock: args.annotation.textBlock,
175
- });
176
- const dimensions = layout.range;
177
- const transform = args.annotation.computeTransform(dimensions);
178
- const anchorPoint = args.debugAnchorPointAndRange ? transform.multiplyPoint3d(args.annotation.computeAnchorPoint(dimensions)) : undefined;
179
- return produceTextBlockGeometry(layout, transform, anchorPoint);
180
- }
181
- //# sourceMappingURL=TextAnnotationGeometry.js.map
124
+ //# sourceMappingURL=TextBlockGeometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextBlockGeometry.js","sourceRoot":"","sources":["../../../src/annotations/TextBlockGeometry.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAuD,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAErH,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAO7C,SAAS,QAAQ,CAAC,KAAqB,EAAE,OAAwB;IAC/D,IAAI,KAAK,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC/B,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;QACzB,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAClC,CAAC;AACH,CAAC;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E,CAAC;IACjD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAChC,MAAM,SAAS,GAAG,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1G,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,WAAW,KAAK,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBACpC,SAAS;YACX,CAAC;YAED,MAAM,QAAQ,GAAG,SAAS,CAAC,oBAAoB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC/F,SAAS,CAAC,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACzD,iBAAiB,CAAC,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACjE,IAAI,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC/B,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YACzC,CAAC;iBAAM,CAAC;gBACN,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;AACtC,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 ElementGeometry\n */\n\nimport { TextBlockGeometryProps, TextBlockGeometryPropsEntry, TextString, TextStyleColor } from \"@itwin/core-common\";\nimport { RunLayout, TextBlockLayout } from \"./TextBlockLayout\";\nimport { LineSegment3d, Point3d, Range2d, Transform, Vector2d } from \"@itwin/core-geometry\";\nimport { assert } from \"@itwin/core-bentley\";\n\ninterface GeometryContext {\n curColor?: TextStyleColor;\n entries: TextBlockGeometryPropsEntry[];\n}\n\nfunction setColor(color: TextStyleColor, context: GeometryContext): void {\n if (color !== context.curColor) {\n context.curColor = color;\n context.entries.push({ color });\n }\n}\n\nfunction createTextString(text: string, run: RunLayout, origin?: Point3d): TextString {\n assert(text.length > 0);\n\n const { lineHeight, widthFactor, isBold, isItalic, isUnderlined } = run.style;\n\n return new TextString({\n text,\n font: run.fontId,\n height: lineHeight,\n widthFactor,\n bold: isBold,\n italic: isItalic,\n underline: isUnderlined,\n origin,\n });\n}\n\nfunction processTextRun(run: RunLayout, transform: Transform, context: GeometryContext): void {\n assert(run.source.type === \"text\");\n const text = run.source.content.substring(run.charOffset, run.charOffset + run.numChars);\n if (text.length === 0) {\n return;\n }\n\n const ts = createTextString(text, run);\n if (\"none\" !== run.source.baselineShift) {\n const isSub = \"subscript\" === run.source.baselineShift;\n const offsetFactor = run.style[isSub ? \"subScriptOffsetFactor\" : \"superScriptOffsetFactor\"];\n const scale = run.style[isSub ? \"subScriptScale\" : \"superScriptScale\"];\n\n ts.origin.y += offsetFactor * ts.height;\n ts.height *= scale;\n }\n\n ts.transformInPlace(transform);\n\n setColor(run.style.color, context);\n context.entries.push({ text: ts });\n}\n\nfunction createFractionTextString(text: string, run: RunLayout, origin: Point3d, transform: Transform): TextString {\n const ts = createTextString(text, run, origin);\n assert(undefined !== ts.widthFactor);\n\n ts.height *= run.style.stackedFractionScale;\n\n ts.transformInPlace(transform);\n\n return ts;\n}\n\nfunction processFractionRun(run: RunLayout, transform: Transform, context: GeometryContext): void {\n const source = run.source;\n assert(source.type === \"fraction\");\n\n if (source.numerator.length === 0 && source.denominator.length === 0) {\n return;\n }\n\n assert(undefined !== run.numeratorRange && undefined !== run.denominatorRange);\n\n const fontSize = new Vector2d(run.style.lineHeight * run.style.widthFactor, run.style.lineHeight);\n fontSize.scale(run.style.stackedFractionScale, fontSize);\n\n const numeratorOffset = new Point3d(run.numeratorRange.low.x, run.numeratorRange.low.y, 0);\n const denominatorOffset = new Point3d(run.denominatorRange.low.x, run.denominatorRange.low.y, 0);\n\n setColor(run.style.color, context);\n\n if (source.numerator.length > 0) {\n context.entries.push({ text: createFractionTextString(source.numerator, run, numeratorOffset, transform) });\n }\n\n const numeratorRange = Range2d.fromJSON(run.numeratorRange);\n const denominatorRange = Range2d.fromJSON(run.denominatorRange);\n\n let separator: LineSegment3d;\n if (run.style.stackedFractionType === \"horizontal\") {\n const fractionWidth = Math.max(numeratorRange.xLength(), denominatorRange.xLength());\n const y = 1.25 * denominatorRange.yLength();\n separator = LineSegment3d.createXYXY(0, y, fractionWidth, y);\n } else {\n const p0 = new Point3d(denominatorRange.low.x - fontSize.x / 2, denominatorRange.low.y + fontSize.y * (1 / 3), 0);\n const p1 = new Point3d(p0.x + fontSize.x, p0.y + fontSize.y * 1.5, 0);\n separator = LineSegment3d.createCapture(p0, p1);\n }\n\n separator.tryTransformInPlace(transform);\n\n context.entries.push({\n separator: {\n startPoint: separator.point0Ref.toJSON(),\n endPoint: separator.point1Ref.toJSON(),\n },\n });\n\n if (source.denominator.length > 0) {\n context.entries.push({ text: createFractionTextString(source.denominator, run, denominatorOffset, transform) });\n }\n}\n\n/**\n * Produces the geometry for a text block in a way that can be interpreted by a [[GeometryStreamBuilder]] or [[ElementBuilder.Geometry]].\n * To build the geometry for a whole [[TextAnnotation]], use [[appendTextAnnotationGeometry]] instead.\n * @param layout of the text block as computed by [[layoutTextBlock]].\n * @param documentTransform that positions the text block in world coordinates.\n * @returns TextBlockGeometryProps.\n * @beta\n */\nexport function produceTextBlockGeometry(layout: TextBlockLayout, documentTransform: Transform): TextBlockGeometryProps {\n const context: GeometryContext = { entries: [] };\n for (const line of layout.lines) {\n const lineTrans = Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);\n for (const run of line.runs) {\n if (\"linebreak\" === run.source.type) {\n continue;\n }\n\n const runTrans = Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);\n lineTrans.multiplyTransformTransform(runTrans, runTrans);\n documentTransform.multiplyTransformTransform(runTrans, runTrans);\n if (\"text\" === run.source.type) {\n processTextRun(run, runTrans, context);\n } else {\n processFractionRun(run, runTrans, context);\n }\n }\n }\n\n return { entries: context.entries };\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { BaselineShift, FontId, FontType, FractionRun, LineLayoutResult, Paragraph, Run, RunLayoutResult, TextBlock, TextBlockLayoutResult, TextRun, TextStyleSettings } from "@itwin/core-common";
5
5
  import { Range2d } from "@itwin/core-geometry";
6
- import { IModelDb } from "./IModelDb";
6
+ import { IModelDb } from "../IModelDb";
7
7
  /** @internal */
8
8
  export interface TextLayoutRanges {
9
9
  layout: Range2d;
@@ -55,13 +55,13 @@ export interface LayoutTextBlockArgs {
55
55
  * If the document specifies a width > 0, individual lines are split to try to avoid exceeding that width.
56
56
  * Individual TextRuns can be split onto multiple lines at word boundaries if necessary. Individual FractionRuns are never split.
57
57
  * @see [[computeLayoutTextBlockResult]]
58
- * @internal
58
+ * @beta
59
59
  */
60
60
  export declare function layoutTextBlock(args: LayoutTextBlockArgs): TextBlockLayout;
61
61
  /**
62
62
  * Gets the result of laying out the the contents of a TextBlock into a series of lines containing runs.
63
63
  * The visual layout accounts for the [TextStyle]($common)s, fonts, and [TextBlock.width]($common). It applies word-wrapping if needed.
64
- * The layout returned matches the visual layout of the geometry produced by [[produceTextAnnotationGeometry]].
64
+ * The layout returned matches the visual layout of the geometry produced by [[appendTextAnnotationGeometry]].
65
65
  * @beta
66
66
  */
67
67
  export declare function computeLayoutTextBlockResult(args: LayoutTextBlockArgs): TextBlockLayoutResult;
@@ -104,7 +104,12 @@ declare class LayoutContext {
104
104
  denominator: Range2d;
105
105
  };
106
106
  }
107
- /** @internal */
107
+ /**
108
+ * Represents the layout of a single run (text, fraction, or line break) within a line of text.
109
+ * Stores information about the run's position, style, and font within the line.
110
+ * Provides utilities for splitting text runs for word wrapping and converting to result objects.
111
+ * @beta
112
+ */
108
113
  export declare class RunLayout {
109
114
  source: Run;
110
115
  charOffset: number;
@@ -130,7 +135,12 @@ export declare class RunLayout {
130
135
  split(context: LayoutContext): RunLayout[];
131
136
  toResult(paragraph: Paragraph): RunLayoutResult;
132
137
  }
133
- /** @internal */
138
+ /**
139
+ * Represents the layout of a single line within a paragraph of a text block.
140
+ * Contains a sequence of RunLayout objects, the computed range of the line, and its offset from the document origin.
141
+ * Provides utilities for appending runs, computing ranges, and converting to result objects.
142
+ * @beta
143
+ */
134
144
  export declare class LineLayout {
135
145
  source: Paragraph;
136
146
  range: Range2d;
@@ -153,7 +163,9 @@ export declare class LineLayout {
153
163
  }
154
164
  /**
155
165
  * Describes the layout of a text block as a collection of lines containing runs.
156
- * @internal
166
+ * Computes the visual layout of the text block, including word wrapping, justification, and margins.
167
+ * Provides access to the computed lines, ranges, and utilities for converting to result objects.
168
+ * @beta
157
169
  */
158
170
  export declare class TextBlockLayout {
159
171
  source: TextBlock;
@@ -174,4 +186,4 @@ export declare class TextBlockLayout {
174
186
  private applyMargins;
175
187
  }
176
188
  export {};
177
- //# sourceMappingURL=TextAnnotationLayout.d.ts.map
189
+ //# sourceMappingURL=TextBlockLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextBlockLayout.d.ts","sourceRoot":"","sources":["../../../src/annotations/TextBlockLayout.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,qBAAqB,EAAoB,OAAO,EAAE,iBAAiB,EAA0B,MAAM,oBAAoB,CAAC;AAC7O,OAAO,EAAY,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC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IACnB,MAAM,EAAE,SAAS,CAAC;IAEzB,8FAA8F;IACvF,SAAS,UAAiB;IAEjC,wDAAwD;IACjD,KAAK,UAAiB;IACtB,KAAK,EAAE,UAAU,EAAE,CAAM;IAChC,OAAO,CAAC,QAAQ,CAAgB;gBAEb,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa;IAcrD,QAAQ,IAAI,qBAAqB;IAOxC,yEAAyE;IAClE,SAAS,IAAI,MAAM;IAI1B,OAAO,KAAK,KAAK,GAGhB;IAED,OAAO,CAAC,aAAa;IAqDrB,OAAO,CAAC,YAAY;IA6BpB,OAAO,CAAC,SAAS;IAqCjB,OAAO,CAAC,YAAY;CAoBrB"}
@@ -16,7 +16,7 @@ import * as LineBreaker from "linebreak";
16
16
  * If the document specifies a width > 0, individual lines are split to try to avoid exceeding that width.
17
17
  * Individual TextRuns can be split onto multiple lines at word boundaries if necessary. Individual FractionRuns are never split.
18
18
  * @see [[computeLayoutTextBlockResult]]
19
- * @internal
19
+ * @beta
20
20
  */
21
21
  export function layoutTextBlock(args) {
22
22
  const findFontId = args.findFontId ?? ((name, type) => args.iModel.fonts.findId({ name, type }) ?? 0);
@@ -28,7 +28,7 @@ export function layoutTextBlock(args) {
28
28
  /**
29
29
  * Gets the result of laying out the the contents of a TextBlock into a series of lines containing runs.
30
30
  * The visual layout accounts for the [TextStyle]($common)s, fonts, and [TextBlock.width]($common). It applies word-wrapping if needed.
31
- * The layout returned matches the visual layout of the geometry produced by [[produceTextAnnotationGeometry]].
31
+ * The layout returned matches the visual layout of the geometry produced by [[appendTextAnnotationGeometry]].
32
32
  * @beta
33
33
  */
34
34
  export function computeLayoutTextBlockResult(args) {
@@ -189,7 +189,12 @@ function split(source) {
189
189
  }
190
190
  return segments;
191
191
  }
192
- /** @internal */
192
+ /**
193
+ * Represents the layout of a single run (text, fraction, or line break) within a line of text.
194
+ * Stores information about the run's position, style, and font within the line.
195
+ * Provides utilities for splitting text runs for word wrapping and converting to result objects.
196
+ * @beta
197
+ */
193
198
  export class RunLayout {
194
199
  source;
195
200
  charOffset;
@@ -302,7 +307,12 @@ export class RunLayout {
302
307
  return result;
303
308
  }
304
309
  }
305
- /** @internal */
310
+ /**
311
+ * Represents the layout of a single line within a paragraph of a text block.
312
+ * Contains a sequence of RunLayout objects, the computed range of the line, and its offset from the document origin.
313
+ * Provides utilities for appending runs, computing ranges, and converting to result objects.
314
+ * @beta
315
+ */
306
316
  export class LineLayout {
307
317
  source;
308
318
  range = new Range2d(0, 0, 0, 0);
@@ -361,7 +371,9 @@ export class LineLayout {
361
371
  }
362
372
  /**
363
373
  * Describes the layout of a text block as a collection of lines containing runs.
364
- * @internal
374
+ * Computes the visual layout of the text block, including word wrapping, justification, and margins.
375
+ * Provides access to the computed lines, ranges, and utilities for converting to result objects.
376
+ * @beta
365
377
  */
366
378
  export class TextBlockLayout {
367
379
  source;
@@ -385,7 +397,7 @@ export class TextBlockLayout {
385
397
  toResult() {
386
398
  return {
387
399
  lines: this.lines.map((x) => x.toResult(this.source)),
388
- range: this.textRange.toJSON(),
400
+ range: this.range.toJSON(),
389
401
  };
390
402
  }
391
403
  /** Compute a string representation, primarily for debugging purposes. */
@@ -510,4 +522,4 @@ export class TextBlockLayout {
510
522
  this.range.extendXY(xLow, yLow);
511
523
  }
512
524
  }
513
- //# sourceMappingURL=TextAnnotationLayout.js.map
525
+ //# sourceMappingURL=TextBlockLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextBlockLayout.js","sourceRoot":"","sources":["../../../src/annotations/TextBlockLayout.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAgK,iBAAiB,EAA0B,MAAM,oBAAoB,CAAC;AAC7O,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,MAAM,EAA2B,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,WAAW,MAAM,WAAW,CAAC;AAqDz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CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACrD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAExD,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC;QAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;QAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;QACzC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;QAE3C,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;CACF","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 ElementGeometry\n */\n\nimport { BaselineShift, FontId, FontType, FractionRun, LineLayoutResult, Paragraph, Run, RunLayoutResult, TextBlock, TextBlockLayoutResult, TextBlockMargins, TextRun, TextStyleSettings, TextStyleSettingsProps } from \"@itwin/core-common\";\nimport { Geometry, Range2d } from \"@itwin/core-geometry\";\nimport { IModelDb } from \"../IModelDb\";\nimport { assert, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\nimport * as LineBreaker from \"linebreak\";\n\n\n/** @internal */\nexport interface TextLayoutRanges {\n layout: Range2d;\n justification: Range2d;\n}\n\n/** Arguments to [[ComputeRangesForTextLayout]].\n * @internal\n */\nexport interface ComputeRangesForTextLayoutArgs {\n chars: string;\n bold: boolean;\n italic: boolean;\n baselineShift: BaselineShift;\n fontId: FontId;\n widthFactor: number;\n lineHeight: number;\n}\n\n/** A function that uses a font to compute the layout and justification ranges of a string of text.\n * @internal\n */\nexport type ComputeRangesForTextLayout = (args: ComputeRangesForTextLayoutArgs) => TextLayoutRanges;\n\n/** A function that looks up the font Id corresponding to a [FontFamilyDescriptor]($common).\n * If no type is provided, the function can return a font of any type matching `name` (there may be more than one, of different types).\n * @internal\n */\nexport type FindFontId = (name: string, type?: FontType) => FontId;\n\n/** @internal */\nexport type FindTextStyle = (name: string) => TextStyleSettings;\n\n/**\n * Arguments supplied to [[computeLayoutTextBlockResult]].\n * @beta\n */\nexport interface LayoutTextBlockArgs {\n /** The text block whose extents are to be computed. */\n textBlock: TextBlock;\n /** The iModel from which to obtain fonts and [TextStyle]($common)s when laying out glyphs. */\n iModel: IModelDb;\n /** @internal chiefly for tests, by default uses IModelJsNative.DgnDb.computeRangesForText. */\n computeTextRange?: ComputeRangesForTextLayout;\n /** @internal chiefly for tests, by default looks up styles from a workspace. */\n findTextStyle?: FindTextStyle;\n /** @internal chiefly for tests, by default uses IModelDb.fontMap. */\n findFontId?: FindFontId;\n}\n\n/**\n * Lays out the contents of a TextBlock into a series of lines containing runs.\n * Each paragraph is decomposed into a series of lines.\n * Each series of consecutive non-linebreak runs within a paragraph is concatenated into one line.\n * If the document specifies a width > 0, individual lines are split to try to avoid exceeding that width.\n * Individual TextRuns can be split onto multiple lines at word boundaries if necessary. Individual FractionRuns are never split.\n * @see [[computeLayoutTextBlockResult]]\n * @beta\n */\nexport function layoutTextBlock(args: LayoutTextBlockArgs): TextBlockLayout {\n const findFontId = args.findFontId ?? ((name, type) => args.iModel.fonts.findId({ name, type }) ?? 0);\n const computeTextRange = args.computeTextRange ?? ((x) => args.iModel.computeRangesForText(x));\n\n // ###TODO finding text styles in workspaces.\n const findTextStyle = args.findTextStyle ?? (() => TextStyleSettings.fromJSON());\n\n return new TextBlockLayout(args.textBlock, new LayoutContext(args.textBlock, computeTextRange, findTextStyle, findFontId));\n}\n\n/**\n * Gets the result of laying out the the contents of a TextBlock into a series of lines containing runs.\n * The visual layout accounts for the [TextStyle]($common)s, fonts, and [TextBlock.width]($common). It applies word-wrapping if needed.\n * The layout returned matches the visual layout of the geometry produced by [[appendTextAnnotationGeometry]].\n * @beta\n */\nexport function computeLayoutTextBlockResult(args: LayoutTextBlockArgs): TextBlockLayoutResult {\n const layout = layoutTextBlock(args);\n return layout.toResult();\n}\n\n/**\n * Arguments supplied to [[computeGraphemeOffsets]].\n * @beta\n */\nexport interface ComputeGraphemeOffsetsArgs extends LayoutTextBlockArgs {\n /** The index of the [Paragraph]($common) in the text block that contains the run layout result text. */\n paragraphIndex: number;\n /** The run layout result for which grapheme ranges will be computed. */\n runLayoutResult: RunLayoutResult;\n /** An array of starting character indexes for each grapheme. Each entry represents the index of the first character in a grapheme. */\n graphemeCharIndexes: number[];\n};\n\n/**\n * Computes the range from the start of a [RunLayoutResult]($common) to the trailing edge of each grapheme.\n * It is the responsibility of the caller to determine the number and character indexes of the graphemes.\n * @returns If the [RunLayoutResult]($common)'s source is a [TextRun]($common), it returns an array containing the range of each grapheme.\n * Otherwise, it returns and empty array.\n * @beta\n */\nexport function computeGraphemeOffsets(args: ComputeGraphemeOffsetsArgs): Range2d[] {\n const { textBlock, paragraphIndex, runLayoutResult, graphemeCharIndexes, iModel } = args;\n const findFontId = args.findFontId ?? ((name, type) => iModel.fonts.findId({ name, type }) ?? 0);\n const computeTextRange = args.computeTextRange ?? ((x) => iModel.computeRangesForText(x));\n const findTextStyle = args.findTextStyle ?? (() => TextStyleSettings.fromJSON());\n const source = textBlock.paragraphs[paragraphIndex].runs[runLayoutResult.sourceRunIndex];\n\n if (source.type !== \"text\" || runLayoutResult.characterCount === 0) {\n return [];\n }\n\n const style = TextStyleSettings.fromJSON(runLayoutResult.textStyle);\n\n const layoutContext = new LayoutContext(textBlock, computeTextRange, findTextStyle, findFontId);\n const graphemeRanges: Range2d[] = [];\n\n graphemeCharIndexes.forEach((_, index) => {\n const nextGraphemeCharIndex = graphemeCharIndexes[index + 1] ?? runLayoutResult.characterCount;\n graphemeRanges.push(layoutContext.computeRangeForTextRun(style, source, runLayoutResult.characterOffset, nextGraphemeCharIndex).layout);\n });\n return graphemeRanges;\n}\n\nfunction scaleRange(range: Range2d, scale: number): void {\n range.low.scaleInPlace(scale);\n range.high.scaleInPlace(scale);\n}\n\nfunction applyBlockSettings(target: TextStyleSettings, source: TextStyleSettings | TextStyleSettingsProps): TextStyleSettings {\n if (source === target) {\n return target;\n }\n\n const lineSpacingFactor = source.lineSpacingFactor ?? target.lineSpacingFactor;\n const lineHeight = source.lineHeight ?? target.lineHeight;\n const widthFactor = source.widthFactor ?? target.widthFactor;\n\n if (lineSpacingFactor !== target.lineSpacingFactor || lineHeight !== target.lineHeight || widthFactor !== target.widthFactor) {\n target = target.clone({ lineSpacingFactor, lineHeight, widthFactor });\n }\n\n return target;\n}\n\nclass LayoutContext {\n private readonly _textStyles = new Map<string, TextStyleSettings>();\n private readonly _fontIds = new Map<string, FontId>();\n public readonly blockSettings: TextStyleSettings;\n\n public constructor(block: TextBlock, private readonly _computeTextRange: ComputeRangesForTextLayout, private readonly _findTextStyle: FindTextStyle, private readonly _findFontId: FindFontId) {\n const settings = this.findTextStyle(block.styleName);\n this.blockSettings = applyBlockSettings(settings, block.styleOverrides);\n }\n\n public findFontId(name: string): FontId {\n let fontId = this._fontIds.get(name);\n if (undefined === fontId) {\n this._fontIds.set(name, fontId = this._findFontId(name));\n }\n\n return fontId;\n }\n\n public findTextStyle(name: string): TextStyleSettings {\n let style = this._textStyles.get(name);\n if (undefined === style) {\n this._textStyles.set(name, style = this._findTextStyle(name));\n }\n\n return style;\n }\n\n public createRunSettings(run: Run): TextStyleSettings {\n let settings = this.findTextStyle(run.styleName);\n if (run.overridesStyle) {\n settings = settings.clone(run.styleOverrides);\n }\n\n return applyBlockSettings(settings, this.blockSettings);\n }\n\n public computeRangeForText(chars: string, style: TextStyleSettings, baselineShift: BaselineShift): TextLayoutRanges {\n if (chars.length === 0) {\n return {\n layout: new Range2d(0, 0, 0, style.lineHeight),\n justification: new Range2d(),\n };\n }\n\n const fontId = this.findFontId(style.fontName);\n const { layout, justification } = this._computeTextRange({\n chars,\n fontId,\n baselineShift,\n bold: style.isBold,\n italic: style.isItalic,\n lineHeight: this.blockSettings.lineHeight,\n widthFactor: this.blockSettings.widthFactor,\n });\n\n if (\"none\" !== baselineShift) {\n const isSub = \"subscript\" === baselineShift;\n const scale = isSub ? style.subScriptScale : style.superScriptScale;\n const offsetFactor = isSub ? style.subScriptOffsetFactor : style.superScriptOffsetFactor;\n const offset = { x: 0, y: style.lineHeight * offsetFactor };\n\n scaleRange(layout, scale);\n layout.cloneTranslated(offset, layout);\n\n scaleRange(justification, scale);\n justification.cloneTranslated(offset, justification);\n }\n\n return { layout, justification };\n }\n\n public computeRangeForTextRun(style: TextStyleSettings, run: TextRun, charOffset: number, numChars: number): TextLayoutRanges {\n return this.computeRangeForText(run.content.substring(charOffset, charOffset + numChars), style, run.baselineShift);\n }\n\n public computeRangeForFractionRun(style: TextStyleSettings, source: FractionRun): { layout: Range2d, numerator: Range2d, denominator: Range2d } {\n const numerator = this.computeRangeForText(source.numerator, style, \"none\").layout;\n scaleRange(numerator, style.stackedFractionScale);\n\n const denominator = this.computeRangeForText(source.denominator, style, \"none\").layout;\n scaleRange(denominator, style.stackedFractionScale);\n\n const numLen = numerator.xLength();\n const denomLen = denominator.xLength();\n switch (style.stackedFractionType) {\n case \"horizontal\": {\n if (numLen > denomLen) {\n denominator.cloneTranslated({ x: (numLen - denomLen) / 2, y: 0 }, denominator);\n } else {\n numerator.cloneTranslated({ x: (denomLen - numLen) / 2, y: 0 }, numerator);\n }\n\n numerator.cloneTranslated({ x: 0, y: 1.5 * denominator.yLength() }, numerator);\n break;\n }\n case \"diagonal\": {\n numerator.cloneTranslated({ x: 0, y: denominator.yLength() }, numerator);\n denominator.cloneTranslated({ x: numLen, y: 0 }, denominator);\n break;\n }\n }\n\n const layout = numerator.clone();\n layout.extendRange(denominator);\n return { layout, numerator, denominator };\n }\n}\n\ninterface Segment {\n segment: string;\n index: number;\n}\n\nfunction split(source: string): Segment[] {\n if (source.length === 0) {\n return [];\n }\n\n let index = 0;\n const segments: Segment[] = [];\n const breaker = new LineBreaker(source);\n for (let brk = breaker.nextBreak(); brk; brk = breaker.nextBreak()) {\n segments.push({\n segment: source.slice(index, brk.position),\n index,\n });\n\n index = brk.position;\n }\n\n return segments;\n}\n\n/**\n * Represents the layout of a single run (text, fraction, or line break) within a line of text.\n * Stores information about the run's position, style, and font within the line.\n * Provides utilities for splitting text runs for word wrapping and converting to result objects.\n * @beta\n */\nexport class RunLayout {\n public source: Run;\n public charOffset: number;\n public numChars: number;\n public range: Range2d;\n public justificationRange?: Range2d;\n public denominatorRange?: Range2d;\n public numeratorRange?: Range2d;\n public offsetFromLine: { x: number, y: number };\n public style: TextStyleSettings;\n public fontId: FontId;\n\n private constructor(props: NonFunctionPropertiesOf<RunLayout>) {\n this.source = props.source;\n this.charOffset = props.charOffset;\n this.numChars = props.numChars;\n this.range = props.range;\n this.justificationRange = props.justificationRange;\n this.denominatorRange = props.denominatorRange;\n this.numeratorRange = props.numeratorRange;\n this.offsetFromLine = props.offsetFromLine;\n this.style = props.style;\n this.fontId = props.fontId;\n }\n\n public static create(source: Run, context: LayoutContext): RunLayout {\n const style = context.createRunSettings(source);\n const fontId = context.findFontId(style.fontName);\n const charOffset = 0;\n const offsetFromLine = { x: 0, y: 0 };\n let numChars = 0;\n\n let range, justificationRange, numeratorRange, denominatorRange;\n\n switch (source.type) {\n case \"text\": {\n numChars = source.content.length;\n const ranges = context.computeRangeForTextRun(style, source, charOffset, numChars);\n range = ranges.layout;\n justificationRange = ranges.justification;\n break;\n }\n case \"fraction\": {\n numChars = 1;\n const ranges = context.computeRangeForFractionRun(style, source);\n range = ranges.layout;\n numeratorRange = ranges.numerator;\n denominatorRange = ranges.denominator;\n break;\n }\n default: {\n // We do this so that blank lines space correctly without special casing later.\n range = new Range2d(0, 0, 0, style.lineHeight);\n break;\n }\n }\n\n return new RunLayout({ source, charOffset, numChars, range, justificationRange, denominatorRange, numeratorRange, offsetFromLine, style, fontId });\n }\n\n /** Compute a string representation, primarily for debugging purposes. */\n public stringify(): string {\n return this.source.type === \"text\" ? this.source.content.substring(this.charOffset, this.charOffset + this.numChars) : this.source.stringify();\n }\n\n public canWrap(): this is { source: TextRun } {\n return this.source.type === \"text\";\n }\n\n private cloneForWrap(args: { ranges: TextLayoutRanges, charOffset: number, numChars: number }): RunLayout {\n assert(this.canWrap());\n\n return new RunLayout({\n ...this,\n charOffset: args.charOffset,\n numChars: args.numChars,\n range: args.ranges.layout,\n justificationRange: args.ranges.justification,\n offsetFromLine: { ...this.offsetFromLine },\n });\n }\n\n public split(context: LayoutContext): RunLayout[] {\n assert(this.charOffset === 0, \"cannot re-split a run\");\n if (!this.canWrap() || this.charOffset > 0) {\n return [this];\n }\n\n const myText = this.source.content.substring(this.charOffset, this.charOffset + this.numChars);\n const segments = split(myText);\n\n if (segments.length <= 1) {\n return [this];\n }\n\n return segments.map((segment: any) => {\n return this.cloneForWrap({\n ranges: context.computeRangeForText(segment.segment, this.style, this.source.baselineShift),\n charOffset: segment.index,\n numChars: segment.segment.length,\n });\n });\n }\n\n public toResult(paragraph: Paragraph): RunLayoutResult {\n const result: RunLayoutResult = {\n sourceRunIndex: paragraph.runs.indexOf(this.source),\n fontId: this.fontId,\n characterOffset: this.charOffset,\n characterCount: this.numChars,\n range: this.range.toJSON(),\n offsetFromLine: this.offsetFromLine,\n textStyle: this.style.toJSON(),\n };\n\n if (this.justificationRange) {\n result.justificationRange = this.justificationRange.toJSON();\n }\n\n if (this.numeratorRange) {\n result.numeratorRange = this.numeratorRange.toJSON();\n }\n\n if (this.denominatorRange) {\n result.denominatorRange = this.denominatorRange.toJSON();\n }\n\n return result;\n }\n}\n\n/**\n * Represents the layout of a single line within a paragraph of a text block.\n * Contains a sequence of RunLayout objects, the computed range of the line, and its offset from the document origin.\n * Provides utilities for appending runs, computing ranges, and converting to result objects.\n * @beta\n */\nexport class LineLayout {\n public source: Paragraph;\n public range = new Range2d(0, 0, 0, 0);\n public justificationRange = new Range2d(0, 0, 0, 0);\n public offsetFromDocument = { x: 0, y: 0 };\n private _runs: RunLayout[] = [];\n\n public constructor(source: Paragraph) {\n this.source = source;\n }\n\n /** Compute a string representation, primarily for debugging purposes. */\n public stringify(): string {\n const runs = this._runs.map((run) => run.stringify());\n return `${runs.join(\"\")}`;\n }\n\n public get runs(): ReadonlyArray<RunLayout> { return this._runs; }\n public get isEmpty() { return this._runs.length === 0; }\n public get back(): RunLayout {\n assert(!this.isEmpty);\n return this._runs[this._runs.length - 1];\n }\n\n public append(run: RunLayout): void {\n this._runs.push(run);\n this.computeRanges();\n }\n\n /** Invoked every time a run is appended,. */\n private computeRanges(): void {\n this.range.low.setZero();\n this.range.high.setZero();\n\n // Some runs (fractions) are taller than others.\n // We want to center each run vertically inside the line.\n let lineHeight = 0;\n for (const run of this._runs) {\n lineHeight = Math.max(lineHeight, run.range.yLength());\n }\n\n for (const run of this._runs) {\n const runHeight = run.range.yLength();\n const runOffset = { x: this.range.high.x, y: (lineHeight - runHeight) / 2 };\n run.offsetFromLine = runOffset;\n\n const runLayoutRange = run.range.cloneTranslated(runOffset);\n this.range.extendRange(runLayoutRange);\n\n if (\"linebreak\" !== run.source.type) {\n const runJustificationRange = run.justificationRange?.cloneTranslated(runOffset);\n this.justificationRange.extendRange(runJustificationRange ?? runLayoutRange);\n }\n }\n }\n\n public toResult(textBlock: TextBlock): LineLayoutResult {\n return {\n sourceParagraphIndex: textBlock.paragraphs.indexOf(this.source),\n runs: this.runs.map((x) => x.toResult(this.source)),\n range: this.range.toJSON(),\n justificationRange: this.justificationRange.toJSON(),\n offsetFromDocument: this.offsetFromDocument,\n };\n }\n}\n\n/**\n * Describes the layout of a text block as a collection of lines containing runs.\n * Computes the visual layout of the text block, including word wrapping, justification, and margins.\n * Provides access to the computed lines, ranges, and utilities for converting to result objects.\n * @beta\n */\nexport class TextBlockLayout {\n public source: TextBlock;\n\n /** @internal: This is primarily for debugging purposes. This is the range of text geometry */\n public textRange = new Range2d();\n\n /** The range including margins of the [[TextBlock]]. */\n public range = new Range2d();\n public lines: LineLayout[] = [];\n private _context: LayoutContext;\n\n public constructor(source: TextBlock, context: LayoutContext) {\n this._context = context;\n this.source = source;\n\n if (source.width > 0) {\n this.textRange.low.x = 0;\n this.textRange.high.x = source.width;\n }\n\n this.populateLines(context);\n this.justifyLines();\n this.applyMargins(source.margins);\n }\n\n public toResult(): TextBlockLayoutResult {\n return {\n lines: this.lines.map((x) => x.toResult(this.source)),\n range: this.range.toJSON(),\n };\n }\n\n /** Compute a string representation, primarily for debugging purposes. */\n public stringify(): string {\n return this.lines.map((line) => line.stringify()).join(\"\\n\");\n }\n\n private get _back(): LineLayout {\n assert(this.lines.length > 0);\n return this.lines[this.lines.length - 1];\n }\n\n private populateLines(context: LayoutContext): void {\n const doc = this.source;\n if (doc.paragraphs.length === 0) {\n return;\n }\n\n const doWrap = doc.width > 0;\n let curLine = new LineLayout(doc.paragraphs[0]);\n for (let i = 0; i < doc.paragraphs.length; i++) {\n const paragraph = doc.paragraphs[i];\n if (i > 0) {\n curLine = this.flushLine(context, curLine, paragraph);\n }\n\n let runs = paragraph.runs.map((run) => RunLayout.create(run, context));\n if (doWrap) {\n runs = runs.map((run) => run.split(context)).flat();\n }\n\n for (const run of runs) {\n if (\"linebreak\" === run.source.type) {\n curLine.append(run);\n curLine = this.flushLine(context, curLine);\n continue;\n }\n\n if (!doWrap) {\n curLine.append(run);\n continue;\n }\n\n const runWidth = run.range.xLength();\n const lineWidth = curLine.range.xLength();\n if (runWidth + lineWidth < doc.width || Geometry.isAlmostEqualNumber(runWidth + lineWidth, doc.width, Geometry.smallMetricDistance)) {\n curLine.append(run);\n continue;\n }\n\n if (curLine.runs.length === 0) {\n curLine.append(run);\n curLine = this.flushLine(context, curLine);\n } else {\n curLine = this.flushLine(context, curLine);\n curLine.append(run);\n }\n }\n }\n\n if (curLine.runs.length > 0) {\n this.flushLine(context, curLine);\n }\n }\n\n private justifyLines(): void {\n // We don't want to justify empty text, or a single line of text whose width is 0. By default text is already left justified.\n if (this.lines.length < 1 || (this.lines.length === 1 && this.source.width === 0) || \"left\" === this.source.justification) {\n return;\n }\n\n // This is the minimum width of the document's bounding box.\n const docWidth = this.source.width;\n\n let minOffset = Number.MAX_VALUE;\n for (const line of this.lines) {\n const lineWidth = line.justificationRange.xLength();\n\n let offset = docWidth - lineWidth;\n if (\"center\" === this.source.justification) {\n offset = offset / 2;\n }\n\n line.offsetFromDocument.x += offset;\n minOffset = Math.min(offset, minOffset);\n }\n\n if (minOffset < 0) {\n // Shift left to accommodate lines that exceeded the document's minimum width.\n this.textRange.low.x += minOffset;\n this.textRange.high.x += minOffset;\n }\n }\n\n private flushLine(context: LayoutContext, line: LineLayout, nextParagraph?: Paragraph): LineLayout {\n nextParagraph = nextParagraph ?? line.source;\n\n // We want to guarantee that each layout line has at least one run.\n if (line.runs.length === 0) {\n // If we're empty, there should always be a preceding run, and it should be a line break.\n if (this.lines.length === 0 || this._back.runs.length === 0) {\n return new LineLayout(nextParagraph);\n }\n\n const prevRun = this._back.back.source;\n assert(prevRun.type === \"linebreak\");\n if (prevRun.type !== \"linebreak\") {\n return new LineLayout(nextParagraph);\n }\n\n line.append(RunLayout.create(prevRun.clone(), context));\n }\n\n // Line origin is its baseline.\n const lineOffset = { x: 0, y: -line.range.yLength() };\n\n // Place it below any existing lines\n if (this.lines.length > 0) {\n lineOffset.y += this._back.offsetFromDocument.y;\n lineOffset.y -= context.blockSettings.lineSpacingFactor * context.blockSettings.lineHeight;\n }\n\n line.offsetFromDocument = lineOffset;\n\n // Update document range from computed line range and position\n this.textRange.extendRange(line.range.cloneTranslated(lineOffset));\n\n this.lines.push(line);\n return new LineLayout(nextParagraph);\n }\n\n private applyMargins(margins: TextBlockMargins) {\n this.range = this.textRange.clone();\n\n if (this.range.isNull)\n return;\n\n // Disregard negative margins.\n const right = margins.right >= 0 ? margins.right : 0;\n const left = margins.left >= 0 ? margins.left : 0;\n const top = margins.top >= 0 ? margins.top : 0;\n const bottom = margins.bottom >= 0 ? margins.bottom : 0;\n\n const xHigh = this.textRange.high.x + right;\n const yHigh = this.textRange.high.y + top;\n const xLow = this.textRange.low.x - left;\n const yLow = this.textRange.low.y - bottom;\n\n this.range.extendXY(xHigh, yHigh);\n this.range.extendXY(xLow, yLow);\n }\n}\n"]}
@@ -1,3 +1,8 @@
1
+ export * from "./annotations/FrameGeometry";
2
+ export * from "./annotations/TextAnnotationElement";
3
+ export * from "./annotations/TextAnnotationGeometry";
4
+ export * from "./annotations/TextBlockGeometry";
5
+ export * from "./annotations/TextBlockLayout";
1
6
  export * from "./BackendHubAccess";
2
7
  export * from "./BackendLoggerCategory";
3
8
  export * from "./BisCoreSchema";
@@ -58,9 +63,6 @@ export * from "./SchemaUtils";
58
63
  export * from "./SheetIndex";
59
64
  export * from "./SQLiteDb";
60
65
  export * from "./SqliteStatement";
61
- export * from "./TextAnnotationElement";
62
- export { computeGraphemeOffsets, computeLayoutTextBlockResult, ComputeGraphemeOffsetsArgs, LayoutTextBlockArgs, } from "./TextAnnotationLayout";
63
- export * from "./TextAnnotationGeometry";
64
66
  export * from "./Texture";
65
67
  export * from "./TileStorage";
66
68
  export * from "./TxnManager";
@@ -1 +1 @@
1
- {"version":3,"file":"core-backend.d.ts","sourceRoot":"","sources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entley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
+ export * from "./annotations/FrameGeometry";
6
+ export * from "./annotations/TextAnnotationElement";
7
+ export * from "./annotations/TextAnnotationGeometry";
8
+ export * from "./annotations/TextBlockGeometry";
9
+ export * from "./annotations/TextBlockLayout";
5
10
  export * from "./BackendHubAccess";
6
11
  export * from "./BackendLoggerCategory";
7
12
  export * from "./BisCoreSchema";
@@ -62,9 +67,6 @@ export * from "./SchemaUtils";
62
67
  export * from "./SheetIndex";
63
68
  export * from "./SQLiteDb";
64
69
  export * from "./SqliteStatement";
65
- export * from "./TextAnnotationElement";
66
- export { computeGraphemeOffsets, computeLayoutTextBlockResult, } from "./TextAnnotationLayout";
67
- export * from "./TextAnnotationGeometry";
68
70
  export * from "./Texture";
69
71
  export * from "./TileStorage";
70
72
  export * from "./TxnManager";
@@ -77,6 +79,26 @@ export * from "./workspace/WorkspaceEditor";
77
79
  export * from "./SqliteChangesetReader";
78
80
  export * from "./ChangesetECAdaptor";
79
81
  export * from "./internal/cross-package";
82
+ const globalSymbolCoreBackend = Symbol.for("itwin.core.backend.globals");
83
+ if (globalThis[globalSymbolCoreBackend]) {
84
+ // Get the stack trace from when the module was first loaded
85
+ const firstLoadStack = globalThis[globalSymbolCoreBackend].stack;
86
+ const error = new Error("Multiple @itwin/core-backend imports detected! This may happen if:\n" +
87
+ "- You have multiple versions of the package installed\n" +
88
+ "- Your bundling configuration is incorrect\n" +
89
+ "- You're importing from both ESM and CommonJS versions");
90
+ /* eslint-disable no-console */
91
+ console.error("Duplicate @itwin/core-backend import:", error);
92
+ console.error("First import occurred at:", firstLoadStack);
93
+ console.error("Current import occurred at:", error.stack);
94
+ /* eslint-enable no-console */
95
+ throw error;
96
+ }
97
+ else {
98
+ globalThis[globalSymbolCoreBackend] = {
99
+ stack: new Error().stack,
100
+ };
101
+ }
80
102
  /** @docs-package-description
81
103
  * The core-backend package always runs on the computer with a local Briefcase.
82
104
  *
@@ -1 +1 @@
1
- {"version":3,"file":"core-backend.js","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,QAAQ,CAAC;AACvB,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC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GG;AAEH;;;;GAIG;AAEH;;;GAGG","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\nexport * from \"./BackendHubAccess\";\nexport * from \"./BackendLoggerCategory\";\nexport * from \"./BisCoreSchema\";\nexport * from \"./BlobContainerService\";\nexport * from \"./BriefcaseManager\";\nexport * from \"./CatalogDb\";\nexport * from \"./Category\";\nexport * from \"./ChangedElementsDb\";\nexport * from \"./ChangeSummaryManager\";\nexport * from \"./ChannelControl\";\nexport * from \"./CheckpointManager\";\nexport * from \"./ClassRegistry\";\nexport * from \"./CloudSqlite\";\nexport * from \"./CodeService\";\nexport * from \"./CodeSpecs\";\nexport * from \"./DevTools\";\nexport * from \"./DisplayStyle\";\nexport * from \"./domains/FunctionalElements\";\nexport * from \"./domains/FunctionalSchema\";\nexport * from \"./domains/GenericElements\";\nexport * from \"./domains/GenericSchema\";\nexport * from \"./ECDb\";\nexport * from \"./ECSchemaXmlContext\";\nexport * from \"./ECSqlStatement\";\nexport * from \"./Element\";\nexport * from \"./ElementAspect\";\nexport * from \"./ElementGraphics\";\nexport * from \"./ElementTreeWalker\";\nexport * from \"./Entity\";\nexport * from \"./EntityReferences\";\nexport * from \"./ExportGraphics\";\nexport * from \"./ExternalSource\";\nexport * from \"./FontFile\";\nexport * from \"./GeoCoordConfig\";\nexport * from \"./GeographicCRSServices\";\nexport * from \"./ImageSourceConversion\";\nexport * from \"./IModelDb\";\nexport * from \"./IModelDbFonts\";\nexport * from \"./IModelElementCloneContext\";\nexport * from \"./IModelHost\";\nexport * from \"./IModelJsFs\";\nexport * from \"./SchemaSync\";\nexport * from \"./IpcHost\";\nexport * from \"./LineStyle\";\nexport * from \"./LocalhostIpcHost\";\nexport * from \"./LocalHub\";\nexport * from \"./LockControl\";\nexport * from \"./Material\";\nexport * from \"./Model\";\nexport * from \"./NativeAppStorage\";\nexport * from \"./NativeHost\";\nexport * from \"./NavigationRelationship\";\nexport * from \"./PropertyStore\";\nexport * from \"./Relationship\";\nexport * from \"./rpc/tracing\";\nexport * from \"./Schema\";\nexport * from \"./SchemaUtils\";\nexport * from \"./SheetIndex\";\nexport * from \"./SQLiteDb\";\nexport * from \"./SqliteStatement\";\nexport * from \"./TextAnnotationElement\";\nexport {\n computeGraphemeOffsets,\n computeLayoutTextBlockResult,\n ComputeGraphemeOffsetsArgs,\n LayoutTextBlockArgs,\n} from \"./TextAnnotationLayout\";\nexport * from \"./TextAnnotationGeometry\";\nexport * from \"./Texture\";\nexport * from \"./TileStorage\";\nexport * from \"./TxnManager\";\nexport * from \"./ViewDefinition\";\nexport * from \"./ViewStore\";\nexport * from \"./workspace/Settings\";\nexport * from \"./workspace/SettingsSchemas\";\nexport * from \"./workspace/Workspace\";\nexport * from \"./workspace/WorkspaceEditor\";\nexport * from \"./SqliteChangesetReader\";\nexport * from \"./ChangesetECAdaptor\";\n\nexport * from \"./internal/cross-package\";\n\n/** @docs-package-description\n * The core-backend package always runs on the computer with a local Briefcase.\n *\n * It contains classes that [backend code]($docs/learning/backend/index.md) can use to work with directly with iModels.\n */\n\n/**\n * @docs-group-description BlobContainers\n * Classes for working with cloud-based blob containers.\n */\n\n/**\n * @docs-group-description Codes\n * Classes for working with [Codes]($docs/BIS/guide/fundamentals/codes.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ECDb\n * Classes for working with ECDb.\n */\n\n/**\n * @docs-group-description ECSQL\n * Classes for working with [ECSQL]($docs/learning/ECSQL.md)\n */\n\n/**\n * @docs-group-description ElementAspects\n * Subclasses of [ElementAspects]($docs/bis/guide/fundamentals/elementaspect-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ElementGeometry\n * Classes for defining the symbology and geometry of geometric elements\n */\n\n/**\n * @docs-group-description Elements\n * Subclasses of [Elements]($docs/BIS/guide/fundamentals/element-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ExportGraphics\n * APIs for producing low-level graphics primitives from element geometry.\n */\n\n/**\n * @docs-group-description HubAccess\n * APIs for working with IModelHub\n */\n\n/**\n * @docs-group-description Images\n * APIs for encoding and decoding images\n */\n\n/**\n * @docs-group-description IModelHost\n * Classes for configuring and administering the backend [host]($docs/learning/backend/IModelHost.md).\n * See [the learning article]($docs/learning/backend/IModelHost.md).\n */\n\n/**\n * @docs-group-description iModels\n * Classes for working with [iModels]($docs/learning/iModels.md).\n * See [the learning article]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description Logging\n * Logger categories used by this package.\n */\n\n/**\n * @docs-group-description Models\n * Subclasses of [Models]($docs/BIS/guide/fundamentals/model-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description NativeApp\n * Classes for working with Mobile/Desktop Application.\n */\n\n/**\n * @docs-group-description Portability\n */\n\n/**\n * @docs-group-description Relationships\n * Classes that describe the [relationships]($docs/bis/guide/fundamentals/relationship-fundamentals.md) between elements.\n */\n\n/**\n * @docs-group-description RpcInterface\n * Classes for working with [RpcInterfaces]($docs/learning/RpcInterface.md).\n */\n\n/**\n * @docs-group-description Schema\n * Classes for working with [ECSchemas]($docs/learning/backend/SchemasAndElementsInTypeScript.md)\n */\n\n/**\n * @docs-group-description SQLite\n * Classes for working directly with SQLite\n */\n\n/**\n * @docs-group-description SQLiteDb\n * Classes for working with SQLiteDb.\n */\n\n/**\n * @docs-group-description TileStorage\n * Class for working with cloud storage using iTwin/object-storage cloud providers\n */\n\n/**\n * @docs-group-description ViewDefinitions\n * Classes for working with Elements that define what appears in [Views]($docs/learning/frontend/views.md).\n * See [the learning articles]($docs/learning/backend/createelements/#orthographicviewdefinition).\n */\n\n/**\n * @docs-group-description Workspace\n * APIs for loading and using Settings and Workspace resources\n */\n"]}
1
+ {"version":3,"file":"core-backend.js","sourceRoot":"","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D,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,cAAc,CAAC,CAAC;IAC3D,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1D,8BAA8B;IAE9B,MAAM,KAAK,CAAC;AACd,CAAC;KAAM,CAAC;IACL,UAAkB,CAAC,uBAAuB,CAAC,GAAG;QAC7C,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC,KAAK;KACzB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;IAGI;AAEJ;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;GAEG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG","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\nexport * from \"./annotations/FrameGeometry\";\nexport * from \"./annotations/TextAnnotationElement\";\nexport * from \"./annotations/TextAnnotationGeometry\";\nexport * from \"./annotations/TextBlockGeometry\";\nexport * from \"./annotations/TextBlockLayout\";\nexport * from \"./BackendHubAccess\";\nexport * from \"./BackendLoggerCategory\";\nexport * from \"./BisCoreSchema\";\nexport * from \"./BlobContainerService\";\nexport * from \"./BriefcaseManager\";\nexport * from \"./CatalogDb\";\nexport * from \"./Category\";\nexport * from \"./ChangedElementsDb\";\nexport * from \"./ChangeSummaryManager\";\nexport * from \"./ChannelControl\";\nexport * from \"./CheckpointManager\";\nexport * from \"./ClassRegistry\";\nexport * from \"./CloudSqlite\";\nexport * from \"./CodeService\";\nexport * from \"./CodeSpecs\";\nexport * from \"./DevTools\";\nexport * from \"./DisplayStyle\";\nexport * from \"./domains/FunctionalElements\";\nexport * from \"./domains/FunctionalSchema\";\nexport * from \"./domains/GenericElements\";\nexport * from \"./domains/GenericSchema\";\nexport * from \"./ECDb\";\nexport * from \"./ECSchemaXmlContext\";\nexport * from \"./ECSqlStatement\";\nexport * from \"./Element\";\nexport * from \"./ElementAspect\";\nexport * from \"./ElementGraphics\";\nexport * from \"./ElementTreeWalker\";\nexport * from \"./Entity\";\nexport * from \"./EntityReferences\";\nexport * from \"./ExportGraphics\";\nexport * from \"./ExternalSource\";\nexport * from \"./FontFile\";\nexport * from \"./GeoCoordConfig\";\nexport * from \"./GeographicCRSServices\";\nexport * from \"./ImageSourceConversion\";\nexport * from \"./IModelDb\";\nexport * from \"./IModelDbFonts\";\nexport * from \"./IModelElementCloneContext\";\nexport * from \"./IModelHost\";\nexport * from \"./IModelJsFs\";\nexport * from \"./SchemaSync\";\nexport * from \"./IpcHost\";\nexport * from \"./LineStyle\";\nexport * from \"./LocalhostIpcHost\";\nexport * from \"./LocalHub\";\nexport * from \"./LockControl\";\nexport * from \"./Material\";\nexport * from \"./Model\";\nexport * from \"./NativeAppStorage\";\nexport * from \"./NativeHost\";\nexport * from \"./NavigationRelationship\";\nexport * from \"./PropertyStore\";\nexport * from \"./Relationship\";\nexport * from \"./rpc/tracing\";\nexport * from \"./Schema\";\nexport * from \"./SchemaUtils\";\nexport * from \"./SheetIndex\";\nexport * from \"./SQLiteDb\";\nexport * from \"./SqliteStatement\";\nexport * from \"./Texture\";\nexport * from \"./TileStorage\";\nexport * from \"./TxnManager\";\nexport * from \"./ViewDefinition\";\nexport * from \"./ViewStore\";\nexport * from \"./workspace/Settings\";\nexport * from \"./workspace/SettingsSchemas\";\nexport * from \"./workspace/Workspace\";\nexport * from \"./workspace/WorkspaceEditor\";\nexport * from \"./SqliteChangesetReader\";\nexport * from \"./ChangesetECAdaptor\";\n\nexport * from \"./internal/cross-package\";\n\nconst globalSymbolCoreBackend = Symbol.for(\"itwin.core.backend.globals\");\nif ((globalThis as any)[globalSymbolCoreBackend]) {\n // Get the stack trace from when the module was first loaded\n const firstLoadStack = (globalThis as any)[globalSymbolCoreBackend].stack;\n\n const error = new Error(\n \"Multiple @itwin/core-backend imports detected! This may happen if:\\n\" +\n \"- You have multiple versions of the package installed\\n\" +\n \"- Your bundling configuration is incorrect\\n\" +\n \"- You're importing from both ESM and CommonJS versions\"\n );\n\n /* eslint-disable no-console */\n console.error(\"Duplicate @itwin/core-backend import:\", error);\n console.error(\"First import occurred at:\", firstLoadStack);\n console.error(\"Current import occurred at:\", error.stack);\n /* eslint-enable no-console */\n\n throw error;\n} else {\n (globalThis as any)[globalSymbolCoreBackend] = {\n stack: new Error().stack,\n };\n}\n\n/** @docs-package-description\n * The core-backend package always runs on the computer with a local Briefcase.\n *\n * It contains classes that [backend code]($docs/learning/backend/index.md) can use to work with directly with iModels.\n */\n\n/**\n * @docs-group-description BlobContainers\n * Classes for working with cloud-based blob containers.\n */\n\n/**\n * @docs-group-description Codes\n * Classes for working with [Codes]($docs/BIS/guide/fundamentals/codes.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ECDb\n * Classes for working with ECDb.\n */\n\n/**\n * @docs-group-description ECSQL\n * Classes for working with [ECSQL]($docs/learning/ECSQL.md)\n */\n\n/**\n * @docs-group-description ElementAspects\n * Subclasses of [ElementAspects]($docs/bis/guide/fundamentals/elementaspect-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ElementGeometry\n * Classes for defining the symbology and geometry of geometric elements\n */\n\n/**\n * @docs-group-description Elements\n * Subclasses of [Elements]($docs/BIS/guide/fundamentals/element-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ExportGraphics\n * APIs for producing low-level graphics primitives from element geometry.\n */\n\n/**\n * @docs-group-description HubAccess\n * APIs for working with IModelHub\n */\n\n/**\n * @docs-group-description Images\n * APIs for encoding and decoding images\n */\n\n/**\n * @docs-group-description IModelHost\n * Classes for configuring and administering the backend [host]($docs/learning/backend/IModelHost.md).\n * See [the learning article]($docs/learning/backend/IModelHost.md).\n */\n\n/**\n * @docs-group-description iModels\n * Classes for working with [iModels]($docs/learning/iModels.md).\n * See [the learning article]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description Logging\n * Logger categories used by this package.\n */\n\n/**\n * @docs-group-description Models\n * Subclasses of [Models]($docs/BIS/guide/fundamentals/model-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description NativeApp\n * Classes for working with Mobile/Desktop Application.\n */\n\n/**\n * @docs-group-description Portability\n */\n\n/**\n * @docs-group-description Relationships\n * Classes that describe the [relationships]($docs/bis/guide/fundamentals/relationship-fundamentals.md) between elements.\n */\n\n/**\n * @docs-group-description RpcInterface\n * Classes for working with [RpcInterfaces]($docs/learning/RpcInterface.md).\n */\n\n/**\n * @docs-group-description Schema\n * Classes for working with [ECSchemas]($docs/learning/backend/SchemasAndElementsInTypeScript.md)\n */\n\n/**\n * @docs-group-description SQLite\n * Classes for working directly with SQLite\n */\n\n/**\n * @docs-group-description SQLiteDb\n * Classes for working with SQLiteDb.\n */\n\n/**\n * @docs-group-description TileStorage\n * Class for working with cloud storage using iTwin/object-storage cloud providers\n */\n\n/**\n * @docs-group-description ViewDefinitions\n * Classes for working with Elements that define what appears in [Views]($docs/learning/frontend/views.md).\n * See [the learning articles]($docs/learning/backend/createelements/#orthographicviewdefinition).\n */\n\n/**\n * @docs-group-description Workspace\n * APIs for loading and using Settings and Workspace resources\n */\n"]}
@@ -36,7 +36,7 @@ export declare class IModelReadRpcImpl extends RpcInterface implements IModelRea
36
36
  getMassPropertiesPerCandidate(tokenProps: IModelRpcProps, props: MassPropertiesPerCandidateRequestProps): Promise<MassPropertiesPerCandidateResponseProps[]>;
37
37
  getToolTipMessage(tokenProps: IModelRpcProps, id: string): Promise<string[]>;
38
38
  /** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.
39
- * @deprecated in 3.x - Use queryViewThumbnail instead
39
+ * @deprecated in 3.x - might be removed in next major version. Use queryViewThumbnail instead
40
40
  */
41
41
  getViewThumbnail(tokenProps: IModelRpcProps, viewId: string): Promise<Uint8Array>;
42
42
  getDefaultViewId(tokenProps: IModelRpcProps): Promise<Id64String>;
@@ -256,7 +256,7 @@ export class IModelReadRpcImpl extends RpcInterface {
256
256
  return (el === undefined) ? [] : el.getToolTipMessage();
257
257
  }
258
258
  /** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.
259
- * @deprecated in 3.x - Use queryViewThumbnail instead
259
+ * @deprecated in 3.x - might be removed in next major version. Use queryViewThumbnail instead
260
260
  */
261
261
  async getViewThumbnail(tokenProps, viewId) {
262
262
  const iModelDb = await getIModelForRpc(tokenProps);