@itwin/core-backend 5.2.0-dev.7 → 5.2.0

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 (506) hide show
  1. package/CHANGELOG.md +56 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +2 -0
  3. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  4. package/lib/cjs/BackendHubAccess.js.map +1 -1
  5. package/lib/cjs/BackendLoggerCategory.d.ts +6 -0
  6. package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
  7. package/lib/cjs/BackendLoggerCategory.js +6 -0
  8. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  9. package/lib/cjs/BisCoreSchema.js.map +1 -1
  10. package/lib/cjs/BlobContainerService.js.map +1 -1
  11. package/lib/cjs/BriefcaseManager.d.ts +57 -3
  12. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  13. package/lib/cjs/BriefcaseManager.js +151 -42
  14. package/lib/cjs/BriefcaseManager.js.map +1 -1
  15. package/lib/cjs/CatalogDb.js.map +1 -1
  16. package/lib/cjs/Category.js.map +1 -1
  17. package/lib/cjs/ChangeSummaryManager.js +2 -2
  18. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  19. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  20. package/lib/cjs/ChangesetECAdaptor.js +248 -248
  21. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  22. package/lib/cjs/ChannelControl.js.map +1 -1
  23. package/lib/cjs/CheckpointManager.js.map +1 -1
  24. package/lib/cjs/ClassRegistry.js +5 -5
  25. package/lib/cjs/ClassRegistry.js.map +1 -1
  26. package/lib/cjs/CloudSqlite.d.ts +4 -0
  27. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  28. package/lib/cjs/CloudSqlite.js.map +1 -1
  29. package/lib/cjs/CodeService.js.map +1 -1
  30. package/lib/cjs/CodeSpecs.js.map +1 -1
  31. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  32. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  33. package/lib/cjs/DevTools.js.map +1 -1
  34. package/lib/cjs/DisplayStyle.js.map +1 -1
  35. package/lib/cjs/ECDb.d.ts +8 -0
  36. package/lib/cjs/ECDb.d.ts.map +1 -1
  37. package/lib/cjs/ECDb.js +22 -0
  38. package/lib/cjs/ECDb.js.map +1 -1
  39. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  40. package/lib/cjs/ECSqlStatement.js.map +1 -1
  41. package/lib/cjs/Element.js.map +1 -1
  42. package/lib/cjs/ElementAspect.js.map +1 -1
  43. package/lib/cjs/ElementGraphics.js.map +1 -1
  44. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  45. package/lib/cjs/Entity.js.map +1 -1
  46. package/lib/cjs/EntityReferences.js.map +1 -1
  47. package/lib/cjs/ExportGraphics.js.map +1 -1
  48. package/lib/cjs/ExternalSource.js.map +1 -1
  49. package/lib/cjs/FontFile.js.map +1 -1
  50. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  51. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  52. package/lib/cjs/GeometrySummary.js +47 -47
  53. package/lib/cjs/GeometrySummary.js.map +1 -1
  54. package/lib/cjs/IModelDb.d.ts +54 -3
  55. package/lib/cjs/IModelDb.d.ts.map +1 -1
  56. package/lib/cjs/IModelDb.js +96 -18
  57. package/lib/cjs/IModelDb.js.map +1 -1
  58. package/lib/cjs/IModelDbFonts.js.map +1 -1
  59. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  60. package/lib/cjs/IModelHost.d.ts +11 -1
  61. package/lib/cjs/IModelHost.d.ts.map +1 -1
  62. package/lib/cjs/IModelHost.js +5 -0
  63. package/lib/cjs/IModelHost.js.map +1 -1
  64. package/lib/cjs/IModelIncrementalSchemaLocater.d.ts +1 -5
  65. package/lib/cjs/IModelIncrementalSchemaLocater.d.ts.map +1 -1
  66. package/lib/cjs/IModelIncrementalSchemaLocater.js +0 -6
  67. package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -1
  68. package/lib/cjs/IModelJsFs.js.map +1 -1
  69. package/lib/cjs/ImageSourceConversion.js.map +1 -1
  70. package/lib/cjs/IpcHost.js.map +1 -1
  71. package/lib/cjs/LineStyle.js.map +1 -1
  72. package/lib/cjs/LocalHub.js +1 -1
  73. package/lib/cjs/LocalHub.js.map +1 -1
  74. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  75. package/lib/cjs/LockControl.js.map +1 -1
  76. package/lib/cjs/Material.js.map +1 -1
  77. package/lib/cjs/Model.js.map +1 -1
  78. package/lib/cjs/NativeAppStorage.js.map +1 -1
  79. package/lib/cjs/NativeHost.js.map +1 -1
  80. package/lib/cjs/NavigationRelationship.js.map +1 -1
  81. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  82. package/lib/cjs/PropertyStore.js.map +1 -1
  83. package/lib/cjs/Relationship.js.map +1 -1
  84. package/lib/cjs/RpcBackend.js.map +1 -1
  85. package/lib/cjs/SQLiteDb.js.map +1 -1
  86. package/lib/cjs/Schema.js.map +1 -1
  87. package/lib/cjs/SchemaSync.js.map +1 -1
  88. package/lib/cjs/SchemaUtils.js.map +1 -1
  89. package/lib/cjs/SheetIndex.js.map +1 -1
  90. package/lib/cjs/SqliteChangesetReader.d.ts +8 -0
  91. package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
  92. package/lib/cjs/SqliteChangesetReader.js +11 -0
  93. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  94. package/lib/cjs/SqliteStatement.js.map +1 -1
  95. package/lib/cjs/StashManager.d.ts +175 -0
  96. package/lib/cjs/StashManager.d.ts.map +1 -0
  97. package/lib/cjs/StashManager.js +306 -0
  98. package/lib/cjs/StashManager.js.map +1 -0
  99. package/lib/cjs/Texture.js.map +1 -1
  100. package/lib/cjs/TileStorage.js.map +1 -1
  101. package/lib/cjs/TxnManager.d.ts +226 -15
  102. package/lib/cjs/TxnManager.d.ts.map +1 -1
  103. package/lib/cjs/TxnManager.js +249 -23
  104. package/lib/cjs/TxnManager.js.map +1 -1
  105. package/lib/cjs/ViewDefinition.js.map +1 -1
  106. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  107. package/lib/cjs/ViewStore.js.map +1 -1
  108. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +10 -1
  109. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  110. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +15 -6
  111. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  112. package/lib/cjs/annotations/FrameGeometry.js +6 -6
  113. package/lib/cjs/annotations/FrameGeometry.js.map +1 -1
  114. package/lib/cjs/annotations/LeaderGeometry.d.ts +3 -2
  115. package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -1
  116. package/lib/cjs/annotations/LeaderGeometry.js +8 -7
  117. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
  118. package/lib/cjs/annotations/TextAnnotationElement.d.ts +145 -36
  119. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
  120. package/lib/cjs/annotations/TextAnnotationElement.js +234 -106
  121. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  122. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +2 -0
  123. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -1
  124. package/lib/cjs/annotations/TextAnnotationGeometry.js +26 -19
  125. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
  126. package/lib/cjs/annotations/TextBlockGeometry.d.ts.map +1 -1
  127. package/lib/cjs/annotations/TextBlockGeometry.js +11 -3
  128. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -1
  129. package/lib/cjs/annotations/TextBlockLayout.d.ts +51 -38
  130. package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -1
  131. package/lib/cjs/annotations/TextBlockLayout.js +252 -156
  132. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -1
  133. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  134. package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +32 -32
  135. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -27
  136. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
  137. package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
  138. package/lib/cjs/core-backend.js.map +1 -1
  139. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  140. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  141. package/lib/cjs/domains/GenericElements.js.map +1 -1
  142. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  143. package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
  144. package/lib/cjs/internal/ChannelAdmin.js +1 -1
  145. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  146. package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
  147. package/lib/cjs/internal/FontFileImpl.js.map +1 -1
  148. package/lib/cjs/internal/HubMock.js.map +1 -1
  149. package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -1
  150. package/lib/cjs/internal/NativePlatform.js.map +1 -1
  151. package/lib/cjs/internal/NoLocks.js.map +1 -1
  152. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  153. package/lib/cjs/internal/Symbols.d.ts +1 -0
  154. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  155. package/lib/cjs/internal/Symbols.js +2 -1
  156. package/lib/cjs/internal/Symbols.js.map +1 -1
  157. package/lib/cjs/internal/annotations/fields.d.ts +2 -12
  158. package/lib/cjs/internal/annotations/fields.d.ts.map +1 -1
  159. package/lib/cjs/internal/annotations/fields.js +49 -45
  160. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  161. package/lib/cjs/internal/cross-package.js.map +1 -1
  162. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  163. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  164. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  165. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  166. package/lib/cjs/rpc/multipart.js.map +1 -1
  167. package/lib/cjs/rpc/tracing.js.map +1 -1
  168. package/lib/cjs/rpc/web/logging.js.map +1 -1
  169. package/lib/cjs/rpc/web/request.js.map +1 -1
  170. package/lib/cjs/rpc/web/response.js.map +1 -1
  171. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  172. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  173. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  174. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  175. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  176. package/lib/cjs/workspace/Settings.js.map +1 -1
  177. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  178. package/lib/cjs/workspace/Workspace.d.ts +1 -1
  179. package/lib/cjs/workspace/Workspace.js.map +1 -1
  180. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
  181. package/lib/esm/BackendHubAccess.d.ts +2 -0
  182. package/lib/esm/BackendHubAccess.d.ts.map +1 -1
  183. package/lib/esm/BackendHubAccess.js.map +1 -1
  184. package/lib/esm/BackendLoggerCategory.d.ts +6 -0
  185. package/lib/esm/BackendLoggerCategory.d.ts.map +1 -1
  186. package/lib/esm/BackendLoggerCategory.js +6 -0
  187. package/lib/esm/BackendLoggerCategory.js.map +1 -1
  188. package/lib/esm/BisCoreSchema.js.map +1 -1
  189. package/lib/esm/BlobContainerService.js.map +1 -1
  190. package/lib/esm/BriefcaseManager.d.ts +57 -3
  191. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  192. package/lib/esm/BriefcaseManager.js +152 -43
  193. package/lib/esm/BriefcaseManager.js.map +1 -1
  194. package/lib/esm/CatalogDb.js.map +1 -1
  195. package/lib/esm/Category.js.map +1 -1
  196. package/lib/esm/ChangeSummaryManager.js +2 -2
  197. package/lib/esm/ChangeSummaryManager.js.map +1 -1
  198. package/lib/esm/ChangedElementsDb.js.map +1 -1
  199. package/lib/esm/ChangesetECAdaptor.js +248 -248
  200. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  201. package/lib/esm/ChannelControl.js.map +1 -1
  202. package/lib/esm/CheckpointManager.js.map +1 -1
  203. package/lib/esm/ClassRegistry.js +5 -5
  204. package/lib/esm/ClassRegistry.js.map +1 -1
  205. package/lib/esm/CloudSqlite.d.ts +4 -0
  206. package/lib/esm/CloudSqlite.d.ts.map +1 -1
  207. package/lib/esm/CloudSqlite.js.map +1 -1
  208. package/lib/esm/CodeService.js.map +1 -1
  209. package/lib/esm/CodeSpecs.js.map +1 -1
  210. package/lib/esm/ConcurrentQuery.js.map +1 -1
  211. package/lib/esm/CustomViewState3dCreator.js.map +1 -1
  212. package/lib/esm/DevTools.js.map +1 -1
  213. package/lib/esm/DisplayStyle.js.map +1 -1
  214. package/lib/esm/ECDb.d.ts +8 -0
  215. package/lib/esm/ECDb.d.ts.map +1 -1
  216. package/lib/esm/ECDb.js +22 -0
  217. package/lib/esm/ECDb.js.map +1 -1
  218. package/lib/esm/ECSchemaXmlContext.js.map +1 -1
  219. package/lib/esm/ECSqlStatement.js.map +1 -1
  220. package/lib/esm/Element.js.map +1 -1
  221. package/lib/esm/ElementAspect.js.map +1 -1
  222. package/lib/esm/ElementGraphics.js.map +1 -1
  223. package/lib/esm/ElementTreeWalker.js.map +1 -1
  224. package/lib/esm/Entity.js.map +1 -1
  225. package/lib/esm/EntityReferences.js.map +1 -1
  226. package/lib/esm/ExportGraphics.js.map +1 -1
  227. package/lib/esm/ExternalSource.js.map +1 -1
  228. package/lib/esm/FontFile.js.map +1 -1
  229. package/lib/esm/GeoCoordConfig.js.map +1 -1
  230. package/lib/esm/GeographicCRSServices.js.map +1 -1
  231. package/lib/esm/GeometrySummary.js +47 -47
  232. package/lib/esm/GeometrySummary.js.map +1 -1
  233. package/lib/esm/IModelDb.d.ts +54 -3
  234. package/lib/esm/IModelDb.d.ts.map +1 -1
  235. package/lib/esm/IModelDb.js +97 -19
  236. package/lib/esm/IModelDb.js.map +1 -1
  237. package/lib/esm/IModelDbFonts.js.map +1 -1
  238. package/lib/esm/IModelElementCloneContext.js.map +1 -1
  239. package/lib/esm/IModelHost.d.ts +11 -1
  240. package/lib/esm/IModelHost.d.ts.map +1 -1
  241. package/lib/esm/IModelHost.js +5 -0
  242. package/lib/esm/IModelHost.js.map +1 -1
  243. package/lib/esm/IModelIncrementalSchemaLocater.d.ts +1 -5
  244. package/lib/esm/IModelIncrementalSchemaLocater.d.ts.map +1 -1
  245. package/lib/esm/IModelIncrementalSchemaLocater.js +0 -6
  246. package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -1
  247. package/lib/esm/IModelJsFs.js.map +1 -1
  248. package/lib/esm/ImageSourceConversion.js.map +1 -1
  249. package/lib/esm/IpcHost.js.map +1 -1
  250. package/lib/esm/LineStyle.js.map +1 -1
  251. package/lib/esm/LocalHub.js +1 -1
  252. package/lib/esm/LocalHub.js.map +1 -1
  253. package/lib/esm/LocalhostIpcHost.js.map +1 -1
  254. package/lib/esm/LockControl.js.map +1 -1
  255. package/lib/esm/Material.js.map +1 -1
  256. package/lib/esm/Model.js.map +1 -1
  257. package/lib/esm/NativeAppStorage.js.map +1 -1
  258. package/lib/esm/NativeHost.js.map +1 -1
  259. package/lib/esm/NavigationRelationship.js.map +1 -1
  260. package/lib/esm/PromiseMemoizer.js.map +1 -1
  261. package/lib/esm/PropertyStore.js.map +1 -1
  262. package/lib/esm/Relationship.js.map +1 -1
  263. package/lib/esm/RpcBackend.js.map +1 -1
  264. package/lib/esm/SQLiteDb.js.map +1 -1
  265. package/lib/esm/Schema.js.map +1 -1
  266. package/lib/esm/SchemaSync.js.map +1 -1
  267. package/lib/esm/SchemaUtils.js.map +1 -1
  268. package/lib/esm/SheetIndex.js.map +1 -1
  269. package/lib/esm/SqliteChangesetReader.d.ts +8 -0
  270. package/lib/esm/SqliteChangesetReader.d.ts.map +1 -1
  271. package/lib/esm/SqliteChangesetReader.js +11 -0
  272. package/lib/esm/SqliteChangesetReader.js.map +1 -1
  273. package/lib/esm/SqliteStatement.js.map +1 -1
  274. package/lib/esm/StashManager.d.ts +175 -0
  275. package/lib/esm/StashManager.d.ts.map +1 -0
  276. package/lib/esm/StashManager.js +301 -0
  277. package/lib/esm/StashManager.js.map +1 -0
  278. package/lib/esm/Texture.js.map +1 -1
  279. package/lib/esm/TileStorage.js.map +1 -1
  280. package/lib/esm/TxnManager.d.ts +226 -15
  281. package/lib/esm/TxnManager.d.ts.map +1 -1
  282. package/lib/esm/TxnManager.js +247 -21
  283. package/lib/esm/TxnManager.js.map +1 -1
  284. package/lib/esm/ViewDefinition.js.map +1 -1
  285. package/lib/esm/ViewStateHydrator.js.map +1 -1
  286. package/lib/esm/ViewStore.js.map +1 -1
  287. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +10 -1
  288. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  289. package/lib/esm/annotations/ElementDrivesTextAnnotation.js +13 -5
  290. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  291. package/lib/esm/annotations/FrameGeometry.js +6 -6
  292. package/lib/esm/annotations/FrameGeometry.js.map +1 -1
  293. package/lib/esm/annotations/LeaderGeometry.d.ts +3 -2
  294. package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -1
  295. package/lib/esm/annotations/LeaderGeometry.js +8 -7
  296. package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
  297. package/lib/esm/annotations/TextAnnotationElement.d.ts +145 -36
  298. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
  299. package/lib/esm/annotations/TextAnnotationElement.js +235 -107
  300. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  301. package/lib/esm/annotations/TextAnnotationGeometry.d.ts +2 -0
  302. package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -1
  303. package/lib/esm/annotations/TextAnnotationGeometry.js +26 -19
  304. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
  305. package/lib/esm/annotations/TextBlockGeometry.d.ts.map +1 -1
  306. package/lib/esm/annotations/TextBlockGeometry.js +11 -3
  307. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -1
  308. package/lib/esm/annotations/TextBlockLayout.d.ts +51 -38
  309. package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -1
  310. package/lib/esm/annotations/TextBlockLayout.js +253 -157
  311. package/lib/esm/annotations/TextBlockLayout.js.map +1 -1
  312. package/lib/esm/core-backend.js.map +1 -1
  313. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  314. package/lib/esm/domains/FunctionalSchema.js.map +1 -1
  315. package/lib/esm/domains/GenericElements.js.map +1 -1
  316. package/lib/esm/domains/GenericSchema.js.map +1 -1
  317. package/lib/esm/internal/ChangesetConflictArgs.js.map +1 -1
  318. package/lib/esm/internal/ChannelAdmin.js +1 -1
  319. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  320. package/lib/esm/internal/ElementLRUCache.js.map +1 -1
  321. package/lib/esm/internal/FontFileImpl.js.map +1 -1
  322. package/lib/esm/internal/HubMock.js.map +1 -1
  323. package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -1
  324. package/lib/esm/internal/NativePlatform.js.map +1 -1
  325. package/lib/esm/internal/NoLocks.js.map +1 -1
  326. package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
  327. package/lib/esm/internal/Symbols.d.ts +1 -0
  328. package/lib/esm/internal/Symbols.d.ts.map +1 -1
  329. package/lib/esm/internal/Symbols.js +1 -0
  330. package/lib/esm/internal/Symbols.js.map +1 -1
  331. package/lib/esm/internal/annotations/fields.d.ts +2 -12
  332. package/lib/esm/internal/annotations/fields.d.ts.map +1 -1
  333. package/lib/esm/internal/annotations/fields.js +51 -47
  334. package/lib/esm/internal/annotations/fields.js.map +1 -1
  335. package/lib/esm/internal/cross-package.js.map +1 -1
  336. package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
  337. package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  338. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  339. package/lib/esm/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  340. package/lib/esm/rpc/multipart.js.map +1 -1
  341. package/lib/esm/rpc/tracing.js.map +1 -1
  342. package/lib/esm/rpc/web/logging.js.map +1 -1
  343. package/lib/esm/rpc/web/request.js.map +1 -1
  344. package/lib/esm/rpc/web/response.js.map +1 -1
  345. package/lib/esm/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  346. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  347. package/lib/esm/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  348. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  349. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  350. package/lib/esm/test/AdvancedEqual.js.map +1 -1
  351. package/lib/esm/test/AnnotationTestUtils.d.ts +5 -1
  352. package/lib/esm/test/AnnotationTestUtils.d.ts.map +1 -1
  353. package/lib/esm/test/AnnotationTestUtils.js +7 -2
  354. package/lib/esm/test/AnnotationTestUtils.js.map +1 -1
  355. package/lib/esm/test/AttachDb.test.js +11 -11
  356. package/lib/esm/test/AttachDb.test.js.map +1 -1
  357. package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
  358. package/lib/esm/test/GeometryTestUtil.js.map +1 -1
  359. package/lib/esm/test/IModelHost.test.js.map +1 -1
  360. package/lib/esm/test/IModelTestUtils.js.map +1 -1
  361. package/lib/esm/test/ImageSourceConversion.test.js.map +1 -1
  362. package/lib/esm/test/IpcHost.test.js.map +1 -1
  363. package/lib/esm/test/KnownTestLocations.js.map +1 -1
  364. package/lib/esm/test/PrintElementTree.js.map +1 -1
  365. package/lib/esm/test/PropertyDb.test.js.map +1 -1
  366. package/lib/esm/test/RevisionUtility.js.map +1 -1
  367. package/lib/esm/test/SchemaUtils.test.js +25 -25
  368. package/lib/esm/test/SchemaUtils.test.js.map +1 -1
  369. package/lib/esm/test/SequentialLogMatcher.js.map +1 -1
  370. package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
  371. package/lib/esm/test/TestUtils.js.map +1 -1
  372. package/lib/esm/test/annotations/Fields.test.js +195 -78
  373. package/lib/esm/test/annotations/Fields.test.js.map +1 -1
  374. package/lib/esm/test/annotations/FrameGeometry.test.js +4 -4
  375. package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -1
  376. package/lib/esm/test/annotations/LeaderGeometry.test.js +19 -17
  377. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
  378. package/lib/esm/test/annotations/TextAnnotation.test.js +410 -59
  379. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  380. package/lib/esm/test/annotations/TextBlock.test.js +627 -193
  381. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
  382. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js.map +1 -1
  383. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts +46 -0
  384. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts.map +1 -1
  385. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js +20 -2
  386. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
  387. package/lib/esm/test/categories/Category.test.js.map +1 -1
  388. package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
  389. package/lib/esm/test/ecdb/CTE.test.js +88 -88
  390. package/lib/esm/test/ecdb/CTE.test.js.map +1 -1
  391. package/lib/esm/test/ecdb/ConcurrentQuery.test.js +15 -15
  392. package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -1
  393. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +15 -15
  394. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
  395. package/lib/esm/test/ecdb/ECDb.test.js +128 -58
  396. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  397. package/lib/esm/test/ecdb/ECDbTestHelper.js.map +1 -1
  398. package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -1
  399. package/lib/esm/test/ecdb/ECSqlAst.test.js +65 -65
  400. package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
  401. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  402. package/lib/esm/test/ecdb/ECSqlReader.test.js +16 -16
  403. package/lib/esm/test/ecdb/ECSqlReader.test.js.map +1 -1
  404. package/lib/esm/test/ecdb/ECSqlStatement.test.js +326 -326
  405. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  406. package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
  407. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
  408. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +21 -21
  409. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
  410. package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
  411. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  412. package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
  413. package/lib/esm/test/element/ElementAspect.test.js +22 -22
  414. package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
  415. package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
  416. package/lib/esm/test/element/ElementRoundTrip.test.js +139 -139
  417. package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
  418. package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
  419. package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
  420. package/lib/esm/test/element/NullStructArray.test.js +13 -13
  421. package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
  422. package/lib/esm/test/element/UrlLink.test.js.map +1 -1
  423. package/lib/esm/test/font/FontFile.test.js.map +1 -1
  424. package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
  425. package/lib/esm/test/hubaccess/ApplyChangeset.test.js +32 -32
  426. package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -1
  427. package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
  428. package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
  429. package/lib/esm/test/hubaccess/Rebase.test.d.ts +2 -0
  430. package/lib/esm/test/hubaccess/Rebase.test.d.ts.map +1 -0
  431. package/lib/esm/test/hubaccess/Rebase.test.js +640 -0
  432. package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -0
  433. package/lib/esm/test/imageData.js.map +1 -1
  434. package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
  435. package/lib/esm/test/imodel/GetTextureImage.test.js.map +1 -1
  436. package/lib/esm/test/imodel/IModel.test.js +44 -44
  437. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  438. package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
  439. package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
  440. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js +20 -20
  441. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
  442. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +3 -3
  443. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
  444. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js.map +1 -1
  445. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js.map +1 -1
  446. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts +16 -1
  447. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts.map +1 -1
  448. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js +47 -0
  449. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +1 -1
  450. package/lib/esm/test/index.js.map +1 -1
  451. package/lib/esm/test/misc/DevTools.test.js.map +1 -1
  452. package/lib/esm/test/misc/EntitySubClasses.test.js.map +1 -1
  453. package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
  454. package/lib/esm/test/misc/PromiseMemoizer.test.js.map +1 -1
  455. package/lib/esm/test/native/DgnDbWorker.test.js.map +1 -1
  456. package/lib/esm/test/rpc/response.test.js.map +1 -1
  457. package/lib/esm/test/schema/ClassRegistry.test.js +99 -99
  458. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  459. package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
  460. package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
  461. package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
  462. package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
  463. package/lib/esm/test/standalone/ChangeMerge.test.js +15 -19
  464. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  465. package/lib/esm/test/standalone/ChangesetReader.test.js +248 -118
  466. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  467. package/lib/esm/test/standalone/CustomViewState3dCreator.test.js.map +1 -1
  468. package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
  469. package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
  470. package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
  471. package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
  472. package/lib/esm/test/standalone/ExportGraphics.test.js +14 -14
  473. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  474. package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
  475. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  476. package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
  477. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -1
  478. package/lib/esm/test/standalone/IModelWrite.test.js +27 -27
  479. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  480. package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
  481. package/lib/esm/test/standalone/MergeConflict.test.js +3 -3
  482. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  483. package/lib/esm/test/standalone/NativeAppStorage.test.js.map +1 -1
  484. package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
  485. package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
  486. package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
  487. package/lib/esm/test/standalone/SchemaUtils.test.js.map +1 -1
  488. package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
  489. package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
  490. package/lib/esm/test/standalone/Setting.test.js.map +1 -1
  491. package/lib/esm/test/standalone/Settings.test.js.map +1 -1
  492. package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
  493. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  494. package/lib/esm/test/standalone/Texture.test.js.map +1 -1
  495. package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
  496. package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
  497. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  498. package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
  499. package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -1
  500. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  501. package/lib/esm/workspace/Settings.js.map +1 -1
  502. package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
  503. package/lib/esm/workspace/Workspace.d.ts +1 -1
  504. package/lib/esm/workspace/Workspace.js.map +1 -1
  505. package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
  506. package/package.json +13 -13
@@ -5,12 +5,11 @@
5
5
  /** @packageDocumentation
6
6
  * @module ElementGeometry
7
7
  */
8
- import { TextStyleSettings } from "@itwin/core-common";
8
+ import { getMarkerText, TextRun, TextStyleSettings } from "@itwin/core-common";
9
9
  import { Geometry, Range2d } from "@itwin/core-geometry";
10
10
  import { assert } from "@itwin/core-bentley";
11
11
  import * as LineBreaker from "linebreak";
12
12
  import { AnnotationTextStyle } from "./TextAnnotationElement";
13
- import { Drawing } from "../Element";
14
13
  /** @internal */
15
14
  function createFindTextStyleImpl(iModel) {
16
15
  return function findTextStyleImpl(id) {
@@ -54,11 +53,10 @@ export function computeLayoutTextBlockResult(args) {
54
53
  * @beta
55
54
  */
56
55
  export function computeGraphemeOffsets(args) {
57
- const { textBlock, paragraphIndex, runLayoutResult, graphemeCharIndexes, iModel } = args;
56
+ const { source, runLayoutResult, graphemeCharIndexes, iModel } = args;
58
57
  const findFontId = args.findFontId ?? ((name, type) => iModel.fonts.findId({ name, type }) ?? 0);
59
58
  const computeTextRange = args.computeTextRange ?? ((x) => iModel.computeRangesForText(x));
60
- const source = textBlock.paragraphs[paragraphIndex].runs[runLayoutResult.sourceRunIndex];
61
- if (source.type !== "text" || runLayoutResult.characterCount === 0) {
59
+ if (!(source instanceof TextRun) || runLayoutResult.characterCount === 0) {
62
60
  return [];
63
61
  }
64
62
  const style = TextStyleSettings.fromJSON(runLayoutResult.textStyle);
@@ -75,7 +73,7 @@ function scaleRange(range, scale) {
75
73
  range.high.scaleInPlace(scale);
76
74
  }
77
75
  /**
78
- * Applies block level settings (lineSpacingFactor, lineHeight, widthFactor, frame, and leader) to a [TextStyleSettings]($common).
76
+ * Applies block level settings (lineSpacingFactor, paragraphSpacingFactor, widthFactor, frame, margins, justification, and leader) to a [TextStyleSettings]($common).
79
77
  * These must be set on the block, as they are meaningless on individual paragraphs/runs.
80
78
  * However, leaders are a special case and can override the block's leader settings.
81
79
  * Setting `isLeader` to `true` makes the [TextBlock]($common) settings not override the leader's settings.
@@ -86,21 +84,27 @@ function applyBlockSettings(target, source, isLeader = false) {
86
84
  return target;
87
85
  }
88
86
  const lineSpacingFactor = source.lineSpacingFactor ?? target.lineSpacingFactor;
89
- const lineHeight = source.lineHeight ?? target.lineHeight;
87
+ const paragraphSpacingFactor = source.paragraphSpacingFactor ?? target.paragraphSpacingFactor;
90
88
  const widthFactor = source.widthFactor ?? target.widthFactor;
89
+ const justification = source.justification ?? target.justification;
91
90
  const frame = source.frame ?? target.frame;
91
+ const margins = source.margins ?? target.margins;
92
92
  const leader = source.leader ?? target.leader;
93
93
  const leaderShouldChange = !isLeader && !target.leaderEquals(leader);
94
94
  if (lineSpacingFactor !== target.lineSpacingFactor ||
95
- lineHeight !== target.lineHeight ||
95
+ paragraphSpacingFactor !== target.paragraphSpacingFactor ||
96
96
  widthFactor !== target.widthFactor ||
97
+ justification !== target.justification ||
97
98
  !target.frameEquals(frame) ||
99
+ !target.marginsEqual(margins) ||
98
100
  leaderShouldChange) {
99
101
  const cloneProps = {
100
102
  lineSpacingFactor,
101
- lineHeight,
103
+ paragraphSpacingFactor,
102
104
  widthFactor,
105
+ justification,
103
106
  frame,
107
+ margins,
104
108
  };
105
109
  if (leaderShouldChange) {
106
110
  cloneProps.leader = leader;
@@ -110,59 +114,39 @@ function applyBlockSettings(target, source, isLeader = false) {
110
114
  return target;
111
115
  }
112
116
  /**
113
- * Resolves the effective style of TextBlockComponents and Leaders, taking into account overrides/style of the instance and its parent(s).
117
+ * Resolves the effective style of TextBlockComponents and Leaders, taking into account overrides of the instance and its parent(s).
114
118
  * @beta
115
119
  */
116
120
  export class TextStyleResolver {
117
- _textStyles = new Map();
118
- _findTextStyle;
119
121
  /** The resolved style of the TextBlock. */
120
122
  blockSettings;
121
- /** The scale factor of the model containing the TextBlock. */
122
- scaleFactor;
123
123
  constructor(args) {
124
- this._findTextStyle = args.findTextStyle ?? createFindTextStyleImpl(args.iModel);
125
- this.scaleFactor = 1;
126
- if (args.modelId) {
127
- const element = args.iModel.elements.getElement(args.modelId);
128
- if (element instanceof Drawing)
129
- this.scaleFactor = element.scaleFactor;
130
- }
131
- this.blockSettings = this.findTextStyle(args.textBlock.styleId);
124
+ const findTextStyle = args.findTextStyle ?? createFindTextStyleImpl(args.iModel);
125
+ this.blockSettings = findTextStyle(args.textStyleId);
132
126
  if (args.textBlock.styleOverrides)
133
127
  this.blockSettings = this.blockSettings.clone(args.textBlock.styleOverrides);
134
128
  }
135
- resolveParagraphSettingsImpl(paragraph) {
129
+ /**
130
+ * Resolves the effective text style settings for a given TextBlockComponent, applying block-level overrides.
131
+ */
132
+ resolveSettings(overrides, isLeader = false) {
136
133
  let settings = this.blockSettings;
137
- if (paragraph.overridesStyle)
138
- settings = settings.clone(paragraph.styleOverrides);
139
- return settings;
140
- }
141
- /** Looks up an [[AnnotationTextStyle]] by ID. Uses caching. */
142
- findTextStyle(id) {
143
- let style = this._textStyles.get(id);
144
- if (undefined === style) {
145
- this._textStyles.set(id, style = this._findTextStyle(id));
146
- }
147
- return style;
148
- }
149
- /** Resolves the effective style for a [TextAnnotationLeader]($common). The TextAnnotationLeader should be a sibling of the provided TextBlock. */
150
- resolveTextAnnotationLeaderSettings(leader) {
151
- let settings = this.blockSettings;
152
- if (leader.styleOverrides)
153
- settings = settings.clone(leader.styleOverrides);
154
- return applyBlockSettings(settings, this.blockSettings, true);
155
- }
156
- /** Resolves the effective style for a [Paragraph]($common). Paragraph should be child of provided TextBlock. */
157
- resolveParagraphSettings(paragraph) {
158
- return applyBlockSettings(this.resolveParagraphSettingsImpl(paragraph), this.blockSettings);
159
- }
160
- /** Resolves the effective style for a [Run]($common). Run should be child of provided Paragraph and TextBlock. */
161
- resolveRunSettings(paragraph, run) {
162
- let settings = this.resolveParagraphSettingsImpl(paragraph);
163
- if (run.overridesStyle)
164
- settings = settings.clone(run.styleOverrides);
165
- return applyBlockSettings(settings, this.blockSettings);
134
+ if (overrides)
135
+ settings = settings.clone(overrides);
136
+ return applyBlockSettings(settings, this.blockSettings, isLeader);
137
+ }
138
+ resolveMarkerText(overrides, index) {
139
+ const markerSettings = overrides.listMarker ?? this.blockSettings.listMarker;
140
+ return getMarkerText(markerSettings, index);
141
+ }
142
+ /**
143
+ * Computes the indentation based on its style and nesting depth.
144
+ */
145
+ resolveIndentation(styleOverrides, depth) {
146
+ const overrides = this.resolveSettings(styleOverrides);
147
+ const indentation = overrides.indentation;
148
+ const tabInterval = overrides.tabInterval;
149
+ return indentation + tabInterval * depth;
166
150
  }
167
151
  }
168
152
  class LayoutContext {
@@ -175,35 +159,35 @@ class LayoutContext {
175
159
  this._computeTextRange = _computeTextRange;
176
160
  this._findFontId = _findFontId;
177
161
  }
178
- findFontId(name) {
162
+ findFontId(name, type) {
179
163
  let fontId = this._fontIds.get(name);
180
164
  if (undefined === fontId) {
181
- this._fontIds.set(name, fontId = this._findFontId(name));
165
+ this._fontIds.set(name, fontId = this._findFontId(name, type));
182
166
  }
183
167
  return fontId;
184
168
  }
185
169
  computeRangeForText(chars, style, baselineShift) {
186
170
  if (chars.length === 0) {
187
171
  return {
188
- layout: new Range2d(0, 0, 0, style.lineHeight),
172
+ layout: new Range2d(0, 0, 0, style.textHeight),
189
173
  justification: new Range2d(),
190
174
  };
191
175
  }
192
- const fontId = this.findFontId(style.fontName);
176
+ const fontId = this.findFontId(style.font.name, style.font.type);
193
177
  const { layout, justification } = this._computeTextRange({
194
178
  chars,
195
179
  fontId,
196
180
  baselineShift,
197
181
  bold: style.isBold,
198
182
  italic: style.isItalic,
199
- lineHeight: this.textStyleResolver.blockSettings.lineHeight,
183
+ textHeight: style.textHeight,
200
184
  widthFactor: this.textStyleResolver.blockSettings.widthFactor,
201
185
  });
202
186
  if ("none" !== baselineShift) {
203
187
  const isSub = "subscript" === baselineShift;
204
188
  const scale = isSub ? style.subScriptScale : style.superScriptScale;
205
189
  const offsetFactor = isSub ? style.subScriptOffsetFactor : style.superScriptOffsetFactor;
206
- const offset = { x: 0, y: style.lineHeight * offsetFactor };
190
+ const offset = { x: 0, y: style.textHeight * offsetFactor };
207
191
  scaleRange(layout, scale);
208
192
  layout.cloneTranslated(offset, layout);
209
193
  scaleRange(justification, scale);
@@ -252,10 +236,10 @@ class LayoutContext {
252
236
  layout.extendRange(denominator);
253
237
  return { layout, numerator, denominator };
254
238
  }
255
- computeRangeForTabRun(style, source, length) {
239
+ computeRangeForTabRun(style, source, lengthFromLastTab) {
256
240
  const interval = source.styleOverrides.tabInterval ?? style.tabInterval;
257
- const tabEndX = interval - length % interval;
258
- const range = new Range2d(0, 0, 0, style.lineHeight);
241
+ const tabEndX = interval - lengthFromLastTab % interval;
242
+ const range = new Range2d(0, 0, 0, style.textHeight);
259
243
  range.extendXY(tabEndX, range.low.y);
260
244
  return range;
261
245
  }
@@ -310,9 +294,9 @@ export class RunLayout {
310
294
  this.style = props.style;
311
295
  this.fontId = props.fontId;
312
296
  }
313
- static create(source, parentParagraph, context) {
314
- const style = context.textStyleResolver.resolveRunSettings(parentParagraph, source);
315
- const fontId = context.findFontId(style.fontName);
297
+ static create(source, context, cumulativeOverrides) {
298
+ const style = context.textStyleResolver.resolveSettings(cumulativeOverrides);
299
+ const fontId = context.findFontId(style.font.name, style.font.type);
316
300
  const charOffset = 0;
317
301
  const offsetFromLine = { x: 0, y: 0 };
318
302
  let numChars = 0;
@@ -338,7 +322,7 @@ export class RunLayout {
338
322
  default: { // "linebreak" or "tab"
339
323
  // "tab": Tabs rely on the context they are in, so we compute its range later.
340
324
  // lineBreak: We do this so that blank lines space correctly without special casing later.
341
- range = new Range2d(0, 0, 0, style.lineHeight);
325
+ range = new Range2d(0, 0, 0, style.textHeight);
342
326
  break;
343
327
  }
344
328
  }
@@ -380,9 +364,8 @@ export class RunLayout {
380
364
  });
381
365
  });
382
366
  }
383
- toResult(paragraph) {
367
+ toResult() {
384
368
  const result = {
385
- sourceRunIndex: paragraph.runs.indexOf(this.source),
386
369
  fontId: this.fontId,
387
370
  characterOffset: this.charOffset,
388
371
  characterCount: this.numChars,
@@ -411,60 +394,109 @@ export class RunLayout {
411
394
  export class LineLayout {
412
395
  source;
413
396
  range = new Range2d(0, 0, 0, 0);
397
+ runRange = new Range2d(0, 0, 0, 0); // Range of all runs excluding marker.
414
398
  justificationRange = new Range2d(0, 0, 0, 0);
415
- offsetFromDocument = { x: 0, y: 0 };
399
+ offsetFromDocument;
400
+ depth;
416
401
  lengthFromLastTab = 0; // Used to track the length from the last tab for tab runs.
417
402
  _runs = [];
418
- constructor(source) {
403
+ _marker;
404
+ constructor(source, style, context, depth = 0) {
419
405
  this.source = source;
406
+ this.depth = depth;
407
+ this.offsetFromDocument = { x: context?.textStyleResolver.resolveIndentation(style, depth) ?? 0, y: 0 };
420
408
  }
421
409
  /** Compute a string representation, primarily for debugging purposes. */
422
410
  stringify() {
423
411
  const runs = this._runs.map((run) => run.stringify());
424
412
  return `${runs.join("")}`;
425
413
  }
414
+ /** Gets the array of RunLayout objects contained in this line. */
426
415
  get runs() { return this._runs; }
416
+ /** Indicates whether this line contains any runs. */
427
417
  get isEmpty() { return this._runs.length === 0; }
418
+ /** Gets the last RunLayout in this line. */
428
419
  get back() {
429
420
  assert(!this.isEmpty);
430
421
  return this._runs[this._runs.length - 1];
431
422
  }
423
+ /**
424
+ * Gets or sets the marker RunLayout for this line, used for lists.
425
+ * A marker is the symbol or character that appears before each list item in a list, bullets, numbers, etc.
426
+ * */
427
+ get marker() { return this._marker; }
428
+ set marker(value) { this._marker = value; }
432
429
  append(run) {
433
430
  this._runs.push(run);
434
431
  this.computeRanges();
435
432
  }
436
433
  /** Invoked every time a run is appended,. */
437
434
  computeRanges() {
438
- this.range.low.setZero();
439
- this.range.high.setZero();
440
- // Some runs (fractions) are taller than others.
441
- // We want to center each run vertically inside the line.
435
+ this.runRange.low.setZero();
436
+ this.runRange.high.setZero();
437
+ this.lengthFromLastTab = 0;
442
438
  let lineHeight = 0;
439
+ let tallestNonFractionRun;
443
440
  for (const run of this._runs) {
444
- lineHeight = Math.max(lineHeight, run.range.yLength());
441
+ const runHeight = run.range.yLength();
442
+ lineHeight = Math.max(lineHeight, runHeight);
443
+ if (run.source.type !== "fraction" && (!tallestNonFractionRun || runHeight > tallestNonFractionRun.range.yLength())) {
444
+ tallestNonFractionRun = run;
445
+ }
446
+ }
447
+ // // The baseline for the line is the bottom of the tallest non-fraction run, centered in the line.
448
+ let baseline = 0;
449
+ if (tallestNonFractionRun) {
450
+ baseline = (lineHeight + tallestNonFractionRun.range.yLength()) / 2;
445
451
  }
446
452
  for (const run of this._runs) {
447
453
  const runHeight = run.range.yLength();
448
- const runOffset = { x: this.range.high.x, y: (lineHeight - runHeight) / 2 };
454
+ // Vertically align runs: normal text at baseline, fractions visually centered on text or line as appropriate.
455
+ let yOffset = lineHeight - baseline;
456
+ if (run.source.type === "fraction") {
457
+ const denominatorHeight = run.denominatorRange?.yLength() ?? 0;
458
+ if (tallestNonFractionRun && run.style.textHeight <= tallestNonFractionRun.style.textHeight) {
459
+ // Shift fraction to baseline, then down by half the denominator height so it appears centered relative to any non-fraction text of the same height.
460
+ yOffset = (lineHeight - baseline) - denominatorHeight / 2;
461
+ }
462
+ else {
463
+ // If the fraction text height is greater than the largest non-fraction text, just center it in the line.
464
+ yOffset = (lineHeight - runHeight) / 2;
465
+ }
466
+ }
467
+ const runOffset = { x: this.runRange.high.x, y: yOffset };
449
468
  run.offsetFromLine = runOffset;
450
469
  const runLayoutRange = run.range.cloneTranslated(runOffset);
451
- this.range.extendRange(runLayoutRange);
470
+ this.runRange.extendRange(runLayoutRange);
452
471
  if ("linebreak" !== run.source.type) {
453
472
  const runJustificationRange = run.justificationRange?.cloneTranslated(runOffset);
454
473
  this.justificationRange.extendRange(runJustificationRange ?? runLayoutRange);
455
474
  }
456
- if (run.source.type === "tab") {
475
+ if ("tab" === run.source.type) {
457
476
  this.lengthFromLastTab = 0;
458
477
  }
459
478
  else {
460
479
  this.lengthFromLastTab += run.range.xLength();
461
480
  }
462
481
  }
482
+ this.range.setFrom(this.runRange);
483
+ if (this._marker) {
484
+ const indentation = this.range.low.x;
485
+ const x = indentation - (this._marker.style.tabInterval / 2) - this._marker.range.xLength();
486
+ const runHeight = this._marker.range.yLength();
487
+ const runOffset = {
488
+ x,
489
+ y: (lineHeight - runHeight) / 2 // Center the marker vertically in the line.
490
+ };
491
+ this._marker.offsetFromLine = runOffset;
492
+ const markerRange = this._marker.range.cloneTranslated(this._marker.offsetFromLine);
493
+ this.range.extendRange(markerRange);
494
+ }
463
495
  }
464
- toResult(textBlock) {
496
+ toResult() {
465
497
  return {
466
- sourceParagraphIndex: textBlock.paragraphs.indexOf(this.source),
467
- runs: this.runs.map((x) => x.toResult(this.source)),
498
+ runs: this.runs.map((x) => x.toResult()),
499
+ marker: this.marker?.toResult(),
468
500
  range: this.range.toJSON(),
469
501
  justificationRange: this.justificationRange.toJSON(),
470
502
  offsetFromDocument: this.offsetFromDocument,
@@ -493,12 +525,12 @@ export class TextBlockLayout {
493
525
  this.textRange.high.x = source.width;
494
526
  }
495
527
  this.populateLines(context);
496
- this.justifyLines();
497
- this.applyMargins(source.margins);
528
+ this.justifyLines(context);
529
+ this.applyMargins(context.textStyleResolver.blockSettings.margins);
498
530
  }
499
531
  toResult() {
500
532
  return {
501
- lines: this.lines.map((x) => x.toResult(this.source)),
533
+ lines: this.lines.map((x) => x.toResult()),
502
534
  range: this.range.toJSON(),
503
535
  };
504
536
  }
@@ -512,72 +544,164 @@ export class TextBlockLayout {
512
544
  }
513
545
  populateLines(context) {
514
546
  const doc = this.source;
515
- if (doc.paragraphs.length === 0) {
547
+ if (!doc.children || doc.children.length === 0) {
516
548
  return;
517
549
  }
518
- const doWrap = doc.width > 0;
519
- let curLine = new LineLayout(doc.paragraphs[0]);
520
- for (let i = 0; i < doc.paragraphs.length; i++) {
521
- const paragraph = doc.paragraphs[i];
522
- if (i > 0) {
523
- curLine = this.flushLine(context, curLine, paragraph);
524
- }
525
- let runs = paragraph.runs.map((run) => RunLayout.create(run, paragraph, context));
526
- if (doWrap) {
527
- runs = runs.map((run) => run.split(context)).flat();
528
- }
529
- for (const run of runs) {
530
- if ("linebreak" === run.source.type) {
531
- curLine.append(run);
532
- curLine = this.flushLine(context, curLine);
533
- continue;
550
+ let curLine = new LineLayout(doc.children[0], doc.children[0].styleOverrides, context);
551
+ let childIndex = 0;
552
+ for (const child of doc.children) {
553
+ curLine = this.populateComponent(child, childIndex++, context, doc.width, curLine, doc, doc.styleOverrides);
554
+ }
555
+ if (curLine.runs.length > 0) {
556
+ this.flushLine(context, curLine, doc.styleOverrides);
557
+ }
558
+ }
559
+ populateComponent(component, componentIndex, context, docWidth, curLine, parent, cumulativeOverrides, depth = 0) {
560
+ cumulativeOverrides = { ...cumulativeOverrides, ...component.styleOverrides };
561
+ switch (component.type) {
562
+ case "list": {
563
+ // If we have any runs in the current line, flush it before starting the list.
564
+ if (curLine.runs.length > 0) {
565
+ curLine = this.flushLine(context, curLine, cumulativeOverrides, component.children[0], true, depth + 1);
566
+ }
567
+ else {
568
+ // If not, we need to apply the indentation for the list to the first line.
569
+ curLine.offsetFromDocument.x = context.textStyleResolver.resolveIndentation(cumulativeOverrides, depth + 1);
570
+ curLine.depth = depth + 1;
534
571
  }
535
- // If this is a tab, we need to apply the tab shift first, and then we can treat it like a text run.
536
- applyTabShift(run, curLine, context);
537
- // If our width is not set (doWrap is false), then we don't have to compute word wrapping, so just append the run, and continue.
538
- if (!doWrap) {
539
- curLine.append(run);
540
- continue;
572
+ // Iterate through each list item, setting the marker and populating its contents.
573
+ component.children.forEach((child, index) => {
574
+ const markerContent = context.textStyleResolver.resolveMarkerText(cumulativeOverrides, index + 1);
575
+ const markerRun = TextRun.create({ content: markerContent });
576
+ curLine.marker = RunLayout.create(markerRun, context, cumulativeOverrides);
577
+ curLine = this.populateComponent(child, index, context, docWidth, curLine, component, cumulativeOverrides, depth + 1);
578
+ });
579
+ // Lastly flush the line.
580
+ const nextSibling = parent?.children[componentIndex + 1];
581
+ if (curLine && nextSibling) {
582
+ curLine = this.flushLine(context, curLine, cumulativeOverrides, nextSibling, true, depth);
541
583
  }
542
- // Next, determine if we can append this run to the current line without exceeding the document width
543
- const runWidth = run.range.xLength();
544
- const lineWidth = curLine.range.xLength();
545
- // If true, then no word wrapping is required, so we can append to the current line.
546
- if (runWidth + lineWidth < doc.width || Geometry.isAlmostEqualNumber(runWidth + lineWidth, doc.width, Geometry.smallMetricDistance)) {
547
- curLine.append(run);
548
- continue;
584
+ break;
585
+ }
586
+ case "paragraph": {
587
+ // Iterate through each paragraph child (either a list or a run), populating its contents.
588
+ component.children.forEach((child, index) => {
589
+ curLine = this.populateComponent(child, index, context, docWidth, curLine, component, cumulativeOverrides, depth);
590
+ });
591
+ // Lastly flush the line.
592
+ const nextSibling = parent?.children[componentIndex + 1];
593
+ if (curLine && nextSibling) {
594
+ curLine = this.flushLine(context, curLine, cumulativeOverrides, nextSibling, true, depth);
549
595
  }
550
- // Do word wrapping
551
- if (curLine.runs.length === 0) {
552
- curLine.append(run);
553
- // Lastly, flush line
554
- curLine = this.flushLine(context, curLine);
596
+ break;
597
+ }
598
+ case "text": {
599
+ const layout = RunLayout.create(component, context, cumulativeOverrides);
600
+ // Text can be word-wrapped, so we need to split it into multiple runs if necessary.
601
+ if (docWidth > 0) {
602
+ layout.split(context).forEach(r => { curLine = this.populateRun(curLine, r, context, cumulativeOverrides, docWidth); });
555
603
  }
556
604
  else {
557
- // First, flush line
558
- curLine = this.flushLine(context, curLine);
559
- // Recompute tab shift if applicable
560
- applyTabShift(run, curLine, context);
561
- curLine.append(run);
605
+ curLine = this.populateRun(curLine, layout, context, cumulativeOverrides, docWidth);
562
606
  }
607
+ break;
608
+ }
609
+ case "fraction":
610
+ case "tab": {
611
+ const layout = RunLayout.create(component, context, cumulativeOverrides);
612
+ curLine = this.populateRun(curLine, layout, context, cumulativeOverrides, docWidth);
613
+ break;
563
614
  }
615
+ case "linebreak": {
616
+ const layout = RunLayout.create(component, context, cumulativeOverrides);
617
+ curLine.append(layout);
618
+ curLine = this.flushLine(context, curLine, cumulativeOverrides, undefined, undefined, depth);
619
+ break;
620
+ }
621
+ default: break;
564
622
  }
565
- if (curLine.runs.length > 0) {
566
- this.flushLine(context, curLine);
623
+ return curLine;
624
+ }
625
+ ;
626
+ populateRun(curLine, run, context, cumulativeOverrides, docWidth) {
627
+ // If this is a tab, we need to apply the tab shift first, and then we can treat it like a text run.
628
+ applyTabShift(run, curLine, context);
629
+ // If our width is not set, then we don't have to compute word wrapping, so just append the run, and continue.
630
+ if (docWidth <= 0) {
631
+ curLine.append(run);
632
+ return curLine;
633
+ }
634
+ // If not, we need to determine if we can append this run to the current line without exceeding the document width or if we need to word wrap.
635
+ const runWidth = run.justificationRange?.xLength() ?? run.range.xLength();
636
+ const lineWidth = curLine.runRange.xLength();
637
+ const newWidth = runWidth + lineWidth + curLine.offsetFromDocument.x;
638
+ // If true, then no word wrapping is required, so we can append to the current line.
639
+ if (newWidth < docWidth || Geometry.isAlmostEqualNumber(newWidth, docWidth, Geometry.smallMetricDistance)) {
640
+ curLine.append(run);
641
+ return curLine;
642
+ }
643
+ // If not, do word wrapping
644
+ if (curLine.runs.length === 0) {
645
+ curLine.append(run);
646
+ // Lastly, flush line
647
+ curLine = this.flushLine(context, curLine, cumulativeOverrides, undefined, undefined, curLine.depth);
648
+ }
649
+ else {
650
+ // First, flush line
651
+ curLine = this.flushLine(context, curLine, cumulativeOverrides, undefined, undefined, curLine.depth);
652
+ // Recompute tab shift if applicable
653
+ applyTabShift(run, curLine, context);
654
+ curLine.append(run);
655
+ }
656
+ return curLine;
657
+ }
658
+ ;
659
+ flushLine(context, curLine, cumulativeOverrides, next, newParagraph = false, depth = 0) {
660
+ next = next ?? curLine.source;
661
+ // We want to guarantee that each layout line has at least one run.
662
+ if (curLine.runs.length === 0) {
663
+ if (this.lines.length === 0 || this._back.runs.length === 0) {
664
+ return new LineLayout(next, cumulativeOverrides, context, depth);
665
+ }
666
+ if (curLine.source.type !== "linebreak") {
667
+ const newLine = new LineLayout(next, cumulativeOverrides, context, depth);
668
+ newLine.offsetFromDocument.y -= context.textStyleResolver.blockSettings.paragraphSpacingFactor * context.textStyleResolver.blockSettings.textHeight;
669
+ return newLine;
670
+ }
671
+ const run = curLine.source.clone();
672
+ curLine.append(RunLayout.create(run, context, cumulativeOverrides));
673
+ }
674
+ // Line origin is its baseline.
675
+ const lineOffset = { ...curLine.offsetFromDocument }; // Start with the line's original offset, which includes indentation.
676
+ lineOffset.y -= curLine.range.yLength(); // Shift down the baseline
677
+ // Place it below any existing lines
678
+ if (this.lines.length > 0) {
679
+ lineOffset.y += this._back.offsetFromDocument.y;
680
+ lineOffset.y -= context.textStyleResolver.blockSettings.lineSpacingFactor * context.textStyleResolver.blockSettings.textHeight;
681
+ }
682
+ curLine.offsetFromDocument = lineOffset;
683
+ // Update document range from computed line range and position
684
+ this.textRange.extendRange(curLine.range.cloneTranslated(lineOffset));
685
+ this.lines.push(curLine);
686
+ if (newParagraph) {
687
+ const newLine = new LineLayout(next, cumulativeOverrides, context, depth);
688
+ newLine.offsetFromDocument.y -= context.textStyleResolver.blockSettings.paragraphSpacingFactor * context.textStyleResolver.blockSettings.textHeight;
689
+ return newLine;
567
690
  }
691
+ return new LineLayout(next, cumulativeOverrides, context, depth);
568
692
  }
569
- justifyLines() {
693
+ justifyLines(context) {
570
694
  // We don't want to justify empty text, or a single line of text whose width is 0. By default text is already left justified.
571
- if (this.lines.length < 1 || (this.lines.length === 1 && this.source.width === 0) || "left" === this.source.justification) {
695
+ if (this.lines.length < 1 || (this.lines.length === 1 && this.source.width === 0) || "left" === context.textStyleResolver.blockSettings.justification) {
572
696
  return;
573
697
  }
574
698
  // This is the minimum width of the document's bounding box.
575
699
  const docWidth = this.source.width;
576
700
  let minOffset = Number.MAX_VALUE;
577
701
  for (const line of this.lines) {
578
- const lineWidth = line.justificationRange.xLength();
702
+ const lineWidth = line.justificationRange.xLength() + line.offsetFromDocument.x;
579
703
  let offset = docWidth - lineWidth;
580
- if ("center" === this.source.justification) {
704
+ if ("center" === context.textStyleResolver.blockSettings.justification) {
581
705
  offset = offset / 2;
582
706
  }
583
707
  line.offsetFromDocument.x += offset;
@@ -589,34 +713,6 @@ export class TextBlockLayout {
589
713
  this.textRange.high.x += minOffset;
590
714
  }
591
715
  }
592
- flushLine(context, line, nextParagraph) {
593
- nextParagraph = nextParagraph ?? line.source;
594
- // We want to guarantee that each layout line has at least one run.
595
- if (line.runs.length === 0) {
596
- // If we're empty, there should always be a preceding run, and it should be a line break.
597
- if (this.lines.length === 0 || this._back.runs.length === 0) {
598
- return new LineLayout(nextParagraph);
599
- }
600
- const prevRun = this._back.back.source;
601
- assert(prevRun.type === "linebreak");
602
- if (prevRun.type !== "linebreak") {
603
- return new LineLayout(nextParagraph);
604
- }
605
- line.append(RunLayout.create(prevRun.clone(), line.source, context));
606
- }
607
- // Line origin is its baseline.
608
- const lineOffset = { x: 0, y: -line.range.yLength() };
609
- // Place it below any existing lines
610
- if (this.lines.length > 0) {
611
- lineOffset.y += this._back.offsetFromDocument.y;
612
- lineOffset.y -= context.textStyleResolver.blockSettings.lineSpacingFactor * context.textStyleResolver.blockSettings.lineHeight;
613
- }
614
- line.offsetFromDocument = lineOffset;
615
- // Update document range from computed line range and position
616
- this.textRange.extendRange(line.range.cloneTranslated(lineOffset));
617
- this.lines.push(line);
618
- return new LineLayout(nextParagraph);
619
- }
620
716
  applyMargins(margins) {
621
717
  this.range = this.textRange.clone();
622
718
  if (this.range.isNull)