@itwin/core-backend 5.1.0-dev.9 → 5.1.1

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 (671) hide show
  1. package/CHANGELOG.md +160 -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/BackendLoggerCategory.js.map +1 -1
  6. package/lib/cjs/BisCoreSchema.d.ts.map +1 -1
  7. package/lib/cjs/BisCoreSchema.js +4 -2
  8. package/lib/cjs/BisCoreSchema.js.map +1 -1
  9. package/lib/cjs/BlobContainerService.js.map +1 -1
  10. package/lib/cjs/BriefcaseManager.d.ts +10 -2
  11. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  12. package/lib/cjs/BriefcaseManager.js +16 -0
  13. package/lib/cjs/BriefcaseManager.js.map +1 -1
  14. package/lib/cjs/CatalogDb.js.map +1 -1
  15. package/lib/cjs/Category.d.ts +4 -4
  16. package/lib/cjs/Category.js +4 -4
  17. package/lib/cjs/Category.js.map +1 -1
  18. package/lib/cjs/ChangeSummaryManager.js +2 -2
  19. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  20. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  21. package/lib/cjs/ChangesetECAdaptor.d.ts +67 -8
  22. package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
  23. package/lib/cjs/ChangesetECAdaptor.js +490 -275
  24. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  25. package/lib/cjs/ChannelControl.js.map +1 -1
  26. package/lib/cjs/CheckpointManager.js.map +1 -1
  27. package/lib/cjs/ClassRegistry.d.ts +9 -1
  28. package/lib/cjs/ClassRegistry.d.ts.map +1 -1
  29. package/lib/cjs/ClassRegistry.js +14 -6
  30. package/lib/cjs/ClassRegistry.js.map +1 -1
  31. package/lib/cjs/CloudSqlite.js +1 -1
  32. package/lib/cjs/CloudSqlite.js.map +1 -1
  33. package/lib/cjs/CodeService.js.map +1 -1
  34. package/lib/cjs/CodeSpecs.d.ts +1 -1
  35. package/lib/cjs/CodeSpecs.js +1 -1
  36. package/lib/cjs/CodeSpecs.js.map +1 -1
  37. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  38. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  39. package/lib/cjs/DevTools.js.map +1 -1
  40. package/lib/cjs/DisplayStyle.d.ts +4 -4
  41. package/lib/cjs/DisplayStyle.js +3 -3
  42. package/lib/cjs/DisplayStyle.js.map +1 -1
  43. package/lib/cjs/ECDb.d.ts +4 -4
  44. package/lib/cjs/ECDb.d.ts.map +1 -1
  45. package/lib/cjs/ECDb.js +4 -4
  46. package/lib/cjs/ECDb.js.map +1 -1
  47. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  48. package/lib/cjs/ECSqlStatement.d.ts +15 -6
  49. package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
  50. package/lib/cjs/ECSqlStatement.js +19 -4
  51. package/lib/cjs/ECSqlStatement.js.map +1 -1
  52. package/lib/cjs/Element.d.ts +54 -51
  53. package/lib/cjs/Element.d.ts.map +1 -1
  54. package/lib/cjs/Element.js +67 -52
  55. package/lib/cjs/Element.js.map +1 -1
  56. package/lib/cjs/ElementAspect.d.ts +8 -8
  57. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  58. package/lib/cjs/ElementAspect.js +8 -8
  59. package/lib/cjs/ElementAspect.js.map +1 -1
  60. package/lib/cjs/ElementGraphics.js.map +1 -1
  61. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  62. package/lib/cjs/Entity.d.ts +10 -7
  63. package/lib/cjs/Entity.d.ts.map +1 -1
  64. package/lib/cjs/Entity.js +35 -13
  65. package/lib/cjs/Entity.js.map +1 -1
  66. package/lib/cjs/EntityReferences.js.map +1 -1
  67. package/lib/cjs/ExportGraphics.d.ts +54 -8
  68. package/lib/cjs/ExportGraphics.d.ts.map +1 -1
  69. package/lib/cjs/ExportGraphics.js +158 -59
  70. package/lib/cjs/ExportGraphics.js.map +1 -1
  71. package/lib/cjs/ExternalSource.js.map +1 -1
  72. package/lib/cjs/FontFile.js.map +1 -1
  73. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  74. package/lib/cjs/GeographicCRSServices.d.ts +6 -2
  75. package/lib/cjs/GeographicCRSServices.d.ts.map +1 -1
  76. package/lib/cjs/GeographicCRSServices.js +1 -1
  77. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  78. package/lib/cjs/GeometrySummary.js +47 -47
  79. package/lib/cjs/GeometrySummary.js.map +1 -1
  80. package/lib/cjs/IModelDb.d.ts +37 -26
  81. package/lib/cjs/IModelDb.d.ts.map +1 -1
  82. package/lib/cjs/IModelDb.js +132 -55
  83. package/lib/cjs/IModelDb.js.map +1 -1
  84. package/lib/cjs/IModelDbFonts.js.map +1 -1
  85. package/lib/cjs/IModelElementCloneContext.d.ts +1 -1
  86. package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -1
  87. package/lib/cjs/IModelElementCloneContext.js +1 -1
  88. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  89. package/lib/cjs/IModelHost.d.ts +2 -3
  90. package/lib/cjs/IModelHost.d.ts.map +1 -1
  91. package/lib/cjs/IModelHost.js +2 -3
  92. package/lib/cjs/IModelHost.js.map +1 -1
  93. package/lib/cjs/IModelIncrementalSchemaLocater.d.ts +36 -0
  94. package/lib/cjs/IModelIncrementalSchemaLocater.d.ts.map +1 -0
  95. package/lib/cjs/IModelIncrementalSchemaLocater.js +69 -0
  96. package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -0
  97. package/lib/cjs/IModelJsFs.js.map +1 -1
  98. package/lib/cjs/ImageSourceConversion.js.map +1 -1
  99. package/lib/cjs/IpcHost.js.map +1 -1
  100. package/lib/cjs/LineStyle.js.map +1 -1
  101. package/lib/cjs/LocalHub.d.ts.map +1 -1
  102. package/lib/cjs/LocalHub.js +6 -4
  103. package/lib/cjs/LocalHub.js.map +1 -1
  104. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  105. package/lib/cjs/LockControl.js.map +1 -1
  106. package/lib/cjs/Material.d.ts +4 -3
  107. package/lib/cjs/Material.d.ts.map +1 -1
  108. package/lib/cjs/Material.js +5 -5
  109. package/lib/cjs/Material.js.map +1 -1
  110. package/lib/cjs/Model.d.ts +22 -22
  111. package/lib/cjs/Model.js +22 -22
  112. package/lib/cjs/Model.js.map +1 -1
  113. package/lib/cjs/NativeAppStorage.js.map +1 -1
  114. package/lib/cjs/NativeHost.js.map +1 -1
  115. package/lib/cjs/NavigationRelationship.js.map +1 -1
  116. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  117. package/lib/cjs/PropertyStore.js.map +1 -1
  118. package/lib/cjs/Relationship.d.ts +3 -0
  119. package/lib/cjs/Relationship.d.ts.map +1 -1
  120. package/lib/cjs/Relationship.js +15 -0
  121. package/lib/cjs/Relationship.js.map +1 -1
  122. package/lib/cjs/RpcBackend.js.map +1 -1
  123. package/lib/cjs/SQLiteDb.d.ts +1 -1
  124. package/lib/cjs/SQLiteDb.js +1 -1
  125. package/lib/cjs/SQLiteDb.js.map +1 -1
  126. package/lib/cjs/Schema.d.ts +25 -0
  127. package/lib/cjs/Schema.d.ts.map +1 -1
  128. package/lib/cjs/Schema.js +25 -0
  129. package/lib/cjs/Schema.js.map +1 -1
  130. package/lib/cjs/SchemaSync.js.map +1 -1
  131. package/lib/cjs/SchemaUtils.js.map +1 -1
  132. package/lib/cjs/SheetIndex.js.map +1 -1
  133. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  134. package/lib/cjs/SqliteStatement.d.ts +1 -1
  135. package/lib/cjs/SqliteStatement.d.ts.map +1 -1
  136. package/lib/cjs/SqliteStatement.js +1 -1
  137. package/lib/cjs/SqliteStatement.js.map +1 -1
  138. package/lib/cjs/Texture.d.ts +1 -1
  139. package/lib/cjs/Texture.js +1 -1
  140. package/lib/cjs/Texture.js.map +1 -1
  141. package/lib/cjs/TileStorage.js.map +1 -1
  142. package/lib/cjs/TxnManager.d.ts +4 -4
  143. package/lib/cjs/TxnManager.js +1 -1
  144. package/lib/cjs/TxnManager.js.map +1 -1
  145. package/lib/cjs/ViewDefinition.d.ts +40 -14
  146. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  147. package/lib/cjs/ViewDefinition.js +42 -14
  148. package/lib/cjs/ViewDefinition.js.map +1 -1
  149. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  150. package/lib/cjs/ViewStore.js.map +1 -1
  151. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +61 -0
  152. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -0
  153. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +110 -0
  154. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -0
  155. package/lib/cjs/annotations/FrameGeometry.d.ts +51 -0
  156. package/lib/cjs/annotations/FrameGeometry.d.ts.map +1 -0
  157. package/lib/cjs/annotations/FrameGeometry.js +249 -0
  158. package/lib/cjs/annotations/FrameGeometry.js.map +1 -0
  159. package/lib/cjs/annotations/LeaderGeometry.d.ts +53 -0
  160. package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -0
  161. package/lib/cjs/annotations/LeaderGeometry.js +184 -0
  162. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -0
  163. package/lib/cjs/annotations/TextAnnotationElement.d.ts +204 -0
  164. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -0
  165. package/lib/cjs/annotations/TextAnnotationElement.js +411 -0
  166. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -0
  167. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +33 -0
  168. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -0
  169. package/lib/cjs/annotations/TextAnnotationGeometry.js +137 -0
  170. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -0
  171. package/lib/cjs/annotations/TextBlockGeometry.d.ts +16 -0
  172. package/lib/cjs/annotations/TextBlockGeometry.d.ts.map +1 -0
  173. package/lib/cjs/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +28 -70
  174. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -0
  175. package/lib/cjs/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +69 -22
  176. package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -0
  177. package/lib/cjs/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +174 -49
  178. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -0
  179. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  180. package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +32 -32
  181. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -27
  182. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
  183. package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
  184. package/lib/cjs/core-backend.d.ts +7 -3
  185. package/lib/cjs/core-backend.d.ts.map +1 -1
  186. package/lib/cjs/core-backend.js +27 -6
  187. package/lib/cjs/core-backend.js.map +1 -1
  188. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  189. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  190. package/lib/cjs/domains/GenericElements.js.map +1 -1
  191. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  192. package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
  193. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  194. package/lib/cjs/internal/ElementLRUCache.d.ts +23 -0
  195. package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -1
  196. package/lib/cjs/internal/ElementLRUCache.js +167 -3
  197. package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
  198. package/lib/cjs/internal/FontFileImpl.js.map +1 -1
  199. package/lib/cjs/internal/HubMock.js.map +1 -1
  200. package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -1
  201. package/lib/cjs/internal/NativePlatform.js.map +1 -1
  202. package/lib/cjs/internal/NoLocks.js.map +1 -1
  203. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  204. package/lib/cjs/internal/Symbols.d.ts +1 -0
  205. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  206. package/lib/cjs/internal/Symbols.js +2 -1
  207. package/lib/cjs/internal/Symbols.js.map +1 -1
  208. package/lib/cjs/internal/annotations/fields.d.ts +22 -0
  209. package/lib/cjs/internal/annotations/fields.d.ts.map +1 -0
  210. package/lib/cjs/internal/annotations/fields.js +237 -0
  211. package/lib/cjs/internal/annotations/fields.js.map +1 -0
  212. package/lib/cjs/internal/cross-package.js.map +1 -1
  213. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  214. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  215. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  216. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  217. package/lib/cjs/rpc/multipart.js.map +1 -1
  218. package/lib/cjs/rpc/tracing.js.map +1 -1
  219. package/lib/cjs/rpc/web/logging.js.map +1 -1
  220. package/lib/cjs/rpc/web/request.js.map +1 -1
  221. package/lib/cjs/rpc/web/response.js.map +1 -1
  222. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  223. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
  224. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +1 -1
  225. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  226. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  227. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
  228. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  229. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +1 -1
  230. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +1 -1
  231. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  232. package/lib/cjs/workspace/Settings.js.map +1 -1
  233. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  234. package/lib/cjs/workspace/Workspace.d.ts +0 -1
  235. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  236. package/lib/cjs/workspace/Workspace.js.map +1 -1
  237. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
  238. package/lib/esm/BackendHubAccess.d.ts +1 -1
  239. package/lib/esm/BackendHubAccess.js +1 -1
  240. package/lib/esm/BackendHubAccess.js.map +1 -1
  241. package/lib/esm/BackendLoggerCategory.js.map +1 -1
  242. package/lib/esm/BisCoreSchema.d.ts.map +1 -1
  243. package/lib/esm/BisCoreSchema.js +4 -2
  244. package/lib/esm/BisCoreSchema.js.map +1 -1
  245. package/lib/esm/BlobContainerService.js.map +1 -1
  246. package/lib/esm/BriefcaseManager.d.ts +10 -2
  247. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  248. package/lib/esm/BriefcaseManager.js +17 -1
  249. package/lib/esm/BriefcaseManager.js.map +1 -1
  250. package/lib/esm/CatalogDb.js.map +1 -1
  251. package/lib/esm/Category.d.ts +4 -4
  252. package/lib/esm/Category.js +4 -4
  253. package/lib/esm/Category.js.map +1 -1
  254. package/lib/esm/ChangeSummaryManager.js +2 -2
  255. package/lib/esm/ChangeSummaryManager.js.map +1 -1
  256. package/lib/esm/ChangedElementsDb.js.map +1 -1
  257. package/lib/esm/ChangesetECAdaptor.d.ts +67 -8
  258. package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
  259. package/lib/esm/ChangesetECAdaptor.js +490 -275
  260. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  261. package/lib/esm/ChannelControl.js.map +1 -1
  262. package/lib/esm/CheckpointManager.js.map +1 -1
  263. package/lib/esm/ClassRegistry.d.ts +9 -1
  264. package/lib/esm/ClassRegistry.d.ts.map +1 -1
  265. package/lib/esm/ClassRegistry.js +14 -6
  266. package/lib/esm/ClassRegistry.js.map +1 -1
  267. package/lib/esm/CloudSqlite.js +1 -1
  268. package/lib/esm/CloudSqlite.js.map +1 -1
  269. package/lib/esm/CodeService.js.map +1 -1
  270. package/lib/esm/CodeSpecs.d.ts +1 -1
  271. package/lib/esm/CodeSpecs.js +1 -1
  272. package/lib/esm/CodeSpecs.js.map +1 -1
  273. package/lib/esm/ConcurrentQuery.js.map +1 -1
  274. package/lib/esm/CustomViewState3dCreator.js.map +1 -1
  275. package/lib/esm/DevTools.js.map +1 -1
  276. package/lib/esm/DisplayStyle.d.ts +4 -4
  277. package/lib/esm/DisplayStyle.js +3 -3
  278. package/lib/esm/DisplayStyle.js.map +1 -1
  279. package/lib/esm/ECDb.d.ts +4 -4
  280. package/lib/esm/ECDb.d.ts.map +1 -1
  281. package/lib/esm/ECDb.js +4 -4
  282. package/lib/esm/ECDb.js.map +1 -1
  283. package/lib/esm/ECSchemaXmlContext.js.map +1 -1
  284. package/lib/esm/ECSqlStatement.d.ts +15 -6
  285. package/lib/esm/ECSqlStatement.d.ts.map +1 -1
  286. package/lib/esm/ECSqlStatement.js +19 -4
  287. package/lib/esm/ECSqlStatement.js.map +1 -1
  288. package/lib/esm/Element.d.ts +54 -51
  289. package/lib/esm/Element.d.ts.map +1 -1
  290. package/lib/esm/Element.js +67 -52
  291. package/lib/esm/Element.js.map +1 -1
  292. package/lib/esm/ElementAspect.d.ts +8 -8
  293. package/lib/esm/ElementAspect.d.ts.map +1 -1
  294. package/lib/esm/ElementAspect.js +8 -8
  295. package/lib/esm/ElementAspect.js.map +1 -1
  296. package/lib/esm/ElementGraphics.js.map +1 -1
  297. package/lib/esm/ElementTreeWalker.js.map +1 -1
  298. package/lib/esm/Entity.d.ts +10 -7
  299. package/lib/esm/Entity.d.ts.map +1 -1
  300. package/lib/esm/Entity.js +36 -14
  301. package/lib/esm/Entity.js.map +1 -1
  302. package/lib/esm/EntityReferences.js.map +1 -1
  303. package/lib/esm/ExportGraphics.d.ts +54 -8
  304. package/lib/esm/ExportGraphics.d.ts.map +1 -1
  305. package/lib/esm/ExportGraphics.js +156 -58
  306. package/lib/esm/ExportGraphics.js.map +1 -1
  307. package/lib/esm/ExternalSource.js.map +1 -1
  308. package/lib/esm/FontFile.js.map +1 -1
  309. package/lib/esm/GeoCoordConfig.js.map +1 -1
  310. package/lib/esm/GeographicCRSServices.d.ts +6 -2
  311. package/lib/esm/GeographicCRSServices.d.ts.map +1 -1
  312. package/lib/esm/GeographicCRSServices.js +1 -1
  313. package/lib/esm/GeographicCRSServices.js.map +1 -1
  314. package/lib/esm/GeometrySummary.js +47 -47
  315. package/lib/esm/GeometrySummary.js.map +1 -1
  316. package/lib/esm/IModelDb.d.ts +37 -26
  317. package/lib/esm/IModelDb.d.ts.map +1 -1
  318. package/lib/esm/IModelDb.js +136 -59
  319. package/lib/esm/IModelDb.js.map +1 -1
  320. package/lib/esm/IModelDbFonts.js.map +1 -1
  321. package/lib/esm/IModelElementCloneContext.d.ts +1 -1
  322. package/lib/esm/IModelElementCloneContext.d.ts.map +1 -1
  323. package/lib/esm/IModelElementCloneContext.js +1 -1
  324. package/lib/esm/IModelElementCloneContext.js.map +1 -1
  325. package/lib/esm/IModelHost.d.ts +2 -3
  326. package/lib/esm/IModelHost.d.ts.map +1 -1
  327. package/lib/esm/IModelHost.js +2 -3
  328. package/lib/esm/IModelHost.js.map +1 -1
  329. package/lib/esm/IModelIncrementalSchemaLocater.d.ts +36 -0
  330. package/lib/esm/IModelIncrementalSchemaLocater.d.ts.map +1 -0
  331. package/lib/esm/IModelIncrementalSchemaLocater.js +65 -0
  332. package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -0
  333. package/lib/esm/IModelJsFs.js.map +1 -1
  334. package/lib/esm/ImageSourceConversion.js.map +1 -1
  335. package/lib/esm/IpcHost.js.map +1 -1
  336. package/lib/esm/LineStyle.js.map +1 -1
  337. package/lib/esm/LocalHub.d.ts.map +1 -1
  338. package/lib/esm/LocalHub.js +6 -4
  339. package/lib/esm/LocalHub.js.map +1 -1
  340. package/lib/esm/LocalhostIpcHost.js.map +1 -1
  341. package/lib/esm/LockControl.js.map +1 -1
  342. package/lib/esm/Material.d.ts +4 -3
  343. package/lib/esm/Material.d.ts.map +1 -1
  344. package/lib/esm/Material.js +5 -5
  345. package/lib/esm/Material.js.map +1 -1
  346. package/lib/esm/Model.d.ts +22 -22
  347. package/lib/esm/Model.js +22 -22
  348. package/lib/esm/Model.js.map +1 -1
  349. package/lib/esm/NativeAppStorage.js.map +1 -1
  350. package/lib/esm/NativeHost.js.map +1 -1
  351. package/lib/esm/NavigationRelationship.js.map +1 -1
  352. package/lib/esm/PromiseMemoizer.js.map +1 -1
  353. package/lib/esm/PropertyStore.js.map +1 -1
  354. package/lib/esm/Relationship.d.ts +3 -0
  355. package/lib/esm/Relationship.d.ts.map +1 -1
  356. package/lib/esm/Relationship.js +15 -0
  357. package/lib/esm/Relationship.js.map +1 -1
  358. package/lib/esm/RpcBackend.js.map +1 -1
  359. package/lib/esm/SQLiteDb.d.ts +1 -1
  360. package/lib/esm/SQLiteDb.js +1 -1
  361. package/lib/esm/SQLiteDb.js.map +1 -1
  362. package/lib/esm/Schema.d.ts +25 -0
  363. package/lib/esm/Schema.d.ts.map +1 -1
  364. package/lib/esm/Schema.js +25 -0
  365. package/lib/esm/Schema.js.map +1 -1
  366. package/lib/esm/SchemaSync.js.map +1 -1
  367. package/lib/esm/SchemaUtils.js.map +1 -1
  368. package/lib/esm/SheetIndex.js.map +1 -1
  369. package/lib/esm/SqliteChangesetReader.js.map +1 -1
  370. package/lib/esm/SqliteStatement.d.ts +1 -1
  371. package/lib/esm/SqliteStatement.d.ts.map +1 -1
  372. package/lib/esm/SqliteStatement.js +1 -1
  373. package/lib/esm/SqliteStatement.js.map +1 -1
  374. package/lib/esm/Texture.d.ts +1 -1
  375. package/lib/esm/Texture.js +1 -1
  376. package/lib/esm/Texture.js.map +1 -1
  377. package/lib/esm/TileStorage.js.map +1 -1
  378. package/lib/esm/TxnManager.d.ts +4 -4
  379. package/lib/esm/TxnManager.js +1 -1
  380. package/lib/esm/TxnManager.js.map +1 -1
  381. package/lib/esm/ViewDefinition.d.ts +40 -14
  382. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  383. package/lib/esm/ViewDefinition.js +42 -14
  384. package/lib/esm/ViewDefinition.js.map +1 -1
  385. package/lib/esm/ViewStateHydrator.js.map +1 -1
  386. package/lib/esm/ViewStore.js.map +1 -1
  387. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +61 -0
  388. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -0
  389. package/lib/esm/annotations/ElementDrivesTextAnnotation.js +105 -0
  390. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -0
  391. package/lib/esm/annotations/FrameGeometry.d.ts +51 -0
  392. package/lib/esm/annotations/FrameGeometry.d.ts.map +1 -0
  393. package/lib/esm/annotations/FrameGeometry.js +244 -0
  394. package/lib/esm/annotations/FrameGeometry.js.map +1 -0
  395. package/lib/esm/annotations/LeaderGeometry.d.ts +53 -0
  396. package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -0
  397. package/lib/esm/annotations/LeaderGeometry.js +179 -0
  398. package/lib/esm/annotations/LeaderGeometry.js.map +1 -0
  399. package/lib/esm/annotations/TextAnnotationElement.d.ts +204 -0
  400. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -0
  401. package/lib/esm/annotations/TextAnnotationElement.js +405 -0
  402. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -0
  403. package/lib/esm/annotations/TextAnnotationGeometry.d.ts +33 -0
  404. package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -0
  405. package/lib/esm/annotations/TextAnnotationGeometry.js +134 -0
  406. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -0
  407. package/lib/esm/annotations/TextBlockGeometry.d.ts +16 -0
  408. package/lib/esm/annotations/TextBlockGeometry.d.ts.map +1 -0
  409. package/lib/esm/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +28 -70
  410. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -0
  411. package/lib/esm/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +69 -22
  412. package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -0
  413. package/lib/esm/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +172 -48
  414. package/lib/esm/annotations/TextBlockLayout.js.map +1 -0
  415. package/lib/esm/core-backend.d.ts +7 -3
  416. package/lib/esm/core-backend.d.ts.map +1 -1
  417. package/lib/esm/core-backend.js +27 -3
  418. package/lib/esm/core-backend.js.map +1 -1
  419. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  420. package/lib/esm/domains/FunctionalSchema.js.map +1 -1
  421. package/lib/esm/domains/GenericElements.js.map +1 -1
  422. package/lib/esm/domains/GenericSchema.js.map +1 -1
  423. package/lib/esm/internal/ChangesetConflictArgs.js.map +1 -1
  424. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  425. package/lib/esm/internal/ElementLRUCache.d.ts +23 -0
  426. package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -1
  427. package/lib/esm/internal/ElementLRUCache.js +165 -2
  428. package/lib/esm/internal/ElementLRUCache.js.map +1 -1
  429. package/lib/esm/internal/FontFileImpl.js.map +1 -1
  430. package/lib/esm/internal/HubMock.js.map +1 -1
  431. package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -1
  432. package/lib/esm/internal/NativePlatform.js.map +1 -1
  433. package/lib/esm/internal/NoLocks.js.map +1 -1
  434. package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
  435. package/lib/esm/internal/Symbols.d.ts +1 -0
  436. package/lib/esm/internal/Symbols.d.ts.map +1 -1
  437. package/lib/esm/internal/Symbols.js +1 -0
  438. package/lib/esm/internal/Symbols.js.map +1 -1
  439. package/lib/esm/internal/annotations/fields.d.ts +22 -0
  440. package/lib/esm/internal/annotations/fields.d.ts.map +1 -0
  441. package/lib/esm/internal/annotations/fields.js +231 -0
  442. package/lib/esm/internal/annotations/fields.js.map +1 -0
  443. package/lib/esm/internal/cross-package.js.map +1 -1
  444. package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
  445. package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  446. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  447. package/lib/esm/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  448. package/lib/esm/rpc/multipart.js.map +1 -1
  449. package/lib/esm/rpc/tracing.js.map +1 -1
  450. package/lib/esm/rpc/web/logging.js.map +1 -1
  451. package/lib/esm/rpc/web/request.js.map +1 -1
  452. package/lib/esm/rpc/web/response.js.map +1 -1
  453. package/lib/esm/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  454. package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
  455. package/lib/esm/rpc-impl/IModelReadRpcImpl.js +1 -1
  456. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  457. package/lib/esm/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  458. package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
  459. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  460. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.d.ts +1 -1
  461. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js +1 -1
  462. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  463. package/lib/esm/test/AdvancedEqual.js.map +1 -1
  464. package/lib/esm/test/AnnotationTestUtils.d.ts +15 -0
  465. package/lib/esm/test/AnnotationTestUtils.d.ts.map +1 -0
  466. package/lib/esm/test/AnnotationTestUtils.js +41 -0
  467. package/lib/esm/test/AnnotationTestUtils.js.map +1 -0
  468. package/lib/esm/test/AttachDb.test.js +11 -11
  469. package/lib/esm/test/AttachDb.test.js.map +1 -1
  470. package/lib/esm/test/ElementLRUCache.test.js +224 -1
  471. package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
  472. package/lib/esm/test/GeometryTestUtil.js.map +1 -1
  473. package/lib/esm/test/IModelHost.test.js.map +1 -1
  474. package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
  475. package/lib/esm/test/IModelTestUtils.js +1 -0
  476. package/lib/esm/test/IModelTestUtils.js.map +1 -1
  477. package/lib/esm/test/ImageSourceConversion.test.js.map +1 -1
  478. package/lib/esm/test/IpcHost.test.js.map +1 -1
  479. package/lib/esm/test/KnownTestLocations.js.map +1 -1
  480. package/lib/esm/test/PrintElementTree.js.map +1 -1
  481. package/lib/esm/test/PropertyDb.test.js.map +1 -1
  482. package/lib/esm/test/RevisionUtility.js.map +1 -1
  483. package/lib/esm/test/SchemaUtils.test.js +25 -25
  484. package/lib/esm/test/SchemaUtils.test.js.map +1 -1
  485. package/lib/esm/test/SequentialLogMatcher.js.map +1 -1
  486. package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
  487. package/lib/esm/test/TestUtils.d.ts +1 -1
  488. package/lib/esm/test/TestUtils.d.ts.map +1 -1
  489. package/lib/esm/test/TestUtils.js +1 -1
  490. package/lib/esm/test/TestUtils.js.map +1 -1
  491. package/lib/esm/test/annotations/Fields.test.d.ts +2 -0
  492. package/lib/esm/test/annotations/Fields.test.d.ts.map +1 -0
  493. package/lib/esm/test/annotations/Fields.test.js +576 -0
  494. package/lib/esm/test/annotations/Fields.test.js.map +1 -0
  495. package/lib/esm/test/annotations/FrameGeometry.test.d.ts +2 -0
  496. package/lib/esm/test/annotations/FrameGeometry.test.d.ts.map +1 -0
  497. package/lib/esm/test/annotations/FrameGeometry.test.js +86 -0
  498. package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -0
  499. package/lib/esm/test/annotations/LeaderGeometry.test.d.ts +2 -0
  500. package/lib/esm/test/annotations/LeaderGeometry.test.d.ts.map +1 -0
  501. package/lib/esm/test/annotations/LeaderGeometry.test.js +256 -0
  502. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -0
  503. package/lib/esm/test/annotations/TextAnnotation.test.js +269 -1047
  504. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  505. package/lib/esm/test/annotations/TextBlock.test.d.ts +2 -0
  506. package/lib/esm/test/annotations/TextBlock.test.d.ts.map +1 -0
  507. package/lib/esm/test/annotations/TextBlock.test.js +1199 -0
  508. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -0
  509. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.d.ts +60 -0
  510. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.d.ts.map +1 -0
  511. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js +69 -0
  512. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js.map +1 -0
  513. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts +1442 -0
  514. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts.map +1 -0
  515. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js +817 -0
  516. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -0
  517. package/lib/esm/test/categories/Category.test.js.map +1 -1
  518. package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
  519. package/lib/esm/test/ecdb/CTE.test.js +88 -88
  520. package/lib/esm/test/ecdb/CTE.test.js.map +1 -1
  521. package/lib/esm/test/ecdb/ConcurrentQuery.test.d.ts +2 -0
  522. package/lib/esm/test/ecdb/ConcurrentQuery.test.d.ts.map +1 -0
  523. package/lib/esm/test/ecdb/ConcurrentQuery.test.js +164 -0
  524. package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -0
  525. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +35 -45
  526. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
  527. package/lib/esm/test/ecdb/ECDb.test.js +86 -65
  528. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  529. package/lib/esm/test/ecdb/ECDbTestHelper.js.map +1 -1
  530. package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -1
  531. package/lib/esm/test/ecdb/ECSqlAst.test.js +65 -65
  532. package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
  533. package/lib/esm/test/ecdb/ECSqlQuery.test.js +0 -55
  534. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  535. package/lib/esm/test/ecdb/ECSqlReader.test.js +16 -16
  536. package/lib/esm/test/ecdb/ECSqlReader.test.js.map +1 -1
  537. package/lib/esm/test/ecdb/ECSqlStatement.test.js +484 -292
  538. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  539. package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
  540. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
  541. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +21 -21
  542. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
  543. package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
  544. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  545. package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
  546. package/lib/esm/test/element/ElementAspect.test.js +22 -22
  547. package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
  548. package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
  549. package/lib/esm/test/element/ElementRoundTrip.test.js +139 -139
  550. package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
  551. package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
  552. package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
  553. package/lib/esm/test/element/NullStructArray.test.js +13 -13
  554. package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
  555. package/lib/esm/test/element/UrlLink.test.js.map +1 -1
  556. package/lib/esm/test/font/FontFile.test.js.map +1 -1
  557. package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
  558. package/lib/esm/test/hubaccess/ApplyChangeset.test.d.ts +2 -0
  559. package/lib/esm/test/hubaccess/ApplyChangeset.test.d.ts.map +1 -0
  560. package/lib/esm/test/hubaccess/ApplyChangeset.test.js +86 -0
  561. package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -0
  562. package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
  563. package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
  564. package/lib/esm/test/imageData.js.map +1 -1
  565. package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
  566. package/lib/esm/test/imodel/GetTextureImage.test.js.map +1 -1
  567. package/lib/esm/test/imodel/IModel.test.js +313 -5
  568. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  569. package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
  570. package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
  571. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.d.ts +2 -0
  572. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.d.ts.map +1 -0
  573. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js +343 -0
  574. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -0
  575. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.d.ts +2 -0
  576. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.d.ts.map +1 -0
  577. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +207 -0
  578. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -0
  579. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts +11 -0
  580. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts.map +1 -0
  581. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js +36 -0
  582. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js.map +1 -0
  583. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts +17 -0
  584. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts.map +1 -0
  585. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js +116 -0
  586. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js.map +1 -0
  587. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts +9 -0
  588. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts.map +1 -0
  589. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js +20 -0
  590. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +1 -0
  591. package/lib/esm/test/index.js.map +1 -1
  592. package/lib/esm/test/misc/DevTools.test.js.map +1 -1
  593. package/lib/esm/test/misc/EntitySubClasses.test.js.map +1 -1
  594. package/lib/esm/test/misc/GeoServices.test.js +36 -10
  595. package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
  596. package/lib/esm/test/misc/PromiseMemoizer.test.js.map +1 -1
  597. package/lib/esm/test/native/DgnDbWorker.test.js.map +1 -1
  598. package/lib/esm/test/rpc/response.test.js.map +1 -1
  599. package/lib/esm/test/schema/ClassRegistry.test.js +175 -73
  600. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  601. package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
  602. package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
  603. package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
  604. package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
  605. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  606. package/lib/esm/test/standalone/ChangesetReader.test.js +575 -164
  607. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  608. package/lib/esm/test/standalone/CustomViewState3dCreator.test.js.map +1 -1
  609. package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
  610. package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
  611. package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
  612. package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
  613. package/lib/esm/test/standalone/ExportGraphics.test.js +67 -15
  614. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  615. package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
  616. package/lib/esm/test/standalone/GeometryStream.test.js +49 -1
  617. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  618. package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
  619. package/lib/esm/test/standalone/IModelLimits.test.d.ts +2 -0
  620. package/lib/esm/test/standalone/IModelLimits.test.d.ts.map +1 -0
  621. package/lib/esm/test/standalone/IModelLimits.test.js +103 -0
  622. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -0
  623. package/lib/esm/test/standalone/IModelWrite.test.js +27 -27
  624. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  625. package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
  626. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  627. package/lib/esm/test/standalone/NativeAppStorage.test.js.map +1 -1
  628. package/lib/esm/test/standalone/RenderMaterialElement.test.js +24 -1
  629. package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
  630. package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
  631. package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
  632. package/lib/esm/test/standalone/SchemaUtils.test.js.map +1 -1
  633. package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
  634. package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
  635. package/lib/esm/test/standalone/Setting.test.js.map +1 -1
  636. package/lib/esm/test/standalone/Settings.test.js.map +1 -1
  637. package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
  638. package/lib/esm/test/standalone/SnapshotDb.test.js +19 -1
  639. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  640. package/lib/esm/test/standalone/Texture.test.js.map +1 -1
  641. package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
  642. package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
  643. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  644. package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
  645. package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -1
  646. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  647. package/lib/esm/workspace/Settings.js.map +1 -1
  648. package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
  649. package/lib/esm/workspace/Workspace.d.ts +0 -1
  650. package/lib/esm/workspace/Workspace.d.ts.map +1 -1
  651. package/lib/esm/workspace/Workspace.js.map +1 -1
  652. package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
  653. package/package.json +22 -16
  654. package/lib/cjs/TextAnnotationElement.d.ts +0 -54
  655. package/lib/cjs/TextAnnotationElement.d.ts.map +0 -1
  656. package/lib/cjs/TextAnnotationElement.js +0 -94
  657. package/lib/cjs/TextAnnotationElement.js.map +0 -1
  658. package/lib/cjs/TextAnnotationGeometry.d.ts +0 -32
  659. package/lib/cjs/TextAnnotationGeometry.d.ts.map +0 -1
  660. package/lib/cjs/TextAnnotationGeometry.js.map +0 -1
  661. package/lib/cjs/TextAnnotationLayout.d.ts.map +0 -1
  662. package/lib/cjs/TextAnnotationLayout.js.map +0 -1
  663. package/lib/esm/TextAnnotationElement.d.ts +0 -54
  664. package/lib/esm/TextAnnotationElement.d.ts.map +0 -1
  665. package/lib/esm/TextAnnotationElement.js +0 -89
  666. package/lib/esm/TextAnnotationElement.js.map +0 -1
  667. package/lib/esm/TextAnnotationGeometry.d.ts +0 -32
  668. package/lib/esm/TextAnnotationGeometry.d.ts.map +0 -1
  669. package/lib/esm/TextAnnotationGeometry.js.map +0 -1
  670. package/lib/esm/TextAnnotationLayout.d.ts.map +0 -1
  671. package/lib/esm/TextAnnotationLayout.js.map +0 -1
@@ -2,987 +2,85 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import { assert, expect } from "chai";
6
- import { computeGraphemeOffsets, layoutTextBlock } from "../../TextAnnotationLayout";
7
- import { Geometry, Range2d } from "@itwin/core-geometry";
8
- import { ColorDef, FontType, FractionRun, LineBreakRun, TextAnnotation, TextBlock, TextRun, TextStyleSettings } from "@itwin/core-common";
9
- import { TextAnnotation2d, TextAnnotation3d } from "../../TextAnnotationElement";
10
- import { produceTextAnnotationGeometry } from "../../TextAnnotationGeometry";
5
+ import { expect } from "chai";
6
+ import { Angle, Point3d, Range2d, Range3d, YawPitchRollAngles } from "@itwin/core-geometry";
7
+ import { FractionRun, SubCategoryAppearance, TextAnnotation, TextBlock, TextRun, TextStyleSettings } from "@itwin/core-common";
8
+ import { StandaloneDb } from "../../IModelDb";
9
+ import { AnnotationTextStyle, TextAnnotation2d, TextAnnotation3d } from "../../annotations/TextAnnotationElement";
11
10
  import { IModelTestUtils } from "../IModelTestUtils";
12
- import { Id64, ProcessDetector } from "@itwin/core-bentley";
13
- function computeTextRangeAsStringLength(args) {
14
- const range = new Range2d(0, 0, args.chars.length, args.lineHeight);
15
- return { layout: range, justification: range };
16
- }
17
- function doLayout(textBlock, args) {
18
- const layout = layoutTextBlock({
19
- textBlock,
20
- iModel: {},
21
- findTextStyle: args?.findTextStyle ?? (() => TextStyleSettings.defaults),
22
- findFontId: args?.findFontId ?? (() => 0),
23
- computeTextRange: args?.computeTextRange ?? computeTextRangeAsStringLength,
24
- });
25
- return layout;
26
- }
27
- function makeTextRun(content, styleName = "") {
28
- return TextRun.create({ content, styleName });
29
- }
30
- function isIntlSupported() {
31
- // Node in the mobile add-on does not include Intl, so this test fails. Right now, mobile
32
- // users are not expected to do any editing, but long term we will attempt to find a better
33
- // solution.
34
- return !ProcessDetector.isMobileAppBackend;
35
- }
36
- describe("layoutTextBlock", () => {
37
- it("resolves TextStyleSettings from combination of TextBlock and Run", () => {
38
- const textBlock = TextBlock.create({ styleName: "block", styleOverrides: { widthFactor: 34, color: 0x00ff00 } });
39
- const run0 = TextRun.create({ content: "run0", styleName: "run", styleOverrides: { lineHeight: 56, color: 0xff0000 } });
40
- const run1 = TextRun.create({ content: "run1", styleName: "run", styleOverrides: { widthFactor: 78, fontName: "run1" } });
41
- textBlock.appendRun(run0);
42
- textBlock.appendRun(run1);
43
- const tb = doLayout(textBlock, {
44
- findTextStyle: (name) => TextStyleSettings.fromJSON(name === "block" ? { lineSpacingFactor: 12, fontName: "block" } : { lineSpacingFactor: 99, fontName: "run" }),
45
- });
46
- expect(tb.lines.length).to.equal(1);
47
- expect(tb.lines[0].runs.length).to.equal(2);
48
- const s0 = tb.lines[0].runs[0].style;
49
- expect(s0.lineHeight).to.equal(1);
50
- expect(s0.lineSpacingFactor).to.equal(12);
51
- expect(s0.widthFactor).to.equal(34);
52
- expect(s0.fontName).to.equal("run");
53
- expect(s0.color).to.equal(0xff0000);
54
- const s1 = tb.lines[0].runs[1].style;
55
- expect(s1.widthFactor).to.equal(34);
56
- expect(s1.lineSpacingFactor).to.equal(12);
57
- expect(s1.lineHeight).to.equal(1);
58
- expect(s1.fontName).to.equal("run1");
59
- expect(s1.color).to.equal("subcategory");
60
- });
61
- it("aligns text to center based on height of stacked fraction", () => {
62
- const textBlock = TextBlock.create({ styleName: "" });
63
- const fractionRun = FractionRun.create({ numerator: "1", denominator: "2", styleName: "fraction" });
64
- const textRun = TextRun.create({ content: "text", styleName: "text" });
65
- textBlock.appendRun(fractionRun);
66
- textBlock.appendRun(textRun);
67
- const layout = doLayout(textBlock);
68
- const fractionLayout = layout.lines[0].runs[0];
69
- const textLayout = layout.lines[0].runs[1];
70
- const round = (num, numDecimalPlaces) => {
71
- const mult = Math.pow(100, numDecimalPlaces);
72
- return Math.round(num * mult) / mult;
73
- };
74
- expect(textLayout.range.yLength()).to.equal(1);
75
- expect(round(fractionLayout.range.yLength(), 2)).to.equal(1.75);
76
- expect(fractionLayout.offsetFromLine.y).to.equal(0);
77
- expect(round(textLayout.offsetFromLine.y, 3)).to.equal(.375);
78
- });
79
- it("produces one line per paragraph if document width <= 0", () => {
80
- const textBlock = TextBlock.create({ styleName: "" });
81
- for (let i = 0; i < 4; i++) {
82
- const layout = doLayout(textBlock);
83
- if (i === 0) {
84
- expect(layout.range.isNull).to.be.true;
85
- }
86
- else {
87
- expect(layout.lines.length).to.equal(i);
88
- expect(layout.range.low.x).to.equal(0);
89
- expect(layout.range.low.y).to.equal(-i - (0.5 * (i - 1))); // lineSpacingFactor=0.5
90
- expect(layout.range.high.x).to.equal(i * 3);
91
- expect(layout.range.high.y).to.equal(0);
92
- }
93
- for (let l = 0; l < layout.lines.length; l++) {
94
- const line = layout.lines[l];
95
- expect(line.runs.length).to.equal(l + 1);
96
- expect(line.range.low.x).to.equal(0);
97
- expect(line.range.low.y).to.equal(0);
98
- expect(line.range.high.y).to.equal(1);
99
- expect(line.range.high.x).to.equal(3 * (l + 1));
100
- for (const run of line.runs) {
101
- expect(run.charOffset).to.equal(0);
102
- expect(run.numChars).to.equal(3);
103
- expect(run.range.low.x).to.equal(0);
104
- expect(run.range.low.y).to.equal(0);
105
- expect(run.range.high.x).to.equal(3);
106
- expect(run.range.high.y).to.equal(1);
107
- }
108
- }
109
- const p = textBlock.appendParagraph();
110
- for (let j = 0; j <= i; j++) {
111
- p.runs.push(TextRun.create({ styleName: "", content: "Run" }));
112
- }
113
- }
114
- });
115
- it("produces a new line for each LineBreakRun", () => {
116
- const lineSpacingFactor = 0.5;
117
- const lineHeight = 1;
118
- const textBlock = TextBlock.create({ styleName: "", styleOverrides: { lineSpacingFactor, lineHeight } });
119
- textBlock.appendRun(TextRun.create({ styleName: "", content: "abc" }));
120
- textBlock.appendRun(LineBreakRun.create({ styleName: "" }));
121
- textBlock.appendRun(TextRun.create({ styleName: "", content: "def" }));
122
- textBlock.appendRun(TextRun.create({ styleName: "", content: "ghi" }));
123
- textBlock.appendRun(LineBreakRun.create({ styleName: "" }));
124
- textBlock.appendRun(TextRun.create({ styleName: "", content: "jkl" }));
125
- const tb = doLayout(textBlock);
126
- expect(tb.lines.length).to.equal(3);
127
- expect(tb.lines[0].runs.length).to.equal(2);
128
- expect(tb.lines[1].runs.length).to.equal(3);
129
- expect(tb.lines[2].runs.length).to.equal(1);
130
- expect(tb.range.low.x).to.equal(0);
131
- expect(tb.range.high.x).to.equal(6);
132
- expect(tb.range.high.y).to.equal(0);
133
- expect(tb.range.low.y).to.equal(-(lineSpacingFactor * 2 + lineHeight * 3));
134
- });
135
- it("computes ranges based on custom line spacing and line height", () => {
136
- const lineSpacingFactor = 2;
137
- const lineHeight = 3;
138
- const textBlock = TextBlock.create({ styleName: "", styleOverrides: { lineSpacingFactor, lineHeight } });
139
- textBlock.appendRun(TextRun.create({ styleName: "", content: "abc" }));
140
- textBlock.appendRun(LineBreakRun.create({ styleName: "" }));
141
- textBlock.appendRun(TextRun.create({ styleName: "", content: "def" }));
142
- textBlock.appendRun(TextRun.create({ styleName: "", content: "ghi" }));
143
- textBlock.appendRun(LineBreakRun.create({ styleName: "" }));
144
- textBlock.appendRun(TextRun.create({ styleName: "", content: "jkl" }));
145
- const tb = doLayout(textBlock);
146
- expect(tb.lines.length).to.equal(3);
147
- expect(tb.lines[0].runs.length).to.equal(2);
148
- expect(tb.lines[1].runs.length).to.equal(3);
149
- expect(tb.lines[2].runs.length).to.equal(1);
150
- // We have 3 lines each `lineHeight` high, plus 2 line breaks in between each `lineHeight*lineSpacingFactor` high.
151
- expect(tb.range.low.x).to.equal(0);
152
- expect(tb.range.high.x).to.equal(6);
153
- expect(tb.range.high.y).to.equal(0);
154
- expect(tb.range.low.y).to.equal(-(lineHeight * 3 + (lineHeight * lineSpacingFactor) * 2));
155
- expect(tb.lines[0].offsetFromDocument.y).to.equal(-lineHeight);
156
- expect(tb.lines[1].offsetFromDocument.y).to.equal(tb.lines[0].offsetFromDocument.y - (lineHeight + lineHeight * lineSpacingFactor));
157
- expect(tb.lines[2].offsetFromDocument.y).to.equal(tb.lines[1].offsetFromDocument.y - (lineHeight + lineHeight * lineSpacingFactor));
158
- expect(tb.lines.every((line) => line.offsetFromDocument.x === 0)).to.be.true;
159
- });
160
- it("splits paragraphs into multiple lines if runs exceed the document width", function () {
161
- if (!isIntlSupported()) {
162
- this.skip();
163
- }
164
- const textBlock = TextBlock.create({ styleName: "" });
165
- textBlock.width = 6;
166
- textBlock.appendRun(makeTextRun("ab"));
167
- expect(doLayout(textBlock).lines.length).to.equal(1);
168
- textBlock.appendRun(makeTextRun("cd"));
169
- expect(doLayout(textBlock).lines.length).to.equal(1);
170
- textBlock.appendRun(makeTextRun("ef"));
171
- expect(doLayout(textBlock).lines.length).to.equal(1);
172
- textBlock.appendRun(makeTextRun("ghi"));
173
- expect(doLayout(textBlock).lines.length).to.equal(2);
174
- textBlock.appendRun(makeTextRun("jklmnop"));
175
- expect(doLayout(textBlock).lines.length).to.equal(3);
176
- textBlock.appendRun(makeTextRun("q"));
177
- expect(doLayout(textBlock).lines.length).to.equal(4);
178
- textBlock.appendRun(makeTextRun("r"));
179
- expect(doLayout(textBlock).lines.length).to.equal(4);
180
- textBlock.appendRun(makeTextRun("stu"));
181
- expect(doLayout(textBlock).lines.length).to.equal(4);
182
- textBlock.appendRun(makeTextRun("vwxyz"));
183
- expect(doLayout(textBlock).lines.length).to.equal(5);
184
- });
185
- function expectRange(width, height, range) {
186
- expect(range.xLength()).to.equal(width);
187
- expect(range.yLength()).to.equal(height);
188
- }
189
- it("computes range for wrapped lines", function () {
190
- if (!isIntlSupported()) {
191
- this.skip();
192
- }
193
- const block = TextBlock.create({ styleName: "", width: 3, styleOverrides: { lineHeight: 1, lineSpacingFactor: 0 } });
194
- function expectBlockRange(width, height) {
195
- const layout = doLayout(block);
196
- expectRange(width, height, layout.range);
197
- }
198
- block.appendRun(makeTextRun("abc"));
199
- expectBlockRange(3, 1);
200
- block.appendRun(makeTextRun("defg"));
201
- expectBlockRange(4, 2);
202
- block.width = 1;
203
- expectBlockRange(4, 2);
204
- block.width = 8;
205
- expectBlockRange(8, 1);
206
- block.width = 6;
207
- expectBlockRange(6, 2);
208
- block.width = 10;
209
- expectBlockRange(10, 1);
210
- block.appendRun(makeTextRun("hijk"));
211
- expectBlockRange(10, 2);
212
- });
213
- it("computes range for split runs", function () {
214
- if (!isIntlSupported()) {
215
- this.skip();
216
- }
217
- const block = TextBlock.create({ styleName: "", styleOverrides: { lineHeight: 1, lineSpacingFactor: 0 } });
218
- function expectBlockRange(width, height) {
219
- const layout = doLayout(block);
220
- expectRange(width, height, layout.range);
221
- }
222
- const sentence = "a bc def ghij klmno";
223
- expect(sentence.length).to.equal(19);
224
- block.appendRun(makeTextRun(sentence));
225
- block.width = 19;
226
- expectBlockRange(19, 1);
227
- block.width = 10;
228
- expectBlockRange(10, 2);
229
- });
230
- it("justifies lines", function () {
231
- if (!isIntlSupported()) {
232
- this.skip();
233
- }
234
- const block = TextBlock.create({ styleName: "", styleOverrides: { lineSpacingFactor: 0 } });
235
- function expectBlockRange(width, height) {
236
- const layout = doLayout(block);
237
- expectRange(width, height, layout.range);
238
- }
239
- function expectLineOffset(offset, lineIndex) {
240
- const layout = doLayout(block);
241
- expect(layout.lines.length).least(lineIndex + 1);
242
- const line = layout.lines[lineIndex];
243
- expect(line.offsetFromDocument.y).to.equal(-(lineIndex + 1));
244
- expect(line.offsetFromDocument.x).to.equal(offset);
245
- }
246
- // Two text runs with 7 characters total.
247
- block.appendRun(makeTextRun("abc"));
248
- block.appendRun(makeTextRun("defg"));
249
- // 1 line of text with width 0: left, right, center justification.
250
- block.justification = "left";
251
- expectBlockRange(7, 1);
252
- expectLineOffset(0, 0);
253
- block.justification = "right";
254
- expectBlockRange(7, 1);
255
- expectLineOffset(0, 0);
256
- block.justification = "center";
257
- expectBlockRange(7, 1);
258
- expectLineOffset(0, 0);
259
- // 1 line of text from a width greater than number of characters: left, right, center justification.
260
- block.width = 10;
261
- block.justification = "left";
262
- expectBlockRange(10, 1);
263
- expectLineOffset(0, 0);
264
- block.justification = "right";
265
- expectBlockRange(10, 1);
266
- expectLineOffset(3, 0); // 3 = 10 - 7
267
- block.justification = "center";
268
- expectBlockRange(10, 1);
269
- expectLineOffset(1.5, 0); // 1.5 = (10 - 7) / 2
270
- // 2 line of text from a width less than number of characters: left, right, center justification.
271
- block.justification = "left";
272
- block.width = 4;
273
- expectBlockRange(4, 2);
274
- expectLineOffset(0, 0);
275
- expectLineOffset(0, 1);
276
- block.justification = "right";
277
- expectBlockRange(4, 2);
278
- expectLineOffset(1, 0);
279
- expectLineOffset(0, 1);
280
- block.justification = "center";
281
- expectBlockRange(4, 2);
282
- expectLineOffset(0.5, 0);
283
- expectLineOffset(0, 1);
284
- // Testing text longer the the width of the text block.
285
- block.width = 2;
286
- block.justification = "left";
287
- expectBlockRange(4, 2);
288
- expectLineOffset(0, 0);
289
- expectLineOffset(0, 1);
290
- block.justification = "right";
291
- expectBlockRange(4, 2);
292
- expectLineOffset(-1, 0);
293
- expectLineOffset(-2, 1);
294
- block.appendRun(makeTextRun("123456789"));
295
- expectBlockRange(9, 3);
296
- expectLineOffset(-1, 0);
297
- expectLineOffset(-2, 1);
298
- expectLineOffset(-7, 2);
299
- block.justification = "center";
300
- expectBlockRange(9, 3);
301
- expectLineOffset(-0.5, 0);
302
- expectLineOffset(-1, 1);
303
- expectLineOffset(-3.5, 2);
304
- });
305
- function expectLines(input, width, expectedLines) {
306
- const textBlock = TextBlock.create({ styleName: "" });
307
- textBlock.width = width;
308
- const run = makeTextRun(input);
309
- textBlock.appendRun(run);
310
- const layout = doLayout(textBlock);
311
- expect(layout.lines.every((line) => line.runs.every((r) => r.source === run))).to.be.true;
312
- const actual = layout.lines.map((line) => line.runs.map((runLayout) => runLayout.source.content.substring(runLayout.charOffset, runLayout.charOffset + runLayout.numChars)).join(""));
313
- expect(actual).to.deep.equal(expectedLines);
314
- return layout;
315
- }
316
- it("splits a single TextRun at word boundaries if it exceeds the document width", function () {
317
- if (!isIntlSupported()) {
318
- this.skip();
319
- }
320
- expectLines("a bc def ghij klmno pqrstu vwxyz", 5, [
321
- "a bc ",
322
- "def ",
323
- "ghij ",
324
- "klmno ",
325
- "pqrstu ",
326
- "vwxyz",
327
- ]);
328
- const fox = "The quick brown fox jumped over the lazy dog";
329
- expectLines(fox, 50, [fox]);
330
- expectLines(fox, 40, [
331
- // 1 2 3 4
332
- // 34567890123456789012345678901234567890
333
- "The quick brown fox jumped over the ",
334
- "lazy dog",
335
- ]);
336
- expectLines(fox, 30, [
337
- // 1 2 3
338
- // 3456789012345678901234567890
339
- "The quick brown fox jumped ",
340
- "over the lazy dog",
341
- ]);
342
- expectLines(fox, 20, [
343
- // 1 2
344
- // 345678901234567890
345
- "The quick brown fox ",
346
- "jumped over the ",
347
- "lazy dog",
348
- ]);
349
- expectLines(fox, 10, [
350
- // 1
351
- // 234567890
352
- "The quick ",
353
- "brown fox ",
354
- "jumped ",
355
- "over the ",
356
- "lazy dog",
357
- ]);
358
- });
359
- it("considers consecutive whitespace part of a single 'word'", function () {
360
- if (!isIntlSupported()) {
361
- this.skip();
362
- }
363
- expectLines("a b c d e f ", 3, [
364
- "a ",
365
- "b ",
366
- "c ",
367
- "d ",
368
- "e ",
369
- "f ",
370
- ]);
371
- });
372
- it("wraps Japanese text", function () {
373
- if (!isIntlSupported()) {
374
- this.skip();
375
- }
376
- // "I am a cat. The name is Tanuki."
377
- expectLines("吾輩は猫である。名前はたぬき。", 1, ["吾", "輩", "は", "猫", "で", "あ", "る。", "名", "前", "は", "た", "ぬ", "き。"]);
378
- });
379
- it("performs word-wrapping with punctuation", function () {
380
- if (!isIntlSupported()) {
381
- this.skip();
382
- }
383
- expectLines("1.24 56.7 8,910", 1, ["1.24 ", "56.7 ", "8,910"]);
384
- expectLines("a.bc de.f g,hij", 1, ["a.bc ", "de.f ", "g,hij"]);
385
- expectLines("Let's see... can you (or anyone) predict?!", 1, [
386
- "Let's ",
387
- "see... ",
388
- "can ",
389
- "you ",
390
- "(or ",
391
- "anyone) ",
392
- "predict?!",
393
- ]);
394
- });
395
- it("performs word-wrapping and line-splitting with multiple runs", function () {
396
- if (!isIntlSupported()) {
397
- this.skip();
398
- }
399
- const textBlock = TextBlock.create({ styleName: "" });
400
- for (const str of ["The ", "quick brown", " fox jumped over ", "the lazy ", "dog"]) {
401
- textBlock.appendRun(makeTextRun(str));
402
- }
403
- function test(width, expected) {
404
- textBlock.width = width;
405
- const layout = doLayout(textBlock);
406
- const actual = layout.lines.map((line) => line.runs.map((runLayout) => runLayout.source.content.substring(runLayout.charOffset, runLayout.charOffset + runLayout.numChars)).join(""));
407
- expect(actual).to.deep.equal(expected);
408
- }
409
- test(50, ["The quick brown fox jumped over the lazy dog"]);
410
- test(40, [
411
- // 1 2 3 4
412
- // 34567890123456789012345678901234567890
413
- "The quick brown fox jumped over the ",
414
- "lazy dog",
415
- ]);
416
- test(30, [
417
- // 1 2 3
418
- // 3456789012345678901234567890
419
- "The quick brown fox jumped ",
420
- "over the lazy dog",
421
- ]);
422
- test(20, [
423
- // 1 2
424
- // 345678901234567890
425
- "The quick brown fox ",
426
- "jumped over the ",
427
- "lazy dog",
428
- ]);
429
- test(10, [
430
- // 1
431
- // 34567890
432
- "The quick ",
433
- "brown fox ",
434
- "jumped ",
435
- "over the ",
436
- "lazy dog",
437
- ]);
438
- });
439
- it("wraps multiple runs", function () {
440
- if (!isIntlSupported()) {
441
- this.skip();
442
- }
443
- const block = TextBlock.create({ styleName: "" });
444
- block.appendRun(makeTextRun("aa")); // 2 chars wide
445
- block.appendRun(makeTextRun("bb ccc d ee")); // 11 chars wide
446
- block.appendRun(makeTextRun("ff ggg h")); // 8 chars wide
447
- function expectLayout(width, expected) {
448
- block.width = width;
449
- const layout = doLayout(block);
450
- expect(layout.stringify()).to.equal(expected);
451
- }
452
- expectLayout(23, "aabb ccc d eeff ggg h");
453
- expectLayout(22, "aabb ccc d eeff ggg h");
454
- expectLayout(21, "aabb ccc d eeff ggg h");
455
- expectLayout(20, "aabb ccc d eeff ggg \nh");
456
- expectLayout(19, "aabb ccc d eeff \nggg h");
457
- expectLayout(18, "aabb ccc d eeff \nggg h");
458
- expectLayout(17, "aabb ccc d eeff \nggg h");
459
- expectLayout(16, "aabb ccc d eeff \nggg h");
460
- expectLayout(15, "aabb ccc d ee\nff ggg h");
461
- expectLayout(14, "aabb ccc d ee\nff ggg h");
462
- expectLayout(13, "aabb ccc d ee\nff ggg h");
463
- expectLayout(12, "aabb ccc d \neeff ggg h");
464
- expectLayout(11, "aabb ccc d \neeff ggg h");
465
- expectLayout(10, "aabb ccc \nd eeff \nggg h");
466
- expectLayout(9, "aabb ccc \nd eeff \nggg h");
467
- expectLayout(8, "aabb \nccc d ee\nff ggg h");
468
- expectLayout(7, "aabb \nccc d \neeff \nggg h");
469
- expectLayout(6, "aabb \nccc d \neeff \nggg h");
470
- expectLayout(5, "aabb \nccc \nd ee\nff \nggg h");
471
- expectLayout(4, "aa\nbb \nccc \nd ee\nff \nggg \nh");
472
- expectLayout(3, "aa\nbb \nccc \nd \nee\nff \nggg \nh");
473
- expectLayout(2, "aa\nbb \nccc \nd \nee\nff \nggg \nh");
474
- expectLayout(1, "aa\nbb \nccc \nd \nee\nff \nggg \nh");
475
- expectLayout(0, "aabb ccc d eeff ggg h");
476
- expectLayout(-1, "aabb ccc d eeff ggg h");
477
- expectLayout(-2, "aabb ccc d eeff ggg h");
478
- });
479
- it("does not word wrap due to floating point rounding error", function () {
480
- if (!isIntlSupported()) {
481
- this.skip();
482
- }
483
- const block = TextBlock.create({ styleName: "", styleOverrides: { lineHeight: 1, lineSpacingFactor: 0 } });
484
- block.appendRun(makeTextRun("abc defg"));
485
- const layout1 = doLayout(block);
486
- let width = layout1.range.xLength();
487
- // Simulate a floating point rounding error by slightly reducing the width
488
- width -= Geometry.smallFloatingPoint;
489
- block.width = width;
490
- const layout2 = doLayout(block);
491
- expect(layout2.range.yLength()).to.equal(1);
492
- });
493
- it("has consistent data when converted to a layout result", function () {
494
- if (!isIntlSupported()) {
495
- this.skip();
496
- }
497
- // Initialize a new TextBlockLayout object
498
- const textBlock = TextBlock.create({ width: 50, styleName: "", styleOverrides: { widthFactor: 34, color: 0x00ff00, fontName: "arial" } });
499
- const run0 = TextRun.create({
500
- content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pretium mi sit amet magna malesuada, at venenatis ante eleifend.",
501
- styleName: "",
502
- styleOverrides: { lineHeight: 56, color: 0xff0000 },
503
- });
504
- const run1 = TextRun.create({
505
- content: "Donec sit amet semper sapien. Nullam commodo, libero a accumsan lacinia, metus enim pharetra lacus, eu facilisis sem nisi eu dui.",
506
- styleName: "",
507
- styleOverrides: { widthFactor: 78, fontName: "run1" },
508
- });
509
- const run2 = TextRun.create({
510
- content: "Duis dui quam, suscipit quis feugiat id, fermentum ut augue. Mauris iaculis odio rhoncus lorem eleifend, posuere viverra turpis elementum.",
511
- styleName: "",
512
- styleOverrides: {},
513
- });
514
- const fractionRun = FractionRun.create({ numerator: "num", denominator: "denom", styleName: "", styleOverrides: {} });
515
- textBlock.appendRun(run0);
516
- textBlock.appendRun(fractionRun);
517
- textBlock.appendParagraph();
518
- textBlock.appendRun(run1);
519
- textBlock.appendRun(run2);
520
- // Call the toResult() method
521
- const textBlockLayout = doLayout(textBlock, {
522
- findFontId: (fontName) => {
523
- if (fontName === "arial") {
524
- return 1;
525
- }
526
- else if (fontName === "run1") {
527
- return 2;
528
- }
529
- return 0;
530
- },
531
- });
532
- const result = textBlockLayout.toResult();
533
- // Assert that the result object has the same data as the original TextBlockLayout object
534
- expect(result.range).to.deep.equal(textBlockLayout.range.toJSON());
535
- expect(result.lines.length).to.equal(textBlockLayout.lines.length);
536
- // Loop through each line in the result and the original object
537
- for (let i = 0; i < result.lines.length; i++) {
538
- const resultLine = result.lines[i];
539
- const originalLine = textBlockLayout.lines[i];
540
- // Source paragraph index matches
541
- expect(resultLine.sourceParagraphIndex).to.equal(textBlock.paragraphs.indexOf(originalLine.source));
542
- // Ranges match
543
- expect(resultLine.range).to.deep.equal(originalLine.range.toJSON());
544
- expect(resultLine.justificationRange).to.deep.equal(originalLine.justificationRange.toJSON());
545
- // Offset matches
546
- expect(resultLine.offsetFromDocument).to.deep.equal(originalLine.offsetFromDocument);
547
- for (let j = 0; j < resultLine.runs.length; j++) {
548
- const resultRun = resultLine.runs[j];
549
- const originalRun = originalLine.runs[j];
550
- // Source run index matches
551
- expect(resultRun.sourceRunIndex).to.equal(textBlock.paragraphs[resultLine.sourceParagraphIndex].runs.indexOf(originalRun.source));
552
- // FontId matches
553
- expect(resultRun.fontId).to.equal(originalRun.fontId);
554
- // Offsets match
555
- expect(resultRun.characterOffset).to.equal(originalRun.charOffset);
556
- expect(resultRun.characterCount).to.equal(originalRun.numChars);
557
- expect(resultRun.offsetFromLine).to.deep.equal(originalRun.offsetFromLine);
558
- // Range matches
559
- expect(resultRun.range).to.deep.equal(originalRun.range.toJSON());
560
- // Text style matches
561
- expect(resultRun.textStyle).to.deep.equal(originalRun.style.toJSON());
562
- // Optional values match existence and values
563
- if (resultRun.justificationRange) {
564
- expect(originalRun.justificationRange);
565
- }
566
- if (originalRun.justificationRange) {
567
- expect(resultRun.justificationRange);
568
- }
569
- if (resultRun.justificationRange && originalRun.justificationRange) {
570
- expect(resultRun.justificationRange).to.deep.equal(originalRun.justificationRange.toJSON());
571
- }
572
- if (resultRun.numeratorRange) {
573
- expect(originalRun.numeratorRange);
574
- }
575
- if (originalRun.numeratorRange) {
576
- expect(resultRun.numeratorRange);
577
- }
578
- if (resultRun.numeratorRange && originalRun.numeratorRange) {
579
- expect(resultRun.numeratorRange).to.deep.equal(originalRun.numeratorRange.toJSON());
580
- }
581
- if (resultRun.denominatorRange) {
582
- expect(originalRun.denominatorRange);
583
- }
584
- if (originalRun.denominatorRange) {
585
- expect(resultRun.denominatorRange);
586
- }
587
- if (resultRun.denominatorRange && originalRun.denominatorRange) {
588
- expect(resultRun.denominatorRange).to.deep.equal(originalRun.denominatorRange.toJSON());
589
- }
590
- // Check that the result string matches what we expect
591
- const inputRun = textBlock.paragraphs[resultLine.sourceParagraphIndex].runs[resultRun.sourceRunIndex].clone();
592
- if (inputRun.type === "text") {
593
- const resultText = inputRun.content.substring(resultRun.characterOffset, resultRun.characterOffset + resultRun.characterCount);
594
- const originalText = inputRun.content.substring(originalRun.charOffset, originalRun.charOffset + originalRun.numChars);
595
- expect(resultText).to.equal(originalText);
596
- }
597
- }
598
- }
599
- });
600
- it("adds margins", function () {
601
- const expectMargins = (layoutRange, marginRange, margins) => {
602
- expect(marginRange.low.x).to.equal(layoutRange.low.x - (margins.left ?? 0));
603
- expect(marginRange.high.x).to.equal(layoutRange.high.x + (margins.right ?? 0));
604
- expect(marginRange.low.y).to.equal(layoutRange.low.y - (margins.bottom ?? 0));
605
- expect(marginRange.high.y).to.equal(layoutRange.high.y + (margins.top ?? 0));
606
- };
607
- const makeTextBlock = (margins) => {
608
- const textblock = TextBlock.create({ styleName: "", styleOverrides: { lineSpacingFactor: 0 }, margins });
609
- textblock.appendRun(makeTextRun("abc"));
610
- textblock.appendRun(makeTextRun("defg"));
611
- return textblock;
612
- };
613
- let block = makeTextBlock({});
614
- let layout = doLayout(block);
615
- // Margins should be 0 by default
616
- expect(layout.range.isAlmostEqual(layout.textRange)).to.be.true;
617
- expectMargins(layout.textRange, layout.range, {});
618
- // All margins should be applied to the range
619
- block = makeTextBlock({ left: 1, right: 2, top: 3, bottom: 4 });
620
- layout = doLayout(block);
621
- expectMargins(layout.textRange, layout.range, { left: 1, right: 2, top: 3, bottom: 4 });
622
- // Just horisontal margins should be applied
623
- block = makeTextBlock({ left: 1, right: 2 });
624
- layout = doLayout(block);
625
- expectMargins(layout.textRange, layout.range, { left: 1, right: 2 });
626
- // Just vertical margins should be applied
627
- block = makeTextBlock({ top: 1, bottom: 2 });
628
- layout = doLayout(block);
629
- expectMargins(layout.textRange, layout.range, { top: 1, bottom: 2 });
630
- });
631
- describe("grapheme offsets", () => {
632
- it("should return an empty array if source type is not text", function () {
633
- const textBlock = TextBlock.create({ styleName: "" });
634
- const fractionRun = FractionRun.create({ numerator: "1", denominator: "2", styleName: "fraction" });
635
- textBlock.appendRun(fractionRun);
636
- const layout = doLayout(textBlock);
637
- const result = layout.toResult();
638
- const args = {
639
- textBlock,
640
- iModel: {},
641
- findTextStyle: () => TextStyleSettings.defaults,
642
- findFontId: () => 0,
643
- computeTextRange: computeTextRangeAsStringLength,
644
- paragraphIndex: result.lines[0].sourceParagraphIndex,
645
- runLayoutResult: result.lines[0].runs[0],
646
- graphemeCharIndexes: [0],
647
- };
648
- const graphemeRanges = computeGraphemeOffsets(args);
649
- expect(graphemeRanges).to.be.an("array").that.is.empty;
650
- });
651
- it("should handle empty text content", function () {
652
- const textBlock = TextBlock.create({ styleName: "" });
653
- const textRun = TextRun.create({ content: "", styleName: "text" });
654
- textBlock.appendRun(textRun);
655
- const layout = doLayout(textBlock);
656
- const result = layout.toResult();
657
- const args = {
658
- textBlock,
659
- iModel: {},
660
- findTextStyle: () => TextStyleSettings.defaults,
661
- findFontId: () => 0,
662
- computeTextRange: computeTextRangeAsStringLength,
663
- paragraphIndex: result.lines[0].sourceParagraphIndex,
664
- runLayoutResult: result.lines[0].runs[0],
665
- graphemeCharIndexes: [0], // Supply a grapheme index even though there is no text
666
- };
667
- const graphemeRanges = computeGraphemeOffsets(args);
668
- expect(graphemeRanges).to.be.an("array").that.is.empty;
669
- });
670
- it("should compute grapheme offsets correctly for a given text", function () {
671
- const textBlock = TextBlock.create({ styleName: "" });
672
- const textRun = TextRun.create({ content: "hello", styleName: "text" });
673
- textBlock.appendRun(textRun);
674
- const layout = doLayout(textBlock);
675
- const result = layout.toResult();
676
- const args = {
677
- textBlock,
678
- iModel: {},
679
- findTextStyle: () => TextStyleSettings.defaults,
680
- findFontId: () => 0,
681
- computeTextRange: computeTextRangeAsStringLength,
682
- paragraphIndex: result.lines[0].sourceParagraphIndex,
683
- runLayoutResult: result.lines[0].runs[0],
684
- graphemeCharIndexes: [0, 1, 2, 3, 4],
685
- };
686
- const graphemeRanges = computeGraphemeOffsets(args);
687
- expect(graphemeRanges).to.be.an("array").that.has.lengthOf(5);
688
- expect(graphemeRanges[0].high.x).to.equal(1);
689
- expect(graphemeRanges[4].high.x).to.equal(5);
690
- });
691
- it("should compute grapheme offsets correctly for non-English text", function () {
692
- const textBlock = TextBlock.create({ styleName: "" });
693
- // Hindi - "Paragraph"
694
- const textRun = TextRun.create({ content: "अनुच्छेद", styleName: "text" });
695
- textBlock.appendRun(textRun);
696
- const layout = doLayout(textBlock);
697
- const result = layout.toResult();
698
- const args = {
699
- textBlock,
700
- iModel: {},
701
- findTextStyle: () => TextStyleSettings.defaults,
702
- findFontId: () => 0,
703
- computeTextRange: computeTextRangeAsStringLength,
704
- paragraphIndex: result.lines[0].sourceParagraphIndex,
705
- runLayoutResult: result.lines[0].runs[0],
706
- graphemeCharIndexes: [0, 1, 3, 7],
707
- };
708
- const graphemeRanges = computeGraphemeOffsets(args);
709
- expect(graphemeRanges).to.be.an("array").that.has.lengthOf(4); // Length based on actual grapheme segmentation
710
- expect(graphemeRanges[0].high.x).to.equal(1);
711
- expect(graphemeRanges[1].high.x).to.equal(3);
712
- expect(graphemeRanges[2].high.x).to.equal(7);
713
- expect(graphemeRanges[3].high.x).to.equal(8);
714
- });
715
- it("should compute grapheme offsets correctly for emoji content", function () {
716
- const textBlock = TextBlock.create({ styleName: "" });
717
- const textRun = TextRun.create({ content: "👨‍👦", styleName: "text" });
718
- textBlock.appendRun(textRun);
719
- const layout = doLayout(textBlock);
720
- const result = layout.toResult();
721
- const args = {
722
- textBlock,
723
- iModel: {},
724
- findTextStyle: () => TextStyleSettings.defaults,
725
- findFontId: () => 0,
726
- computeTextRange: computeTextRangeAsStringLength,
727
- paragraphIndex: result.lines[0].sourceParagraphIndex,
728
- runLayoutResult: result.lines[0].runs[0],
729
- graphemeCharIndexes: [0],
730
- };
731
- const graphemeRanges = computeGraphemeOffsets(args);
732
- expect(graphemeRanges).to.be.an("array").that.has.lengthOf(1); // Length based on actual grapheme segmentation
733
- expect(graphemeRanges[0].high.x).to.equal(5);
734
- });
735
- });
736
- describe("using native font library", () => {
737
- let iModel;
738
- before(() => {
739
- const seedFileName = IModelTestUtils.resolveAssetFile("CompatibilityTestSeed.bim");
740
- const testFileName = IModelTestUtils.prepareOutputFile("NativeFonts", "NativeFonts.bim");
741
- iModel = IModelTestUtils.createSnapshotFromSeed(testFileName, seedFileName);
742
- });
743
- after(() => iModel.close());
744
- it("maps font names to Id", async () => {
745
- const vera = iModel.fonts.findId({ name: "Vera" });
746
- expect(vera).to.equal(1);
747
- const arial = await iModel.fonts.acquireId({ name: "Arial", type: FontType.TrueType });
748
- const comic = await iModel.fonts.acquireId({ name: "Comic Sans", type: FontType.TrueType });
749
- iModel.saveChanges();
750
- expect(arial).to.equal(2);
751
- expect(comic).to.equal(3);
752
- expect(iModel.fonts.findId({ name: "Consolas" })).to.be.undefined;
753
- function test(fontName, expectedFontId) {
754
- const textBlock = TextBlock.create({ styleName: "" });
755
- textBlock.appendRun(TextRun.create({ styleName: "", styleOverrides: { fontName } }));
756
- const layout = layoutTextBlock({ textBlock, iModel });
757
- const run = layout.lines[0].runs[0];
758
- expect(run).not.to.be.undefined;
759
- expect(run.fontId).to.equal(expectedFontId);
760
- }
761
- test("Arial", arial);
762
- test("Comic Sans", comic);
763
- test("Consolas", 0);
764
- test("arial", arial);
765
- test("aRIaL", arial);
766
- });
767
- function computeDimensions(args) {
768
- const textBlock = TextBlock.create({
769
- styleName: "",
770
- styleOverrides: {
771
- lineHeight: args.height,
772
- widthFactor: args.width,
773
- },
774
- });
775
- textBlock.appendRun(TextRun.create({
776
- styleName: "",
777
- content: args.content ?? "This is a string of text.",
778
- styleOverrides: {
779
- isBold: args.bold,
780
- isItalic: args.italic,
781
- fontName: args.font ?? "Vera",
782
- },
783
- }));
784
- const range = layoutTextBlock({ textBlock, iModel }).range;
785
- return { x: range.high.x - range.low.x, y: range.high.y - range.low.y };
786
- }
787
- it("computes different ranges for different strings", () => {
788
- expect(computeDimensions({ content: "text" })).to.deep.equal(computeDimensions({ content: "text" }));
789
- expect(computeDimensions({ content: "text" })).not.to.deep.equal(computeDimensions({ content: "texttexttext" }));
790
- expect(computeDimensions({ content: "text" })).not.to.deep.equal(computeDimensions({ content: "TEXT" }));
791
- });
792
- it("computes different ranges for different fonts", () => {
793
- // These two are embedded in the iModel.
794
- expect(computeDimensions({ font: "Vera" })).not.to.deep.equal(computeDimensions({ font: "Karla" }));
795
- // These two are not embedded in the iModel, but do exist in its font table - they should both fall back to the default font.
796
- expect(computeDimensions({ font: "Arial" })).to.deep.equal(computeDimensions({ font: "Comic Sans" }));
797
- });
798
- it("computes different ranges for different height and width", () => {
799
- expect(computeDimensions({ height: 2 })).to.deep.equal(computeDimensions({ height: 2 }));
800
- expect(computeDimensions({ height: 2 })).not.to.deep.equal(computeDimensions({ height: 3 }));
801
- expect(computeDimensions({ width: 2 })).to.deep.equal(computeDimensions({ width: 2 }));
802
- expect(computeDimensions({ width: 2 })).not.to.deep.equal(computeDimensions({ width: 3 }));
803
- });
804
- it("excludes trailing blank glyphs from justification ranges", () => {
805
- function computeRanges(chars) {
806
- return iModel.computeRangesForText({
807
- chars,
808
- bold: false,
809
- italic: false,
810
- fontId: 1,
811
- widthFactor: 1,
812
- lineHeight: 1,
813
- baselineShift: "none",
814
- });
815
- }
816
- function test(chars, expectEqualRanges) {
817
- const { justification, layout } = computeRanges(chars);
818
- expect(layout.low.x).to.equal(justification.low.x);
819
- expect(layout.high.y).to.equal(justification.high.y);
820
- expect(layout.low.y).to.equal(justification.low.y);
821
- if (expectEqualRanges) {
822
- expect(layout.high.x).to.equal(justification.high.x);
823
- }
824
- else {
825
- expect(layout.high.x).greaterThan(justification.high.x);
826
- }
827
- }
828
- test("abcdef", true);
829
- test("abcdef ", false);
830
- test("abcdef ", false);
831
- test("abc def", true);
832
- // new line has no width ever.
833
- test("abcdef\n", true);
834
- // apparently native code doesn't consider tab characters to be "blank".
835
- test("abcdef\t", true);
836
- // apparently native code doesn't consider "thin space" to be "blank".
837
- test("abcdef\u2009", true);
838
- const r1 = computeRanges("abcdef ");
839
- const r2 = computeRanges("abcdef ");
840
- expect(r1.layout.xLength()).lessThan(r2.layout.xLength());
841
- expect(r1.justification.xLength()).to.equal(r2.justification.xLength());
842
- });
843
- });
844
- });
11
+ import { Subject } from "../../Element";
12
+ import { Guid, Id64 } from "@itwin/core-bentley";
13
+ import { DefinitionModel } from "../../Model";
14
+ import { DrawingCategory, SpatialCategory } from "../../Category";
15
+ import { DisplayStyle2d, DisplayStyle3d } from "../../DisplayStyle";
16
+ import { CategorySelector, DrawingViewDefinition, ModelSelector, SpatialViewDefinition } from "../../ViewDefinition";
17
+ import { FontFile } from "../../FontFile";
18
+ import { computeTextRangeAsStringLength } from "../AnnotationTestUtils";
845
19
  function mockIModel() {
846
20
  const iModel = {
847
21
  fonts: {
848
22
  findId: () => 0,
849
23
  },
850
- computeRangesForText: () => { return { layout: new Range2d(0, 0, 1, 1), justification: new Range2d(0, 0, 1, 1) }; },
24
+ computeRangesForText: computeTextRangeAsStringLength,
851
25
  forEachMetaData: () => undefined,
852
26
  };
853
27
  return iModel;
854
28
  }
855
- describe("produceTextAnnotationGeometry", () => {
856
- function makeText(color) {
857
- const styleOverrides = undefined !== color ? { color: color instanceof ColorDef ? color.toJSON() : color } : undefined;
858
- return TextRun.create({ styleName: "", styleOverrides, content: "text" });
859
- }
860
- function makeFraction(color) {
861
- const styleOverrides = undefined !== color ? { color: color instanceof ColorDef ? color.toJSON() : color } : undefined;
862
- return FractionRun.create({ numerator: "num", denominator: "denom", styleName: "", styleOverrides });
863
- }
864
- function makeBreak(color) {
865
- const styleOverrides = undefined !== color ? { color: color instanceof ColorDef ? color.toJSON() : color } : undefined;
866
- return LineBreakRun.create({ styleName: "", styleOverrides });
867
- }
868
- function makeTextBlock(runs) {
869
- const block = TextBlock.create({ styleName: "" });
870
- for (const run of runs) {
871
- block.appendRun(run);
872
- }
873
- return block;
874
- }
875
- function makeGeometry(runs) {
876
- const block = makeTextBlock(runs);
877
- const annotation = TextAnnotation.fromJSON({ textBlock: block.toJSON() });
878
- return produceTextAnnotationGeometry({ iModel: mockIModel(), annotation }).entries;
879
- }
880
- it("produces an empty array for an empty text block", () => {
881
- expect(makeGeometry([])).to.deep.equal([]);
882
- });
883
- it("produces an empty array for a block consisting only of line breaks", () => {
884
- expect(makeGeometry([makeBreak(), makeBreak(), makeBreak()])).to.deep.equal([]);
885
- });
886
- it("produces one appearance entry if all runs use subcategory color", () => {
887
- const geom = makeGeometry([makeText(), makeFraction(), makeText("subcategory"), makeFraction("subcategory")]);
888
- expect(geom.length).to.equal(9);
889
- expect(geom[0].color).to.equal("subcategory");
890
- expect(geom.slice(1).some((entry) => entry.color !== undefined)).to.be.false;
891
- });
892
- it("produces strings and fraction separators", () => {
893
- const geom = makeGeometry([makeText(), makeFraction(), makeFraction(), makeText()]);
894
- expect(geom.length).to.equal(9);
895
- expect(geom[0].color).to.equal("subcategory");
896
- expect(geom[1].text).not.to.be.undefined;
897
- expect(geom[2].text).not.to.be.undefined;
898
- expect(geom[3].separator).not.to.be.undefined;
899
- expect(geom[4].text).not.to.be.undefined;
900
- expect(geom[5].text).not.to.be.undefined;
901
- expect(geom[6].separator).not.to.be.undefined;
902
- expect(geom[7].text).not.to.be.undefined;
903
- expect(geom[8].text).not.to.be.undefined;
904
- });
905
- it("produces an appearance change for each non-break run that is a different color from the previous run", () => {
906
- const geom = makeGeometry([
907
- makeText(ColorDef.blue),
908
- makeText(), // subcategory by default
909
- makeText(),
910
- makeText(ColorDef.red),
911
- makeText(ColorDef.white),
912
- makeText(ColorDef.white),
913
- makeBreak("subcategory"),
914
- makeFraction(ColorDef.green),
915
- makeText(ColorDef.green),
916
- makeBreak(ColorDef.black),
917
- makeText(ColorDef.green),
918
- ]).map((entry) => entry.text ? "text" : (entry.separator ? "sep" : (typeof entry.color === "number" ? ColorDef.fromJSON(entry.color) : entry.color)));
919
- expect(geom).to.deep.equal([
920
- ColorDef.blue,
921
- "text",
922
- "subcategory",
923
- "text",
924
- "text",
925
- ColorDef.red,
926
- "text",
927
- ColorDef.white,
928
- "text",
929
- "text",
930
- ColorDef.green,
931
- "text", "sep", "text",
932
- "text",
933
- "text",
934
- ]);
29
+ function createAnnotation(styleId) {
30
+ const styleOverrides = { fontName: "Karla" };
31
+ const block = TextBlock.create({ styleId: styleId ?? "0x42", styleOverrides });
32
+ block.appendRun(TextRun.create({ content: "Run, Barry,", styleOverrides }));
33
+ block.appendRun(TextRun.create({ content: " RUN!!! ", styleOverrides }));
34
+ block.appendRun(FractionRun.create({ numerator: "Harrison", denominator: "Wells", styleOverrides }));
35
+ block.margins = { left: 0, right: 1, top: 2, bottom: 3 };
36
+ const annotation = TextAnnotation.fromJSON({ textBlock: block.toJSON() });
37
+ annotation.anchor = { vertical: "middle", horizontal: "right" };
38
+ annotation.orientation = YawPitchRollAngles.createDegrees(1, 0, -1);
39
+ annotation.offset = Point3d.create(10, -5, 0);
40
+ annotation.leaders = [{ startPoint: Point3d.createZero(), attachment: { mode: "Nearest" } }];
41
+ return annotation;
42
+ }
43
+ const createJobSubjectElement = (iModel, name) => {
44
+ const subj = Subject.create(iModel, iModel.elements.getRootSubject().id, name);
45
+ subj.setJsonProperty("Subject", { Job: name }); // eslint-disable-line @typescript-eslint/naming-convention
46
+ return subj;
47
+ };
48
+ const insertDrawingModel = (standaloneModel, parentId, definitionModel) => {
49
+ const category = DrawingCategory.insert(standaloneModel, definitionModel, "DrawingCategory", new SubCategoryAppearance());
50
+ const [_, model] = IModelTestUtils.createAndInsertDrawingPartitionAndModel(standaloneModel, { spec: '0x1', scope: '0x1', value: 'Drawing' }, undefined, parentId);
51
+ const displayStyle = DisplayStyle2d.insert(standaloneModel, definitionModel, "DisplayStyle2d");
52
+ const categorySelector = CategorySelector.insert(standaloneModel, definitionModel, "DrawingCategories", [category]);
53
+ const viewRange = new Range2d(0, 0, 500, 500);
54
+ DrawingViewDefinition.insert(standaloneModel, definitionModel, "Drawing View", model, categorySelector, displayStyle, viewRange);
55
+ return { category, model };
56
+ };
57
+ const insertSpatialModel = (standaloneModel, parentId, definitionModel) => {
58
+ const category = SpatialCategory.insert(standaloneModel, definitionModel, "spatialCategory", new SubCategoryAppearance());
59
+ const [_, model] = IModelTestUtils.createAndInsertPhysicalPartitionAndModel(standaloneModel, { spec: '0x1', scope: '0x1', value: 'Spatial' }, undefined, parentId);
60
+ const modelSelector = ModelSelector.insert(standaloneModel, definitionModel, "SpatialModelSelector", [model]);
61
+ const displayStyle = DisplayStyle3d.insert(standaloneModel, definitionModel, "DisplayStyle3d");
62
+ const categorySelector = CategorySelector.insert(standaloneModel, definitionModel, "spatialCategories", [category]);
63
+ const viewRange = new Range3d(0, 0, 0, 500, 500, 500);
64
+ SpatialViewDefinition.insertWithCamera(standaloneModel, definitionModel, "spatial View", modelSelector, categorySelector, displayStyle, viewRange);
65
+ return { category, model };
66
+ };
67
+ const createIModel = async (name) => {
68
+ const filePath = IModelTestUtils.prepareOutputFile("annotationTests", `${name}.bim`);
69
+ const iModel = StandaloneDb.createEmpty(filePath, {
70
+ rootSubject: { name: `${name} tests`, description: `${name} tests` },
71
+ client: "integration tests",
72
+ globalOrigin: { x: 0, y: 0 },
73
+ projectExtents: { low: { x: -500, y: -500, z: -50 }, high: { x: 500, y: 500, z: 50 } },
74
+ guid: Guid.createValue(),
935
75
  });
936
- it("offsets geometry entries by margins", () => {
937
- function makeGeometryWithMargins(anchor, margins) {
938
- const runs = [makeText()];
939
- const block = makeTextBlock(runs);
940
- block.margins = margins;
941
- const annotation = TextAnnotation.fromJSON({ textBlock: block.toJSON() });
942
- annotation.anchor = anchor;
943
- const geom = produceTextAnnotationGeometry({ iModel: mockIModel(), annotation }).entries;
944
- return geom[1].text;
945
- }
946
- function testMargins(margins, height, width) {
947
- // We want to disregard negative margins. Note, I'm not changing the margins object itself. It gets passed into makeGeometryWithMargins as it is.
948
- const left = margins.left >= 0 ? margins.left : 0;
949
- const right = margins.right >= 0 ? margins.right : 0;
950
- const top = margins.top >= 0 ? margins.top : 0;
951
- const bottom = margins.bottom >= 0 ? margins.bottom : 0;
952
- // Test case: bottom, left
953
- let props = makeGeometryWithMargins({ horizontal: "left", vertical: "bottom" }, margins);
954
- expect(props).not.to.be.undefined;
955
- expect(props?.origin, "Expected geometry to be offset by left and bottom margins").to.deep.equal({ x: left, y: bottom, z: 0 });
956
- // Test case: top, right
957
- props = makeGeometryWithMargins({ vertical: "top", horizontal: "right" }, margins);
958
- let x = (right + width) * -1;
959
- let y = (top + height) * -1;
960
- expect(props).not.to.be.undefined;
961
- expect(props?.origin, "Expected geometry to be offset by top and right margins").to.deep.equal({ x, y, z: 0 });
962
- // Test case: middle, center
963
- props = makeGeometryWithMargins({ vertical: "middle", horizontal: "center" }, margins);
964
- x = (left - right - width) / 2;
965
- y = (bottom - top - height) / 2;
966
- expect(props).not.to.be.undefined;
967
- expect(props?.origin, "Expected geometry to be centered in the margins").to.deep.equal({ x, y, z: 0 });
968
- }
969
- // Getting the range from the same mock the native code uses to compute the range of a text block.
970
- const textRange = mockIModel().computeRangesForText({
971
- chars: "text",
972
- bold: false,
973
- italic: false,
974
- fontId: 1,
975
- widthFactor: 1,
976
- lineHeight: 1,
977
- baselineShift: "none",
978
- });
979
- const xLength = textRange.layout.xLength(); // Will be 1 because of the mock implementation.
980
- const yLength = textRange.layout.yLength(); // Will be 1 because of the mock implementation.
981
- testMargins({ top: 0, right: 0, bottom: 0, left: 0 }, yLength, xLength);
982
- testMargins({ top: 1, right: 2, bottom: 3, left: 4 }, yLength, xLength);
983
- testMargins({ top: -1, right: -2, bottom: -3, left: -4 }, yLength, xLength);
76
+ await iModel.fonts.embedFontFile({
77
+ file: FontFile.createFromTrueTypeFileName(IModelTestUtils.resolveFontFile("Karla-Regular.ttf"))
984
78
  });
985
- });
79
+ return iModel;
80
+ };
81
+ const createAnnotationTextStyle = (iModel, definitionModel, name, settings = TextStyleSettings.defaultProps) => {
82
+ return AnnotationTextStyle.create(iModel, definitionModel, name, settings, "description");
83
+ };
986
84
  describe("TextAnnotation element", () => {
987
85
  function makeElement(props) {
988
86
  return TextAnnotation2d.fromJSON({
@@ -993,33 +91,29 @@ describe("TextAnnotation element", () => {
993
91
  scope: "0x78",
994
92
  },
995
93
  classFullName: TextAnnotation2d.classFullName,
94
+ placement: {
95
+ origin: { x: 0, y: 0 },
96
+ angle: 0,
97
+ },
996
98
  ...props,
997
99
  }, mockIModel());
998
100
  }
999
101
  describe("getAnnotation", () => {
1000
- it("returns undefined if not present in JSON properties", () => {
102
+ it("returns undefined if not provided", () => {
1001
103
  expect(makeElement().getAnnotation()).to.be.undefined;
1002
104
  });
1003
- it("extracts from JSON properties", () => {
105
+ it("converts JSON string to class instance", () => {
1004
106
  const elem = makeElement({
1005
- jsonProperties: {
1006
- annotation: {
1007
- textBlock: TextBlock.create({ styleName: "block" }).toJSON(),
1008
- },
1009
- },
107
+ textAnnotationData: JSON.stringify({ textBlock: TextBlock.create({ styleId: "0x42" }).toJSON() })
1010
108
  });
1011
109
  const anno = elem.getAnnotation();
1012
110
  expect(anno).not.to.be.undefined;
1013
111
  expect(anno.textBlock.isEmpty).to.be.true;
1014
- expect(anno.textBlock.styleName).to.equal("block");
112
+ expect(anno.textBlock.styleId).to.equal("0x42");
1015
113
  });
1016
114
  it("produces a new object each time it is called", () => {
1017
115
  const elem = makeElement({
1018
- jsonProperties: {
1019
- annotation: {
1020
- textBlock: TextBlock.create({ styleName: "block" }).toJSON(),
1021
- },
1022
- },
116
+ textAnnotationData: JSON.stringify({ textBlock: TextBlock.create({ styleId: "0x42" }).toJSON() })
1023
117
  });
1024
118
  const anno1 = elem.getAnnotation();
1025
119
  const anno2 = elem.getAnnotation();
@@ -1028,74 +122,49 @@ describe("TextAnnotation element", () => {
1028
122
  });
1029
123
  });
1030
124
  describe("setAnnotation", () => {
1031
- it("updates JSON properties and recomputes geometry stream", () => {
125
+ it("updates properties", () => {
1032
126
  const elem = makeElement();
1033
- expect(elem.geom).to.be.undefined;
1034
- const annotation = { textBlock: TextBlock.create({ styleName: "block" }).toJSON() };
1035
- elem.setAnnotation(TextAnnotation.fromJSON(annotation));
1036
- expect(elem.geom).not.to.be.undefined;
1037
- expect(elem.jsonProperties.annotation).to.deep.equal(annotation);
1038
- expect(elem.jsonProperties.annotation).not.to.equal(annotation);
1039
- });
1040
- it("uses default subcategory by default", () => {
1041
- const elem = makeElement();
1042
- elem.setAnnotation(TextAnnotation.fromJSON({ textBlock: { styleName: "block" } }));
1043
- expect(elem.geom.length).to.equal(1);
1044
- expect(elem.geom[0].appearance.subCategory).to.equal("0x13");
1045
- });
1046
- it("uses specific subcategory if provided", () => {
1047
- const elem = makeElement();
1048
- elem.setAnnotation(TextAnnotation.fromJSON({ textBlock: { styleName: "block" } }), "0x1234");
1049
- expect(elem.geom.length).to.equal(1);
1050
- expect(elem.geom[0].appearance.subCategory).to.equal("0x1234");
127
+ const textBlock = TextBlock.create({ styleId: "0x42" });
128
+ textBlock.appendRun(TextRun.create({ content: "text" }));
129
+ const annotation = TextAnnotation.fromJSON({ textBlock: textBlock.toJSON() });
130
+ elem.setAnnotation(annotation);
131
+ expect(elem.getAnnotation().toJSON()).to.deep.equal(annotation.toJSON());
132
+ expect(elem.getAnnotation().toJSON()).not.to.equal(annotation.toJSON());
1051
133
  });
1052
134
  });
1053
- describe("persistence", () => {
135
+ describe("TextAnnotation3d Persistence", () => {
1054
136
  let imodel;
1055
- let seed;
1056
- before(() => {
1057
- const seedFileName = IModelTestUtils.resolveAssetFile("CompatibilityTestSeed.bim");
1058
- const testFileName = IModelTestUtils.prepareOutputFile("GeometryStream", "GeometryStreamTest.bim");
1059
- imodel = IModelTestUtils.createSnapshotFromSeed(testFileName, seedFileName);
1060
- seed = imodel.elements.getElement("0x1d");
1061
- assert.exists(seed);
1062
- assert.isTrue(seed.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
137
+ let seedCategoryId;
138
+ let seedModelId;
139
+ let seedStyleId;
140
+ before(async () => {
141
+ imodel = await createIModel("TextAnnotation3d");
142
+ const jobSubjectId = createJobSubjectElement(imodel, "Job").insert();
143
+ const definitionModel = DefinitionModel.insert(imodel, jobSubjectId, "Definition");
144
+ const { category, model } = insertSpatialModel(imodel, jobSubjectId, definitionModel);
145
+ const styleId = createAnnotationTextStyle(imodel, definitionModel, "test", { fontName: "Totally Real Font", lineHeight: 0.25, isItalic: true }).insert();
146
+ expect(jobSubjectId).not.to.be.undefined;
147
+ expect(category).not.to.be.undefined;
148
+ expect(model).not.to.be.undefined;
149
+ expect(styleId).not.to.be.undefined;
150
+ seedCategoryId = category;
151
+ seedModelId = model;
152
+ seedStyleId = styleId;
1063
153
  });
1064
154
  after(() => imodel.close());
1065
- function createElement(props) {
1066
- return TextAnnotation3d.fromJSON({
1067
- category: seed.category,
1068
- model: seed.model,
1069
- code: {
1070
- spec: seed.code.spec,
1071
- scope: seed.code.scope,
1072
- },
1073
- ...props,
1074
- classFullName: TextAnnotation3d.classFullName,
1075
- }, imodel);
1076
- }
1077
- function createAnnotation() {
1078
- const block = TextBlock.createEmpty();
1079
- block.styleName = "block";
1080
- block.appendRun(makeTextRun("run", "run1"));
1081
- block.appendRun(makeTextRun("RUN!!!!!", "run2"));
1082
- return TextAnnotation.fromJSON({
1083
- textBlock: block.toJSON(),
1084
- anchor: {
1085
- vertical: "middle",
1086
- horizontal: "right",
1087
- },
1088
- orientation: { yaw: 1, pitch: 0, roll: -1 },
1089
- offset: [0, -5, 100],
1090
- });
155
+ function createElement3d(createArgs) {
156
+ return TextAnnotation3d.create(imodel, seedCategoryId, seedModelId, {
157
+ origin: { x: 0, y: 0, z: 0 },
158
+ angles: YawPitchRollAngles.createDegrees(0, 0, 0).toJSON(),
159
+ }, createArgs?.textAnnotationData);
1091
160
  }
1092
- it("create method does not automatically compute the geometry", () => {
161
+ it("creating element does not automatically compute the geometry", () => {
1093
162
  const annotation = createAnnotation();
1094
- const el = createElement({ jsonProperties: { annotation: annotation.toJSON() } });
163
+ const el = createElement3d({ textAnnotationData: annotation.toJSON() });
1095
164
  expect(el.getAnnotation().equals(annotation)).to.be.true;
1096
165
  expect(el.geom).to.be.undefined;
1097
166
  });
1098
- function expectPlacement(el, expectValidBBox, expectedOrigin = [0, 0, 0], expectedYPR = [0, 0, 0]) {
167
+ function expectPlacement3d(el, expectValidBBox, expectedOrigin = [0, 0, 0], expectedYPR = [0, 0, 0]) {
1099
168
  expect(el.placement.origin.x).to.equal(expectedOrigin[0]);
1100
169
  expect(el.placement.origin.y).to.equal(expectedOrigin[1]);
1101
170
  expect(el.placement.origin.z).to.equal(expectedOrigin[2]);
@@ -1104,32 +173,185 @@ describe("TextAnnotation element", () => {
1104
173
  expect(el.placement.angles.roll.radians).to.equal(expectedYPR[2]);
1105
174
  expect(el.placement.bbox.isNull).to.equal(!expectValidBBox);
1106
175
  }
1107
- it("inserts and round-trips through JSON", () => {
1108
- function test(annotation) {
1109
- const el0 = createElement();
176
+ describe("inserts 3d element and round-trips through JSON", async () => {
177
+ async function test(annotation) {
178
+ const el0 = createElement3d();
1110
179
  if (annotation) {
1111
180
  el0.setAnnotation(annotation);
1112
181
  }
1113
- expectPlacement(el0, false);
182
+ expectPlacement3d(el0, false);
1114
183
  const elId = el0.insert();
1115
184
  expect(Id64.isValidId64(elId)).to.be.true;
1116
185
  const el1 = imodel.elements.getElement(elId);
1117
186
  expect(el1).not.to.be.undefined;
1118
187
  expect(el1 instanceof TextAnnotation3d).to.be.true;
1119
- expectPlacement(el1, undefined !== annotation && !annotation.textBlock.isEmpty);
188
+ expectPlacement3d(el1, undefined !== annotation && !annotation.textBlock.isEmpty);
1120
189
  const anno = el1.getAnnotation();
1121
190
  if (!annotation) {
1122
191
  expect(anno).to.be.undefined;
192
+ expect(el0.toJSON().elementGeometryBuilderParams).to.be.undefined;
1123
193
  }
1124
194
  else {
1125
195
  expect(anno).not.to.be.undefined;
1126
196
  expect(anno.equals(annotation)).to.be.true;
197
+ expect(el0.toJSON().elementGeometryBuilderParams).not.to.be.undefined;
1127
198
  }
1128
199
  }
1129
- test();
1130
- test(TextAnnotation.fromJSON({ textBlock: { styleName: "block" } }));
1131
- test(createAnnotation());
200
+ it("roundtrips an empty annotation", async () => { await test(); });
201
+ it("roundtrips an annotation with a style", async () => { await test(TextAnnotation.fromJSON({ textBlock: { styleId: seedStyleId } })); });
202
+ it("roundtrips an annotation with a textBlock", async () => { await test(createAnnotation()); });
1132
203
  });
1133
204
  });
205
+ describe("TextAnnotation2d Persistence", () => {
206
+ let imodel;
207
+ let seedCategoryId;
208
+ let seedModelId;
209
+ let seedStyleId;
210
+ before(async () => {
211
+ imodel = await createIModel("TextAnnotation2d");
212
+ const jobSubjectId = createJobSubjectElement(imodel, "Job").insert();
213
+ const definitionModel = DefinitionModel.insert(imodel, jobSubjectId, "Definition");
214
+ const { category, model } = insertDrawingModel(imodel, jobSubjectId, definitionModel);
215
+ const styleId = createAnnotationTextStyle(imodel, definitionModel, "test", { fontName: "Totally Real Font", lineHeight: 0.25, isItalic: true }).insert();
216
+ expect(jobSubjectId).not.to.be.undefined;
217
+ expect(category).not.to.be.undefined;
218
+ expect(model).not.to.be.undefined;
219
+ expect(styleId).not.to.be.undefined;
220
+ seedCategoryId = category;
221
+ seedModelId = model;
222
+ seedStyleId = styleId;
223
+ });
224
+ after(() => {
225
+ imodel.saveChanges("tests");
226
+ imodel.close();
227
+ });
228
+ function createElement2d(createArgs) {
229
+ return TextAnnotation2d.create(imodel, seedCategoryId, seedModelId, {
230
+ origin: { x: 0, y: 0 },
231
+ angle: Angle.createDegrees(0).toJSON(),
232
+ }, createArgs?.textAnnotationData);
233
+ }
234
+ it("creating element does not automatically compute the geometry", () => {
235
+ const annotation = createAnnotation();
236
+ const el = createElement2d({ textAnnotationData: annotation.toJSON() });
237
+ expect(el.getAnnotation().equals(annotation)).to.be.true;
238
+ expect(el.geom).to.be.undefined;
239
+ });
240
+ function expectPlacement2d(el, expectValidBBox, expectedOrigin = [0, 0, 0], expectedYPR = [0, 0, 0]) {
241
+ expect(el.placement.origin.x).to.equal(expectedOrigin[0]);
242
+ expect(el.placement.origin.y).to.equal(expectedOrigin[1]);
243
+ expect(el.placement.angle.degrees).to.equal(expectedYPR[0]);
244
+ expect(el.placement.bbox.isNull).to.equal(!expectValidBBox);
245
+ }
246
+ describe("inserts 2d element and round-trips through JSON", async () => {
247
+ async function test(annotation) {
248
+ const el0 = createElement2d();
249
+ if (annotation) {
250
+ el0.setAnnotation(annotation);
251
+ }
252
+ expectPlacement2d(el0, false);
253
+ const elId = el0.insert();
254
+ expect(Id64.isValidId64(elId)).to.be.true;
255
+ const el1 = imodel.elements.getElement(elId);
256
+ expect(el1).not.to.be.undefined;
257
+ expect(el1 instanceof TextAnnotation2d).to.be.true;
258
+ expectPlacement2d(el1, undefined !== annotation && !annotation.textBlock.isEmpty);
259
+ const anno = el1.getAnnotation();
260
+ if (!annotation) {
261
+ expect(anno).to.be.undefined;
262
+ expect(el0.toJSON().elementGeometryBuilderParams).to.be.undefined;
263
+ }
264
+ else {
265
+ expect(anno).not.to.be.undefined;
266
+ expect(anno.equals(annotation)).to.be.true;
267
+ expect(el0.toJSON().elementGeometryBuilderParams).not.to.be.undefined;
268
+ }
269
+ }
270
+ it("roundtrips an empty annotation", async () => { await test(); });
271
+ it("roundtrips an annotation with a style", async () => { await test(TextAnnotation.fromJSON({ textBlock: { styleId: seedStyleId } })); });
272
+ it("roundtrips an annotation with a textBlock", async () => { await test(createAnnotation()); });
273
+ });
274
+ });
275
+ });
276
+ describe("AnnotationTextStyle", () => {
277
+ let imodel;
278
+ let seedSubjectId;
279
+ let seedDefinitionModel;
280
+ before(async () => {
281
+ imodel = await createIModel("AnnotationTextStyle");
282
+ const jobSubjectId = createJobSubjectElement(imodel, "Job").insert();
283
+ const definitionModel = DefinitionModel.insert(imodel, jobSubjectId, "Definition");
284
+ expect(jobSubjectId).not.to.be.undefined;
285
+ expect(definitionModel).not.to.be.undefined;
286
+ seedSubjectId = jobSubjectId;
287
+ seedDefinitionModel = definitionModel;
288
+ });
289
+ after(() => {
290
+ imodel.close();
291
+ });
292
+ it("inserts a style and round-trips through JSON", async () => {
293
+ const textStyle = TextStyleSettings.fromJSON({
294
+ fontName: "Totally Real Font",
295
+ isUnderlined: true,
296
+ lineHeight: 0.5
297
+ });
298
+ const el0 = createAnnotationTextStyle(imodel, seedDefinitionModel, "round-trip", textStyle.toJSON());
299
+ const elId = el0.insert();
300
+ expect(Id64.isValidId64(elId)).to.be.true;
301
+ const el1 = imodel.elements.getElement(elId);
302
+ expect(el1).not.to.be.undefined;
303
+ expect(el1 instanceof AnnotationTextStyle).to.be.true;
304
+ const style = el1.settings;
305
+ expect(style).not.to.be.undefined;
306
+ expect(style.toJSON()).to.deep.equal(textStyle.toJSON());
307
+ });
308
+ it("does not allow elements with invalid styles to be inserted", async () => {
309
+ // Default style should fail since it has no font
310
+ let annotationTextStyle = createAnnotationTextStyle(imodel, seedDefinitionModel, "default");
311
+ expect(() => annotationTextStyle.insert()).to.throw();
312
+ // font is required
313
+ annotationTextStyle = createAnnotationTextStyle(imodel, seedDefinitionModel, "no font", { fontName: "" });
314
+ expect(() => annotationTextStyle.insert()).to.throw();
315
+ // lineHeight should be positive
316
+ annotationTextStyle = createAnnotationTextStyle(imodel, seedDefinitionModel, "invalid lineHeight", { fontName: "Totally Real Font", lineHeight: 0 });
317
+ expect(() => annotationTextStyle.insert()).to.throw();
318
+ // stackedFractionScale should be positive
319
+ annotationTextStyle = createAnnotationTextStyle(imodel, seedDefinitionModel, "invalid stackedFractionScale", { fontName: "Totally Real Font", stackedFractionScale: 0 });
320
+ expect(() => annotationTextStyle.insert()).to.throw();
321
+ });
322
+ it("does not allow updating of elements to invalid styles", async () => {
323
+ const annotationTextStyle = createAnnotationTextStyle(imodel, seedDefinitionModel, "valid style", { fontName: "Totally Real Font" });
324
+ const elId = annotationTextStyle.insert();
325
+ expect(Id64.isValidId64(elId)).to.be.true;
326
+ const el1 = imodel.elements.getElement(elId);
327
+ expect(el1).not.to.be.undefined;
328
+ expect(el1 instanceof AnnotationTextStyle).to.be.true;
329
+ el1.settings = el1.settings.clone({ fontName: "" });
330
+ expect(() => el1.update()).to.throw();
331
+ el1.settings = el1.settings.clone({ fontName: "Totally Real Font", lineHeight: 0 });
332
+ expect(() => el1.update()).to.throw();
333
+ el1.settings = el1.settings.clone({ lineHeight: 2, stackedFractionScale: 0 });
334
+ expect(() => el1.update()).to.throw();
335
+ el1.settings = el1.settings.clone({ stackedFractionScale: 0.45 });
336
+ el1.update();
337
+ const updatedElement = imodel.elements.getElement(elId);
338
+ expect(updatedElement.settings.toJSON()).to.deep.equal(el1.settings.toJSON());
339
+ });
340
+ it("uses default style if none specified", async () => {
341
+ const el0 = AnnotationTextStyle.fromJSON({
342
+ classFullName: AnnotationTextStyle.classFullName,
343
+ model: seedSubjectId,
344
+ code: AnnotationTextStyle.createCode(imodel, seedSubjectId, "style1"),
345
+ }, imodel);
346
+ expect(el0.settings).not.to.be.undefined;
347
+ expect(el0.settings.toJSON()).to.deep.equal(TextStyleSettings.defaultProps);
348
+ });
349
+ it("can update style via cloning", async () => {
350
+ const el0 = createAnnotationTextStyle(imodel, seedDefinitionModel, "cloning", { fontName: "Totally Real Font" });
351
+ const newStyle = el0.settings.clone({ isBold: true, lineSpacingFactor: 3 });
352
+ expect(el0.settings.toJSON()).to.not.deep.equal(newStyle.toJSON());
353
+ el0.settings = newStyle;
354
+ expect(el0.settings.toJSON()).to.deep.equal(newStyle.toJSON());
355
+ });
1134
356
  });
1135
357
  //# sourceMappingURL=TextAnnotation.test.js.map