@fluidframework/tree 2.118.0 → 3.0.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.
- package/CHANGELOG.md +367 -75
- package/README.md +55 -52
- package/{api-extractor.json → api-extractor/api-extractor-model.json} +1 -1
- package/api-report/tree.alpha.api.md +130 -145
- package/api-report/tree.beta.api.md +122 -91
- package/api-report/tree.legacy.beta.api.md +122 -91
- package/api-report/tree.legacy.public.api.md +26 -43
- package/api-report/tree.public.api.md +26 -43
- package/dist/api.d.ts +9 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +2 -3
- package/dist/api.js.map +1 -1
- package/dist/codec/codec.d.ts +2 -2
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +9 -7
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/discriminatedUnions.js +1 -0
- package/dist/codec/discriminatedUnions.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js +4 -2
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/componentApi.d.ts.map +1 -1
- package/dist/componentApi.js +20 -17
- package/dist/componentApi.js.map +1 -1
- package/dist/core/change-family/editBuilder.js +1 -0
- package/dist/core/change-family/editBuilder.js.map +1 -1
- package/dist/core/forest/editableForest.js +1 -2
- package/dist/core/forest/editableForest.js.map +1 -1
- package/dist/core/forest/forest.js +3 -3
- package/dist/core/forest/forest.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +9 -5
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/changeRebaser.js +5 -5
- package/dist/core/rebase/changeRebaser.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +2 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/revisionTagCodec.d.ts +1 -1
- package/dist/core/rebase/revisionTagCodec.d.ts.map +1 -1
- package/dist/core/rebase/revisionTagCodec.js +3 -1
- package/dist/core/rebase/revisionTagCodec.js.map +1 -1
- package/dist/core/rebase/types.d.ts +12 -1
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +19 -15
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/rebase/utils.js +9 -10
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/schema-stored/schema.js +9 -4
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.js +6 -4
- package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +1 -1
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +62 -55
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/chunk.js +2 -2
- package/dist/core/tree/chunk.js.map +1 -1
- package/dist/core/tree/cursor.js +12 -12
- package/dist/core/tree/cursor.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts +34 -9
- package/dist/core/tree/deltaUtil.d.ts.map +1 -1
- package/dist/core/tree/deltaUtil.js +51 -17
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +23 -21
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +10 -10
- package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.js +1 -2
- package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -2
- package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.js +3 -2
- package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +3 -3
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV1.d.ts +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
- package/dist/core/tree/index.d.ts +1 -1
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +7 -4
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/mapTree.js +1 -2
- package/dist/core/tree/mapTree.js.map +1 -1
- package/dist/core/tree/pathTree.js +7 -8
- package/dist/core/tree/pathTree.js.map +1 -1
- package/dist/core/tree/persistedTreeTextFormat.d.ts +4 -4
- package/dist/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
- package/dist/core/tree/sparseTree.js +17 -13
- package/dist/core/tree/sparseTree.js.map +1 -1
- package/dist/core/tree/treeTextFormat.js +4 -5
- package/dist/core/tree/treeTextFormat.js.map +1 -1
- package/dist/core/tree/types.js +3 -3
- package/dist/core/tree/types.js.map +1 -1
- package/dist/core/tree/visitDelta.js +1 -2
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/core/tree/visitorUtils.js +5 -6
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/entrypoints/alpha.d.ts +1 -1
- package/dist/entrypoints/alpha.d.ts.map +1 -1
- package/dist/entrypoints/alpha.js +6 -4
- package/dist/entrypoints/alpha.js.map +1 -1
- package/dist/entrypoints/beta.d.ts +1 -1
- package/dist/entrypoints/beta.d.ts.map +1 -1
- package/dist/entrypoints/beta.js +2 -2
- package/dist/entrypoints/beta.js.map +1 -1
- package/dist/entrypoints/legacy.d.ts +1 -1
- package/dist/entrypoints/legacy.d.ts.map +1 -1
- package/dist/entrypoints/legacy.js +2 -2
- package/dist/entrypoints/legacy.js.map +1 -1
- package/dist/entrypoints/public.d.ts +1 -1
- package/dist/entrypoints/public.d.ts.map +1 -1
- package/dist/entrypoints/public.js +1 -2
- package/dist/entrypoints/public.js.map +1 -1
- package/dist/extensibleUnionNode.d.ts.map +1 -1
- package/dist/extensibleUnionNode.js +1 -1
- package/dist/extensibleUnionNode.js.map +1 -1
- package/dist/feature-libraries/changeAtomIdBTree.js +3 -4
- package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
- package/dist/feature-libraries/changeAtomIdCodec.js +1 -2
- package/dist/feature-libraries/changeAtomIdCodec.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +14 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +28 -20
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +22 -16
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +9 -11
- package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +15 -7
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +7 -3
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +3 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -0
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +33 -17
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +2 -2
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +11 -2
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +5 -6
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +2 -3
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/sequenceChunk.js +1 -0
- package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +73 -15
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/comparison-forest/comparisonForest.js +79 -79
- package/dist/feature-libraries/comparison-forest/comparisonForest.js.map +1 -1
- package/dist/feature-libraries/cursorComparator.d.ts +8 -0
- package/dist/feature-libraries/cursorComparator.d.ts.map +1 -1
- package/dist/feature-libraries/cursorComparator.js +43 -10
- package/dist/feature-libraries/cursorComparator.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +6 -3
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +2 -2
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js +2 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
- package/dist/feature-libraries/deltaUtils.js +2 -3
- package/dist/feature-libraries/deltaUtils.js.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js +2 -0
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/dist/feature-libraries/editableTreeBinder.js +1 -2
- package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js +19 -3
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js +2 -2
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyEntity.js +14 -14
- package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +28 -30
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.js +24 -23
- package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/dist/feature-libraries/flex-tree/observer.js +2 -2
- package/dist/feature-libraries/flex-tree/observer.js.map +1 -1
- package/dist/feature-libraries/flex-tree/utilities.js +5 -5
- package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +122 -117
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +49 -32
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/dist/feature-libraries/forest-summary/summaryTypes.js +2 -3
- package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +35 -31
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/mapTreeCursor.js +6 -7
- package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.js +2 -3
- package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.js +6 -7
- package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js +4 -4
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +14 -12
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +63 -10
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js +3 -3
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKind.js +10 -0
- package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/filterEdits.d.ts +13 -0
- package/dist/feature-libraries/modular-schema/filterEdits.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/filterEdits.js +51 -0
- package/dist/feature-libraries/modular-schema/filterEdits.js.map +1 -0
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +7 -4
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +1 -2
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js +1 -2
- package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/invert.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/invert.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/invert.js +5 -30
- package/dist/feature-libraries/modular-schema/invert.js.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.js +4 -5
- package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +5 -7
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js +459 -10
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +14 -15
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +1 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +2 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -10
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +30 -97
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +9 -9
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +4 -4
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js +1 -2
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts +13 -1
- package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeUtils.js +115 -12
- package/dist/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -1
- package/dist/feature-libraries/modular-schema/prune.d.ts +2 -3
- package/dist/feature-libraries/modular-schema/prune.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/prune.js +25 -8
- package/dist/feature-libraries/modular-schema/prune.js.map +1 -1
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -3
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
- package/dist/feature-libraries/node-identifier/nodeIdentifier.js +2 -2
- package/dist/feature-libraries/node-identifier/nodeIdentifier.js.map +1 -1
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js +3 -3
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +274 -267
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +27 -35
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +7 -7
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +8 -8
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js +1 -2
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +1 -2
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js +3 -0
- package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/dist/feature-libraries/schemaChecker.js +5 -5
- package/dist/feature-libraries/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +8 -2
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/filterEdits.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/filterEdits.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/filterEdits.js +29 -11
- package/dist/feature-libraries/sequence-field/filterEdits.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV1.d.ts +102 -102
- package/dist/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV2.d.ts +79 -79
- package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV3.d.ts +56 -56
- package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +1 -2
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/markListFactory.js +3 -4
- package/dist/feature-libraries/sequence-field/markListFactory.js.map +1 -1
- package/dist/feature-libraries/sequence-field/markQueue.js +4 -2
- package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.js +9 -9
- package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/dist/feature-libraries/sequence-field/prune.js +1 -2
- package/dist/feature-libraries/sequence-field/prune.js.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js +7 -2
- package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js +1 -2
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -1
- package/dist/feature-libraries/sequence-field/replaceRevisions.js +1 -2
- package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +2 -3
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +1 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +9 -9
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +1 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +54 -67
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +19 -15
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/feature-libraries/treeTextCursor.js +8 -8
- package/dist/feature-libraries/treeTextCursor.js.map +1 -1
- package/dist/feature-libraries/valueUtilities.js +4 -5
- package/dist/feature-libraries/valueUtilities.js.map +1 -1
- package/dist/index.d.ts +4 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -9
- package/dist/index.js.map +1 -1
- package/dist/internalTypes.d.ts +1 -1
- package/dist/internalTypes.d.ts.map +1 -1
- package/dist/internalTypes.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/serializableDomainSchema.d.ts +1 -1
- package/dist/shared-tree/history.d.ts.map +1 -1
- package/dist/shared-tree/history.js +32 -13
- package/dist/shared-tree/history.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts +27 -3
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +36 -7
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +2 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +6 -2
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/isAuditableFromOutcome.js +1 -2
- package/dist/shared-tree/isAuditableFromOutcome.js.map +1 -1
- package/dist/shared-tree/schematizeTree.js +3 -4
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +2 -2
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +59 -26
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +28 -19
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +3 -3
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js +12 -4
- package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +11 -8
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFormat.js +2 -3
- package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.js +2 -0
- package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/dist/shared-tree/transactionMinimize.d.ts.map +1 -1
- package/dist/shared-tree/transactionMinimize.js +2 -1
- package/dist/shared-tree/transactionMinimize.js.map +1 -1
- package/dist/shared-tree/transactionPostProcessor.js +2 -3
- package/dist/shared-tree/transactionPostProcessor.js.map +1 -1
- package/dist/shared-tree/tree.js +2 -2
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +5 -16
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +18 -11
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/{lib/simple-tree/api → dist/shared-tree}/treeBeta.d.ts +8 -65
- package/dist/shared-tree/treeBeta.d.ts.map +1 -0
- package/dist/shared-tree/treeBeta.js +70 -0
- package/dist/shared-tree/treeBeta.js.map +1 -0
- package/dist/shared-tree/treeCheckout.d.ts +5 -0
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +986 -907
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree/unhydratedTreeContext.js +3 -4
- package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +24 -20
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/branchCommitCounter.js +35 -32
- package/dist/shared-tree-core/branchCommitCounter.js.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.js +9 -8
- package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/dist/shared-tree-core/branchIdCodec.js +2 -3
- package/dist/shared-tree-core/branchIdCodec.js.map +1 -1
- package/dist/shared-tree-core/customMetadataCodec.js +2 -3
- package/dist/shared-tree-core/customMetadataCodec.js.map +1 -1
- package/dist/shared-tree-core/customMetadataFormat.d.ts.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.js +11 -9
- package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +73 -44
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +3 -3
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js +33 -36
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js +1 -2
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -2
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +11 -11
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +5 -4
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +10 -9
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +6 -1
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js +1 -2
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js +1 -2
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +3 -3
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +3 -2
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +3 -2
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +44 -22
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/summaryTypes.js +2 -2
- package/dist/shared-tree-core/summaryTypes.js.map +1 -1
- package/dist/shared-tree-core/transaction.js +36 -39
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/shared-tree-core/versionedSummarizer.js +4 -0
- package/dist/shared-tree-core/versionedSummarizer.js.map +1 -1
- package/dist/simple-tree/api/cloneTree.d.ts +11 -0
- package/dist/simple-tree/api/cloneTree.d.ts.map +1 -0
- package/dist/simple-tree/api/cloneTree.js +31 -0
- package/dist/simple-tree/api/cloneTree.js.map +1 -0
- package/dist/simple-tree/api/conciseTree.js +2 -3
- package/dist/simple-tree/api/conciseTree.js.map +1 -1
- package/dist/simple-tree/api/configuration.js +21 -2
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/create.js +2 -3
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/customTree.js +6 -6
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/dirtyIndex.js +1 -2
- package/dist/simple-tree/api/dirtyIndex.js.map +1 -1
- package/dist/simple-tree/api/discrepancies.js +2 -3
- package/dist/simple-tree/api/discrepancies.js.map +1 -1
- package/dist/simple-tree/api/eraseSchemaDetails.js +2 -3
- package/dist/simple-tree/api/eraseSchemaDetails.js.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.js +1 -2
- package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/getSimpleSchema.js +1 -2
- package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
- package/dist/simple-tree/api/identifierIndex.js +1 -2
- package/dist/simple-tree/api/identifierIndex.js.map +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.js +2 -2
- package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +3 -3
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +4 -7
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js +2 -3
- package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts +3 -7
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js +6 -9
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +4 -9
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +13 -12
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +20 -22
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +78 -81
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts +7 -9
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js +32 -35
- package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js +1 -2
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js +1 -2
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/dist/simple-tree/api/schemaStatics.d.ts +7 -7
- package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaCodec.js +2 -3
- package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +2 -3
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js +1 -2
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +46 -2
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +54 -12
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +2 -3
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/transactionTypes.d.ts +4 -4
- package/dist/simple-tree/api/transactionTypes.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +80 -61
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js +3 -5
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.d.ts +16 -4
- package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
- package/dist/simple-tree/api/treeChangeEventsBeta.d.ts +209 -0
- package/dist/simple-tree/api/treeChangeEventsBeta.d.ts.map +1 -0
- package/dist/simple-tree/api/{treeAlpha.js → treeChangeEventsBeta.js} +1 -1
- package/dist/simple-tree/api/treeChangeEventsBeta.js.map +1 -0
- package/dist/simple-tree/api/treeNodeApi.d.ts +1 -75
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +7 -7
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +8 -6
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +5 -6
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/core/allowedTypes.js +22 -13
- package/dist/simple-tree/core/allowedTypes.js.map +1 -1
- package/dist/simple-tree/core/context.js +3 -0
- package/dist/simple-tree/core/context.js.map +1 -1
- package/dist/simple-tree/core/flexList.js +2 -3
- package/dist/simple-tree/core/flexList.js.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.js +2 -3
- package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +1 -1
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +2 -2
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/treeNode.d.ts +3 -4
- package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNode.js +31 -32
- package/dist/simple-tree/core/treeNode.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +194 -192
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js +3 -3
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.js +23 -23
- package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
- package/dist/simple-tree/core/types.js +1 -2
- package/dist/simple-tree/core/types.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +177 -150
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/core/walkSchema.js +2 -3
- package/dist/simple-tree/core/walkSchema.js.map +1 -1
- package/dist/simple-tree/core/withType.d.ts +7 -9
- package/dist/simple-tree/core/withType.d.ts.map +1 -1
- package/dist/simple-tree/core/withType.js +6 -7
- package/dist/simple-tree/core/withType.js.map +1 -1
- package/dist/simple-tree/createContext.js +2 -3
- package/dist/simple-tree/createContext.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js +33 -15
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/getTreeNodeForField.js +1 -2
- package/dist/simple-tree/getTreeNodeForField.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +5 -8
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +18 -17
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +3 -2
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +31 -33
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js +2 -2
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/common.js +1 -2
- package/dist/simple-tree/node-kinds/common.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts +6 -6
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +10 -16
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.js +2 -2
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +27 -28
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.js +2 -2
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js +10 -13
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +3 -2
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.js +2 -2
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
- package/dist/simple-tree/prepareForInsertion.js +4 -5
- package/dist/simple-tree/prepareForInsertion.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +11 -11
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/treeSchema.js +1 -2
- package/dist/simple-tree/treeSchema.js.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +3 -4
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/dist/simple-tree/walkFieldSchema.js +1 -2
- package/dist/simple-tree/walkFieldSchema.js.map +1 -1
- package/dist/tableSchema.d.ts +2 -87
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +309 -275
- package/dist/tableSchema.js.map +1 -1
- package/dist/text/codePointUtils.d.ts +16 -3
- package/dist/text/codePointUtils.d.ts.map +1 -1
- package/dist/text/codePointUtils.js +24 -13
- package/dist/text/codePointUtils.js.map +1 -1
- package/dist/text/textDomain.d.ts +7 -1
- package/dist/text/textDomain.d.ts.map +1 -1
- package/dist/text/textDomain.js +32 -28
- package/dist/text/textDomain.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +45 -34
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/text/textDomainFormattedDefault.js +2 -5
- package/dist/text/textDomainFormattedDefault.js.map +1 -1
- package/dist/treeDataStore.js +2 -3
- package/dist/treeDataStore.js.map +1 -1
- package/dist/treeFactory.js +7 -7
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/arrayUtilities.js +5 -6
- package/dist/util/arrayUtilities.js.map +1 -1
- package/dist/util/bTreeUtils.js +3 -4
- package/dist/util/bTreeUtils.js.map +1 -1
- package/dist/util/brand.js +6 -5
- package/dist/util/brand.js.map +1 -1
- package/dist/util/brandedMap.js +2 -3
- package/dist/util/brandedMap.js.map +1 -1
- package/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js +7 -4
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/cloneWithReplacements.js +1 -2
- package/dist/util/cloneWithReplacements.js.map +1 -1
- package/dist/util/compressedIds.js +29 -7
- package/dist/util/compressedIds.js.map +1 -1
- package/dist/util/idAllocator.js +3 -3
- package/dist/util/idAllocator.js.map +1 -1
- package/dist/util/nestedMap.js +15 -17
- package/dist/util/nestedMap.js.map +1 -1
- package/dist/util/nestedSet.js +2 -3
- package/dist/util/nestedSet.js.map +1 -1
- package/dist/util/offsetList.js +2 -4
- package/dist/util/offsetList.js.map +1 -1
- package/dist/util/opaque.js +2 -3
- package/dist/util/opaque.js.map +1 -1
- package/dist/util/rangeMap.js +6 -2
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/readSnapshotBlob.d.ts.map +1 -1
- package/dist/util/referenceCounting.js +1 -0
- package/dist/util/referenceCounting.js.map +1 -1
- package/dist/util/stackyIterator.js +3 -2
- package/dist/util/stackyIterator.js.map +1 -1
- package/dist/util/typeUtils.js +1 -2
- package/dist/util/typeUtils.js.map +1 -1
- package/dist/util/typeboxBrand.js +2 -3
- package/dist/util/typeboxBrand.js.map +1 -1
- package/dist/util/utils.d.ts +2 -2
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +32 -32
- package/dist/util/utils.js.map +1 -1
- package/lib/api.d.ts +9 -1
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js.map +1 -1
- package/lib/codec/codec.d.ts +2 -2
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +2 -0
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/discriminatedUnions.js +1 -0
- package/lib/codec/discriminatedUnions.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js +2 -0
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/componentApi.d.ts.map +1 -1
- package/lib/componentApi.js +20 -17
- package/lib/componentApi.js.map +1 -1
- package/lib/core/change-family/editBuilder.js +1 -0
- package/lib/core/change-family/editBuilder.js.map +1 -1
- package/lib/core/index.d.ts +2 -2
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +2 -2
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/revisionTagCodec.js +3 -1
- package/lib/core/rebase/revisionTagCodec.js.map +1 -1
- package/lib/core/rebase/types.d.ts +12 -1
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +3 -0
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/schema-stored/schema.js +5 -0
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.js +4 -2
- package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
- package/lib/core/tree/anchorSet.js +61 -54
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/deltaUtil.d.ts +34 -9
- package/lib/core/tree/deltaUtil.d.ts.map +1 -1
- package/lib/core/tree/deltaUtil.js +41 -10
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +23 -21
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +10 -10
- package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.js +2 -0
- package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV2.js +2 -0
- package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +3 -3
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
- package/lib/core/tree/index.d.ts +1 -1
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/persistedTreeTextFormat.d.ts +4 -4
- package/lib/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
- package/lib/core/tree/sparseTree.js +15 -11
- package/lib/core/tree/sparseTree.js.map +1 -1
- package/lib/entrypoints/alpha.d.ts +1 -1
- package/lib/entrypoints/alpha.d.ts.map +1 -1
- package/lib/entrypoints/alpha.js +1 -1
- package/lib/entrypoints/alpha.js.map +1 -1
- package/lib/entrypoints/beta.d.ts +1 -1
- package/lib/entrypoints/beta.d.ts.map +1 -1
- package/lib/entrypoints/beta.js +1 -1
- package/lib/entrypoints/beta.js.map +1 -1
- package/lib/entrypoints/legacy.d.ts +1 -1
- package/lib/entrypoints/legacy.d.ts.map +1 -1
- package/lib/entrypoints/legacy.js +1 -1
- package/lib/entrypoints/legacy.js.map +1 -1
- package/lib/entrypoints/public.d.ts +1 -1
- package/lib/entrypoints/public.d.ts.map +1 -1
- package/lib/entrypoints/public.js +1 -1
- package/lib/entrypoints/public.js.map +1 -1
- package/lib/extensibleUnionNode.d.ts.map +1 -1
- package/lib/extensibleUnionNode.js +2 -2
- package/lib/extensibleUnionNode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +14 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +14 -6
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +18 -12
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +1 -3
- package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +8 -0
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +4 -0
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +1 -0
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +2 -0
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +28 -12
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +2 -2
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +9 -0
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.js +1 -0
- package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +71 -13
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/comparison-forest/comparisonForest.js +79 -79
- package/lib/feature-libraries/comparison-forest/comparisonForest.js.map +1 -1
- package/lib/feature-libraries/cursorComparator.d.ts +8 -0
- package/lib/feature-libraries/cursorComparator.d.ts.map +1 -1
- package/lib/feature-libraries/cursorComparator.js +43 -9
- package/lib/feature-libraries/cursorComparator.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js +2 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js +2 -0
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js +19 -3
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyEntity.js +12 -12
- package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +25 -27
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js +22 -21
- package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +122 -117
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +49 -32
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +33 -29
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +14 -12
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +63 -10
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKind.js +10 -0
- package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/filterEdits.d.ts +13 -0
- package/lib/feature-libraries/modular-schema/filterEdits.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/filterEdits.js +46 -0
- package/lib/feature-libraries/modular-schema/filterEdits.js.map +1 -0
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +5 -2
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/invert.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/invert.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/invert.js +6 -30
- package/lib/feature-libraries/modular-schema/invert.js.map +1 -1
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +5 -7
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js +458 -8
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -10
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +20 -85
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts +13 -1
- package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeUtils.js +100 -3
- package/lib/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -1
- package/lib/feature-libraries/modular-schema/prune.d.ts +2 -3
- package/lib/feature-libraries/modular-schema/prune.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/prune.js +25 -7
- package/lib/feature-libraries/modular-schema/prune.js.map +1 -1
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -3
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js +1 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +273 -266
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +24 -32
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js +3 -0
- package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +6 -0
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/filterEdits.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/filterEdits.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/filterEdits.js +31 -12
- package/lib/feature-libraries/sequence-field/filterEdits.js.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV1.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV2.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV3.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/markListFactory.js +3 -4
- package/lib/feature-libraries/sequence-field/markListFactory.js.map +1 -1
- package/lib/feature-libraries/sequence-field/markQueue.js +4 -2
- package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.js +6 -0
- package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +9 -9
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +3 -15
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +13 -9
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/index.d.ts +4 -29
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -17
- package/lib/index.js.map +1 -1
- package/lib/internalTypes.d.ts +1 -1
- package/lib/internalTypes.d.ts.map +1 -1
- package/lib/internalTypes.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/serializableDomainSchema.d.ts +1 -1
- package/lib/shared-tree/history.d.ts.map +1 -1
- package/lib/shared-tree/history.js +32 -13
- package/lib/shared-tree/history.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts +27 -3
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +30 -2
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +2 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +2 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +2 -2
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +60 -27
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +24 -15
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.js +12 -4
- package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +6 -3
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.js +2 -0
- package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/lib/shared-tree/transactionMinimize.d.ts.map +1 -1
- package/lib/shared-tree/transactionMinimize.js +4 -3
- package/lib/shared-tree/transactionMinimize.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +5 -16
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +13 -6
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/{dist/simple-tree/api → lib/shared-tree}/treeBeta.d.ts +8 -65
- package/lib/shared-tree/treeBeta.d.ts.map +1 -0
- package/lib/shared-tree/treeBeta.js +64 -0
- package/lib/shared-tree/treeBeta.js.map +1 -0
- package/lib/shared-tree/treeCheckout.d.ts +5 -0
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +985 -906
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree/unhydratedTreeContext.js +3 -4
- package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +22 -18
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/branchCommitCounter.js +35 -32
- package/lib/shared-tree-core/branchCommitCounter.js.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.js +9 -8
- package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/lib/shared-tree-core/customMetadataFormat.d.ts.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.js +11 -9
- package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +73 -44
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js +32 -34
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +4 -4
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +2 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +6 -1
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +2 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +2 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +45 -23
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.js +36 -39
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/shared-tree-core/versionedSummarizer.js +4 -0
- package/lib/shared-tree-core/versionedSummarizer.js.map +1 -1
- package/lib/simple-tree/api/cloneTree.d.ts +11 -0
- package/lib/simple-tree/api/cloneTree.d.ts.map +1 -0
- package/lib/simple-tree/api/cloneTree.js +28 -0
- package/lib/simple-tree/api/cloneTree.js.map +1 -0
- package/lib/simple-tree/api/configuration.js +19 -0
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +3 -3
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts +3 -7
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js +1 -3
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +4 -9
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +9 -8
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +18 -20
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +78 -81
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts +7 -9
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js +32 -35
- package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/lib/simple-tree/api/schemaStatics.d.ts +7 -7
- package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +46 -2
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +48 -6
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/transactionTypes.d.ts +4 -4
- package/lib/simple-tree/api/transactionTypes.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +80 -61
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js +2 -3
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.d.ts +16 -4
- package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
- package/lib/simple-tree/api/treeChangeEventsBeta.d.ts +209 -0
- package/lib/simple-tree/api/treeChangeEventsBeta.d.ts.map +1 -0
- package/lib/simple-tree/api/{treeAlpha.js → treeChangeEventsBeta.js} +1 -1
- package/lib/simple-tree/api/treeChangeEventsBeta.js.map +1 -0
- package/lib/simple-tree/api/treeNodeApi.d.ts +1 -75
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +1 -1
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +8 -6
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/core/allowedTypes.js +12 -3
- package/lib/simple-tree/core/allowedTypes.js.map +1 -1
- package/lib/simple-tree/core/context.js +3 -0
- package/lib/simple-tree/core/context.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +1 -1
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +1 -1
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/treeNode.d.ts +3 -4
- package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNode.js +29 -30
- package/lib/simple-tree/core/treeNode.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +181 -179
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.js +19 -19
- package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +173 -146
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/core/withType.d.ts +7 -9
- package/lib/simple-tree/core/withType.d.ts.map +1 -1
- package/lib/simple-tree/core/withType.js +5 -6
- package/lib/simple-tree/core/withType.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js +23 -5
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +2 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +16 -15
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +3 -2
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +28 -32
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts +6 -6
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +10 -17
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +25 -28
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js +10 -14
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +3 -2
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
- package/lib/tableSchema.d.ts +2 -87
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +309 -275
- package/lib/tableSchema.js.map +1 -1
- package/lib/text/codePointUtils.d.ts +16 -3
- package/lib/text/codePointUtils.d.ts.map +1 -1
- package/lib/text/codePointUtils.js +22 -10
- package/lib/text/codePointUtils.js.map +1 -1
- package/lib/text/textDomain.d.ts +7 -1
- package/lib/text/textDomain.d.ts.map +1 -1
- package/lib/text/textDomain.js +21 -17
- package/lib/text/textDomain.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +43 -32
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/text/textDomainFormattedDefault.js +2 -5
- package/lib/text/textDomainFormattedDefault.js.map +1 -1
- package/lib/util/brand.js +1 -0
- package/lib/util/brand.js.map +1 -1
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js +3 -0
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/compressedIds.js +22 -0
- package/lib/util/compressedIds.js.map +1 -1
- package/lib/util/nestedMap.js +2 -4
- package/lib/util/nestedMap.js.map +1 -1
- package/lib/util/offsetList.js +2 -4
- package/lib/util/offsetList.js.map +1 -1
- package/lib/util/rangeMap.js +4 -0
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/readSnapshotBlob.d.ts.map +1 -1
- package/lib/util/referenceCounting.js +1 -0
- package/lib/util/referenceCounting.js.map +1 -1
- package/lib/util/stackyIterator.js +3 -2
- package/lib/util/stackyIterator.js.map +1 -1
- package/lib/util/utils.d.ts +2 -2
- package/lib/util/utils.d.ts.map +1 -1
- package/package.json +67 -95
- package/src/api.ts +11 -0
- package/src/core/index.ts +6 -2
- package/src/core/rebase/index.ts +1 -0
- package/src/core/rebase/types.ts +16 -1
- package/src/core/tree/anchorSet.ts +2 -2
- package/src/core/tree/deltaUtil.ts +67 -13
- package/src/core/tree/index.ts +5 -2
- package/src/entrypoints/alpha.ts +19 -21
- package/src/entrypoints/beta.ts +12 -5
- package/src/entrypoints/legacy.ts +12 -5
- package/src/entrypoints/public.ts +1 -5
- package/src/extensibleUnionNode.ts +1 -2
- package/src/feature-libraries/cursorComparator.ts +57 -9
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +77 -12
- package/src/feature-libraries/modular-schema/filterEdits.ts +108 -0
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +7 -4
- package/src/feature-libraries/modular-schema/index.ts +5 -2
- package/src/feature-libraries/modular-schema/invert.ts +16 -61
- package/src/feature-libraries/modular-schema/minimizeModularChange.ts +831 -10
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +10 -124
- package/src/feature-libraries/modular-schema/modularChangeUtils.ts +164 -2
- package/src/feature-libraries/modular-schema/prune.ts +52 -10
- package/src/feature-libraries/optional-field/optionalField.ts +30 -42
- package/src/feature-libraries/sequence-field/filterEdits.ts +62 -26
- package/src/feature-libraries/sequence-field/utils.ts +7 -19
- package/src/index.ts +7 -39
- package/src/internalTypes.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/history.ts +41 -19
- package/src/shared-tree/independentView.ts +40 -3
- package/src/shared-tree/index.ts +5 -1
- package/src/shared-tree/schematizingTreeView.ts +2 -2
- package/src/shared-tree/sharedTree.ts +2 -1
- package/src/shared-tree/transactionMinimize.ts +13 -4
- package/src/shared-tree/treeAlpha.ts +17 -31
- package/src/{simple-tree/api → shared-tree}/treeBeta.ts +56 -167
- package/src/shared-tree/treeCheckout.ts +82 -9
- package/src/shared-tree-core/editManager.ts +16 -8
- package/src/shared-tree-core/editManagerCodecsCommons.ts +30 -34
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +1 -1
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +2 -2
- package/src/simple-tree/api/cloneTree.ts +47 -0
- package/src/simple-tree/api/index.ts +15 -21
- package/src/simple-tree/api/schemaFactoryAlpha.ts +2 -2
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +87 -6
- package/src/simple-tree/api/transactionTypes.ts +4 -4
- package/src/simple-tree/api/tree.ts +139 -85
- package/src/simple-tree/api/treeChangeEvents.ts +16 -4
- package/src/simple-tree/api/treeChangeEventsBeta.ts +245 -0
- package/src/simple-tree/api/treeNodeApi.ts +6 -85
- package/src/simple-tree/api/typesUnsafe.ts +8 -6
- package/src/simple-tree/core/index.ts +1 -1
- package/src/simple-tree/core/treeNode.ts +3 -10
- package/src/simple-tree/core/withType.ts +8 -11
- package/src/simple-tree/index.ts +3 -7
- package/src/simple-tree/node-kinds/array/arrayNode.ts +14 -12
- package/src/simple-tree/node-kinds/map/mapNode.ts +14 -15
- package/src/simple-tree/node-kinds/object/objectNode.ts +3 -6
- package/src/simple-tree/node-kinds/record/recordNode.ts +6 -8
- package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +2 -1
- package/src/tableSchema.ts +8 -187
- package/src/text/codePointUtils.ts +25 -14
- package/src/text/textDomain.ts +15 -2
- package/src/text/textDomainFormatted.ts +9 -4
- package/tsconfig.json +1 -1
- package/alpha.d.ts +0 -11
- package/beta.d.ts +0 -11
- package/dist/simple-tree/api/treeAlpha.d.ts +0 -126
- package/dist/simple-tree/api/treeAlpha.d.ts.map +0 -1
- package/dist/simple-tree/api/treeAlpha.js.map +0 -1
- package/dist/simple-tree/api/treeBeta.d.ts.map +0 -1
- package/dist/simple-tree/api/treeBeta.js +0 -83
- package/dist/simple-tree/api/treeBeta.js.map +0 -1
- package/docs/main/glossary.md +0 -163
- package/internal.d.ts +0 -11
- package/legacy.d.ts +0 -11
- package/lib/simple-tree/api/treeAlpha.d.ts +0 -126
- package/lib/simple-tree/api/treeAlpha.d.ts.map +0 -1
- package/lib/simple-tree/api/treeAlpha.js.map +0 -1
- package/lib/simple-tree/api/treeBeta.d.ts.map +0 -1
- package/lib/simple-tree/api/treeBeta.js +0 -77
- package/lib/simple-tree/api/treeBeta.js.map +0 -1
- package/src/simple-tree/api/treeAlpha.ts +0 -153
- /package/api-extractor/{api-extractor.current.json → api-extractor-report.current.json} +0 -0
- /package/api-extractor/{api-extractor.legacy.json → api-extractor-report.legacy.json} +0 -0
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.FormattedText = exports.StringTextAtomNode = void 0;
|
|
8
|
-
const tslib_1 = require("tslib");
|
|
9
8
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
10
9
|
const internal_2 = require("@fluidframework/telemetry-utils/internal");
|
|
11
10
|
const index_js_1 = require("../core/index.js");
|
|
@@ -95,10 +94,9 @@ var FormattedText;
|
|
|
95
94
|
* TODO: The choice to always include the built-in {@link FormattedText.(StringTextAtom:variable)} is a design decision that should be re-evaluated before stabilizing.
|
|
96
95
|
*/
|
|
97
96
|
function createSchema(inputSchemaFactory, formatSchema, extraAtoms, defaultFormatInsertable) {
|
|
98
|
-
var _TextNode_instances, _TextNode_fullString_reference, _TextNode_charactersCopy_reference, _TextNode_editRange;
|
|
99
97
|
const atoms = [FormattedText.StringTextAtom, ...extraAtoms];
|
|
100
98
|
const sf = createFormattedScopedFactory(inputSchemaFactory);
|
|
101
|
-
const defaultFormat =
|
|
99
|
+
const defaultFormat = index_js_3.TreeBeta.create(formatSchema, defaultFormatInsertable);
|
|
102
100
|
/**
|
|
103
101
|
* Gets a format node, which must be cloned before being inserted.
|
|
104
102
|
*/
|
|
@@ -106,10 +104,10 @@ var FormattedText;
|
|
|
106
104
|
// Note we cannot use the `format ?? defaultFormat` syntax as format is allowed to be `null`.
|
|
107
105
|
return format === undefined
|
|
108
106
|
? defaultFormat
|
|
109
|
-
:
|
|
107
|
+
: index_js_3.TreeBeta.create(formatSchema, format);
|
|
110
108
|
}
|
|
111
109
|
function cloneFormat(format) {
|
|
112
|
-
const clone =
|
|
110
|
+
const clone = index_js_3.TreeBeta.clone(format);
|
|
113
111
|
// TypeScript fails to prove that cloning a node gives a node, and not possible undefined (like cloning a empty field could).
|
|
114
112
|
// This cast helps users of this function get the types they need.
|
|
115
113
|
return clone;
|
|
@@ -117,10 +115,6 @@ var FormattedText;
|
|
|
117
115
|
class TextNode extends sf.object("Text", {
|
|
118
116
|
content: index_js_4.SchemaFactory.required([() => StringArray], { key: index_js_1.EmptyKey }),
|
|
119
117
|
}) {
|
|
120
|
-
constructor() {
|
|
121
|
-
super(...arguments);
|
|
122
|
-
_TextNode_instances.add(this);
|
|
123
|
-
}
|
|
124
118
|
insertAt(index, additionalCharacters, format) {
|
|
125
119
|
const newAtoms = typeof additionalCharacters === "string"
|
|
126
120
|
? stringTextAtomsFromString(additionalCharacters)
|
|
@@ -136,7 +130,7 @@ var FormattedText;
|
|
|
136
130
|
}
|
|
137
131
|
charactersCopy() {
|
|
138
132
|
const result = this.content.charactersCopy();
|
|
139
|
-
(0, textDomain_js_1.expensiveInternalValidationAssert)(() => (0, internal_1.compareArrays)(result,
|
|
133
|
+
(0, textDomain_js_1.expensiveInternalValidationAssert)(() => (0, internal_1.compareArrays)(result, this.#charactersCopy_reference()) ||
|
|
140
134
|
"invalid charactersCopy optimizations");
|
|
141
135
|
return result;
|
|
142
136
|
}
|
|
@@ -145,9 +139,21 @@ var FormattedText;
|
|
|
145
139
|
}
|
|
146
140
|
fullString() {
|
|
147
141
|
const result = this.content.fullString();
|
|
148
|
-
(0, textDomain_js_1.expensiveInternalValidationAssert)(() => result ===
|
|
142
|
+
(0, textDomain_js_1.expensiveInternalValidationAssert)(() => result === this.#fullString_reference() || "invalid fullString optimizations");
|
|
149
143
|
return result;
|
|
150
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* A non-optimized reference implementation of fullString.
|
|
147
|
+
*/
|
|
148
|
+
#fullString_reference() {
|
|
149
|
+
return [...this.characters()].join("");
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Unoptimized trivially correct implementation of charactersCopy.
|
|
153
|
+
*/
|
|
154
|
+
#charactersCopy_reference() {
|
|
155
|
+
return [...this.characters()];
|
|
156
|
+
}
|
|
151
157
|
static fromString(value, format) {
|
|
152
158
|
const formatNode = getFormatNode(format);
|
|
153
159
|
// Use `this` rather than `TextNode` so the more derived schema class is constructed when using this as a static on a subclass.
|
|
@@ -174,7 +180,7 @@ var FormattedText;
|
|
|
174
180
|
(0, internal_1.assert)(typeof key === "string", 0xcc8 /* Object.entries returned a non-string key. */);
|
|
175
181
|
return [key, value];
|
|
176
182
|
});
|
|
177
|
-
|
|
183
|
+
this.#editRange(start, end, "FormattedText.formatRange", (atom) => {
|
|
178
184
|
const formatNode = atom.format;
|
|
179
185
|
const atomFormatSchema = index_js_3.Tree.schema(formatNode);
|
|
180
186
|
if (!(0, index_js_4.isObjectNodeSchema)(atomFormatSchema)) {
|
|
@@ -187,17 +193,37 @@ var FormattedText;
|
|
|
187
193
|
}
|
|
188
194
|
// Ensures that if the input is a node, it is cloned before being inserted into the tree.
|
|
189
195
|
// Note that since this uses field schema, `undefined` can pass through this if allowed by the schema.
|
|
190
|
-
const clonedValue =
|
|
196
|
+
const clonedValue = index_js_3.TreeBeta.clone(index_js_3.TreeBeta.create(field, value));
|
|
191
197
|
formatNode[key] = clonedValue;
|
|
192
198
|
}
|
|
193
199
|
});
|
|
194
200
|
}
|
|
195
201
|
reformat(start, end, format) {
|
|
196
202
|
const node = getFormatNode(format);
|
|
197
|
-
|
|
203
|
+
this.#editRange(start, end, "FormattedText.reformat", (atom) => {
|
|
198
204
|
atom.format = cloneFormat(node);
|
|
199
205
|
});
|
|
200
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Map an edit over a range of atoms, validating the range and running the edits in a transaction.
|
|
209
|
+
* @remarks
|
|
210
|
+
* This is not exposed in the API since this approach will have to be replaced when formatting is optimized,
|
|
211
|
+
* so we don't want users to directly depend on this un-optimizable layer.
|
|
212
|
+
*/
|
|
213
|
+
#editRange(start, end, method, edit) {
|
|
214
|
+
const formatStart = start ?? 0;
|
|
215
|
+
(0, index_js_5.validateIndex)(formatStart, this.content, method, true);
|
|
216
|
+
const formatEnd = Math.min(this.content.length, end ?? this.content.length);
|
|
217
|
+
(0, index_js_5.validateIndexRange)(formatStart, formatEnd, this.content, method);
|
|
218
|
+
index_js_3.TreeAlpha.context(this).runTransaction(() => {
|
|
219
|
+
for (let i = formatStart; i < formatEnd; i++) {
|
|
220
|
+
const atom = this.content[i];
|
|
221
|
+
// Range validated above, so this should never fail.
|
|
222
|
+
(0, internal_1.assert)(atom !== undefined, 0xd08 /* Index out of bounds while formatting text range. */);
|
|
223
|
+
edit(atom);
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
201
227
|
/**
|
|
202
228
|
* Returns the {@link FormattedText.TextAtom.content} at the given atom index, or `undefined` if out of bounds.
|
|
203
229
|
*/
|
|
@@ -208,10 +234,13 @@ var FormattedText;
|
|
|
208
234
|
return atom.content.content;
|
|
209
235
|
}
|
|
210
236
|
onCharactersChanged(callback) {
|
|
211
|
-
return index_js_3.
|
|
237
|
+
return index_js_3.TreeBeta.on(this.content, "nodeChanged", ({ delta }) => (0, textDomain_js_1.processCharactersChangedDelta)(delta, (index) => this.getAtomCharacterAt(index), callback));
|
|
238
|
+
}
|
|
239
|
+
createInsertionAnchor(index) {
|
|
240
|
+
return (0, index_js_4.createArrayInsertionAnchor)(this.content, index);
|
|
212
241
|
}
|
|
213
242
|
onContentChanged(callback) {
|
|
214
|
-
return index_js_3.
|
|
243
|
+
return index_js_3.TreeBeta.on(this.content, "treeChanged", ({ delta }) => (0, textDomain_js_1.processCharactersChangedDelta)(delta, (index) => this.getAtomCharacterAt(index), callback));
|
|
215
244
|
}
|
|
216
245
|
getUniformRun(startIndex, endIndex) {
|
|
217
246
|
return this.content.getUniformRun(startIndex, endIndex);
|
|
@@ -220,24 +249,6 @@ var FormattedText;
|
|
|
220
249
|
return this.content.getString(startIndex, endIndex);
|
|
221
250
|
}
|
|
222
251
|
}
|
|
223
|
-
_TextNode_instances = new WeakSet(), _TextNode_fullString_reference = function _TextNode_fullString_reference() {
|
|
224
|
-
return [...this.characters()].join("");
|
|
225
|
-
}, _TextNode_charactersCopy_reference = function _TextNode_charactersCopy_reference() {
|
|
226
|
-
return [...this.characters()];
|
|
227
|
-
}, _TextNode_editRange = function _TextNode_editRange(start, end, method, edit) {
|
|
228
|
-
const formatStart = start ?? 0;
|
|
229
|
-
(0, index_js_5.validateIndex)(formatStart, this.content, method, true);
|
|
230
|
-
const formatEnd = Math.min(this.content.length, end ?? this.content.length);
|
|
231
|
-
(0, index_js_5.validateIndexRange)(formatStart, formatEnd, this.content, method);
|
|
232
|
-
index_js_3.TreeAlpha.context(this).runTransaction(() => {
|
|
233
|
-
for (let i = formatStart; i < formatEnd; i++) {
|
|
234
|
-
const atom = this.content[i];
|
|
235
|
-
// Range validated above, so this should never fail.
|
|
236
|
-
(0, internal_1.assert)(atom !== undefined, 0xd08 /* Index out of bounds while formatting text range. */);
|
|
237
|
-
edit(atom);
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
};
|
|
241
252
|
function stringTextAtomsFromString(value) {
|
|
242
253
|
// TypeScript can't prove in this Generic context that StringTextAtom is assignable to TextAtomNode, so we have to cast.
|
|
243
254
|
// Since TextAtomSchemas unconditionally includes StringTextAtom, this cast is safe.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textDomainFormatted.js","sourceRoot":"","sources":["../../src/text/textDomainFormatted.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,kEAA+F;AAC/F,uEAAsE;AAEtE,+CAM0B;AAC1B,4DAAqF;AACrF,sDAAwE;AACxE,sDAUiC;AAiBjC,+CAM0B;AAE1B,mDAKyB;AAEzB;;;GAGG;AACH,2HAA2H;AAC3H,SAAS,4BAA4B,CACpC,kBAAiD;IAEjD,OAAO,IAAA,sDAA2C,EAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;AAC1F,CAAC;AAED;;GAEG;AACH,MAAM,QAAQ,GAAG,IAAI,6BAAkB,CAAC,mCAAmC,CAAC,CAAC;AAE7E,MAAM,SAAS,GAAa,IAAA,gBAAK,EAAC,QAAQ,CAAC,CAAC;AAE5C;;;;GAIG;AACH,MAAa,kBACZ,SAAQ,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE;IACzC;;;;;;;;;;OAUG;IACH,OAAO,EAAE,wBAAa,CAAC,QAAQ,CAAC,CAAC,wBAAa,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,mBAAQ,EAAE,CAAC;CAC1E,CAAC;IAGK,MAAM,CAAC,aAAa,CAAC,KAAa;QACxC,MAAM,SAAS,GAAG,IAAA,0BAAe,EAAC,IAAA,oCAAoB,EAAC,KAAK,CAAC,CAAC,CAAC;QAC/D,IAAI,SAAS,KAAK,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wBAAa,CAAC,QAAQ,CAAC,YAAY,CAAC;SAC5C,CAAC;SAKG;QAEN;;;;;;;;;;;WAWG;QACH,MAAM,IAAI,GAAG,IAAA,yCAA8B,GAGxC,CAAC,QAAQ,CAAC,CAAC;QAMd,OAAO,IAAI,CAAC;IACb,CAAC;IA7de,0BAAY,eA6d3B,CAAA;IA4DD;;;;OAIG;IACU,4BAAc,GAAG,IAAA,6BAAkB,GAAmC,CAClF,kBAAkB,CAClB,CAAC;AAqPH,CAAC,EA1yBgB,aAAa,6BAAb,aAAa,QA0yB7B","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\teraseSchemaDetails,\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 {\n\tbrand,\n\tmapIterable,\n\toneFromIterable,\n\tvalidateIndex,\n\tvalidateIndexRange,\n} from \"../util/index.js\";\n\nimport {\n\tcharactersFromString,\n\texpensiveInternalValidationAssert,\n\tprocessCharactersChangedDelta,\n\ttype PlainText,\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 * Atom in the string containing a single character.\n * @privateRemarks\n * This is outside the namespace so it can be exported for testing, but not package exported.\n */\nexport class StringTextAtomNode\n\textends sfStatic.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 * Longer strings are still valid. For example, 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\timplements FormattedText.TextAtom\n{\n\tpublic static fromCharacter(value: string): StringTextAtomNode {\n\t\tconst character = oneFromIterable(charactersFromString(value));\n\t\tif (character === undefined) {\n\t\t\tthrow new UsageError(\"value must contain exactly one Unicode character.\");\n\t\t}\n\t\treturn new StringTextAtomNode({ content: character });\n\t}\n\n\tpublic static fromString(value: string): StringTextAtomNode[] {\n\t\treturn Array.from(\n\t\t\tcharactersFromString(value),\n\t\t\t(character) => new StringTextAtomNode({ content: character }),\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 *\n * @remarks\n * This is generic over formatting an embedded object/atom types.\n *\n * @privateRemarks\n * See {@link FormattedTextDefault} for an example parameterization.\n *\n * TODO:\n * - Add more comprehensive tests for generic parameterizations other than default.\n * - Sort out API around overwriting subsets of formatting information.\n * @alpha\n */\nexport namespace FormattedText {\n\t/**\n\t * Creates a schema for a formatted text node, parameterized by the formatting and the embedded object (atom) types.\n\t *\n\t * @param inputSchemaFactory - The {@link SchemaFactoryBeta} used to scope the generated schema.\n\t * The generated types are scoped under `com.fluidframework.text.formatted<TUserScope>`, where `TUserScope` is the scope of this factory.\n\t * This scope is used to distinguish different usages of `createSchema` from each-other, and must be kept the same between versions for nodes to remain compatible.\n\t * It must be different to distinguish different formatted text schema within the same document.\n\t * @param formatSchema - Schema describing the formatting associated with each atom of text.\n\t * Use an {@link NodeKind.Object|Object node} to support {@link FormattedText.Members.formatRange}.\n\t * @param extraAtoms - Additional atom schema to allow as text content beyond the built-in {@link FormattedText.(StringTextAtom:variable)}.\n\t * Use this to embed richer content (for example line breaks or inline objects) alongside plain characters.\n\t * @param defaultFormatInsertable - The formatting applied to text inserted via non-formatted APIs\n\t * (for example {@link FormattedText.Members.insertAt} and {@link FormattedText.Statics.fromString} when no explicit format is provided).\n\t * @returns The schema for the formatted text node, whose nodes implement {@link FormattedText.Members} and whose statics implement {@link FormattedText.Statics}.\n\t *\n\t * @privateRemarks\n\t * See {@link FormattedTextDefault} for an example parameterization of this factory.\n\t *\n\t * TODO: The choice to always include the built-in {@link FormattedText.(StringTextAtom:variable)} is a design decision that should be re-evaluated before stabilizing.\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\t\t/**\n\t\t * The type of a text atom node, which goes in a StringAtom.\n\t\t */\n\t\ttype TextAtomNode = TreeNodeFromImplicitAllowedTypes<TextAtomSchemas<ExtraAtomsSchema>>;\n\n\t\tconst sf = createFormattedScopedFactory(inputSchemaFactory);\n\n\t\tconst defaultFormat: TreeFieldFromImplicitField<FormatSchema> =\n\t\t\tTreeBeta.create<FormatSchema>(formatSchema, defaultFormatInsertable);\n\n\t\t/**\n\t\t * Gets a format node, which must be cloned before being inserted.\n\t\t */\n\t\tfunction getFormatNode(\n\t\t\tformat?: InsertableTreeFieldFromImplicitField<FormatSchema>,\n\t\t): TreeFieldFromImplicitField<FormatSchema> {\n\t\t\t// Note we cannot use the `format ?? defaultFormat` syntax as format is allowed to be `null`.\n\t\t\treturn format === undefined\n\t\t\t\t? defaultFormat\n\t\t\t\t: TreeBeta.create<FormatSchema>(formatSchema, format);\n\t\t}\n\n\t\tfunction cloneFormat(\n\t\t\tformat: TreeFieldFromImplicitField<FormatSchema>,\n\t\t): TreeFieldFromImplicitField<FormatSchema> &\n\t\t\tTreeNodeFromImplicitAllowedTypes<FormatSchema> {\n\t\t\tconst clone: TreeFieldFromImplicitField<FormatSchema> =\n\t\t\t\tTreeBeta.clone<FormatSchema>(format);\n\t\t\t// TypeScript fails to prove that cloning a node gives a node, and not possible undefined (like cloning a empty field could).\n\t\t\t// This cast helps users of this function get the types they need.\n\t\t\treturn clone as typeof clone & TreeNodeFromImplicitAllowedTypes<FormatSchema>;\n\t\t}\n\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 Members<FormatSchema, ExtraAtomsSchema>\n\t\t{\n\t\t\tpublic insertAt(\n\t\t\t\tindex: number,\n\t\t\t\tadditionalCharacters:\n\t\t\t\t\t| string\n\t\t\t\t\t| Iterable<TreeNodeFromImplicitAllowedTypes<TextAtomSchemas<ExtraAtomsSchema>>>,\n\t\t\t\tformat?: InsertableTreeFieldFromImplicitField<FormatSchema>,\n\t\t\t): void {\n\t\t\t\tconst newAtoms: Iterable<TextAtomNode> =\n\t\t\t\t\ttypeof additionalCharacters === \"string\"\n\t\t\t\t\t\t? stringTextAtomsFromString(additionalCharacters)\n\t\t\t\t\t\t: additionalCharacters;\n\t\t\t\tconst formatNode = getFormatNode(format);\n\t\t\t\tthis.content.insertAt(\n\t\t\t\t\tindex,\n\t\t\t\t\tTreeArrayNode.spread(stringAtomsFromTextAtoms(newAtoms, formatNode)),\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\texpensiveInternalValidationAssert(\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\texpensiveInternalValidationAssert(\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\t#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\t#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?: InsertableTreeFieldFromImplicitField<FormatSchema>,\n\t\t\t): TextNode {\n\t\t\t\tconst formatNode = getFormatNode(format);\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(value, formatNode),\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 fieldFormatsRaw = Object.entries(format) as [\n\t\t\t\t\tkeyof TreeNodeFromImplicitAllowedTypes<FormatSchema>,\n\t\t\t\t\tunknown,\n\t\t\t\t][];\n\t\t\t\tconst fieldFormats = fieldFormatsRaw.map(([key, value]) => {\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\treturn [key, value] as const;\n\t\t\t\t});\n\t\t\t\tthis.#editRange(start, end, \"FormattedText.formatRange\", (atom) => {\n\t\t\t\t\tconst formatNode: TreeNode | TreeValue = atom.format;\n\t\t\t\t\tconst atomFormatSchema = TreeStatic.schema(formatNode);\n\t\t\t\t\tif (!isObjectNodeSchema(atomFormatSchema)) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\"formatRange currently only supports object nodes for the format.\",\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tfor (const [key, value] of fieldFormats) {\n\t\t\t\t\t\tconst field = atomFormatSchema.fields.get(key);\n\t\t\t\t\t\tif (field === undefined) {\n\t\t\t\t\t\t\tthrow new UsageError(`Unknown format key: ${key}`);\n\t\t\t\t\t\t}\n\n\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// Note that since this uses field schema, `undefined` can pass through this if allowed by the schema.\n\t\t\t\t\t\tconst clonedValue = TreeBeta.clone(TreeBeta.create(field, value as never)) as\n\t\t\t\t\t\t\t| TreeNode\n\t\t\t\t\t\t\t| TreeValue;\n\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tformatNode as unknown as Record<\n\t\t\t\t\t\t\t\tkeyof TreeNodeFromImplicitAllowedTypes<FormatSchema>,\n\t\t\t\t\t\t\t\tTreeNode | TreeValue\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t)[key] = clonedValue;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tpublic reformat(\n\t\t\t\tstart: number | undefined,\n\t\t\t\tend: number | undefined,\n\t\t\t\tformat?: InsertableTreeFieldFromImplicitField<FormatSchema>,\n\t\t\t): void {\n\t\t\t\tconst node = getFormatNode(format);\n\t\t\t\tthis.#editRange(start, end, \"FormattedText.reformat\", (atom) => {\n\t\t\t\t\tatom.format = cloneFormat(node);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Map an edit over a range of atoms, validating the range and running the edits in a transaction.\n\t\t\t * @remarks\n\t\t\t * This is not exposed in the API since this approach will have to be replaced when formatting is optimized,\n\t\t\t * so we don't want users to directly depend on this un-optimizable layer.\n\t\t\t */\n\t\t\t#editRange(\n\t\t\t\tstart: number | undefined,\n\t\t\t\tend: number | undefined,\n\t\t\t\tmethod: string,\n\t\t\t\tedit: (atom: StringAtom) => void,\n\t\t\t): void {\n\t\t\t\tconst formatStart = start ?? 0;\n\t\t\t\tvalidateIndex(formatStart, this.content, method, true);\n\n\t\t\t\tconst formatEnd = Math.min(this.content.length, end ?? this.content.length);\n\t\t\t\tvalidateIndexRange(formatStart, formatEnd, this.content, method);\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\tedit(atom);\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 FormattedText.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 PlainText.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 PlainText.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 stringTextAtomsFromString(\n\t\t\tvalue: string,\n\t\t): Iterable<StringTextAtom & TextAtomNode> {\n\t\t\t// TypeScript can't prove in this Generic context that StringTextAtom is assignable to TextAtomNode, so we have to cast.\n\t\t\t// Since TextAtomSchemas unconditionally includes StringTextAtom, this cast is safe.\n\t\t\treturn StringTextAtom.fromString(value) as (StringTextAtom & TextAtomNode)[];\n\t\t}\n\n\t\tfunction stringAtomsFromTextAtoms(\n\t\t\tvalue: Iterable<TreeNodeFromImplicitAllowedTypes<TextAtomSchemas<ExtraAtomsSchema>>>,\n\t\t\tformat: TreeFieldFromImplicitField<FormatSchema>,\n\t\t): Iterable<StringAtom> {\n\t\t\tconst result = mapIterable(value, (content) => {\n\t\t\t\tconst data = {\n\t\t\t\t\tcontent,\n\t\t\t\t\tformat: cloneFormat(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\tfunction textAtomsFromString(\n\t\t\tvalue: string,\n\t\t\tformat: TreeFieldFromImplicitField<FormatSchema>,\n\t\t): Iterable<StringAtom> {\n\t\t\tconst textAtoms = stringTextAtomsFromString(value);\n\t\t\treturn stringAtomsFromTextAtoms(textAtoms, format);\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 FormattedText.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, \"FormattedText.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, \"FormattedText.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 FormattedText.Members} for the API.\n\t\t * See {@link FormattedText.Statics} for static APIs on this Schema, including construction.\n\t\t * @privateRemarks\n\t\t * eraseSchemaDetailsSubclassable risks user's defining subclass members which collide with internals.\n\t\t * Ideally we would generate private members for non-public properties, but TypeScript does not support this.\n\t\t * It is up to the user of eraseSchemaDetailsSubclassable to manage this risk.\n\t\t *\n\t\t * TODO: there is at least one collision prone member to worry about here: `content`.\n\t\t */\n\t\tconst Tree = eraseSchemaDetailsSubclassable<\n\t\t\tMembers<FormatSchema, ExtraAtomsSchema>,\n\t\t\tStatics<Tree, FormatSchema>\n\t\t>()(TextNode);\n\t\ttype Tree = ErasedNode<\n\t\t\tMembers<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 * @privateRemarks\n\t * This is implemented {@link StringAtom}, but we avoid leaking the fact this is a TreeNode in the API surface to\n\t * preserve more future flexibility.\n\t * @sealed\n\t * @alpha\n\t */\n\texport interface FormattedAtom<TFormat, TText> {\n\t\t/**\n\t\t * Content which is formatted.\n\t\t */\n\t\treadonly content: TText;\n\t\t/**\n\t\t * Formatting which is applied to the content.\n\t\t * @remarks\n\t\t * Can be reassigned or deeply mutated to edit the formatting of the content.\n\t\t */\n\t\tformat: TFormat;\n\t}\n\n\t/**\n\t * Portion of a string.\n\t * @remarks\n\t * Additional kinds of text atoms (also known as embedded objects) which can occur inside a string can implement this.\n\t * The schema for them can then be provided to {@link FormattedText.createSchema}.\n\t * @alpha\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 * Static factory functions for {@link FormattedText.(StringTextAtom:variable)}.\n\t * @privateRemarks\n\t * We type-erase `StringTextAtom` and only provide these static factories for construction\n\t * to reduce the chance of someone accidentally creating a text atom for a string other than a single unicode code point.\n\t * Other strings should work, but our intention is to provide no type-safe API which can produce them, so an application can take their lack of existence as an invariant if they want.\n\t * It is still however possible to produce them, like export/import round trips with editing in the middle of the process, or collaboration with an equivalent schema which doesn't enforce this invariant.\n\t * @sealed\n\t * @alpha\n\t */\n\texport interface StringTextAtomStatics {\n\t\t/**\n\t\t * Creates an atom from exactly one Unicode code point.\n\t\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if `value` does not contain exactly one Unicode code character.\n\t\t */\n\t\tfromCharacter(value: string): StringTextAtom;\n\n\t\t/**\n\t\t * Creates one atom for each Unicode code point in `value`.\n\t\t */\n\t\tfromString(value: string): StringTextAtom[];\n\t}\n\n\t/**\n\t * Schema for a {@link FormattedText.(StringTextAtom:variable)} node.\n\t * @sealed\n\t * @alpha\n\t */\n\texport const StringTextAtom = eraseSchemaDetails<TextAtom, StringTextAtomStatics>()(\n\t\tStringTextAtomNode,\n\t);\n\n\t/**\n\t * Node for the {@link FormattedText.(StringTextAtom:variable)} schema.\n\t * @sealed\n\t * @alpha\n\t */\n\texport type StringTextAtom = ErasedNode<\n\t\tTextAtom,\n\t\t\"com.fluidframework.text.formatted.StringTextAtom\"\n\t>;\n\n\t/**\n\t * Statics for formatted text nodes.\n\t * @sealed\n\t * @alpha\n\t */\n\texport interface Statics<TTree, FormatSchema extends ImplicitAllowedTypes> {\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(\n\t\t\tvalue: string,\n\t\t\tformat?: InsertableTreeFieldFromImplicitField<FormatSchema>,\n\t\t): 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 FormattedText.Statics.fromString} for construction.\n\t * @see {@link FormattedText.createSchema} for creating schemas whose nodes implement this.\n\t * @sealed\n\t * @alpha\n\t */\n\texport interface Members<\n\t\tFormatSchema extends ImplicitAllowedTypes,\n\t\tExtraAtomsSchema extends readonly LazyItem<\n\t\t\tTreeNodeSchema<string, NodeKind, TextAtom & TreeNode>\n\t\t>[],\n\t> extends PlainText.Members {\n\t\t/**\n\t\t * {@link PlainText.Members.insertAt} with optional formatting to apply to all additional characters,\n\t\t * and allowing an array of atoms instead of a string.\n\t\t * @param format - Optional formatting to apply to all additional characters. If not specified, the default formatting (from {@link FormattedText.createSchema}) will be used.\n\t\t * @remarks\n\t\t * Use {@link FormattedText.Members.insertWithFormattingAt} if you need to specify formatting for atom independently.\n\t\t * @override\n\t\t */\n\t\tinsertAt(\n\t\t\tindex: number,\n\t\t\tadditionalCharacters:\n\t\t\t\t| string\n\t\t\t\t| Iterable<TreeNodeFromImplicitAllowedTypes<TextAtomSchemas<ExtraAtomsSchema>>>,\n\t\t\tformat?: InsertableTreeFieldFromImplicitField<FormatSchema>,\n\t\t): void;\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 *\n\t\t * For more efficient access, use {@link FormattedText.Members.getUniformRun} and {@link FormattedText.Members.getString} to access ranges of characters\n\t\t * to avoid having to inspect the formatting on every atom.\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 FormattedAtom<\n\t\t\tTreeNodeFromImplicitAllowedTypes<FormatSchema>,\n\t\t\tTreeNodeFromImplicitAllowedTypes<TextAtomSchemas<ExtraAtomsSchema>>\n\t\t>[];\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 FormattedText.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<\n\t\t\t\tFormattedAtomInsertable<\n\t\t\t\t\tInsertableTreeNodeFromImplicitAllowedTypes<FormatSchema>,\n\t\t\t\t\tInsertableTreeNodeFromImplicitAllowedTypes<TextAtomSchemas<ExtraAtomsSchema>>\n\t\t\t\t>\n\t\t\t>,\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 * For each atom, every property of `format` will be cloned and assigned to the atom's format's corresponding subtree, overwriting any existing values for those properties.\n\t\t * All enumerable own properties of `format` will be applied, including those with `undefined` values.\n\t\t * @remarks\n\t\t * The start and end behave the same as in {@link (TreeArrayNode:interface).removeRange}.\n\t\t * This edits existing formatting subtrees on each atom, and only works when those atoms are object nodes.\n\t\t *\n\t\t * This is typically used to set some formatting property, like `bold` on a range of text without impacting other formatting properties.\n\t\t * @privateRemarks\n\t\t * This API is designed such that it can be optimized and improved in the future in a few different ways:\n\t\t * 1. TODO: It can be optimized to use lower level APIs directly, bypassing the overhead of the public API surface.\n\t\t * 2. TODO: A lower level editing API could be introduced and used to more efficiently express the edit (for example a bulk edit based on path, or a way to reuse the inserted content in multiple places instead of having to clone it before making the edit).\n\t\t * 3. TODO: Optimize the encoding of such edits, either with a dedicated format for range edits like this and/or encoding optimizations that can compress such edits over ranges to O(1) space.\n\t\t * 4. TODO: Preserve the range editing semantics through the whole stack to allow for better merge behavior, and make optimizations easier.\n\t\t */\n\t\tformatRange(\n\t\t\tstartIndex: number | undefined,\n\t\t\tendIndex: number | undefined,\n\t\t\tformat: Partial<TreeNodeFromImplicitAllowedTypes<FormatSchema>>,\n\t\t): void;\n\n\t\t/**\n\t\t * Replace formatting of 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 replace the formatting of the indicated range with.\n\t\t * For each atom, `format` will be cloned and assigned to the atom's format, overwriting any existing formatting.\n\t\t * If not specified the `defaultFormat` from {@link FormattedText.createSchema} will be used.\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\t * This is typically used to normalize formatting, like resetting the formatting of a range to default settings.\n\t\t * @privateRemarks\n\t\t * See notes on {@link FormattedText.Members.formatRange} for future optimization opportunities.\n\t\t */\n\t\treformat(\n\t\t\tstartIndex?: number | undefined,\n\t\t\tendIndex?: number | undefined,\n\t\t\tformat?: InsertableTreeFieldFromImplicitField<FormatSchema>,\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 PlainText.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 PlainText.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 PlainText.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 PlainText.TextOp[] | undefined) => void,\n\t\t): () => void;\n\t}\n\n\t/**\n\t * Insertable shape for a formatted text atom used by {@link FormattedText.Members.insertWithFormattingAt}.\n\t * @input\n\t * @alpha\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 * @alpha\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 text atoms for a given schema.\n\t * @remarks\n\t * This is just schema for the text atom {@link AllowedTypes},\n\t * and does not include the actual formatting (which is higher up in the tree).\n\t * @sealed\n\t * @alpha\n\t */\n\texport type TextAtomSchemas<\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 * A generic type for a formatted text schema.\n\t * @sealed\n\t * @alpha\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\tMembers<FormatSchema, ExtraAtomsSchema>,\n\t\t\tFormattedTextSchemaIdentifier<TUserScope>\n\t\t>,\n\t\tFormatSchema\n\t> &\n\t\tErasedSchemaSubclassable<\n\t\t\tMembers<FormatSchema, ExtraAtomsSchema>,\n\t\t\tFormattedTextSchemaIdentifier<TUserScope>\n\t\t>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"textDomainFormatted.js","sourceRoot":"","sources":["../../src/text/textDomainFormatted.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA+F;AAC/F,uEAAsE;AAEtE,+CAM0B;AAC1B,4DAAqF;AACrF,sDAAkF;AAClF,sDAUiC;AAkBjC,+CAM0B;AAE1B,mDAKyB;AAEzB;;;GAGG;AACH,2HAA2H;AAC3H,SAAS,4BAA4B,CACpC,kBAAiD;IAEjD,OAAO,IAAA,sDAA2C,EAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;AAC1F,CAAC;AAED;;GAEG;AACH,MAAM,QAAQ,GAAG,IAAI,6BAAkB,CAAC,mCAAmC,CAAC,CAAC;AAE7E,MAAM,SAAS,GAAa,IAAA,gBAAK,EAAC,QAAQ,CAAC,CAAC;AAE5C;;;;GAIG;AACH,MAAa,kBACZ,SAAQ,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE;IACzC;;;;;;;;;;OAUG;IACH,OAAO,EAAE,wBAAa,CAAC,QAAQ,CAAC,CAAC,wBAAa,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,mBAAQ,EAAE,CAAC;CAC1E,CAAC;IAGK,MAAM,CAAC,aAAa,CAAC,KAAa;QACxC,MAAM,SAAS,GAAG,IAAA,0BAAe,EAAC,IAAA,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H,MAAM,UACL,SAAQ,EAAE,CAAC,MAAM,CAAC,YAAY,EAAE;YAC/B,OAAO,EAAE,wBAAa,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,mBAAQ,EAAE,CAAC;YACzD,MAAM,EAAE,wBAAa,CAAC,QAAQ,CAAC,YAAY,CAAC;SAC5C,CAAC;SAKG;QAEN;;;;;;;;;;;WAWG;QACH,MAAM,IAAI,GAAG,IAAA,yCAA8B,GAGxC,CAAC,QAAQ,CAAC,CAAC;QAMd,OAAO,IAAI,CAAC;IACb,CAAC;IAjee,0BAAY,eAie3B,CAAA;IA4DD;;;;OAIG;IACU,4BAAc,GAAG,IAAA,6BAAkB,GAAmC,CAClF,kBAAkB,CAClB,CAAC;AAqPH,CAAC,EA9yBgB,aAAa,6BAAb,aAAa,QA8yB7B","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, TreeBeta } from \"../shared-tree/index.js\";\nimport {\n\tcreateArrayInsertionAnchor,\n\tgetInnerNode,\n\tSchemaFactory,\n\tSchemaFactoryAlpha,\n\tTreeArrayNode,\n\tcreateCustomizedFluidFrameworkScopedFactory,\n\teraseSchemaDetails,\n\tisObjectNodeSchema,\n\teraseSchemaDetailsSubclassable,\n} from \"../simple-tree/index.js\";\nimport type {\n\tArrayPlaceAnchor,\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 {\n\tbrand,\n\tmapIterable,\n\toneFromIterable,\n\tvalidateIndex,\n\tvalidateIndexRange,\n} from \"../util/index.js\";\n\nimport {\n\tcharactersFromString,\n\texpensiveInternalValidationAssert,\n\tprocessCharactersChangedDelta,\n\ttype PlainText,\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 * Atom in the string containing a single character.\n * @privateRemarks\n * This is outside the namespace so it can be exported for testing, but not package exported.\n */\nexport class StringTextAtomNode\n\textends sfStatic.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 * Longer strings are still valid. For example, 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\timplements FormattedText.TextAtom\n{\n\tpublic static fromCharacter(value: string): StringTextAtomNode {\n\t\tconst character = oneFromIterable(charactersFromString(value));\n\t\tif (character === undefined) {\n\t\t\tthrow new UsageError(\"value must contain exactly one Unicode character.\");\n\t\t}\n\t\treturn new StringTextAtomNode({ content: character });\n\t}\n\n\tpublic static fromString(value: string): StringTextAtomNode[] {\n\t\treturn Array.from(\n\t\t\tcharactersFromString(value),\n\t\t\t(character) => new StringTextAtomNode({ content: character }),\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 *\n * @remarks\n * This is generic over formatting an embedded object/atom types.\n *\n * @privateRemarks\n * See {@link FormattedTextDefault} for an example parameterization.\n *\n * TODO:\n * - Add more comprehensive tests for generic parameterizations other than default.\n * - Sort out API around overwriting subsets of formatting information.\n * @alpha\n */\nexport namespace FormattedText {\n\t/**\n\t * Creates a schema for a formatted text node, parameterized by the formatting and the embedded object (atom) types.\n\t *\n\t * @param inputSchemaFactory - The {@link SchemaFactoryBeta} used to scope the generated schema.\n\t * The generated types are scoped under `com.fluidframework.text.formatted<TUserScope>`, where `TUserScope` is the scope of this factory.\n\t * This scope is used to distinguish different usages of `createSchema` from each-other, and must be kept the same between versions for nodes to remain compatible.\n\t * It must be different to distinguish different formatted text schema within the same document.\n\t * @param formatSchema - Schema describing the formatting associated with each atom of text.\n\t * Use an {@link NodeKind.Object|Object node} to support {@link FormattedText.Members.formatRange}.\n\t * @param extraAtoms - Additional atom schema to allow as text content beyond the built-in {@link FormattedText.(StringTextAtom:variable)}.\n\t * Use this to embed richer content (for example line breaks or inline objects) alongside plain characters.\n\t * @param defaultFormatInsertable - The formatting applied to text inserted via non-formatted APIs\n\t * (for example {@link FormattedText.Members.insertAt} and {@link FormattedText.Statics.fromString} when no explicit format is provided).\n\t * @returns The schema for the formatted text node, whose nodes implement {@link FormattedText.Members} and whose statics implement {@link FormattedText.Statics}.\n\t *\n\t * @privateRemarks\n\t * See {@link FormattedTextDefault} for an example parameterization of this factory.\n\t *\n\t * TODO: The choice to always include the built-in {@link FormattedText.(StringTextAtom:variable)} is a design decision that should be re-evaluated before stabilizing.\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\t\t/**\n\t\t * The type of a text atom node, which goes in a StringAtom.\n\t\t */\n\t\ttype TextAtomNode = TreeNodeFromImplicitAllowedTypes<TextAtomSchemas<ExtraAtomsSchema>>;\n\n\t\tconst sf = createFormattedScopedFactory(inputSchemaFactory);\n\n\t\tconst defaultFormat: TreeFieldFromImplicitField<FormatSchema> =\n\t\t\tTreeBeta.create<FormatSchema>(formatSchema, defaultFormatInsertable);\n\n\t\t/**\n\t\t * Gets a format node, which must be cloned before being inserted.\n\t\t */\n\t\tfunction getFormatNode(\n\t\t\tformat?: InsertableTreeFieldFromImplicitField<FormatSchema>,\n\t\t): TreeFieldFromImplicitField<FormatSchema> {\n\t\t\t// Note we cannot use the `format ?? defaultFormat` syntax as format is allowed to be `null`.\n\t\t\treturn format === undefined\n\t\t\t\t? defaultFormat\n\t\t\t\t: TreeBeta.create<FormatSchema>(formatSchema, format);\n\t\t}\n\n\t\tfunction cloneFormat(\n\t\t\tformat: TreeFieldFromImplicitField<FormatSchema>,\n\t\t): TreeFieldFromImplicitField<FormatSchema> &\n\t\t\tTreeNodeFromImplicitAllowedTypes<FormatSchema> {\n\t\t\tconst clone: TreeFieldFromImplicitField<FormatSchema> =\n\t\t\t\tTreeBeta.clone<FormatSchema>(format);\n\t\t\t// TypeScript fails to prove that cloning a node gives a node, and not possible undefined (like cloning a empty field could).\n\t\t\t// This cast helps users of this function get the types they need.\n\t\t\treturn clone as typeof clone & TreeNodeFromImplicitAllowedTypes<FormatSchema>;\n\t\t}\n\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 Members<FormatSchema, ExtraAtomsSchema>\n\t\t{\n\t\t\tpublic insertAt(\n\t\t\t\tindex: number,\n\t\t\t\tadditionalCharacters:\n\t\t\t\t\t| string\n\t\t\t\t\t| Iterable<TreeNodeFromImplicitAllowedTypes<TextAtomSchemas<ExtraAtomsSchema>>>,\n\t\t\t\tformat?: InsertableTreeFieldFromImplicitField<FormatSchema>,\n\t\t\t): void {\n\t\t\t\tconst newAtoms: Iterable<TextAtomNode> =\n\t\t\t\t\ttypeof additionalCharacters === \"string\"\n\t\t\t\t\t\t? stringTextAtomsFromString(additionalCharacters)\n\t\t\t\t\t\t: additionalCharacters;\n\t\t\t\tconst formatNode = getFormatNode(format);\n\t\t\t\tthis.content.insertAt(\n\t\t\t\t\tindex,\n\t\t\t\t\tTreeArrayNode.spread(stringAtomsFromTextAtoms(newAtoms, formatNode)),\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\texpensiveInternalValidationAssert(\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\texpensiveInternalValidationAssert(\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\t#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\t#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?: InsertableTreeFieldFromImplicitField<FormatSchema>,\n\t\t\t): TextNode {\n\t\t\t\tconst formatNode = getFormatNode(format);\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(value, formatNode),\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 fieldFormatsRaw = Object.entries(format) as [\n\t\t\t\t\tkeyof TreeNodeFromImplicitAllowedTypes<FormatSchema>,\n\t\t\t\t\tunknown,\n\t\t\t\t][];\n\t\t\t\tconst fieldFormats = fieldFormatsRaw.map(([key, value]) => {\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\treturn [key, value] as const;\n\t\t\t\t});\n\t\t\t\tthis.#editRange(start, end, \"FormattedText.formatRange\", (atom) => {\n\t\t\t\t\tconst formatNode: TreeNode | TreeValue = atom.format;\n\t\t\t\t\tconst atomFormatSchema = TreeStatic.schema(formatNode);\n\t\t\t\t\tif (!isObjectNodeSchema(atomFormatSchema)) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\"formatRange currently only supports object nodes for the format.\",\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tfor (const [key, value] of fieldFormats) {\n\t\t\t\t\t\tconst field = atomFormatSchema.fields.get(key);\n\t\t\t\t\t\tif (field === undefined) {\n\t\t\t\t\t\t\tthrow new UsageError(`Unknown format key: ${key}`);\n\t\t\t\t\t\t}\n\n\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// Note that since this uses field schema, `undefined` can pass through this if allowed by the schema.\n\t\t\t\t\t\tconst clonedValue = TreeBeta.clone(TreeBeta.create(field, value as never)) as\n\t\t\t\t\t\t\t| TreeNode\n\t\t\t\t\t\t\t| TreeValue;\n\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tformatNode as unknown as Record<\n\t\t\t\t\t\t\t\tkeyof TreeNodeFromImplicitAllowedTypes<FormatSchema>,\n\t\t\t\t\t\t\t\tTreeNode | TreeValue\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t)[key] = clonedValue;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tpublic reformat(\n\t\t\t\tstart: number | undefined,\n\t\t\t\tend: number | undefined,\n\t\t\t\tformat?: InsertableTreeFieldFromImplicitField<FormatSchema>,\n\t\t\t): void {\n\t\t\t\tconst node = getFormatNode(format);\n\t\t\t\tthis.#editRange(start, end, \"FormattedText.reformat\", (atom) => {\n\t\t\t\t\tatom.format = cloneFormat(node);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Map an edit over a range of atoms, validating the range and running the edits in a transaction.\n\t\t\t * @remarks\n\t\t\t * This is not exposed in the API since this approach will have to be replaced when formatting is optimized,\n\t\t\t * so we don't want users to directly depend on this un-optimizable layer.\n\t\t\t */\n\t\t\t#editRange(\n\t\t\t\tstart: number | undefined,\n\t\t\t\tend: number | undefined,\n\t\t\t\tmethod: string,\n\t\t\t\tedit: (atom: StringAtom) => void,\n\t\t\t): void {\n\t\t\t\tconst formatStart = start ?? 0;\n\t\t\t\tvalidateIndex(formatStart, this.content, method, true);\n\n\t\t\t\tconst formatEnd = Math.min(this.content.length, end ?? this.content.length);\n\t\t\t\tvalidateIndexRange(formatStart, formatEnd, this.content, method);\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\tedit(atom);\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 FormattedText.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 PlainText.TextOp[] | undefined) => void,\n\t\t\t): () => void {\n\t\t\t\treturn TreeBeta.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 createInsertionAnchor(index: number): ArrayPlaceAnchor {\n\t\t\t\treturn createArrayInsertionAnchor(this.content, index);\n\t\t\t}\n\n\t\t\tpublic onContentChanged(\n\t\t\t\tcallback: (ops: readonly PlainText.TextOp[] | undefined) => void,\n\t\t\t): () => void {\n\t\t\t\treturn TreeBeta.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 stringTextAtomsFromString(\n\t\t\tvalue: string,\n\t\t): Iterable<StringTextAtom & TextAtomNode> {\n\t\t\t// TypeScript can't prove in this Generic context that StringTextAtom is assignable to TextAtomNode, so we have to cast.\n\t\t\t// Since TextAtomSchemas unconditionally includes StringTextAtom, this cast is safe.\n\t\t\treturn StringTextAtom.fromString(value) as (StringTextAtom & TextAtomNode)[];\n\t\t}\n\n\t\tfunction stringAtomsFromTextAtoms(\n\t\t\tvalue: Iterable<TreeNodeFromImplicitAllowedTypes<TextAtomSchemas<ExtraAtomsSchema>>>,\n\t\t\tformat: TreeFieldFromImplicitField<FormatSchema>,\n\t\t): Iterable<StringAtom> {\n\t\t\tconst result = mapIterable(value, (content) => {\n\t\t\t\tconst data = {\n\t\t\t\t\tcontent,\n\t\t\t\t\tformat: cloneFormat(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\tfunction textAtomsFromString(\n\t\t\tvalue: string,\n\t\t\tformat: TreeFieldFromImplicitField<FormatSchema>,\n\t\t): Iterable<StringAtom> {\n\t\t\tconst textAtoms = stringTextAtomsFromString(value);\n\t\t\treturn stringAtomsFromTextAtoms(textAtoms, format);\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 FormattedText.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, \"FormattedText.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, \"FormattedText.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 FormattedText.Members} for the API.\n\t\t * See {@link FormattedText.Statics} for static APIs on this Schema, including construction.\n\t\t * @privateRemarks\n\t\t * eraseSchemaDetailsSubclassable risks user's defining subclass members which collide with internals.\n\t\t * Ideally we would generate private members for non-public properties, but TypeScript does not support this.\n\t\t * It is up to the user of eraseSchemaDetailsSubclassable to manage this risk.\n\t\t *\n\t\t * TODO: there is at least one collision prone member to worry about here: `content`.\n\t\t */\n\t\tconst Tree = eraseSchemaDetailsSubclassable<\n\t\t\tMembers<FormatSchema, ExtraAtomsSchema>,\n\t\t\tStatics<Tree, FormatSchema>\n\t\t>()(TextNode);\n\t\ttype Tree = ErasedNode<\n\t\t\tMembers<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 * @privateRemarks\n\t * This is implemented {@link StringAtom}, but we avoid leaking the fact this is a TreeNode in the API surface to\n\t * preserve more future flexibility.\n\t * @sealed\n\t * @alpha\n\t */\n\texport interface FormattedAtom<TFormat, TText> {\n\t\t/**\n\t\t * Content which is formatted.\n\t\t */\n\t\treadonly content: TText;\n\t\t/**\n\t\t * Formatting which is applied to the content.\n\t\t * @remarks\n\t\t * Can be reassigned or deeply mutated to edit the formatting of the content.\n\t\t */\n\t\tformat: TFormat;\n\t}\n\n\t/**\n\t * Portion of a string.\n\t * @remarks\n\t * Additional kinds of text atoms (also known as embedded objects) which can occur inside a string can implement this.\n\t * The schema for them can then be provided to {@link FormattedText.createSchema}.\n\t * @alpha\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 * Static factory functions for {@link FormattedText.(StringTextAtom:variable)}.\n\t * @privateRemarks\n\t * We type-erase `StringTextAtom` and only provide these static factories for construction\n\t * to reduce the chance of someone accidentally creating a text atom for a string other than a single unicode code point.\n\t * Other strings should work, but our intention is to provide no type-safe API which can produce them, so an application can take their lack of existence as an invariant if they want.\n\t * It is still however possible to produce them, like export/import round trips with editing in the middle of the process, or collaboration with an equivalent schema which doesn't enforce this invariant.\n\t * @sealed\n\t * @alpha\n\t */\n\texport interface StringTextAtomStatics {\n\t\t/**\n\t\t * Creates an atom from exactly one Unicode code point.\n\t\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if `value` does not contain exactly one Unicode code character.\n\t\t */\n\t\tfromCharacter(value: string): StringTextAtom;\n\n\t\t/**\n\t\t * Creates one atom for each Unicode code point in `value`.\n\t\t */\n\t\tfromString(value: string): StringTextAtom[];\n\t}\n\n\t/**\n\t * Schema for a {@link FormattedText.(StringTextAtom:variable)} node.\n\t * @sealed\n\t * @alpha\n\t */\n\texport const StringTextAtom = eraseSchemaDetails<TextAtom, StringTextAtomStatics>()(\n\t\tStringTextAtomNode,\n\t);\n\n\t/**\n\t * Node for the {@link FormattedText.(StringTextAtom:variable)} schema.\n\t * @sealed\n\t * @alpha\n\t */\n\texport type StringTextAtom = ErasedNode<\n\t\tTextAtom,\n\t\t\"com.fluidframework.text.formatted.StringTextAtom\"\n\t>;\n\n\t/**\n\t * Statics for formatted text nodes.\n\t * @sealed\n\t * @alpha\n\t */\n\texport interface Statics<TTree, FormatSchema extends ImplicitAllowedTypes> {\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(\n\t\t\tvalue: string,\n\t\t\tformat?: InsertableTreeFieldFromImplicitField<FormatSchema>,\n\t\t): 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 FormattedText.Statics.fromString} for construction.\n\t * @see {@link FormattedText.createSchema} for creating schemas whose nodes implement this.\n\t * @sealed\n\t * @alpha\n\t */\n\texport interface Members<\n\t\tFormatSchema extends ImplicitAllowedTypes,\n\t\tExtraAtomsSchema extends readonly LazyItem<\n\t\t\tTreeNodeSchema<string, NodeKind, TextAtom & TreeNode>\n\t\t>[],\n\t> extends PlainText.Members {\n\t\t/**\n\t\t * {@link PlainText.Members.insertAt} with optional formatting to apply to all additional characters,\n\t\t * and allowing an array of atoms instead of a string.\n\t\t * @param format - Optional formatting to apply to all additional characters. If not specified, the default formatting (from {@link FormattedText.createSchema}) will be used.\n\t\t * @remarks\n\t\t * Use {@link FormattedText.Members.insertWithFormattingAt} if you need to specify formatting for atom independently.\n\t\t * @override\n\t\t */\n\t\tinsertAt(\n\t\t\tindex: number,\n\t\t\tadditionalCharacters:\n\t\t\t\t| string\n\t\t\t\t| Iterable<TreeNodeFromImplicitAllowedTypes<TextAtomSchemas<ExtraAtomsSchema>>>,\n\t\t\tformat?: InsertableTreeFieldFromImplicitField<FormatSchema>,\n\t\t): void;\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 *\n\t\t * For more efficient access, use {@link FormattedText.Members.getUniformRun} and {@link FormattedText.Members.getString} to access ranges of characters\n\t\t * to avoid having to inspect the formatting on every atom.\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 FormattedAtom<\n\t\t\tTreeNodeFromImplicitAllowedTypes<FormatSchema>,\n\t\t\tTreeNodeFromImplicitAllowedTypes<TextAtomSchemas<ExtraAtomsSchema>>\n\t\t>[];\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 FormattedText.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<\n\t\t\t\tFormattedAtomInsertable<\n\t\t\t\t\tInsertableTreeNodeFromImplicitAllowedTypes<FormatSchema>,\n\t\t\t\t\tInsertableTreeNodeFromImplicitAllowedTypes<TextAtomSchemas<ExtraAtomsSchema>>\n\t\t\t\t>\n\t\t\t>,\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 * For each atom, every property of `format` will be cloned and assigned to the atom's format's corresponding subtree, overwriting any existing values for those properties.\n\t\t * All enumerable own properties of `format` will be applied, including those with `undefined` values.\n\t\t * @remarks\n\t\t * The start and end behave the same as in {@link (TreeArrayNode:interface).removeRange}.\n\t\t * This edits existing formatting subtrees on each atom, and only works when those atoms are object nodes.\n\t\t *\n\t\t * This is typically used to set some formatting property, like `bold` on a range of text without impacting other formatting properties.\n\t\t * @privateRemarks\n\t\t * This API is designed such that it can be optimized and improved in the future in a few different ways:\n\t\t * 1. TODO: It can be optimized to use lower level APIs directly, bypassing the overhead of the public API surface.\n\t\t * 2. TODO: A lower level editing API could be introduced and used to more efficiently express the edit (for example a bulk edit based on path, or a way to reuse the inserted content in multiple places instead of having to clone it before making the edit).\n\t\t * 3. TODO: Optimize the encoding of such edits, either with a dedicated format for range edits like this and/or encoding optimizations that can compress such edits over ranges to O(1) space.\n\t\t * 4. TODO: Preserve the range editing semantics through the whole stack to allow for better merge behavior, and make optimizations easier.\n\t\t */\n\t\tformatRange(\n\t\t\tstartIndex: number | undefined,\n\t\t\tendIndex: number | undefined,\n\t\t\tformat: Partial<TreeNodeFromImplicitAllowedTypes<FormatSchema>>,\n\t\t): void;\n\n\t\t/**\n\t\t * Replace formatting of 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 replace the formatting of the indicated range with.\n\t\t * For each atom, `format` will be cloned and assigned to the atom's format, overwriting any existing formatting.\n\t\t * If not specified the `defaultFormat` from {@link FormattedText.createSchema} will be used.\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\t * This is typically used to normalize formatting, like resetting the formatting of a range to default settings.\n\t\t * @privateRemarks\n\t\t * See notes on {@link FormattedText.Members.formatRange} for future optimization opportunities.\n\t\t */\n\t\treformat(\n\t\t\tstartIndex?: number | undefined,\n\t\t\tendIndex?: number | undefined,\n\t\t\tformat?: InsertableTreeFieldFromImplicitField<FormatSchema>,\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 PlainText.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 PlainText.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 PlainText.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 PlainText.TextOp[] | undefined) => void,\n\t\t): () => void;\n\t}\n\n\t/**\n\t * Insertable shape for a formatted text atom used by {@link FormattedText.Members.insertWithFormattingAt}.\n\t * @input\n\t * @alpha\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 * @alpha\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 text atoms for a given schema.\n\t * @remarks\n\t * This is just schema for the text atom {@link AllowedTypes},\n\t * and does not include the actual formatting (which is higher up in the tree).\n\t * @sealed\n\t * @alpha\n\t */\n\texport type TextAtomSchemas<\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 * A generic type for a formatted text schema.\n\t * @sealed\n\t * @alpha\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\tMembers<FormatSchema, ExtraAtomsSchema>,\n\t\t\tFormattedTextSchemaIdentifier<TUserScope>\n\t\t>,\n\t\tFormatSchema\n\t> &\n\t\tErasedSchemaSubclassable<\n\t\t\tMembers<FormatSchema, ExtraAtomsSchema>,\n\t\t\tFormattedTextSchemaIdentifier<TUserScope>\n\t\t>;\n}\n"]}
|
|
@@ -38,8 +38,8 @@ var FormattedTextDefault;
|
|
|
38
38
|
size: index_js_1.SchemaFactory.number,
|
|
39
39
|
font: index_js_1.SchemaFactory.string,
|
|
40
40
|
}) {
|
|
41
|
+
static defaultFormat = new CharacterFormat(defaultFormat);
|
|
41
42
|
}
|
|
42
|
-
CharacterFormat.defaultFormat = new CharacterFormat(defaultFormat);
|
|
43
43
|
FormattedTextDefault.CharacterFormat = CharacterFormat;
|
|
44
44
|
/**
|
|
45
45
|
* Tag with which a line in text can be formatted from HTML.
|
|
@@ -74,10 +74,7 @@ var FormattedTextDefault;
|
|
|
74
74
|
tag: FormattedTextDefault.LineTag.schema,
|
|
75
75
|
indent: index_js_1.SchemaFactory.number,
|
|
76
76
|
}) {
|
|
77
|
-
|
|
78
|
-
super(...arguments);
|
|
79
|
-
this.content = "\n";
|
|
80
|
-
}
|
|
77
|
+
content = "\n";
|
|
81
78
|
}
|
|
82
79
|
FormattedTextDefault.StringLineAtom = StringLineAtom;
|
|
83
80
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textDomainFormattedDefault.js","sourceRoot":"","sources":["../../src/text/textDomainFormattedDefault.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,sDAA4F;AAM5F,qEAAyD;AAEzD;;GAEG;AACH,MAAM,EAAE,GAAG,IAAI,4BAAiB,CAAC,2CAA2C,CAAC,CAAC;AAE9E,MAAM,aAAa,GAAG;IACrB,IAAI,EAAE,KAAK;IACX,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,KAAK;IAChB,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,OAAO;CACJ,CAAC;AAEX;;;;;GAKG;AACH,IAAiB,oBAAoB,CAqHpC;AArHD,WAAiB,oBAAoB;IAQpC;;;;OAIG;IACH,MAAa,eAAgB,SAAQ,EAAE,CAAC,MAAM,CAAC,iBAAiB,EAAE;QACjE,IAAI,EAAE,wBAAa,CAAC,OAAO;QAC3B,MAAM,EAAE,wBAAa,CAAC,OAAO;QAC7B,SAAS,EAAE,wBAAa,CAAC,OAAO;QAChC,IAAI,EAAE,wBAAa,CAAC,MAAM;QAC1B,IAAI,EAAE,wBAAa,CAAC,MAAM;KAC1B,CAAC
|
|
1
|
+
{"version":3,"file":"textDomainFormattedDefault.js","sourceRoot":"","sources":["../../src/text/textDomainFormattedDefault.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,sDAA4F;AAM5F,qEAAyD;AAEzD;;GAEG;AACH,MAAM,EAAE,GAAG,IAAI,4BAAiB,CAAC,2CAA2C,CAAC,CAAC;AAE9E,MAAM,aAAa,GAAG;IACrB,IAAI,EAAE,KAAK;IACX,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,KAAK;IAChB,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,OAAO;CACJ,CAAC;AAEX;;;;;GAKG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soft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { enumFromStrings, SchemaFactory, SchemaFactoryBeta } from \"../simple-tree/index.js\";\nimport type {\n\tTreeNodeFromImplicitAllowedTypes,\n\tInsertableTreeNodeFromImplicitAllowedTypes,\n} from \"../simple-tree/index.js\";\n\nimport { FormattedText } from \"./textDomainFormatted.js\";\n\n/**\n * Schema factory for default formatted text types which are not generic.\n */\nconst sf = new SchemaFactoryBeta(\"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 default parameterization of the generic {@link FormattedText} with hard-coded assumptions about what kind of embedded content and what kind of formatting is supported.\n * @remarks\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 FormattedText}.\n * @internal\n */\nexport namespace FormattedTextDefault {\n\t/**\n\t * Portion of a string with formatting.\n\t * @sealed\n\t * @internal\n\t */\n\texport type FormattedAtom = FormattedText.FormattedAtom<CharacterFormat, StringAtomContent>;\n\n\t/**\n\t * Formatting options for characters.\n\t * @sealed\n\t * @internal\n\t */\n\texport class CharacterFormat extends sf.object(\"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 FormattedTextDefault.(LineTag:variable)}\n\t * @sealed\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 * @sealed\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 * @sealed\n\t * @internal\n\t */\n\texport const StringAtomContent = [FormattedText.StringTextAtom, StringLineAtom] as const;\n\t/**\n\t * {@inheritdoc FormattedTextDefault.(StringAtomContent:variable)}\n\t * @sealed\n\t * @internal\n\t */\n\texport type StringAtomContent = TreeNodeFromImplicitAllowedTypes<typeof StringAtomContent>;\n\n\t/**\n\t * Statics for text nodes.\n\t * @sealed\n\t * @internal\n\t */\n\texport type Statics<TTree = Tree> = FormattedText.Statics<TTree, typeof CharacterFormat>;\n\n\t/**\n\t * Insertable shape for a formatted text atom used by {@link FormattedText.Members.insertWithFormattingAt}.\n\t * @sealed\n\t * @internal\n\t */\n\texport type FormattedAtomInsertable = FormattedText.FormattedAtom<\n\t\tInsertableTreeNodeFromImplicitAllowedTypes<typeof CharacterFormat>,\n\t\tInsertableTreeNodeFromImplicitAllowedTypes<TextAtomSchemas>\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 * @sealed\n\t * @internal\n\t */\n\texport type TextAtomSchemas = FormattedText.TextAtomSchemas<[typeof StringLineAtom]>;\n\n\t/**\n\t * The schema produced using {@link FormattedText.createSchema} with hard-coded assumptions\n\t * about what kind of embedded content and what kind of formatting is supported.\n\t * @sealed\n\t * @internal\n\t */\n\texport class Tree extends FormattedText.createSchema(\n\t\tsf,\n\t\tCharacterFormat,\n\t\t[StringLineAtom],\n\t\tdefaultFormat,\n\t) {}\n}\n"]}
|
package/dist/treeDataStore.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.defineTreeDataStore = defineTreeDataStore;
|
|
8
|
+
exports.instantiateTreeFirstTime = instantiateTreeFirstTime;
|
|
8
9
|
const internal_1 = require("@fluidframework/shared-object-base/internal");
|
|
9
10
|
const treeFactory_js_1 = require("./treeFactory.js");
|
|
10
11
|
/**
|
|
@@ -33,7 +34,6 @@ function defineTreeDataStore(options) {
|
|
|
33
34
|
});
|
|
34
35
|
return result;
|
|
35
36
|
}
|
|
36
|
-
exports.defineTreeDataStore = defineTreeDataStore;
|
|
37
37
|
/**
|
|
38
38
|
* Simple tree instantiation helper.
|
|
39
39
|
* @remarks
|
|
@@ -46,7 +46,6 @@ async function instantiateTreeFirstTime(rootCreator, creator, treeKind, options)
|
|
|
46
46
|
initializeTreeFirstTime(tree, options, creator);
|
|
47
47
|
return tree;
|
|
48
48
|
}
|
|
49
|
-
exports.instantiateTreeFirstTime = instantiateTreeFirstTime;
|
|
50
49
|
function initializeTreeFirstTime(tree, options, creator) {
|
|
51
50
|
if (options.initializer !== undefined) {
|
|
52
51
|
const view = tree.viewWith(options.config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeDataStore.js","sourceRoot":"","sources":["../src/treeDataStore.ts"],"names":[],"mappings":";AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"treeDataStore.js","sourceRoot":"","sources":["../src/treeDataStore.ts"],"names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GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;QAC9C,IAAI,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport type { DataStoreKind } from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tSharedObjectCreator,\n\tSharedObjectKey,\n\tSharedObjectRegistry,\n\tSharedObjectKindAlpha,\n\tDataStoreOptions,\n} from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tsharedObjectRegistryFromIterable,\n\tdefineDataStore,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport type {\n\tImplicitFieldSchema,\n\tInsertableTreeFieldFromImplicitField,\n\tITree,\n\tTreeView,\n\tTreeViewConfiguration,\n} from \"./simple-tree/index.js\";\nimport { SharedTreeAlpha } from \"./treeFactory.js\";\n\n/**\n * Options for {@link defineTreeDataStore}.\n * @input\n * @alpha\n */\nexport interface TreeDataStoreOptions<TSchema extends ImplicitFieldSchema>\n\textends Pick<DataStoreOptions<never, never>, \"type\"> {\n\t/**\n\t * Configuration for the tree view to be used in this data store.\n\t */\n\treadonly config: TreeViewConfiguration<TSchema>;\n\n\t/**\n\t * If provided, used to initialize the tree content when creating a new instance of the data store.\n\t */\n\treadonly initializer?: (\n\t\tcreator: SharedObjectCreator,\n\t) => InsertableTreeFieldFromImplicitField<TSchema>;\n\n\t/**\n\t * If provided, must include at least a SharedTree kind in the registry.\n\t * @remarks\n\t * {@link configuredSharedTree} can be used to customize the SharedTree kind used in the registry.\n\t */\n\treadonly registry?: Iterable<SharedObjectKindAlpha<IFluidLoadable>> | SharedObjectRegistry;\n\n\treadonly key?: SharedObjectKey<ITree>;\n}\n\n/**\n * Defines a {@link @fluidframework/driver-definitions#DataStoreKind} for a simple tree data store.\n * @remarks\n * This is a simple tree specific wrapper around {@link @fluidframework/shared-object-base#defineDataStore}.\n * Use {@link @fluidframework/shared-object-base#defineDataStore} directly if more control is needed, even if still just using tree.\n *\n * This uses {@link instantiateTreeFirstTime} to create the tree, and optionally initialize it.\n * @alpha\n */\nexport function defineTreeDataStore<const TSchema extends ImplicitFieldSchema>(\n\toptions: TreeDataStoreOptions<TSchema>,\n): DataStoreKind<TreeView<TSchema>> {\n\tconst registry: SharedObjectRegistry =\n\t\ttypeof options.registry === \"function\"\n\t\t\t? options.registry\n\t\t\t: sharedObjectRegistryFromIterable([...(options.registry ?? [SharedTreeAlpha])]);\n\n\tconst result = defineDataStore<TreeView<TSchema>, ITree>({\n\t\ttype: options.type,\n\t\tregistry,\n\t\tasync instantiateFirstTime(\n\t\t\trootCreator: SharedObjectCreator,\n\t\t\tcreator: SharedObjectCreator,\n\t\t): Promise<ITree> {\n\t\t\treturn instantiateTreeFirstTime(\n\t\t\t\trootCreator,\n\t\t\t\tcreator,\n\t\t\t\toptions.key ?? SharedTreeAlpha,\n\t\t\t\toptions,\n\t\t\t);\n\t\t},\n\t\tasync view(tree): Promise<TreeView<TSchema>> {\n\t\t\tconst view = tree.viewWith(options.config);\n\t\t\treturn view;\n\t\t},\n\t});\n\treturn result;\n}\n\n/**\n * Simple tree instantiation helper.\n * @remarks\n * This is used by {@link defineTreeDataStore}, but can also be used in custom data stores with {@link @fluidframework/shared-object-base#defineDataStore}.\n * Typically used to implement {@link @fluidframework/shared-object-base#DataStoreOptions.instantiateFirstTime} to create the tree and optionally initialize it.\n * @alpha\n */\nexport async function instantiateTreeFirstTime<TSchema extends ImplicitFieldSchema>(\n\trootCreator: SharedObjectCreator,\n\tcreator: SharedObjectCreator,\n\ttreeKind: SharedObjectKey<ITree>,\n\toptions: Pick<TreeDataStoreOptions<TSchema>, \"config\" | \"initializer\">,\n): Promise<ITree> {\n\tconst tree = await rootCreator.createSharedObject(treeKind);\n\tinitializeTreeFirstTime(tree, options, creator);\n\treturn tree;\n}\n\nfunction initializeTreeFirstTime<TSchema extends ImplicitFieldSchema>(\n\ttree: ITree,\n\toptions: Pick<TreeDataStoreOptions<TSchema>, \"config\" | \"initializer\">,\n\tcreator: SharedObjectCreator,\n): void {\n\tif (options.initializer !== undefined) {\n\t\tconst view = tree.viewWith(options.config);\n\t\tview.initialize(options.initializer(creator));\n\t\tview.dispose();\n\t}\n}\n"]}
|
package/dist/treeFactory.js
CHANGED
|
@@ -4,7 +4,13 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.SharedTreeAlpha = exports.SharedTree = void 0;
|
|
8
|
+
exports.configuredSharedTreeBeta = configuredSharedTreeBeta;
|
|
9
|
+
exports.configuredSharedTreeBetaLegacy = configuredSharedTreeBetaLegacy;
|
|
10
|
+
exports.configuredSharedTreeAlpha = configuredSharedTreeAlpha;
|
|
11
|
+
exports.configuredSharedTree = configuredSharedTree;
|
|
12
|
+
exports.configuredSharedTreeInternal = configuredSharedTreeInternal;
|
|
13
|
+
exports.resolveOptions = resolveOptions;
|
|
8
14
|
const internal_1 = require("@fluidframework/shared-object-base/internal");
|
|
9
15
|
const internal_2 = require("@fluidframework/telemetry-utils/internal");
|
|
10
16
|
const index_js_1 = require("./codec/index.js");
|
|
@@ -88,7 +94,6 @@ exports.SharedTreeAlpha = configuredSharedTree({});
|
|
|
88
94
|
function configuredSharedTreeBeta(options) {
|
|
89
95
|
return configuredSharedTree(options);
|
|
90
96
|
}
|
|
91
|
-
exports.configuredSharedTreeBeta = configuredSharedTreeBeta;
|
|
92
97
|
/**
|
|
93
98
|
* {@link configuredSharedTreeBeta} including the legacy `ISharedObjectKind` type.
|
|
94
99
|
* @privateRemarks
|
|
@@ -98,7 +103,6 @@ exports.configuredSharedTreeBeta = configuredSharedTreeBeta;
|
|
|
98
103
|
function configuredSharedTreeBetaLegacy(options) {
|
|
99
104
|
return configuredSharedTree(options);
|
|
100
105
|
}
|
|
101
|
-
exports.configuredSharedTreeBetaLegacy = configuredSharedTreeBetaLegacy;
|
|
102
106
|
/**
|
|
103
107
|
* {@link configuredSharedTreeBeta} but including the alpha {@link SharedTreeOptions}.
|
|
104
108
|
* @alpha
|
|
@@ -106,7 +110,6 @@ exports.configuredSharedTreeBetaLegacy = configuredSharedTreeBetaLegacy;
|
|
|
106
110
|
function configuredSharedTreeAlpha(options) {
|
|
107
111
|
return configuredSharedTree(options);
|
|
108
112
|
}
|
|
109
|
-
exports.configuredSharedTreeAlpha = configuredSharedTreeAlpha;
|
|
110
113
|
/**
|
|
111
114
|
* {@link configuredSharedTreeBetaLegacy} but including `@alpha` options.
|
|
112
115
|
*
|
|
@@ -134,7 +137,6 @@ function configuredSharedTree(options) {
|
|
|
134
137
|
const internalOptions = resolveOptions(options);
|
|
135
138
|
return configuredSharedTreeInternal(internalOptions);
|
|
136
139
|
}
|
|
137
|
-
exports.configuredSharedTree = configuredSharedTree;
|
|
138
140
|
function configuredSharedTreeInternal(options) {
|
|
139
141
|
const sharedObjectOptions = {
|
|
140
142
|
type: sharedTreeAttributes_js_1.SharedTreeFactoryType,
|
|
@@ -144,7 +146,6 @@ function configuredSharedTreeInternal(options) {
|
|
|
144
146
|
};
|
|
145
147
|
return (0, internal_1.makeSharedObjectKind)(sharedObjectOptions);
|
|
146
148
|
}
|
|
147
|
-
exports.configuredSharedTreeInternal = configuredSharedTreeInternal;
|
|
148
149
|
function resolveOptions(options) {
|
|
149
150
|
const internal = {
|
|
150
151
|
...resolveFormatOptions(options),
|
|
@@ -154,7 +155,6 @@ function resolveOptions(options) {
|
|
|
154
155
|
}
|
|
155
156
|
return internal;
|
|
156
157
|
}
|
|
157
|
-
exports.resolveOptions = resolveOptions;
|
|
158
158
|
function resolveFormatOptions(options) {
|
|
159
159
|
const enableSharedBranches = options.enableSharedBranches ?? false;
|
|
160
160
|
if (enableSharedBranches) {
|