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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (473) hide show
  1. package/CHANGELOG.md +34 -1
  2. package/lib/cjs/BackendHubAccess.js.map +1 -1
  3. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  4. package/lib/cjs/BisCoreSchema.js.map +1 -1
  5. package/lib/cjs/BlobContainerService.js.map +1 -1
  6. package/lib/cjs/BriefcaseManager.d.ts +2 -2
  7. package/lib/cjs/BriefcaseManager.js.map +1 -1
  8. package/lib/cjs/CatalogDb.js.map +1 -1
  9. package/lib/cjs/Category.js.map +1 -1
  10. package/lib/cjs/ChangeSummaryManager.js +2 -2
  11. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  12. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  13. package/lib/cjs/ChangesetECAdaptor.js +248 -248
  14. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  15. package/lib/cjs/ChannelControl.js.map +1 -1
  16. package/lib/cjs/CheckpointManager.js.map +1 -1
  17. package/lib/cjs/ClassRegistry.js +5 -5
  18. package/lib/cjs/ClassRegistry.js.map +1 -1
  19. package/lib/cjs/CloudSqlite.d.ts +12 -9
  20. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  21. package/lib/cjs/CloudSqlite.js.map +1 -1
  22. package/lib/cjs/CodeService.js.map +1 -1
  23. package/lib/cjs/CodeSpecs.js.map +1 -1
  24. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  25. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  26. package/lib/cjs/DevTools.js.map +1 -1
  27. package/lib/cjs/DisplayStyle.d.ts +2 -2
  28. package/lib/cjs/DisplayStyle.d.ts.map +1 -1
  29. package/lib/cjs/DisplayStyle.js +4 -4
  30. package/lib/cjs/DisplayStyle.js.map +1 -1
  31. package/lib/cjs/ECDb.js +1 -1
  32. package/lib/cjs/ECDb.js.map +1 -1
  33. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  34. package/lib/cjs/ECSqlStatement.js.map +1 -1
  35. package/lib/cjs/Element.d.ts +2 -2
  36. package/lib/cjs/Element.d.ts.map +1 -1
  37. package/lib/cjs/Element.js +2 -2
  38. package/lib/cjs/Element.js.map +1 -1
  39. package/lib/cjs/ElementAspect.js.map +1 -1
  40. package/lib/cjs/ElementGraphics.js.map +1 -1
  41. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  42. package/lib/cjs/Entity.js.map +1 -1
  43. package/lib/cjs/EntityReferences.js.map +1 -1
  44. package/lib/cjs/ExportGraphics.js.map +1 -1
  45. package/lib/cjs/ExternalSource.js.map +1 -1
  46. package/lib/cjs/FontFile.js.map +1 -1
  47. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  48. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  49. package/lib/cjs/GeometrySummary.js +47 -47
  50. package/lib/cjs/GeometrySummary.js.map +1 -1
  51. package/lib/cjs/IModelDb.d.ts.map +1 -1
  52. package/lib/cjs/IModelDb.js +20 -9
  53. package/lib/cjs/IModelDb.js.map +1 -1
  54. package/lib/cjs/IModelDbFonts.js.map +1 -1
  55. package/lib/cjs/IModelElementCloneContext.d.ts +1 -1
  56. package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -1
  57. package/lib/cjs/IModelElementCloneContext.js +2 -2
  58. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  59. package/lib/cjs/IModelHost.d.ts +1 -2
  60. package/lib/cjs/IModelHost.d.ts.map +1 -1
  61. package/lib/cjs/IModelHost.js +9 -17
  62. package/lib/cjs/IModelHost.js.map +1 -1
  63. package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -1
  64. package/lib/cjs/IModelJsFs.js.map +1 -1
  65. package/lib/cjs/ImageSourceConversion.js.map +1 -1
  66. package/lib/cjs/IpcHost.js.map +1 -1
  67. package/lib/cjs/LineStyle.js.map +1 -1
  68. package/lib/cjs/LocalHub.js +1 -1
  69. package/lib/cjs/LocalHub.js.map +1 -1
  70. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  71. package/lib/cjs/LockControl.js.map +1 -1
  72. package/lib/cjs/Material.d.ts +1 -1
  73. package/lib/cjs/Material.d.ts.map +1 -1
  74. package/lib/cjs/Material.js +2 -2
  75. package/lib/cjs/Material.js.map +1 -1
  76. package/lib/cjs/Model.js.map +1 -1
  77. package/lib/cjs/NativeAppStorage.js.map +1 -1
  78. package/lib/cjs/NativeHost.js.map +1 -1
  79. package/lib/cjs/NavigationRelationship.js.map +1 -1
  80. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  81. package/lib/cjs/PropertyStore.js.map +1 -1
  82. package/lib/cjs/Relationship.js.map +1 -1
  83. package/lib/cjs/RpcBackend.js.map +1 -1
  84. package/lib/cjs/SQLiteDb.js.map +1 -1
  85. package/lib/cjs/Schema.js.map +1 -1
  86. package/lib/cjs/SchemaSync.js.map +1 -1
  87. package/lib/cjs/SchemaUtils.js.map +1 -1
  88. package/lib/cjs/SheetIndex.js.map +1 -1
  89. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  90. package/lib/cjs/SqliteStatement.js.map +1 -1
  91. package/lib/cjs/StashManager.js.map +1 -1
  92. package/lib/cjs/Texture.js.map +1 -1
  93. package/lib/cjs/TileStorage.d.ts +1 -1
  94. package/lib/cjs/TileStorage.d.ts.map +1 -1
  95. package/lib/cjs/TileStorage.js.map +1 -1
  96. package/lib/cjs/TxnManager.d.ts +2 -0
  97. package/lib/cjs/TxnManager.d.ts.map +1 -1
  98. package/lib/cjs/TxnManager.js +10 -2
  99. package/lib/cjs/TxnManager.js.map +1 -1
  100. package/lib/cjs/ViewDefinition.d.ts +1 -1
  101. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  102. package/lib/cjs/ViewDefinition.js +2 -2
  103. package/lib/cjs/ViewDefinition.js.map +1 -1
  104. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  105. package/lib/cjs/ViewStore.js.map +1 -1
  106. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +7 -1
  107. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  108. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +25 -0
  109. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  110. package/lib/cjs/annotations/FrameGeometry.js +6 -6
  111. package/lib/cjs/annotations/FrameGeometry.js.map +1 -1
  112. package/lib/cjs/annotations/LeaderGeometry.js +4 -4
  113. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
  114. package/lib/cjs/annotations/TextAnnotationElement.d.ts +122 -21
  115. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
  116. package/lib/cjs/annotations/TextAnnotationElement.js +298 -63
  117. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  118. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
  119. package/lib/cjs/annotations/TextBlockGeometry.js +3 -3
  120. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -1
  121. package/lib/cjs/annotations/TextBlockLayout.d.ts +2 -2
  122. package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -1
  123. package/lib/cjs/annotations/TextBlockLayout.js +52 -25
  124. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -1
  125. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  126. package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +32 -32
  127. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -27
  128. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
  129. package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
  130. package/lib/cjs/core-backend.js.map +1 -1
  131. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  132. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  133. package/lib/cjs/domains/GenericElements.js.map +1 -1
  134. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  135. package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
  136. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  137. package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
  138. package/lib/cjs/internal/FontFileImpl.js.map +1 -1
  139. package/lib/cjs/internal/HubMock.js.map +1 -1
  140. package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -1
  141. package/lib/cjs/internal/NativePlatform.js.map +1 -1
  142. package/lib/cjs/internal/NoLocks.js.map +1 -1
  143. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  144. package/lib/cjs/internal/Symbols.js.map +1 -1
  145. package/lib/cjs/internal/annotations/fields.d.ts.map +1 -1
  146. package/lib/cjs/internal/annotations/fields.js +1 -0
  147. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  148. package/lib/cjs/internal/cross-package.js.map +1 -1
  149. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  150. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  151. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  152. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  153. package/lib/cjs/rpc/multipart.js.map +1 -1
  154. package/lib/cjs/rpc/tracing.js.map +1 -1
  155. package/lib/cjs/rpc/web/logging.js.map +1 -1
  156. package/lib/cjs/rpc/web/request.js.map +1 -1
  157. package/lib/cjs/rpc/web/response.js.map +1 -1
  158. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  159. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  160. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  161. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  162. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  163. package/lib/cjs/workspace/Settings.js.map +1 -1
  164. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  165. package/lib/cjs/workspace/Workspace.js.map +1 -1
  166. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
  167. package/lib/esm/BackendHubAccess.js.map +1 -1
  168. package/lib/esm/BackendLoggerCategory.js.map +1 -1
  169. package/lib/esm/BisCoreSchema.js.map +1 -1
  170. package/lib/esm/BlobContainerService.js.map +1 -1
  171. package/lib/esm/BriefcaseManager.d.ts +2 -2
  172. package/lib/esm/BriefcaseManager.js.map +1 -1
  173. package/lib/esm/CatalogDb.js.map +1 -1
  174. package/lib/esm/Category.js.map +1 -1
  175. package/lib/esm/ChangeSummaryManager.js +2 -2
  176. package/lib/esm/ChangeSummaryManager.js.map +1 -1
  177. package/lib/esm/ChangedElementsDb.js.map +1 -1
  178. package/lib/esm/ChangesetECAdaptor.js +248 -248
  179. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  180. package/lib/esm/ChannelControl.js.map +1 -1
  181. package/lib/esm/CheckpointManager.js.map +1 -1
  182. package/lib/esm/ClassRegistry.js +5 -5
  183. package/lib/esm/ClassRegistry.js.map +1 -1
  184. package/lib/esm/CloudSqlite.d.ts +12 -9
  185. package/lib/esm/CloudSqlite.d.ts.map +1 -1
  186. package/lib/esm/CloudSqlite.js.map +1 -1
  187. package/lib/esm/CodeService.js.map +1 -1
  188. package/lib/esm/CodeSpecs.js.map +1 -1
  189. package/lib/esm/ConcurrentQuery.js.map +1 -1
  190. package/lib/esm/CustomViewState3dCreator.js.map +1 -1
  191. package/lib/esm/DevTools.js.map +1 -1
  192. package/lib/esm/DisplayStyle.d.ts +2 -2
  193. package/lib/esm/DisplayStyle.d.ts.map +1 -1
  194. package/lib/esm/DisplayStyle.js +4 -4
  195. package/lib/esm/DisplayStyle.js.map +1 -1
  196. package/lib/esm/ECDb.js +1 -1
  197. package/lib/esm/ECDb.js.map +1 -1
  198. package/lib/esm/ECSchemaXmlContext.js.map +1 -1
  199. package/lib/esm/ECSqlStatement.js.map +1 -1
  200. package/lib/esm/Element.d.ts +2 -2
  201. package/lib/esm/Element.d.ts.map +1 -1
  202. package/lib/esm/Element.js +2 -2
  203. package/lib/esm/Element.js.map +1 -1
  204. package/lib/esm/ElementAspect.js.map +1 -1
  205. package/lib/esm/ElementGraphics.js.map +1 -1
  206. package/lib/esm/ElementTreeWalker.js.map +1 -1
  207. package/lib/esm/Entity.js.map +1 -1
  208. package/lib/esm/EntityReferences.js.map +1 -1
  209. package/lib/esm/ExportGraphics.js.map +1 -1
  210. package/lib/esm/ExternalSource.js.map +1 -1
  211. package/lib/esm/FontFile.js.map +1 -1
  212. package/lib/esm/GeoCoordConfig.js.map +1 -1
  213. package/lib/esm/GeographicCRSServices.js.map +1 -1
  214. package/lib/esm/GeometrySummary.js +47 -47
  215. package/lib/esm/GeometrySummary.js.map +1 -1
  216. package/lib/esm/IModelDb.d.ts.map +1 -1
  217. package/lib/esm/IModelDb.js +20 -9
  218. package/lib/esm/IModelDb.js.map +1 -1
  219. package/lib/esm/IModelDbFonts.js.map +1 -1
  220. package/lib/esm/IModelElementCloneContext.d.ts +1 -1
  221. package/lib/esm/IModelElementCloneContext.d.ts.map +1 -1
  222. package/lib/esm/IModelElementCloneContext.js +2 -2
  223. package/lib/esm/IModelElementCloneContext.js.map +1 -1
  224. package/lib/esm/IModelHost.d.ts +1 -2
  225. package/lib/esm/IModelHost.d.ts.map +1 -1
  226. package/lib/esm/IModelHost.js +10 -18
  227. package/lib/esm/IModelHost.js.map +1 -1
  228. package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -1
  229. package/lib/esm/IModelJsFs.js.map +1 -1
  230. package/lib/esm/ImageSourceConversion.js.map +1 -1
  231. package/lib/esm/IpcHost.js.map +1 -1
  232. package/lib/esm/LineStyle.js.map +1 -1
  233. package/lib/esm/LocalHub.js +1 -1
  234. package/lib/esm/LocalHub.js.map +1 -1
  235. package/lib/esm/LocalhostIpcHost.js.map +1 -1
  236. package/lib/esm/LockControl.js.map +1 -1
  237. package/lib/esm/Material.d.ts +1 -1
  238. package/lib/esm/Material.d.ts.map +1 -1
  239. package/lib/esm/Material.js +2 -2
  240. package/lib/esm/Material.js.map +1 -1
  241. package/lib/esm/Model.js.map +1 -1
  242. package/lib/esm/NativeAppStorage.js.map +1 -1
  243. package/lib/esm/NativeHost.js.map +1 -1
  244. package/lib/esm/NavigationRelationship.js.map +1 -1
  245. package/lib/esm/PromiseMemoizer.js.map +1 -1
  246. package/lib/esm/PropertyStore.js.map +1 -1
  247. package/lib/esm/Relationship.js.map +1 -1
  248. package/lib/esm/RpcBackend.js.map +1 -1
  249. package/lib/esm/SQLiteDb.js.map +1 -1
  250. package/lib/esm/Schema.js.map +1 -1
  251. package/lib/esm/SchemaSync.js.map +1 -1
  252. package/lib/esm/SchemaUtils.js.map +1 -1
  253. package/lib/esm/SheetIndex.js.map +1 -1
  254. package/lib/esm/SqliteChangesetReader.js.map +1 -1
  255. package/lib/esm/SqliteStatement.js.map +1 -1
  256. package/lib/esm/StashManager.js.map +1 -1
  257. package/lib/esm/Texture.js.map +1 -1
  258. package/lib/esm/TileStorage.d.ts +1 -1
  259. package/lib/esm/TileStorage.d.ts.map +1 -1
  260. package/lib/esm/TileStorage.js.map +1 -1
  261. package/lib/esm/TxnManager.d.ts +2 -0
  262. package/lib/esm/TxnManager.d.ts.map +1 -1
  263. package/lib/esm/TxnManager.js +10 -2
  264. package/lib/esm/TxnManager.js.map +1 -1
  265. package/lib/esm/ViewDefinition.d.ts +1 -1
  266. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  267. package/lib/esm/ViewDefinition.js +2 -2
  268. package/lib/esm/ViewDefinition.js.map +1 -1
  269. package/lib/esm/ViewStateHydrator.js.map +1 -1
  270. package/lib/esm/ViewStore.js.map +1 -1
  271. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +7 -1
  272. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  273. package/lib/esm/annotations/ElementDrivesTextAnnotation.js +25 -0
  274. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  275. package/lib/esm/annotations/FrameGeometry.js +6 -6
  276. package/lib/esm/annotations/FrameGeometry.js.map +1 -1
  277. package/lib/esm/annotations/LeaderGeometry.js +4 -4
  278. package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
  279. package/lib/esm/annotations/TextAnnotationElement.d.ts +122 -21
  280. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
  281. package/lib/esm/annotations/TextAnnotationElement.js +298 -64
  282. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  283. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
  284. package/lib/esm/annotations/TextBlockGeometry.js +3 -3
  285. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -1
  286. package/lib/esm/annotations/TextBlockLayout.d.ts +2 -2
  287. package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -1
  288. package/lib/esm/annotations/TextBlockLayout.js +52 -25
  289. package/lib/esm/annotations/TextBlockLayout.js.map +1 -1
  290. package/lib/esm/core-backend.js.map +1 -1
  291. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  292. package/lib/esm/domains/FunctionalSchema.js.map +1 -1
  293. package/lib/esm/domains/GenericElements.js.map +1 -1
  294. package/lib/esm/domains/GenericSchema.js.map +1 -1
  295. package/lib/esm/internal/ChangesetConflictArgs.js.map +1 -1
  296. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  297. package/lib/esm/internal/ElementLRUCache.js.map +1 -1
  298. package/lib/esm/internal/FontFileImpl.js.map +1 -1
  299. package/lib/esm/internal/HubMock.js.map +1 -1
  300. package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -1
  301. package/lib/esm/internal/NativePlatform.js.map +1 -1
  302. package/lib/esm/internal/NoLocks.js.map +1 -1
  303. package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
  304. package/lib/esm/internal/Symbols.js.map +1 -1
  305. package/lib/esm/internal/annotations/fields.d.ts.map +1 -1
  306. package/lib/esm/internal/annotations/fields.js +1 -0
  307. package/lib/esm/internal/annotations/fields.js.map +1 -1
  308. package/lib/esm/internal/cross-package.js.map +1 -1
  309. package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
  310. package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  311. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  312. package/lib/esm/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  313. package/lib/esm/rpc/multipart.js.map +1 -1
  314. package/lib/esm/rpc/tracing.js.map +1 -1
  315. package/lib/esm/rpc/web/logging.js.map +1 -1
  316. package/lib/esm/rpc/web/request.js.map +1 -1
  317. package/lib/esm/rpc/web/response.js.map +1 -1
  318. package/lib/esm/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  319. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  320. package/lib/esm/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  321. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  322. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  323. package/lib/esm/test/AdvancedEqual.js.map +1 -1
  324. package/lib/esm/test/AnnotationTestUtils.js +1 -1
  325. package/lib/esm/test/AnnotationTestUtils.js.map +1 -1
  326. package/lib/esm/test/AttachDb.test.js +11 -11
  327. package/lib/esm/test/AttachDb.test.js.map +1 -1
  328. package/lib/esm/test/ElementDrivesElement.test.d.ts +93 -0
  329. package/lib/esm/test/ElementDrivesElement.test.d.ts.map +1 -0
  330. package/lib/esm/test/ElementDrivesElement.test.js +862 -0
  331. package/lib/esm/test/ElementDrivesElement.test.js.map +1 -0
  332. package/lib/esm/test/ElementLRUCache.test.js +13 -0
  333. package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
  334. package/lib/esm/test/GeometryTestUtil.js.map +1 -1
  335. package/lib/esm/test/IModelHost.test.js +17 -11
  336. package/lib/esm/test/IModelHost.test.js.map +1 -1
  337. package/lib/esm/test/IModelTestUtils.js.map +1 -1
  338. package/lib/esm/test/ImageSourceConversion.test.js.map +1 -1
  339. package/lib/esm/test/IpcHost.test.js.map +1 -1
  340. package/lib/esm/test/KnownTestLocations.js.map +1 -1
  341. package/lib/esm/test/PrintElementTree.js.map +1 -1
  342. package/lib/esm/test/PropertyDb.test.js.map +1 -1
  343. package/lib/esm/test/RevisionUtility.js.map +1 -1
  344. package/lib/esm/test/SchemaUtils.test.js +25 -25
  345. package/lib/esm/test/SchemaUtils.test.js.map +1 -1
  346. package/lib/esm/test/SequentialLogMatcher.js.map +1 -1
  347. package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
  348. package/lib/esm/test/TestUtils.js.map +1 -1
  349. package/lib/esm/test/annotations/Fields.test.js +229 -90
  350. package/lib/esm/test/annotations/Fields.test.js.map +1 -1
  351. package/lib/esm/test/annotations/FrameGeometry.test.js +4 -4
  352. package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -1
  353. package/lib/esm/test/annotations/LeaderGeometry.test.js +8 -8
  354. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
  355. package/lib/esm/test/annotations/TextAnnotation.test.js +402 -36
  356. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  357. package/lib/esm/test/annotations/TextBlock.test.js +218 -151
  358. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
  359. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js.map +1 -1
  360. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
  361. package/lib/esm/test/categories/Category.test.js.map +1 -1
  362. package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
  363. package/lib/esm/test/ecdb/CTE.test.js +88 -88
  364. package/lib/esm/test/ecdb/CTE.test.js.map +1 -1
  365. package/lib/esm/test/ecdb/ConcurrentQuery.test.js +17 -17
  366. package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -1
  367. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +15 -15
  368. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
  369. package/lib/esm/test/ecdb/ECDb.test.js +72 -72
  370. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  371. package/lib/esm/test/ecdb/ECDbTestHelper.js.map +1 -1
  372. package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -1
  373. package/lib/esm/test/ecdb/ECSqlAst.test.js +65 -65
  374. package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
  375. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  376. package/lib/esm/test/ecdb/ECSqlReader.test.js +16 -16
  377. package/lib/esm/test/ecdb/ECSqlReader.test.js.map +1 -1
  378. package/lib/esm/test/ecdb/ECSqlStatement.test.js +359 -328
  379. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  380. package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
  381. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
  382. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +21 -21
  383. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
  384. package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
  385. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  386. package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
  387. package/lib/esm/test/element/ElementAspect.test.js +22 -22
  388. package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
  389. package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
  390. package/lib/esm/test/element/ElementRoundTrip.test.js +139 -139
  391. package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
  392. package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
  393. package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
  394. package/lib/esm/test/element/NullStructArray.test.js +13 -13
  395. package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
  396. package/lib/esm/test/element/UrlLink.test.js.map +1 -1
  397. package/lib/esm/test/font/FontFile.test.js.map +1 -1
  398. package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
  399. package/lib/esm/test/hubaccess/ApplyChangeset.test.js +32 -32
  400. package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -1
  401. package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
  402. package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
  403. package/lib/esm/test/hubaccess/Rebase.test.js +103 -35
  404. package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
  405. package/lib/esm/test/imageData.js.map +1 -1
  406. package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
  407. package/lib/esm/test/imodel/GetTextureImage.test.js.map +1 -1
  408. package/lib/esm/test/imodel/IModel.test.js +89 -44
  409. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  410. package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
  411. package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
  412. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
  413. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
  414. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js.map +1 -1
  415. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js.map +1 -1
  416. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +1 -1
  417. package/lib/esm/test/index.js.map +1 -1
  418. package/lib/esm/test/misc/DevTools.test.js.map +1 -1
  419. package/lib/esm/test/misc/EntitySubClasses.test.js.map +1 -1
  420. package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
  421. package/lib/esm/test/misc/PromiseMemoizer.test.js.map +1 -1
  422. package/lib/esm/test/native/DgnDbWorker.test.js.map +1 -1
  423. package/lib/esm/test/rpc/response.test.js.map +1 -1
  424. package/lib/esm/test/schema/ClassRegistry.test.js +99 -99
  425. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  426. package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
  427. package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
  428. package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
  429. package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
  430. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  431. package/lib/esm/test/standalone/ChangesetReader.test.js +164 -170
  432. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  433. package/lib/esm/test/standalone/CustomViewState3dCreator.test.js.map +1 -1
  434. package/lib/esm/test/standalone/DisplayStyle.test.js +6 -6
  435. package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
  436. package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
  437. package/lib/esm/test/standalone/ElementGraphics.test.js +75 -6
  438. package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
  439. package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
  440. package/lib/esm/test/standalone/ExportGraphics.test.js +14 -14
  441. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  442. package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
  443. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  444. package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
  445. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -1
  446. package/lib/esm/test/standalone/IModelWrite.test.js +27 -27
  447. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  448. package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
  449. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  450. package/lib/esm/test/standalone/NativeAppStorage.test.js.map +1 -1
  451. package/lib/esm/test/standalone/RenderMaterialElement.test.js +4 -4
  452. package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
  453. package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
  454. package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
  455. package/lib/esm/test/standalone/SchemaUtils.test.js.map +1 -1
  456. package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
  457. package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
  458. package/lib/esm/test/standalone/Setting.test.js.map +1 -1
  459. package/lib/esm/test/standalone/Settings.test.js.map +1 -1
  460. package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
  461. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  462. package/lib/esm/test/standalone/Texture.test.js.map +1 -1
  463. package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
  464. package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
  465. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  466. package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
  467. package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -1
  468. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  469. package/lib/esm/workspace/Settings.js.map +1 -1
  470. package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
  471. package/lib/esm/workspace/Workspace.js.map +1 -1
  472. package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
  473. package/package.json +16 -18
@@ -21,9 +21,9 @@ function isIntlSupported() {
21
21
  }
22
22
  function findTextStyleImpl(id) {
23
23
  if (id === "0x42") {
24
- return TextStyleSettings.fromJSON({ lineSpacingFactor: 12, fontName: "block", isBold: true });
24
+ return TextStyleSettings.fromJSON({ lineSpacingFactor: 12, font: { name: "block" }, isBold: true });
25
25
  }
26
- return TextStyleSettings.fromJSON({ lineSpacingFactor: 1, fontName: "other" });
26
+ return TextStyleSettings.fromJSON({ lineSpacingFactor: 1, font: { name: "other" } });
27
27
  }
28
28
  describe("layoutTextBlock", () => {
29
29
  describe("resolves TextStyleSettings", () => {
@@ -39,13 +39,13 @@ describe("layoutTextBlock", () => {
39
39
  expect(tb.lines.length).to.equal(1);
40
40
  expect(tb.lines[0].runs.length).to.equal(1);
41
41
  const runStyle = tb.lines[0].runs[0].style;
42
- expect(runStyle.fontName).to.equal("block");
42
+ expect(runStyle.font.name).to.equal("block");
43
43
  expect(runStyle.lineSpacingFactor).to.equal(12);
44
44
  expect(runStyle.isBold).to.be.true;
45
45
  });
46
46
  it("inherits style overrides from Paragraph when Run has no style overrides", () => {
47
47
  const textBlock = TextBlock.create();
48
- textBlock.appendParagraph({ styleOverrides: { fontName: "paragraph" } });
48
+ textBlock.appendParagraph({ styleOverrides: { font: { name: "paragraph" } } });
49
49
  textBlock.appendRun(TextRun.create({ content: "test" }));
50
50
  const tb = doLayout(textBlock, {
51
51
  textStyleId: "0x42",
@@ -54,13 +54,13 @@ describe("layoutTextBlock", () => {
54
54
  expect(tb.lines.length).to.equal(1);
55
55
  expect(tb.lines[0].runs.length).to.equal(1);
56
56
  const runStyle = tb.lines[0].runs[0].style;
57
- expect(runStyle.fontName).to.equal("paragraph");
57
+ expect(runStyle.font.name).to.equal("paragraph");
58
58
  expect(runStyle.isBold).to.be.true;
59
59
  });
60
60
  it("uses Run style overrides when Run has overrides", () => {
61
61
  const textBlock = TextBlock.create();
62
- textBlock.appendParagraph({ styleOverrides: { lineSpacingFactor: 55, fontName: "paragraph" } });
63
- textBlock.appendRun(TextRun.create({ content: "test", styleOverrides: { lineSpacingFactor: 99, fontName: "run" } }));
62
+ textBlock.appendParagraph({ styleOverrides: { lineSpacingFactor: 55, font: { name: "paragraph" } } });
63
+ textBlock.appendRun(TextRun.create({ content: "test", styleOverrides: { lineSpacingFactor: 99, font: { name: "run" } } }));
64
64
  const tb = doLayout(textBlock, {
65
65
  textStyleId: "0x42",
66
66
  findTextStyle: findTextStyleImpl,
@@ -68,13 +68,13 @@ describe("layoutTextBlock", () => {
68
68
  expect(tb.lines.length).to.equal(1);
69
69
  expect(tb.lines[0].runs.length).to.equal(1);
70
70
  const runStyle = tb.lines[0].runs[0].style;
71
- expect(runStyle.fontName).to.equal("run");
71
+ expect(runStyle.font.name).to.equal("run");
72
72
  expect(runStyle.isBold).to.be.true;
73
73
  });
74
74
  it("still uses TextBlock specific styles when Run has style overrides", () => {
75
75
  // Some style settings make sense on a TextBlock, so they are always applied from the TextBlock, even if the Run has a style override.
76
76
  const textBlock = TextBlock.create();
77
- const run = TextRun.create({ content: "test", styleOverrides: { lineSpacingFactor: 99, fontName: "run" } });
77
+ const run = TextRun.create({ content: "test", styleOverrides: { lineSpacingFactor: 99, font: { name: "run" } } });
78
78
  textBlock.appendParagraph();
79
79
  textBlock.appendRun(run);
80
80
  const tb = doLayout(textBlock, {
@@ -87,9 +87,9 @@ describe("layoutTextBlock", () => {
87
87
  expect(runStyle.lineSpacingFactor).to.equal(12);
88
88
  });
89
89
  it("inherits overrides from TextBlock, Paragraph and Run when there is no styleId", () => {
90
- const textBlock = TextBlock.create({ styleOverrides: { widthFactor: 34, lineHeight: 3, lineSpacingFactor: 12, isBold: true } });
91
- const run = TextRun.create({ content: "test", styleOverrides: { widthFactor: 78, fontName: "override", leader: { wantElbow: true } } });
92
- textBlock.appendParagraph({ styleOverrides: { lineHeight: 56, color: 0xff0000, frame: { shape: "octagon" } } });
90
+ const textBlock = TextBlock.create({ styleOverrides: { widthFactor: 34, textHeight: 3, lineSpacingFactor: 12, paragraphSpacingFactor: 2, isBold: true } });
91
+ const run = TextRun.create({ content: "test", styleOverrides: { widthFactor: 78, font: { name: "override" }, leader: { wantElbow: true } } });
92
+ textBlock.appendParagraph({ styleOverrides: { textHeight: 56, paragraphSpacingFactor: 25, color: 0xff0000, frame: { shape: "octagon" } } });
93
93
  textBlock.appendRun(run);
94
94
  const tb = doLayout(textBlock, {
95
95
  findTextStyle: findTextStyleImpl,
@@ -99,22 +99,23 @@ describe("layoutTextBlock", () => {
99
99
  const runStyle = tb.lines[0].runs[0].style;
100
100
  // widthFactor is always taken from the TextBlock, even if the Run has overrides
101
101
  expect(runStyle.widthFactor).to.equal(34);
102
- // lineHeight is always taken from the TextBlock, even if the Run has overrides
103
- expect(runStyle.lineHeight).to.equal(3);
102
+ // paragraphSpacingFactor is always taken from the TextBlock, even if the Run has overrides
103
+ expect(runStyle.paragraphSpacingFactor).to.equal(2);
104
104
  // lineSpacingFactor is always taken from the TextBlock, even if the Run has overrides
105
105
  expect(runStyle.lineSpacingFactor).to.equal(12);
106
106
  // frame settings are always taken from the TextBlock, even if the Paragraph or Run has overrides
107
107
  expect(runStyle.frame.shape).to.equal("none");
108
108
  // leader settings are always taken from the TextBlock, even if the Paragraph or Run has overrides
109
109
  expect(runStyle.leader.wantElbow).to.be.false;
110
- expect(runStyle.fontName).to.equal("override");
110
+ expect(runStyle.font.name).to.equal("override");
111
111
  expect(runStyle.color).to.equal(0xff0000);
112
112
  expect(runStyle.isBold).to.be.true;
113
+ expect(runStyle.textHeight).to.equal(56);
113
114
  });
114
115
  it("does not inherit overrides in TextBlock or Paragraph when Run has same propertied overriden - unless they are TextBlock specific settings", () => {
115
- const textBlock = TextBlock.create({ styleOverrides: { widthFactor: 34, lineHeight: 3, lineSpacingFactor: 12, isBold: true } });
116
- const run = TextRun.create({ content: "test", styleOverrides: { widthFactor: 78, lineHeight: 6, lineSpacingFactor: 24, fontName: "override", isBold: false } });
117
- textBlock.appendParagraph({ styleOverrides: { lineHeight: 56, color: 0xff0000 } });
116
+ const textBlock = TextBlock.create({ styleOverrides: { widthFactor: 34, margins: { left: 3 }, textHeight: 3, lineSpacingFactor: 12, paragraphSpacingFactor: 2, isBold: true, justification: "center" } });
117
+ const run = TextRun.create({ content: "test", styleOverrides: { widthFactor: 78, margins: { left: 4, right: 3 }, textHeight: 6, paragraphSpacingFactor: 25, lineSpacingFactor: 24, font: { name: "override" }, isBold: false, justification: "right" } });
118
+ textBlock.appendParagraph({ styleOverrides: { textHeight: 56, paragraphSpacingFactor: 50, color: 0xff0000, justification: "left" } });
118
119
  textBlock.appendRun(run);
119
120
  const tb = doLayout(textBlock, {
120
121
  textStyleId: "0x42",
@@ -125,19 +126,25 @@ describe("layoutTextBlock", () => {
125
126
  const runStyle = tb.lines[0].runs[0].style;
126
127
  // widthFactor is always taken from the TextBlock, even if the Run has a styleId or overrides
127
128
  expect(runStyle.widthFactor).to.equal(34);
128
- // lineHeight is always taken from the TextBlock, even if the Run has a styleId or overrides
129
- expect(runStyle.lineHeight).to.equal(3);
129
+ // paragraphSpacingFactor is always taken from the TextBlock, even if the Run has overrides
130
+ expect(runStyle.paragraphSpacingFactor).to.equal(2);
130
131
  // lineSpacingFactor is always taken from the TextBlock, even if the Run has a styleId or overrides
131
132
  expect(runStyle.lineSpacingFactor).to.equal(12);
132
- expect(runStyle.fontName).to.equal("override");
133
+ // margins are always taken from the TextBlock, even if the Paragraph or Run has overrides
134
+ expect(runStyle.margins.left).to.equal(3);
135
+ expect(runStyle.margins.right).to.equal(0);
136
+ // justification is always taken from the TextBlock, even if the Paragraph or Run has overrides
137
+ expect(runStyle.justification).to.equal("center");
138
+ expect(runStyle.font.name).to.equal("override");
133
139
  expect(runStyle.color).to.equal(0xff0000);
134
140
  expect(runStyle.isBold).to.be.false;
141
+ expect(runStyle.textHeight).to.equal(6);
135
142
  });
136
143
  it("takes child overrides over parent overrides", () => {
137
144
  //...unless they are TextBlock specific as covered in other tests
138
- const textBlock = TextBlock.create({ styleOverrides: { fontName: "grandparent" } });
139
- const run = TextRun.create({ content: "test", styleOverrides: { fontName: "child" } });
140
- textBlock.appendParagraph({ styleOverrides: { fontName: "parent" } });
145
+ const textBlock = TextBlock.create({ styleOverrides: { font: { name: "grandparent" } } });
146
+ const run = TextRun.create({ content: "test", styleOverrides: { font: { name: "child" } } });
147
+ textBlock.appendParagraph({ styleOverrides: { font: { name: "parent" } } });
141
148
  textBlock.appendRun(run);
142
149
  const tb = doLayout(textBlock, {
143
150
  findTextStyle: findTextStyleImpl,
@@ -145,7 +152,7 @@ describe("layoutTextBlock", () => {
145
152
  expect(tb.lines.length).to.equal(1);
146
153
  expect(tb.lines[0].runs.length).to.equal(1);
147
154
  const runStyle = tb.lines[0].runs[0].style;
148
- expect(runStyle.fontName).to.equal("child");
155
+ expect(runStyle.font.name).to.equal("child");
149
156
  });
150
157
  });
151
158
  it("has consistent data when converted to a layout result", function () {
@@ -153,14 +160,14 @@ describe("layoutTextBlock", () => {
153
160
  this.skip();
154
161
  }
155
162
  // Initialize a new TextBlockLayout object
156
- const textBlock = TextBlock.create({ width: 50, styleOverrides: { widthFactor: 34, color: 0x00ff00, fontName: "arial" } });
163
+ const textBlock = TextBlock.create({ width: 50, styleOverrides: { widthFactor: 34, color: 0x00ff00, font: { name: "arial" } } });
157
164
  const run0 = TextRun.create({
158
165
  content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pretium mi sit amet magna malesuada, at venenatis ante eleifend.",
159
- styleOverrides: { lineHeight: 56, color: 0xff0000 },
166
+ styleOverrides: { textHeight: 56, color: 0xff0000 },
160
167
  });
161
168
  const run1 = TextRun.create({
162
169
  content: "Donec sit amet semper sapien. Nullam commodo, libero a accumsan lacinia, metus enim pharetra lacus, eu facilisis sem nisi eu dui.",
163
- styleOverrides: { widthFactor: 78, fontName: "run1" },
170
+ styleOverrides: { widthFactor: 78, font: { name: "run1" } },
164
171
  });
165
172
  const run2 = TextRun.create({
166
173
  content: "Duis dui quam, suscipit quis feugiat id, fermentum ut augue. Mauris iaculis odio rhoncus lorem eleifend, posuere viverra turpis elementum.",
@@ -255,48 +262,115 @@ describe("layoutTextBlock", () => {
255
262
  expect(marginRange.low.y).to.equal(layoutRange.low.y - (margins.bottom ?? 0));
256
263
  expect(marginRange.high.y).to.equal(layoutRange.high.y + (margins.top ?? 0));
257
264
  };
258
- const makeTextBlock = (margins) => {
259
- const textBlock = TextBlock.create({ styleOverrides: { lineSpacingFactor: 0 }, margins });
260
- textBlock.appendRun(makeTextRun("abc"));
261
- textBlock.appendRun(makeTextRun("defg"));
262
- return textBlock;
265
+ const textBlock = TextBlock.create({ styleOverrides: { lineSpacingFactor: 0 } });
266
+ textBlock.appendRun(makeTextRun("abc"));
267
+ textBlock.appendRun(makeTextRun("defg"));
268
+ const marginStyleCallback = (margins) => {
269
+ return () => TextStyleSettings.fromJSON({ margins: { ...margins } });
263
270
  };
264
- let block = makeTextBlock({});
265
- let layout = doLayout(block);
271
+ let layout = doLayout(textBlock, {
272
+ findTextStyle: marginStyleCallback({}),
273
+ });
266
274
  // Margins should be 0 by default
267
275
  expect(layout.range.isAlmostEqual(layout.textRange)).to.be.true;
268
276
  expectMargins(layout.textRange, layout.range, {});
269
277
  // All margins should be applied to the range
270
- block = makeTextBlock({ left: 1, right: 2, top: 3, bottom: 4 });
271
- layout = doLayout(block);
278
+ layout = doLayout(textBlock, {
279
+ findTextStyle: marginStyleCallback({ left: 1, right: 2, top: 3, bottom: 4 }),
280
+ });
272
281
  expectMargins(layout.textRange, layout.range, { left: 1, right: 2, top: 3, bottom: 4 });
273
282
  // Just horizontal margins should be applied
274
- block = makeTextBlock({ left: 1, right: 2 });
275
- layout = doLayout(block);
283
+ layout = doLayout(textBlock, {
284
+ findTextStyle: marginStyleCallback({ left: 1, right: 2 }),
285
+ });
276
286
  expectMargins(layout.textRange, layout.range, { left: 1, right: 2 });
277
287
  // Just vertical margins should be applied
278
- block = makeTextBlock({ top: 1, bottom: 2 });
279
- layout = doLayout(block);
288
+ layout = doLayout(textBlock, {
289
+ findTextStyle: marginStyleCallback({ top: 1, bottom: 2 }),
290
+ });
280
291
  expectMargins(layout.textRange, layout.range, { top: 1, bottom: 2 });
281
292
  });
282
293
  describe("range", () => {
283
- it("aligns text to center based on height of stacked fraction", () => {
294
+ const round = (num, numDecimalPlaces) => {
295
+ const multiplier = Math.pow(100, numDecimalPlaces);
296
+ return Math.round(num * multiplier) / multiplier;
297
+ };
298
+ it("aligns text of the same size on the bottom of the line", () => {
284
299
  const textBlock = TextBlock.create();
285
- const fractionRun = FractionRun.create({ numerator: "1", denominator: "2" });
286
- const textRun = TextRun.create({ content: "text" });
300
+ const run1 = TextRun.create({ content: "abc" });
301
+ const run2 = TextRun.create({ content: "defg" });
302
+ textBlock.appendRun(run1);
303
+ textBlock.appendRun(run2);
304
+ const layout = doLayout(textBlock);
305
+ const run1Layout = layout.lines[0].runs[0];
306
+ const run2Layout = layout.lines[0].runs[1];
307
+ expect(run1Layout.range.yLength()).to.equal(1);
308
+ expect(run2Layout.range.yLength()).to.equal(1);
309
+ expect(run1Layout.offsetFromLine.y).to.equal(0);
310
+ expect(run2Layout.offsetFromLine.y).to.equal(0);
311
+ });
312
+ it("aligns text of varying sizes to the baseline of the largest text", () => {
313
+ const textBlock = TextBlock.create();
314
+ const smallText = TextRun.create({ content: "small", styleOverrides: { textHeight: 1 } });
315
+ const largeText = TextRun.create({ content: "large", styleOverrides: { textHeight: 3 } });
316
+ textBlock.appendRun(smallText);
317
+ textBlock.appendRun(largeText);
318
+ const layout = doLayout(textBlock);
319
+ const smallLayout = layout.lines[0].runs[0];
320
+ const largeLayout = layout.lines[0].runs[1];
321
+ expect(smallLayout.range.yLength()).to.equal(1);
322
+ expect(largeLayout.range.yLength()).to.equal(3);
323
+ expect(largeLayout.offsetFromLine.y).to.equal(0);
324
+ expect(smallLayout.offsetFromLine.y).to.equal(0);
325
+ });
326
+ it("aligns text to center based on height of the largest stacked fraction", () => {
327
+ const textBlock = TextBlock.create();
328
+ const fractionRun = FractionRun.create({ numerator: "1", denominator: "2", styleOverrides: { textHeight: 4 } });
329
+ const textRun = TextRun.create({ content: "text", styleOverrides: { textHeight: 2 } });
287
330
  textBlock.appendRun(fractionRun);
288
331
  textBlock.appendRun(textRun);
289
332
  const layout = doLayout(textBlock);
290
333
  const fractionLayout = layout.lines[0].runs[0];
291
334
  const textLayout = layout.lines[0].runs[1];
292
- const round = (num, numDecimalPlaces) => {
293
- const multiplier = Math.pow(100, numDecimalPlaces);
294
- return Math.round(num * multiplier) / multiplier;
295
- };
296
- expect(textLayout.range.yLength()).to.equal(1);
297
- expect(round(fractionLayout.range.yLength(), 2)).to.equal(1.75);
335
+ expect(round(fractionLayout.range.yLength(), 2)).to.equal(7);
336
+ expect(textLayout.range.yLength()).to.equal(2);
337
+ // Fraction should be defining the line height
338
+ expect(fractionLayout.offsetFromLine.y).to.equal(0);
339
+ expect(round(textLayout.offsetFromLine.y, 2)).to.equal(2.5);
340
+ });
341
+ it("aligns the largest non-fraction text to the center based on height of stacked fraction and aligns all other text to the baseline", () => {
342
+ const textBlock = TextBlock.create();
343
+ const smallText = TextRun.create({ content: "s", styleOverrides: { textHeight: 1 } });
344
+ const mediumText = TextRun.create({ content: "m", styleOverrides: { textHeight: 2 } });
345
+ const fraction = FractionRun.create({ numerator: "1", denominator: "2", styleOverrides: { textHeight: 4 } });
346
+ textBlock.appendRun(smallText);
347
+ textBlock.appendRun(mediumText);
348
+ textBlock.appendRun(fraction);
349
+ const layout = doLayout(textBlock);
350
+ const smallLayout = layout.lines[0].runs[0];
351
+ const mediumLayout = layout.lines[0].runs[1];
352
+ const fractionLayout = layout.lines[0].runs[2];
353
+ expect(smallLayout.range.yLength()).to.equal(1);
354
+ expect(mediumLayout.range.yLength()).to.equal(2);
355
+ expect(round(fractionLayout.range.yLength(), 2)).to.equal(7);
356
+ expect(round(mediumLayout.offsetFromLine.y, 2)).to.equal(2.5);
357
+ expect(round(smallLayout.offsetFromLine.y, 2)).to.equal(2.5);
298
358
  expect(fractionLayout.offsetFromLine.y).to.equal(0);
299
- expect(round(textLayout.offsetFromLine.y, 3)).to.equal(.375);
359
+ });
360
+ it("aligns fractions to the baseline of same sized text", () => {
361
+ const textBlock = TextBlock.create();
362
+ const text = TextRun.create({ content: "t", styleOverrides: { textHeight: 3 } });
363
+ const fraction = FractionRun.create({ numerator: "1", denominator: "2", styleOverrides: { textHeight: 3 } });
364
+ textBlock.appendRun(text);
365
+ textBlock.appendRun(fraction);
366
+ const layout = doLayout(textBlock);
367
+ const textLayout = layout.lines[0].runs[0];
368
+ const fractionLayout = layout.lines[0].runs[1];
369
+ expect(textLayout.range.yLength()).to.equal(3);
370
+ expect(round(fractionLayout.range.yLength(), 2)).to.equal(5.25);
371
+ expect(round(textLayout.offsetFromLine.y, 3)).to.equal(1.125);
372
+ // Slightly lower than text baseline so that the fraction appears centered on the text
373
+ expect(round(fractionLayout.offsetFromLine.y, 3)).to.equal(0.075);
300
374
  });
301
375
  it("produces one line per paragraph if document width <= 0", () => {
302
376
  const lineSpacingFactor = 0.5;
@@ -338,8 +412,8 @@ describe("layoutTextBlock", () => {
338
412
  });
339
413
  it("produces a new line for each LineBreakRun", () => {
340
414
  const lineSpacingFactor = 0.5;
341
- const lineHeight = 1;
342
- const textBlock = TextBlock.create({ styleOverrides: { lineSpacingFactor, lineHeight } });
415
+ const textHeight = 1;
416
+ const textBlock = TextBlock.create({ styleOverrides: { lineSpacingFactor, textHeight } });
343
417
  textBlock.appendRun(TextRun.create({ content: "abc" }));
344
418
  textBlock.appendRun(LineBreakRun.create());
345
419
  textBlock.appendRun(TextRun.create({ content: "def" }));
@@ -355,12 +429,12 @@ describe("layoutTextBlock", () => {
355
429
  expect(tb.range.high.x).to.equal(6);
356
430
  expect(tb.range.high.y).to.equal(0);
357
431
  // paragraphSpacingFactor should not be applied to linebreaks, but lineSpacingFactor should.
358
- expect(tb.range.low.y).to.equal(-(lineSpacingFactor * 2 + lineHeight * 3));
432
+ expect(tb.range.low.y).to.equal(-(lineSpacingFactor * 2 + textHeight * 3));
359
433
  });
360
434
  it("applies tab shifts", () => {
361
- const lineHeight = 1;
435
+ const textHeight = 1;
362
436
  const tabInterval = 6;
363
- const textBlock = TextBlock.create({ styleOverrides: { lineHeight, tabInterval } });
437
+ const textBlock = TextBlock.create({ styleOverrides: { textHeight, tabInterval } });
364
438
  // Appends a line that looks like `stringOne` TAB `stringTwo` LINEBREAK
365
439
  const appendLine = (stringOne, stringTwo, wantLineBreak = true) => {
366
440
  if (stringOne.length > 0)
@@ -390,9 +464,9 @@ describe("layoutTextBlock", () => {
390
464
  });
391
465
  });
392
466
  it("applies consecutive tab shifts", () => {
393
- const lineHeight = 1;
467
+ const textHeight = 1;
394
468
  const tabInterval = 6;
395
- const textBlock = TextBlock.create({ styleOverrides: { lineHeight, tabInterval } });
469
+ const textBlock = TextBlock.create({ styleOverrides: { textHeight, tabInterval } });
396
470
  // line 0: ----->----->----->LINEBREAK
397
471
  textBlock.appendRun(TabRun.create({ styleOverrides: { tabInterval } }));
398
472
  textBlock.appendRun(TabRun.create({ styleOverrides: { tabInterval } }));
@@ -431,12 +505,12 @@ describe("layoutTextBlock", () => {
431
505
  expect(line3.runs.length).to.equal(7);
432
506
  expect(line3.range.xLength()).to.equal(7 + 3 + 7, `Multiple tabs with different intervals should be applied correctly`);
433
507
  });
434
- it("computes ranges based on custom line spacing, line height, and indentation", () => {
508
+ it("computes ranges based on custom line spacing, text height, and indentation", () => {
435
509
  const lineSpacingFactor = 2;
436
- const lineHeight = 3;
510
+ const textHeight = 3;
437
511
  const paragraphSpacingFactor = 13;
438
512
  const indentation = 7;
439
- const textBlock = TextBlock.create({ styleOverrides: { lineSpacingFactor, lineHeight, paragraphSpacingFactor, indentation } });
513
+ const textBlock = TextBlock.create({ styleOverrides: { lineSpacingFactor, textHeight, paragraphSpacingFactor, indentation } });
440
514
  textBlock.appendRun(TextRun.create({ content: "abc" }));
441
515
  textBlock.appendRun(LineBreakRun.create());
442
516
  textBlock.appendRun(TextRun.create({ content: "def" }));
@@ -455,25 +529,25 @@ describe("layoutTextBlock", () => {
455
529
 
456
530
  Where ↵ = LineBreak, ¶ = ParagraphBreak, ⇥ = indentation
457
531
 
458
- We have 3 lines each `lineHeight` high, plus 2 line breaks in between each `lineHeight*lineSpacingFactor` high.
532
+ We have 3 lines each `textHeight` high, plus 2 line breaks in between each `textHeight*lineSpacingFactor` high.
459
533
  No paragraph spacing should be applied since there is one paragraph.
460
534
  */
461
535
  expect(tb.range.low.x).to.equal(7);
462
536
  expect(tb.range.high.x).to.equal(6 + 7); // 7 for indentation, 6 for the length of "defghi"
463
537
  expect(tb.range.high.y).to.equal(0);
464
- expect(tb.range.low.y).to.equal(-(lineHeight * 3 + (lineHeight * lineSpacingFactor) * 2));
465
- expect(tb.lines[0].offsetFromDocument.y).to.equal(-lineHeight);
466
- expect(tb.lines[1].offsetFromDocument.y).to.equal(tb.lines[0].offsetFromDocument.y - (lineHeight + lineHeight * lineSpacingFactor));
467
- expect(tb.lines[2].offsetFromDocument.y).to.equal(tb.lines[1].offsetFromDocument.y - (lineHeight + lineHeight * lineSpacingFactor));
538
+ expect(tb.range.low.y).to.equal(-(textHeight * 3 + (textHeight * lineSpacingFactor) * 2));
539
+ expect(tb.lines[0].offsetFromDocument.y).to.equal(-textHeight);
540
+ expect(tb.lines[1].offsetFromDocument.y).to.equal(tb.lines[0].offsetFromDocument.y - (textHeight + textHeight * lineSpacingFactor));
541
+ expect(tb.lines[2].offsetFromDocument.y).to.equal(tb.lines[1].offsetFromDocument.y - (textHeight + textHeight * lineSpacingFactor));
468
542
  tb.lines.forEach((line) => expect(line.offsetFromDocument.x).to.equal(7));
469
543
  });
470
544
  it("computes paragraph spacing and indentation", () => {
471
545
  const lineSpacingFactor = 2;
472
- const lineHeight = 3;
546
+ const textHeight = 3;
473
547
  const paragraphSpacingFactor = 13;
474
548
  const indentation = 7;
475
549
  const tabInterval = 5;
476
- const textBlock = TextBlock.create({ styleOverrides: { lineSpacingFactor, lineHeight, paragraphSpacingFactor, indentation, tabInterval } });
550
+ const textBlock = TextBlock.create({ styleOverrides: { lineSpacingFactor, textHeight, paragraphSpacingFactor, indentation, tabInterval } });
477
551
  const p1 = textBlock.appendParagraph();
478
552
  p1.children.push(TextRun.create({ content: "abc" })); // Line 1
479
553
  p1.children.push(LineBreakRun.create());
@@ -498,33 +572,33 @@ describe("layoutTextBlock", () => {
498
572
  Where ↵ = LineBreak, ¶ = ParagraphBreak, → = tabInterval/2, ⇥ = indentation
499
573
 
500
574
  We have:
501
- 6 lines each `lineHeight` high
502
- 5 line breaks in between each `lineHeight*lineSpacingFactor` high
503
- 4 paragraph breaks in between each `lineHeight*paragraphSpacingFactor` high
575
+ 6 lines each `textHeight` high
576
+ 5 line breaks in between each `textHeight*lineSpacingFactor` high
577
+ 4 paragraph breaks in between each `textHeight*paragraphSpacingFactor` high
504
578
  */
505
579
  expect(tb.range.low.x).to.equal(7); // 7 for indentation
506
580
  expect(tb.range.high.x).to.equal(7 + 5 + 11); // 7 for indentation, 5 for the tab stop, 11 for the length of "list item 1"
507
581
  expect(tb.range.high.y).to.equal(0);
508
- expect(tb.range.low.y).to.equal(-(lineHeight * 6 + (lineHeight * lineSpacingFactor) * 5 + (lineHeight * paragraphSpacingFactor) * 4));
582
+ expect(tb.range.low.y).to.equal(-(textHeight * 6 + (textHeight * lineSpacingFactor) * 5 + (textHeight * paragraphSpacingFactor) * 4));
509
583
  // Cumulative vertical offsets to help make the test more readable.
510
- let offsetY = -lineHeight;
584
+ let offsetY = -textHeight;
511
585
  let offsetX = indentation;
512
586
  expect(tb.lines[0].offsetFromDocument.y).to.equal(offsetY);
513
587
  expect(tb.lines[0].offsetFromDocument.x).to.equal(offsetX);
514
- offsetY -= (lineHeight + lineHeight * lineSpacingFactor);
588
+ offsetY -= (textHeight + textHeight * lineSpacingFactor);
515
589
  expect(tb.lines[1].offsetFromDocument.y).to.equal(offsetY);
516
590
  expect(tb.lines[1].offsetFromDocument.x).to.equal(offsetX);
517
- offsetY -= (lineHeight + lineHeight * lineSpacingFactor + lineHeight * paragraphSpacingFactor);
591
+ offsetY -= (textHeight + textHeight * lineSpacingFactor + textHeight * paragraphSpacingFactor);
518
592
  expect(tb.lines[2].offsetFromDocument.y).to.equal(offsetY);
519
593
  expect(tb.lines[2].offsetFromDocument.x).to.equal(offsetX);
520
594
  offsetX += tabInterval; // List items are indented using tabInterval.
521
- offsetY -= (lineHeight + lineHeight * lineSpacingFactor + lineHeight * paragraphSpacingFactor);
595
+ offsetY -= (textHeight + textHeight * lineSpacingFactor + textHeight * paragraphSpacingFactor);
522
596
  expect(tb.lines[3].offsetFromDocument.y).to.equal(offsetY);
523
597
  expect(tb.lines[3].offsetFromDocument.x).to.equal(offsetX);
524
- offsetY -= (lineHeight + lineHeight * lineSpacingFactor + lineHeight * paragraphSpacingFactor);
598
+ offsetY -= (textHeight + textHeight * lineSpacingFactor + textHeight * paragraphSpacingFactor);
525
599
  expect(tb.lines[4].offsetFromDocument.y).to.equal(offsetY);
526
600
  expect(tb.lines[4].offsetFromDocument.x).to.equal(offsetX);
527
- offsetY -= (lineHeight + lineHeight * lineSpacingFactor + lineHeight * paragraphSpacingFactor);
601
+ offsetY -= (textHeight + textHeight * lineSpacingFactor + textHeight * paragraphSpacingFactor);
528
602
  expect(tb.lines[5].offsetFromDocument.y).to.equal(offsetY);
529
603
  expect(tb.lines[5].offsetFromDocument.x).to.equal(offsetX);
530
604
  });
@@ -536,7 +610,7 @@ describe("layoutTextBlock", () => {
536
610
  if (!isIntlSupported()) {
537
611
  this.skip();
538
612
  }
539
- const block = TextBlock.create({ width: 3, styleOverrides: { lineHeight: 1, lineSpacingFactor: 0 } });
613
+ const block = TextBlock.create({ width: 3, styleOverrides: { textHeight: 1, lineSpacingFactor: 0 } });
540
614
  function expectBlockRange(width, height) {
541
615
  const layout = doLayout(block);
542
616
  expectRange(width, height, layout.range);
@@ -560,7 +634,7 @@ describe("layoutTextBlock", () => {
560
634
  if (!isIntlSupported()) {
561
635
  this.skip();
562
636
  }
563
- const block = TextBlock.create({ styleOverrides: { lineHeight: 1, lineSpacingFactor: 0 } });
637
+ const block = TextBlock.create({ styleOverrides: { textHeight: 1, lineSpacingFactor: 0 } });
564
638
  function expectBlockRange(width, height) {
565
639
  const layout = doLayout(block);
566
640
  expectRange(width, height, layout.range);
@@ -575,7 +649,7 @@ describe("layoutTextBlock", () => {
575
649
  });
576
650
  it("computes range for list markers and list items based on indentation", function () {
577
651
  const lineSpacingFactor = 2;
578
- const lineHeight = 3;
652
+ const textHeight = 3;
579
653
  const paragraphSpacingFactor = 13;
580
654
  const indentation = 7;
581
655
  const tabInterval = 5;
@@ -649,7 +723,7 @@ describe("layoutTextBlock", () => {
649
723
  ]
650
724
  }
651
725
  ];
652
- const textBlock = TextBlock.create({ styleOverrides: { lineSpacingFactor, lineHeight, paragraphSpacingFactor, indentation, tabInterval } });
726
+ const textBlock = TextBlock.create({ styleOverrides: { lineSpacingFactor, textHeight, paragraphSpacingFactor, indentation, tabInterval } });
653
727
  const p1 = textBlock.appendParagraph();
654
728
  p1.children.push(List.create({ children: listChildren }));
655
729
  /* Final TextBlock should look like:
@@ -664,23 +738,23 @@ describe("layoutTextBlock", () => {
664
738
  Where ↵ = LineBreak, ¶ = ParagraphBreak, → = tab, → = tabInterval/2, ⇥ = indentation
665
739
 
666
740
  We have:
667
- 7 lines each `lineHeight` high
668
- 6 line breaks in between each `lineHeight*lineSpacingFactor` high
669
- 6 paragraph breaks in between each `lineHeight*paragraphSpacingFactor` high
741
+ 7 lines each `textHeight` high
742
+ 6 line breaks in between each `textHeight*lineSpacingFactor` high
743
+ 6 paragraph breaks in between each `textHeight*paragraphSpacingFactor` high
670
744
  */
671
745
  const tb = doLayout(textBlock);
672
746
  expect(tb.lines.length).to.equal(7);
673
747
  expect(tb.range.low.x).to.equal(7 + 5 - 5 / 2 - 2); // indentation + tabInterval - tabInterval/2 (for marker offset) + 2 (for the marker "1." justification, it's 2 characters wide)
674
748
  expect(tb.range.high.x).to.equal(7 + 3 * 5 + 21); // 7 for indentation, 3 * 5 for the most nested tab stops, 21 for the length of "Rhode Island Greening"
675
749
  expect(tb.range.high.y).to.equal(0);
676
- expect(tb.range.low.y).to.equal(-(lineHeight * 7 + (lineHeight * lineSpacingFactor) * 6 + (lineHeight * paragraphSpacingFactor) * 6));
750
+ expect(tb.range.low.y).to.equal(-(textHeight * 7 + (textHeight * lineSpacingFactor) * 6 + (textHeight * paragraphSpacingFactor) * 6));
677
751
  // Cumulative vertical offsets to help make the test more readable.
678
- let offsetY = -lineHeight;
752
+ let offsetY = -textHeight;
679
753
  for (const line of tb.lines) {
680
754
  expect(line.offsetFromDocument.y).to.equal(offsetY);
681
755
  expect(line.marker).to.not.be.undefined;
682
- expect(line.marker?.offsetFromLine.y).to.equal((lineHeight - line.marker.range.yLength()) / 2);
683
- offsetY -= (lineHeight + lineHeight * lineSpacingFactor + lineHeight * paragraphSpacingFactor);
756
+ expect(line.marker?.offsetFromLine.y).to.equal((textHeight - line.marker.range.yLength()) / 2);
757
+ offsetY -= (textHeight + textHeight * lineSpacingFactor + textHeight * paragraphSpacingFactor);
684
758
  }
685
759
  let markerXLength = tb.lines[0].marker.range.xLength();
686
760
  let inset = indentation + tabInterval;
@@ -712,12 +786,16 @@ describe("layoutTextBlock", () => {
712
786
  this.skip();
713
787
  }
714
788
  const block = TextBlock.create({ styleOverrides: { lineSpacingFactor: 0 } });
715
- function expectBlockRange(width, height) {
716
- const layout = doLayout(block);
789
+ function expectBlockRange(width, height, justification) {
790
+ const layout = doLayout(block, {
791
+ findTextStyle: () => TextStyleSettings.fromJSON({ justification })
792
+ });
717
793
  expectRange(width, height, layout.range);
718
794
  }
719
- function expectLineOffset(offset, lineIndex) {
720
- const layout = doLayout(block);
795
+ function expectLineOffset(offset, lineIndex, justification) {
796
+ const layout = doLayout(block, {
797
+ findTextStyle: () => TextStyleSettings.fromJSON({ justification }),
798
+ });
721
799
  expect(layout.lines.length).least(lineIndex + 1);
722
800
  const line = layout.lines[lineIndex];
723
801
  expect(line.offsetFromDocument.y).to.equal(-(lineIndex + 1));
@@ -727,65 +805,53 @@ describe("layoutTextBlock", () => {
727
805
  block.appendRun(makeTextRun("abc"));
728
806
  block.appendRun(makeTextRun("defg"));
729
807
  // 1 line of text with width 0: left, right, center justification.
730
- block.justification = "left";
731
- expectBlockRange(7, 1);
732
- expectLineOffset(0, 0);
733
- block.justification = "right";
734
- expectBlockRange(7, 1);
735
- expectLineOffset(0, 0);
736
- block.justification = "center";
737
- expectBlockRange(7, 1);
738
- expectLineOffset(0, 0);
808
+ expectBlockRange(7, 1, "left");
809
+ expectLineOffset(0, 0, "left");
810
+ expectBlockRange(7, 1, "right");
811
+ expectLineOffset(0, 0, "right");
812
+ expectBlockRange(7, 1, "center");
813
+ expectLineOffset(0, 0, "center");
739
814
  // 1 line of text from a width greater than number of characters: left, right, center justification.
740
815
  block.width = 10;
741
- block.justification = "left";
742
- expectBlockRange(10, 1);
743
- expectLineOffset(0, 0);
744
- block.justification = "right";
745
- expectBlockRange(10, 1);
746
- expectLineOffset(3, 0); // 3 = 10 - 7
747
- block.justification = "center";
748
- expectBlockRange(10, 1);
749
- expectLineOffset(1.5, 0); // 1.5 = (10 - 7) / 2
816
+ expectBlockRange(10, 1, "left");
817
+ expectLineOffset(0, 0, "left");
818
+ expectBlockRange(10, 1, "right");
819
+ expectLineOffset(3, 0, "right"); // 3 = 10 - 7
820
+ expectBlockRange(10, 1, "center");
821
+ expectLineOffset(1.5, 0, "center"); // 1.5 = (10 - 7) / 2
750
822
  // 2 line of text from a width less than number of characters: left, right, center justification.
751
- block.justification = "left";
752
823
  block.width = 4;
753
- expectBlockRange(4, 2);
754
- expectLineOffset(0, 0);
755
- expectLineOffset(0, 1);
756
- block.justification = "right";
757
- expectBlockRange(4, 2);
758
- expectLineOffset(1, 0);
759
- expectLineOffset(0, 1);
760
- block.justification = "center";
761
- expectBlockRange(4, 2);
762
- expectLineOffset(0.5, 0);
763
- expectLineOffset(0, 1);
824
+ expectBlockRange(4, 2, "left");
825
+ expectLineOffset(0, 0, "left");
826
+ expectLineOffset(0, 1, "left");
827
+ expectBlockRange(4, 2, "right");
828
+ expectLineOffset(1, 0, "right");
829
+ expectLineOffset(0, 1, "right");
830
+ expectBlockRange(4, 2, "center");
831
+ expectLineOffset(0.5, 0, "center");
832
+ expectLineOffset(0, 1, "center");
764
833
  // Testing text longer the the width of the text block.
765
834
  block.width = 2;
766
- block.justification = "left";
767
- expectBlockRange(4, 2);
768
- expectLineOffset(0, 0);
769
- expectLineOffset(0, 1);
770
- block.justification = "right";
771
- expectBlockRange(4, 2);
772
- expectLineOffset(-1, 0);
773
- expectLineOffset(-2, 1);
835
+ expectBlockRange(4, 2, "left");
836
+ expectLineOffset(0, 0, "left");
837
+ expectLineOffset(0, 1, "left");
838
+ expectBlockRange(4, 2, "right");
839
+ expectLineOffset(-1, 0, "right");
840
+ expectLineOffset(-2, 1, "right");
774
841
  block.appendRun(makeTextRun("123456789"));
775
- expectBlockRange(9, 3);
776
- expectLineOffset(-1, 0);
777
- expectLineOffset(-2, 1);
778
- expectLineOffset(-7, 2);
779
- block.justification = "center";
780
- expectBlockRange(9, 3);
781
- expectLineOffset(-0.5, 0);
782
- expectLineOffset(-1, 1);
783
- expectLineOffset(-3.5, 2);
842
+ expectBlockRange(9, 3, "right");
843
+ expectLineOffset(-1, 0, "right");
844
+ expectLineOffset(-2, 1, "right");
845
+ expectLineOffset(-7, 2, "right");
846
+ expectBlockRange(9, 3, "center");
847
+ expectLineOffset(-0.5, 0, "center");
848
+ expectLineOffset(-1, 1, "center");
849
+ expectLineOffset(-3.5, 2, "center");
784
850
  });
785
851
  });
786
852
  describe("word-wrapping", () => {
787
853
  function expectLines(input, width, expectedLines) {
788
- const textBlock = TextBlock.create({ styleOverrides: { paragraphSpacingFactor: 0, lineSpacingFactor: 0, lineHeight: 1 } });
854
+ const textBlock = TextBlock.create({ styleOverrides: { paragraphSpacingFactor: 0, lineSpacingFactor: 0, textHeight: 1 } });
789
855
  textBlock.width = width;
790
856
  const run = makeTextRun(input);
791
857
  textBlock.appendRun(run);
@@ -888,8 +954,8 @@ describe("layoutTextBlock", () => {
888
954
  if (!isIntlSupported()) {
889
955
  this.skip();
890
956
  }
891
- const lineHeight = 1;
892
- const textBlock = TextBlock.create({ styleOverrides: { lineHeight } });
957
+ const textHeight = 1;
958
+ const textBlock = TextBlock.create({ styleOverrides: { textHeight } });
893
959
  // line 0: -->-->------> LINEBREAK
894
960
  textBlock.appendRun(TabRun.create({ styleOverrides: { tabInterval: 3 } }));
895
961
  textBlock.appendRun(TabRun.create({ styleOverrides: { tabInterval: 3 } }));
@@ -1043,7 +1109,7 @@ describe("layoutTextBlock", () => {
1043
1109
  if (!isIntlSupported()) {
1044
1110
  this.skip();
1045
1111
  }
1046
- const block = TextBlock.create({ styleOverrides: { lineHeight: 1, lineSpacingFactor: 0 } });
1112
+ const block = TextBlock.create({ styleOverrides: { textHeight: 1, lineSpacingFactor: 0 } });
1047
1113
  block.appendRun(makeTextRun("abc defg"));
1048
1114
  const layout1 = doLayout(block);
1049
1115
  let width = layout1.range.xLength();
@@ -1057,7 +1123,7 @@ describe("layoutTextBlock", () => {
1057
1123
  if (!isIntlSupported()) {
1058
1124
  this.skip();
1059
1125
  }
1060
- const textBlock = TextBlock.create({ styleOverrides: { indentation: 2, tabInterval: 3, lineHeight: 1, lineSpacingFactor: 0, paragraphSpacingFactor: 0 } });
1126
+ const textBlock = TextBlock.create({ styleOverrides: { indentation: 2, tabInterval: 3, textHeight: 1, lineSpacingFactor: 0, paragraphSpacingFactor: 0 } });
1061
1127
  /* Final TextBlock should look like:
1062
1128
  ⇥→1.→Lorem ipsum dolor sit amet, consectetur adipiscing elit¶ | Inset by 5
1063
1129
  ⇥→2.→sed do¶ | Inset by 5
@@ -1234,7 +1300,7 @@ describe("layoutTextBlock", () => {
1234
1300
  expect(iModel.fonts.findId({ name: "Consolas" })).to.be.undefined;
1235
1301
  function test(fontName, expectedFontId) {
1236
1302
  const textBlock = TextBlock.create();
1237
- textBlock.appendRun(TextRun.create({ styleOverrides: { fontName } }));
1303
+ textBlock.appendRun(TextRun.create({ styleOverrides: { font: { name: fontName } } }));
1238
1304
  const textStyleResolver = new TextStyleResolver({ textBlock, textStyleId: "", iModel });
1239
1305
  const layout = layoutTextBlock({ textBlock, iModel, textStyleResolver });
1240
1306
  const run = layout.lines[0].runs[0];
@@ -1250,7 +1316,7 @@ describe("layoutTextBlock", () => {
1250
1316
  function computeDimensions(args) {
1251
1317
  const textBlock = TextBlock.create({
1252
1318
  styleOverrides: {
1253
- lineHeight: args.height,
1319
+ textHeight: args.height,
1254
1320
  widthFactor: args.width,
1255
1321
  },
1256
1322
  });
@@ -1259,7 +1325,7 @@ describe("layoutTextBlock", () => {
1259
1325
  styleOverrides: {
1260
1326
  isBold: args.bold,
1261
1327
  isItalic: args.italic,
1262
- fontName: args.font ?? "Vera",
1328
+ font: { name: args.font ?? "Vera" },
1263
1329
  },
1264
1330
  }));
1265
1331
  const textStyleResolver = new TextStyleResolver({ textBlock, textStyleId: "", iModel });
@@ -1291,7 +1357,7 @@ describe("layoutTextBlock", () => {
1291
1357
  italic: false,
1292
1358
  fontId: 1,
1293
1359
  widthFactor: 1,
1294
- lineHeight: 1,
1360
+ textHeight: 1,
1295
1361
  baselineShift: "none",
1296
1362
  });
1297
1363
  }
@@ -1524,10 +1590,11 @@ describe("produceTextBlockGeometry", () => {
1524
1590
  function makeGeometryWithMargins(anchor, margins) {
1525
1591
  const runs = [makeText()];
1526
1592
  const block = makeTextBlock(runs);
1527
- block.margins = margins;
1528
1593
  const annotation = TextAnnotation.fromJSON({ textBlock: block.toJSON() });
1529
1594
  annotation.anchor = anchor;
1530
- const layout = doLayout(block);
1595
+ const layout = doLayout(block, {
1596
+ findTextStyle: () => TextStyleSettings.fromJSON({ margins: { ...margins } }),
1597
+ });
1531
1598
  const geom = produceTextBlockGeometry(layout, annotation.computeTransform(layout.range)).entries;
1532
1599
  return geom[1].text;
1533
1600
  }