@itwin/core-common 5.2.0-dev.8 → 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 (404) hide show
  1. package/CHANGELOG.md +52 -1
  2. package/lib/cjs/AmbientOcclusion.js.map +1 -1
  3. package/lib/cjs/AnalysisStyle.js.map +1 -1
  4. package/lib/cjs/Atmosphere.js.map +1 -1
  5. package/lib/cjs/AuthorizationClient.js.map +1 -1
  6. package/lib/cjs/BackgroundMapProvider.js.map +1 -1
  7. package/lib/cjs/BackgroundMapSettings.js.map +1 -1
  8. package/lib/cjs/Base64EncodedString.js.map +1 -1
  9. package/lib/cjs/BlobReader.js.map +1 -1
  10. package/lib/cjs/BriefcaseTypes.d.ts +2 -0
  11. package/lib/cjs/BriefcaseTypes.d.ts.map +1 -1
  12. package/lib/cjs/BriefcaseTypes.js.map +1 -1
  13. package/lib/cjs/Camera.js.map +1 -1
  14. package/lib/cjs/CatalogIModel.js.map +1 -1
  15. package/lib/cjs/CesiumIonAssets.js.map +1 -1
  16. package/lib/cjs/ChangedElements.js.map +1 -1
  17. package/lib/cjs/ChangedEntities.js.map +1 -1
  18. package/lib/cjs/ChangesetProps.js.map +1 -1
  19. package/lib/cjs/ClipStyle.js.map +1 -1
  20. package/lib/cjs/Code.js.map +1 -1
  21. package/lib/cjs/ColorByName.js.map +1 -1
  22. package/lib/cjs/ColorDef.js.map +1 -1
  23. package/lib/cjs/CommonLoggerCategory.js.map +1 -1
  24. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  25. package/lib/cjs/ContextRealityModel.js.map +1 -1
  26. package/lib/cjs/ContourDisplay.js.map +1 -1
  27. package/lib/cjs/DisplayStyleSettings.js.map +1 -1
  28. package/lib/cjs/ECSchemaProps.js.map +1 -1
  29. package/lib/cjs/ECSqlReader.js.map +1 -1
  30. package/lib/cjs/ECSqlTypes.js.map +1 -1
  31. package/lib/cjs/ElementMesh.js.map +1 -1
  32. package/lib/cjs/ElementProps.d.ts +32 -6
  33. package/lib/cjs/ElementProps.d.ts.map +1 -1
  34. package/lib/cjs/ElementProps.js.map +1 -1
  35. package/lib/cjs/EmphasizeElementsProps.js.map +1 -1
  36. package/lib/cjs/EntityProps.js.map +1 -1
  37. package/lib/cjs/EntityReference.js.map +1 -1
  38. package/lib/cjs/Environment.js.map +1 -1
  39. package/lib/cjs/FeatureIndex.js.map +1 -1
  40. package/lib/cjs/FeatureSymbology.d.ts.map +1 -1
  41. package/lib/cjs/FeatureSymbology.js +0 -2
  42. package/lib/cjs/FeatureSymbology.js.map +1 -1
  43. package/lib/cjs/FeatureTable.js.map +1 -1
  44. package/lib/cjs/Fonts.js.map +1 -1
  45. package/lib/cjs/Frustum.js.map +1 -1
  46. package/lib/cjs/GenericInstanceFilter.js.map +1 -1
  47. package/lib/cjs/GeoCoordinateServices.js.map +1 -1
  48. package/lib/cjs/GeometryContainment.js.map +1 -1
  49. package/lib/cjs/GeometryParams.js.map +1 -1
  50. package/lib/cjs/GeometrySummary.js.map +1 -1
  51. package/lib/cjs/Gradient.js.map +1 -1
  52. package/lib/cjs/GraphicParams.js.map +1 -1
  53. package/lib/cjs/GroundPlane.js.map +1 -1
  54. package/lib/cjs/HSLColor.js.map +1 -1
  55. package/lib/cjs/HSVColor.js.map +1 -1
  56. package/lib/cjs/HiddenLine.js.map +1 -1
  57. package/lib/cjs/Hilite.js.map +1 -1
  58. package/lib/cjs/IModel.js.map +1 -1
  59. package/lib/cjs/IModelError.js.map +1 -1
  60. package/lib/cjs/IModelVersion.js.map +1 -1
  61. package/lib/cjs/ITwinCoreErrors.js.map +1 -1
  62. package/lib/cjs/Image.js.map +1 -1
  63. package/lib/cjs/IpcAppProps.js.map +1 -1
  64. package/lib/cjs/LightSettings.js.map +1 -1
  65. package/lib/cjs/LinePixels.js.map +1 -1
  66. package/lib/cjs/Localization.js.map +1 -1
  67. package/lib/cjs/MapImagerySettings.js.map +1 -1
  68. package/lib/cjs/MapLayerSettings.js.map +1 -1
  69. package/lib/cjs/MassProperties.js.map +1 -1
  70. package/lib/cjs/MaterialProps.js.map +1 -1
  71. package/lib/cjs/ModelClipGroup.js.map +1 -1
  72. package/lib/cjs/ModelGeometryChanges.js.map +1 -1
  73. package/lib/cjs/ModelProps.js.map +1 -1
  74. package/lib/cjs/NativeAppProps.js.map +1 -1
  75. package/lib/cjs/OctEncodedNormal.js.map +1 -1
  76. package/lib/cjs/PlanProjectionSettings.js.map +1 -1
  77. package/lib/cjs/PlanarClipMask.js.map +1 -1
  78. package/lib/cjs/QPoint.js.map +1 -1
  79. package/lib/cjs/RealityDataAccessProps.js.map +1 -1
  80. package/lib/cjs/RealityModelDisplaySettings.js.map +1 -1
  81. package/lib/cjs/RenderMaterial.js.map +1 -1
  82. package/lib/cjs/RenderPolyline.js.map +1 -1
  83. package/lib/cjs/RenderTexture.js.map +1 -1
  84. package/lib/cjs/RgbColor.js.map +1 -1
  85. package/lib/cjs/RpcInterface.js.map +1 -1
  86. package/lib/cjs/RpcManager.js.map +1 -1
  87. package/lib/cjs/SessionProps.js.map +1 -1
  88. package/lib/cjs/SkyBox.js.map +1 -1
  89. package/lib/cjs/SolarCalculate.js.map +1 -1
  90. package/lib/cjs/SolarShadows.js.map +1 -1
  91. package/lib/cjs/SpatialClassification.js.map +1 -1
  92. package/lib/cjs/SubCategoryAppearance.js.map +1 -1
  93. package/lib/cjs/SubCategoryOverride.js.map +1 -1
  94. package/lib/cjs/TerrainSettings.js.map +1 -1
  95. package/lib/cjs/TextureMapping.js.map +1 -1
  96. package/lib/cjs/TextureProps.js.map +1 -1
  97. package/lib/cjs/ThematicDisplay.js.map +1 -1
  98. package/lib/cjs/Thumbnail.js.map +1 -1
  99. package/lib/cjs/TileProps.js.map +1 -1
  100. package/lib/cjs/Tween.js.map +1 -1
  101. package/lib/cjs/TxnAction.js.map +1 -1
  102. package/lib/cjs/ViewDetails.js.map +1 -1
  103. package/lib/cjs/ViewFlags.js.map +1 -1
  104. package/lib/cjs/ViewProps.js.map +1 -1
  105. package/lib/cjs/WhiteOnWhiteReversalSettings.js.map +1 -1
  106. package/lib/cjs/annotation/TextAnnotation.d.ts +1 -1
  107. package/lib/cjs/annotation/TextAnnotation.d.ts.map +1 -1
  108. package/lib/cjs/annotation/TextAnnotation.js +1 -1
  109. package/lib/cjs/annotation/TextAnnotation.js.map +1 -1
  110. package/lib/cjs/annotation/TextBlock.d.ts +111 -126
  111. package/lib/cjs/annotation/TextBlock.d.ts.map +1 -1
  112. package/lib/cjs/annotation/TextBlock.js +234 -142
  113. package/lib/cjs/annotation/TextBlock.js.map +1 -1
  114. package/lib/cjs/annotation/TextBlockGeometryProps.js.map +1 -1
  115. package/lib/cjs/annotation/TextBlockLayoutResult.d.ts +3 -5
  116. package/lib/cjs/annotation/TextBlockLayoutResult.d.ts.map +1 -1
  117. package/lib/cjs/annotation/TextBlockLayoutResult.js.map +1 -1
  118. package/lib/cjs/annotation/TextField.d.ts +86 -0
  119. package/lib/cjs/annotation/TextField.d.ts.map +1 -0
  120. package/lib/cjs/annotation/TextField.js +10 -0
  121. package/lib/cjs/annotation/TextField.js.map +1 -0
  122. package/lib/cjs/annotation/TextStyle.d.ts +125 -35
  123. package/lib/cjs/annotation/TextStyle.d.ts.map +1 -1
  124. package/lib/cjs/annotation/TextStyle.js +105 -46
  125. package/lib/cjs/annotation/TextStyle.js.map +1 -1
  126. package/lib/cjs/core-common.d.ts +1 -0
  127. package/lib/cjs/core-common.d.ts.map +1 -1
  128. package/lib/cjs/core-common.js +1 -0
  129. package/lib/cjs/core-common.js.map +1 -1
  130. package/lib/cjs/domains/FunctionalElementProps.js.map +1 -1
  131. package/lib/cjs/domains/GenericElementProps.js.map +1 -1
  132. package/lib/cjs/geometry/AdditionalTransform.js.map +1 -1
  133. package/lib/cjs/geometry/AreaPattern.js.map +1 -1
  134. package/lib/cjs/geometry/BoundingSphere.js.map +1 -1
  135. package/lib/cjs/geometry/Cartographic.js.map +1 -1
  136. package/lib/cjs/geometry/CoordinateReferenceSystem.js.map +1 -1
  137. package/lib/cjs/geometry/ElementGeometry.js.map +1 -1
  138. package/lib/cjs/geometry/ElementGeometryFB.js.map +1 -1
  139. package/lib/cjs/geometry/FrustumPlanes.js.map +1 -1
  140. package/lib/cjs/geometry/GeodeticDatum.js.map +1 -1
  141. package/lib/cjs/geometry/GeodeticEllipsoid.js.map +1 -1
  142. package/lib/cjs/geometry/GeometryStream.js.map +1 -1
  143. package/lib/cjs/geometry/ImageGraphic.js.map +1 -1
  144. package/lib/cjs/geometry/LineStyle.js.map +1 -1
  145. package/lib/cjs/geometry/Placement.js.map +1 -1
  146. package/lib/cjs/geometry/Projection.js.map +1 -1
  147. package/lib/cjs/geometry/TextString.js.map +1 -1
  148. package/lib/cjs/internal/BackendTypes.js.map +1 -1
  149. package/lib/cjs/internal/PackedFeatureTable.js.map +1 -1
  150. package/lib/cjs/internal/RenderMaterialParams.js.map +1 -1
  151. package/lib/cjs/internal/RenderMesh.js.map +1 -1
  152. package/lib/cjs/internal/RenderTextureParams.js.map +1 -1
  153. package/lib/cjs/internal/Snapping.js.map +1 -1
  154. package/lib/cjs/internal/annotations/FieldFormatter.d.ts +18 -0
  155. package/lib/cjs/internal/annotations/FieldFormatter.d.ts.map +1 -0
  156. package/lib/cjs/internal/annotations/FieldFormatter.js +66 -0
  157. package/lib/cjs/internal/annotations/FieldFormatter.js.map +1 -0
  158. package/lib/cjs/internal/cross-package.d.ts +1 -0
  159. package/lib/cjs/internal/cross-package.d.ts.map +1 -1
  160. package/lib/cjs/internal/cross-package.js +4 -1
  161. package/lib/cjs/internal/cross-package.js.map +1 -1
  162. package/lib/cjs/ipc/IpcSession.js.map +1 -1
  163. package/lib/cjs/ipc/IpcSocket.js.map +1 -1
  164. package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
  165. package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
  166. package/lib/cjs/rpc/DevToolsRpcInterface.js.map +1 -1
  167. package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
  168. package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
  169. package/lib/cjs/rpc/SnapshotIModelRpcInterface.js.map +1 -1
  170. package/lib/cjs/rpc/TestRpcManager.js.map +1 -1
  171. package/lib/cjs/rpc/core/RpcConfiguration.js.map +1 -1
  172. package/lib/cjs/rpc/core/RpcConstants.js.map +1 -1
  173. package/lib/cjs/rpc/core/RpcControl.js.map +1 -1
  174. package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
  175. package/lib/cjs/rpc/core/RpcMarshaling.js.map +1 -1
  176. package/lib/cjs/rpc/core/RpcOperation.js.map +1 -1
  177. package/lib/cjs/rpc/core/RpcPendingQueue.js.map +1 -1
  178. package/lib/cjs/rpc/core/RpcProtocol.js.map +1 -1
  179. package/lib/cjs/rpc/core/RpcPush.js.map +1 -1
  180. package/lib/cjs/rpc/core/RpcRegistry.js.map +1 -1
  181. package/lib/cjs/rpc/core/RpcRequest.js.map +1 -1
  182. package/lib/cjs/rpc/core/RpcRequestContext.js.map +1 -1
  183. package/lib/cjs/rpc/core/RpcRoutingToken.js.map +1 -1
  184. package/lib/cjs/rpc/core/RpcSessionInvocation.js.map +1 -1
  185. package/lib/cjs/rpc/web/BentleyCloudRpcManager.js.map +1 -1
  186. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  187. package/lib/cjs/rpc/web/OpenAPI.js.map +1 -1
  188. package/lib/cjs/rpc/web/RpcMultipart.js.map +1 -1
  189. package/lib/cjs/rpc/web/WebAppRpcLogging.js.map +1 -1
  190. package/lib/cjs/rpc/web/WebAppRpcProtocol.js.map +1 -1
  191. package/lib/cjs/rpc/web/WebAppRpcRequest.js.map +1 -1
  192. package/lib/cjs/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
  193. package/lib/cjs/tile/B3dmTileIO.js.map +1 -1
  194. package/lib/cjs/tile/CompositeTileIO.js.map +1 -1
  195. package/lib/cjs/tile/ElementGraphics.js.map +1 -1
  196. package/lib/cjs/tile/GltfTileIO.js.map +1 -1
  197. package/lib/cjs/tile/I3dmTileIO.js.map +1 -1
  198. package/lib/cjs/tile/IModelTileIO.js.map +1 -1
  199. package/lib/cjs/tile/PntsTileIO.js.map +1 -1
  200. package/lib/cjs/tile/TileIO.js.map +1 -1
  201. package/lib/cjs/tile/TileMetadata.js.map +1 -1
  202. package/lib/cjs/tile/Tileset3dSchema.js.map +1 -1
  203. package/lib/esm/AmbientOcclusion.js.map +1 -1
  204. package/lib/esm/AnalysisStyle.js.map +1 -1
  205. package/lib/esm/Atmosphere.js.map +1 -1
  206. package/lib/esm/AuthorizationClient.js.map +1 -1
  207. package/lib/esm/BackgroundMapProvider.js.map +1 -1
  208. package/lib/esm/BackgroundMapSettings.js.map +1 -1
  209. package/lib/esm/Base64EncodedString.js.map +1 -1
  210. package/lib/esm/BlobReader.js.map +1 -1
  211. package/lib/esm/BriefcaseTypes.d.ts +2 -0
  212. package/lib/esm/BriefcaseTypes.d.ts.map +1 -1
  213. package/lib/esm/BriefcaseTypes.js.map +1 -1
  214. package/lib/esm/Camera.js.map +1 -1
  215. package/lib/esm/CatalogIModel.js.map +1 -1
  216. package/lib/esm/CesiumIonAssets.js.map +1 -1
  217. package/lib/esm/ChangedElements.js.map +1 -1
  218. package/lib/esm/ChangedEntities.js.map +1 -1
  219. package/lib/esm/ChangesetProps.js.map +1 -1
  220. package/lib/esm/ClipStyle.js.map +1 -1
  221. package/lib/esm/Code.js.map +1 -1
  222. package/lib/esm/ColorByName.js.map +1 -1
  223. package/lib/esm/ColorDef.js.map +1 -1
  224. package/lib/esm/CommonLoggerCategory.js.map +1 -1
  225. package/lib/esm/ConcurrentQuery.js.map +1 -1
  226. package/lib/esm/ContextRealityModel.js.map +1 -1
  227. package/lib/esm/ContourDisplay.js.map +1 -1
  228. package/lib/esm/DisplayStyleSettings.js.map +1 -1
  229. package/lib/esm/ECSchemaProps.js.map +1 -1
  230. package/lib/esm/ECSqlReader.js.map +1 -1
  231. package/lib/esm/ECSqlTypes.js.map +1 -1
  232. package/lib/esm/ElementMesh.js.map +1 -1
  233. package/lib/esm/ElementProps.d.ts +32 -6
  234. package/lib/esm/ElementProps.d.ts.map +1 -1
  235. package/lib/esm/ElementProps.js.map +1 -1
  236. package/lib/esm/EmphasizeElementsProps.js.map +1 -1
  237. package/lib/esm/EntityProps.js.map +1 -1
  238. package/lib/esm/EntityReference.js.map +1 -1
  239. package/lib/esm/Environment.js.map +1 -1
  240. package/lib/esm/FeatureIndex.js.map +1 -1
  241. package/lib/esm/FeatureSymbology.d.ts.map +1 -1
  242. package/lib/esm/FeatureSymbology.js +0 -2
  243. package/lib/esm/FeatureSymbology.js.map +1 -1
  244. package/lib/esm/FeatureTable.js.map +1 -1
  245. package/lib/esm/Fonts.js.map +1 -1
  246. package/lib/esm/Frustum.js.map +1 -1
  247. package/lib/esm/GenericInstanceFilter.js.map +1 -1
  248. package/lib/esm/GeoCoordinateServices.js.map +1 -1
  249. package/lib/esm/GeometryContainment.js.map +1 -1
  250. package/lib/esm/GeometryParams.js.map +1 -1
  251. package/lib/esm/GeometrySummary.js.map +1 -1
  252. package/lib/esm/Gradient.js.map +1 -1
  253. package/lib/esm/GraphicParams.js.map +1 -1
  254. package/lib/esm/GroundPlane.js.map +1 -1
  255. package/lib/esm/HSLColor.js.map +1 -1
  256. package/lib/esm/HSVColor.js.map +1 -1
  257. package/lib/esm/HiddenLine.js.map +1 -1
  258. package/lib/esm/Hilite.js.map +1 -1
  259. package/lib/esm/IModel.js.map +1 -1
  260. package/lib/esm/IModelError.js.map +1 -1
  261. package/lib/esm/IModelVersion.js.map +1 -1
  262. package/lib/esm/ITwinCoreErrors.js.map +1 -1
  263. package/lib/esm/Image.js.map +1 -1
  264. package/lib/esm/IpcAppProps.js.map +1 -1
  265. package/lib/esm/LightSettings.js.map +1 -1
  266. package/lib/esm/LinePixels.js.map +1 -1
  267. package/lib/esm/Localization.js.map +1 -1
  268. package/lib/esm/MapImagerySettings.js.map +1 -1
  269. package/lib/esm/MapLayerSettings.js.map +1 -1
  270. package/lib/esm/MassProperties.js.map +1 -1
  271. package/lib/esm/MaterialProps.js.map +1 -1
  272. package/lib/esm/ModelClipGroup.js.map +1 -1
  273. package/lib/esm/ModelGeometryChanges.js.map +1 -1
  274. package/lib/esm/ModelProps.js.map +1 -1
  275. package/lib/esm/NativeAppProps.js.map +1 -1
  276. package/lib/esm/OctEncodedNormal.js.map +1 -1
  277. package/lib/esm/PlanProjectionSettings.js.map +1 -1
  278. package/lib/esm/PlanarClipMask.js.map +1 -1
  279. package/lib/esm/QPoint.js.map +1 -1
  280. package/lib/esm/RealityDataAccessProps.js.map +1 -1
  281. package/lib/esm/RealityModelDisplaySettings.js.map +1 -1
  282. package/lib/esm/RenderMaterial.js.map +1 -1
  283. package/lib/esm/RenderPolyline.js.map +1 -1
  284. package/lib/esm/RenderTexture.js.map +1 -1
  285. package/lib/esm/RgbColor.js.map +1 -1
  286. package/lib/esm/RpcInterface.js.map +1 -1
  287. package/lib/esm/RpcManager.js.map +1 -1
  288. package/lib/esm/SessionProps.js.map +1 -1
  289. package/lib/esm/SkyBox.js.map +1 -1
  290. package/lib/esm/SolarCalculate.js.map +1 -1
  291. package/lib/esm/SolarShadows.js.map +1 -1
  292. package/lib/esm/SpatialClassification.js.map +1 -1
  293. package/lib/esm/SubCategoryAppearance.js.map +1 -1
  294. package/lib/esm/SubCategoryOverride.js.map +1 -1
  295. package/lib/esm/TerrainSettings.js.map +1 -1
  296. package/lib/esm/TextureMapping.js.map +1 -1
  297. package/lib/esm/TextureProps.js.map +1 -1
  298. package/lib/esm/ThematicDisplay.js.map +1 -1
  299. package/lib/esm/Thumbnail.js.map +1 -1
  300. package/lib/esm/TileProps.js.map +1 -1
  301. package/lib/esm/Tween.js.map +1 -1
  302. package/lib/esm/TxnAction.js.map +1 -1
  303. package/lib/esm/ViewDetails.js.map +1 -1
  304. package/lib/esm/ViewFlags.js.map +1 -1
  305. package/lib/esm/ViewProps.js.map +1 -1
  306. package/lib/esm/WhiteOnWhiteReversalSettings.js.map +1 -1
  307. package/lib/esm/annotation/TextAnnotation.d.ts +1 -1
  308. package/lib/esm/annotation/TextAnnotation.d.ts.map +1 -1
  309. package/lib/esm/annotation/TextAnnotation.js +1 -1
  310. package/lib/esm/annotation/TextAnnotation.js.map +1 -1
  311. package/lib/esm/annotation/TextBlock.d.ts +111 -126
  312. package/lib/esm/annotation/TextBlock.d.ts.map +1 -1
  313. package/lib/esm/annotation/TextBlock.js +230 -141
  314. package/lib/esm/annotation/TextBlock.js.map +1 -1
  315. package/lib/esm/annotation/TextBlockGeometryProps.js.map +1 -1
  316. package/lib/esm/annotation/TextBlockLayoutResult.d.ts +3 -5
  317. package/lib/esm/annotation/TextBlockLayoutResult.d.ts.map +1 -1
  318. package/lib/esm/annotation/TextBlockLayoutResult.js.map +1 -1
  319. package/lib/esm/annotation/TextField.d.ts +86 -0
  320. package/lib/esm/annotation/TextField.d.ts.map +1 -0
  321. package/lib/esm/annotation/TextField.js +9 -0
  322. package/lib/esm/annotation/TextField.js.map +1 -0
  323. package/lib/esm/annotation/TextStyle.d.ts +125 -35
  324. package/lib/esm/annotation/TextStyle.d.ts.map +1 -1
  325. package/lib/esm/annotation/TextStyle.js +104 -45
  326. package/lib/esm/annotation/TextStyle.js.map +1 -1
  327. package/lib/esm/core-common.d.ts +1 -0
  328. package/lib/esm/core-common.d.ts.map +1 -1
  329. package/lib/esm/core-common.js +1 -0
  330. package/lib/esm/core-common.js.map +1 -1
  331. package/lib/esm/domains/FunctionalElementProps.js.map +1 -1
  332. package/lib/esm/domains/GenericElementProps.js.map +1 -1
  333. package/lib/esm/geometry/AdditionalTransform.js.map +1 -1
  334. package/lib/esm/geometry/AreaPattern.js.map +1 -1
  335. package/lib/esm/geometry/BoundingSphere.js.map +1 -1
  336. package/lib/esm/geometry/Cartographic.js.map +1 -1
  337. package/lib/esm/geometry/CoordinateReferenceSystem.js.map +1 -1
  338. package/lib/esm/geometry/ElementGeometry.js.map +1 -1
  339. package/lib/esm/geometry/ElementGeometryFB.js.map +1 -1
  340. package/lib/esm/geometry/FrustumPlanes.js.map +1 -1
  341. package/lib/esm/geometry/GeodeticDatum.js.map +1 -1
  342. package/lib/esm/geometry/GeodeticEllipsoid.js.map +1 -1
  343. package/lib/esm/geometry/GeometryStream.js.map +1 -1
  344. package/lib/esm/geometry/ImageGraphic.js.map +1 -1
  345. package/lib/esm/geometry/LineStyle.js.map +1 -1
  346. package/lib/esm/geometry/Placement.js.map +1 -1
  347. package/lib/esm/geometry/Projection.js.map +1 -1
  348. package/lib/esm/geometry/TextString.js.map +1 -1
  349. package/lib/esm/internal/BackendTypes.js.map +1 -1
  350. package/lib/esm/internal/PackedFeatureTable.js.map +1 -1
  351. package/lib/esm/internal/RenderMaterialParams.js.map +1 -1
  352. package/lib/esm/internal/RenderMesh.js.map +1 -1
  353. package/lib/esm/internal/RenderTextureParams.js.map +1 -1
  354. package/lib/esm/internal/Snapping.js.map +1 -1
  355. package/lib/esm/internal/annotations/FieldFormatter.d.ts +18 -0
  356. package/lib/esm/internal/annotations/FieldFormatter.d.ts.map +1 -0
  357. package/lib/esm/internal/annotations/FieldFormatter.js +62 -0
  358. package/lib/esm/internal/annotations/FieldFormatter.js.map +1 -0
  359. package/lib/esm/internal/cross-package.d.ts +1 -0
  360. package/lib/esm/internal/cross-package.d.ts.map +1 -1
  361. package/lib/esm/internal/cross-package.js +1 -0
  362. package/lib/esm/internal/cross-package.js.map +1 -1
  363. package/lib/esm/ipc/IpcSession.js.map +1 -1
  364. package/lib/esm/ipc/IpcSocket.js.map +1 -1
  365. package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
  366. package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
  367. package/lib/esm/rpc/DevToolsRpcInterface.js.map +1 -1
  368. package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
  369. package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
  370. package/lib/esm/rpc/SnapshotIModelRpcInterface.js.map +1 -1
  371. package/lib/esm/rpc/TestRpcManager.js.map +1 -1
  372. package/lib/esm/rpc/core/RpcConfiguration.js.map +1 -1
  373. package/lib/esm/rpc/core/RpcConstants.js.map +1 -1
  374. package/lib/esm/rpc/core/RpcControl.js.map +1 -1
  375. package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
  376. package/lib/esm/rpc/core/RpcMarshaling.js.map +1 -1
  377. package/lib/esm/rpc/core/RpcOperation.js.map +1 -1
  378. package/lib/esm/rpc/core/RpcPendingQueue.js.map +1 -1
  379. package/lib/esm/rpc/core/RpcProtocol.js.map +1 -1
  380. package/lib/esm/rpc/core/RpcPush.js.map +1 -1
  381. package/lib/esm/rpc/core/RpcRegistry.js.map +1 -1
  382. package/lib/esm/rpc/core/RpcRequest.js.map +1 -1
  383. package/lib/esm/rpc/core/RpcRequestContext.js.map +1 -1
  384. package/lib/esm/rpc/core/RpcRoutingToken.js.map +1 -1
  385. package/lib/esm/rpc/core/RpcSessionInvocation.js.map +1 -1
  386. package/lib/esm/rpc/web/BentleyCloudRpcManager.js.map +1 -1
  387. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  388. package/lib/esm/rpc/web/OpenAPI.js.map +1 -1
  389. package/lib/esm/rpc/web/RpcMultipart.js.map +1 -1
  390. package/lib/esm/rpc/web/WebAppRpcLogging.js.map +1 -1
  391. package/lib/esm/rpc/web/WebAppRpcProtocol.js.map +1 -1
  392. package/lib/esm/rpc/web/WebAppRpcRequest.js.map +1 -1
  393. package/lib/esm/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
  394. package/lib/esm/tile/B3dmTileIO.js.map +1 -1
  395. package/lib/esm/tile/CompositeTileIO.js.map +1 -1
  396. package/lib/esm/tile/ElementGraphics.js.map +1 -1
  397. package/lib/esm/tile/GltfTileIO.js.map +1 -1
  398. package/lib/esm/tile/I3dmTileIO.js.map +1 -1
  399. package/lib/esm/tile/IModelTileIO.js.map +1 -1
  400. package/lib/esm/tile/PntsTileIO.js.map +1 -1
  401. package/lib/esm/tile/TileIO.js.map +1 -1
  402. package/lib/esm/tile/TileMetadata.js.map +1 -1
  403. package/lib/esm/tile/Tileset3dSchema.js.map +1 -1
  404. package/package.json +6 -6
@@ -5,26 +5,36 @@
5
5
  /** @packageDocumentation
6
6
  * @module Annotation
7
7
  */
8
- import { TextStyleSettings } from "./TextStyle";
9
- /** Abstract representation of any of the building blocks that make up a [[TextBlock]] document - namely [[Run]]s, [[Paragraph]]s, and [[TextBlock]] itself.
10
- * The [[TextBlock]] can specify an [AnnotationTextStyle]($backend) that formats its contents. Each component can specify an optional [[styleOverrides]] to customize that formatting.
8
+ import { ListMarkerEnumerator, TextStyleSettings } from "./TextStyle";
9
+ function clearStyleOverrides(component, options) {
10
+ component.styleOverrides = {};
11
+ if (!options?.preserveChildrenOverrides) {
12
+ for (const child of component.children) {
13
+ child.clearStyleOverrides(options);
14
+ }
15
+ }
16
+ }
17
+ /**
18
+ * Abstract representation of any of the building blocks that make up a [[TextBlock]] document - namely [[Run]]s and [[StructuralTextBlockComponent]]s.
19
+ * The [[TextBlock]] can specify an [AnnotationTextStyle]($backend) that formats its contents.
20
+ * Each component can specify an optional [[styleOverrides]] to customize that formatting.
11
21
  * @beta
12
22
  */
13
23
  export class TextBlockComponent {
14
24
  _styleOverrides;
15
25
  /** @internal */
16
26
  constructor(props) {
17
- this._styleOverrides = TextStyleSettings.cloneProps(props?.styleOverrides ?? {});
27
+ this._styleOverrides = structuredClone(props?.styleOverrides ?? {});
18
28
  }
19
- /** Deviations in individual properties of the [[TextStyleSettings]] in the [AnnotationTextStyle]($backend) specified by `styleId` on the [[TextBlock]].
20
- * For example, if the style uses the "Arial" font, you can override that by settings `styleOverrides.fontName` to "Comic Sans".
29
+ /** Deviations in individual properties of the [[TextStyleSettings]] in the [AnnotationTextStyle]($backend).
30
+ * For example, if the style uses the "Arial" font, you can override that by settings `styleOverrides.font.name` to "Comic Sans".
21
31
  * @see [[clearStyleOverrides]] to reset this to an empty object.
22
32
  */
23
33
  get styleOverrides() {
24
34
  return this._styleOverrides;
25
35
  }
26
36
  set styleOverrides(overrides) {
27
- this._styleOverrides = TextStyleSettings.cloneProps(overrides);
37
+ this._styleOverrides = structuredClone(overrides);
28
38
  }
29
39
  /** Reset any [[styleOverrides]] applied to this component. */
30
40
  clearStyleOverrides(_options) {
@@ -45,23 +55,14 @@ export class TextBlockComponent {
45
55
  /** Convert this component to its JSON representation. */
46
56
  toJSON() {
47
57
  return {
48
- styleOverrides: TextStyleSettings.cloneProps(this.styleOverrides),
58
+ styleOverrides: structuredClone(this.styleOverrides),
49
59
  };
50
60
  }
51
61
  /** Returns true if `this` is equivalent to `other`. */
52
62
  equals(other) {
53
- const myKeys = Object.keys(this.styleOverrides);
54
- const yrKeys = Object.keys(other._styleOverrides);
55
- if (myKeys.length !== yrKeys.length) {
56
- return false;
57
- }
58
- for (const name of myKeys) {
59
- const key = name;
60
- if (this.styleOverrides[key] !== other.styleOverrides[key]) {
61
- return false;
62
- }
63
- }
64
- return true;
63
+ const mySettings = TextStyleSettings.fromJSON(this.styleOverrides);
64
+ const otherSettings = TextStyleSettings.fromJSON(other.styleOverrides);
65
+ return mySettings.equals(otherSettings);
65
66
  }
66
67
  }
67
68
  /** A sequence of characters within a [[Paragraph]] that share a single style. Runs are the leaf nodes of a [[TextBlock]] document. When laid out for display, a single run may span
@@ -72,15 +73,15 @@ export class TextBlockComponent {
72
73
  export var Run;
73
74
  (function (Run) {
74
75
  /** Create a run from its JSON representation.
75
- * @see [[TextRun.create]], [[FractionRun.create]], and [[LineBreakRun.create]] to create a run directly.
76
+ * @see [[TextRun.create]], [[FractionRun.create]], [[FieldRun.create]], [[TabRun.create]], and [[LineBreakRun.create]] to create a run directly.
76
77
  */
77
78
  function fromJSON(props) {
78
79
  switch (props.type) {
79
- case "text": return TextRun.create(props);
80
+ case "field": return FieldRun.create(props);
80
81
  case "fraction": return FractionRun.create(props);
81
- case "tab": return TabRun.create(props);
82
82
  case "linebreak": return LineBreakRun.create(props);
83
- case "field": return FieldRun.create(props);
83
+ case "tab": return TabRun.create(props);
84
+ case "text": return TextRun.create(props);
84
85
  }
85
86
  }
86
87
  Run.fromJSON = fromJSON;
@@ -112,7 +113,10 @@ export class TextRun extends TextBlockComponent {
112
113
  };
113
114
  }
114
115
  static create(props) {
115
- return new TextRun(props);
116
+ return new TextRun({ ...props, type: "text" });
117
+ }
118
+ get isEmpty() {
119
+ return this.stringify().length === 0;
116
120
  }
117
121
  /** Simply returns [[content]]. */
118
122
  stringify() {
@@ -150,7 +154,10 @@ export class FractionRun extends TextBlockComponent {
150
154
  return new FractionRun(this.toJSON());
151
155
  }
152
156
  static create(props) {
153
- return new FractionRun(props);
157
+ return new FractionRun({ ...props, type: "fraction" });
158
+ }
159
+ get isEmpty() {
160
+ return this.stringify().length === 0;
154
161
  }
155
162
  /** Formats the fraction as a string with the [[numerator]] and [[denominator]] separated by [[TextBlockStringifyOptions.fractionSeparator]]. */
156
163
  stringify(options) {
@@ -177,11 +184,14 @@ export class LineBreakRun extends TextBlockComponent {
177
184
  };
178
185
  }
179
186
  static create(props) {
180
- return new LineBreakRun(props);
187
+ return new LineBreakRun({ ...props, type: "linebreak" });
181
188
  }
182
189
  clone() {
183
190
  return new LineBreakRun(this.toJSON());
184
191
  }
192
+ get isEmpty() {
193
+ return this.stringify().length === 0;
194
+ }
185
195
  /** Simply returns [[TextBlockStringifyOptions.lineBreak]]. */
186
196
  stringify(options) {
187
197
  return options?.lineBreak ?? " ";
@@ -209,6 +219,9 @@ export class TabRun extends TextBlockComponent {
209
219
  static create(props) {
210
220
  return new TabRun(props);
211
221
  }
222
+ get isEmpty() {
223
+ return this.stringify().length === 0;
224
+ }
212
225
  /**
213
226
  * Converts a [[TabRun]] to its string representation.
214
227
  * If the `tabsAsSpaces` option is provided, returns a string of spaces of the specified length.
@@ -227,7 +240,8 @@ export class TabRun extends TextBlockComponent {
227
240
  /** A [[Run]] that displays the formatted value of a property of some [Element]($backend).
228
241
  * When a [[TextBlock]] containing a [[FieldRun]] is written into the iModel as an [ITextAnnotation]($backend) element,
229
242
  * a dependency is established between the two elements via the [ElementDrivesTextAnnotation]($backend) relationship such that
230
- * whenever the source element specified by [[propertyHost]] is modified, the field(s) in the `ITextAnnotation` element are automatically
243
+ * whenever the source element specified by [[propertyHost]] is modified or the `ITextAnnotation` element is inserted or updated in the iModel,
244
+ * the field(s) in the `ITextAnnotation` element are automatically
231
245
  * recalculated, causing their [[cachedContent]] to update. If the field's display string cannot be evaluated (for example, because the specified element or
232
246
  * property does not exist), then its cached content is set to [[FieldRun.invalidContentIndicator]].
233
247
  * A [[FieldRun]] displays its [[cachedContent]] in the same way that [[TextRun]]s display their `content`, including word wrapping where appropriate.
@@ -242,8 +256,10 @@ export class FieldRun extends TextBlockComponent {
242
256
  propertyHost;
243
257
  /** Describes how to obtain the property value from [[propertyHost]]. */
244
258
  propertyPath;
245
- /** Specifies how to format the property value obtained from [[propertyPath]] into a string to be stored in [[cachedContent]]. */
246
- formatter;
259
+ /** Specifies how to format the property value obtained from [[propertyPath]] into a string to be stored in [[cachedContent]].
260
+ * The specific options used depend upon the [[FieldPropertyType]].
261
+ */
262
+ formatOptions;
247
263
  _cachedContent;
248
264
  /** The field's most recently evaluated display string. */
249
265
  get cachedContent() {
@@ -258,7 +274,7 @@ export class FieldRun extends TextBlockComponent {
258
274
  this._cachedContent = props.cachedContent ?? FieldRun.invalidContentIndicator;
259
275
  this.propertyHost = props.propertyHost;
260
276
  this.propertyPath = props.propertyPath;
261
- this.formatter = props.formatter;
277
+ this.formatOptions = props.formatOptions;
262
278
  }
263
279
  /** Create a FieldRun from its JSON representation. */
264
280
  static create(props) {
@@ -266,7 +282,8 @@ export class FieldRun extends TextBlockComponent {
266
282
  ...props,
267
283
  propertyHost: { ...props.propertyHost },
268
284
  propertyPath: structuredClone(props.propertyPath),
269
- formatter: structuredClone(props.formatter),
285
+ formatOptions: structuredClone(props.formatOptions),
286
+ type: "field",
270
287
  });
271
288
  }
272
289
  /** Convert the FieldRun to its JSON representation. */
@@ -280,8 +297,8 @@ export class FieldRun extends TextBlockComponent {
280
297
  if (this.cachedContent !== FieldRun.invalidContentIndicator) {
281
298
  json.cachedContent = this.cachedContent;
282
299
  }
283
- if (this.formatter) {
284
- json.formatter = structuredClone(this.formatter);
300
+ if (this.formatOptions) {
301
+ json.formatOptions = structuredClone(this.formatOptions);
285
302
  }
286
303
  return json;
287
304
  }
@@ -289,6 +306,9 @@ export class FieldRun extends TextBlockComponent {
289
306
  clone() {
290
307
  return new FieldRun(this.toJSON());
291
308
  }
309
+ get isEmpty() {
310
+ return this.stringify().length === 0;
311
+ }
292
312
  /** Convert this FieldRun to a simple string representation. */
293
313
  stringify() {
294
314
  return this.cachedContent;
@@ -308,194 +328,263 @@ export class FieldRun extends TextBlockComponent {
308
328
  }
309
329
  const thisAccessors = this.propertyPath.accessors ?? [];
310
330
  const otherAccessors = other.propertyPath.accessors ?? [];
311
- const thisJsonAccessors = this.propertyPath.jsonAccessors ?? [];
312
- const otherJsonAccessors = other.propertyPath.jsonAccessors ?? [];
313
- if (thisAccessors.length !== otherAccessors.length || thisJsonAccessors.length !== otherJsonAccessors.length) {
331
+ if (thisAccessors.length !== otherAccessors.length) {
314
332
  return false;
315
333
  }
316
334
  if (!thisAccessors.every((value, index) => value === otherAccessors[index])) {
317
335
  return false;
318
336
  }
319
- if (!thisJsonAccessors.every((value, index) => value === otherJsonAccessors[index])) {
320
- return false;
321
- }
322
- if (this.formatter && other.formatter) {
323
- // ###TODO better comparison of formatter objects.
324
- if (JSON.stringify(this.formatter) !== JSON.stringify(other.formatter)) {
337
+ if (this.formatOptions && other.formatOptions) {
338
+ // We anticipate new formatting options being added in the future.
339
+ // So to account for properties we don't know about, just compare the string representations.
340
+ if (JSON.stringify(this.formatOptions) !== JSON.stringify(other.formatOptions)) {
325
341
  return false;
326
342
  }
327
343
  }
328
- else if (this.formatter || other.formatter) {
344
+ else if (this.formatOptions || other.formatOptions) {
329
345
  return false;
330
346
  }
331
347
  return true;
332
348
  }
333
349
  }
334
- /** A collection of [[Run]]s within a [[TextBlock]]. Each paragraph within a text block is laid out on a separate line.
350
+ /** A collection of [[Run]]s and [[List]]s. Paragraphs can be appended to [[List]]s and [[TextBlock]]s.
351
+ * Each paragraph is laid out on a separate line. If included in a [[List]], the paragraph will be treated as a list item.
335
352
  * @beta
336
353
  */
337
354
  export class Paragraph extends TextBlockComponent {
338
- /** The runs within the paragraph. You can modify the contents of this array to change the content of the paragraph. */
339
- runs;
355
+ type = "paragraph";
356
+ children;
340
357
  constructor(props) {
341
358
  super(props);
342
- this.runs = props?.runs?.map((run) => Run.fromJSON(run)) ?? [];
359
+ this.children = props?.children?.map((child) => child.type === "list" ? List.create(child) : Run.fromJSON(child)) ?? [];
360
+ }
361
+ /** Create a paragraph from its JSON representation. */
362
+ static create(props) {
363
+ return new Paragraph(props);
364
+ }
365
+ clearStyleOverrides(options) {
366
+ clearStyleOverrides(this, options);
367
+ }
368
+ get isEmpty() {
369
+ return this.children.length === 0;
370
+ }
371
+ clone() {
372
+ return new Paragraph(this.toJSON());
343
373
  }
344
374
  toJSON() {
345
375
  return {
346
376
  ...super.toJSON(),
347
- runs: this.runs.map((run) => run.toJSON()),
377
+ children: this.children.map((child) => child.toJSON()),
348
378
  };
349
379
  }
350
- /** Create a paragraph from its JSON representation. */
380
+ /** Compute a string representation of this paragraph by concatenating the string representations of all of its children. */
381
+ stringify(options, context) {
382
+ return this.children.map((x, index) => (index > 0 && x.type === "list") ? `${options?.paragraphBreak ?? " "}${x.stringify(options, context)}` : x.stringify(options, context)).join("") ?? "";
383
+ }
384
+ equals(other) {
385
+ return (other instanceof Paragraph) && super.equals(other);
386
+ }
387
+ }
388
+ /** A collection of list items ([[Paragraph]]s). Lists can be appended to [[Paragraph]]s.
389
+ * Lists will be laid out on a new line. Each item in a list is laid out on a separate line.
390
+ * @beta
391
+ */
392
+ export class List extends TextBlockComponent {
393
+ type = "list";
394
+ children;
395
+ constructor(props) {
396
+ super(props);
397
+ this.children = props?.children?.map((child) => Paragraph.create(child)) ?? [];
398
+ }
399
+ /** Create a list from its JSON representation. */
351
400
  static create(props) {
352
- return new Paragraph(props);
401
+ return new List({ ...props, type: "list" });
402
+ }
403
+ clearStyleOverrides(options) {
404
+ clearStyleOverrides(this, options);
405
+ }
406
+ get isEmpty() {
407
+ return this.children.length === 0;
353
408
  }
354
409
  clone() {
355
- return new Paragraph(this.toJSON());
410
+ return new List(this.toJSON());
356
411
  }
357
- /**
358
- * Clears any [[styleOverrides]] applied to this Paragraph.
359
- * Will also clear [[styleOverrides]] from all child components unless [[ClearTextStyleOptions.preserveChildrenOverrides]] is `true`.
360
- */
361
- clearStyleOverrides(options) {
362
- super.clearStyleOverrides();
363
- if (options?.preserveChildrenOverrides)
364
- return;
365
- for (const run of this.runs) {
366
- run.clearStyleOverrides();
367
- }
412
+ toJSON() {
413
+ return {
414
+ ...super.toJSON(),
415
+ type: "list",
416
+ children: this.children.map((run) => run.toJSON()),
417
+ };
368
418
  }
369
- /** Compute a string representation of this paragraph by concatenating the string representations of all of its [[runs]]. */
370
- stringify(options) {
371
- return this.runs.map((x) => x.stringify(options)).join("");
419
+ /** Compute a string representation of this list by concatenating the string representations of all of its [[children]]. */
420
+ stringify(options, context) {
421
+ const children = this.children.map((x, index) => {
422
+ const depth = context?.depth ?? 0;
423
+ const marker = getMarkerText(this.styleOverrides.listMarker ?? TextStyleSettings.defaultProps.listMarker, index + 1);
424
+ const tab = (options?.tabsAsSpaces ? " ".repeat(options.tabsAsSpaces) : "\t").repeat(depth);
425
+ return `${tab}${marker}${options?.listMarkerBreak ?? " "}${x.stringify(options, { depth: depth + 1 })}`;
426
+ });
427
+ return children.join(options?.paragraphBreak ?? " ") ?? "";
372
428
  }
373
429
  equals(other) {
374
- if (!(other instanceof Paragraph)) {
375
- return false;
376
- }
377
- if (this.runs.length !== other.runs.length || !super.equals(other)) {
378
- return false;
379
- }
380
- return this.runs.every((run, index) => run.equals(other.runs[index]));
430
+ return (other instanceof List) && super.equals(other);
381
431
  }
382
432
  }
383
- ;
384
- /** Represents a formatted text document consisting of a series of [[Paragraph]]s, each laid out on a separate line and containing their own content in the form of [[Run]]s.
385
- * You can change the content of the document by directly modifying the contents of its [[paragraphs]], or via [[appendParagraph]] and [[appendRun]].
433
+ /** Represents a formatted text document consisting of a series of [[Paragraph]]s, each laid out on a separate line and containing their own content.
386
434
  * No word-wrapping is applied to the document unless a [[width]] greater than zero is specified.
387
435
  * @see [[TextAnnotation]] to position a text block as an annotation in 2d or 3d space.
388
436
  * @beta
389
437
  */
390
438
  export class TextBlock extends TextBlockComponent {
391
- /** The ID of the [AnnotationTextStyle]($backend) that provides the base formatting for the contents of this TextBlock.
392
- * @note Assigning to this property retains all style overrides on the TextBlock and its child components.
393
- * Call [[clearStyleOverrides]] to clear the TextBlock's and optionally all children's style overrides.
394
- */
395
- styleId;
439
+ children;
396
440
  /** The width of the document in meters. Lines that would exceed this width are instead wrapped around to the next line if possible.
397
441
  * A value less than or equal to zero indicates no wrapping is to be applied.
398
442
  * Default: 0
399
443
  */
400
444
  width;
401
- /** The alignment of the document's content. */
402
- justification;
403
- /** The margins of the document. */
404
- margins;
405
- /** The ordered list of paragraphs within the document. */
406
- paragraphs;
407
445
  constructor(props) {
408
446
  super(props);
409
- this.styleId = props.styleId;
410
447
  this.width = props.width ?? 0;
411
- this.justification = props.justification ?? "left";
412
- // Assign default margins if not provided
413
- this.margins = {
414
- left: props.margins?.left ?? 0,
415
- right: props.margins?.right ?? 0,
416
- top: props.margins?.top ?? 0,
417
- bottom: props.margins?.bottom ?? 0,
418
- };
419
- this.paragraphs = props.paragraphs?.map((x) => Paragraph.create(x)) ?? [];
448
+ this.children = props?.children?.map((para) => Paragraph.create(para)) ?? [];
449
+ }
450
+ clearStyleOverrides(options) {
451
+ clearStyleOverrides(this, options);
420
452
  }
421
453
  toJSON() {
422
454
  return {
423
455
  ...super.toJSON(),
424
- styleId: this.styleId,
425
456
  width: this.width,
426
- justification: this.justification,
427
- margins: this.margins,
428
- paragraphs: this.paragraphs.map((x) => x.toJSON()),
457
+ children: this.children.map((x) => x.toJSON()),
429
458
  };
430
459
  }
431
460
  /** Create a text block from its JSON representation. */
432
461
  static create(props) {
433
- return new TextBlock(props);
434
- }
435
- /** Create an empty text block containing no [[paragraphs]] and an empty [[styleId]]. */
436
- static createEmpty() {
437
- return TextBlock.create({ styleId: "" });
462
+ return new TextBlock(props ?? {});
438
463
  }
439
464
  /** Returns true if every paragraph in this text block is empty. */
440
465
  get isEmpty() {
441
- return this.paragraphs.every((p) => p.runs.length === 0);
466
+ return !this.children || this.children.every((child) => child.isEmpty);
442
467
  }
443
468
  clone() {
444
469
  return new TextBlock(this.toJSON());
445
470
  }
446
- /**
447
- * Clears any [[styleOverrides]] applied to this TextBlock.
448
- * Will also clear [[styleOverrides]] from all child components unless [[ClearTextStyleOptions.preserveChildrenOverrides]] is `true`.
449
- */
450
- clearStyleOverrides(options) {
451
- super.clearStyleOverrides();
452
- if (options?.preserveChildrenOverrides)
453
- return;
454
- for (const paragraph of this.paragraphs) {
455
- paragraph.clearStyleOverrides();
456
- }
457
- }
458
- /** Compute a string representation of the document's contents by concatenating the string representations of each of its [[paragraphs]], separated by [[TextBlockStringifyOptions.paragraphBreak]]. */
471
+ /** Compute a string representation of the document's contents by concatenating the string representations of each of its [[children]], separated by [[TextBlockStringifyOptions.paragraphBreak]]. */
459
472
  stringify(options) {
460
- return this.paragraphs.map((x) => x.stringify(options)).join(options?.paragraphBreak ?? " ");
473
+ return this.children.map((x) => x.stringify(options)).join(options?.paragraphBreak ?? " ") || "";
461
474
  }
462
475
  /** Add and return a new paragraph.
463
476
  * By default, the paragraph will be created with no [[styleOverrides]], so that it inherits the style of this block.
464
- * @param seedFromLast If true and [[paragraphs]] is not empty, the new paragraph will inherit the style overrides of the last [[Paragraph]] in this block.
477
+ * @param seedFromLast If true and [[children]] is not empty, the new paragraph will inherit the style overrides of the last child in this block.
478
+ * @note Be sure you pass in [[ParagraphProps]] and not [[Paragraph]] or style overrides will be ignored.
465
479
  */
466
- appendParagraph(seedFromLast = false) {
467
- let styleOverrides = {};
468
- if (seedFromLast && this.paragraphs.length > 0) {
469
- const seed = this.paragraphs[this.paragraphs.length - 1];
470
- styleOverrides = { ...seed.styleOverrides };
471
- }
472
- const paragraph = Paragraph.create({
473
- styleOverrides
474
- });
475
- this.paragraphs.push(paragraph);
480
+ appendParagraph(props, seedFromLast = false) {
481
+ const seed = seedFromLast ? this.children[this.children.length - 1] : undefined;
482
+ const styleOverrides = { ...seed?.styleOverrides, ...props?.styleOverrides };
483
+ const paragraph = Paragraph.create({ ...props, styleOverrides });
484
+ this.children.push(paragraph);
476
485
  return paragraph;
477
486
  }
478
487
  /** Append a run to the last [[Paragraph]] in this block.
479
- * If the block contains no [[paragraphs]], a new one will first be created using [[appendParagraph]].
488
+ * If the block contains no [[children]], a new [[Paragraph]] will first be created using [[appendParagraph]].
480
489
  */
481
490
  appendRun(run) {
482
- const paragraph = this.paragraphs[this.paragraphs.length - 1] ?? this.appendParagraph();
483
- paragraph.runs.push(run);
491
+ const paragraph = this.children[this.children.length - 1] ?? this.appendParagraph();
492
+ paragraph.children.push(run);
484
493
  }
485
494
  equals(other) {
486
495
  if (!(other instanceof TextBlock)) {
487
496
  return false;
488
497
  }
489
- if (this.styleId !== other.styleId || !super.equals(other)) {
498
+ if (!super.equals(other)) {
490
499
  return false;
491
500
  }
492
- if (this.width !== other.width || this.justification !== other.justification || this.paragraphs.length !== other.paragraphs.length) {
501
+ if (this.width !== other.width) {
493
502
  return false;
494
503
  }
495
- const marginsAreEqual = Object.entries(this.margins).every(([key, value]) => value === other.margins[key]);
496
- if (!marginsAreEqual)
497
- return false;
498
- return this.paragraphs.every((paragraph, index) => paragraph.equals(other.paragraphs[index]));
504
+ if (this.children && other.children) {
505
+ if (this.children.length !== other.children.length) {
506
+ return false;
507
+ }
508
+ return this.children.every((child, index) => other.children && child.equals(other.children[index]));
509
+ }
510
+ return true;
499
511
  }
500
512
  }
513
+ /**
514
+ * Recursively traverses a [[StructuralTextBlockComponent]] tree, yielding each child component along with its parent container.
515
+ * This generator enables depth-first iteration over all components in a text block structure, including paragraphs, lists, and runs.
516
+ *
517
+ * @param parent The root container whose children should be traversed.
518
+ * @returns An IterableIterator yielding objects with the child component and its parent container.
519
+ * @beta
520
+ */
521
+ export function* traverseTextBlockComponent(parent) {
522
+ for (const child of parent.children) {
523
+ yield { parent, child };
524
+ if (child.type === "list" || child.type === "paragraph") {
525
+ yield* traverseTextBlockComponent(child);
526
+ }
527
+ }
528
+ }
529
+ /**
530
+ * Returns the formatted marker text for a list item based on the marker type and item number.
531
+ * Supports ordered and unordered list markers, including alphabetic, Roman numeral, and numeric formats.
532
+ * @param marker The type of list marker to use.
533
+ * @param num The item number in the list.
534
+ * @returns The formatted marker string for the list item.
535
+ * @beta
536
+ */
537
+ export function getMarkerText(marker, num) {
538
+ let markerString = "";
539
+ switch (marker.enumerator) {
540
+ case undefined:
541
+ case ListMarkerEnumerator.Number:
542
+ markerString = `${num}`;
543
+ break;
544
+ case ListMarkerEnumerator.Letter:
545
+ markerString = integerToAlpha(num);
546
+ break;
547
+ case ListMarkerEnumerator.RomanNumeral:
548
+ markerString = integerToRoman(num);
549
+ break;
550
+ default:
551
+ markerString = marker.enumerator;
552
+ break;
553
+ }
554
+ if (marker.case) {
555
+ markerString = marker.case === "upper" ? markerString.toUpperCase() : markerString.toLowerCase();
556
+ }
557
+ const terminator = marker.terminator === "period" ? "." : marker.terminator === "parenthesis" ? ")" : "";
558
+ return `${markerString}${terminator}`;
559
+ }
560
+ /**
561
+ * Converts an integer to its Roman numeral representation.
562
+ * Supports numbers from 1 and above.
563
+ * @param num The integer to convert.
564
+ * @returns The Roman numeral string.
565
+ */
566
+ function integerToRoman(num) {
567
+ const values = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
568
+ const symbols = ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'];
569
+ let roman = '';
570
+ for (let i = 0; i < values.length; i++) {
571
+ while (num >= values[i]) {
572
+ roman += symbols[i];
573
+ num -= values[i];
574
+ }
575
+ }
576
+ return roman;
577
+ }
578
+ /**
579
+ * Converts an integer to its alphabetic representation (A-Z, AA-ZZ, etc.).
580
+ * Used for ordered list markers with alphabetic styles.
581
+ * @param num The integer to convert (1-based).
582
+ * @returns The alphabetic string for the given number.
583
+ */
584
+ function integerToAlpha(num) {
585
+ const letterOffset = (num - 1) % 26;
586
+ const letter = String.fromCharCode(65 + letterOffset);
587
+ const depth = Math.ceil(num / 26);
588
+ return letter.repeat(depth);
589
+ }
501
590
  //# sourceMappingURL=TextBlock.js.map