@fluidframework/tree 2.110.0 → 2.111.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 (374) hide show
  1. package/.vscode/settings.json +1 -0
  2. package/CHANGELOG.md +48 -0
  3. package/api-report/tree.alpha.api.md +48 -31
  4. package/api-report/tree.beta.api.md +38 -0
  5. package/api-report/tree.legacy.beta.api.md +38 -0
  6. package/dist/core/change-family/changeFamily.d.ts +3 -10
  7. package/dist/core/change-family/changeFamily.d.ts.map +1 -1
  8. package/dist/core/change-family/changeFamily.js.map +1 -1
  9. package/dist/core/rebase/types.d.ts +2 -2
  10. package/dist/core/rebase/types.js.map +1 -1
  11. package/dist/core/schema-stored/storedSchemaRepository.d.ts +2 -2
  12. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  13. package/dist/entrypoints/alpha.d.ts +1 -1
  14. package/dist/entrypoints/alpha.d.ts.map +1 -1
  15. package/dist/entrypoints/alpha.js.map +1 -1
  16. package/dist/entrypoints/beta.d.ts +1 -1
  17. package/dist/entrypoints/beta.d.ts.map +1 -1
  18. package/dist/entrypoints/beta.js.map +1 -1
  19. package/dist/entrypoints/legacy.d.ts +1 -1
  20. package/dist/entrypoints/legacy.d.ts.map +1 -1
  21. package/dist/entrypoints/legacy.js.map +1 -1
  22. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +19 -14
  23. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  24. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +13 -32
  25. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  26. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +85 -28
  27. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  28. package/dist/feature-libraries/chunked-forest/codec/codecs.js +83 -9
  29. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  30. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
  31. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  32. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +11 -0
  33. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  34. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  35. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  36. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
  37. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  38. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
  39. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  40. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
  41. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  42. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  43. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  44. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  45. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  46. package/dist/feature-libraries/forest-summary/codec.d.ts +3 -3
  47. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  48. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  49. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
  50. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  51. package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -6
  52. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  53. package/dist/feature-libraries/index.d.ts +1 -1
  54. package/dist/feature-libraries/index.d.ts.map +1 -1
  55. package/dist/feature-libraries/index.js +2 -1
  56. package/dist/feature-libraries/index.js.map +1 -1
  57. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  58. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +9 -9
  59. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  60. package/dist/index.d.ts +2 -2
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +2 -1
  63. package/dist/index.js.map +1 -1
  64. package/dist/packageVersion.d.ts +1 -1
  65. package/dist/packageVersion.js +1 -1
  66. package/dist/packageVersion.js.map +1 -1
  67. package/dist/shared-tree/independentView.d.ts.map +1 -1
  68. package/dist/shared-tree/independentView.js +4 -7
  69. package/dist/shared-tree/independentView.js.map +1 -1
  70. package/dist/shared-tree/index.d.ts +1 -1
  71. package/dist/shared-tree/index.d.ts.map +1 -1
  72. package/dist/shared-tree/index.js.map +1 -1
  73. package/dist/shared-tree/schematizingTreeView.d.ts +5 -5
  74. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  75. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  76. package/dist/shared-tree/sharedTree.d.ts +5 -0
  77. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  78. package/dist/shared-tree/sharedTree.js +7 -4
  79. package/dist/shared-tree/sharedTree.js.map +1 -1
  80. package/dist/shared-tree/transactionPostProcessor.d.ts +28 -0
  81. package/dist/shared-tree/transactionPostProcessor.d.ts.map +1 -0
  82. package/dist/shared-tree/transactionPostProcessor.js +28 -0
  83. package/dist/shared-tree/transactionPostProcessor.js.map +1 -0
  84. package/dist/shared-tree/treeAlpha.js +3 -3
  85. package/dist/shared-tree/treeAlpha.js.map +1 -1
  86. package/dist/shared-tree/treeCheckout.d.ts +16 -12
  87. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  88. package/dist/shared-tree/treeCheckout.js +18 -9
  89. package/dist/shared-tree/treeCheckout.js.map +1 -1
  90. package/dist/shared-tree/unhydratedTreeContext.d.ts +5 -5
  91. package/dist/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  92. package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
  93. package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -2
  94. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  95. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  96. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
  97. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  98. package/dist/shared-tree-core/editManagerCodecsCommons.js +2 -4
  99. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  100. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
  101. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  102. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  103. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
  104. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  105. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  106. package/dist/shared-tree-core/editManagerSummarizer.d.ts +5 -9
  107. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  108. package/dist/shared-tree-core/editManagerSummarizer.js +5 -10
  109. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  110. package/dist/shared-tree-core/index.d.ts +1 -1
  111. package/dist/shared-tree-core/index.d.ts.map +1 -1
  112. package/dist/shared-tree-core/index.js +3 -2
  113. package/dist/shared-tree-core/index.js.map +1 -1
  114. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  115. package/dist/shared-tree-core/sharedTreeCore.js +3 -1
  116. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  117. package/dist/shared-tree-core/transaction.d.ts +84 -9
  118. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  119. package/dist/shared-tree-core/transaction.js +74 -7
  120. package/dist/shared-tree-core/transaction.js.map +1 -1
  121. package/dist/simple-tree/api/index.d.ts +1 -1
  122. package/dist/simple-tree/api/index.d.ts.map +1 -1
  123. package/dist/simple-tree/api/index.js.map +1 -1
  124. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  125. package/dist/simple-tree/api/schemaCreationUtilities.js +3 -3
  126. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  127. package/dist/simple-tree/api/schemaFactory.d.ts +1 -1
  128. package/dist/simple-tree/api/schemaFactory.js +2 -2
  129. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  130. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +2 -2
  131. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +2 -2
  132. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  133. package/dist/simple-tree/api/transactionTypes.d.ts +91 -28
  134. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  135. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  136. package/dist/simple-tree/api/tree.d.ts +86 -22
  137. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  138. package/dist/simple-tree/api/tree.js.map +1 -1
  139. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  140. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  141. package/dist/simple-tree/core/treeNodeSchema.d.ts +7 -7
  142. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  143. package/dist/simple-tree/index.d.ts +1 -1
  144. package/dist/simple-tree/index.d.ts.map +1 -1
  145. package/dist/simple-tree/index.js.map +1 -1
  146. package/dist/text/index.d.ts +1 -0
  147. package/dist/text/index.d.ts.map +1 -1
  148. package/dist/text/index.js +3 -1
  149. package/dist/text/index.js.map +1 -1
  150. package/dist/text/textDomainFormatted.d.ts +69 -758
  151. package/dist/text/textDomainFormatted.d.ts.map +1 -1
  152. package/dist/text/textDomainFormatted.js +275 -322
  153. package/dist/text/textDomainFormatted.js.map +1 -1
  154. package/dist/text/textDomainFormattedDefault.d.ts +273 -0
  155. package/dist/text/textDomainFormattedDefault.d.ts.map +1 -0
  156. package/dist/text/textDomainFormattedDefault.js +94 -0
  157. package/dist/text/textDomainFormattedDefault.js.map +1 -0
  158. package/dist/util/compressedIds.d.ts +118 -0
  159. package/dist/util/compressedIds.d.ts.map +1 -0
  160. package/dist/util/compressedIds.js +133 -0
  161. package/dist/util/compressedIds.js.map +1 -0
  162. package/dist/util/index.d.ts +1 -0
  163. package/dist/util/index.d.ts.map +1 -1
  164. package/dist/util/index.js +9 -1
  165. package/dist/util/index.js.map +1 -1
  166. package/lib/core/change-family/changeFamily.d.ts +3 -10
  167. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  168. package/lib/core/change-family/changeFamily.js.map +1 -1
  169. package/lib/core/rebase/types.d.ts +2 -2
  170. package/lib/core/rebase/types.js.map +1 -1
  171. package/lib/core/schema-stored/storedSchemaRepository.d.ts +2 -2
  172. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  173. package/lib/entrypoints/alpha.d.ts +1 -1
  174. package/lib/entrypoints/alpha.d.ts.map +1 -1
  175. package/lib/entrypoints/alpha.js.map +1 -1
  176. package/lib/entrypoints/beta.d.ts +1 -1
  177. package/lib/entrypoints/beta.d.ts.map +1 -1
  178. package/lib/entrypoints/beta.js.map +1 -1
  179. package/lib/entrypoints/legacy.d.ts +1 -1
  180. package/lib/entrypoints/legacy.d.ts.map +1 -1
  181. package/lib/entrypoints/legacy.js.map +1 -1
  182. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +19 -14
  183. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  184. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +14 -33
  185. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  186. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +85 -28
  187. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  188. package/lib/feature-libraries/chunked-forest/codec/codecs.js +82 -9
  189. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  190. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
  191. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  192. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +12 -1
  193. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  194. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  195. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  196. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  197. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  198. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
  199. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  200. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
  201. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  202. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  203. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  204. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  205. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  206. package/lib/feature-libraries/forest-summary/codec.d.ts +3 -3
  207. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  208. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  209. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
  210. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  211. package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -6
  212. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  213. package/lib/feature-libraries/index.d.ts +1 -1
  214. package/lib/feature-libraries/index.d.ts.map +1 -1
  215. package/lib/feature-libraries/index.js +1 -1
  216. package/lib/feature-libraries/index.js.map +1 -1
  217. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  218. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +10 -10
  219. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  220. package/lib/index.d.ts +2 -2
  221. package/lib/index.d.ts.map +1 -1
  222. package/lib/index.js +1 -1
  223. package/lib/index.js.map +1 -1
  224. package/lib/packageVersion.d.ts +1 -1
  225. package/lib/packageVersion.js +1 -1
  226. package/lib/packageVersion.js.map +1 -1
  227. package/lib/shared-tree/independentView.d.ts.map +1 -1
  228. package/lib/shared-tree/independentView.js +5 -8
  229. package/lib/shared-tree/independentView.js.map +1 -1
  230. package/lib/shared-tree/index.d.ts +1 -1
  231. package/lib/shared-tree/index.d.ts.map +1 -1
  232. package/lib/shared-tree/index.js.map +1 -1
  233. package/lib/shared-tree/schematizingTreeView.d.ts +5 -5
  234. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  235. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  236. package/lib/shared-tree/sharedTree.d.ts +5 -0
  237. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  238. package/lib/shared-tree/sharedTree.js +8 -5
  239. package/lib/shared-tree/sharedTree.js.map +1 -1
  240. package/lib/shared-tree/transactionPostProcessor.d.ts +28 -0
  241. package/lib/shared-tree/transactionPostProcessor.d.ts.map +1 -0
  242. package/lib/shared-tree/transactionPostProcessor.js +23 -0
  243. package/lib/shared-tree/transactionPostProcessor.js.map +1 -0
  244. package/lib/shared-tree/treeAlpha.js +3 -3
  245. package/lib/shared-tree/treeAlpha.js.map +1 -1
  246. package/lib/shared-tree/treeCheckout.d.ts +16 -12
  247. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  248. package/lib/shared-tree/treeCheckout.js +18 -9
  249. package/lib/shared-tree/treeCheckout.js.map +1 -1
  250. package/lib/shared-tree/unhydratedTreeContext.d.ts +5 -5
  251. package/lib/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  252. package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
  253. package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -2
  254. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  255. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  256. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
  257. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  258. package/lib/shared-tree-core/editManagerCodecsCommons.js +3 -5
  259. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  260. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
  261. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  262. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  263. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
  264. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  265. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  266. package/lib/shared-tree-core/editManagerSummarizer.d.ts +5 -9
  267. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  268. package/lib/shared-tree-core/editManagerSummarizer.js +5 -10
  269. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  270. package/lib/shared-tree-core/index.d.ts +1 -1
  271. package/lib/shared-tree-core/index.d.ts.map +1 -1
  272. package/lib/shared-tree-core/index.js +1 -1
  273. package/lib/shared-tree-core/index.js.map +1 -1
  274. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  275. package/lib/shared-tree-core/sharedTreeCore.js +3 -1
  276. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  277. package/lib/shared-tree-core/transaction.d.ts +84 -9
  278. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  279. package/lib/shared-tree-core/transaction.js +73 -6
  280. package/lib/shared-tree-core/transaction.js.map +1 -1
  281. package/lib/simple-tree/api/index.d.ts +1 -1
  282. package/lib/simple-tree/api/index.d.ts.map +1 -1
  283. package/lib/simple-tree/api/index.js.map +1 -1
  284. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  285. package/lib/simple-tree/api/schemaCreationUtilities.js +3 -3
  286. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  287. package/lib/simple-tree/api/schemaFactory.d.ts +1 -1
  288. package/lib/simple-tree/api/schemaFactory.js +2 -2
  289. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  290. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +2 -2
  291. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +2 -2
  292. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  293. package/lib/simple-tree/api/transactionTypes.d.ts +91 -28
  294. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  295. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  296. package/lib/simple-tree/api/tree.d.ts +86 -22
  297. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  298. package/lib/simple-tree/api/tree.js.map +1 -1
  299. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  300. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  301. package/lib/simple-tree/core/treeNodeSchema.d.ts +7 -7
  302. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  303. package/lib/simple-tree/index.d.ts +1 -1
  304. package/lib/simple-tree/index.d.ts.map +1 -1
  305. package/lib/simple-tree/index.js.map +1 -1
  306. package/lib/text/index.d.ts +1 -0
  307. package/lib/text/index.d.ts.map +1 -1
  308. package/lib/text/index.js +1 -0
  309. package/lib/text/index.js.map +1 -1
  310. package/lib/text/textDomainFormatted.d.ts +69 -758
  311. package/lib/text/textDomainFormatted.d.ts.map +1 -1
  312. package/lib/text/textDomainFormatted.js +277 -324
  313. package/lib/text/textDomainFormatted.js.map +1 -1
  314. package/lib/text/textDomainFormattedDefault.d.ts +273 -0
  315. package/lib/text/textDomainFormattedDefault.d.ts.map +1 -0
  316. package/lib/text/textDomainFormattedDefault.js +91 -0
  317. package/lib/text/textDomainFormattedDefault.js.map +1 -0
  318. package/lib/util/compressedIds.d.ts +118 -0
  319. package/lib/util/compressedIds.d.ts.map +1 -0
  320. package/lib/util/compressedIds.js +124 -0
  321. package/lib/util/compressedIds.js.map +1 -0
  322. package/lib/util/index.d.ts +1 -0
  323. package/lib/util/index.d.ts.map +1 -1
  324. package/lib/util/index.js +1 -0
  325. package/lib/util/index.js.map +1 -1
  326. package/package.json +23 -23
  327. package/src/core/change-family/changeFamily.ts +3 -12
  328. package/src/core/rebase/types.ts +2 -2
  329. package/src/core/schema-stored/storedSchemaRepository.ts +2 -2
  330. package/src/entrypoints/alpha.ts +12 -8
  331. package/src/entrypoints/beta.ts +8 -0
  332. package/src/entrypoints/legacy.ts +8 -0
  333. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +35 -64
  334. package/src/feature-libraries/chunked-forest/codec/codecs.ts +138 -42
  335. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +32 -4
  336. package/src/feature-libraries/chunked-forest/codec/index.ts +1 -0
  337. package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +7 -19
  338. package/src/feature-libraries/chunked-forest/index.ts +3 -0
  339. package/src/feature-libraries/forest-summary/codec.ts +5 -3
  340. package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -5
  341. package/src/feature-libraries/index.ts +3 -0
  342. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +13 -9
  343. package/src/index.ts +13 -8
  344. package/src/packageVersion.ts +1 -1
  345. package/src/shared-tree/independentView.ts +5 -10
  346. package/src/shared-tree/index.ts +1 -0
  347. package/src/shared-tree/schematizingTreeView.ts +25 -25
  348. package/src/shared-tree/sharedTree.ts +16 -4
  349. package/src/shared-tree/transactionPostProcessor.ts +40 -0
  350. package/src/shared-tree/treeAlpha.ts +3 -3
  351. package/src/shared-tree/treeCheckout.ts +61 -44
  352. package/src/shared-tree/unhydratedTreeContext.ts +18 -15
  353. package/src/shared-tree-core/editManagerCodecs.ts +3 -2
  354. package/src/shared-tree-core/editManagerCodecsCommons.ts +10 -14
  355. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +3 -2
  356. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +3 -2
  357. package/src/shared-tree-core/editManagerSummarizer.ts +5 -9
  358. package/src/shared-tree-core/index.ts +8 -5
  359. package/src/shared-tree-core/sharedTreeCore.ts +3 -2
  360. package/src/shared-tree-core/transaction.ts +148 -18
  361. package/src/simple-tree/api/index.ts +13 -9
  362. package/src/simple-tree/api/schemaCreationUtilities.ts +3 -3
  363. package/src/simple-tree/api/schemaFactory.ts +2 -2
  364. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +2 -2
  365. package/src/simple-tree/api/transactionTypes.ts +111 -39
  366. package/src/simple-tree/api/tree.ts +141 -47
  367. package/src/simple-tree/api/treeBeta.ts +2 -0
  368. package/src/simple-tree/core/treeNodeSchema.ts +7 -7
  369. package/src/simple-tree/index.ts +12 -8
  370. package/src/text/index.ts +1 -0
  371. package/src/text/textDomainFormatted.ts +520 -415
  372. package/src/text/textDomainFormattedDefault.ts +150 -0
  373. package/src/util/compressedIds.ts +216 -0
  374. package/src/util/index.ts +15 -0
@@ -1 +1 @@
1
- {"version":3,"file":"textDomainFormatted.js","sourceRoot":"","sources":["../../src/text/textDomainFormatted.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EACN,QAAQ,EACR,sBAAsB,GAGtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EACN,eAAe,E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;QAHF;;YAIiB,YAAO,GAAG,IAAI,CAAC;QAChC,CAAC;KAAA;IALY,kCAAc,iBAK1B,CAAA;IAED;;;OAGG;IACU,qCAAiB,GAAG,CAAC,cAAc,EAAE,cAAc,CAAU,CAAC;IAO3E;;;OAGG;IACH,MAAa,UAAW,SAAQ,EAAE,CAAC,MAAM,CAAC,YAAY,EAAE;QACvD,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,oBAAA,iBAAiB,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;QACrE,MAAM,EAAE,eAAe;KACvB,CAAC;KAAG;IAHQ,8BAAU,aAGlB,CAAA;IAuHL;;;;;;OAMG;IACU,wBAAI,GAAG,kBAAkB,EAAoB,CAAC,QAAQ,CAAC,CAAC;AAEtE,CAAC,EA3NgB,mBAAmB,KAAnB,mBAAmB,QA2NnC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, compareArrays, debugAssert, fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tEmptyKey,\n\tforEachNodeSubsequence,\n\ttype FieldKey,\n\ttype ITreeCursorSynchronous,\n} from \"../core/index.js\";\nimport { currentObserver, buildNodeComparator } from \"../feature-libraries/index.js\";\nimport { TreeAlpha } from \"../shared-tree/index.js\";\nimport {\n\tenumFromStrings,\n\teraseSchemaDetails,\n\tgetInnerNode,\n\tSchemaFactory,\n\tSchemaFactoryAlpha,\n\tTreeArrayNode,\n\tTreeBeta,\n} from \"../simple-tree/index.js\";\nimport type {\n\tInsertableTypedNode,\n\tTreeNode,\n\tTreeNodeFromImplicitAllowedTypes,\n\tWithType,\n} from \"../simple-tree/index.js\";\nimport { brand, mapIterable, validateIndex, validateIndexRange } from \"../util/index.js\";\n\nimport {\n\tcharactersFromString,\n\tprocessCharactersChangedDelta,\n\ttype TextAsTree,\n} from \"./textDomain.js\";\n\nconst sf = new SchemaFactoryAlpha(\"com.fluidframework.text.formatted\");\n\nclass TextNode\n\textends sf.object(\"Text\", {\n\t\tcontent: SchemaFactory.required([() => StringArray], { key: EmptyKey }),\n\t})\n\timplements FormattedTextAsTree.Members\n{\n\tpublic defaultFormat: FormattedTextAsTree.CharacterFormat =\n\t\tnew FormattedTextAsTree.CharacterFormat(defaultFormat);\n\n\tpublic insertAt(index: number, additionalCharacters: string): void {\n\t\tthis.content.insertAt(\n\t\t\tindex,\n\t\t\tTreeArrayNode.spread(textAtomsFromString(additionalCharacters, this.defaultFormat)),\n\t\t);\n\t}\n\n\tpublic removeRange(index: number | undefined, end: number | undefined): void {\n\t\tthis.content.removeRange(index, end);\n\t}\n\n\tpublic characters(): Iterable<string> {\n\t\treturn mapIterable(this.content, (atom) => atom.content.content);\n\t}\n\n\tpublic charactersCopy(): string[] {\n\t\tconst result = this.content.charactersCopy();\n\t\tdebugAssert(\n\t\t\t() =>\n\t\t\t\tcompareArrays(result, this.charactersCopy_reference()) ||\n\t\t\t\t\"invalid charactersCopy optimizations\",\n\t\t);\n\t\treturn result;\n\t}\n\n\tpublic characterCount(): number {\n\t\treturn this.content.length;\n\t}\n\n\tpublic fullString(): string {\n\t\tconst result = this.content.fullString();\n\t\tdebugAssert(\n\t\t\t() => result === this.fullString_reference() || \"invalid fullString optimizations\",\n\t\t);\n\t\treturn result;\n\t}\n\n\t/**\n\t * A non-optimized reference implementation of fullString.\n\t */\n\tpublic fullString_reference(): string {\n\t\treturn [...this.characters()].join(\"\");\n\t}\n\n\t/**\n\t * Unoptimized trivially correct implementation of charactersCopy.\n\t */\n\tpublic charactersCopy_reference(): string[] {\n\t\treturn [...this.characters()];\n\t}\n\n\tpublic static fromString(\n\t\tvalue: string,\n\t\tformat?: FormattedTextAsTree.CharacterFormat,\n\t): TextNode {\n\t\t// Constructing an ArrayNode from an iterator is supported, so creating an array from the iterable of characters seems like it's not necessary here,\n\t\t// but to reduce the risk of incorrect data interpretation, we actually ban this in the special case where the iterable is a string directly, which is the case here.\n\t\t// Thus the array construction here is necessary to avoid a runtime error.\n\t\treturn new TextNode({\n\t\t\tcontent: [\n\t\t\t\t...textAtomsFromString(\n\t\t\t\t\tvalue,\n\t\t\t\t\tformat ?? new FormattedTextAsTree.CharacterFormat(defaultFormat),\n\t\t\t\t),\n\t\t\t],\n\t\t});\n\t}\n\n\tpublic charactersWithFormatting(): readonly FormattedTextAsTree.StringAtom[] {\n\t\treturn this.content;\n\t}\n\tpublic insertWithFormattingAt(\n\t\tindex: number,\n\t\tadditionalCharacters: Iterable<InsertableTypedNode<typeof FormattedTextAsTree.StringAtom>>,\n\t): void {\n\t\tthis.content.insertAt(index, TreeArrayNode.spread(additionalCharacters));\n\t}\n\tpublic formatRange(\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\tformat: Partial<FormattedTextAsTree.CharacterFormat>,\n\t): void {\n\t\tconst formatStart = start ?? 0;\n\t\tvalidateIndex(formatStart, this.content, \"FormattedTextAsTree.formatRange\", true);\n\n\t\tconst formatEnd = Math.min(this.content.length, end ?? this.content.length);\n\t\tvalidateIndexRange(\n\t\t\tformatStart,\n\t\t\tformatEnd,\n\t\t\tthis.content,\n\t\t\t\"FormattedTextAsTree.formatRange\",\n\t\t);\n\n\t\tconst branch = TreeAlpha.branch(this);\n\n\t\tconst applyFormatting = (): void => {\n\t\t\tfor (let i = formatStart; i < formatEnd; i++) {\n\t\t\t\tconst atom = this.content[i];\n\t\t\t\tif (atom === undefined) {\n\t\t\t\t\tthrow new UsageError(\"Index out of bounds while formatting text range.\");\n\t\t\t\t}\n\t\t\t\tfor (const [key, value] of Object.entries(format) as [\n\t\t\t\t\tkeyof FormattedTextAsTree.CharacterFormat,\n\t\t\t\t\tunknown,\n\t\t\t\t][]) {\n\t\t\t\t\t// Object.entries should only return string keyed enumerable own properties.\n\t\t\t\t\t// The TypeScript typing does not account for this, and thus this assertion is necessary for this code to compile.\n\t\t\t\t\tassert(\n\t\t\t\t\t\ttypeof key === \"string\",\n\t\t\t\t\t\t0xcc8 /* Object.entries returned a non-string key. */,\n\t\t\t\t\t);\n\t\t\t\t\tconst f = FormattedTextAsTree.CharacterFormat.fields.get(key);\n\t\t\t\t\tif (f === undefined) {\n\t\t\t\t\t\tthrow new UsageError(`Unknown format key: ${key}`);\n\t\t\t\t\t}\n\t\t\t\t\t// Ensures that if the input is a node, it is cloned before being inserted into the tree.\n\t\t\t\t\tatom.format[key] = TreeBeta.clone(TreeBeta.create(f, value as never)) as never;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tif (branch === undefined) {\n\t\t\t// If this node does not have a corresponding branch, then it is unhydrated.\n\t\t\t// I.e., it is not part of a collaborative session yet.\n\t\t\t// Therefore, we don't need to run the edits as a transaction.\n\t\t\t// Note: for unhydrated nodes each atom edit fires a separate `treeChanged` event,\n\t\t\t// so formatting N atoms will produce N callbacks on `onContentChanged` subscribers\n\t\t\t// instead of the single callback that hydrated (transacted) edits produce.\n\t\t\t// `withBufferedTreeEvents` is not a viable mitigation here: when more than one atom's\n\t\t\t// `format` field changes within the same buffered scope, the kernel's per-field\n\t\t\t// dedup logic discards the delta (see `treeNodeKernel.ts` `#fieldMarksBuffer`),\n\t\t\t// which is worse for incremental consumers than N well-formed callbacks.\n\t\t\t// Use `runTransaction` on a hydrated node (i.e. after inserting into the document)\n\t\t\t// if batched events matter.\n\t\t\tapplyFormatting();\n\t\t} else {\n\t\t\t// Wrap all formatting operations in a single transaction for atomicity.\n\t\t\tbranch.runTransaction(() => {\n\t\t\t\tapplyFormatting();\n\t\t\t});\n\t\t}\n\t}\n\t/**\n\t * Returns the character string at the given atom index, or `undefined` if out of bounds.\n\t * @remarks\n\t * Line atoms expand to `\"\\n\"`; text atoms return their underlying code point(s).\n\t */\n\tprivate getAtomCharacterAt(index: number): string | undefined {\n\t\tconst atom = this.content[index];\n\t\tif (atom === undefined) return undefined;\n\t\treturn atom.content instanceof FormattedTextAsTree.StringLineAtom\n\t\t\t? \"\\n\"\n\t\t\t: atom.content.content;\n\t}\n\n\tpublic onCharactersChanged(\n\t\tcallback: (ops: readonly TextAsTree.TextOp[] | undefined) => void,\n\t): () => void {\n\t\treturn TreeAlpha.on(this.content, \"nodeChanged\", ({ delta }) =>\n\t\t\tprocessCharactersChangedDelta(\n\t\t\t\tdelta,\n\t\t\t\t(index) => this.getAtomCharacterAt(index),\n\t\t\t\tcallback,\n\t\t\t),\n\t\t);\n\t}\n\n\tpublic onContentChanged(\n\t\tcallback: (ops: readonly TextAsTree.TextOp[] | undefined) => void,\n\t): () => void {\n\t\treturn TreeAlpha.on(this.content, \"treeChanged\", ({ delta }) =>\n\t\t\tprocessCharactersChangedDelta(\n\t\t\t\tdelta,\n\t\t\t\t(index) => this.getAtomCharacterAt(index),\n\t\t\t\tcallback,\n\t\t\t),\n\t\t);\n\t}\n\n\tpublic getUniformRun(startIndex: number, endIndex?: number): number {\n\t\treturn this.content.getUniformRun(startIndex, endIndex);\n\t}\n\tpublic getString(startIndex: number, endIndex?: number): string {\n\t\treturn this.content.getString(startIndex, endIndex);\n\t}\n}\n\nconst defaultFormat = {\n\tbold: false,\n\titalic: false,\n\tunderline: false,\n\tsize: 12,\n\tfont: \"Arial\",\n} as const;\n\nconst formatKey: FieldKey = brand(\"format\");\n\nfunction textAtomsFromString(\n\tvalue: string,\n\tformat: FormattedTextAsTree.CharacterFormat,\n): Iterable<FormattedTextAsTree.StringAtom> {\n\tconst result = mapIterable(\n\t\tcharactersFromString(value),\n\t\t(char) =>\n\t\t\tnew FormattedTextAsTree.StringAtom({\n\t\t\t\tcontent: { content: char },\n\t\t\t\tformat: TreeBeta.clone<typeof FormattedTextAsTree.CharacterFormat>(format),\n\t\t\t}),\n\t);\n\treturn result;\n}\n\nclass StringArray extends sf.array(\"StringArray\", [() => FormattedTextAsTree.StringAtom]) {\n\tpublic withBorrowedSequenceCursor<T>(f: (cursor: ITreeCursorSynchronous) => T): T {\n\t\tconst innerNode = getInnerNode(this);\n\t\t// Since the cursor will be used to read content from the tree and won't track observations,\n\t\t// treat it as if it observed the whole subtree.\n\t\tcurrentObserver?.observeNodeDeep(innerNode);\n\t\tconst cursor = innerNode.borrowCursor();\n\t\tcursor.enterField(EmptyKey);\n\t\tconst result = f(cursor);\n\t\tcursor.exitField();\n\t\treturn result;\n\t}\n\n\tprivate getCharactersSubarray(startIndex: number, endIndex: number): string[] {\n\t\treturn this.withBorrowedSequenceCursor((cursor) => {\n\t\t\tconst result: string[] = [];\n\t\t\tforEachNodeSubsequence(cursor, startIndex, endIndex, () => {\n\t\t\t\tdebugAssert(\n\t\t\t\t\t() =>\n\t\t\t\t\t\tcursor.type === FormattedTextAsTree.StringAtom.identifier ||\n\t\t\t\t\t\t\"invalid fullString type optimizations\",\n\t\t\t\t);\n\t\t\t\tcursor.enterField(EmptyKey);\n\t\t\t\tcursor.enterNode(0);\n\t\t\t\tlet content: string;\n\t\t\t\tswitch (cursor.type) {\n\t\t\t\t\tcase FormattedTextAsTree.StringTextAtom.identifier: {\n\t\t\t\t\t\tcursor.enterField(EmptyKey);\n\t\t\t\t\t\tcursor.enterNode(0);\n\t\t\t\t\t\tcontent = cursor.value as string;\n\t\t\t\t\t\tdebugAssert(\n\t\t\t\t\t\t\t() => typeof content === \"string\" || \"invalid fullString type optimizations\",\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcursor.exitNode();\n\t\t\t\t\t\tcursor.exitField();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase FormattedTextAsTree.StringLineAtom.identifier: {\n\t\t\t\t\t\tcontent = \"\\n\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tfail(0xcde /* Unsupported node type in text array */, () => `${cursor.type}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcursor.exitNode();\n\t\t\t\tcursor.exitField();\n\t\t\t\tresult.push(content);\n\t\t\t});\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tpublic charactersCopy(): string[] {\n\t\treturn this.getCharactersSubarray(0, this.length);\n\t}\n\n\tpublic fullString(): string {\n\t\treturn this.charactersCopy().join(\"\");\n\t}\n\n\tpublic getString(startIndex: number, endIndex: number = this.length): string {\n\t\tvalidateIndexRange(startIndex, endIndex, this, \"FormattedTextAsTree.getString\");\n\t\treturn this.getCharactersSubarray(startIndex, endIndex).join(\"\");\n\t}\n\n\tpublic getUniformRun(startIndex: number, endIndex: number = this.length): number {\n\t\tvalidateIndexRange(startIndex, endIndex, this, \"FormattedTextAsTree.getUniformRun\");\n\t\tif (endIndex === startIndex) {\n\t\t\tthrow new UsageError(\"endIndex must be greater than startIndex for getUniformRun.\");\n\t\t}\n\t\tconst arrayLength = this.length;\n\t\treturn this.withBorrowedSequenceCursor((cursor) => {\n\t\t\tcursor.enterNode(startIndex);\n\n\t\t\t// Capture the content type of the first atom\n\t\t\tcursor.enterField(EmptyKey);\n\t\t\tcursor.enterNode(0);\n\t\t\tconst contentType = cursor.type;\n\t\t\tcursor.exitNode();\n\t\t\tcursor.exitField();\n\n\t\t\t// Build a comparator from the format subtree of the first atom\n\t\t\t// This compares by field key\n\t\t\tcursor.enterField(formatKey);\n\t\t\tcursor.enterNode(0);\n\t\t\tconst formatComparator = buildNodeComparator(cursor);\n\t\t\tcursor.exitNode();\n\t\t\tcursor.exitField();\n\n\t\t\tlet runLength = 1;\n\t\t\tconst limit = Math.min(endIndex, arrayLength) - startIndex;\n\n\t\t\twhile (runLength < limit && cursor.nextNode()) {\n\t\t\t\t// Compare atom type\n\t\t\t\tcursor.enterField(EmptyKey);\n\t\t\t\tcursor.enterNode(0);\n\t\t\t\tconst typeMatches = cursor.type === contentType;\n\t\t\t\tcursor.exitNode();\n\t\t\t\tcursor.exitField();\n\t\t\t\tif (!typeMatches) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// Compare format subtree using the compiled comparator\n\t\t\t\tcursor.enterField(formatKey);\n\t\t\t\tcursor.enterNode(0);\n\t\t\t\tconst formatMatches = formatComparator(cursor);\n\t\t\t\tcursor.exitNode();\n\t\t\t\tcursor.exitField();\n\n\t\t\t\tif (formatMatches !== true) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\trunLength++;\n\t\t\t}\n\t\t\tcursor.exitNode();\n\t\t\treturn runLength;\n\t\t});\n\t}\n}\n\n/**\n * A collection of text related types, schema and utilities for working with text beyond the basic {@link SchemaStatics.string}.\n * @privateRemarks\n * This has hard-coded assumptions about what kind of embedded content and what kind of formatting is supported.\n * We will want to generalize this with a more generic schema factory function like with table.\n * Then either that and/or the output from it can be package exported.\n * This version is just an initial prototype.\n * @internal\n */\nexport namespace FormattedTextAsTree {\n\t/**\n\t * Formatting options for characters.\n\t * @internal\n\t */\n\texport class CharacterFormat extends sf.objectAlpha(\"CharacterFormat\", {\n\t\tbold: SchemaFactory.boolean,\n\t\titalic: SchemaFactory.boolean,\n\t\tunderline: SchemaFactory.boolean,\n\t\tsize: SchemaFactory.number,\n\t\tfont: SchemaFactory.string,\n\t}) {}\n\n\t/**\n\t * Unit in the string representing a single character.\n\t * @internal\n\t */\n\texport class StringTextAtom extends sf.object(\"StringTextAtom\", {\n\t\t/**\n\t\t * The underlying text content of this atom.\n\t\t * @remarks\n\t\t * This is typically a single Unicode code point, and thus may contain multiple UTF-16 surrogate pair code units.\n\t\t * Using longer strings is still valid. For example, so users might store whole grapheme clusters here, or even longer sections of text.\n\t\t * Anything combined into a single atom will be treated atomically, and can not be partially selected or formatted.\n\t\t * Using larger atoms and splitting them as needed is NOT a recommended approach, since this will result in poor merge behavior for concurrent edits.\n\t\t * Instead atoms should always be the smallest unit of text which will be independently selected, moved or formatted.\n\t\t * @privateRemarks\n\t\t * This content logically represents the whole atom's content, so using {@link EmptyKey} makes sense to help indicate that.\n\t\t */\n\t\tcontent: SchemaFactory.required([SchemaFactory.string], { key: EmptyKey }),\n\t}) {}\n\n\t/**\n\t * Tag with which a line in text can be formatted from HTML.\n\t * @internal\n\t */\n\texport const LineTag = enumFromStrings(sf.scopedFactory(\"lineTag\"), [\n\t\t\"h1\",\n\t\t\"h2\",\n\t\t\"h3\",\n\t\t\"h4\",\n\t\t\"h5\",\n\t\t\"li\",\n\t\t\"ol\",\n\t\t\"checked\",\n\t\t\"unchecked\",\n\t\t\"blockquote\",\n\t\t\"codeBlock\",\n\t]);\n\t/**\n\t * {@inheritdoc FormattedTextAsTree.(LineTag:variable)}\n\t * @internal\n\t */\n\texport type LineTag = TreeNodeFromImplicitAllowedTypes<typeof LineTag.schema>;\n\n\t/**\n\t * Unit in the string representing a new line character with line formatting.\n\t * @remarks\n\t * This aligns with how Quill represents line formatting.\n\t * Quill formats line attributes (headers, list, blockquote, etc... ) on the newline character\n\t * and only lines using this atom can have line-specific formatting.\n\t * The optional indent level mirrors Quill's indent attribute,\n\t * which is applies to the line before the line break.\n\t * Any tagged line can be indented independently.\n\t * @internal\n\t */\n\texport class StringLineAtom extends sf.object(\"StringLineAtom\", {\n\t\ttag: LineTag.schema,\n\t\tindent: SchemaFactory.number,\n\t}) {\n\t\tpublic readonly content = \"\\n\";\n\t}\n\n\t/**\n\t * Types of \"atoms\" that make up the text.\n\t * @internal\n\t */\n\texport const StringAtomContent = [StringTextAtom, StringLineAtom] as const;\n\t/**\n\t * {@inheritdoc FormattedTextAsTree.(StringAtomContent:variable)}\n\t * @internal\n\t */\n\texport type StringAtomContent = TreeNodeFromImplicitAllowedTypes<typeof StringAtomContent>;\n\n\t/**\n\t * A unit of the text, with formatting.\n\t * @internal\n\t */\n\texport class StringAtom extends sf.object(\"StringAtom\", {\n\t\tcontent: SchemaFactory.required(StringAtomContent, { key: EmptyKey }),\n\t\tformat: CharacterFormat,\n\t}) {}\n\n\t/**\n\t * Statics for text nodes.\n\t * @internal\n\t */\n\texport interface Statics {\n\t\t/**\n\t\t * Construct a {@link FormattedTextAsTree.(Tree:type)} from a string, where each character (as defined by iterating over the string) becomes a single character in the text node.\n\t\t * @remarks This combines pairs of utf-16 surrogate code units into single characters as appropriate.\n\t\t */\n\t\tfromString(value: string): Tree;\n\t}\n\n\t/**\n\t * Interface for a text node.\n\t * @remarks\n\t * The string is broken up into substrings which are referred to as 'characters'.\n\t * Unlike with JavaScript strings, all indexes are by character, not UTF-16 code unit.\n\t * This avoids the problem JavaScript where it can split UTF-16 surrogate pairs producing invalid strings,\n\t * and avoids the issue where indexing a string and iterating it segment the string differently.\n\t * This does NOT mean the characters correspond to user perceived characters (like grapheme clusters try to do):\n\t * applications will likely want to include higher level segmentation logic\n\t * which might differ between operations like delete\n\t * (which often operates on something in between unicode code points and grapheme clusters)\n\t * and navigation/selection (which typically uses grapheme clusters).\n\t *\n\t * @see {@link FormattedTextAsTree.Statics.fromString} for construction.\n\t * @see {@link FormattedTextAsTree.(Tree:type)} for schema.\n\t * @internal\n\t */\n\texport interface Members extends TextAsTree.Members {\n\t\t/**\n\t\t * Format to use by default for text inserted with non-formatted APIs.\n\t\t * @remarks\n\t\t * This is not persisted in the tree, and observation of it is not tracked by the tree observation tracking.\n\t\t * @privateRemarks\n\t\t * Opt this into observation tracking.\n\t\t */\n\t\tdefaultFormat: CharacterFormat;\n\n\t\t/**\n\t\t * Gets an array type view of the characters currently in the text.\n\t\t * @remarks\n\t\t * This iterator matches the behavior of {@link (TreeArrayNode:interface)} with respect to edits during iteration.\n\t\t * @privateRemarks\n\t\t * Currently this is implemented by a node and changes with the text over time.\n\t\t * We might not want to leak a node like this in the API.\n\t\t * Providing a way to index and iterate separately might be better.\n\t\t */\n\t\tcharactersWithFormatting(): readonly StringAtom[];\n\n\t\t/**\n\t\t * Insert a range of characters into the string based on character index.\n\t\t * @remarks\n\t\t * See {@link (TreeArrayNode:interface).insertAt} for more details on the behavior.\n\t\t * See {@link FormattedTextAsTree.Statics.fromString} for how the `additionalCharacters` string is broken into characters.\n\t\t * @privateRemarks\n\t\t * If we provide ways to customize character boundaries, that could be handled here by taking in an Iterable<string> instead of a string.\n\t\t * Doing this currently would enable insertion of text with different character boundaries than the existing text,\n\t\t * which would violate the currently documented character boundary invariants.\n\t\t *\n\t\t * Another option would be to take an approach like Table,\n\t\t * where the user of the API uses a factory function to generate the schema, and can inject custom logic, like a string character iterator.\n\t\t */\n\t\tinsertWithFormattingAt(\n\t\t\tindex: number,\n\t\t\tadditionalCharacters: Iterable<InsertableTypedNode<typeof StringAtom>>,\n\t\t): void;\n\n\t\t/**\n\t\t * Apply formatting to a range of characters based on character index.\n\t\t * @param startIndex - The starting index (inclusive) of the range to format.\n\t\t * @param endIndex - The ending index (exclusive) of the range to format.\n\t\t * @param format - The formatting to apply to the specified range.\n\t\t * @remarks\n\t\t * The start and end behave the same as in {@link (TreeArrayNode:interface).removeRange}.\n\t\t */\n\t\tformatRange(\n\t\t\tstartIndex: number | undefined,\n\t\t\tendIndex: number | undefined,\n\t\t\tformat: Partial<CharacterFormat>,\n\t\t): void;\n\n\t\t/**\n\t\t * Returns the length of the run of characters starting at `startIndex` which have the same formatting and atom type, up to `endIndex`.\n\t\t * @param startIndex - The starting index of the run.\n\t\t * @param endIndex - The ending index (exclusive) of the run. Defaults to the end of the text.\n\t\t */\n\t\tgetUniformRun(startIndex: number, endIndex?: number): number;\n\t\t/**\n\t\t * Returns a substring of the text from `startIndex` to `endIndex`\n\t\t * @param startIndex - starting index (inclusive)\n\t\t * @param endIndex - Optional ending index (exclusive). Defaults to the end of the text.\n\t\t */\n\t\tgetString(startIndex: number, endIndex?: number): string;\n\n\t\t/**\n\t\t * Subscribe to all content changes on this text node, including both shallow\n\t\t * changes (inserts/removes) and deep changes (formatting updates on existing characters).\n\t\t * @param callback - Called after each change with a sequence of {@link TextAsTree.TextOp}s describing what changed,\n\t\t * or `undefined` when a delta could not be computed (e.g. during a schema upgrade).\n\t\t * @returns A cleanup function that unsubscribes the callback when called.\n\t\t * @remarks\n\t\t * Unlike {@link TextAsTree.Members.onCharactersChanged} which only fires on\n\t\t * shallow changes (inserts and removes), this method also fires on deep changes —\n\t\t * formatting property updates on existing characters.\n\t\t * The {@link TextAsTree.TextRetainOp.formattingChanged} flag on retain ops\n\t\t * indicates which character ranges had formatting updates.\n\t\t *\n\t\t * All counts in the delivered ops are in Unicode code points, not UTF-16 code units.\n\t\t * For characters outside the Basic Multilingual Plane (e.g. emoji), one code point\n\t\t * corresponds to two UTF-16 code units — convert before using the counts as string indices.\n\t\t */\n\t\tonContentChanged(\n\t\t\tcallback: (ops: readonly TextAsTree.TextOp[] | undefined) => void,\n\t\t): () => void;\n\t}\n\n\t/**\n\t * Schema for a text node.\n\t * @remarks\n\t * See {@link FormattedTextAsTree.Members} for the API.\n\t * See {@link FormattedTextAsTree.Statics} for static APIs on this Schema, including construction.\n\t * @internal\n\t */\n\texport const Tree = eraseSchemaDetails<Members, Statics>()(TextNode);\n\texport type Tree = Members & TreeNode & WithType<\"com.fluidframework.text.formatted.Text\">;\n}\n"]}
1
+ {"version":3,"file":"textDomainFormatted.js","sourceRoot":"","sources":["../../src/text/textDomainFormatted.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EACN,QAAQ,EACR,sBAAsB,GAItB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EACN,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACR,2CAA2C,EAC3C,kBAAkB,EAClB,8BAA8B,GAC9B,MAAM,yBAAyB,CAAC;AAiBjC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEzF,OAAO,E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AC,EA9nBgB,mBAAmB,KAAnB,mBAAmB,QA8nBnC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, compareArrays, debugAssert, fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tEmptyKey,\n\tforEachNodeSubsequence,\n\ttype FieldKey,\n\ttype ITreeCursorSynchronous,\n\ttype TreeValue,\n} from \"../core/index.js\";\nimport { currentObserver, buildNodeComparator } from \"../feature-libraries/index.js\";\nimport { TreeAlpha, Tree as TreeStatic } from \"../shared-tree/index.js\";\nimport {\n\tgetInnerNode,\n\tSchemaFactory,\n\tSchemaFactoryAlpha,\n\tTreeArrayNode,\n\tTreeBeta,\n\tcreateCustomizedFluidFrameworkScopedFactory,\n\tisObjectNodeSchema,\n\teraseSchemaDetailsSubclassable,\n} from \"../simple-tree/index.js\";\nimport type {\n\tTreeNodeSchema,\n\tLazyItem,\n\tImplicitAllowedTypes,\n\tTreeFieldFromImplicitField,\n\tInsertableTypedNode,\n\tTreeNodeFromImplicitAllowedTypes,\n\tInsertableTreeNodeFromImplicitAllowedTypes,\n\tInsertableTreeFieldFromImplicitField,\n\tNodeKind,\n\tTreeNode,\n\tScopedSchemaName,\n\tErasedSchemaSubclassable,\n\tErasedNode,\n\tSchemaFactoryBeta,\n} from \"../simple-tree/index.js\";\nimport { brand, mapIterable, validateIndex, validateIndexRange } from \"../util/index.js\";\n\nimport {\n\tcharactersFromString,\n\tprocessCharactersChangedDelta,\n\ttype TextAsTree,\n} from \"./textDomain.js\";\n\n/**\n * Sets up scope for formatted text schema built-in types.\n * @remarks User-provided factory scoping will be applied as `com.fluidframework.text.formatted<user-scope>`.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Inferring is the most practical option here\nfunction createFormattedScopedFactory<TUserScope extends string>(\n\tinputSchemaFactory: SchemaFactoryBeta<TUserScope>,\n) {\n\treturn createCustomizedFluidFrameworkScopedFactory(inputSchemaFactory, \"text.formatted\");\n}\n\n/**\n * Schema factory for formatted text types which are not generic.\n */\nconst sfStatic = new SchemaFactoryAlpha(\"com.fluidframework.text.formatted\");\n\nconst formatKey: FieldKey = brand(\"format\");\n\n/**\n * A collection of text related types, schema and utilities for working with text beyond the basic {@link SchemaStatics.string}.\n * @remarks\n * This is generic over formatting an embedded object/atom types.\n * See {@link FormattedTextAsTreeDefault} for a default parameterization.\n * @privateRemarks\n * TODO:\n * - Add more comprehensive tests for generic parameterizations other than default.\n * - Sort out API around overwriting subsets of formatting information.\n * @internal\n */\nexport namespace FormattedTextAsTree {\n\t/**\n\t * Factory for formatted text schema as a function of the formatting and the embedded object (atom) types.\n\t */\n\texport function createSchema<\n\t\tconst TUserScope extends string,\n\t\tconst FormatSchema extends ImplicitAllowedTypes,\n\t\tconst ExtraAtomsSchema extends readonly LazyItem<\n\t\t\tTreeNodeSchema<string, NodeKind, TextAtom & TreeNode>\n\t\t>[],\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryBeta<TUserScope>,\n\t\tformatSchema: FormatSchema,\n\t\textraAtoms: ExtraAtomsSchema,\n\t\tdefaultFormatInsertable: InsertableTreeFieldFromImplicitField<FormatSchema>,\n\t): FormattedTextSchema<TUserScope, FormatSchema, ExtraAtomsSchema> {\n\t\tconst atoms = [StringTextAtom, ...extraAtoms] as const;\n\n\t\tconst sf = createFormattedScopedFactory(inputSchemaFactory);\n\t\tclass TextNode\n\t\t\textends sf.object(\"Text\", {\n\t\t\t\tcontent: SchemaFactory.required([() => StringArray], { key: EmptyKey }),\n\t\t\t})\n\t\t\timplements FormattedTextMembers<FormatSchema, ExtraAtomsSchema>\n\t\t{\n\t\t\tpublic defaultFormat: TreeFieldFromImplicitField<FormatSchema> =\n\t\t\t\tTreeBeta.create<FormatSchema>(formatSchema, defaultFormatInsertable);\n\n\t\t\tpublic insertAt(index: number, additionalCharacters: string): void {\n\t\t\t\tthis.content.insertAt(\n\t\t\t\t\tindex,\n\t\t\t\t\tTreeArrayNode.spread(textAtomsFromString(additionalCharacters, this.defaultFormat)),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tpublic removeRange(index: number | undefined, end: number | undefined): void {\n\t\t\t\tthis.content.removeRange(index, end);\n\t\t\t}\n\n\t\t\tpublic characters(): Iterable<string> {\n\t\t\t\treturn mapIterable(this.content, (atom) => atom.content.content);\n\t\t\t}\n\n\t\t\tpublic charactersCopy(): string[] {\n\t\t\t\tconst result = this.content.charactersCopy();\n\t\t\t\tdebugAssert(\n\t\t\t\t\t() =>\n\t\t\t\t\t\tcompareArrays(result, this.charactersCopy_reference()) ||\n\t\t\t\t\t\t\"invalid charactersCopy optimizations\",\n\t\t\t\t);\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tpublic characterCount(): number {\n\t\t\t\treturn this.content.length;\n\t\t\t}\n\n\t\t\tpublic fullString(): string {\n\t\t\t\tconst result = this.content.fullString();\n\t\t\t\tdebugAssert(\n\t\t\t\t\t() => result === this.fullString_reference() || \"invalid fullString optimizations\",\n\t\t\t\t);\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * A non-optimized reference implementation of fullString.\n\t\t\t */\n\t\t\tpublic fullString_reference(): string {\n\t\t\t\treturn [...this.characters()].join(\"\");\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Unoptimized trivially correct implementation of charactersCopy.\n\t\t\t */\n\t\t\tpublic charactersCopy_reference(): string[] {\n\t\t\t\treturn [...this.characters()];\n\t\t\t}\n\n\t\t\tpublic static fromString(\n\t\t\t\tvalue: string,\n\t\t\t\tformat?: TreeFieldFromImplicitField<FormatSchema>,\n\t\t\t): TextNode {\n\t\t\t\t// Use `this` rather than `TextNode` so the more derived schema class is constructed when using this as a static on a subclass.\n\t\t\t\treturn new this({\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t// Constructing an ArrayNode from an iterator is supported, so creating an array from the iterable of characters seems like it's not necessary here,\n\t\t\t\t\t\t// but to reduce the risk of incorrect data interpretation, we actually ban this in the special case where the iterable is a string directly, which is the case here.\n\t\t\t\t\t\t// Thus the array construction here is necessary to avoid a runtime error.\n\t\t\t\t\t\t...textAtomsFromString(\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\tformat ?? TreeBeta.create<FormatSchema>(formatSchema, defaultFormatInsertable),\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tpublic charactersWithFormatting(): readonly StringAtom[] {\n\t\t\t\treturn this.content;\n\t\t\t}\n\t\t\tpublic insertWithFormattingAt(\n\t\t\t\tindex: number,\n\t\t\t\tadditionalCharacters: Iterable<InsertableTypedNode<typeof StringAtom>>,\n\t\t\t): void {\n\t\t\t\tthis.content.insertAt(index, TreeArrayNode.spread(additionalCharacters));\n\t\t\t}\n\n\t\t\tpublic formatRange(\n\t\t\t\tstart: number | undefined,\n\t\t\t\tend: number | undefined,\n\t\t\t\tformat: Partial<TreeNodeFromImplicitAllowedTypes<FormatSchema>>,\n\t\t\t): void {\n\t\t\t\tconst formatStart = start ?? 0;\n\t\t\t\tvalidateIndex(formatStart, this.content, \"FormattedTextAsTree.formatRange\", true);\n\n\t\t\t\tconst formatEnd = Math.min(this.content.length, end ?? this.content.length);\n\t\t\t\tvalidateIndexRange(\n\t\t\t\t\tformatStart,\n\t\t\t\t\tformatEnd,\n\t\t\t\t\tthis.content,\n\t\t\t\t\t\"FormattedTextAsTree.formatRange\",\n\t\t\t\t);\n\n\t\t\t\tconst fieldFormats = Object.entries(format) as [\n\t\t\t\t\tkeyof TreeNodeFromImplicitAllowedTypes<FormatSchema>,\n\t\t\t\t\tunknown,\n\t\t\t\t][];\n\n\t\t\t\tTreeAlpha.context(this).runTransaction(() => {\n\t\t\t\t\tfor (let i = formatStart; i < formatEnd; i++) {\n\t\t\t\t\t\tconst atom = this.content[i];\n\t\t\t\t\t\t// Range validated above, so this should never fail.\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tatom !== undefined,\n\t\t\t\t\t\t\t0xd08 /* Index out of bounds while formatting text range. */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst formatNode: TreeNode | TreeValue = atom.format;\n\t\t\t\t\t\tconst atomFormatSchema = TreeStatic.schema(formatNode);\n\t\t\t\t\t\tif (!isObjectNodeSchema(atomFormatSchema)) {\n\t\t\t\t\t\t\t// TODO: redesign this API to work with all allowed FormatSchema types.\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t\"formatRange currently only supports object nodes for the format.\",\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (const [key, value] of fieldFormats) {\n\t\t\t\t\t\t\t// Object.entries should only return string keyed enumerable own properties.\n\t\t\t\t\t\t\t// The TypeScript typing does not account for this, and thus this assertion is necessary for this code to compile.\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\ttypeof key === \"string\",\n\t\t\t\t\t\t\t\t0xcc8 /* Object.entries returned a non-string key. */,\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tconst field = atomFormatSchema.fields.get(key);\n\t\t\t\t\t\t\tif (field === undefined) {\n\t\t\t\t\t\t\t\tthrow new UsageError(`Unknown format key: ${key}`);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Ensures that if the input is a node, it is cloned before being inserted into the tree.\n\t\t\t\t\t\t\tconst clonedValue = TreeBeta.clone(TreeBeta.create(field, value as never)) as\n\t\t\t\t\t\t\t\t| TreeNode\n\t\t\t\t\t\t\t\t| TreeValue;\n\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\tformatNode as unknown as Record<\n\t\t\t\t\t\t\t\t\tkeyof TreeNodeFromImplicitAllowedTypes<FormatSchema>,\n\t\t\t\t\t\t\t\t\tTreeNode | TreeValue\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t)[key] = clonedValue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Returns the {@link FormattedTextAsTree.TextAtom.content} at the given atom index, or `undefined` if out of bounds.\n\t\t\t */\n\t\t\tprivate getAtomCharacterAt(index: number): string | undefined {\n\t\t\t\tconst atom = this.content[index];\n\t\t\t\tif (atom === undefined) return undefined;\n\t\t\t\treturn atom.content.content;\n\t\t\t}\n\n\t\t\tpublic onCharactersChanged(\n\t\t\t\tcallback: (ops: readonly TextAsTree.TextOp[] | undefined) => void,\n\t\t\t): () => void {\n\t\t\t\treturn TreeAlpha.on(this.content, \"nodeChanged\", ({ delta }) =>\n\t\t\t\t\tprocessCharactersChangedDelta(\n\t\t\t\t\t\tdelta,\n\t\t\t\t\t\t(index) => this.getAtomCharacterAt(index),\n\t\t\t\t\t\tcallback,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tpublic onContentChanged(\n\t\t\t\tcallback: (ops: readonly TextAsTree.TextOp[] | undefined) => void,\n\t\t\t): () => void {\n\t\t\t\treturn TreeAlpha.on(this.content, \"treeChanged\", ({ delta }) =>\n\t\t\t\t\tprocessCharactersChangedDelta(\n\t\t\t\t\t\tdelta,\n\t\t\t\t\t\t(index) => this.getAtomCharacterAt(index),\n\t\t\t\t\t\tcallback,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tpublic getUniformRun(startIndex: number, endIndex?: number): number {\n\t\t\t\treturn this.content.getUniformRun(startIndex, endIndex);\n\t\t\t}\n\n\t\t\tpublic getString(startIndex: number, endIndex?: number): string {\n\t\t\t\treturn this.content.getString(startIndex, endIndex);\n\t\t\t}\n\t\t}\n\n\t\tfunction textAtomsFromString(\n\t\t\tvalue: string,\n\t\t\tformat: TreeFieldFromImplicitField<FormatSchema>,\n\t\t): Iterable<StringAtom> {\n\t\t\tconst result = mapIterable(charactersFromString(value), (char) => {\n\t\t\t\tconst textAtom = new StringTextAtom({ content: char });\n\t\t\t\tconst data = {\n\t\t\t\t\tcontent: textAtom,\n\t\t\t\t\tformat: TreeBeta.clone<FormatSchema>(format),\n\t\t\t\t};\n\t\t\t\treturn new StringAtom(data as never); // Generic break type safety here. TODO: try and make safer.\n\t\t\t});\n\t\t\treturn result;\n\t\t}\n\n\t\tclass StringArray extends sf.array(\"StringArray\", [() => StringAtom]) {\n\t\t\tpublic withBorrowedSequenceCursor<T>(f: (cursor: ITreeCursorSynchronous) => T): T {\n\t\t\t\tconst innerNode = getInnerNode(this);\n\t\t\t\t// Since the cursor will be used to read content from the tree and won't track observations,\n\t\t\t\t// treat it as if it observed the whole subtree.\n\t\t\t\tcurrentObserver?.observeNodeDeep(innerNode);\n\t\t\t\tconst cursor = innerNode.borrowCursor();\n\t\t\t\tcursor.enterField(EmptyKey);\n\t\t\t\tconst result = f(cursor);\n\t\t\t\tcursor.exitField();\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tprivate getCharactersSubarray(startIndex: number, endIndex: number): string[] {\n\t\t\t\tconst slowPathIndexes: number[] = [];\n\t\t\t\tconst result: string[] = [];\n\t\t\t\tthis.withBorrowedSequenceCursor((cursor) => {\n\t\t\t\t\tforEachNodeSubsequence(cursor, startIndex, endIndex, () => {\n\t\t\t\t\t\tdebugAssert(\n\t\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\t\t(cursor.type as string) === StringAtom.identifier ||\n\t\t\t\t\t\t\t\t\"invalid fullString type optimizations\",\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcursor.enterField(EmptyKey);\n\t\t\t\t\t\tcursor.enterNode(0);\n\t\t\t\t\t\tlet content: string;\n\t\t\t\t\t\tswitch (cursor.type) {\n\t\t\t\t\t\t\tcase StringTextAtom.identifier: {\n\t\t\t\t\t\t\t\tcursor.enterField(EmptyKey);\n\t\t\t\t\t\t\t\tcursor.enterNode(0);\n\t\t\t\t\t\t\t\tcontent = cursor.value as string;\n\t\t\t\t\t\t\t\tdebugAssert(\n\t\t\t\t\t\t\t\t\t() => typeof content === \"string\" || \"invalid fullString type optimizations\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tcursor.exitNode();\n\t\t\t\t\t\t\t\tcursor.exitField();\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// TODO: we could optimize this for constant cases via an optional symbol on the atom schema holding the constant.\n\t\t\t\t\t\t\t// A less general optimization could just include cases for build in types with constant values\n\t\t\t\t\t\t\t// (like below commented code: currently this would cause a cyclical dependency but could be refactored).\n\t\t\t\t\t\t\t// case FormattedTextAsTree.StringLineAtom.identifier: {\n\t\t\t\t\t\t\t// \tcontent = \"\\n\";\n\t\t\t\t\t\t\t// \tbreak;\n\t\t\t\t\t\t\t// }\n\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\tslowPathIndexes.push(result.length);\n\t\t\t\t\t\t\t\tcontent = \"\"; // Placeholder for slow path content\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcursor.exitNode();\n\t\t\t\t\t\tcursor.exitField();\n\t\t\t\t\t\tresult.push(content);\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\t// Fill in slow path cases not optimized above.\n\t\t\t\tfor (const index of slowPathIndexes) {\n\t\t\t\t\tconst node =\n\t\t\t\t\t\tthis[index + startIndex] ??\n\t\t\t\t\t\tfail(\n\t\t\t\t\t\t\t0xd09 /* getCharactersSubarray failed to find index after index range was checked */,\n\t\t\t\t\t\t);\n\t\t\t\t\tresult[index] = node.content.content;\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tpublic charactersCopy(): string[] {\n\t\t\t\treturn this.getCharactersSubarray(0, this.length);\n\t\t\t}\n\n\t\t\tpublic fullString(): string {\n\t\t\t\treturn this.charactersCopy().join(\"\");\n\t\t\t}\n\n\t\t\tpublic getString(startIndex: number, endIndex: number = this.length): string {\n\t\t\t\tvalidateIndexRange(startIndex, endIndex, this, \"FormattedTextAsTree.getString\");\n\t\t\t\treturn this.getCharactersSubarray(startIndex, endIndex).join(\"\");\n\t\t\t}\n\n\t\t\tpublic getUniformRun(startIndex: number, endIndex: number = this.length): number {\n\t\t\t\tvalidateIndexRange(startIndex, endIndex, this, \"FormattedTextAsTree.getUniformRun\");\n\t\t\t\tif (endIndex === startIndex) {\n\t\t\t\t\tthrow new UsageError(\"endIndex must be greater than startIndex for getUniformRun.\");\n\t\t\t\t}\n\t\t\t\tconst arrayLength = this.length;\n\t\t\t\treturn this.withBorrowedSequenceCursor((cursor) => {\n\t\t\t\t\tcursor.enterNode(startIndex);\n\n\t\t\t\t\t// Capture the content type of the first atom\n\t\t\t\t\tcursor.enterField(EmptyKey);\n\t\t\t\t\tcursor.enterNode(0);\n\t\t\t\t\tconst contentType = cursor.type;\n\t\t\t\t\tcursor.exitNode();\n\t\t\t\t\tcursor.exitField();\n\n\t\t\t\t\t// Build a comparator from the format subtree of the first atom\n\t\t\t\t\t// This compares by field key\n\t\t\t\t\tcursor.enterField(formatKey);\n\t\t\t\t\tcursor.enterNode(0);\n\t\t\t\t\tconst formatComparator = buildNodeComparator(cursor);\n\t\t\t\t\tcursor.exitNode();\n\t\t\t\t\tcursor.exitField();\n\n\t\t\t\t\tlet runLength = 1;\n\t\t\t\t\tconst limit = Math.min(endIndex, arrayLength) - startIndex;\n\n\t\t\t\t\twhile (runLength < limit && cursor.nextNode()) {\n\t\t\t\t\t\t// Compare atom type\n\t\t\t\t\t\tcursor.enterField(EmptyKey);\n\t\t\t\t\t\tcursor.enterNode(0);\n\t\t\t\t\t\tconst typeMatches = cursor.type === contentType;\n\t\t\t\t\t\tcursor.exitNode();\n\t\t\t\t\t\tcursor.exitField();\n\t\t\t\t\t\tif (!typeMatches) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Compare format subtree using the compiled comparator\n\t\t\t\t\t\tcursor.enterField(formatKey);\n\t\t\t\t\t\tcursor.enterNode(0);\n\t\t\t\t\t\tconst formatMatches = formatComparator(cursor);\n\t\t\t\t\t\tcursor.exitNode();\n\t\t\t\t\t\tcursor.exitField();\n\n\t\t\t\t\t\tif (formatMatches !== true) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\trunLength++;\n\t\t\t\t\t}\n\t\t\t\t\tcursor.exitNode();\n\t\t\t\t\treturn runLength;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * A unit of the text, with formatting.\n\t\t */\n\t\tclass StringAtom\n\t\t\textends sf.object(\"StringAtom\", {\n\t\t\t\tcontent: SchemaFactory.required(atoms, { key: EmptyKey }),\n\t\t\t\tformat: SchemaFactory.required(formatSchema),\n\t\t\t})\n\t\t\timplements\n\t\t\t\tFormattedAtom<\n\t\t\t\t\tTreeNodeFromImplicitAllowedTypes<FormatSchema>,\n\t\t\t\t\tTreeNodeFromImplicitAllowedTypes<typeof atoms>\n\t\t\t\t> {}\n\n\t\t/**\n\t\t * Schema for a text node.\n\t\t * @remarks\n\t\t * See {@link FormattedTextAsTree.Members} for the API.\n\t\t * See {@link FormattedTextAsTree.Statics} for static APIs on this Schema, including construction.\n\t\t */\n\t\tconst Tree = eraseSchemaDetailsSubclassable<\n\t\t\tFormattedTextMembers<FormatSchema, ExtraAtomsSchema>,\n\t\t\tStatics<Tree>\n\t\t>()(TextNode);\n\t\ttype Tree = ErasedNode<\n\t\t\tFormattedTextMembers<FormatSchema, ExtraAtomsSchema>,\n\t\t\tFormattedTextSchemaIdentifier<TUserScope>\n\t\t>;\n\n\t\treturn Tree;\n\t}\n\n\t/**\n\t * Portion of a string with formatting.\n\t * @sealed\n\t * @internal\n\t */\n\texport interface FormattedAtom<TFormat, TText> {\n\t\treadonly content: TText;\n\t\tformat: TFormat;\n\t}\n\n\t/**\n\t * Portion of a string.\n\t * @internal\n\t */\n\texport interface TextAtom {\n\t\t/**\n\t\t * The content of the text atom, viewed as a string.\n\t\t */\n\t\treadonly content: string;\n\t}\n\n\t/**\n\t * Unit in the string representing a single character.\n\t * @internal\n\t */\n\texport class StringTextAtom\n\t\textends sfStatic.object(\"StringTextAtom\", {\n\t\t\t/**\n\t\t\t * The underlying text content of this atom.\n\t\t\t * @remarks\n\t\t\t * This is typically a single Unicode code point, and thus may contain multiple UTF-16 surrogate pair code units.\n\t\t\t * Using longer strings is still valid. For example, so users might store whole grapheme clusters here, or even longer sections of text.\n\t\t\t * Anything combined into a single atom will be treated atomically, and can not be partially selected or formatted.\n\t\t\t * Using larger atoms and splitting them as needed is NOT a recommended approach, since this will result in poor merge behavior for concurrent edits.\n\t\t\t * Instead atoms should always be the smallest unit of text which will be independently selected, moved or formatted.\n\t\t\t * @privateRemarks\n\t\t\t * This content logically represents the whole atom's content, so using {@link EmptyKey} makes sense to help indicate that.\n\t\t\t */\n\t\t\tcontent: SchemaFactory.required([SchemaFactory.string], { key: EmptyKey }),\n\t\t})\n\t\timplements TextAtom {}\n\n\t/**\n\t * Statics for text nodes.\n\t * @internal\n\t */\n\texport interface Statics<TTree> {\n\t\t/**\n\t\t * Construct a node of `this` schema from a string, where each character (as defined by iterating over the string) becomes a single character in the text node.\n\t\t * @remarks This combines pairs of utf-16 surrogate code units into single characters as appropriate.\n\t\t */\n\t\tfromString(value: string): TTree;\n\t}\n\n\t/**\n\t * Interface for a text node.\n\t * @remarks\n\t * The string is broken up into substrings which are referred to as 'characters'.\n\t * Unlike with JavaScript strings, all indexes are by character, not UTF-16 code unit.\n\t * This avoids the problem JavaScript where it can split UTF-16 surrogate pairs producing invalid strings,\n\t * and avoids the issue where indexing a string and iterating it segment the string differently.\n\t * This does NOT mean the characters correspond to user perceived characters (like grapheme clusters try to do):\n\t * applications will likely want to include higher level segmentation logic\n\t * which might differ between operations like delete\n\t * (which often operates on something in between unicode code points and grapheme clusters)\n\t * and navigation/selection (which typically uses grapheme clusters).\n\t *\n\t * @see {@link FormattedTextAsTree.Statics.fromString} for construction.\n\t * @see {@link FormattedTextAsTree.createSchema} for creating schemas whose nodes implement this.\n\t * @internal\n\t */\n\texport interface Members<TFormatTree, TPartialFormat, TFormattedAtom, TFormattedInsert>\n\t\textends TextAsTree.Members {\n\t\t/**\n\t\t * Format to use by default for text inserted with non-formatted APIs.\n\t\t * @remarks\n\t\t * This is not persisted in the tree, and observation of it is not tracked by the tree observation tracking.\n\t\t * @privateRemarks\n\t\t * Opt this into observation tracking.\n\t\t */\n\t\tdefaultFormat: TFormatTree;\n\n\t\t/**\n\t\t * Gets an array type view of the characters currently in the text.\n\t\t * @remarks\n\t\t * This iterator matches the behavior of {@link (TreeArrayNode:interface)} with respect to edits during iteration.\n\t\t * @privateRemarks\n\t\t * Currently this is implemented by a node and changes with the text over time.\n\t\t * We might not want to leak a node like this in the API.\n\t\t * Providing a way to index and iterate separately might be better.\n\t\t */\n\t\tcharactersWithFormatting(): readonly TFormattedAtom[];\n\n\t\t/**\n\t\t * Insert a range of characters into the string based on character index.\n\t\t * @remarks\n\t\t * See {@link (TreeArrayNode:interface).insertAt} for more details on the behavior.\n\t\t * See {@link FormattedTextAsTree.Statics.fromString} for how the `additionalCharacters` string is broken into characters.\n\t\t * @privateRemarks\n\t\t * If we provide ways to customize character boundaries, that could be handled here by taking in an Iterable<string> instead of a string.\n\t\t * Doing this currently would enable insertion of text with different character boundaries than the existing text,\n\t\t * which would violate the currently documented character boundary invariants.\n\t\t *\n\t\t * Another option would be to take an approach like Table,\n\t\t * where the user of the API uses a factory function to generate the schema, and can inject custom logic, like a string character iterator.\n\t\t */\n\t\tinsertWithFormattingAt(\n\t\t\tindex: number,\n\t\t\tadditionalCharacters: Iterable<TFormattedInsert>,\n\t\t): void;\n\n\t\t/**\n\t\t * Apply formatting to a range of characters based on character index.\n\t\t * @param startIndex - The starting index (inclusive) of the range to format.\n\t\t * @param endIndex - The ending index (exclusive) of the range to format.\n\t\t * @param format - The formatting to apply to the specified range.\n\t\t * @remarks\n\t\t * The start and end behave the same as in {@link (TreeArrayNode:interface).removeRange}.\n\t\t */\n\t\tformatRange(\n\t\t\tstartIndex: number | undefined,\n\t\t\tendIndex: number | undefined,\n\t\t\tformat: TPartialFormat,\n\t\t): void;\n\n\t\t/**\n\t\t * Returns the length of the run of characters starting at `startIndex` which have the same formatting and atom type, up to `endIndex`.\n\t\t * @param startIndex - The starting index of the run.\n\t\t * @param endIndex - The ending index (exclusive) of the run. Defaults to the end of the text.\n\t\t */\n\t\tgetUniformRun(startIndex: number, endIndex?: number): number;\n\t\t/**\n\t\t * Returns a substring of the text from `startIndex` to `endIndex`\n\t\t * @param startIndex - starting index (inclusive)\n\t\t * @param endIndex - Optional ending index (exclusive). Defaults to the end of the text.\n\t\t */\n\t\tgetString(startIndex: number, endIndex?: number): string;\n\n\t\t/**\n\t\t * Subscribe to all content changes on this text node, including both shallow\n\t\t * changes (inserts/removes) and deep changes (formatting updates on existing characters).\n\t\t * @param callback - Called after each change with a sequence of {@link TextAsTree.TextOp}s describing what changed,\n\t\t * or `undefined` when a delta could not be computed (e.g. during a schema upgrade).\n\t\t * @returns A cleanup function that unsubscribes the callback when called.\n\t\t * @remarks\n\t\t * Unlike {@link TextAsTree.Members.onCharactersChanged} which only fires on\n\t\t * shallow changes (inserts and removes), this method also fires on deep changes —\n\t\t * formatting property updates on existing characters.\n\t\t * The {@link TextAsTree.TextRetainOp.formattingChanged} flag on retain ops\n\t\t * indicates which character ranges had formatting updates.\n\t\t *\n\t\t * All counts in the delivered ops are in Unicode code points, not UTF-16 code units.\n\t\t * For characters outside the Basic Multilingual Plane (e.g. emoji), one code point\n\t\t * corresponds to two UTF-16 code units — convert before using the counts as string indices.\n\t\t */\n\t\tonContentChanged(\n\t\t\tcallback: (ops: readonly TextAsTree.TextOp[] | undefined) => void,\n\t\t): () => void;\n\t}\n\n\t/**\n\t * Insertable shape for a formatted text atom used by {@link FormattedTextAsTree.Members.insertWithFormattingAt}.\n\t * @internal\n\t */\n\texport interface FormattedAtomInsertable<TFormat, TContent> {\n\t\treadonly content: TContent;\n\t\treadonly format: TFormat;\n\t}\n\n\t/**\n\t * Schema identifier for the a generic formatted text schema.\n\t * @privateRemarks\n\t * Eventually this should probably be given a better name and/or made a system type in a system namespace.\n\t * @internal\n\t */\n\texport type FormattedTextSchemaIdentifier<TUserScope extends string> = ScopedSchemaName<\n\t\t`com.fluidframework.text.formatted<${TUserScope}>`,\n\t\t\"Text\"\n\t>;\n\n\t/**\n\t * Helper for expressing the full set of formatted text atoms for a given schema.\n\t * @privateRemarks\n\t * Eventually this should probably be given a better name and/or made a system type in a system namespace.\n\t * @internal\n\t */\n\texport type FormattedTextAtoms<\n\t\tExtraAtomsSchema extends readonly LazyItem<\n\t\t\tTreeNodeSchema<string, NodeKind, TextAtom & TreeNode>\n\t\t>[],\n\t> = readonly [typeof StringTextAtom, ...ExtraAtomsSchema];\n\n\t/**\n\t * Helper for configuring {@link FormattedTextAsTree.Members}.\n\t * @privateRemarks\n\t * Eventually this should probably be inlined into `FormattedTextAsTree.Members` or made a system type in a system namespace.\n\t * The approach should be evaluated after settling on a redesign of the `formatRange` API as that will impact what the type parameters are.\n\t * @internal\n\t */\n\texport type FormattedTextMembers<\n\t\tFormatSchema extends ImplicitAllowedTypes,\n\t\tExtraAtomsSchema extends readonly LazyItem<\n\t\t\tTreeNodeSchema<string, NodeKind, TextAtom & TreeNode>\n\t\t>[],\n\t> = Members<\n\t\tTreeFieldFromImplicitField<FormatSchema>,\n\t\tPartial<TreeNodeFromImplicitAllowedTypes<FormatSchema>>,\n\t\tFormattedAtom<\n\t\t\tTreeNodeFromImplicitAllowedTypes<FormatSchema>,\n\t\t\tTreeNodeFromImplicitAllowedTypes<FormattedTextAtoms<ExtraAtomsSchema>>\n\t\t>,\n\t\tFormattedAtomInsertable<\n\t\t\tInsertableTreeNodeFromImplicitAllowedTypes<FormatSchema>,\n\t\t\tInsertableTreeNodeFromImplicitAllowedTypes<FormattedTextAtoms<ExtraAtomsSchema>>\n\t\t>\n\t>;\n\n\t/**\n\t * A generic type for a formatted text schema.\n\t * @internal\n\t */\n\texport type FormattedTextSchema<\n\t\tTUserScope extends string,\n\t\tFormatSchema extends ImplicitAllowedTypes,\n\t\tExtraAtomsSchema extends readonly LazyItem<\n\t\t\tTreeNodeSchema<string, NodeKind, TextAtom & TreeNode>\n\t\t>[],\n\t> = Statics<\n\t\tErasedNode<\n\t\t\tFormattedTextMembers<FormatSchema, ExtraAtomsSchema>,\n\t\t\tFormattedTextSchemaIdentifier<TUserScope>\n\t\t>\n\t> &\n\t\tErasedSchemaSubclassable<\n\t\t\tFormattedTextMembers<FormatSchema, ExtraAtomsSchema>,\n\t\t\tFormattedTextSchemaIdentifier<TUserScope>\n\t\t>;\n}\n"]}
@@ -0,0 +1,273 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { TreeNodeFromImplicitAllowedTypes, InsertableTreeNodeFromImplicitAllowedTypes } from "../simple-tree/index.js";
6
+ import { FormattedTextAsTree } from "./textDomainFormatted.js";
7
+ /**
8
+ * A collection of text related types, schema and utilities for working with text beyond the basic {@link SchemaStatics.string}.
9
+ * @remarks
10
+ * This is a default parameterization of the generic {@link FormattedTextAsTree} with hard-coded assumptions about what kind of embedded content and what kind of formatting is supported.
11
+ * It is unlikely this meets the needs of most users, but it can serve as an unstable example of how to use the generic {@link FormattedTextAsTree}.
12
+ * @internal
13
+ */
14
+ export declare namespace FormattedTextAsTreeDefault {
15
+ /**
16
+ * Portion of a string with formatting.
17
+ * @sealed
18
+ * @internal
19
+ */
20
+ export type FormattedAtom = FormattedTextAsTree.FormattedAtom<CharacterFormat, StringAtomContent>;
21
+ const CharacterFormat_base: import("../simple-tree/index.js").ObjectNodeSchemaWorkaround<"com.fluidframework.text.formatted.default.CharacterFormat", {
22
+ readonly bold: import("../simple-tree/leafNodeSchema.js").LeafSchema<"boolean", boolean>;
23
+ readonly italic: import("../simple-tree/leafNodeSchema.js").LeafSchema<"boolean", boolean>;
24
+ readonly underline: import("../simple-tree/leafNodeSchema.js").LeafSchema<"boolean", boolean>;
25
+ readonly size: import("../simple-tree/leafNodeSchema.js").LeafSchema<"number", number>;
26
+ readonly font: import("../simple-tree/leafNodeSchema.js").LeafSchema<"string", string>;
27
+ }, true, unknown>;
28
+ /**
29
+ * Formatting options for characters.
30
+ * @internal
31
+ */
32
+ export class CharacterFormat extends CharacterFormat_base {
33
+ static readonly defaultFormat: CharacterFormat;
34
+ }
35
+ /**
36
+ * Tag with which a line in text can be formatted from HTML.
37
+ * @internal
38
+ */
39
+ export const LineTag: (<TValue extends "ol" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "checked" | "unchecked" | "blockquote" | "codeBlock">(value: TValue) => TValue extends unknown ? import("../simple-tree/index.js").TreeNode & {
40
+ readonly value: TValue;
41
+ } : never) & {
42
+ h1: import("../simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.text.formatted.default.lineTag.h1" | "com.h1", import("../simple-tree/index.js").NodeKind.Object, import("../simple-tree/index.js").TreeNode & {
43
+ readonly value: "h1";
44
+ }, Record<string, never>, true, Record<string, never>, undefined>;
45
+ h3: import("../simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.text.formatted.default.lineTag.h3" | "com.h3", import("../simple-tree/index.js").NodeKind.Object, import("../simple-tree/index.js").TreeNode & {
46
+ readonly value: "h3";
47
+ }, Record<string, never>, true, Record<string, never>, undefined>;
48
+ codeBlock: import("../simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.text.formatted.default.lineTag.codeBlock" | "com.codeBlock", import("../simple-tree/index.js").NodeKind.Object, import("../simple-tree/index.js").TreeNode & {
49
+ readonly value: "codeBlock";
50
+ }, Record<string, never>, true, Record<string, never>, undefined>;
51
+ h2: import("../simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.text.formatted.default.lineTag.h2" | "com.h2", import("../simple-tree/index.js").NodeKind.Object, import("../simple-tree/index.js").TreeNode & {
52
+ readonly value: "h2";
53
+ }, Record<string, never>, true, Record<string, never>, undefined>;
54
+ h4: import("../simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.text.formatted.default.lineTag.h4" | "com.h4", import("../simple-tree/index.js").NodeKind.Object, import("../simple-tree/index.js").TreeNode & {
55
+ readonly value: "h4";
56
+ }, Record<string, never>, true, Record<string, never>, undefined>;
57
+ unchecked: import("../simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.text.formatted.default.lineTag.unchecked" | "com.unchecked", import("../simple-tree/index.js").NodeKind.Object, import("../simple-tree/index.js").TreeNode & {
58
+ readonly value: "unchecked";
59
+ }, Record<string, never>, true, Record<string, never>, undefined>;
60
+ h5: import("../simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.text.formatted.default.lineTag.h5" | "com.h5", import("../simple-tree/index.js").NodeKind.Object, import("../simple-tree/index.js").TreeNode & {
61
+ readonly value: "h5";
62
+ }, Record<string, never>, true, Record<string, never>, undefined>;
63
+ li: import("../simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.text.formatted.default.lineTag.li" | "com.li", import("../simple-tree/index.js").NodeKind.Object, import("../simple-tree/index.js").TreeNode & {
64
+ readonly value: "li";
65
+ }, Record<string, never>, true, Record<string, never>, undefined>;
66
+ ol: import("../simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.text.formatted.default.lineTag.ol" | "com.ol", import("../simple-tree/index.js").NodeKind.Object, import("../simple-tree/index.js").TreeNode & {
67
+ readonly value: "ol";
68
+ }, Record<string, never>, true, Record<string, never>, undefined>;
69
+ checked: import("../simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.text.formatted.default.lineTag.checked" | "com.checked", import("../simple-tree/index.js").NodeKind.Object, import("../simple-tree/index.js").TreeNode & {
70
+ readonly value: "checked";
71
+ }, Record<string, never>, true, Record<string, never>, undefined>;
72
+ blockquote: import("../simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.text.formatted.default.lineTag.blockquote" | "com.blockquote", import("../simple-tree/index.js").NodeKind.Object, import("../simple-tree/index.js").TreeNode & {
73
+ readonly value: "blockquote";
74
+ }, Record<string, never>, true, Record<string, never>, undefined>;
75
+ } & {
76
+ readonly schema: [import("../simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.text.formatted.default.lineTag.ol" | "com.ol", import("../simple-tree/index.js").NodeKind.Object, import("../simple-tree/index.js").TreeNode & {
77
+ readonly value: "ol";
78
+ }, Record<string, never>, true, Record<string, never>, undefined>, import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.li" | "com.li", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
79
+ readonly value: "li";
80
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.h1" | "com.h1", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
81
+ readonly value: "h1";
82
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.h2" | "com.h2", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
83
+ readonly value: "h2";
84
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.h3" | "com.h3", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
85
+ readonly value: "h3";
86
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.h4" | "com.h4", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
87
+ readonly value: "h4";
88
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.h5" | "com.h5", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
89
+ readonly value: "h5";
90
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.checked" | "com.checked", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
91
+ readonly value: "checked";
92
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.unchecked" | "com.unchecked", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
93
+ readonly value: "unchecked";
94
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.blockquote" | "com.blockquote", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
95
+ readonly value: "blockquote";
96
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.codeBlock" | "com.codeBlock", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
97
+ readonly value: "codeBlock";
98
+ })];
99
+ };
100
+ /**
101
+ * {@inheritdoc FormattedTextAsTreeDefault.(LineTag:variable)}
102
+ * @internal
103
+ */
104
+ export type LineTag = TreeNodeFromImplicitAllowedTypes<typeof LineTag.schema>;
105
+ const StringLineAtom_base: import("../simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.text.formatted.default.StringLineAtom", import("../simple-tree/index.js").NodeKind.Object, import("../simple-tree/index.js").TreeObjectNode<{
106
+ readonly tag: [import("../simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.text.formatted.default.lineTag.ol" | "com.ol", import("../simple-tree/index.js").NodeKind.Object, import("../simple-tree/index.js").TreeNode & {
107
+ readonly value: "ol";
108
+ }, Record<string, never>, true, Record<string, never>, undefined>, import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.li" | "com.li", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
109
+ readonly value: "li";
110
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.h1" | "com.h1", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
111
+ readonly value: "h1";
112
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.h2" | "com.h2", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
113
+ readonly value: "h2";
114
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.h3" | "com.h3", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
115
+ readonly value: "h3";
116
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.h4" | "com.h4", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
117
+ readonly value: "h4";
118
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.h5" | "com.h5", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
119
+ readonly value: "h5";
120
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.checked" | "com.checked", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
121
+ readonly value: "checked";
122
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.unchecked" | "com.unchecked", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
123
+ readonly value: "unchecked";
124
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.blockquote" | "com.blockquote", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
125
+ readonly value: "blockquote";
126
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.codeBlock" | "com.codeBlock", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
127
+ readonly value: "codeBlock";
128
+ })];
129
+ readonly indent: import("../simple-tree/leafNodeSchema.js").LeafSchema<"number", number>;
130
+ }, "com.fluidframework.text.formatted.default.StringLineAtom">, object & {
131
+ readonly tag: Record<string, never> | (Record<string, never> & import("../simple-tree/index.js").TreeNode & {
132
+ readonly value: "ol";
133
+ }) | (Record<string, never> & import("../simple-tree/index.js").TreeNode & {
134
+ readonly value: "li";
135
+ }) | (Record<string, never> & import("../simple-tree/index.js").TreeNode & {
136
+ readonly value: "h1";
137
+ }) | (Record<string, never> & import("../simple-tree/index.js").TreeNode & {
138
+ readonly value: "h2";
139
+ }) | (Record<string, never> & import("../simple-tree/index.js").TreeNode & {
140
+ readonly value: "h3";
141
+ }) | (Record<string, never> & import("../simple-tree/index.js").TreeNode & {
142
+ readonly value: "h4";
143
+ }) | (Record<string, never> & import("../simple-tree/index.js").TreeNode & {
144
+ readonly value: "h5";
145
+ }) | (Record<string, never> & import("../simple-tree/index.js").TreeNode & {
146
+ readonly value: "checked";
147
+ }) | (Record<string, never> & import("../simple-tree/index.js").TreeNode & {
148
+ readonly value: "unchecked";
149
+ }) | (Record<string, never> & import("../simple-tree/index.js").TreeNode & {
150
+ readonly value: "blockquote";
151
+ }) | (Record<string, never> & import("../simple-tree/index.js").TreeNode & {
152
+ readonly value: "codeBlock";
153
+ }) | (import("../simple-tree/index.js").TreeNode & {
154
+ readonly value: "ol";
155
+ } & Record<string, never>) | (import("../simple-tree/index.js").TreeNode & {
156
+ readonly value: "ol";
157
+ }) | (import("../simple-tree/index.js").TreeNode & {
158
+ readonly value: "li";
159
+ } & Record<string, never>) | (import("../simple-tree/index.js").TreeNode & {
160
+ readonly value: "li";
161
+ }) | (import("../simple-tree/index.js").TreeNode & {
162
+ readonly value: "h1";
163
+ } & Record<string, never>) | (import("../simple-tree/index.js").TreeNode & {
164
+ readonly value: "h1";
165
+ }) | (import("../simple-tree/index.js").TreeNode & {
166
+ readonly value: "h2";
167
+ } & Record<string, never>) | (import("../simple-tree/index.js").TreeNode & {
168
+ readonly value: "h2";
169
+ }) | (import("../simple-tree/index.js").TreeNode & {
170
+ readonly value: "h3";
171
+ } & Record<string, never>) | (import("../simple-tree/index.js").TreeNode & {
172
+ readonly value: "h3";
173
+ }) | (import("../simple-tree/index.js").TreeNode & {
174
+ readonly value: "h4";
175
+ } & Record<string, never>) | (import("../simple-tree/index.js").TreeNode & {
176
+ readonly value: "h4";
177
+ }) | (import("../simple-tree/index.js").TreeNode & {
178
+ readonly value: "h5";
179
+ } & Record<string, never>) | (import("../simple-tree/index.js").TreeNode & {
180
+ readonly value: "h5";
181
+ }) | (import("../simple-tree/index.js").TreeNode & {
182
+ readonly value: "checked";
183
+ } & Record<string, never>) | (import("../simple-tree/index.js").TreeNode & {
184
+ readonly value: "checked";
185
+ }) | (import("../simple-tree/index.js").TreeNode & {
186
+ readonly value: "unchecked";
187
+ } & Record<string, never>) | (import("../simple-tree/index.js").TreeNode & {
188
+ readonly value: "unchecked";
189
+ }) | (import("../simple-tree/index.js").TreeNode & {
190
+ readonly value: "blockquote";
191
+ } & Record<string, never>) | (import("../simple-tree/index.js").TreeNode & {
192
+ readonly value: "blockquote";
193
+ }) | (import("../simple-tree/index.js").TreeNode & {
194
+ readonly value: "codeBlock";
195
+ } & Record<string, never>) | (import("../simple-tree/index.js").TreeNode & {
196
+ readonly value: "codeBlock";
197
+ });
198
+ readonly indent: number;
199
+ }, true, {
200
+ readonly tag: [import("../simple-tree/index.js").TreeNodeSchemaClass<"com.fluidframework.text.formatted.default.lineTag.ol" | "com.ol", import("../simple-tree/index.js").NodeKind.Object, import("../simple-tree/index.js").TreeNode & {
201
+ readonly value: "ol";
202
+ }, Record<string, never>, true, Record<string, never>, undefined>, import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.li" | "com.li", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
203
+ readonly value: "li";
204
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.h1" | "com.h1", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
205
+ readonly value: "h1";
206
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.h2" | "com.h2", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
207
+ readonly value: "h2";
208
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.h3" | "com.h3", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
209
+ readonly value: "h3";
210
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.h4" | "com.h4", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
211
+ readonly value: "h4";
212
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.h5" | "com.h5", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
213
+ readonly value: "h5";
214
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.checked" | "com.checked", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
215
+ readonly value: "checked";
216
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.unchecked" | "com.unchecked", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
217
+ readonly value: "unchecked";
218
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.blockquote" | "com.blockquote", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
219
+ readonly value: "blockquote";
220
+ }), import("../simple-tree/index.js").TreeNodeSchemaCore<"com.fluidframework.text.formatted.default.lineTag.codeBlock" | "com.codeBlock", import("../simple-tree/index.js").NodeKind.Object, true, Record<string, never>, Record<string, never>, unknown> & (new (data?: Record<string, never> | import("../simple-tree/index.js").InternalTreeNode | undefined) => import("../simple-tree/index.js").TreeNode & {
221
+ readonly value: "codeBlock";
222
+ })];
223
+ readonly indent: import("../simple-tree/leafNodeSchema.js").LeafSchema<"number", number>;
224
+ }, never, unknown>;
225
+ /**
226
+ * Unit in the string representing a new line character with line formatting.
227
+ * @remarks
228
+ * This aligns with how Quill represents line formatting.
229
+ * Quill formats line attributes (headers, list, blockquote, etc... ) on the newline character
230
+ * and only lines using this atom can have line-specific formatting.
231
+ * The optional indent level mirrors Quill's indent attribute,
232
+ * which is applies to the line before the line break.
233
+ * Any tagged line can be indented independently.
234
+ * @internal
235
+ */
236
+ export class StringLineAtom extends StringLineAtom_base {
237
+ readonly content = "\n";
238
+ }
239
+ /**
240
+ * Types of "atoms" that make up the text.
241
+ * @internal
242
+ */
243
+ export const StringAtomContent: readonly [typeof FormattedTextAsTree.StringTextAtom, typeof StringLineAtom];
244
+ /**
245
+ * {@inheritdoc FormattedTextAsTreeDefault.(StringAtomContent:variable)}
246
+ * @internal
247
+ */
248
+ export type StringAtomContent = TreeNodeFromImplicitAllowedTypes<typeof StringAtomContent>;
249
+ /**
250
+ * Statics for text nodes.
251
+ * @internal
252
+ */
253
+ export type Statics<TTree = Tree> = FormattedTextAsTree.Statics<TTree>;
254
+ /**
255
+ * Insertable shape for a formatted text atom used by {@link FormattedTextAsTree.Members.insertWithFormattingAt}.
256
+ * @internal
257
+ */
258
+ export type FormattedAtomInsertable = FormattedTextAsTree.FormattedAtom<InsertableTreeNodeFromImplicitAllowedTypes<typeof CharacterFormat>, InsertableTreeNodeFromImplicitAllowedTypes<FormattedTextAtoms>>;
259
+ /**
260
+ * Helper for expressing the full set of formatted text atoms for a given schema.
261
+ * @privateRemarks
262
+ * Eventually this should probably be given a better name and/or made a system type in a system namespace.
263
+ * @internal
264
+ */
265
+ export type FormattedTextAtoms = FormattedTextAsTree.FormattedTextAtoms<[
266
+ typeof StringLineAtom
267
+ ]>;
268
+ const Tree_base: FormattedTextAsTree.FormattedTextSchema<"default", typeof CharacterFormat, readonly [typeof StringLineAtom]>;
269
+ export class Tree extends Tree_base {
270
+ }
271
+ export {};
272
+ }
273
+ //# sourceMappingURL=textDomainFormattedDefault.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textDomainFormattedD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,aAAa,CACtE,0CAA0C,CAAC,OAAO,eAAe,CAAC,EAClE,0CAA0C,CAAC,kBAAkB,CAAC,CAC9D,CAAC;IAEF;;;;;OAKG;IACH,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,kBAAkB,CACtE;QAAC,OAAO,cAAc;KAAC,CACvB,CAAC;;IAEF,MAAM,OAAO,IAAK,SAAQ,SAKzB;KAAG;;CACJ"}
@@ -0,0 +1,91 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { enumFromStrings, SchemaFactory, SchemaFactoryAlpha, SchemaFactoryBeta, } from "../simple-tree/index.js";
6
+ import { FormattedTextAsTree } from "./textDomainFormatted.js";
7
+ /**
8
+ * Schema factory for default formatted text types which are not generic.
9
+ */
10
+ const sf = new SchemaFactoryAlpha("com.fluidframework.text.formatted.default");
11
+ const defaultFormat = {
12
+ bold: false,
13
+ italic: false,
14
+ underline: false,
15
+ size: 12,
16
+ font: "Arial",
17
+ };
18
+ /**
19
+ * A collection of text related types, schema and utilities for working with text beyond the basic {@link SchemaStatics.string}.
20
+ * @remarks
21
+ * This is a default parameterization of the generic {@link FormattedTextAsTree} with hard-coded assumptions about what kind of embedded content and what kind of formatting is supported.
22
+ * It is unlikely this meets the needs of most users, but it can serve as an unstable example of how to use the generic {@link FormattedTextAsTree}.
23
+ * @internal
24
+ */
25
+ export var FormattedTextAsTreeDefault;
26
+ (function (FormattedTextAsTreeDefault) {
27
+ /**
28
+ * Formatting options for characters.
29
+ * @internal
30
+ */
31
+ class CharacterFormat extends sf.objectAlpha("CharacterFormat", {
32
+ bold: SchemaFactory.boolean,
33
+ italic: SchemaFactory.boolean,
34
+ underline: SchemaFactory.boolean,
35
+ size: SchemaFactory.number,
36
+ font: SchemaFactory.string,
37
+ }) {
38
+ }
39
+ CharacterFormat.defaultFormat = new CharacterFormat(defaultFormat);
40
+ FormattedTextAsTreeDefault.CharacterFormat = CharacterFormat;
41
+ /**
42
+ * Tag with which a line in text can be formatted from HTML.
43
+ * @internal
44
+ */
45
+ FormattedTextAsTreeDefault.LineTag = enumFromStrings(sf.scopedFactory("lineTag"), [
46
+ "h1",
47
+ "h2",
48
+ "h3",
49
+ "h4",
50
+ "h5",
51
+ "li",
52
+ "ol",
53
+ "checked",
54
+ "unchecked",
55
+ "blockquote",
56
+ "codeBlock",
57
+ ]);
58
+ /**
59
+ * Unit in the string representing a new line character with line formatting.
60
+ * @remarks
61
+ * This aligns with how Quill represents line formatting.
62
+ * Quill formats line attributes (headers, list, blockquote, etc... ) on the newline character
63
+ * and only lines using this atom can have line-specific formatting.
64
+ * The optional indent level mirrors Quill's indent attribute,
65
+ * which is applies to the line before the line break.
66
+ * Any tagged line can be indented independently.
67
+ * @internal
68
+ */
69
+ class StringLineAtom extends sf.object("StringLineAtom", {
70
+ tag: FormattedTextAsTreeDefault.LineTag.schema,
71
+ indent: SchemaFactory.number,
72
+ }) {
73
+ constructor() {
74
+ super(...arguments);
75
+ this.content = "\n";
76
+ }
77
+ }
78
+ FormattedTextAsTreeDefault.StringLineAtom = StringLineAtom;
79
+ /**
80
+ * Types of "atoms" that make up the text.
81
+ * @internal
82
+ */
83
+ FormattedTextAsTreeDefault.StringAtomContent = [
84
+ FormattedTextAsTree.StringTextAtom,
85
+ StringLineAtom,
86
+ ];
87
+ class Tree extends FormattedTextAsTree.createSchema(new SchemaFactoryBeta("default"), CharacterFormat, [StringLineAtom], defaultFormat) {
88
+ }
89
+ FormattedTextAsTreeDefault.Tree = Tree;
90
+ })(FormattedTextAsTreeDefault || (FormattedTextAsTreeDefault = {}));
91
+ //# sourceMappingURL=textDomainFormattedDefault.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textDomainFormattedDefault.js","sourceRoot":"","sources":["../../src/text/textDomainFormattedDefault.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,iBA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Ac,iBAK1B,CAAA;IAED;;;OAGG;IACU,4CAAiB,GAAG;QAChC,mBAAmB,CAAC,cAAc;QAClC,cAAc;KACL,CAAC;IAgCX,MAAa,IAAK,SAAQ,mBAAmB,CAAC,YAAY,CACzD,IAAI,iBAAiB,CAAC,SAAS,CAAC,EAChC,eAAe,EACf,CAAC,cAAc,CAAC,EAChB,aAAa,CACb;KAAG;IALS,+BAAI,OAKb,CAAA;AACL,CAAC,EA/GgB,0BAA0B,KAA1B,0BAA0B,QA+G1C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tenumFromStrings,\n\tSchemaFactory,\n\tSchemaFactoryAlpha,\n\tSchemaFactoryBeta,\n} from \"../simple-tree/index.js\";\nimport type {\n\tTreeNodeFromImplicitAllowedTypes,\n\tInsertableTreeNodeFromImplicitAllowedTypes,\n} from \"../simple-tree/index.js\";\n\nimport { FormattedTextAsTree } from \"./textDomainFormatted.js\";\n\n/**\n * Schema factory for default formatted text types which are not generic.\n */\nconst sf = new SchemaFactoryAlpha(\"com.fluidframework.text.formatted.default\");\n\nconst defaultFormat = {\n\tbold: false,\n\titalic: false,\n\tunderline: false,\n\tsize: 12,\n\tfont: \"Arial\",\n} as const;\n\n/**\n * A collection of text related types, schema and utilities for working with text beyond the basic {@link SchemaStatics.string}.\n * @remarks\n * This is a default parameterization of the generic {@link FormattedTextAsTree} with hard-coded assumptions about what kind of embedded content and what kind of formatting is supported.\n * It is unlikely this meets the needs of most users, but it can serve as an unstable example of how to use the generic {@link FormattedTextAsTree}.\n * @internal\n */\nexport namespace FormattedTextAsTreeDefault {\n\t/**\n\t * Portion of a string with formatting.\n\t * @sealed\n\t * @internal\n\t */\n\texport type FormattedAtom = FormattedTextAsTree.FormattedAtom<\n\t\tCharacterFormat,\n\t\tStringAtomContent\n\t>;\n\n\t/**\n\t * Formatting options for characters.\n\t * @internal\n\t */\n\texport class CharacterFormat extends sf.objectAlpha(\"CharacterFormat\", {\n\t\tbold: SchemaFactory.boolean,\n\t\titalic: SchemaFactory.boolean,\n\t\tunderline: SchemaFactory.boolean,\n\t\tsize: SchemaFactory.number,\n\t\tfont: SchemaFactory.string,\n\t}) {\n\t\tpublic static readonly defaultFormat = new CharacterFormat(defaultFormat);\n\t}\n\n\t/**\n\t * Tag with which a line in text can be formatted from HTML.\n\t * @internal\n\t */\n\texport const LineTag = enumFromStrings(sf.scopedFactory(\"lineTag\"), [\n\t\t\"h1\",\n\t\t\"h2\",\n\t\t\"h3\",\n\t\t\"h4\",\n\t\t\"h5\",\n\t\t\"li\",\n\t\t\"ol\",\n\t\t\"checked\",\n\t\t\"unchecked\",\n\t\t\"blockquote\",\n\t\t\"codeBlock\",\n\t]);\n\t/**\n\t * {@inheritdoc FormattedTextAsTreeDefault.(LineTag:variable)}\n\t * @internal\n\t */\n\texport type LineTag = TreeNodeFromImplicitAllowedTypes<typeof LineTag.schema>;\n\n\t/**\n\t * Unit in the string representing a new line character with line formatting.\n\t * @remarks\n\t * This aligns with how Quill represents line formatting.\n\t * Quill formats line attributes (headers, list, blockquote, etc... ) on the newline character\n\t * and only lines using this atom can have line-specific formatting.\n\t * The optional indent level mirrors Quill's indent attribute,\n\t * which is applies to the line before the line break.\n\t * Any tagged line can be indented independently.\n\t * @internal\n\t */\n\texport class StringLineAtom extends sf.object(\"StringLineAtom\", {\n\t\ttag: LineTag.schema,\n\t\tindent: SchemaFactory.number,\n\t}) {\n\t\tpublic readonly content = \"\\n\";\n\t}\n\n\t/**\n\t * Types of \"atoms\" that make up the text.\n\t * @internal\n\t */\n\texport const StringAtomContent = [\n\t\tFormattedTextAsTree.StringTextAtom,\n\t\tStringLineAtom,\n\t] as const;\n\t/**\n\t * {@inheritdoc FormattedTextAsTreeDefault.(StringAtomContent:variable)}\n\t * @internal\n\t */\n\texport type StringAtomContent = TreeNodeFromImplicitAllowedTypes<typeof StringAtomContent>;\n\n\t/**\n\t * Statics for text nodes.\n\t * @internal\n\t */\n\texport type Statics<TTree = Tree> = FormattedTextAsTree.Statics<TTree>;\n\n\t/**\n\t * Insertable shape for a formatted text atom used by {@link FormattedTextAsTree.Members.insertWithFormattingAt}.\n\t * @internal\n\t */\n\texport type FormattedAtomInsertable = FormattedTextAsTree.FormattedAtom<\n\t\tInsertableTreeNodeFromImplicitAllowedTypes<typeof CharacterFormat>,\n\t\tInsertableTreeNodeFromImplicitAllowedTypes<FormattedTextAtoms>\n\t>;\n\n\t/**\n\t * Helper for expressing the full set of formatted text atoms for a given schema.\n\t * @privateRemarks\n\t * Eventually this should probably be given a better name and/or made a system type in a system namespace.\n\t * @internal\n\t */\n\texport type FormattedTextAtoms = FormattedTextAsTree.FormattedTextAtoms<\n\t\t[typeof StringLineAtom]\n\t>;\n\n\texport class Tree extends FormattedTextAsTree.createSchema(\n\t\tnew SchemaFactoryBeta(\"default\"),\n\t\tCharacterFormat,\n\t\t[StringLineAtom],\n\t\tdefaultFormat,\n\t) {}\n}\n"]}