@fluidframework/tree 2.110.0 → 2.112.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 (598) hide show
  1. package/.vscode/settings.json +1 -0
  2. package/CHANGELOG.md +193 -0
  3. package/api-report/tree.alpha.api.md +96 -36
  4. package/api-report/tree.beta.api.md +39 -1
  5. package/api-report/tree.legacy.beta.api.md +39 -1
  6. package/api-report/tree.legacy.public.api.md +1 -1
  7. package/api-report/tree.public.api.md +1 -1
  8. package/dist/componentApi.d.ts +198 -0
  9. package/dist/componentApi.d.ts.map +1 -0
  10. package/dist/componentApi.js +138 -0
  11. package/dist/componentApi.js.map +1 -0
  12. package/dist/core/change-family/changeFamily.d.ts +3 -10
  13. package/dist/core/change-family/changeFamily.d.ts.map +1 -1
  14. package/dist/core/change-family/changeFamily.js.map +1 -1
  15. package/dist/core/rebase/types.d.ts +2 -2
  16. package/dist/core/rebase/types.js.map +1 -1
  17. package/dist/core/schema-stored/storedSchemaRepository.d.ts +2 -2
  18. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  19. package/dist/entrypoints/alpha.d.ts +1 -1
  20. package/dist/entrypoints/alpha.d.ts.map +1 -1
  21. package/dist/entrypoints/alpha.js +4 -2
  22. package/dist/entrypoints/alpha.js.map +1 -1
  23. package/dist/entrypoints/beta.d.ts +1 -1
  24. package/dist/entrypoints/beta.d.ts.map +1 -1
  25. package/dist/entrypoints/beta.js.map +1 -1
  26. package/dist/entrypoints/legacy.d.ts +1 -1
  27. package/dist/entrypoints/legacy.d.ts.map +1 -1
  28. package/dist/entrypoints/legacy.js.map +1 -1
  29. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -20
  30. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  31. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +13 -32
  32. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  33. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -2
  34. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  35. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  36. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +73 -28
  37. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  38. package/dist/feature-libraries/chunked-forest/codec/codecs.js +76 -9
  39. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  40. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
  41. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  42. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +11 -0
  43. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  44. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  45. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
  47. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  48. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
  49. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  50. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
  51. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  52. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  53. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  55. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  56. package/dist/feature-libraries/forest-summary/codec.d.ts +3 -3
  57. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  58. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  59. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
  60. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  61. package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -6
  62. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  63. package/dist/feature-libraries/index.d.ts +3 -3
  64. package/dist/feature-libraries/index.d.ts.map +1 -1
  65. package/dist/feature-libraries/index.js +4 -2
  66. package/dist/feature-libraries/index.js.map +1 -1
  67. package/dist/feature-libraries/modular-schema/index.d.ts +1 -0
  68. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  69. package/dist/feature-libraries/modular-schema/index.js +3 -1
  70. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  71. package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +25 -0
  72. package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -0
  73. package/dist/feature-libraries/modular-schema/minimizeModularChange.js +29 -0
  74. package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -0
  75. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  76. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +9 -9
  77. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  78. package/dist/feature-libraries/schemaChecker.d.ts +22 -3
  79. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
  80. package/dist/feature-libraries/schemaChecker.js +48 -5
  81. package/dist/feature-libraries/schemaChecker.js.map +1 -1
  82. package/dist/index.d.ts +4 -3
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +6 -2
  85. package/dist/index.js.map +1 -1
  86. package/dist/packageVersion.d.ts +1 -1
  87. package/dist/packageVersion.js +1 -1
  88. package/dist/packageVersion.js.map +1 -1
  89. package/dist/shared-tree/independentView.d.ts +17 -4
  90. package/dist/shared-tree/independentView.d.ts.map +1 -1
  91. package/dist/shared-tree/independentView.js +15 -12
  92. package/dist/shared-tree/independentView.js.map +1 -1
  93. package/dist/shared-tree/index.d.ts +3 -2
  94. package/dist/shared-tree/index.d.ts.map +1 -1
  95. package/dist/shared-tree/index.js +3 -1
  96. package/dist/shared-tree/index.js.map +1 -1
  97. package/dist/shared-tree/schematizingTreeView.d.ts +6 -5
  98. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  99. package/dist/shared-tree/schematizingTreeView.js +6 -3
  100. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  101. package/dist/shared-tree/serializedChange.d.ts +41 -0
  102. package/dist/shared-tree/serializedChange.d.ts.map +1 -0
  103. package/dist/shared-tree/serializedChange.js +87 -0
  104. package/dist/shared-tree/serializedChange.js.map +1 -0
  105. package/dist/shared-tree/sharedTree.d.ts +18 -0
  106. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  107. package/dist/shared-tree/sharedTree.js +9 -4
  108. package/dist/shared-tree/sharedTree.js.map +1 -1
  109. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +7 -0
  110. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  111. package/dist/shared-tree/sharedTreeChangeFamily.js +8 -1
  112. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  113. package/dist/shared-tree/transactionMinimize.d.ts +35 -0
  114. package/dist/shared-tree/transactionMinimize.d.ts.map +1 -0
  115. package/dist/shared-tree/transactionMinimize.js +65 -0
  116. package/dist/shared-tree/transactionMinimize.js.map +1 -0
  117. package/dist/shared-tree/transactionPostProcessor.d.ts +28 -0
  118. package/dist/shared-tree/transactionPostProcessor.d.ts.map +1 -0
  119. package/dist/shared-tree/transactionPostProcessor.js +28 -0
  120. package/dist/shared-tree/transactionPostProcessor.js.map +1 -0
  121. package/dist/shared-tree/treeAlpha.js +3 -3
  122. package/dist/shared-tree/treeAlpha.js.map +1 -1
  123. package/dist/shared-tree/treeCheckout.d.ts +19 -13
  124. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  125. package/dist/shared-tree/treeCheckout.js +54 -71
  126. package/dist/shared-tree/treeCheckout.js.map +1 -1
  127. package/dist/shared-tree/unhydratedTreeContext.d.ts +5 -5
  128. package/dist/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  129. package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
  130. package/dist/shared-tree-core/editManager.d.ts +6 -3
  131. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  132. package/dist/shared-tree-core/editManager.js +35 -14
  133. package/dist/shared-tree-core/editManager.js.map +1 -1
  134. package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -2
  135. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  136. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  137. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
  138. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  139. package/dist/shared-tree-core/editManagerCodecsCommons.js +2 -4
  140. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  141. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
  142. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  143. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  144. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
  145. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  146. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  147. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +1 -1
  148. package/dist/shared-tree-core/editManagerFormatCommons.js +1 -1
  149. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  150. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
  151. package/dist/shared-tree-core/editManagerSummarizer.d.ts +5 -9
  152. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  153. package/dist/shared-tree-core/editManagerSummarizer.js +5 -10
  154. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  155. package/dist/shared-tree-core/index.d.ts +1 -1
  156. package/dist/shared-tree-core/index.d.ts.map +1 -1
  157. package/dist/shared-tree-core/index.js +3 -2
  158. package/dist/shared-tree-core/index.js.map +1 -1
  159. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  160. package/dist/shared-tree-core/messageCodecVSharedBranches.js +8 -2
  161. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  162. package/dist/shared-tree-core/messageFormat.d.ts +1 -1
  163. package/dist/shared-tree-core/messageFormat.js +1 -1
  164. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  165. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +10 -1
  166. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  167. package/dist/shared-tree-core/messageFormatVSharedBranches.js +1 -0
  168. package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  169. package/dist/shared-tree-core/messageTypes.d.ts +1 -0
  170. package/dist/shared-tree-core/messageTypes.d.ts.map +1 -1
  171. package/dist/shared-tree-core/messageTypes.js.map +1 -1
  172. package/dist/shared-tree-core/sharedTreeCore.d.ts +9 -3
  173. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  174. package/dist/shared-tree-core/sharedTreeCore.js +27 -12
  175. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  176. package/dist/shared-tree-core/transaction.d.ts +84 -9
  177. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  178. package/dist/shared-tree-core/transaction.js +88 -7
  179. package/dist/shared-tree-core/transaction.js.map +1 -1
  180. package/dist/simple-tree/api/index.d.ts +2 -2
  181. package/dist/simple-tree/api/index.d.ts.map +1 -1
  182. package/dist/simple-tree/api/index.js +2 -2
  183. package/dist/simple-tree/api/index.js.map +1 -1
  184. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +9 -24
  185. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  186. package/dist/simple-tree/api/schemaCompatibilityTester.js +31 -44
  187. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  188. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  189. package/dist/simple-tree/api/schemaCreationUtilities.js +3 -3
  190. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  191. package/dist/simple-tree/api/schemaFactory.d.ts +1 -1
  192. package/dist/simple-tree/api/schemaFactory.js +2 -2
  193. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  194. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +56 -15
  195. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  196. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  197. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +0 -3
  198. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  199. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  200. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +2 -2
  201. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  202. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +3 -4
  203. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  204. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  205. package/dist/simple-tree/api/storedSchema.js +1 -2
  206. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  207. package/dist/simple-tree/api/transactionTypes.d.ts +91 -28
  208. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  209. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  210. package/dist/simple-tree/api/tree.d.ts +108 -24
  211. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  212. package/dist/simple-tree/api/tree.js.map +1 -1
  213. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  214. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  215. package/dist/simple-tree/api/typesUnsafe.d.ts +2 -2
  216. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  217. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  218. package/dist/simple-tree/core/treeNodeSchema.d.ts +7 -7
  219. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  220. package/dist/simple-tree/index.d.ts +1 -1
  221. package/dist/simple-tree/index.d.ts.map +1 -1
  222. package/dist/simple-tree/index.js +2 -2
  223. package/dist/simple-tree/index.js.map +1 -1
  224. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +83 -4
  225. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  226. package/dist/simple-tree/node-kinds/array/arrayNode.js +39 -0
  227. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  228. package/dist/simple-tree/simpleSchemaFormatV1.js +1 -1
  229. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  230. package/dist/text/index.d.ts +1 -0
  231. package/dist/text/index.d.ts.map +1 -1
  232. package/dist/text/index.js +3 -1
  233. package/dist/text/index.js.map +1 -1
  234. package/dist/text/textDomainFormatted.d.ts +69 -758
  235. package/dist/text/textDomainFormatted.d.ts.map +1 -1
  236. package/dist/text/textDomainFormatted.js +275 -322
  237. package/dist/text/textDomainFormatted.js.map +1 -1
  238. package/dist/text/textDomainFormattedDefault.d.ts +273 -0
  239. package/dist/text/textDomainFormattedDefault.d.ts.map +1 -0
  240. package/dist/text/textDomainFormattedDefault.js +94 -0
  241. package/dist/text/textDomainFormattedDefault.js.map +1 -0
  242. package/dist/treeFactory.js +1 -1
  243. package/dist/treeFactory.js.map +1 -1
  244. package/dist/util/breakable.d.ts +16 -1
  245. package/dist/util/breakable.d.ts.map +1 -1
  246. package/dist/util/breakable.js +9 -1
  247. package/dist/util/breakable.js.map +1 -1
  248. package/dist/util/compressedIds.d.ts +185 -0
  249. package/dist/util/compressedIds.d.ts.map +1 -0
  250. package/dist/util/compressedIds.js +164 -0
  251. package/dist/util/compressedIds.js.map +1 -0
  252. package/dist/util/index.d.ts +2 -1
  253. package/dist/util/index.d.ts.map +1 -1
  254. package/dist/util/index.js +10 -2
  255. package/dist/util/index.js.map +1 -1
  256. package/dist/util/nestedMap.d.ts.map +1 -1
  257. package/dist/util/nestedMap.js +16 -3
  258. package/dist/util/nestedMap.js.map +1 -1
  259. package/dist/util/nestedSet.d.ts +1 -1
  260. package/dist/util/nestedSet.d.ts.map +1 -1
  261. package/dist/util/nestedSet.js.map +1 -1
  262. package/dist/util/utils.d.ts +0 -6
  263. package/dist/util/utils.d.ts.map +1 -1
  264. package/dist/util/utils.js +1 -15
  265. package/dist/util/utils.js.map +1 -1
  266. package/lib/componentApi.d.ts +198 -0
  267. package/lib/componentApi.d.ts.map +1 -0
  268. package/lib/componentApi.js +135 -0
  269. package/lib/componentApi.js.map +1 -0
  270. package/lib/core/change-family/changeFamily.d.ts +3 -10
  271. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  272. package/lib/core/change-family/changeFamily.js.map +1 -1
  273. package/lib/core/rebase/types.d.ts +2 -2
  274. package/lib/core/rebase/types.js.map +1 -1
  275. package/lib/core/schema-stored/storedSchemaRepository.d.ts +2 -2
  276. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  277. package/lib/entrypoints/alpha.d.ts +1 -1
  278. package/lib/entrypoints/alpha.d.ts.map +1 -1
  279. package/lib/entrypoints/alpha.js +1 -1
  280. package/lib/entrypoints/alpha.js.map +1 -1
  281. package/lib/entrypoints/beta.d.ts +1 -1
  282. package/lib/entrypoints/beta.d.ts.map +1 -1
  283. package/lib/entrypoints/beta.js.map +1 -1
  284. package/lib/entrypoints/legacy.d.ts +1 -1
  285. package/lib/entrypoints/legacy.d.ts.map +1 -1
  286. package/lib/entrypoints/legacy.js.map +1 -1
  287. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -20
  288. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  289. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +14 -33
  290. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  291. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -2
  292. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  293. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  294. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +73 -28
  295. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  296. package/lib/feature-libraries/chunked-forest/codec/codecs.js +75 -9
  297. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  298. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
  299. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  300. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +12 -1
  301. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  302. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  303. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  304. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  305. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  306. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
  307. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  308. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
  309. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  310. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  311. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  312. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  313. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  314. package/lib/feature-libraries/forest-summary/codec.d.ts +3 -3
  315. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  316. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  317. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
  318. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  319. package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -6
  320. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  321. package/lib/feature-libraries/index.d.ts +3 -3
  322. package/lib/feature-libraries/index.d.ts.map +1 -1
  323. package/lib/feature-libraries/index.js +2 -2
  324. package/lib/feature-libraries/index.js.map +1 -1
  325. package/lib/feature-libraries/modular-schema/index.d.ts +1 -0
  326. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  327. package/lib/feature-libraries/modular-schema/index.js +1 -0
  328. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  329. package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +25 -0
  330. package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -0
  331. package/lib/feature-libraries/modular-schema/minimizeModularChange.js +25 -0
  332. package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -0
  333. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  334. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +10 -10
  335. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  336. package/lib/feature-libraries/schemaChecker.d.ts +22 -3
  337. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
  338. package/lib/feature-libraries/schemaChecker.js +48 -5
  339. package/lib/feature-libraries/schemaChecker.js.map +1 -1
  340. package/lib/index.d.ts +4 -3
  341. package/lib/index.d.ts.map +1 -1
  342. package/lib/index.js +3 -2
  343. package/lib/index.js.map +1 -1
  344. package/lib/packageVersion.d.ts +1 -1
  345. package/lib/packageVersion.js +1 -1
  346. package/lib/packageVersion.js.map +1 -1
  347. package/lib/shared-tree/independentView.d.ts +17 -4
  348. package/lib/shared-tree/independentView.d.ts.map +1 -1
  349. package/lib/shared-tree/independentView.js +13 -10
  350. package/lib/shared-tree/independentView.js.map +1 -1
  351. package/lib/shared-tree/index.d.ts +3 -2
  352. package/lib/shared-tree/index.d.ts.map +1 -1
  353. package/lib/shared-tree/index.js +1 -0
  354. package/lib/shared-tree/index.js.map +1 -1
  355. package/lib/shared-tree/schematizingTreeView.d.ts +6 -5
  356. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  357. package/lib/shared-tree/schematizingTreeView.js +7 -4
  358. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  359. package/lib/shared-tree/serializedChange.d.ts +41 -0
  360. package/lib/shared-tree/serializedChange.d.ts.map +1 -0
  361. package/lib/shared-tree/serializedChange.js +84 -0
  362. package/lib/shared-tree/serializedChange.js.map +1 -0
  363. package/lib/shared-tree/sharedTree.d.ts +18 -0
  364. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  365. package/lib/shared-tree/sharedTree.js +10 -5
  366. package/lib/shared-tree/sharedTree.js.map +1 -1
  367. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +7 -0
  368. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  369. package/lib/shared-tree/sharedTreeChangeFamily.js +7 -1
  370. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  371. package/lib/shared-tree/transactionMinimize.d.ts +35 -0
  372. package/lib/shared-tree/transactionMinimize.d.ts.map +1 -0
  373. package/lib/shared-tree/transactionMinimize.js +62 -0
  374. package/lib/shared-tree/transactionMinimize.js.map +1 -0
  375. package/lib/shared-tree/transactionPostProcessor.d.ts +28 -0
  376. package/lib/shared-tree/transactionPostProcessor.d.ts.map +1 -0
  377. package/lib/shared-tree/transactionPostProcessor.js +23 -0
  378. package/lib/shared-tree/transactionPostProcessor.js.map +1 -0
  379. package/lib/shared-tree/treeAlpha.js +3 -3
  380. package/lib/shared-tree/treeAlpha.js.map +1 -1
  381. package/lib/shared-tree/treeCheckout.d.ts +19 -13
  382. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  383. package/lib/shared-tree/treeCheckout.js +36 -53
  384. package/lib/shared-tree/treeCheckout.js.map +1 -1
  385. package/lib/shared-tree/unhydratedTreeContext.d.ts +5 -5
  386. package/lib/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  387. package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
  388. package/lib/shared-tree-core/editManager.d.ts +6 -3
  389. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  390. package/lib/shared-tree-core/editManager.js +36 -15
  391. package/lib/shared-tree-core/editManager.js.map +1 -1
  392. package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -2
  393. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  394. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  395. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
  396. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  397. package/lib/shared-tree-core/editManagerCodecsCommons.js +3 -5
  398. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  399. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
  400. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  401. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  402. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
  403. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  404. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  405. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +1 -1
  406. package/lib/shared-tree-core/editManagerFormatCommons.js +1 -1
  407. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  408. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
  409. package/lib/shared-tree-core/editManagerSummarizer.d.ts +5 -9
  410. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  411. package/lib/shared-tree-core/editManagerSummarizer.js +5 -10
  412. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  413. package/lib/shared-tree-core/index.d.ts +1 -1
  414. package/lib/shared-tree-core/index.d.ts.map +1 -1
  415. package/lib/shared-tree-core/index.js +1 -1
  416. package/lib/shared-tree-core/index.js.map +1 -1
  417. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  418. package/lib/shared-tree-core/messageCodecVSharedBranches.js +8 -2
  419. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  420. package/lib/shared-tree-core/messageFormat.d.ts +1 -1
  421. package/lib/shared-tree-core/messageFormat.js +1 -1
  422. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  423. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +10 -1
  424. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  425. package/lib/shared-tree-core/messageFormatVSharedBranches.js +1 -0
  426. package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  427. package/lib/shared-tree-core/messageTypes.d.ts +1 -0
  428. package/lib/shared-tree-core/messageTypes.d.ts.map +1 -1
  429. package/lib/shared-tree-core/messageTypes.js.map +1 -1
  430. package/lib/shared-tree-core/sharedTreeCore.d.ts +9 -3
  431. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  432. package/lib/shared-tree-core/sharedTreeCore.js +28 -13
  433. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  434. package/lib/shared-tree-core/transaction.d.ts +84 -9
  435. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  436. package/lib/shared-tree-core/transaction.js +87 -6
  437. package/lib/shared-tree-core/transaction.js.map +1 -1
  438. package/lib/simple-tree/api/index.d.ts +2 -2
  439. package/lib/simple-tree/api/index.d.ts.map +1 -1
  440. package/lib/simple-tree/api/index.js +1 -1
  441. package/lib/simple-tree/api/index.js.map +1 -1
  442. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +9 -24
  443. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  444. package/lib/simple-tree/api/schemaCompatibilityTester.js +29 -42
  445. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  446. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  447. package/lib/simple-tree/api/schemaCreationUtilities.js +3 -3
  448. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  449. package/lib/simple-tree/api/schemaFactory.d.ts +1 -1
  450. package/lib/simple-tree/api/schemaFactory.js +2 -2
  451. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  452. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +56 -15
  453. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  454. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  455. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +0 -3
  456. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  457. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  458. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +2 -2
  459. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  460. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +4 -5
  461. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  462. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  463. package/lib/simple-tree/api/storedSchema.js +2 -3
  464. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  465. package/lib/simple-tree/api/transactionTypes.d.ts +91 -28
  466. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  467. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  468. package/lib/simple-tree/api/tree.d.ts +108 -24
  469. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  470. package/lib/simple-tree/api/tree.js.map +1 -1
  471. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  472. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  473. package/lib/simple-tree/api/typesUnsafe.d.ts +2 -2
  474. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  475. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  476. package/lib/simple-tree/core/treeNodeSchema.d.ts +7 -7
  477. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  478. package/lib/simple-tree/index.d.ts +1 -1
  479. package/lib/simple-tree/index.d.ts.map +1 -1
  480. package/lib/simple-tree/index.js +1 -1
  481. package/lib/simple-tree/index.js.map +1 -1
  482. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +83 -4
  483. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  484. package/lib/simple-tree/node-kinds/array/arrayNode.js +39 -0
  485. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  486. package/lib/simple-tree/simpleSchemaFormatV1.js +1 -1
  487. package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  488. package/lib/text/index.d.ts +1 -0
  489. package/lib/text/index.d.ts.map +1 -1
  490. package/lib/text/index.js +1 -0
  491. package/lib/text/index.js.map +1 -1
  492. package/lib/text/textDomainFormatted.d.ts +69 -758
  493. package/lib/text/textDomainFormatted.d.ts.map +1 -1
  494. package/lib/text/textDomainFormatted.js +277 -324
  495. package/lib/text/textDomainFormatted.js.map +1 -1
  496. package/lib/text/textDomainFormattedDefault.d.ts +273 -0
  497. package/lib/text/textDomainFormattedDefault.d.ts.map +1 -0
  498. package/lib/text/textDomainFormattedDefault.js +91 -0
  499. package/lib/text/textDomainFormattedDefault.js.map +1 -0
  500. package/lib/treeFactory.js +1 -1
  501. package/lib/treeFactory.js.map +1 -1
  502. package/lib/util/breakable.d.ts +16 -1
  503. package/lib/util/breakable.d.ts.map +1 -1
  504. package/lib/util/breakable.js +9 -1
  505. package/lib/util/breakable.js.map +1 -1
  506. package/lib/util/compressedIds.d.ts +185 -0
  507. package/lib/util/compressedIds.d.ts.map +1 -0
  508. package/lib/util/compressedIds.js +154 -0
  509. package/lib/util/compressedIds.js.map +1 -0
  510. package/lib/util/index.d.ts +2 -1
  511. package/lib/util/index.d.ts.map +1 -1
  512. package/lib/util/index.js +2 -1
  513. package/lib/util/index.js.map +1 -1
  514. package/lib/util/nestedMap.d.ts.map +1 -1
  515. package/lib/util/nestedMap.js +17 -4
  516. package/lib/util/nestedMap.js.map +1 -1
  517. package/lib/util/nestedSet.d.ts +1 -1
  518. package/lib/util/nestedSet.d.ts.map +1 -1
  519. package/lib/util/nestedSet.js.map +1 -1
  520. package/lib/util/utils.d.ts +0 -6
  521. package/lib/util/utils.d.ts.map +1 -1
  522. package/lib/util/utils.js +0 -13
  523. package/lib/util/utils.js.map +1 -1
  524. package/package.json +23 -23
  525. package/src/componentApi.ts +354 -0
  526. package/src/core/change-family/changeFamily.ts +3 -12
  527. package/src/core/rebase/types.ts +2 -2
  528. package/src/core/schema-stored/storedSchemaRepository.ts +2 -2
  529. package/src/entrypoints/alpha.ts +15 -8
  530. package/src/entrypoints/beta.ts +8 -0
  531. package/src/entrypoints/legacy.ts +8 -0
  532. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +22 -72
  533. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -2
  534. package/src/feature-libraries/chunked-forest/codec/codecs.ts +110 -41
  535. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +32 -4
  536. package/src/feature-libraries/chunked-forest/codec/index.ts +1 -0
  537. package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +7 -19
  538. package/src/feature-libraries/chunked-forest/index.ts +3 -0
  539. package/src/feature-libraries/forest-summary/codec.ts +5 -3
  540. package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -5
  541. package/src/feature-libraries/index.ts +5 -0
  542. package/src/feature-libraries/modular-schema/index.ts +1 -0
  543. package/src/feature-libraries/modular-schema/minimizeModularChange.ts +33 -0
  544. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +13 -9
  545. package/src/feature-libraries/schemaChecker.ts +86 -9
  546. package/src/index.ts +16 -8
  547. package/src/packageVersion.ts +1 -1
  548. package/src/shared-tree/independentView.ts +40 -15
  549. package/src/shared-tree/index.ts +4 -0
  550. package/src/shared-tree/schematizingTreeView.ts +40 -30
  551. package/src/shared-tree/serializedChange.ts +127 -0
  552. package/src/shared-tree/sharedTree.ts +32 -4
  553. package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
  554. package/src/shared-tree/transactionMinimize.ts +74 -0
  555. package/src/shared-tree/transactionPostProcessor.ts +40 -0
  556. package/src/shared-tree/treeAlpha.ts +3 -3
  557. package/src/shared-tree/treeCheckout.ts +103 -101
  558. package/src/shared-tree/unhydratedTreeContext.ts +18 -15
  559. package/src/shared-tree-core/editManager.ts +42 -6
  560. package/src/shared-tree-core/editManagerCodecs.ts +3 -2
  561. package/src/shared-tree-core/editManagerCodecsCommons.ts +10 -14
  562. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +3 -2
  563. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +3 -2
  564. package/src/shared-tree-core/editManagerFormatCommons.ts +1 -1
  565. package/src/shared-tree-core/editManagerSummarizer.ts +5 -9
  566. package/src/shared-tree-core/index.ts +8 -5
  567. package/src/shared-tree-core/messageCodecVSharedBranches.ts +8 -1
  568. package/src/shared-tree-core/messageFormat.ts +1 -1
  569. package/src/shared-tree-core/messageFormatVSharedBranches.ts +10 -0
  570. package/src/shared-tree-core/messageTypes.ts +1 -0
  571. package/src/shared-tree-core/sharedTreeCore.ts +36 -12
  572. package/src/shared-tree-core/transaction.ts +165 -18
  573. package/src/simple-tree/api/index.ts +14 -10
  574. package/src/simple-tree/api/schemaCompatibilityTester.ts +36 -48
  575. package/src/simple-tree/api/schemaCreationUtilities.ts +3 -3
  576. package/src/simple-tree/api/schemaFactory.ts +2 -2
  577. package/src/simple-tree/api/schemaFactoryAlpha.ts +56 -15
  578. package/src/simple-tree/api/schemaFactoryBeta.ts +0 -3
  579. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +4 -5
  580. package/src/simple-tree/api/storedSchema.ts +2 -3
  581. package/src/simple-tree/api/transactionTypes.ts +111 -39
  582. package/src/simple-tree/api/tree.ts +165 -49
  583. package/src/simple-tree/api/treeBeta.ts +2 -0
  584. package/src/simple-tree/api/typesUnsafe.ts +2 -1
  585. package/src/simple-tree/core/treeNodeSchema.ts +7 -7
  586. package/src/simple-tree/index.ts +13 -9
  587. package/src/simple-tree/node-kinds/array/arrayNode.ts +168 -4
  588. package/src/simple-tree/simpleSchemaFormatV1.ts +1 -1
  589. package/src/text/index.ts +1 -0
  590. package/src/text/textDomainFormatted.ts +520 -415
  591. package/src/text/textDomainFormattedDefault.ts +150 -0
  592. package/src/treeFactory.ts +1 -1
  593. package/src/util/breakable.ts +8 -1
  594. package/src/util/compressedIds.ts +304 -0
  595. package/src/util/index.ts +18 -1
  596. package/src/util/nestedMap.ts +21 -4
  597. package/src/util/nestedSet.ts +1 -1
  598. package/src/util/utils.ts +0 -18
@@ -0,0 +1,150 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import {
7
+ enumFromStrings,
8
+ SchemaFactory,
9
+ SchemaFactoryAlpha,
10
+ SchemaFactoryBeta,
11
+ } from "../simple-tree/index.js";
12
+ import type {
13
+ TreeNodeFromImplicitAllowedTypes,
14
+ InsertableTreeNodeFromImplicitAllowedTypes,
15
+ } from "../simple-tree/index.js";
16
+
17
+ import { FormattedTextAsTree } from "./textDomainFormatted.js";
18
+
19
+ /**
20
+ * Schema factory for default formatted text types which are not generic.
21
+ */
22
+ const sf = new SchemaFactoryAlpha("com.fluidframework.text.formatted.default");
23
+
24
+ const defaultFormat = {
25
+ bold: false,
26
+ italic: false,
27
+ underline: false,
28
+ size: 12,
29
+ font: "Arial",
30
+ } as const;
31
+
32
+ /**
33
+ * A collection of text related types, schema and utilities for working with text beyond the basic {@link SchemaStatics.string}.
34
+ * @remarks
35
+ * 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.
36
+ * 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}.
37
+ * @internal
38
+ */
39
+ export namespace FormattedTextAsTreeDefault {
40
+ /**
41
+ * Portion of a string with formatting.
42
+ * @sealed
43
+ * @internal
44
+ */
45
+ export type FormattedAtom = FormattedTextAsTree.FormattedAtom<
46
+ CharacterFormat,
47
+ StringAtomContent
48
+ >;
49
+
50
+ /**
51
+ * Formatting options for characters.
52
+ * @internal
53
+ */
54
+ export class CharacterFormat extends sf.objectAlpha("CharacterFormat", {
55
+ bold: SchemaFactory.boolean,
56
+ italic: SchemaFactory.boolean,
57
+ underline: SchemaFactory.boolean,
58
+ size: SchemaFactory.number,
59
+ font: SchemaFactory.string,
60
+ }) {
61
+ public static readonly defaultFormat = new CharacterFormat(defaultFormat);
62
+ }
63
+
64
+ /**
65
+ * Tag with which a line in text can be formatted from HTML.
66
+ * @internal
67
+ */
68
+ export const LineTag = enumFromStrings(sf.scopedFactory("lineTag"), [
69
+ "h1",
70
+ "h2",
71
+ "h3",
72
+ "h4",
73
+ "h5",
74
+ "li",
75
+ "ol",
76
+ "checked",
77
+ "unchecked",
78
+ "blockquote",
79
+ "codeBlock",
80
+ ]);
81
+ /**
82
+ * {@inheritdoc FormattedTextAsTreeDefault.(LineTag:variable)}
83
+ * @internal
84
+ */
85
+ export type LineTag = TreeNodeFromImplicitAllowedTypes<typeof LineTag.schema>;
86
+
87
+ /**
88
+ * Unit in the string representing a new line character with line formatting.
89
+ * @remarks
90
+ * This aligns with how Quill represents line formatting.
91
+ * Quill formats line attributes (headers, list, blockquote, etc... ) on the newline character
92
+ * and only lines using this atom can have line-specific formatting.
93
+ * The optional indent level mirrors Quill's indent attribute,
94
+ * which is applies to the line before the line break.
95
+ * Any tagged line can be indented independently.
96
+ * @internal
97
+ */
98
+ export class StringLineAtom extends sf.object("StringLineAtom", {
99
+ tag: LineTag.schema,
100
+ indent: SchemaFactory.number,
101
+ }) {
102
+ public readonly content = "\n";
103
+ }
104
+
105
+ /**
106
+ * Types of "atoms" that make up the text.
107
+ * @internal
108
+ */
109
+ export const StringAtomContent = [
110
+ FormattedTextAsTree.StringTextAtom,
111
+ StringLineAtom,
112
+ ] as const;
113
+ /**
114
+ * {@inheritdoc FormattedTextAsTreeDefault.(StringAtomContent:variable)}
115
+ * @internal
116
+ */
117
+ export type StringAtomContent = TreeNodeFromImplicitAllowedTypes<typeof StringAtomContent>;
118
+
119
+ /**
120
+ * Statics for text nodes.
121
+ * @internal
122
+ */
123
+ export type Statics<TTree = Tree> = FormattedTextAsTree.Statics<TTree>;
124
+
125
+ /**
126
+ * Insertable shape for a formatted text atom used by {@link FormattedTextAsTree.Members.insertWithFormattingAt}.
127
+ * @internal
128
+ */
129
+ export type FormattedAtomInsertable = FormattedTextAsTree.FormattedAtom<
130
+ InsertableTreeNodeFromImplicitAllowedTypes<typeof CharacterFormat>,
131
+ InsertableTreeNodeFromImplicitAllowedTypes<FormattedTextAtoms>
132
+ >;
133
+
134
+ /**
135
+ * Helper for expressing the full set of formatted text atoms for a given schema.
136
+ * @privateRemarks
137
+ * Eventually this should probably be given a better name and/or made a system type in a system namespace.
138
+ * @internal
139
+ */
140
+ export type FormattedTextAtoms = FormattedTextAsTree.FormattedTextAtoms<
141
+ [typeof StringLineAtom]
142
+ >;
143
+
144
+ export class Tree extends FormattedTextAsTree.createSchema(
145
+ new SchemaFactoryBeta("default"),
146
+ CharacterFormat,
147
+ [StringLineAtom],
148
+ defaultFormat,
149
+ ) {}
150
+ }
@@ -77,7 +77,7 @@ function treeKernelFactory(
77
77
  };
78
78
 
79
79
  return new SharedTreeKernel(
80
- new Breakable("SharedTree"),
80
+ new Breakable("SharedTree", args.logger),
81
81
  args.sharedObject,
82
82
  args.serializer,
83
83
  args.submitLocalMessage,
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { assert } from "@fluidframework/core-utils/internal";
7
- import { UsageError } from "@fluidframework/telemetry-utils/internal";
7
+ import { UsageError, type TelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
8
8
 
9
9
  /**
10
10
  * An object which can enter a "broken" state where trying to use it is a UsageError.
@@ -22,6 +22,13 @@ export class Breakable {
22
22
  * This is useful for documenting the semantics of a given Breakable and when inspecting things in the debugger, but is currently otherwise unused.
23
23
  */
24
24
  private readonly name: string,
25
+ /**
26
+ * Optional logger for telemetry.
27
+ * @remarks
28
+ * When provided, subsystems that have access to a Breakable can use this logger to emit telemetry
29
+ * without requiring additional plumbing.
30
+ */
31
+ public readonly logger?: TelemetryLoggerExt,
25
32
  ) {}
26
33
 
27
34
  /**
@@ -0,0 +1,304 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { assert } from "@fluidframework/core-utils/internal";
7
+ import type {
8
+ IIdCompressor,
9
+ OpSpaceCompressedId,
10
+ SessionId,
11
+ SessionSpaceCompressedId,
12
+ } from "@fluidframework/id-compressor";
13
+ import { isFinalId, isStableId } from "@fluidframework/id-compressor/internal";
14
+ import { v5 as uuidV5 } from "uuid";
15
+
16
+ /**
17
+ * An encoded identifier that can be decoded without an originator session id.
18
+ * A finalized compressed id — the same numeric value in op-space and session-space.
19
+ * @remarks
20
+ * These are safe to use in contexts where the encoding id compressor is available to decode them,
21
+ * even when the session id of the encoding id compressor is not known.
22
+ */
23
+ export type OriginatorlessEncodedId = SessionSpaceCompressedId & OpSpaceCompressedId;
24
+
25
+ /**
26
+ * An encoded identifier that may require an originator session id to decode.
27
+ * Any op-space compressed id, either finalized or session-local.
28
+ * @remarks
29
+ * These are only safe to use in contexts where the encoding id compressor is available
30
+ * and the session id of the encoding id compressor is known.
31
+ * Currently the only such case is in ops, excluding attach summary ops.
32
+ */
33
+ export type OriginatorDependentEncodedId = OpSpaceCompressedId;
34
+
35
+ /**
36
+ * Selects how identifiers are encoded for transport/persistence.
37
+ */
38
+ export enum EncodedIdType {
39
+ /**
40
+ * {@link OriginatorlessEncodedId}.
41
+ */
42
+ Originatorless,
43
+ /**
44
+ * {@link OriginatorDependentEncodedId}.
45
+ */
46
+ OriginatorDependent,
47
+ }
48
+
49
+ export type EncodedId<T extends EncodedIdType> = T extends EncodedIdType.Originatorless
50
+ ? OriginatorlessEncodedId
51
+ : T extends EncodedIdType.OriginatorDependent
52
+ ? OriginatorDependentEncodedId
53
+ : OriginatorlessEncodedId | OriginatorDependentEncodedId;
54
+
55
+ /**
56
+ * Context for encoding identifiers.
57
+ * @remarks
58
+ * See {@link FieldBatchDecodingContext} for the decoder.
59
+ */
60
+ export interface IdEncodingContext {
61
+ encodePossiblyCompressedId(id: string): string | EncodedId<EncodedIdType>;
62
+ }
63
+
64
+ /**
65
+ * Encode a string identifier into a possibly compressed form based on the requested mode.
66
+ *
67
+ * @param id - The string identifier to encode.
68
+ * @param idCompressor - The ID compressor to use for compression.
69
+ * @param encodedIdType - The type of encoding to use. If the context doing the decoding will have the originator {@link SessionId},
70
+ * then {@link EncodedIdType.OriginatorDependent} can be used.
71
+ * Otherwise, {@link EncodedIdType.Originatorless} must be used.
72
+ *
73
+ * @privateRemarks
74
+ * Performance:
75
+ * When trying to optimize to avoid unnecessary identifier decompression, and store identifiers compressed in memory,
76
+ * this will likely need to be updated to allow in SessionSpaceCompressedIds.
77
+ */
78
+ export function encodePossiblyCompressedId<T extends EncodedIdType>(
79
+ id: string,
80
+ idCompressor: IIdCompressor,
81
+ encodedIdType: T,
82
+ ): string | EncodedId<T> {
83
+ if (!isStableId(id)) {
84
+ return id;
85
+ }
86
+ const sessionSpaceCompressedId = idCompressor.tryRecompress(id);
87
+ if (sessionSpaceCompressedId === undefined) {
88
+ return id;
89
+ }
90
+ const opSpaceId = idCompressor.normalizeToOpSpace(sessionSpaceCompressedId);
91
+ if (encodedIdType === EncodedIdType.Originatorless) {
92
+ return isFinalId(opSpaceId) ? (opSpaceId as unknown as EncodedId<T>) : id;
93
+ }
94
+ return opSpaceId as unknown as EncodedId<T>;
95
+ }
96
+
97
+ /**
98
+ * Namespace used for the deterministic UUIDv5 produced by the heal-on-decode workaround
99
+ * in {@link forceDecodeEncodedIdWithoutSession}.
100
+ *
101
+ * This scheme requires consensus across all clients to function — every client that
102
+ * encounters the same unresolvable id must produce the same v5 UUID.
103
+ */
104
+ const healingNamespace = "f8a89df3-6882-400f-b913-4c1f6f0157bd";
105
+
106
+ /**
107
+ * Decode an {@link OriginatorlessEncodedId} without needing an originator session id.
108
+ *
109
+ * The id is guaranteed to be final by the type contract; it is normalized via
110
+ * {@link IIdCompressor.tryNormalizeToSessionSpaceWithoutSession}, which handles the
111
+ * cluster-aligned-local case rather than relying on the bare numeric value.
112
+ */
113
+ export function decodeOriginatorlessEncodedId(
114
+ id: OriginatorlessEncodedId,
115
+ idCompressor: IIdCompressor,
116
+ ): SessionSpaceCompressedId {
117
+ const sessionSpaceId = idCompressor.tryNormalizeToSessionSpaceWithoutSession(id);
118
+ assert(
119
+ sessionSpaceId !== undefined,
120
+ 0xd0a /* OriginatorlessEncodedId must be a finalized compressed id at runtime */,
121
+ );
122
+ return sessionSpaceId;
123
+ }
124
+
125
+ /**
126
+ * Decode an {@link OriginatorDependentEncodedId} using a known originator session id.
127
+ */
128
+ export function decodeEncodedIdWithOriginator(
129
+ id: OriginatorDependentEncodedId,
130
+ originator: SessionId,
131
+ idCompressor: IIdCompressor,
132
+ ): SessionSpaceCompressedId {
133
+ return idCompressor.normalizeToSessionSpace(id, originator);
134
+ }
135
+
136
+ /**
137
+ * Decode an {@link OriginatorDependentEncodedId} without a session.
138
+ *
139
+ * Returns the session-space id if `id` is finalized (and therefore resolvable
140
+ * without an originator session), or `undefined` if `id` is a non-final op-space
141
+ * id that cannot be resolved without the originator session.
142
+ */
143
+ export function tryDecodeEncodedIdWithoutSession(
144
+ id: OriginatorDependentEncodedId,
145
+ idCompressor: IIdCompressor,
146
+ ): SessionSpaceCompressedId | undefined {
147
+ return idCompressor.tryNormalizeToSessionSpaceWithoutSession(id);
148
+ }
149
+
150
+ /**
151
+ * Configuration for the heal-on-decode workaround. The internal counterpart of
152
+ * the user-facing {@link SharedTreeOptionsBeta.healUnresolvableIdentifiersOnDecode}
153
+ * option — see that option for the user-facing rationale and trade-offs.
154
+ *
155
+ * Carried by decode-side contexts ({@link IdDecoderOptionsOriginatorless},
156
+ * `ChangeEncodingContext.healing`,
157
+ * `EditManagerEncodingContext.healing`, etc.) when the workaround is enabled.
158
+ * Presence enables healing; `undefined` means healing is disabled. There is no separate boolean,
159
+ * which makes it impossible to enable healing without supplying the namespace
160
+ * input.
161
+ */
162
+ export interface IdentifierHealingConfig {
163
+ /**
164
+ * The SharedTree's shared-object id, used as the v5 namespace input so
165
+ * healed UUIDs are unique across attaches of different documents with the
166
+ * same session offsets.
167
+ */
168
+ readonly sharedObjectId: string;
169
+ }
170
+
171
+ /**
172
+ * Decode an op-space compressed id without a session.
173
+ *
174
+ * Finalized ids are returned as session-space ids (final ids are invariant
175
+ * across the two spaces). Non-final ids are healed via {@link IdentifierHealingConfig}
176
+ * if provided, or cause the resolver to throw otherwise. A healed result is a
177
+ * deterministic v5 UUID string — *not* a `StableId`, since that brand requires
178
+ * v4, but still a valid identifier value; the `string` arm of the return type
179
+ * covers this case.
180
+ */
181
+ export function forceDecodeEncodedIdWithoutSession(
182
+ id: OpSpaceCompressedId,
183
+ idCompressor: IIdCompressor,
184
+ healing: IdentifierHealingConfig | undefined,
185
+ ): SessionSpaceCompressedId | string {
186
+ const decoded = tryDecodeEncodedIdWithoutSession(id, idCompressor);
187
+ if (decoded !== undefined) {
188
+ return decoded;
189
+ }
190
+ // `id` is a non-final op-space compressed id.
191
+ if (healing !== undefined) {
192
+ return uuidV5(`${healing.sharedObjectId}|${id}`, healingNamespace);
193
+ }
194
+ throw new Error(
195
+ "Summary could not be loaded due to an incorrectly encoded identifier. See SharedTreeOptionsBeta.healUnresolvableIdentifiersOnDecode for mitigation.",
196
+ );
197
+ }
198
+
199
+ /**
200
+ * Convert a decoded, but possibly compressed, identifier to the decompressed string format.
201
+ *
202
+ * Session-space compressed ids are decompressed to their UUID representation via the compressor.
203
+ * String inputs pass through unchanged — they are already in the stored form,
204
+ * whether a `StableId` UUID, a heal-synthesized v5 UUID or other arbitrary string identifier.
205
+ */
206
+ export function decompressIdentifierIfNeeded(
207
+ id: SessionSpaceCompressedId | string,
208
+ idCompressor: Pick<IIdCompressor, "decompress">,
209
+ ): string {
210
+ if (typeof id === "string") {
211
+ return id;
212
+ } else {
213
+ const decompressed = idCompressor.decompress(id);
214
+ assert(typeof decompressed === "string", 0xd0b /* Decompressed id must be a string */);
215
+ return decompressed;
216
+ }
217
+ }
218
+
219
+ /**
220
+ * Options for creating an {@link IdDecodingContext} without an originator.
221
+ * @remarks
222
+ * Decodes {@link OriginatorlessEncodedId} instances, and optionally has a {@link IdentifierHealingConfig} fallback for {@link OriginatorDependentEncodedId} instances.
223
+ */
224
+ export interface IdDecoderOptionsOriginatorless {
225
+ readonly idCompressor: IIdCompressor;
226
+ /**
227
+ * Optional {@link IdentifierHealingConfig} to use for healing unresolvable identifiers.
228
+ * @privateRemarks
229
+ * This is a required field which can be undefined to make it explicit when this is not provided.
230
+ * This explicitness helps ensure we we don't accidentally drop the healing config as that would break
231
+ * an edge case which does not get a lot of testing.
232
+ */
233
+ readonly healing: IdentifierHealingConfig | undefined;
234
+ }
235
+
236
+ /**
237
+ * Options for creating an {@link IdDecodingContext} with an originator.
238
+ * @remarks
239
+ * Decodes {@link OriginatorDependentEncodedId} instances.
240
+ */
241
+ export interface IdDecoderOptionsWithOriginator {
242
+ readonly idCompressor: IIdCompressor;
243
+ /**
244
+ * The ID of the session that encoded the ids.
245
+ */
246
+ readonly originatorId: SessionId;
247
+ }
248
+
249
+ /**
250
+ * Context for decoding identifiers.
251
+ * @remarks
252
+ * Depended on how this is constructed, it may or may not handle {@link OriginatorDependentEncodedId} instances.
253
+ *
254
+ * This intentionally avoids exposing anything which depends on the underlying id-compressor's session ID to avoid confusion with the session ID of the compressor which encoded the data.
255
+ * If the session ID of the encoder which encoded the data is known, that information is baked into `resolveEncodedId`.
256
+ *
257
+ * @privateRemarks
258
+ * We have code (FieldBatchDecodingContext) which sometimes has a session ID and sometimes doesn't, so we need a flexible decoding context.
259
+ * Additionally, since this is about serialized data, having stronger types is often counterproductive, as it just relies more on type casts when parsing.
260
+ * This is why we use this flexible pattern rather than code strongly typed over which kind of encoded ids are expected.
261
+ */
262
+ export class IdDecodingContext {
263
+ /**
264
+ * Used internally to prevent the use of this decoder in incremental chunks if it has a session id (which would be wrong in those chunks).
265
+ */
266
+ protected readonly hasOriginatorSessionId: boolean;
267
+
268
+ /**
269
+ * Compressor which can decompress session-space identifiers from {@link resolveEncodedId} as needed.
270
+ */
271
+ public readonly idCompressor: Pick<IIdCompressor, "decompress">;
272
+
273
+ /**
274
+ * Resolves an encoded op-space identifier to either a session-space ID
275
+ * (which {@link idCompressor} can decompress if needed)
276
+ * or a string (which passes through unchanged).
277
+ * @remarks
278
+ * In contexts where non-final identifiers can't be supported (where no originator session is available),
279
+ * if a non-final identifier is encountered, this may throw or perform a data healing workaround.
280
+ * See {@link FieldBatchDecodingContext.forOp} and {@link FieldBatchDecodingContext.forSummary} for details.
281
+ */
282
+ public readonly resolveEncodedId: (
283
+ id: OpSpaceCompressedId,
284
+ ) => SessionSpaceCompressedId | string;
285
+
286
+ /**
287
+ * Creates a new instance of the context.
288
+ * @param options - The options for creating the context.
289
+ */
290
+ public constructor(
291
+ options: IdDecoderOptionsOriginatorless | IdDecoderOptionsWithOriginator,
292
+ ) {
293
+ this.idCompressor = options.idCompressor;
294
+ if ("originatorId" in options) {
295
+ this.hasOriginatorSessionId = true;
296
+ this.resolveEncodedId = (id): SessionSpaceCompressedId | string =>
297
+ options.idCompressor.normalizeToSessionSpace(id, options.originatorId);
298
+ } else {
299
+ this.hasOriginatorSessionId = false;
300
+ this.resolveEncodedId = (id): SessionSpaceCompressedId | string =>
301
+ forceDecodeEncodedIdWithoutSession(id, options.idCompressor, options.healing);
302
+ }
303
+ }
304
+ }
package/src/util/index.ts CHANGED
@@ -106,7 +106,6 @@ export {
106
106
  hasSingle,
107
107
  defineLazyCachedProperty,
108
108
  copyPropertyIfDefined as copyProperty,
109
- getOrAddInMap,
110
109
  iterableHasSome,
111
110
  } from "./utils.js";
112
111
  export { ReferenceCountedBase, type ReferenceCounted } from "./referenceCounting.js";
@@ -165,3 +164,21 @@ export {
165
164
  export { cloneWithReplacements } from "./cloneWithReplacements.js";
166
165
 
167
166
  export { readAndParseSnapshotBlob } from "./readSnapshotBlob.js";
167
+
168
+ export {
169
+ type OriginatorlessEncodedId,
170
+ type OriginatorDependentEncodedId,
171
+ type IdentifierHealingConfig,
172
+ EncodedIdType,
173
+ encodePossiblyCompressedId,
174
+ type IdEncodingContext,
175
+ type EncodedId,
176
+ decodeOriginatorlessEncodedId,
177
+ decodeEncodedIdWithOriginator,
178
+ tryDecodeEncodedIdWithoutSession,
179
+ forceDecodeEncodedIdWithoutSession,
180
+ decompressIdentifierIfNeeded,
181
+ IdDecodingContext,
182
+ type IdDecoderOptionsOriginatorless,
183
+ type IdDecoderOptionsWithOriginator,
184
+ } from "./compressedIds.js";
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { oob } from "@fluidframework/core-utils/internal";
7
7
 
8
- import { getOrAddInMap, getOrCreate } from "./utils.js";
8
+ import { getOrCreate } from "./utils.js";
9
9
 
10
10
  /**
11
11
  * A dictionary whose values are keyed off of two objects (key1, key2).
@@ -72,6 +72,23 @@ export function populateNestedMap<Key1, Key2, Value>(
72
72
  }
73
73
  }
74
74
 
75
+ /**
76
+ * Sets the value at `key` in map to new Map if not already present.
77
+ * Returns the value at `key` after setting it.
78
+ */
79
+ function getOrAddInMap<Key1, Key2, Value>(
80
+ map: NestedMap<Key1, Key2, Value>,
81
+ key1: Key1,
82
+ ): Map<Key2, Value> {
83
+ const currentValue = map.get(key1);
84
+ if (currentValue !== undefined) {
85
+ return currentValue;
86
+ }
87
+ const value = new Map<Key2, Value>();
88
+ map.set(key1, value);
89
+ return value;
90
+ }
91
+
75
92
  /**
76
93
  * Sets the value at (key1, key2) in map to value.
77
94
  * If there already is a value for (key1, key2), it is replaced with the provided one.
@@ -82,7 +99,7 @@ export function setInNestedMap<Key1, Key2, Value>(
82
99
  key2: Key2,
83
100
  value: Value,
84
101
  ): void {
85
- const innerMap = getOrAddInMap(map, key1, new Map<Key2, Value>());
102
+ const innerMap = getOrAddInMap(map, key1);
86
103
  innerMap.set(key2, value);
87
104
  }
88
105
 
@@ -95,7 +112,7 @@ export function getOrCreateInNestedMap<Key1, Key2, Value>(
95
112
  key2: Key2,
96
113
  defaultValue: (key1: Key1, key2: Key2) => Value,
97
114
  ): Value {
98
- const innerMap = getOrAddInMap(map, key1, new Map<Key2, Value>());
115
+ const innerMap = getOrAddInMap(map, key1);
99
116
  return getOrCreate(innerMap, key2, (): Value => defaultValue(key1, key2));
100
117
  }
101
118
 
@@ -193,7 +210,7 @@ export function nestedMapFromFlatList<Key1, Key2, Value>(
193
210
  ): NestedMap<Key1, Key2, Value> {
194
211
  const map = new Map<Key1, Map<Key2, Value>>();
195
212
  for (const [key1, key2, val] of list) {
196
- getOrAddInMap(map, key1, new Map<Key2, Value>()).set(key2, val);
213
+ getOrAddInMap(map, key1).set(key2, val);
197
214
  }
198
215
  return map;
199
216
  }
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { type NestedMap, getOrDefaultInNestedMap, setInNestedMap } from "./nestedMap.js";
7
7
 
8
- export type NestedSet<Key1, Key2> = NestedMap<Key1, Key2, boolean>;
8
+ export type NestedSet<Key1, Key2> = NestedMap<Key1, Key2, true>;
9
9
 
10
10
  export function addToNestedSet<Key1, Key2>(
11
11
  set: NestedSet<Key1, Key2>,
package/src/util/utils.ts CHANGED
@@ -192,24 +192,6 @@ export function compareSets<T>({
192
192
  return true;
193
193
  }
194
194
 
195
- /**
196
- * Sets the value at `key` in map to value if not already present.
197
- * Returns the value at `key` after setting it.
198
- * This is equivalent to a get or default that adds the default to the map.
199
- */
200
- export function getOrAddInMap<Key, Value>(
201
- map: MapGetSet<Key, Value>,
202
- key: Key,
203
- value: Value,
204
- ): Value {
205
- const currentValue = map.get(key);
206
- if (currentValue !== undefined) {
207
- return currentValue;
208
- }
209
- map.set(key, value);
210
- return value;
211
- }
212
-
213
195
  /**
214
196
  * Retrieve a value from a map with the given key, or create a new entry if the key is not in the map.
215
197
  * @param map - The map to query/update