@fluidframework/tree 2.113.0-411909 → 2.114.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 +272 -0
- package/api-report/tree.alpha.api.md +19 -0
- package/dist/core/change-family/changeFamily.d.ts +15 -4
- package/dist/core/change-family/changeFamily.d.ts.map +1 -1
- package/dist/core/change-family/changeFamily.js.map +1 -1
- package/dist/core/change-family/editBuilder.d.ts +2 -3
- package/dist/core/change-family/editBuilder.d.ts.map +1 -1
- package/dist/core/change-family/editBuilder.js +1 -2
- package/dist/core/change-family/editBuilder.js.map +1 -1
- package/dist/core/change-family/index.d.ts +1 -1
- package/dist/core/change-family/index.d.ts.map +1 -1
- package/dist/core/change-family/index.js.map +1 -1
- package/dist/core/index.d.ts +3 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/tree/delta.d.ts +62 -16
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts +7 -13
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +32 -46
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/index.d.ts +1 -0
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts +2 -4
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +2 -2
- 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 +5 -2
- package/dist/entrypoints/alpha.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +10 -2
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/comparison-forest/comparisonForest.d.ts +51 -0
- package/dist/feature-libraries/comparison-forest/comparisonForest.d.ts.map +1 -0
- package/dist/feature-libraries/comparison-forest/comparisonForest.js +98 -0
- package/dist/feature-libraries/comparison-forest/comparisonForest.js.map +1 -0
- package/dist/feature-libraries/comparison-forest/index.d.ts +6 -0
- package/dist/feature-libraries/comparison-forest/index.d.ts.map +1 -0
- package/dist/feature-libraries/comparison-forest/index.js +10 -0
- package/dist/feature-libraries/comparison-forest/index.js.map +1 -0
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +8 -6
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.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/index.d.ts +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/noChangeCodecs.d.ts +2 -2
- package/dist/feature-libraries/default-schema/noChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/noChangeCodecs.js +3 -1
- package/dist/feature-libraries/default-schema/noChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +6 -3
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js +18 -6
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +2 -3
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +2 -3
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +4 -3
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +77 -72
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.d.ts +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.js +12 -0
- package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.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 +15 -0
- package/dist/feature-libraries/modular-schema/invert.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/invert.js +159 -0
- package/dist/feature-libraries/modular-schema/invert.js.map +1 -0
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +3 -4
- package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js +2 -2
- package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +9 -9
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +0 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -22
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +53 -406
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts +61 -0
- package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeUtils.js +205 -0
- package/dist/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -0
- package/dist/feature-libraries/modular-schema/prune.d.ts +10 -0
- package/dist/feature-libraries/modular-schema/prune.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/prune.js +49 -0
- package/dist/feature-libraries/modular-schema/prune.js.map +1 -0
- package/dist/feature-libraries/optional-field/optionalField.js +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +2 -2
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts +2 -2
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/treeTextCursor.d.ts +15 -0
- package/dist/feature-libraries/treeTextCursor.d.ts.map +1 -1
- package/dist/feature-libraries/treeTextCursor.js +64 -1
- package/dist/feature-libraries/treeTextCursor.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.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/shared-tree/serializedChange.d.ts +2 -2
- package/dist/shared-tree/serializedChange.d.ts.map +1 -1
- package/dist/shared-tree/serializedChange.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +6 -3
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +8 -6
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +2 -2
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +41 -4
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +57 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/transactionMinimize.d.ts.map +1 -1
- package/dist/shared-tree/transactionMinimize.js +2 -2
- package/dist/shared-tree/transactionMinimize.js.map +1 -1
- package/dist/shared-tree/transactionPostProcessor.d.ts +2 -1
- package/dist/shared-tree/transactionPostProcessor.d.ts.map +1 -1
- package/dist/shared-tree/transactionPostProcessor.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +8 -7
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +1 -1
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +23 -9
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +7 -0
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +4 -4
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +2 -0
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -14
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +11 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +4 -11
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +4 -11
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.d.ts +4 -4
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +0 -1
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +8 -1
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +5 -5
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +10 -10
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +6 -3
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/simple-tree/api/eraseSchemaDetails.d.ts +15 -0
- package/dist/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -1
- package/dist/simple-tree/api/eraseSchemaDetails.js +15 -0
- package/dist/simple-tree/api/eraseSchemaDetails.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +21 -2
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts +13 -0
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +9 -0
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/text/textDomain.d.ts +12 -0
- package/dist/text/textDomain.d.ts.map +1 -1
- package/dist/text/textDomain.js +37 -16
- package/dist/text/textDomain.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +155 -61
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +147 -71
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/text/textDomainFormattedDefault.d.ts +37 -14
- package/dist/text/textDomainFormattedDefault.d.ts.map +1 -1
- package/dist/text/textDomainFormattedDefault.js +13 -5
- package/dist/text/textDomainFormattedDefault.js.map +1 -1
- package/dist/treeDataStore.d.ts +49 -0
- package/dist/treeDataStore.d.ts.map +1 -0
- package/dist/treeDataStore.js +57 -0
- package/dist/treeDataStore.js.map +1 -0
- package/dist/treeFactory.d.ts +8 -3
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +6 -1
- package/dist/treeFactory.js.map +1 -1
- package/lib/core/change-family/changeFamily.d.ts +15 -4
- package/lib/core/change-family/changeFamily.d.ts.map +1 -1
- package/lib/core/change-family/changeFamily.js.map +1 -1
- package/lib/core/change-family/editBuilder.d.ts +2 -3
- package/lib/core/change-family/editBuilder.d.ts.map +1 -1
- package/lib/core/change-family/editBuilder.js +1 -2
- package/lib/core/change-family/editBuilder.js.map +1 -1
- package/lib/core/change-family/index.d.ts +1 -1
- package/lib/core/change-family/index.d.ts.map +1 -1
- package/lib/core/change-family/index.js.map +1 -1
- package/lib/core/index.d.ts +3 -2
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/tree/delta.d.ts +62 -16
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts +7 -13
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +7 -21
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/index.d.ts +1 -0
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts +2 -4
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +2 -2
- package/lib/core/tree/visitorUtils.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/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +10 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/comparison-forest/comparisonForest.d.ts +51 -0
- package/lib/feature-libraries/comparison-forest/comparisonForest.d.ts.map +1 -0
- package/lib/feature-libraries/comparison-forest/comparisonForest.js +94 -0
- package/lib/feature-libraries/comparison-forest/comparisonForest.js.map +1 -0
- package/lib/feature-libraries/comparison-forest/index.d.ts +6 -0
- package/lib/feature-libraries/comparison-forest/index.d.ts.map +1 -0
- package/lib/feature-libraries/comparison-forest/index.js +6 -0
- package/lib/feature-libraries/comparison-forest/index.js.map +1 -0
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +8 -6
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +6 -3
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/noChangeCodecs.d.ts +2 -2
- package/lib/feature-libraries/default-schema/noChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/noChangeCodecs.js +3 -1
- package/lib/feature-libraries/default-schema/noChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +6 -3
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js +16 -4
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +2 -3
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +2 -3
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +4 -3
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +2 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.d.ts +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.js +12 -0
- package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -1
- 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/genericFieldKindCodecs.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.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 +15 -0
- package/lib/feature-libraries/modular-schema/invert.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/invert.js +155 -0
- package/lib/feature-libraries/modular-schema/invert.js.map +1 -0
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +3 -4
- package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js +2 -2
- package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +9 -9
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +0 -2
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -22
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +16 -367
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts +61 -0
- package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeUtils.js +192 -0
- package/lib/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -0
- package/lib/feature-libraries/modular-schema/prune.d.ts +10 -0
- package/lib/feature-libraries/modular-schema/prune.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/prune.js +45 -0
- package/lib/feature-libraries/modular-schema/prune.js.map +1 -0
- package/lib/feature-libraries/optional-field/optionalField.js +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +2 -2
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts +2 -2
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/treeTextCursor.d.ts +15 -0
- package/lib/feature-libraries/treeTextCursor.d.ts.map +1 -1
- package/lib/feature-libraries/treeTextCursor.js +62 -1
- package/lib/feature-libraries/treeTextCursor.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.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/shared-tree/serializedChange.d.ts +2 -2
- package/lib/shared-tree/serializedChange.d.ts.map +1 -1
- package/lib/shared-tree/serializedChange.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +6 -3
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +9 -7
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +2 -2
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +41 -4
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +55 -0
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/transactionMinimize.d.ts.map +1 -1
- package/lib/shared-tree/transactionMinimize.js +3 -3
- package/lib/shared-tree/transactionMinimize.js.map +1 -1
- package/lib/shared-tree/transactionPostProcessor.d.ts +2 -1
- package/lib/shared-tree/transactionPostProcessor.d.ts.map +1 -1
- package/lib/shared-tree/transactionPostProcessor.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +8 -7
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +1 -1
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +23 -9
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +7 -0
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +4 -4
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +2 -0
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -14
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +11 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +4 -11
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +4 -11
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.d.ts +4 -4
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +0 -1
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +8 -1
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +5 -5
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +10 -10
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +6 -3
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/simple-tree/api/eraseSchemaDetails.d.ts +15 -0
- package/lib/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -1
- package/lib/simple-tree/api/eraseSchemaDetails.js +15 -0
- package/lib/simple-tree/api/eraseSchemaDetails.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +21 -2
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts +13 -0
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +9 -0
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/text/textDomain.d.ts +12 -0
- package/lib/text/textDomain.d.ts.map +1 -1
- package/lib/text/textDomain.js +34 -15
- package/lib/text/textDomain.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +155 -61
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +148 -73
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/text/textDomainFormattedDefault.d.ts +37 -14
- package/lib/text/textDomainFormattedDefault.d.ts.map +1 -1
- package/lib/text/textDomainFormattedDefault.js +14 -6
- package/lib/text/textDomainFormattedDefault.js.map +1 -1
- package/lib/treeDataStore.d.ts +49 -0
- package/lib/treeDataStore.d.ts.map +1 -0
- package/lib/treeDataStore.js +52 -0
- package/lib/treeDataStore.js.map +1 -0
- package/lib/treeFactory.d.ts +8 -3
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +5 -0
- package/lib/treeFactory.js.map +1 -1
- package/package.json +25 -24
- package/src/core/change-family/changeFamily.ts +32 -4
- package/src/core/change-family/editBuilder.ts +1 -2
- package/src/core/change-family/index.ts +2 -0
- package/src/core/index.ts +9 -6
- package/src/core/tree/delta.ts +62 -16
- package/src/core/tree/detachedFieldIndex.ts +7 -38
- package/src/core/tree/index.ts +2 -0
- package/src/core/tree/visitorUtils.ts +3 -17
- package/src/entrypoints/alpha.ts +7 -3
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +11 -1
- package/src/feature-libraries/comparison-forest/comparisonForest.ts +140 -0
- package/src/feature-libraries/comparison-forest/index.ts +6 -0
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +20 -6
- package/src/feature-libraries/default-schema/index.ts +1 -0
- package/src/feature-libraries/default-schema/noChangeCodecs.ts +11 -3
- package/src/feature-libraries/detachedFieldIndexSummarizer.ts +33 -5
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -3
- package/src/feature-libraries/index.ts +5 -0
- package/src/feature-libraries/mitigatedChangeFamily.ts +21 -3
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +10 -1
- package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +9 -4
- package/src/feature-libraries/modular-schema/index.ts +1 -0
- package/src/feature-libraries/modular-schema/invert.ts +338 -0
- package/src/feature-libraries/modular-schema/minimizeModularChange.ts +3 -5
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +16 -13
- package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +3 -1
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +2 -1
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +45 -644
- package/src/feature-libraries/modular-schema/modularChangeUtils.ts +340 -0
- package/src/feature-libraries/modular-schema/prune.ts +69 -0
- package/src/feature-libraries/optional-field/optionalField.ts +1 -1
- package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +4 -2
- package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +5 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +4 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +4 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +6 -3
- package/src/feature-libraries/treeTextCursor.ts +66 -1
- package/src/index.ts +4 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/serializedChange.ts +2 -2
- package/src/shared-tree/sharedTree.ts +34 -14
- package/src/shared-tree/sharedTreeChangeCodecs.ts +11 -3
- package/src/shared-tree/sharedTreeChangeFamily.ts +77 -2
- package/src/shared-tree/transactionMinimize.ts +7 -3
- package/src/shared-tree/transactionPostProcessor.ts +5 -1
- package/src/shared-tree/treeCheckout.ts +55 -16
- package/src/shared-tree-core/branch.ts +40 -12
- package/src/shared-tree-core/editManager.ts +46 -25
- package/src/shared-tree-core/editManagerCodecs.ts +9 -21
- package/src/shared-tree-core/editManagerCodecsCommons.ts +14 -2
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +18 -21
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +18 -20
- package/src/shared-tree-core/editManagerSummarizer.ts +9 -6
- package/src/shared-tree-core/messageCodecV1ToV4.ts +3 -3
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +2 -2
- package/src/shared-tree-core/messageCodecs.ts +12 -2
- package/src/shared-tree-core/sharedTreeCore.ts +15 -6
- package/src/shared-tree-core/transaction.ts +47 -25
- package/src/simple-tree/api/eraseSchemaDetails.ts +15 -0
- package/src/simple-tree/node-kinds/array/arrayNode.ts +21 -2
- package/src/simple-tree/node-kinds/map/mapNode.ts +24 -2
- package/src/text/textDomain.ts +29 -6
- package/src/text/textDomainFormatted.ts +351 -134
- package/src/text/textDomainFormattedDefault.ts +25 -16
- package/src/treeDataStore.ts +125 -0
- package/src/treeFactory.ts +11 -3
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
tagChange,
|
|
18
18
|
type ChangeFamilyEditor,
|
|
19
19
|
type GraphCommit,
|
|
20
|
+
type ProcessChangeFn,
|
|
20
21
|
type RevisionTag,
|
|
21
22
|
} from "../core/index.js";
|
|
22
23
|
import { getLast, getOrCreate } from "../util/index.js";
|
|
@@ -263,7 +264,7 @@ export enum ChangeProcessorApplicability {
|
|
|
263
264
|
* (see the conversion helpers in the `shared-tree` layer) so that its internal
|
|
264
265
|
* change representation does not leak into the public API.
|
|
265
266
|
*/
|
|
266
|
-
export interface ChangeProcessor<TChange> {
|
|
267
|
+
export interface ChangeProcessor<TChange, TChangeProcessingContext> {
|
|
267
268
|
/**
|
|
268
269
|
* Informs what context it should be invoked for.
|
|
269
270
|
*/
|
|
@@ -271,13 +272,13 @@ export interface ChangeProcessor<TChange> {
|
|
|
271
272
|
/**
|
|
272
273
|
* Processes the given change, returning a change with the same observable effect.
|
|
273
274
|
*/
|
|
274
|
-
readonly processChange:
|
|
275
|
+
readonly processChange: ProcessChangeFn<TChange, TChangeProcessingContext>;
|
|
275
276
|
}
|
|
276
277
|
|
|
277
278
|
/**
|
|
278
279
|
* Options for {@link Transactor.start | starting} a transaction.
|
|
279
280
|
*/
|
|
280
|
-
export interface SquashingTransactionOptions<TChange> {
|
|
281
|
+
export interface SquashingTransactionOptions<TChange, TChangeProcessingContext> {
|
|
281
282
|
/**
|
|
282
283
|
* An optional {@link ChangeProcessor} applied to the squashed change produced when a transaction that was started
|
|
283
284
|
* with this option is committed.
|
|
@@ -288,7 +289,7 @@ export interface SquashingTransactionOptions<TChange> {
|
|
|
288
289
|
* How often the processor is invoked across nested transactions is governed by its
|
|
289
290
|
* {@link ChangeProcessor.applicability | applicability}.
|
|
290
291
|
*/
|
|
291
|
-
readonly postProcessor?: ChangeProcessor<TChange>;
|
|
292
|
+
readonly postProcessor?: ChangeProcessor<TChange, TChangeProcessingContext>;
|
|
292
293
|
}
|
|
293
294
|
|
|
294
295
|
/**
|
|
@@ -300,8 +301,9 @@ export interface SquashingTransactionOptions<TChange> {
|
|
|
300
301
|
export class SquashingTransactionStack<
|
|
301
302
|
TEditor extends ChangeFamilyEditor,
|
|
302
303
|
TChange,
|
|
303
|
-
|
|
304
|
-
|
|
304
|
+
TChangeProcessingContext,
|
|
305
|
+
> extends TransactionStack<SquashingTransactionOptions<TChange, TChangeProcessingContext>> {
|
|
306
|
+
#transactionBranch?: SharedTreeBranch<TEditor, TChange, TChangeProcessingContext>;
|
|
305
307
|
|
|
306
308
|
/**
|
|
307
309
|
* An editor for whichever branch is currently the {@link SquashingTransactionStack.activeBranch | active branch}.
|
|
@@ -317,7 +319,7 @@ export class SquashingTransactionStack<
|
|
|
317
319
|
/**
|
|
318
320
|
* Get the "active branch" for this transactor - either the transaction branch if a transaction is in progress, or the original branch otherwise.
|
|
319
321
|
*/
|
|
320
|
-
public get activeBranch(): SharedTreeBranch<TEditor, TChange> {
|
|
322
|
+
public get activeBranch(): SharedTreeBranch<TEditor, TChange, TChangeProcessingContext> {
|
|
321
323
|
return this.#transactionBranch ?? this.branch;
|
|
322
324
|
}
|
|
323
325
|
|
|
@@ -326,10 +328,16 @@ export class SquashingTransactionStack<
|
|
|
326
328
|
* @remarks When the active branch changes, the listeners for these events will automatically be transferred to the new active branch.
|
|
327
329
|
* In contrast, binding an event to the {@link SquashingTransactionStack.activeBranch | active branch} directly will not automatically transfer the listener when the active branch changes.
|
|
328
330
|
*/
|
|
329
|
-
public get activeBranchEvents(): Listenable<
|
|
331
|
+
public get activeBranchEvents(): Listenable<
|
|
332
|
+
SharedTreeBranchEvents<TEditor, TChange, TChangeProcessingContext>
|
|
333
|
+
> {
|
|
330
334
|
const off = (
|
|
331
|
-
eventName: keyof SharedTreeBranchEvents<TEditor, TChange>,
|
|
332
|
-
listener: SharedTreeBranchEvents<
|
|
335
|
+
eventName: keyof SharedTreeBranchEvents<TEditor, TChange, TChangeProcessingContext>,
|
|
336
|
+
listener: SharedTreeBranchEvents<
|
|
337
|
+
TEditor,
|
|
338
|
+
TChange,
|
|
339
|
+
TChangeProcessingContext
|
|
340
|
+
>[typeof eventName],
|
|
333
341
|
): void => {
|
|
334
342
|
this.activeBranch.events.off(eventName, listener);
|
|
335
343
|
const listeners = this.#activeBranchEvents.get(eventName);
|
|
@@ -349,9 +357,13 @@ export class SquashingTransactionStack<
|
|
|
349
357
|
};
|
|
350
358
|
}
|
|
351
359
|
readonly #activeBranchEvents = new Map<
|
|
352
|
-
keyof SharedTreeBranchEvents<TEditor, TChange>,
|
|
360
|
+
keyof SharedTreeBranchEvents<TEditor, TChange, TChangeProcessingContext>,
|
|
353
361
|
Set<
|
|
354
|
-
SharedTreeBranchEvents<
|
|
362
|
+
SharedTreeBranchEvents<
|
|
363
|
+
TEditor,
|
|
364
|
+
TChange,
|
|
365
|
+
TChangeProcessingContext
|
|
366
|
+
>[keyof SharedTreeBranchEvents<TEditor, TChange, TChangeProcessingContext>]
|
|
355
367
|
>
|
|
356
368
|
>();
|
|
357
369
|
|
|
@@ -365,20 +377,23 @@ export class SquashingTransactionStack<
|
|
|
365
377
|
* options rather than baked into this stack, so different transactions may supply different post-processors (or none).
|
|
366
378
|
*/
|
|
367
379
|
public constructor(
|
|
368
|
-
public readonly branch: SharedTreeBranch<TEditor, TChange>,
|
|
380
|
+
public readonly branch: SharedTreeBranch<TEditor, TChange, TChangeProcessingContext>,
|
|
369
381
|
mintRevisionTag: () => RevisionTag,
|
|
370
382
|
onPush?: () => OnPopWithViewUpdate<TChange> | void,
|
|
371
383
|
) {
|
|
372
384
|
// A stack of the post-processors to apply when each in-progress transaction commits, ordered from outermost to
|
|
373
385
|
// innermost. Each in-progress transaction contributes exactly one entry: either the processor to apply when it
|
|
374
386
|
// commits, or `undefined` when none should be applied.
|
|
375
|
-
const postProcessorStack: (
|
|
387
|
+
const postProcessorStack: (
|
|
388
|
+
| ChangeProcessor<TChange, TChangeProcessingContext>
|
|
389
|
+
| undefined
|
|
390
|
+
)[] = [];
|
|
376
391
|
// Determines the entry to push for a transaction that was started with the given `requested` processor (if any).
|
|
377
392
|
// A processor with "outermost" applicability that is already active in an enclosing transaction resolves to
|
|
378
393
|
// `undefined` so that it is only applied once (at the outermost transaction that supplied it).
|
|
379
394
|
const resolvePostProcessor = (
|
|
380
|
-
requested: ChangeProcessor<TChange> | undefined,
|
|
381
|
-
): ChangeProcessor<TChange> | undefined => {
|
|
395
|
+
requested: ChangeProcessor<TChange, TChangeProcessingContext> | undefined,
|
|
396
|
+
): ChangeProcessor<TChange, TChangeProcessingContext> | undefined => {
|
|
382
397
|
if (
|
|
383
398
|
requested?.applicability === ChangeProcessorApplicability.IfOutermost &&
|
|
384
399
|
postProcessorStack.includes(requested)
|
|
@@ -391,12 +406,13 @@ export class SquashingTransactionStack<
|
|
|
391
406
|
super(
|
|
392
407
|
// Invoked when an outer transaction starts
|
|
393
408
|
(
|
|
394
|
-
startOptions?: SquashingTransactionOptions<TChange>,
|
|
395
|
-
): Callbacks<SquashingTransactionOptions<TChange>> => {
|
|
409
|
+
startOptions?: SquashingTransactionOptions<TChange, TChangeProcessingContext>,
|
|
410
|
+
): Callbacks<SquashingTransactionOptions<TChange, TChangeProcessingContext>> => {
|
|
396
411
|
postProcessorStack.push(resolvePostProcessor(startOptions?.postProcessor));
|
|
397
412
|
// Keep track of the commit that each transaction was on when it started
|
|
398
413
|
const startHead = this.activeBranch.getHead();
|
|
399
|
-
const
|
|
414
|
+
const changeFamily = this.branch.changeFamily;
|
|
415
|
+
const rebaser = changeFamily.rebaser;
|
|
400
416
|
const outerOnPop = onPush?.();
|
|
401
417
|
let transactionRevision: RevisionTag | undefined;
|
|
402
418
|
const transactionBranch = this.branch.fork(
|
|
@@ -462,7 +478,9 @@ export class SquashingTransactionStack<
|
|
|
462
478
|
// Apply this transaction's post-processor (if any) to the squashed change (for example, to
|
|
463
479
|
// "minimize" it so that it contains no extraneous information).
|
|
464
480
|
const change =
|
|
465
|
-
postProcessor === undefined
|
|
481
|
+
postProcessor === undefined
|
|
482
|
+
? squash
|
|
483
|
+
: changeFamily.buildProcessor(postProcessor.processChange)(squash);
|
|
466
484
|
|
|
467
485
|
if (change !== squash) {
|
|
468
486
|
// The post-processor produced a change that differs from the
|
|
@@ -524,9 +542,9 @@ export class SquashingTransactionStack<
|
|
|
524
542
|
outerOnPop?.(result, viewUpdate);
|
|
525
543
|
};
|
|
526
544
|
// Invoked when a nested transaction begins
|
|
527
|
-
const onNestedTransactionPush: OnPush<
|
|
528
|
-
|
|
529
|
-
) => {
|
|
545
|
+
const onNestedTransactionPush: OnPush<
|
|
546
|
+
SquashingTransactionOptions<TChange, TChangeProcessingContext>
|
|
547
|
+
> = (nestedStartOptions) => {
|
|
530
548
|
postProcessorStack.push(resolvePostProcessor(nestedStartOptions?.postProcessor));
|
|
531
549
|
const nestedStartHead = this.activeBranch.getHead();
|
|
532
550
|
const nestedOuterOnPop = onPush?.();
|
|
@@ -558,7 +576,9 @@ export class SquashingTransactionStack<
|
|
|
558
576
|
0xd07 /* Expected transaction revision in the presence of transaction steps */,
|
|
559
577
|
);
|
|
560
578
|
const squash = rebaser.compose(nestedSteps);
|
|
561
|
-
const processedSquash =
|
|
579
|
+
const processedSquash = changeFamily.buildProcessor(
|
|
580
|
+
nestedPostProcessor.processChange,
|
|
581
|
+
)(squash);
|
|
562
582
|
// Roll back the transaction branch to the nested start head and apply the
|
|
563
583
|
// processed change if it differs from the original change.
|
|
564
584
|
if (processedSquash !== squash) {
|
|
@@ -586,7 +606,9 @@ export class SquashingTransactionStack<
|
|
|
586
606
|
|
|
587
607
|
/** Updates the transaction branch (and therefore the active branch) and rebinds the branch events. */
|
|
588
608
|
private setTransactionBranch(
|
|
589
|
-
transactionBranch:
|
|
609
|
+
transactionBranch:
|
|
610
|
+
| SharedTreeBranch<TEditor, TChange, TChangeProcessingContext>
|
|
611
|
+
| undefined,
|
|
590
612
|
): void {
|
|
591
613
|
const oldActiveBranch = this.activeBranch;
|
|
592
614
|
this.#transactionBranch = transactionBranch;
|
|
@@ -103,6 +103,21 @@ export function eraseSchemaDetails<TNode, ExtraSchemaProperties = unknown>(): <
|
|
|
103
103
|
* const square = Square.create(10);
|
|
104
104
|
* assert.equal(square.area, 100);
|
|
105
105
|
* ```
|
|
106
|
+
* @remarks
|
|
107
|
+
* Care must be taken to avoid subclass members colliding with internal members of the schema.
|
|
108
|
+
* This is mainly a problem when using the output from {@link eraseSchemaDetailsSubclassable} to type a class returned to third party code which can subclass it.
|
|
109
|
+
* This pattern mainly occurs when writing generic schema factory functions which generate a schema from some parameters and return it to third party code which can subclass it.
|
|
110
|
+
*
|
|
111
|
+
* For example if the schema has a field or method named `size` (from a field, like in the `Square` example, or otherwise),
|
|
112
|
+
* then a subclass should not define a member named `size` as it will collide with the internal field.
|
|
113
|
+
*
|
|
114
|
+
* In practice, this risk can be mitigated by doing one of:
|
|
115
|
+
* 1. Using JavaScript private properties
|
|
116
|
+
* 2. Use non exported symbols for the properties
|
|
117
|
+
* 3. Use a naming convention for internal properties which you document the subclasses must not use.
|
|
118
|
+
* 4. Documenting the specific internal properties keys as not to be used by subclasses.
|
|
119
|
+
* 5. Subclass the returned class and declaring uninitialized readonly private properties to protect them (`private readonly size!: unknown;`).
|
|
120
|
+
* 6. Include the properties in `TNode` or `ExtraSchemaProperties`. This can use readonly erased types (like unknown) if desired.
|
|
106
121
|
* @privateRemarks
|
|
107
122
|
* See "example" test for an executable version of this example.
|
|
108
123
|
* @alpha
|
|
@@ -158,6 +158,11 @@ export interface TreeArrayNode<
|
|
|
158
158
|
* Removes the item at the specified location.
|
|
159
159
|
* @param index - The index at which to remove the item.
|
|
160
160
|
* @throws Throws if `index` is not in the range [0, `array.length`).
|
|
161
|
+
* @remarks
|
|
162
|
+
* The item to remove is determined when this method is called, not when the resulting edit is sequenced.
|
|
163
|
+
* This means that, once the edit is sequenced, the item being removed may no longer be at `index`,
|
|
164
|
+
* and may in fact no longer be in this array at all (for example, if a concurrent edit moved it to another array).
|
|
165
|
+
* This operation removes that item from wherever it then resides.
|
|
161
166
|
*/
|
|
162
167
|
removeAt(index: number): void;
|
|
163
168
|
|
|
@@ -534,12 +539,22 @@ export interface TreeArrayNodeAlpha<
|
|
|
534
539
|
/**
|
|
535
540
|
* Removes the last item from the array and returns it.
|
|
536
541
|
* @returns The removed item, or `undefined` if the array is empty (in which case the array is not modified).
|
|
542
|
+
* @remarks
|
|
543
|
+
* Equivalent to `removeAt(array.length - 1)`, additionally returning the removed item:
|
|
544
|
+
* see {@link (TreeArrayNode:interface).removeAt} for details, including merge semantics with concurrent edits.
|
|
545
|
+
* In particular, the item removed is the one that is last at the time this method is called,
|
|
546
|
+
* not the one that is last at the time the resulting edit is sequenced.
|
|
537
547
|
*/
|
|
538
548
|
pop(): T | undefined;
|
|
539
549
|
|
|
540
550
|
/**
|
|
541
551
|
* Removes the first item from the array and returns it.
|
|
542
552
|
* @returns The removed item, or `undefined` if the array is empty (in which case the array is not modified).
|
|
553
|
+
* @remarks
|
|
554
|
+
* Equivalent to `removeAt(0)`, additionally returning the removed item:
|
|
555
|
+
* see {@link (TreeArrayNode:interface).removeAt} for details, including merge semantics with concurrent edits.
|
|
556
|
+
* In particular, the item removed is the one that is first at the time this method is called,
|
|
557
|
+
* not the one that is first at the time the resulting edit is sequenced.
|
|
543
558
|
*/
|
|
544
559
|
shift(): T | undefined;
|
|
545
560
|
|
|
@@ -550,8 +565,10 @@ export interface TreeArrayNodeAlpha<
|
|
|
550
565
|
* @remarks
|
|
551
566
|
* Unlike `Array.prototype.unshift`, this method does not return the new length of the array.
|
|
552
567
|
*
|
|
553
|
-
*
|
|
554
|
-
*
|
|
568
|
+
* All items inserted by a single call to this method are inserted consecutively.
|
|
569
|
+
* The order of the inserted items relative to other concurrently inserted items is fully specified:
|
|
570
|
+
* Concurrently unshifting `[A, B]` and `[X, Y]` will yield `[A, B, X, Y]` if the edit unshifting `[A, B]`
|
|
571
|
+
* is sequenced after the edit unshifting `[X, Y]`.
|
|
555
572
|
*/
|
|
556
573
|
unshift(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
557
574
|
|
|
@@ -563,6 +580,8 @@ export interface TreeArrayNodeAlpha<
|
|
|
563
580
|
* Must be a non-negative integer no greater than the number of items from `start` to the end of the array.
|
|
564
581
|
* @param items - The item(s) to insert at `start`.
|
|
565
582
|
* @returns An array containing the item(s) that were removed.
|
|
583
|
+
* @remarks
|
|
584
|
+
* See {@link (TreeArrayNode:interface).insertAt} for the merge semantics of the inserted items.
|
|
566
585
|
*/
|
|
567
586
|
splice(
|
|
568
587
|
start: number,
|
|
@@ -166,7 +166,21 @@ export interface TreeMapNode<T extends ImplicitAllowedTypes = ImplicitAllowedTyp
|
|
|
166
166
|
export interface TreeMapNodeAlpha<T extends ImplicitAllowedTypes = ImplicitAllowedTypes>
|
|
167
167
|
extends FluidReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>,
|
|
168
168
|
TreeNode,
|
|
169
|
-
Pick<TreeMapNode<T>, "set" | "delete"> {
|
|
169
|
+
Pick<TreeMapNode<T>, "set" | "delete"> {
|
|
170
|
+
/**
|
|
171
|
+
* Removes all elements from the map.
|
|
172
|
+
* @remarks
|
|
173
|
+
* The merge semantics of this operation are loosely specified. Either of the following may occur:
|
|
174
|
+
*
|
|
175
|
+
* - `clear` may remove all elements that were in the map when the edit was authored,
|
|
176
|
+
* even if some of those elements have since been moved elsewhere in the tree
|
|
177
|
+
* (in which case they are removed from their new location).
|
|
178
|
+
*
|
|
179
|
+
* - `clear` may remove all elements that are in the map when the edit is sequenced,
|
|
180
|
+
* even if some of those elements were not yet in the map when the edit was authored.
|
|
181
|
+
*/
|
|
182
|
+
clear(): void;
|
|
183
|
+
}
|
|
170
184
|
|
|
171
185
|
// TreeMapNode is invariant over schema type, so for this handler to work with all schema, the only possible type for the schema is `any`.
|
|
172
186
|
// This is not ideal, but no alternatives are possible.
|
|
@@ -265,7 +279,15 @@ abstract class CustomMapNodeBase<const T extends ImplicitAllowedTypes> extends T
|
|
|
265
279
|
callbackFn.call(thisArg, node, field.key, this);
|
|
266
280
|
}
|
|
267
281
|
}
|
|
268
|
-
|
|
282
|
+
public clear(): void {
|
|
283
|
+
const node = this.innerNode;
|
|
284
|
+
const transaction = node.isHydrated() ? node.context.checkout.transaction : undefined;
|
|
285
|
+
transaction?.start();
|
|
286
|
+
for (const key of [...node.keys()]) {
|
|
287
|
+
this.delete(key);
|
|
288
|
+
}
|
|
289
|
+
transaction?.commit();
|
|
290
|
+
}
|
|
269
291
|
}
|
|
270
292
|
|
|
271
293
|
/**
|
package/src/text/textDomain.ts
CHANGED
|
@@ -34,6 +34,29 @@ import type {
|
|
|
34
34
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports, import-x/no-duplicates
|
|
35
35
|
import type { NodeKind, TreeNodeSchema } from "../simple-tree/index.js";
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Enables expensive debug assertions for formatted text.
|
|
39
|
+
*/
|
|
40
|
+
let enableTextExpensiveDebugAsserts = false;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Enables or disables expensive debug assertions for formatted text.
|
|
44
|
+
* @remarks
|
|
45
|
+
* These should remain disabled except when testing implementation details of this code.
|
|
46
|
+
*/
|
|
47
|
+
export function setEnableExpensiveDebugAsserts(value: boolean): void {
|
|
48
|
+
enableTextExpensiveDebugAsserts = value;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Runs `condition` as a {@link debugAssert} only when {@link enableTextExpensiveDebugAsserts} is enabled.
|
|
53
|
+
* @remarks
|
|
54
|
+
* Like all {@link debugAssert}s, this is compiled out of production builds, so `condition` is never evaluated there.
|
|
55
|
+
*/
|
|
56
|
+
export function expensiveInternalValidationAssert(condition: () => true | string): void {
|
|
57
|
+
debugAssert(() => !enableTextExpensiveDebugAsserts || condition());
|
|
58
|
+
}
|
|
59
|
+
|
|
37
60
|
const sf = new SchemaFactoryAlpha("com.fluidframework.text");
|
|
38
61
|
|
|
39
62
|
class TextNode
|
|
@@ -120,9 +143,9 @@ class TextNode
|
|
|
120
143
|
|
|
121
144
|
public charactersCopy(): string[] {
|
|
122
145
|
const result = this.content.charactersCopy();
|
|
123
|
-
|
|
146
|
+
expensiveInternalValidationAssert(
|
|
124
147
|
() =>
|
|
125
|
-
compareArrays(result, this
|
|
148
|
+
compareArrays(result, this.#charactersCopy_reference()) ||
|
|
126
149
|
"invalid charactersCopy optimizations",
|
|
127
150
|
);
|
|
128
151
|
return result;
|
|
@@ -130,8 +153,8 @@ class TextNode
|
|
|
130
153
|
|
|
131
154
|
public fullString(): string {
|
|
132
155
|
const result = this.content.fullString();
|
|
133
|
-
|
|
134
|
-
() => result === this
|
|
156
|
+
expensiveInternalValidationAssert(
|
|
157
|
+
() => result === this.#fullString_reference() || "invalid fullString optimizations",
|
|
135
158
|
);
|
|
136
159
|
return result;
|
|
137
160
|
}
|
|
@@ -139,14 +162,14 @@ class TextNode
|
|
|
139
162
|
/**
|
|
140
163
|
* Unoptimized trivially correct implementation of fullString.
|
|
141
164
|
*/
|
|
142
|
-
|
|
165
|
+
#fullString_reference(): string {
|
|
143
166
|
return this.content.join("");
|
|
144
167
|
}
|
|
145
168
|
|
|
146
169
|
/**
|
|
147
170
|
* Unoptimized trivially correct implementation of charactersCopy.
|
|
148
171
|
*/
|
|
149
|
-
|
|
172
|
+
#charactersCopy_reference(): string[] {
|
|
150
173
|
return [...this.content];
|
|
151
174
|
}
|
|
152
175
|
|