@fluidframework/tree 2.82.0 → 2.90.0-378676
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 +43 -0
- package/README.md +33 -5
- package/api-report/tree.alpha.api.md +26 -21
- package/api-report/tree.beta.api.md +14 -2
- package/api-report/tree.legacy.beta.api.md +14 -2
- package/api-report/tree.legacy.public.api.md +1 -1
- package/api-report/tree.public.api.md +1 -1
- package/dist/alpha.d.ts +3 -3
- package/dist/beta.d.ts +1 -0
- package/dist/codec/codec.d.ts +3 -39
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +5 -50
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/index.d.ts +1 -1
- package/dist/codec/index.d.ts.map +1 -1
- package/dist/codec/index.js +1 -2
- package/dist/codec/index.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +20 -7
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js +56 -30
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/core/change-family/changeFamily.d.ts +4 -1
- 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/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 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/changeRebaser.d.ts +6 -1
- package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
- 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/types.d.ts +1 -0
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +5 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +25 -7
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/tree/delta.d.ts +5 -0
- 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 +13 -1
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +14 -1
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js +6 -4
- package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexTypes.d.ts +4 -0
- package/dist/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
- package/dist/core/tree/index.d.ts +2 -2
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +4 -3
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/pathTree.d.ts +11 -3
- package/dist/core/tree/pathTree.d.ts.map +1 -1
- package/dist/core/tree/pathTree.js +14 -2
- package/dist/core/tree/pathTree.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +17 -13
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/extensibleUnionNode.d.ts +97 -0
- package/dist/extensibleUnionNode.d.ts.map +1 -0
- package/dist/{extensibleSchemaUnion.js → extensibleUnionNode.js} +28 -18
- package/dist/extensibleUnionNode.js.map +1 -0
- package/dist/feature-libraries/changeAtomIdBTree.d.ts +3 -2
- package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
- package/dist/feature-libraries/changeAtomIdBTree.js +15 -2
- package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +4 -4
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +92 -44
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +220 -70
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +12 -2
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +2 -1
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js +4 -2
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +40 -0
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js +153 -0
- package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js.map +1 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +7 -6
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js +15 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
- package/dist/feature-libraries/deltaUtils.d.ts +1 -0
- package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
- package/dist/feature-libraries/deltaUtils.js +6 -1
- package/dist/feature-libraries/deltaUtils.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.d.ts +9 -0
- package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js +6 -0
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts +8 -7
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +39 -8
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js +7 -1
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts +3 -3
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV1.d.ts +2 -3
- package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV1.js +1 -2
- package/dist/feature-libraries/forest-summary/formatV1.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV2.d.ts +2 -3
- package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV2.js +1 -2
- package/dist/feature-libraries/forest-summary/formatV2.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +3 -3
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +8 -4
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.js +2 -2
- package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +100 -24
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js +8 -12
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +85 -51
- 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/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +4 -9
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +3 -3
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +2 -3
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +20 -24
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +277 -159
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV3.d.ts +15 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV3.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV3.js +296 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV3.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +8 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +56 -22
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1390 -462
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +1 -2
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +3 -3
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV3.d.ts +74 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV3.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV3.js +35 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormatV3.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +49 -10
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js +3 -3
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts +13 -32
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +257 -446
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +23 -0
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +1 -0
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +31 -0
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +1 -0
- package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +31 -31
- package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js +57 -28
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +12 -0
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +1 -0
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js +57 -0
- package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js.map +1 -0
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +5 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/optional-field/requiredField.d.ts +3 -2
- package/dist/feature-libraries/optional-field/requiredField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/requiredField.js +6 -1
- package/dist/feature-libraries/optional-field/requiredField.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +6 -4
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.d.ts +6 -7
- package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +81 -259
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/helperTypes.d.ts +14 -10
- package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +65 -167
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/markQueue.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +4 -56
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.js +7 -90
- package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js +109 -116
- package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/replaceRevisions.js +19 -32
- package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +1 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +22 -4
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +388 -187
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +20 -62
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -13
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +3 -2
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +16 -111
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/dist/feature-libraries/sequence-field/types.d.ts +37 -74
- package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/types.js.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.d.ts +20 -25
- package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +159 -320
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +1 -0
- 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/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +1 -1
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts +4 -4
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +2 -1
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +1 -5
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +21 -35
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +9 -3
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +4 -1
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -0
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +9 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +4 -4
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts +16 -6
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.js +14 -7
- package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/dist/shared-tree/tree.d.ts +1 -1
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +1 -1
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +13 -11
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +58 -10
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +3 -2
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +4 -3
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +2 -2
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +9 -9
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +4 -0
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +10 -2
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +3 -3
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js +2 -2
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +2 -2
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +2 -2
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +1 -0
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +6 -0
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.js +1 -0
- package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +2 -2
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +3 -1
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
- 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/messageCodecs.d.ts +4 -0
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +12 -4
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormat.d.ts +1 -0
- package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormat.js +6 -0
- package/dist/shared-tree-core/messageFormat.js.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +2 -2
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js +1 -0
- package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +1 -0
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +2 -2
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +148 -29
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +180 -99
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts +1 -1
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/core/allowedTypes.d.ts +1 -1
- package/dist/simple-tree/core/allowedTypes.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +17 -12
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +88 -8
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts +4 -4
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +3 -3
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +3 -3
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +9 -16
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/common.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/common.js +1 -1
- package/dist/simple-tree/node-kinds/common.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +2 -2
- package/dist/simple-tree/node-kinds/map/mapNode.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 +19 -19
- package/dist/simple-tree/node-kinds/object/objectNode.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 +4 -2
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/prepareForInsertion.d.ts +54 -47
- package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/dist/simple-tree/prepareForInsertion.js +183 -125
- package/dist/simple-tree/prepareForInsertion.js.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +8 -3
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +59 -19
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +3 -3
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +48 -32
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +12 -2
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/bTreeUtils.d.ts.map +1 -1
- package/dist/util/bTreeUtils.js +6 -6
- package/dist/util/bTreeUtils.js.map +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +2 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/rangeMap.d.ts +23 -11
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +42 -10
- package/dist/util/rangeMap.js.map +1 -1
- package/lib/alpha.d.ts +3 -3
- package/lib/beta.d.ts +1 -0
- package/lib/codec/codec.d.ts +3 -39
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +4 -47
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/index.d.ts +1 -1
- package/lib/codec/index.d.ts.map +1 -1
- package/lib/codec/index.js +1 -1
- package/lib/codec/index.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts +20 -7
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js +59 -33
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/core/change-family/changeFamily.d.ts +4 -1
- 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/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 -3
- 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/changeRebaser.d.ts +6 -1
- package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
- package/lib/core/rebase/changeRebaser.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/types.d.ts +1 -0
- 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/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +25 -7
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/tree/delta.d.ts +5 -0
- 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 +13 -1
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +15 -2
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.js +6 -4
- package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexTypes.d.ts +4 -0
- package/lib/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
- package/lib/core/tree/index.d.ts +2 -2
- 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/pathTree.d.ts +11 -3
- package/lib/core/tree/pathTree.d.ts.map +1 -1
- package/lib/core/tree/pathTree.js +12 -1
- package/lib/core/tree/pathTree.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +17 -13
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/extensibleUnionNode.d.ts +97 -0
- package/lib/extensibleUnionNode.d.ts.map +1 -0
- package/lib/{extensibleSchemaUnion.js → extensibleUnionNode.js} +28 -18
- package/lib/extensibleUnionNode.js.map +1 -0
- package/lib/feature-libraries/changeAtomIdBTree.d.ts +3 -2
- package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
- package/lib/feature-libraries/changeAtomIdBTree.js +15 -3
- package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +5 -5
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +92 -44
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +217 -69
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +12 -2
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +2 -1
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js +2 -1
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +40 -0
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js +149 -0
- package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js.map +1 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +7 -6
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js +15 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
- package/lib/feature-libraries/deltaUtils.d.ts +1 -0
- package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
- package/lib/feature-libraries/deltaUtils.js +5 -1
- package/lib/feature-libraries/deltaUtils.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.d.ts +9 -0
- package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js +6 -0
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts +8 -7
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +40 -9
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js +8 -2
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts +3 -3
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV1.d.ts +2 -3
- package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV1.js +1 -2
- package/lib/feature-libraries/forest-summary/formatV1.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV2.d.ts +2 -3
- package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV2.js +1 -2
- package/lib/feature-libraries/forest-summary/formatV2.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +3 -3
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +3 -3
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.js +2 -2
- package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +100 -24
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js +7 -10
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +85 -51
- 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/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +4 -9
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +3 -3
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +1 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +20 -24
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +268 -145
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV3.d.ts +15 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV3.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV3.js +292 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV3.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +8 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +56 -22
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1387 -468
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +1 -2
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV3.d.ts +74 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV3.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV3.js +32 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormatV3.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +49 -10
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts +13 -32
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +254 -442
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +23 -0
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +1 -0
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +27 -0
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +1 -0
- package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +31 -31
- package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +55 -26
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +12 -0
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +1 -0
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js +53 -0
- package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js.map +1 -0
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +5 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/optional-field/requiredField.d.ts +3 -2
- package/lib/feature-libraries/optional-field/requiredField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/requiredField.js +5 -1
- package/lib/feature-libraries/optional-field/requiredField.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +6 -4
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.d.ts +6 -7
- package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +83 -261
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/helperTypes.d.ts +14 -10
- package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.js +67 -169
- package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
- package/lib/feature-libraries/sequence-field/markQueue.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +4 -56
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.js +6 -84
- package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.js +111 -118
- package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/replaceRevisions.js +19 -32
- package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +2 -3
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +22 -4
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +379 -182
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +21 -63
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -13
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +3 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +16 -111
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/lib/feature-libraries/sequence-field/types.d.ts +37 -74
- package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/types.js.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.d.ts +20 -25
- package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +155 -313
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +1 -0
- 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/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +1 -1
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts +4 -4
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +3 -2
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +1 -5
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +24 -38
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +9 -3
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +4 -1
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -0
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +9 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +4 -4
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +3 -3
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts +16 -6
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.js +12 -6
- package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/lib/shared-tree/tree.d.ts +1 -1
- package/lib/shared-tree/tree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +1 -1
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +13 -11
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +61 -13
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +3 -2
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +4 -3
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +2 -2
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +9 -9
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +4 -0
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +8 -1
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +3 -3
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js +2 -2
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +2 -2
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js +2 -2
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +2 -2
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +2 -2
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +1 -0
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +6 -0
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.js +1 -0
- package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +2 -2
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +2 -2
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
- 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/messageCodecs.d.ts +4 -0
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +10 -3
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormat.d.ts +1 -0
- package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormat.js +6 -0
- package/lib/shared-tree-core/messageFormat.js.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +2 -2
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js +1 -0
- package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +1 -0
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -1
- 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/snapshotCompatibilityChecker.d.ts +148 -29
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +179 -98
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts +1 -1
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/core/allowedTypes.d.ts +1 -1
- package/lib/simple-tree/core/allowedTypes.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +17 -12
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +87 -8
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts +4 -4
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +3 -3
- 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/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +11 -18
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/common.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/common.js +2 -2
- package/lib/simple-tree/node-kinds/common.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +2 -2
- package/lib/simple-tree/node-kinds/map/mapNode.js.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 +20 -20
- package/lib/simple-tree/node-kinds/object/objectNode.js.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 +4 -2
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/prepareForInsertion.d.ts +54 -47
- package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/lib/simple-tree/prepareForInsertion.js +184 -125
- package/lib/simple-tree/prepareForInsertion.js.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +8 -3
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +56 -17
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +3 -3
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +30 -14
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +13 -3
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/bTreeUtils.d.ts.map +1 -1
- package/lib/util/bTreeUtils.js +6 -6
- package/lib/util/bTreeUtils.js.map +1 -1
- package/lib/util/index.d.ts +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/rangeMap.d.ts +23 -11
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +40 -9
- package/lib/util/rangeMap.js.map +1 -1
- package/package.json +23 -23
- package/src/codec/codec.ts +10 -112
- package/src/codec/index.ts +0 -3
- package/src/codec/versioned/codec.ts +119 -83
- package/src/core/change-family/changeFamily.ts +5 -0
- package/src/core/change-family/index.ts +1 -0
- package/src/core/index.ts +4 -1
- package/src/core/rebase/changeRebaser.ts +6 -1
- package/src/core/rebase/index.ts +1 -0
- package/src/core/rebase/types.ts +4 -0
- package/src/core/rebase/utils.ts +31 -7
- package/src/core/tree/delta.ts +6 -0
- package/src/core/tree/detachedFieldIndex.ts +29 -1
- package/src/core/tree/detachedFieldIndexCodecs.ts +6 -4
- package/src/core/tree/detachedFieldIndexTypes.ts +5 -0
- package/src/core/tree/index.ts +13 -12
- package/src/core/tree/pathTree.ts +16 -4
- package/src/core/tree/visitDelta.ts +31 -11
- package/src/{extensibleSchemaUnion.ts → extensibleUnionNode.ts} +61 -19
- package/src/feature-libraries/changeAtomIdBTree.ts +28 -3
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +5 -11
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +369 -127
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +13 -4
- package/src/feature-libraries/default-schema/index.ts +16 -5
- package/src/feature-libraries/default-schema/locationBasedEditBuilder.ts +231 -0
- package/src/feature-libraries/default-schema/mappedEditBuilder.ts +35 -9
- package/src/feature-libraries/deltaUtils.ts +6 -1
- package/src/feature-libraries/flex-tree/context.ts +17 -0
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +7 -8
- package/src/feature-libraries/flex-tree/lazyField.ts +65 -24
- package/src/feature-libraries/forest-summary/codec.ts +8 -7
- package/src/feature-libraries/forest-summary/formatCommon.ts +5 -3
- package/src/feature-libraries/forest-summary/formatV1.ts +1 -3
- package/src/feature-libraries/forest-summary/formatV2.ts +1 -3
- package/src/feature-libraries/index.ts +22 -9
- package/src/feature-libraries/mitigatedChangeFamily.ts +3 -1
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +144 -47
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +113 -58
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +7 -18
- package/src/feature-libraries/modular-schema/index.ts +16 -16
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +626 -352
- package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +1 -0
- package/src/feature-libraries/modular-schema/modularChangeCodecV3.ts +649 -0
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +14 -0
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +2694 -748
- package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +1 -0
- package/src/feature-libraries/modular-schema/modularChangeFormatV2.ts +1 -1
- package/src/feature-libraries/modular-schema/modularChangeFormatV3.ts +67 -0
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +62 -10
- package/src/feature-libraries/optional-field/optionalField.ts +359 -568
- package/src/feature-libraries/optional-field/optionalFieldChangeFormatV3.ts +45 -0
- package/src/feature-libraries/optional-field/optionalFieldChangeTypes.ts +31 -35
- package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +89 -35
- package/src/feature-libraries/optional-field/optionalFieldCodecV3.ts +94 -0
- package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +5 -1
- package/src/feature-libraries/optional-field/requiredField.ts +15 -2
- package/src/feature-libraries/schema-index/codec.ts +6 -4
- package/src/feature-libraries/sequence-field/compose.ts +137 -522
- package/src/feature-libraries/sequence-field/helperTypes.ts +34 -19
- package/src/feature-libraries/sequence-field/invert.ts +102 -228
- package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
- package/src/feature-libraries/sequence-field/moveEffectTable.ts +8 -195
- package/src/feature-libraries/sequence-field/rebase.ts +171 -207
- package/src/feature-libraries/sequence-field/replaceRevisions.ts +26 -52
- package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +8 -3
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +677 -229
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +56 -70
- package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +28 -30
- package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +21 -131
- package/src/feature-libraries/sequence-field/types.ts +40 -79
- package/src/feature-libraries/sequence-field/utils.ts +211 -370
- package/src/index.ts +3 -3
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +12 -6
- package/src/shared-tree/index.ts +3 -2
- package/src/shared-tree/schematizeTree.ts +21 -8
- package/src/shared-tree/schematizingTreeView.ts +38 -68
- package/src/shared-tree/sharedTree.ts +30 -15
- package/src/shared-tree/sharedTreeChangeCodecs.ts +10 -2
- package/src/shared-tree/sharedTreeChangeFamily.ts +7 -4
- package/src/shared-tree/sharedTreeEditBuilder.ts +43 -8
- package/src/shared-tree/tree.ts +1 -1
- package/src/shared-tree/treeAlpha.ts +1 -1
- package/src/shared-tree/treeCheckout.ts +95 -21
- package/src/shared-tree-core/branch.ts +8 -2
- package/src/shared-tree-core/editManager.ts +16 -2
- package/src/shared-tree-core/editManagerCodecs.ts +11 -1
- package/src/shared-tree-core/editManagerCodecsCommons.ts +7 -7
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +3 -10
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +3 -10
- package/src/shared-tree-core/editManagerFormatCommons.ts +6 -0
- package/src/shared-tree-core/editManagerFormatV1toV4.ts +3 -1
- package/src/shared-tree-core/index.ts +2 -0
- package/src/shared-tree-core/messageCodecV1ToV4.ts +2 -1
- package/src/shared-tree-core/messageCodecs.ts +13 -7
- package/src/shared-tree-core/messageFormat.ts +6 -0
- package/src/shared-tree-core/messageFormatV1ToV4.ts +3 -1
- package/src/shared-tree-core/sharedTreeCore.ts +4 -1
- package/src/simple-tree/api/index.ts +2 -2
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +344 -142
- package/src/simple-tree/api/tree.ts +1 -1
- package/src/simple-tree/api/treeBeta.ts +1 -1
- package/src/simple-tree/core/allowedTypes.ts +1 -1
- package/src/simple-tree/core/unhydratedFlexTree.ts +124 -35
- package/src/simple-tree/fieldSchema.ts +6 -4
- package/src/simple-tree/index.ts +4 -3
- package/src/simple-tree/node-kinds/array/arrayNode.ts +20 -24
- package/src/simple-tree/node-kinds/common.ts +2 -5
- package/src/simple-tree/node-kinds/map/mapNode.ts +4 -4
- package/src/simple-tree/node-kinds/object/objectNode.ts +26 -26
- package/src/simple-tree/node-kinds/record/recordNode.ts +10 -9
- package/src/simple-tree/prepareForInsertion.ts +342 -200
- package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +83 -22
- package/src/text/textDomainFormatted.ts +37 -17
- package/src/treeFactory.ts +16 -4
- package/src/util/bTreeUtils.ts +10 -6
- package/src/util/index.ts +3 -0
- package/src/util/rangeMap.ts +67 -22
- package/api-extractor-lint.json +0 -4
- package/dist/extensibleSchemaUnion.d.ts +0 -72
- package/dist/extensibleSchemaUnion.d.ts.map +0 -1
- package/dist/extensibleSchemaUnion.js.map +0 -1
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +0 -9
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +0 -1
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js +0 -50
- package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +0 -1
- package/docs/main/sequence-field/move-composition.md +0 -46
- package/lib/extensibleSchemaUnion.d.ts +0 -72
- package/lib/extensibleSchemaUnion.d.ts.map +0 -1
- package/lib/extensibleSchemaUnion.js.map +0 -1
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +0 -9
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +0 -1
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js +0 -46
- package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js.map +0 -1
- package/src/feature-libraries/sequence-field/relevantRemovedRoots.ts +0 -57
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { assert, unreachableCase, fail } from "@fluidframework/core-utils/internal";
|
|
6
|
-
import {
|
|
7
|
-
import { CrossFieldTarget, } from "../modular-schema/index.js";
|
|
6
|
+
import { areEqualChangeAtomIdOpts, areEqualChangeAtomIds, } from "../../core/index.js";
|
|
8
7
|
import { MarkListFactory } from "./markListFactory.js";
|
|
9
8
|
import { MarkQueue } from "./markQueue.js";
|
|
10
|
-
import {
|
|
11
|
-
import { NoopMarkType, } from "./types.js";
|
|
12
|
-
import { CellOrder, areEqualCellIds, areInputCellsEmpty, areOutputCellsEmpty, asAttachAndDetach, cellSourcesFromMarks, compareCellPositionsUsingTombstones, extractMarkEffect, getEndpoint, getInputCellId, getOutputCellId, isAttach, isAttachAndDetachEffect, isDetach, isImpactfulCellRename, isNewAttach, isNoopMark, isRename, markEmptiesCells, markFillsCells, markHasCellEffect, normalizeCellRename, settleMark, withNodeChange, withRevision, } from "./utils.js";
|
|
9
|
+
import { CellOrder, areEqualCellIds, areInputCellsEmpty, areOutputCellsEmpty, cellSourcesFromMarks, compareCellPositionsUsingTombstones, extractMarkEffect, getAttachedRootId, getDetachOutputCellId, getDetachedRootId, getInputCellId, getMovedNodeId, getOutputCellId, isAttach, isDetach, isNewAttach, isNoopMark, isPin, isRename, markEmptiesCells, markHasCellEffect, normalizeCellRename, withNodeChange, } from "./utils.js";
|
|
13
10
|
/**
|
|
14
11
|
* Composes a sequence of changesets into a single changeset.
|
|
15
12
|
* @param changes - The changesets to be applied.
|
|
@@ -30,26 +27,8 @@ function composeMarkLists(baseMarkList, newMarkList, composeChild, moveEffects,
|
|
|
30
27
|
const queue = new ComposeQueue(baseMarkList, newMarkList, moveEffects, revisionMetadata);
|
|
31
28
|
while (!queue.isEmpty()) {
|
|
32
29
|
const { baseMark, newMark } = queue.pop();
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
factory.push(composeMark(baseMark, moveEffects, (node) => composeChildChanges(node, undefined, composeChild)));
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
// We only compose changesets that will not be further rebased.
|
|
39
|
-
// It is therefore safe to remove any intentions that have no impact in the context they apply to.
|
|
40
|
-
const settledNewMark = settleMark(newMark);
|
|
41
|
-
if (baseMark === undefined) {
|
|
42
|
-
factory.push(composeMark(settledNewMark, moveEffects, (node) => composeChildChanges(undefined, node, composeChild)));
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
// Past this point, we are guaranteed that `settledNewMark` and `baseMark` have the same length and
|
|
46
|
-
// start at the same location in the revision after the base changes.
|
|
47
|
-
// They therefore refer to the same range for that revision.
|
|
48
|
-
const settledBaseMark = settleMark(baseMark);
|
|
49
|
-
const composedMark = composeMarks(settledBaseMark, settledNewMark, composeChild, moveEffects);
|
|
50
|
-
factory.push(composedMark);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
30
|
+
const composedMark = composeMarks(baseMark, newMark, composeChild, moveEffects);
|
|
31
|
+
factory.push(composedMark);
|
|
53
32
|
}
|
|
54
33
|
return factory.list;
|
|
55
34
|
}
|
|
@@ -64,128 +43,64 @@ function composeMarkLists(baseMarkList, newMarkList, composeChild, moveEffects,
|
|
|
64
43
|
*/
|
|
65
44
|
function composeMarks(baseMark, newMark, composeChild, moveEffects) {
|
|
66
45
|
const nodeChange = handleNodeChanges(baseMark, newMark, composeChild, moveEffects);
|
|
67
|
-
return
|
|
46
|
+
return withNodeChange(composeMarksIgnoreChild(baseMark, newMark, moveEffects), nodeChange);
|
|
68
47
|
}
|
|
69
48
|
function composeMarksIgnoreChild(baseMark, newMark, moveEffects) {
|
|
70
49
|
if (isNoopMark(baseMark)) {
|
|
71
50
|
return newMark;
|
|
72
51
|
}
|
|
73
52
|
else if (isNoopMark(newMark)) {
|
|
74
|
-
return baseMark;
|
|
53
|
+
return updateBaseMarkId(moveEffects, baseMark);
|
|
75
54
|
}
|
|
76
55
|
if (isRename(baseMark) && isRename(newMark)) {
|
|
56
|
+
if (areEqualChangeAtomIdOpts(baseMark.cellId, newMark.idOverride)) {
|
|
57
|
+
return createNoopMark(baseMark.count, undefined, baseMark.cellId);
|
|
58
|
+
}
|
|
77
59
|
return { ...baseMark, idOverride: newMark.idOverride };
|
|
78
60
|
}
|
|
79
61
|
else if (isRename(baseMark)) {
|
|
80
|
-
assert(isAttach(newMark)
|
|
62
|
+
assert(isAttach(newMark), 0x9f1 /* Unexpected mark type */);
|
|
63
|
+
assert(baseMark.cellId !== undefined && newMark.cellId !== undefined, "Expected marks to target an empty cell");
|
|
81
64
|
return { ...newMark, cellId: baseMark.cellId };
|
|
82
65
|
}
|
|
83
66
|
else if (isRename(newMark)) {
|
|
84
|
-
assert(isDetach(baseMark)
|
|
85
|
-
return
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
assert(isMoveOut(baseMark), 0x808 /* Unexpected mark type */);
|
|
102
|
-
// The base changeset and new changeset both move these nodes.
|
|
103
|
-
// Call the original position of the nodes A, the position after the base changeset is applied B,
|
|
104
|
-
// and the position after the new changeset is applied C.
|
|
105
|
-
// The new changeset moves the nodes from B, temporarily returns them to A, and then moves them to C.
|
|
106
|
-
// The composition of the base and new changesets will be a move directly from A to C,
|
|
107
|
-
// since the move from A to B cancels out with the return from B to A.
|
|
108
|
-
// This if-block is handling marks at A.
|
|
109
|
-
// When we compose the marks at B we will link the start of the base move (A to B)
|
|
110
|
-
// with the end of the new move (B to C).
|
|
111
|
-
// Because we are replacing the mark representing the start of the move with the new changeset's
|
|
112
|
-
// move-out from A, we update the base move-in at B to consider that its start point.
|
|
113
|
-
const newDetachId = {
|
|
114
|
-
revision: newDetachRevision,
|
|
115
|
-
localId: newAttachAndDetach.detach.id,
|
|
116
|
-
};
|
|
117
|
-
setTruncatedEndpointForInner(moveEffects, CrossFieldTarget.Destination, getEndpoint(baseMark), baseMark.count, newDetachId);
|
|
118
|
-
const newEndpoint = getComposedEndpoint(moveEffects, CrossFieldTarget.Source, baseMark.revision, baseMark.id, baseMark.count);
|
|
119
|
-
if (newEndpoint !== undefined) {
|
|
120
|
-
changeFinalEndpoint(newDetach, newEndpoint);
|
|
121
|
-
setTruncatedEndpoint(moveEffects, CrossFieldTarget.Destination, newEndpoint, baseMark.count, newDetachId);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return newDetach;
|
|
125
|
-
}
|
|
126
|
-
if (isImpactfulCellRename(baseMark)) {
|
|
127
|
-
assert(baseMark.cellId !== undefined, 0x9f4 /* Impactful cell rename must target empty cell */);
|
|
128
|
-
const baseAttachAndDetach = asAttachAndDetach(baseMark);
|
|
129
|
-
const newOutputId = getOutputCellId(newAttachAndDetach);
|
|
130
|
-
const originalAttach = { ...baseAttachAndDetach.attach };
|
|
131
|
-
const finalDetach = { ...newAttachAndDetach.detach };
|
|
132
|
-
handleMovePivot(baseMark.count, originalAttach, finalDetach, moveEffects);
|
|
133
|
-
if (areEqualCellIds(newOutputId, baseAttachAndDetach.cellId)) {
|
|
134
|
-
return { count: baseAttachAndDetach.count, cellId: baseAttachAndDetach.cellId };
|
|
67
|
+
assert(isDetach(baseMark), 0x9f2 /* Unexpected mark type */);
|
|
68
|
+
return updateBaseMarkId(moveEffects, { ...baseMark, cellRename: newMark.idOverride });
|
|
69
|
+
}
|
|
70
|
+
if (!markHasCellEffect(baseMark)) {
|
|
71
|
+
assert(baseMark.type === "Attach", "Expected baseMark to be a pin");
|
|
72
|
+
// `newMark` can be either a remove or another pin.
|
|
73
|
+
// A pin is treated as a detach and attach, so we call `composeAttachDetach` in either case.
|
|
74
|
+
moveEffects.composeAttachDetach(getAttachedRootId(baseMark), {
|
|
75
|
+
revision: newMark.revision,
|
|
76
|
+
localId: newMark.id,
|
|
77
|
+
}, baseMark.count);
|
|
78
|
+
const pinId = getAttachedRootId(baseMark);
|
|
79
|
+
return newMark.type === "Detach"
|
|
80
|
+
? {
|
|
81
|
+
...newMark,
|
|
82
|
+
detachCellId: baseMark.detachCellId ?? pinId,
|
|
83
|
+
cellRename: getDetachOutputCellId(newMark),
|
|
135
84
|
}
|
|
136
|
-
|
|
137
|
-
const detachRevision = finalDetach.revision;
|
|
138
|
-
if (detachRevision !== undefined) {
|
|
139
|
-
finalDetach.revision = detachRevision;
|
|
140
|
-
}
|
|
141
|
-
return normalizeCellRename(baseMark.cellId, baseMark.count, originalAttach, finalDetach);
|
|
142
|
-
}
|
|
143
|
-
return normalizeCellRename(newAttachAndDetach.cellId, newAttachAndDetach.count, newAttachAndDetach.attach, newAttachAndDetach.detach);
|
|
144
|
-
}
|
|
145
|
-
if (isImpactfulCellRename(baseMark)) {
|
|
146
|
-
const baseAttachAndDetach = asAttachAndDetach(baseMark);
|
|
147
|
-
if (markFillsCells(newMark)) {
|
|
148
|
-
const originalAttach = withRevision({
|
|
149
|
-
...baseAttachAndDetach.attach,
|
|
150
|
-
cellId: baseAttachAndDetach.cellId,
|
|
151
|
-
count: baseAttachAndDetach.count,
|
|
152
|
-
}, baseAttachAndDetach.attach.revision);
|
|
153
|
-
if (isMoveIn(baseAttachAndDetach.attach) && isMoveOut(baseAttachAndDetach.detach)) {
|
|
154
|
-
assert(isMoveIn(newMark), 0x809 /* Unexpected mark type */);
|
|
155
|
-
const originalAttachId = {
|
|
156
|
-
revision: baseAttachAndDetach.attach.revision,
|
|
157
|
-
localId: baseAttachAndDetach.attach.id,
|
|
158
|
-
};
|
|
159
|
-
setTruncatedEndpointForInner(moveEffects, CrossFieldTarget.Source, getEndpoint(newMark), baseAttachAndDetach.count, originalAttachId);
|
|
160
|
-
const newEndpoint = getComposedEndpoint(moveEffects, CrossFieldTarget.Destination, newMark.revision, newMark.id, newMark.count);
|
|
161
|
-
if (newEndpoint !== undefined) {
|
|
162
|
-
changeFinalEndpoint(originalAttach, newEndpoint);
|
|
163
|
-
setTruncatedEndpoint(moveEffects, CrossFieldTarget.Source, newEndpoint, baseMark.count, originalAttachId);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return originalAttach;
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
// Other mark types have been handled by previous conditional branches.
|
|
170
|
-
assert(newMark.type === NoopMarkType, 0x80a /* Unexpected mark type */);
|
|
171
|
-
return baseMark;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
if (!markHasCellEffect(baseMark) && !markHasCellEffect(newMark)) {
|
|
175
|
-
return createNoopMark(newMark.count, undefined, getInputCellId(baseMark));
|
|
176
|
-
}
|
|
177
|
-
else if (!markHasCellEffect(baseMark)) {
|
|
178
|
-
return newMark;
|
|
85
|
+
: newMark;
|
|
179
86
|
}
|
|
180
87
|
else if (!markHasCellEffect(newMark)) {
|
|
181
|
-
|
|
88
|
+
if (isAttach(newMark) && isAttach(baseMark)) {
|
|
89
|
+
// When composing two inserts, the second insert (which is a pin) should take precedence.
|
|
90
|
+
// We treat the pin as a detach and reattach.
|
|
91
|
+
moveEffects.composeAttachDetach(getAttachedRootId(baseMark), getAttachedRootId(newMark), baseMark.count);
|
|
92
|
+
const composed = { cellId: baseMark.cellId, ...newMark };
|
|
93
|
+
delete composed.detachCellId;
|
|
94
|
+
return composed;
|
|
95
|
+
}
|
|
96
|
+
return updateBaseMarkId(moveEffects, baseMark);
|
|
182
97
|
}
|
|
183
98
|
else if (areInputCellsEmpty(baseMark)) {
|
|
184
99
|
assert(isDetach(newMark), 0x71c /* Unexpected mark type */);
|
|
185
100
|
assert(isAttach(baseMark), 0x71d /* Expected generative mark */);
|
|
186
101
|
const attach = extractMarkEffect(baseMark);
|
|
187
102
|
const detach = extractMarkEffect(newMark);
|
|
188
|
-
|
|
103
|
+
moveEffects.composeAttachDetach(getAttachedRootId(baseMark), getDetachedRootId(newMark), baseMark.count);
|
|
189
104
|
if (areEqualCellIds(getOutputCellId(newMark), baseMark.cellId)) {
|
|
190
105
|
// The output and input cell IDs are the same, so this mark has no effect.
|
|
191
106
|
return { count: baseMark.count, cellId: baseMark.cellId };
|
|
@@ -193,37 +108,36 @@ function composeMarksIgnoreChild(baseMark, newMark, moveEffects) {
|
|
|
193
108
|
return normalizeCellRename(baseMark.cellId, baseMark.count, attach, detach);
|
|
194
109
|
}
|
|
195
110
|
else {
|
|
196
|
-
|
|
197
|
-
|
|
111
|
+
assert(baseMark.type === "Detach", "Unexpected mark type");
|
|
112
|
+
assert(newMark.type === "Attach", "Unexpected mark type");
|
|
113
|
+
const detachId = getDetachedRootId(baseMark);
|
|
114
|
+
const attachId = getAttachedRootId(newMark);
|
|
115
|
+
moveEffects.composeDetachAttach(detachId, attachId, baseMark.count, true);
|
|
116
|
+
// The composition has no net effect but we preserve the second change's intention to pin the nodes here.
|
|
117
|
+
const composedMark = { ...newMark };
|
|
118
|
+
delete composedMark.cellId;
|
|
119
|
+
const baseDetachCellId = baseMark.detachCellId ?? detachId;
|
|
120
|
+
if (!areEqualChangeAtomIds(baseDetachCellId, attachId)) {
|
|
121
|
+
composedMark.detachCellId = baseDetachCellId;
|
|
122
|
+
}
|
|
123
|
+
return composedMark;
|
|
198
124
|
}
|
|
199
125
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
setEndpoint(moveEffects, CrossFieldTarget.Source, finalSource, count, finalDest);
|
|
213
|
-
const truncatedEndpoint1 = getTruncatedEndpointForInner(moveEffects, CrossFieldTarget.Destination, baseAttach.revision, baseAttach.id, count);
|
|
214
|
-
if (truncatedEndpoint1 !== undefined) {
|
|
215
|
-
setTruncatedEndpoint(moveEffects, CrossFieldTarget.Destination, finalDest, count, truncatedEndpoint1);
|
|
216
|
-
}
|
|
217
|
-
setEndpoint(moveEffects, CrossFieldTarget.Destination, finalDest, count, finalSource);
|
|
218
|
-
const truncatedEndpoint2 = getTruncatedEndpointForInner(moveEffects, CrossFieldTarget.Source, newDetach.revision, newDetach.id, count);
|
|
219
|
-
if (truncatedEndpoint2 !== undefined) {
|
|
220
|
-
setTruncatedEndpoint(moveEffects, CrossFieldTarget.Source, finalSource, count, truncatedEndpoint2);
|
|
126
|
+
function updateBaseMarkId(moveEffects, baseMark) {
|
|
127
|
+
if (isDetach(baseMark)) {
|
|
128
|
+
const baseDetachId = getDetachedRootId(baseMark);
|
|
129
|
+
const updatedDetachId = getUpdatedDetachId(moveEffects, baseMark);
|
|
130
|
+
if (updatedDetachId !== undefined &&
|
|
131
|
+
!areEqualChangeAtomIds(updatedDetachId, baseDetachId)) {
|
|
132
|
+
return {
|
|
133
|
+
...baseMark,
|
|
134
|
+
revision: updatedDetachId.revision,
|
|
135
|
+
id: updatedDetachId.localId,
|
|
136
|
+
detachCellId: baseMark.detachCellId ?? baseDetachId,
|
|
137
|
+
};
|
|
221
138
|
}
|
|
222
|
-
// The `finalEndpoint` field of AttachAndDetach move effect pairs is not used,
|
|
223
|
-
// so we remove it as a normalization.
|
|
224
|
-
delete baseAttach.finalEndpoint;
|
|
225
|
-
delete newDetach.finalEndpoint;
|
|
226
139
|
}
|
|
140
|
+
return baseMark;
|
|
227
141
|
}
|
|
228
142
|
function createNoopMark(length, nodeChange, cellId) {
|
|
229
143
|
const mark = { count: length };
|
|
@@ -237,14 +151,13 @@ function createNoopMark(length, nodeChange, cellId) {
|
|
|
237
151
|
return mark;
|
|
238
152
|
}
|
|
239
153
|
function handleNodeChanges(baseMark, newMark, composeChild, moveEffects) {
|
|
240
|
-
if (newMark.changes !== undefined
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
return undefined;
|
|
246
|
-
}
|
|
154
|
+
if (newMark.changes !== undefined &&
|
|
155
|
+
baseMark.type === "Attach" &&
|
|
156
|
+
baseMark.cellId !== undefined) {
|
|
157
|
+
moveEffects.sendNewChangesToBaseSourceLocation(getAttachedRootId(baseMark), newMark.changes);
|
|
158
|
+
return undefined;
|
|
247
159
|
}
|
|
160
|
+
// TODO: Make sure composeChild is not called twice on the node changes.
|
|
248
161
|
return composeChildChanges(baseMark.changes, newMark.changes, composeChild);
|
|
249
162
|
}
|
|
250
163
|
function composeChildChanges(baseChange, newChange, composeChild) {
|
|
@@ -253,17 +166,15 @@ function composeChildChanges(baseChange, newChange, composeChild) {
|
|
|
253
166
|
}
|
|
254
167
|
return composeChild(baseChange, newChange);
|
|
255
168
|
}
|
|
256
|
-
function composeMark(mark, moveEffects, composeChild) {
|
|
257
|
-
const nodeChanges = mark.changes === undefined ? undefined : composeChild(mark.changes);
|
|
258
|
-
const updatedMark = withUpdatedEndpoint(mark, mark.count, moveEffects);
|
|
259
|
-
return withNodeChange(updatedMark, nodeChanges);
|
|
260
|
-
}
|
|
261
169
|
export class ComposeQueue {
|
|
262
170
|
constructor(baseMarks, newMarks, moveEffects, revisionMetadata) {
|
|
263
171
|
this.moveEffects = moveEffects;
|
|
264
172
|
this.revisionMetadata = revisionMetadata;
|
|
265
|
-
|
|
266
|
-
|
|
173
|
+
const queryFunc = (mark) => isDetach(mark) || isPin(mark)
|
|
174
|
+
? moveEffects.getNewChangesForBaseDetach(getMovedNodeId(mark), mark.count).length
|
|
175
|
+
: mark.count;
|
|
176
|
+
this.baseMarks = new MarkQueue(baseMarks, queryFunc);
|
|
177
|
+
this.newMarks = new MarkQueue(newMarks, (mark) => mark.count);
|
|
267
178
|
this.baseMarksCellSources = cellSourcesFromMarks(baseMarks, getOutputCellId);
|
|
268
179
|
this.newMarksCellSources = cellSourcesFromMarks(newMarks, getInputCellId);
|
|
269
180
|
}
|
|
@@ -274,7 +185,7 @@ export class ComposeQueue {
|
|
|
274
185
|
const baseMark = this.baseMarks.peek();
|
|
275
186
|
const newMark = this.newMarks.peek();
|
|
276
187
|
if (baseMark === undefined && newMark === undefined) {
|
|
277
|
-
|
|
188
|
+
fail("Should not pop when queue is empty");
|
|
278
189
|
}
|
|
279
190
|
else if (baseMark === undefined) {
|
|
280
191
|
return this.dequeueNew();
|
|
@@ -323,9 +234,6 @@ export class ComposeQueue {
|
|
|
323
234
|
dequeueBase(length = Number.POSITIVE_INFINITY) {
|
|
324
235
|
const baseMark = this.baseMarks.dequeueUpTo(length);
|
|
325
236
|
const movedChanges = getMovedChangesFromMark(this.moveEffects, baseMark);
|
|
326
|
-
if (movedChanges !== undefined) {
|
|
327
|
-
this.moveEffects.onMoveIn(movedChanges);
|
|
328
|
-
}
|
|
329
237
|
const newMark = createNoopMark(baseMark.count, movedChanges, getOutputCellId(baseMark));
|
|
330
238
|
return { baseMark, newMark };
|
|
331
239
|
}
|
|
@@ -359,100 +267,14 @@ export class ComposeQueue {
|
|
|
359
267
|
}
|
|
360
268
|
}
|
|
361
269
|
function getMovedChangesFromMark(moveEffects, markEffect) {
|
|
362
|
-
if (
|
|
363
|
-
return getMovedChangesFromMark(moveEffects, markEffect.detach);
|
|
364
|
-
}
|
|
365
|
-
if (!isMoveOut(markEffect)) {
|
|
270
|
+
if (!isDetach(markEffect)) {
|
|
366
271
|
return undefined;
|
|
367
272
|
}
|
|
368
|
-
return
|
|
369
|
-
|
|
370
|
-
// It is expected that the range from `id` to `id + count - 1` has the same move effect.
|
|
371
|
-
// The call sites to this function are making queries about a mark which has already been split by a `MarkQueue`
|
|
372
|
-
// to match the ranges in `moveEffects`.
|
|
373
|
-
// TODO: Reduce the duplication between this and other MoveEffect helpers
|
|
374
|
-
function getModifyAfter(moveEffects, revision, id) {
|
|
375
|
-
const target = CrossFieldTarget.Source;
|
|
376
|
-
const effect = getMoveEffect(moveEffects, target, revision, id, 1);
|
|
377
|
-
if (effect.value?.modifyAfter !== undefined) {
|
|
378
|
-
return effect.value.modifyAfter;
|
|
379
|
-
}
|
|
380
|
-
return undefined;
|
|
381
|
-
}
|
|
382
|
-
// TODO: Reduce the duplication between this and other MoveEffect helpers
|
|
383
|
-
function setModifyAfter(moveEffects, { revision, localId: id }, modifyAfter) {
|
|
384
|
-
const target = CrossFieldTarget.Source;
|
|
385
|
-
const count = 1;
|
|
386
|
-
const effect = getMoveEffect(moveEffects, target, revision, id, count, false);
|
|
387
|
-
const newEffect = effect.value === undefined ? { modifyAfter } : { ...effect.value, modifyAfter };
|
|
388
|
-
setMoveEffect(moveEffects, target, revision, id, count, newEffect);
|
|
389
|
-
}
|
|
390
|
-
function setEndpoint(moveEffects, target, id, count, endpoint) {
|
|
391
|
-
const effect = getMoveEffect(moveEffects, target, id.revision, id.localId, count, false);
|
|
392
|
-
const newEffect = effect.value === undefined ? { endpoint } : { ...effect.value, endpoint };
|
|
393
|
-
setMoveEffect(moveEffects, target, id.revision, id.localId, effect.length, newEffect);
|
|
394
|
-
const remainingCount = count - effect.length;
|
|
395
|
-
if (remainingCount > 0) {
|
|
396
|
-
setEndpoint(moveEffects, target, offsetChangeAtomId(id, effect.length), remainingCount, offsetChangeAtomId(endpoint, effect.length));
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
function setTruncatedEndpoint(moveEffects, target, id, count, truncatedEndpoint) {
|
|
400
|
-
const effect = getMoveEffect(moveEffects, target, id.revision, id.localId, count);
|
|
401
|
-
const newEffect = effect.value === undefined
|
|
402
|
-
? { truncatedEndpoint }
|
|
403
|
-
: { ...effect.value, truncatedEndpoint };
|
|
404
|
-
setMoveEffect(moveEffects, target, id.revision, id.localId, effect.length, newEffect);
|
|
405
|
-
const remainingCount = count - effect.length;
|
|
406
|
-
if (remainingCount > 0) {
|
|
407
|
-
setTruncatedEndpoint(moveEffects, target, offsetChangeAtomId(id, effect.length), remainingCount, offsetChangeAtomId(truncatedEndpoint, effect.length));
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
function setTruncatedEndpointForInner(moveEffects, target, id, count, truncatedEndpointForInner) {
|
|
411
|
-
const effect = getMoveEffect(moveEffects, target, id.revision, id.localId, count);
|
|
412
|
-
const newEffect = effect.value === undefined
|
|
413
|
-
? { truncatedEndpointForInner }
|
|
414
|
-
: { ...effect.value, truncatedEndpointForInner };
|
|
415
|
-
setMoveEffect(moveEffects, target, id.revision, id.localId, effect.length, newEffect);
|
|
416
|
-
const remainingCount = count - effect.length;
|
|
417
|
-
if (remainingCount > 0) {
|
|
418
|
-
setTruncatedEndpointForInner(moveEffects, target, offsetChangeAtomId(id, effect.length), remainingCount, offsetChangeAtomId(truncatedEndpointForInner, effect.length));
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
function withUpdatedEndpoint(mark, count, effects) {
|
|
422
|
-
if (isAttachAndDetachEffect(mark)) {
|
|
423
|
-
return {
|
|
424
|
-
...mark,
|
|
425
|
-
attach: withUpdatedEndpoint(mark.attach, count, effects),
|
|
426
|
-
detach: withUpdatedEndpoint(mark.detach, count, effects),
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
if (!isMoveMark(mark)) {
|
|
430
|
-
return mark;
|
|
431
|
-
}
|
|
432
|
-
const finalDest = getComposedEndpoint(effects, getCrossFieldTargetFromMove(mark), mark.revision, mark.id, count);
|
|
433
|
-
if (finalDest === undefined) {
|
|
434
|
-
return mark;
|
|
435
|
-
}
|
|
436
|
-
const output = { ...mark };
|
|
437
|
-
changeFinalEndpoint(output, finalDest);
|
|
438
|
-
return output;
|
|
439
|
-
}
|
|
440
|
-
function changeFinalEndpoint(mark, endpoint) {
|
|
441
|
-
if (areEqualCellIds(endpoint, { revision: mark.revision, localId: mark.id })) {
|
|
442
|
-
delete mark.finalEndpoint;
|
|
443
|
-
}
|
|
444
|
-
else {
|
|
445
|
-
mark.finalEndpoint = endpoint;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
function getComposedEndpoint(moveEffects, target, revision, id, count) {
|
|
449
|
-
const effect = getMoveEffect(moveEffects, target, revision, id, count);
|
|
450
|
-
assert(effect.length === count, 0x815 /* Expected effect to cover entire mark */);
|
|
451
|
-
return effect.value?.truncatedEndpoint ?? effect.value?.endpoint;
|
|
273
|
+
return moveEffects.getNewChangesForBaseDetach(getDetachedRootId(markEffect), 1).value
|
|
274
|
+
?.nodeChange;
|
|
452
275
|
}
|
|
453
|
-
function
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
return effect.value?.truncatedEndpointForInner;
|
|
276
|
+
function getUpdatedDetachId(manager, mark) {
|
|
277
|
+
return manager.getNewChangesForBaseDetach(getDetachedRootId(mark), mark.count).value
|
|
278
|
+
?.detachId;
|
|
457
279
|
}
|
|
458
280
|
//# sourceMappingURL=compose.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.js","sourceRoot":"","sources":["../../../src/feature-libraries/sequence-field/compose.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,qC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,EAC5B,MAAwB,EACxB,QAAiC,EACjC,EAAU,EACV,KAAa;IAEb,MAAM,MAAM,GAAG,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACvE,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,KAAK,EAAE,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAClF,OAAO,MAAM,CAAC,KAAK,EAAE,iBAAiB,IAAI,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC;AAClE,CAAC;AAED,SAAS,4BAA4B,CACpC,WAA4B,EAC5B,MAAwB,EACxB,QAAiC,EACjC,EAAU,EACV,KAAa;IAEb,MAAM,MAAM,GAAG,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACvE,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,KAAK,EAAE,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAClF,OAAO,MAAM,CAAC,KAAK,EAAE,yBAAyB,CAAC;AAChD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype ChangeAtomId,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n\toffsetChangeAtomId,\n} from \"../../core/index.js\";\nimport type { IdAllocator } from \"../../util/index.js\";\nimport {\n\ttype CrossFieldManager,\n\tCrossFieldTarget,\n\ttype NodeChangeComposer,\n\ttype NodeId,\n} from \"../modular-schema/index.js\";\n\nimport type { MoveMarkEffect } from \"./helperTypes.js\";\nimport { MarkListFactory } from \"./markListFactory.js\";\nimport { MarkQueue } from \"./markQueue.js\";\nimport {\n\ttype MoveEffect,\n\ttype MoveEffectTable,\n\tgetCrossFieldTargetFromMove,\n\tgetMoveEffect,\n\tgetMoveIn,\n\tisMoveIn,\n\tisMoveMark,\n\tisMoveOut,\n\tsetMoveEffect,\n} from \"./moveEffectTable.js\";\nimport {\n\ttype Attach,\n\ttype CellMark,\n\ttype Changeset,\n\ttype Detach,\n\ttype Mark,\n\ttype MarkEffect,\n\ttype MarkList,\n\ttype MoveId,\n\ttype NoopMark,\n\tNoopMarkType,\n} from \"./types.js\";\nimport {\n\tCellOrder,\n\tareEqualCellIds,\n\tareInputCellsEmpty,\n\tareOutputCellsEmpty,\n\tasAttachAndDetach,\n\tcellSourcesFromMarks,\n\tcompareCellPositionsUsingTombstones,\n\textractMarkEffect,\n\tgetEndpoint,\n\tgetInputCellId,\n\tgetOutputCellId,\n\tisAttach,\n\tisAttachAndDetachEffect,\n\tisDetach,\n\tisImpactfulCellRename,\n\tisNewAttach,\n\tisNoopMark,\n\tisRename,\n\tmarkEmptiesCells,\n\tmarkFillsCells,\n\tmarkHasCellEffect,\n\tnormalizeCellRename,\n\tsettleMark,\n\twithNodeChange,\n\twithRevision,\n} from \"./utils.js\";\n\n/**\n * Composes a sequence of changesets into a single changeset.\n * @param changes - The changesets to be applied.\n * Parts of the input may be reused in the output, but the input is not mutated.\n * Each changeset in the list is assumed to be applicable after the previous one.\n * @returns A changeset that is equivalent to applying each of the given `changes` in order.\n *\n * WARNING! This implementation is incomplete:\n * - Tombstone information is ignored.\n * - Support for moves is not implemented.\n * - Support for slices is not implemented.\n */\nexport function compose(\n\tchange1: Changeset,\n\tchange2: Changeset,\n\tcomposeChild: NodeChangeComposer,\n\t_genId: IdAllocator,\n\tmanager: CrossFieldManager,\n\trevisionMetadata: RevisionMetadataSource,\n): Changeset {\n\treturn composeMarkLists(\n\t\tchange1,\n\t\tchange2,\n\t\tcomposeChild,\n\t\tmanager as MoveEffectTable,\n\t\trevisionMetadata,\n\t);\n}\n\nfunction composeMarkLists(\n\tbaseMarkList: MarkList,\n\tnewMarkList: MarkList,\n\tcomposeChild: NodeChangeComposer,\n\tmoveEffects: MoveEffectTable,\n\trevisionMetadata: RevisionMetadataSource,\n): MarkList {\n\tconst factory = new MarkListFactory();\n\tconst queue = new ComposeQueue(baseMarkList, newMarkList, moveEffects, revisionMetadata);\n\twhile (!queue.isEmpty()) {\n\t\tconst { baseMark, newMark } = queue.pop();\n\t\tif (newMark === undefined) {\n\t\t\tassert(\n\t\t\t\tbaseMark !== undefined,\n\t\t\t\t0x4db /* Non-empty queue should not return two undefined marks */,\n\t\t\t);\n\t\t\tfactory.push(\n\t\t\t\tcomposeMark(baseMark, moveEffects, (node: NodeId) =>\n\t\t\t\t\tcomposeChildChanges(node, undefined, composeChild),\n\t\t\t\t),\n\t\t\t);\n\t\t} else {\n\t\t\t// We only compose changesets that will not be further rebased.\n\t\t\t// It is therefore safe to remove any intentions that have no impact in the context they apply to.\n\t\t\tconst settledNewMark = settleMark(newMark);\n\t\t\tif (baseMark === undefined) {\n\t\t\t\tfactory.push(\n\t\t\t\t\tcomposeMark(settledNewMark, moveEffects, (node: NodeId) =>\n\t\t\t\t\t\tcomposeChildChanges(undefined, node, composeChild),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Past this point, we are guaranteed that `settledNewMark` and `baseMark` have the same length and\n\t\t\t\t// start at the same location in the revision after the base changes.\n\t\t\t\t// They therefore refer to the same range for that revision.\n\t\t\t\tconst settledBaseMark = settleMark(baseMark);\n\t\t\t\tconst composedMark = composeMarks(\n\t\t\t\t\tsettledBaseMark,\n\t\t\t\t\tsettledNewMark,\n\t\t\t\t\tcomposeChild,\n\t\t\t\t\tmoveEffects,\n\t\t\t\t);\n\t\t\t\tfactory.push(composedMark);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn factory.list;\n}\n\n/**\n * Composes two marks where `newMark` is based on the state produced by `baseMark`.\n * @param baseMark - The mark to compose with `newMark`.\n * Its output range should be the same as `newMark`'s input range.\n * @param newRev - The revision the new mark is part of.\n * @param newMark - The mark to compose with `baseMark`.\n * Its input range should be the same as `baseMark`'s output range.\n * @returns A mark that is equivalent to applying both `baseMark` and `newMark` successively.\n */\nfunction composeMarks(\n\tbaseMark: Mark,\n\tnewMark: Mark,\n\tcomposeChild: NodeChangeComposer,\n\tmoveEffects: MoveEffectTable,\n): Mark {\n\tconst nodeChange = handleNodeChanges(baseMark, newMark, composeChild, moveEffects);\n\n\treturn withUpdatedEndpoint(\n\t\twithNodeChange(composeMarksIgnoreChild(baseMark, newMark, moveEffects), nodeChange),\n\t\tbaseMark.count,\n\t\tmoveEffects,\n\t);\n}\n\nfunction composeMarksIgnoreChild(\n\tbaseMark: Mark,\n\tnewMark: Mark,\n\tmoveEffects: MoveEffectTable,\n): Mark {\n\tif (isNoopMark(baseMark)) {\n\t\treturn newMark;\n\t} else if (isNoopMark(newMark)) {\n\t\treturn baseMark;\n\t}\n\n\tif (isRename(baseMark) && isRename(newMark)) {\n\t\treturn { ...baseMark, idOverride: newMark.idOverride };\n\t} else if (isRename(baseMark)) {\n\t\tassert(\n\t\t\tisAttach(newMark) || isAttachAndDetachEffect(newMark),\n\t\t\t0x9f1 /* Unexpected mark type */,\n\t\t);\n\t\treturn { ...newMark, cellId: baseMark.cellId };\n\t} else if (isRename(newMark)) {\n\t\tassert(\n\t\t\tisDetach(baseMark) || isAttachAndDetachEffect(baseMark),\n\t\t\t0x9f2 /* Unexpected mark type */,\n\t\t);\n\t\treturn isDetach(baseMark)\n\t\t\t? { ...baseMark, idOverride: newMark.idOverride }\n\t\t\t: { ...baseMark, detach: { ...baseMark.detach, idOverride: newMark.idOverride } };\n\t}\n\n\tif (isImpactfulCellRename(newMark)) {\n\t\tconst newAttachAndDetach = asAttachAndDetach(newMark);\n\t\tassert(\n\t\t\tnewAttachAndDetach.cellId !== undefined,\n\t\t\t0x9f3 /* Impactful cell rename must target empty cell */,\n\t\t);\n\t\tconst newDetachRevision = newAttachAndDetach.detach.revision;\n\t\tif (markEmptiesCells(baseMark)) {\n\t\t\t// baseMark is a detach which cancels with the attach portion of the AttachAndDetach,\n\t\t\t// so we are just left with the detach portion of the AttachAndDetach.\n\t\t\tconst newDetach: CellMark<Detach> = {\n\t\t\t\t...newAttachAndDetach.detach,\n\t\t\t\tcount: baseMark.count,\n\t\t\t};\n\n\t\t\tif (isMoveIn(newAttachAndDetach.attach) && isMoveOut(newAttachAndDetach.detach)) {\n\t\t\t\tassert(isMoveOut(baseMark), 0x808 /* Unexpected mark type */);\n\n\t\t\t\t// The base changeset and new changeset both move these nodes.\n\t\t\t\t// Call the original position of the nodes A, the position after the base changeset is applied B,\n\t\t\t\t// and the position after the new changeset is applied C.\n\t\t\t\t// The new changeset moves the nodes from B, temporarily returns them to A, and then moves them to C.\n\t\t\t\t// The composition of the base and new changesets will be a move directly from A to C,\n\t\t\t\t// since the move from A to B cancels out with the return from B to A.\n\t\t\t\t// This if-block is handling marks at A.\n\t\t\t\t// When we compose the marks at B we will link the start of the base move (A to B)\n\t\t\t\t// with the end of the new move (B to C).\n\t\t\t\t// Because we are replacing the mark representing the start of the move with the new changeset's\n\t\t\t\t// move-out from A, we update the base move-in at B to consider that its start point.\n\t\t\t\tconst newDetachId = {\n\t\t\t\t\trevision: newDetachRevision,\n\t\t\t\t\tlocalId: newAttachAndDetach.detach.id,\n\t\t\t\t};\n\n\t\t\t\tsetTruncatedEndpointForInner(\n\t\t\t\t\tmoveEffects,\n\t\t\t\t\tCrossFieldTarget.Destination,\n\t\t\t\t\tgetEndpoint(baseMark),\n\t\t\t\t\tbaseMark.count,\n\t\t\t\t\tnewDetachId,\n\t\t\t\t);\n\n\t\t\t\tconst newEndpoint = getComposedEndpoint(\n\t\t\t\t\tmoveEffects,\n\t\t\t\t\tCrossFieldTarget.Source,\n\t\t\t\t\tbaseMark.revision,\n\t\t\t\t\tbaseMark.id,\n\t\t\t\t\tbaseMark.count,\n\t\t\t\t);\n\n\t\t\t\tif (newEndpoint !== undefined) {\n\t\t\t\t\tchangeFinalEndpoint(newDetach as MoveMarkEffect, newEndpoint);\n\t\t\t\t\tsetTruncatedEndpoint(\n\t\t\t\t\t\tmoveEffects,\n\t\t\t\t\t\tCrossFieldTarget.Destination,\n\t\t\t\t\t\tnewEndpoint,\n\t\t\t\t\t\tbaseMark.count,\n\t\t\t\t\t\tnewDetachId,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn newDetach;\n\t\t}\n\n\t\tif (isImpactfulCellRename(baseMark)) {\n\t\t\tassert(\n\t\t\t\tbaseMark.cellId !== undefined,\n\t\t\t\t0x9f4 /* Impactful cell rename must target empty cell */,\n\t\t\t);\n\t\t\tconst baseAttachAndDetach = asAttachAndDetach(baseMark);\n\t\t\tconst newOutputId = getOutputCellId(newAttachAndDetach);\n\n\t\t\tconst originalAttach = { ...baseAttachAndDetach.attach };\n\t\t\tconst finalDetach = { ...newAttachAndDetach.detach };\n\n\t\t\thandleMovePivot(baseMark.count, originalAttach, finalDetach, moveEffects);\n\n\t\t\tif (areEqualCellIds(newOutputId, baseAttachAndDetach.cellId)) {\n\t\t\t\treturn { count: baseAttachAndDetach.count, cellId: baseAttachAndDetach.cellId };\n\t\t\t}\n\n\t\t\t// `newMark`'s attach portion cancels with `baseMark`'s detach portion.\n\t\t\tconst detachRevision = finalDetach.revision;\n\t\t\tif (detachRevision !== undefined) {\n\t\t\t\tfinalDetach.revision = detachRevision;\n\t\t\t}\n\n\t\t\treturn normalizeCellRename(baseMark.cellId, baseMark.count, originalAttach, finalDetach);\n\t\t}\n\n\t\treturn normalizeCellRename(\n\t\t\tnewAttachAndDetach.cellId,\n\t\t\tnewAttachAndDetach.count,\n\t\t\tnewAttachAndDetach.attach,\n\t\t\tnewAttachAndDetach.detach,\n\t\t);\n\t}\n\tif (isImpactfulCellRename(baseMark)) {\n\t\tconst baseAttachAndDetach = asAttachAndDetach(baseMark);\n\t\tif (markFillsCells(newMark)) {\n\t\t\tconst originalAttach = withRevision(\n\t\t\t\t{\n\t\t\t\t\t...baseAttachAndDetach.attach,\n\t\t\t\t\tcellId: baseAttachAndDetach.cellId,\n\t\t\t\t\tcount: baseAttachAndDetach.count,\n\t\t\t\t},\n\t\t\t\tbaseAttachAndDetach.attach.revision,\n\t\t\t);\n\n\t\t\tif (isMoveIn(baseAttachAndDetach.attach) && isMoveOut(baseAttachAndDetach.detach)) {\n\t\t\t\tassert(isMoveIn(newMark), 0x809 /* Unexpected mark type */);\n\n\t\t\t\tconst originalAttachId = {\n\t\t\t\t\trevision: baseAttachAndDetach.attach.revision,\n\t\t\t\t\tlocalId: baseAttachAndDetach.attach.id,\n\t\t\t\t};\n\n\t\t\t\tsetTruncatedEndpointForInner(\n\t\t\t\t\tmoveEffects,\n\t\t\t\t\tCrossFieldTarget.Source,\n\t\t\t\t\tgetEndpoint(newMark),\n\t\t\t\t\tbaseAttachAndDetach.count,\n\t\t\t\t\toriginalAttachId,\n\t\t\t\t);\n\n\t\t\t\tconst newEndpoint = getComposedEndpoint(\n\t\t\t\t\tmoveEffects,\n\t\t\t\t\tCrossFieldTarget.Destination,\n\t\t\t\t\tnewMark.revision,\n\t\t\t\t\tnewMark.id,\n\t\t\t\t\tnewMark.count,\n\t\t\t\t);\n\n\t\t\t\tif (newEndpoint !== undefined) {\n\t\t\t\t\tchangeFinalEndpoint(originalAttach as MoveMarkEffect, newEndpoint);\n\t\t\t\t\tsetTruncatedEndpoint(\n\t\t\t\t\t\tmoveEffects,\n\t\t\t\t\t\tCrossFieldTarget.Source,\n\t\t\t\t\t\tnewEndpoint,\n\t\t\t\t\t\tbaseMark.count,\n\t\t\t\t\t\toriginalAttachId,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn originalAttach;\n\t\t} else {\n\t\t\t// Other mark types have been handled by previous conditional branches.\n\t\t\tassert(newMark.type === NoopMarkType, 0x80a /* Unexpected mark type */);\n\t\t\treturn baseMark;\n\t\t}\n\t}\n\n\tif (!markHasCellEffect(baseMark) && !markHasCellEffect(newMark)) {\n\t\treturn createNoopMark(newMark.count, undefined, getInputCellId(baseMark));\n\t} else if (!markHasCellEffect(baseMark)) {\n\t\treturn newMark;\n\t} else if (!markHasCellEffect(newMark)) {\n\t\treturn baseMark;\n\t} else if (areInputCellsEmpty(baseMark)) {\n\t\tassert(isDetach(newMark), 0x71c /* Unexpected mark type */);\n\t\tassert(isAttach(baseMark), 0x71d /* Expected generative mark */);\n\n\t\tconst attach = extractMarkEffect(baseMark);\n\t\tconst detach = extractMarkEffect(newMark);\n\n\t\thandleMovePivot(baseMark.count, attach, detach, moveEffects);\n\n\t\tif (areEqualCellIds(getOutputCellId(newMark), baseMark.cellId)) {\n\t\t\t// The output and input cell IDs are the same, so this mark has no effect.\n\t\t\treturn { count: baseMark.count, cellId: baseMark.cellId };\n\t\t}\n\t\treturn normalizeCellRename(baseMark.cellId, baseMark.count, attach, detach);\n\t} else {\n\t\tconst length = baseMark.count;\n\t\treturn createNoopMark(length, undefined);\n\t}\n}\n\n/**\n * Checks if `baseAttach` and `newDetach` are both moves, and if so updates their move endpoints as appropriate,\n * and removes their `finalEndpoint` endpoint fields. Note that can mutate `baseAttach` and `newDetach`.\n * If the effects are not both moves this function does nothing.\n * @param count - The number of cells targeted\n * @param baseAttach - The base attach effect at this location\n * @param newDetach - The new detach effect at this location\n */\nfunction handleMovePivot(\n\tcount: number,\n\tbaseAttach: Attach,\n\tnewDetach: Detach,\n\tmoveEffects: MoveEffectTable,\n): void {\n\tif (isMoveIn(baseAttach) && isMoveOut(newDetach)) {\n\t\tconst finalSource = getEndpoint(baseAttach);\n\t\tconst finalDest = getEndpoint(newDetach);\n\n\t\tsetEndpoint(moveEffects, CrossFieldTarget.Source, finalSource, count, finalDest);\n\n\t\tconst truncatedEndpoint1 = getTruncatedEndpointForInner(\n\t\t\tmoveEffects,\n\t\t\tCrossFieldTarget.Destination,\n\t\t\tbaseAttach.revision,\n\t\t\tbaseAttach.id,\n\t\t\tcount,\n\t\t);\n\n\t\tif (truncatedEndpoint1 !== undefined) {\n\t\t\tsetTruncatedEndpoint(\n\t\t\t\tmoveEffects,\n\t\t\t\tCrossFieldTarget.Destination,\n\t\t\t\tfinalDest,\n\t\t\t\tcount,\n\t\t\t\ttruncatedEndpoint1,\n\t\t\t);\n\t\t}\n\n\t\tsetEndpoint(moveEffects, CrossFieldTarget.Destination, finalDest, count, finalSource);\n\n\t\tconst truncatedEndpoint2 = getTruncatedEndpointForInner(\n\t\t\tmoveEffects,\n\t\t\tCrossFieldTarget.Source,\n\t\t\tnewDetach.revision,\n\t\t\tnewDetach.id,\n\t\t\tcount,\n\t\t);\n\n\t\tif (truncatedEndpoint2 !== undefined) {\n\t\t\tsetTruncatedEndpoint(\n\t\t\t\tmoveEffects,\n\t\t\t\tCrossFieldTarget.Source,\n\t\t\t\tfinalSource,\n\t\t\t\tcount,\n\t\t\t\ttruncatedEndpoint2,\n\t\t\t);\n\t\t}\n\n\t\t// The `finalEndpoint` field of AttachAndDetach move effect pairs is not used,\n\t\t// so we remove it as a normalization.\n\t\tdelete baseAttach.finalEndpoint;\n\t\tdelete newDetach.finalEndpoint;\n\t}\n}\n\nfunction createNoopMark(\n\tlength: number,\n\tnodeChange: NodeId | undefined,\n\tcellId?: ChangeAtomId,\n): Mark {\n\tconst mark: CellMark<NoopMark> = { count: length };\n\tif (nodeChange !== undefined) {\n\t\tassert(length === 1, 0x692 /* A mark with a node change must have length one */);\n\t\tmark.changes = nodeChange;\n\t}\n\tif (cellId !== undefined) {\n\t\tmark.cellId = cellId;\n\t}\n\treturn mark;\n}\n\nfunction handleNodeChanges(\n\tbaseMark: Mark,\n\tnewMark: Mark,\n\tcomposeChild: NodeChangeComposer,\n\tmoveEffects: MoveEffectTable,\n): NodeId | undefined {\n\tif (newMark.changes !== undefined) {\n\t\tconst baseSource = getMoveIn(baseMark);\n\n\t\t// TODO: Make sure composeChild is not called twice on the node changes.\n\t\tif (baseSource !== undefined) {\n\t\t\tsetModifyAfter(moveEffects, getEndpoint(baseSource), newMark.changes);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\treturn composeChildChanges(baseMark.changes, newMark.changes, composeChild);\n}\n\nfunction composeChildChanges(\n\tbaseChange: NodeId | undefined,\n\tnewChange: NodeId | undefined,\n\tcomposeChild: NodeChangeComposer,\n): NodeId | undefined {\n\tif (baseChange === undefined && newChange === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn composeChild(baseChange, newChange);\n}\n\nfunction composeMark<TMark extends Mark>(\n\tmark: TMark,\n\tmoveEffects: MoveEffectTable,\n\tcomposeChild: (node: NodeId) => NodeId | undefined,\n): TMark {\n\tconst nodeChanges = mark.changes === undefined ? undefined : composeChild(mark.changes);\n\tconst updatedMark = withUpdatedEndpoint(mark, mark.count, moveEffects);\n\treturn withNodeChange(updatedMark, nodeChanges);\n}\n\nexport class ComposeQueue {\n\tprivate readonly baseMarks: MarkQueue;\n\tprivate readonly newMarks: MarkQueue;\n\tprivate readonly baseMarksCellSources: ReadonlySet<RevisionTag | undefined>;\n\tprivate readonly newMarksCellSources: ReadonlySet<RevisionTag | undefined>;\n\n\tpublic constructor(\n\t\tbaseMarks: Changeset,\n\t\tnewMarks: Changeset,\n\t\tprivate readonly moveEffects: MoveEffectTable,\n\t\tprivate readonly revisionMetadata: RevisionMetadataSource,\n\t) {\n\t\tthis.baseMarks = new MarkQueue(baseMarks, moveEffects);\n\t\tthis.newMarks = new MarkQueue(newMarks, moveEffects);\n\t\tthis.baseMarksCellSources = cellSourcesFromMarks(baseMarks, getOutputCellId);\n\t\tthis.newMarksCellSources = cellSourcesFromMarks(newMarks, getInputCellId);\n\t}\n\n\tpublic isEmpty(): boolean {\n\t\treturn this.baseMarks.isEmpty() && this.newMarks.isEmpty();\n\t}\n\n\tpublic pop(): ComposeMarks {\n\t\tconst baseMark = this.baseMarks.peek();\n\t\tconst newMark = this.newMarks.peek();\n\t\tif (baseMark === undefined && newMark === undefined) {\n\t\t\treturn {};\n\t\t} else if (baseMark === undefined) {\n\t\t\treturn this.dequeueNew();\n\t\t} else if (newMark === undefined) {\n\t\t\treturn this.dequeueBase();\n\t\t} else if (areOutputCellsEmpty(baseMark) && areInputCellsEmpty(newMark)) {\n\t\t\tconst baseCellId: ChangeAtomId =\n\t\t\t\tgetOutputCellId(baseMark) ?? fail(0xb29 /* Expected defined output ID */);\n\n\t\t\tif (markEmptiesCells(baseMark) && baseCellId.revision === undefined) {\n\t\t\t\t// The base revision should always be defined except when squashing changes into a transaction.\n\t\t\t\t// In the future, we want to support reattaches in the new change here.\n\t\t\t\t// We will need to be able to order the base mark relative to the new mark\n\t\t\t\t// (which requires the local changes to have a revision tag))\n\t\t\t\tassert(\n\t\t\t\t\tisNewAttach(newMark),\n\t\t\t\t\t0x695 /* TODO: Assign revision tags to each change in a transaction */,\n\t\t\t\t);\n\t\t\t\treturn this.dequeueNew();\n\t\t\t}\n\n\t\t\tconst newCellId = getInputCellId(newMark);\n\t\t\tassert(newCellId !== undefined, 0x89d /* Both marks should have cell IDs */);\n\t\t\tconst comparison = compareCellPositionsUsingTombstones(\n\t\t\t\tbaseCellId,\n\t\t\t\tnewCellId,\n\t\t\t\tthis.baseMarksCellSources,\n\t\t\t\tthis.newMarksCellSources,\n\t\t\t\tthis.revisionMetadata,\n\t\t\t);\n\t\t\tswitch (comparison) {\n\t\t\t\tcase CellOrder.SameCell: {\n\t\t\t\t\treturn this.dequeueBoth();\n\t\t\t\t}\n\t\t\t\tcase CellOrder.OldThenNew: {\n\t\t\t\t\treturn this.dequeueBase();\n\t\t\t\t}\n\t\t\t\tcase CellOrder.NewThenOld: {\n\t\t\t\t\treturn this.dequeueNew();\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(comparison);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (areOutputCellsEmpty(baseMark)) {\n\t\t\treturn this.dequeueBase();\n\t\t} else if (areInputCellsEmpty(newMark)) {\n\t\t\treturn this.dequeueNew();\n\t\t} else {\n\t\t\treturn this.dequeueBoth();\n\t\t}\n\t}\n\n\tprivate dequeueBase(length: number = Number.POSITIVE_INFINITY): ComposeMarks {\n\t\tconst baseMark = this.baseMarks.dequeueUpTo(length);\n\t\tconst movedChanges = getMovedChangesFromMark(this.moveEffects, baseMark);\n\t\tif (movedChanges !== undefined) {\n\t\t\tthis.moveEffects.onMoveIn(movedChanges);\n\t\t}\n\n\t\tconst newMark = createNoopMark(baseMark.count, movedChanges, getOutputCellId(baseMark));\n\t\treturn { baseMark, newMark };\n\t}\n\n\tprivate dequeueNew(length: number = Number.POSITIVE_INFINITY): ComposeMarks {\n\t\tconst newMark = this.newMarks.dequeueUpTo(length);\n\t\tconst baseMark = createNoopMark(newMark.count, undefined, getInputCellId(newMark));\n\n\t\treturn {\n\t\t\tbaseMark,\n\t\t\tnewMark,\n\t\t};\n\t}\n\n\tprivate dequeueBoth(): ComposeMarks {\n\t\tconst length = this.peekMinLength();\n\t\tconst baseMark = this.baseMarks.dequeueUpTo(length);\n\t\tlet newMark = this.newMarks.dequeueUpTo(length);\n\t\tconst movedChanges = getMovedChangesFromMark(this.moveEffects, baseMark);\n\n\t\tif (movedChanges !== undefined) {\n\t\t\tassert(newMark.changes === undefined, 0x8da /* Unexpected node changeset collision */);\n\t\t\tnewMark = withNodeChange(newMark, movedChanges);\n\t\t}\n\n\t\treturn {\n\t\t\tbaseMark,\n\t\t\tnewMark,\n\t\t};\n\t}\n\n\tprivate peekMinLength(): number {\n\t\tconst baseMark = this.baseMarks.peek();\n\t\tconst newMark = this.newMarks.peek();\n\t\tassert(\n\t\t\tbaseMark !== undefined && newMark !== undefined,\n\t\t\t0x8db /* Cannot peek length unless both mark queues are non-empty */,\n\t\t);\n\n\t\treturn Math.min(newMark.count, baseMark.count);\n\t}\n}\n\ninterface ComposeMarks {\n\tbaseMark?: Mark;\n\tnewMark?: Mark;\n}\n\nfunction getMovedChangesFromMark(\n\tmoveEffects: MoveEffectTable,\n\tmarkEffect: MarkEffect,\n): NodeId | undefined {\n\tif (isAttachAndDetachEffect(markEffect)) {\n\t\treturn getMovedChangesFromMark(moveEffects, markEffect.detach);\n\t}\n\tif (!isMoveOut(markEffect)) {\n\t\treturn undefined;\n\t}\n\n\treturn getModifyAfter(moveEffects, markEffect.revision, markEffect.id);\n}\n\n// It is expected that the range from `id` to `id + count - 1` has the same move effect.\n// The call sites to this function are making queries about a mark which has already been split by a `MarkQueue`\n// to match the ranges in `moveEffects`.\n// TODO: Reduce the duplication between this and other MoveEffect helpers\nfunction getModifyAfter(\n\tmoveEffects: MoveEffectTable,\n\trevision: RevisionTag | undefined,\n\tid: MoveId,\n): NodeId | undefined {\n\tconst target = CrossFieldTarget.Source;\n\tconst effect = getMoveEffect(moveEffects, target, revision, id, 1);\n\n\tif (effect.value?.modifyAfter !== undefined) {\n\t\treturn effect.value.modifyAfter;\n\t}\n\n\treturn undefined;\n}\n\n// TODO: Reduce the duplication between this and other MoveEffect helpers\nfunction setModifyAfter(\n\tmoveEffects: MoveEffectTable,\n\t{ revision, localId: id }: ChangeAtomId,\n\tmodifyAfter: NodeId,\n): void {\n\tconst target = CrossFieldTarget.Source;\n\tconst count = 1;\n\tconst effect = getMoveEffect(moveEffects, target, revision, id, count, false);\n\tconst newEffect: MoveEffect =\n\t\teffect.value === undefined ? { modifyAfter } : { ...effect.value, modifyAfter };\n\tsetMoveEffect(moveEffects, target, revision, id, count, newEffect);\n}\n\nfunction setEndpoint(\n\tmoveEffects: MoveEffectTable,\n\ttarget: CrossFieldTarget,\n\tid: ChangeAtomId,\n\tcount: number,\n\tendpoint: ChangeAtomId,\n): void {\n\tconst effect = getMoveEffect(moveEffects, target, id.revision, id.localId, count, false);\n\tconst newEffect = effect.value === undefined ? { endpoint } : { ...effect.value, endpoint };\n\tsetMoveEffect(moveEffects, target, id.revision, id.localId, effect.length, newEffect);\n\n\tconst remainingCount = count - effect.length;\n\tif (remainingCount > 0) {\n\t\tsetEndpoint(\n\t\t\tmoveEffects,\n\t\t\ttarget,\n\t\t\toffsetChangeAtomId(id, effect.length),\n\t\t\tremainingCount,\n\t\t\toffsetChangeAtomId(endpoint, effect.length),\n\t\t);\n\t}\n}\n\nfunction setTruncatedEndpoint(\n\tmoveEffects: MoveEffectTable,\n\ttarget: CrossFieldTarget,\n\tid: ChangeAtomId,\n\tcount: number,\n\ttruncatedEndpoint: ChangeAtomId,\n): void {\n\tconst effect = getMoveEffect(moveEffects, target, id.revision, id.localId, count);\n\tconst newEffect =\n\t\teffect.value === undefined\n\t\t\t? { truncatedEndpoint }\n\t\t\t: { ...effect.value, truncatedEndpoint };\n\n\tsetMoveEffect(moveEffects, target, id.revision, id.localId, effect.length, newEffect);\n\n\tconst remainingCount = count - effect.length;\n\tif (remainingCount > 0) {\n\t\tsetTruncatedEndpoint(\n\t\t\tmoveEffects,\n\t\t\ttarget,\n\t\t\toffsetChangeAtomId(id, effect.length),\n\t\t\tremainingCount,\n\t\t\toffsetChangeAtomId(truncatedEndpoint, effect.length),\n\t\t);\n\t}\n}\n\nfunction setTruncatedEndpointForInner(\n\tmoveEffects: MoveEffectTable,\n\ttarget: CrossFieldTarget,\n\tid: ChangeAtomId,\n\tcount: number,\n\ttruncatedEndpointForInner: ChangeAtomId,\n): void {\n\tconst effect = getMoveEffect(moveEffects, target, id.revision, id.localId, count);\n\tconst newEffect =\n\t\teffect.value === undefined\n\t\t\t? { truncatedEndpointForInner }\n\t\t\t: { ...effect.value, truncatedEndpointForInner };\n\tsetMoveEffect(moveEffects, target, id.revision, id.localId, effect.length, newEffect);\n\n\tconst remainingCount = count - effect.length;\n\tif (remainingCount > 0) {\n\t\tsetTruncatedEndpointForInner(\n\t\t\tmoveEffects,\n\t\t\ttarget,\n\t\t\toffsetChangeAtomId(id, effect.length),\n\t\t\tremainingCount,\n\t\t\toffsetChangeAtomId(truncatedEndpointForInner, effect.length),\n\t\t);\n\t}\n}\n\nfunction withUpdatedEndpoint<TMark extends MarkEffect>(\n\tmark: TMark,\n\tcount: number,\n\teffects: MoveEffectTable,\n): TMark {\n\tif (isAttachAndDetachEffect(mark)) {\n\t\treturn {\n\t\t\t...mark,\n\t\t\tattach: withUpdatedEndpoint(mark.attach, count, effects),\n\t\t\tdetach: withUpdatedEndpoint(mark.detach, count, effects),\n\t\t};\n\t}\n\n\tif (!isMoveMark(mark)) {\n\t\treturn mark;\n\t}\n\tconst finalDest = getComposedEndpoint(\n\t\teffects,\n\t\tgetCrossFieldTargetFromMove(mark),\n\t\tmark.revision,\n\t\tmark.id,\n\t\tcount,\n\t);\n\n\tif (finalDest === undefined) {\n\t\treturn mark;\n\t}\n\n\tconst output = { ...mark };\n\tchangeFinalEndpoint(output, finalDest);\n\n\treturn output;\n}\n\nfunction changeFinalEndpoint(mark: MoveMarkEffect, endpoint: ChangeAtomId): void {\n\tif (areEqualCellIds(endpoint, { revision: mark.revision, localId: mark.id })) {\n\t\tdelete mark.finalEndpoint;\n\t} else {\n\t\tmark.finalEndpoint = endpoint;\n\t}\n}\n\nfunction getComposedEndpoint(\n\tmoveEffects: MoveEffectTable,\n\ttarget: CrossFieldTarget,\n\trevision: RevisionTag | undefined,\n\tid: MoveId,\n\tcount: number,\n): ChangeAtomId | undefined {\n\tconst effect = getMoveEffect(moveEffects, target, revision, id, count);\n\tassert(effect.length === count, 0x815 /* Expected effect to cover entire mark */);\n\treturn effect.value?.truncatedEndpoint ?? effect.value?.endpoint;\n}\n\nfunction getTruncatedEndpointForInner(\n\tmoveEffects: MoveEffectTable,\n\ttarget: CrossFieldTarget,\n\trevision: RevisionTag | undefined,\n\tid: MoveId,\n\tcount: number,\n): ChangeAtomId | undefined {\n\tconst effect = getMoveEffect(moveEffects, target, revision, id, count);\n\tassert(effect.length === count, 0x934 /* Expected effect to cover entire mark */);\n\treturn effect.value?.truncatedEndpointForInner;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"compose.js","sourceRoot":"","sources":["../../../src/feature-libraries/sequence-field/compose.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAEpF,OAAO,EACN,wBAAwB,EACxB,qBAAqB,GAIrB,MAAM,qBA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CAAyC,CAAC,CAAC;YACvF,OAAO,GAAG,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACjD,CAAC;QAED,OAAO;YACN,QAAQ;YACR,OAAO;SACP,CAAC;IACH,CAAC;IAEO,aAAa;QACpB,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACrC,MAAM,CACL,QAAQ,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,EAC/C,KAAK,CAAC,8DAA8D,CACpE,CAAC;QAEF,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;CACD;AAOD,SAAS,uBAAuB,CAC/B,WAA+B,EAC/B,UAAsB;IAEtB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,OAAO,WAAW,CAAC,0BAA0B,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK;QACpF,EAAE,UAAU,CAAC;AACf,CAAC;AAED,SAAS,kBAAkB,CAC1B,OAA2B,EAC3B,IAAsB;IAEtB,OAAO,OAAO,CAAC,0BAA0B,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK;QACnF,EAAE,QAAQ,CAAC;AACb,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tareEqualChangeAtomIdOpts,\n\tareEqualChangeAtomIds,\n\ttype ChangeAtomId,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n} from \"../../core/index.js\";\nimport type { IdAllocator } from \"../../util/index.js\";\nimport type {\n\tComposeNodeManager,\n\tNodeChangeComposer,\n\tNodeId,\n} from \"../modular-schema/index.js\";\n\nimport { MarkListFactory } from \"./markListFactory.js\";\nimport { MarkQueue } from \"./markQueue.js\";\nimport type { NodeRangeQueryFunc } from \"./moveEffectTable.js\";\nimport type {\n\tCellMark,\n\tChangeset,\n\tDetach,\n\tMark,\n\tMarkEffect,\n\tMarkList,\n\tNoopMark,\n} from \"./types.js\";\nimport {\n\tCellOrder,\n\tareEqualCellIds,\n\tareInputCellsEmpty,\n\tareOutputCellsEmpty,\n\tcellSourcesFromMarks,\n\tcompareCellPositionsUsingTombstones,\n\textractMarkEffect,\n\tgetAttachedRootId,\n\tgetDetachOutputCellId,\n\tgetDetachedRootId,\n\tgetInputCellId,\n\tgetMovedNodeId,\n\tgetOutputCellId,\n\tisAttach,\n\tisDetach,\n\tisNewAttach,\n\tisNoopMark,\n\tisPin,\n\tisRename,\n\tmarkEmptiesCells,\n\tmarkHasCellEffect,\n\tnormalizeCellRename,\n\twithNodeChange,\n} from \"./utils.js\";\n\n/**\n * Composes a sequence of changesets into a single changeset.\n * @param changes - The changesets to be applied.\n * Parts of the input may be reused in the output, but the input is not mutated.\n * Each changeset in the list is assumed to be applicable after the previous one.\n * @returns A changeset that is equivalent to applying each of the given `changes` in order.\n *\n * WARNING! This implementation is incomplete:\n * - Tombstone information is ignored.\n * - Support for moves is not implemented.\n * - Support for slices is not implemented.\n */\nexport function compose(\n\tchange1: Changeset,\n\tchange2: Changeset,\n\tcomposeChild: NodeChangeComposer,\n\t_genId: IdAllocator,\n\tmanager: ComposeNodeManager,\n\trevisionMetadata: RevisionMetadataSource,\n): Changeset {\n\treturn composeMarkLists(change1, change2, composeChild, manager, revisionMetadata);\n}\n\nfunction composeMarkLists(\n\tbaseMarkList: MarkList,\n\tnewMarkList: MarkList,\n\tcomposeChild: NodeChangeComposer,\n\tmoveEffects: ComposeNodeManager,\n\trevisionMetadata: RevisionMetadataSource,\n): MarkList {\n\tconst factory = new MarkListFactory();\n\tconst queue = new ComposeQueue(baseMarkList, newMarkList, moveEffects, revisionMetadata);\n\twhile (!queue.isEmpty()) {\n\t\tconst { baseMark, newMark } = queue.pop();\n\t\tconst composedMark = composeMarks(baseMark, newMark, composeChild, moveEffects);\n\t\tfactory.push(composedMark);\n\t}\n\n\treturn factory.list;\n}\n\n/**\n * Composes two marks where `newMark` is based on the state produced by `baseMark`.\n * @param baseMark - The mark to compose with `newMark`.\n * Its output range should be the same as `newMark`'s input range.\n * @param newRev - The revision the new mark is part of.\n * @param newMark - The mark to compose with `baseMark`.\n * Its input range should be the same as `baseMark`'s output range.\n * @returns A mark that is equivalent to applying both `baseMark` and `newMark` successively.\n */\nfunction composeMarks(\n\tbaseMark: Mark,\n\tnewMark: Mark,\n\tcomposeChild: NodeChangeComposer,\n\tmoveEffects: ComposeNodeManager,\n): Mark {\n\tconst nodeChange = handleNodeChanges(baseMark, newMark, composeChild, moveEffects);\n\treturn withNodeChange(composeMarksIgnoreChild(baseMark, newMark, moveEffects), nodeChange);\n}\n\nfunction composeMarksIgnoreChild(\n\tbaseMark: Mark,\n\tnewMark: Mark,\n\tmoveEffects: ComposeNodeManager,\n): Mark {\n\tif (isNoopMark(baseMark)) {\n\t\treturn newMark;\n\t} else if (isNoopMark(newMark)) {\n\t\treturn updateBaseMarkId(moveEffects, baseMark);\n\t}\n\n\tif (isRename(baseMark) && isRename(newMark)) {\n\t\tif (areEqualChangeAtomIdOpts(baseMark.cellId, newMark.idOverride)) {\n\t\t\treturn createNoopMark(baseMark.count, undefined, baseMark.cellId);\n\t\t}\n\t\treturn { ...baseMark, idOverride: newMark.idOverride };\n\t} else if (isRename(baseMark)) {\n\t\tassert(isAttach(newMark), 0x9f1 /* Unexpected mark type */);\n\t\tassert(\n\t\t\tbaseMark.cellId !== undefined && newMark.cellId !== undefined,\n\t\t\t\"Expected marks to target an empty cell\",\n\t\t);\n\t\treturn { ...newMark, cellId: baseMark.cellId };\n\t} else if (isRename(newMark)) {\n\t\tassert(isDetach(baseMark), 0x9f2 /* Unexpected mark type */);\n\t\treturn updateBaseMarkId(moveEffects, { ...baseMark, cellRename: newMark.idOverride });\n\t}\n\n\tif (!markHasCellEffect(baseMark)) {\n\t\tassert(baseMark.type === \"Attach\", \"Expected baseMark to be a pin\");\n\n\t\t// `newMark` can be either a remove or another pin.\n\t\t// A pin is treated as a detach and attach, so we call `composeAttachDetach` in either case.\n\t\tmoveEffects.composeAttachDetach(\n\t\t\tgetAttachedRootId(baseMark),\n\t\t\t{\n\t\t\t\trevision: newMark.revision,\n\t\t\t\tlocalId: newMark.id,\n\t\t\t},\n\t\t\tbaseMark.count,\n\t\t);\n\n\t\tconst pinId = getAttachedRootId(baseMark);\n\t\treturn newMark.type === \"Detach\"\n\t\t\t? {\n\t\t\t\t\t...newMark,\n\t\t\t\t\tdetachCellId: baseMark.detachCellId ?? pinId,\n\t\t\t\t\tcellRename: getDetachOutputCellId(newMark),\n\t\t\t\t}\n\t\t\t: newMark;\n\t} else if (!markHasCellEffect(newMark)) {\n\t\tif (isAttach(newMark) && isAttach(baseMark)) {\n\t\t\t// When composing two inserts, the second insert (which is a pin) should take precedence.\n\t\t\t// We treat the pin as a detach and reattach.\n\t\t\tmoveEffects.composeAttachDetach(\n\t\t\t\tgetAttachedRootId(baseMark),\n\t\t\t\tgetAttachedRootId(newMark),\n\t\t\t\tbaseMark.count,\n\t\t\t);\n\n\t\t\tconst composed = { cellId: baseMark.cellId, ...newMark };\n\t\t\tdelete composed.detachCellId;\n\t\t\treturn composed;\n\t\t}\n\t\treturn updateBaseMarkId(moveEffects, baseMark);\n\t} else if (areInputCellsEmpty(baseMark)) {\n\t\tassert(isDetach(newMark), 0x71c /* Unexpected mark type */);\n\t\tassert(isAttach(baseMark), 0x71d /* Expected generative mark */);\n\n\t\tconst attach = extractMarkEffect(baseMark);\n\t\tconst detach = extractMarkEffect(newMark);\n\n\t\tmoveEffects.composeAttachDetach(\n\t\t\tgetAttachedRootId(baseMark),\n\t\t\tgetDetachedRootId(newMark),\n\t\t\tbaseMark.count,\n\t\t);\n\n\t\tif (areEqualCellIds(getOutputCellId(newMark), baseMark.cellId)) {\n\t\t\t// The output and input cell IDs are the same, so this mark has no effect.\n\t\t\treturn { count: baseMark.count, cellId: baseMark.cellId };\n\t\t}\n\t\treturn normalizeCellRename(baseMark.cellId, baseMark.count, attach, detach);\n\t} else {\n\t\tassert(baseMark.type === \"Detach\", \"Unexpected mark type\");\n\t\tassert(newMark.type === \"Attach\", \"Unexpected mark type\");\n\t\tconst detachId = getDetachedRootId(baseMark);\n\t\tconst attachId = getAttachedRootId(newMark);\n\n\t\tmoveEffects.composeDetachAttach(detachId, attachId, baseMark.count, true);\n\n\t\t// The composition has no net effect but we preserve the second change's intention to pin the nodes here.\n\t\tconst composedMark = { ...newMark };\n\t\tdelete composedMark.cellId;\n\t\tconst baseDetachCellId = baseMark.detachCellId ?? detachId;\n\t\tif (!areEqualChangeAtomIds(baseDetachCellId, attachId)) {\n\t\t\tcomposedMark.detachCellId = baseDetachCellId;\n\t\t}\n\n\t\treturn composedMark;\n\t}\n}\n\nfunction updateBaseMarkId(moveEffects: ComposeNodeManager, baseMark: Mark): Mark {\n\tif (isDetach(baseMark)) {\n\t\tconst baseDetachId = getDetachedRootId(baseMark);\n\t\tconst updatedDetachId = getUpdatedDetachId(moveEffects, baseMark);\n\t\tif (\n\t\t\tupdatedDetachId !== undefined &&\n\t\t\t!areEqualChangeAtomIds(updatedDetachId, baseDetachId)\n\t\t) {\n\t\t\treturn {\n\t\t\t\t...baseMark,\n\t\t\t\trevision: updatedDetachId.revision,\n\t\t\t\tid: updatedDetachId.localId,\n\t\t\t\tdetachCellId: baseMark.detachCellId ?? baseDetachId,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn baseMark;\n}\n\nfunction createNoopMark(\n\tlength: number,\n\tnodeChange: NodeId | undefined,\n\tcellId?: ChangeAtomId,\n): Mark {\n\tconst mark: CellMark<NoopMark> = { count: length };\n\tif (nodeChange !== undefined) {\n\t\tassert(length === 1, 0x692 /* A mark with a node change must have length one */);\n\t\tmark.changes = nodeChange;\n\t}\n\tif (cellId !== undefined) {\n\t\tmark.cellId = cellId;\n\t}\n\treturn mark;\n}\n\nfunction handleNodeChanges(\n\tbaseMark: Mark,\n\tnewMark: Mark,\n\tcomposeChild: NodeChangeComposer,\n\tmoveEffects: ComposeNodeManager,\n): NodeId | undefined {\n\tif (\n\t\tnewMark.changes !== undefined &&\n\t\tbaseMark.type === \"Attach\" &&\n\t\tbaseMark.cellId !== undefined\n\t) {\n\t\tmoveEffects.sendNewChangesToBaseSourceLocation(\n\t\t\tgetAttachedRootId(baseMark),\n\t\t\tnewMark.changes,\n\t\t);\n\t\treturn undefined;\n\t}\n\n\t// TODO: Make sure composeChild is not called twice on the node changes.\n\treturn composeChildChanges(baseMark.changes, newMark.changes, composeChild);\n}\n\nfunction composeChildChanges(\n\tbaseChange: NodeId | undefined,\n\tnewChange: NodeId | undefined,\n\tcomposeChild: NodeChangeComposer,\n): NodeId | undefined {\n\tif (baseChange === undefined && newChange === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn composeChild(baseChange, newChange);\n}\n\nexport class ComposeQueue {\n\tprivate readonly baseMarks: MarkQueue;\n\tprivate readonly newMarks: MarkQueue;\n\tprivate readonly baseMarksCellSources: ReadonlySet<RevisionTag | undefined>;\n\tprivate readonly newMarksCellSources: ReadonlySet<RevisionTag | undefined>;\n\n\tpublic constructor(\n\t\tbaseMarks: Changeset,\n\t\tnewMarks: Changeset,\n\t\tprivate readonly moveEffects: ComposeNodeManager,\n\t\tprivate readonly revisionMetadata: RevisionMetadataSource,\n\t) {\n\t\tconst queryFunc: NodeRangeQueryFunc = (mark) =>\n\t\t\tisDetach(mark) || isPin(mark)\n\t\t\t\t? moveEffects.getNewChangesForBaseDetach(getMovedNodeId(mark), mark.count).length\n\t\t\t\t: mark.count;\n\n\t\tthis.baseMarks = new MarkQueue(baseMarks, queryFunc);\n\t\tthis.newMarks = new MarkQueue(newMarks, (mark) => mark.count);\n\t\tthis.baseMarksCellSources = cellSourcesFromMarks(baseMarks, getOutputCellId);\n\t\tthis.newMarksCellSources = cellSourcesFromMarks(newMarks, getInputCellId);\n\t}\n\n\tpublic isEmpty(): boolean {\n\t\treturn this.baseMarks.isEmpty() && this.newMarks.isEmpty();\n\t}\n\n\tpublic pop(): ComposeMarks {\n\t\tconst baseMark = this.baseMarks.peek();\n\t\tconst newMark = this.newMarks.peek();\n\t\tif (baseMark === undefined && newMark === undefined) {\n\t\t\tfail(\"Should not pop when queue is empty\");\n\t\t} else if (baseMark === undefined) {\n\t\t\treturn this.dequeueNew();\n\t\t} else if (newMark === undefined) {\n\t\t\treturn this.dequeueBase();\n\t\t} else if (areOutputCellsEmpty(baseMark) && areInputCellsEmpty(newMark)) {\n\t\t\tconst baseCellId: ChangeAtomId =\n\t\t\t\tgetOutputCellId(baseMark) ?? fail(0xb29 /* Expected defined output ID */);\n\n\t\t\tif (markEmptiesCells(baseMark) && baseCellId.revision === undefined) {\n\t\t\t\t// The base revision should always be defined except when squashing changes into a transaction.\n\t\t\t\t// In the future, we want to support reattaches in the new change here.\n\t\t\t\t// We will need to be able to order the base mark relative to the new mark\n\t\t\t\t// (which requires the local changes to have a revision tag))\n\t\t\t\tassert(\n\t\t\t\t\tisNewAttach(newMark),\n\t\t\t\t\t0x695 /* TODO: Assign revision tags to each change in a transaction */,\n\t\t\t\t);\n\t\t\t\treturn this.dequeueNew();\n\t\t\t}\n\n\t\t\tconst newCellId = getInputCellId(newMark);\n\t\t\tassert(newCellId !== undefined, 0x89d /* Both marks should have cell IDs */);\n\t\t\tconst comparison = compareCellPositionsUsingTombstones(\n\t\t\t\tbaseCellId,\n\t\t\t\tnewCellId,\n\t\t\t\tthis.baseMarksCellSources,\n\t\t\t\tthis.newMarksCellSources,\n\t\t\t\tthis.revisionMetadata,\n\t\t\t);\n\t\t\tswitch (comparison) {\n\t\t\t\tcase CellOrder.SameCell: {\n\t\t\t\t\treturn this.dequeueBoth();\n\t\t\t\t}\n\t\t\t\tcase CellOrder.OldThenNew: {\n\t\t\t\t\treturn this.dequeueBase();\n\t\t\t\t}\n\t\t\t\tcase CellOrder.NewThenOld: {\n\t\t\t\t\treturn this.dequeueNew();\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(comparison);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (areOutputCellsEmpty(baseMark)) {\n\t\t\treturn this.dequeueBase();\n\t\t} else if (areInputCellsEmpty(newMark)) {\n\t\t\treturn this.dequeueNew();\n\t\t} else {\n\t\t\treturn this.dequeueBoth();\n\t\t}\n\t}\n\n\tprivate dequeueBase(length: number = Number.POSITIVE_INFINITY): ComposeMarks {\n\t\tconst baseMark = this.baseMarks.dequeueUpTo(length);\n\t\tconst movedChanges = getMovedChangesFromMark(this.moveEffects, baseMark);\n\t\tconst newMark = createNoopMark(baseMark.count, movedChanges, getOutputCellId(baseMark));\n\t\treturn { baseMark, newMark };\n\t}\n\n\tprivate dequeueNew(length: number = Number.POSITIVE_INFINITY): ComposeMarks {\n\t\tconst newMark = this.newMarks.dequeueUpTo(length);\n\t\tconst baseMark = createNoopMark(newMark.count, undefined, getInputCellId(newMark));\n\n\t\treturn {\n\t\t\tbaseMark,\n\t\t\tnewMark,\n\t\t};\n\t}\n\n\tprivate dequeueBoth(): ComposeMarks {\n\t\tconst length = this.peekMinLength();\n\t\tconst baseMark = this.baseMarks.dequeueUpTo(length);\n\t\tlet newMark = this.newMarks.dequeueUpTo(length);\n\t\tconst movedChanges = getMovedChangesFromMark(this.moveEffects, baseMark);\n\n\t\tif (movedChanges !== undefined) {\n\t\t\tassert(newMark.changes === undefined, 0x8da /* Unexpected node changeset collision */);\n\t\t\tnewMark = withNodeChange(newMark, movedChanges);\n\t\t}\n\n\t\treturn {\n\t\t\tbaseMark,\n\t\t\tnewMark,\n\t\t};\n\t}\n\n\tprivate peekMinLength(): number {\n\t\tconst baseMark = this.baseMarks.peek();\n\t\tconst newMark = this.newMarks.peek();\n\t\tassert(\n\t\t\tbaseMark !== undefined && newMark !== undefined,\n\t\t\t0x8db /* Cannot peek length unless both mark queues are non-empty */,\n\t\t);\n\n\t\treturn Math.min(newMark.count, baseMark.count);\n\t}\n}\n\ninterface ComposeMarks {\n\tbaseMark: Mark;\n\tnewMark: Mark;\n}\n\nfunction getMovedChangesFromMark(\n\tmoveEffects: ComposeNodeManager,\n\tmarkEffect: MarkEffect,\n): NodeId | undefined {\n\tif (!isDetach(markEffect)) {\n\t\treturn undefined;\n\t}\n\n\treturn moveEffects.getNewChangesForBaseDetach(getDetachedRootId(markEffect), 1).value\n\t\t?.nodeChange;\n}\n\nfunction getUpdatedDetachId(\n\tmanager: ComposeNodeManager,\n\tmark: CellMark<Detach>,\n): ChangeAtomId | undefined {\n\treturn manager.getNewChangesForBaseDetach(getDetachedRootId(mark), mark.count).value\n\t\t?.detachId;\n}\n"]}
|