@fluidframework/tree 2.90.0 → 2.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +365 -0
- package/alpha.d.ts +2 -2
- package/api-extractor/api-extractor-lint-alpha.cjs.json +1 -1
- package/api-extractor/api-extractor-lint-alpha.esm.json +1 -1
- package/api-extractor/api-extractor-lint-beta.cjs.json +1 -1
- package/api-extractor/api-extractor-lint-beta.esm.json +1 -1
- package/api-extractor/api-extractor-lint-bundle.json +1 -1
- package/api-extractor/api-extractor-lint-legacy.cjs.json +1 -1
- package/api-extractor/api-extractor-lint-legacy.esm.json +1 -1
- package/api-extractor/api-extractor-lint-public.cjs.json +1 -1
- package/api-extractor/api-extractor-lint-public.esm.json +1 -1
- package/api-extractor/api-extractor.current.json +1 -1
- package/api-extractor/api-extractor.legacy.json +2 -1
- package/api-extractor.json +1 -0
- package/api-report/tree.alpha.api.md +141 -37
- package/beta.d.ts +2 -2
- package/dist/api.d.ts +6 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js.map +1 -1
- package/dist/codec/codec.d.ts +28 -2
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +1 -0
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/index.d.ts +2 -2
- package/dist/codec/index.d.ts.map +1 -1
- package/dist/codec/index.js +2 -4
- package/dist/codec/index.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +18 -36
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js +46 -59
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/codec/versioned/index.d.ts +1 -1
- package/dist/codec/versioned/index.d.ts.map +1 -1
- package/dist/codec/versioned/index.js +2 -4
- package/dist/codec/versioned/index.js.map +1 -1
- package/dist/core/forest/forest.d.ts +5 -2
- package/dist/core/forest/forest.d.ts.map +1 -1
- package/dist/core/forest/forest.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/changeRebaser.d.ts +8 -1
- package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
- package/dist/core/rebase/changeRebaser.js.map +1 -1
- package/dist/core/rebase/revisionTagCodec.d.ts +4 -3
- package/dist/core/rebase/revisionTagCodec.d.ts.map +1 -1
- package/dist/core/rebase/revisionTagCodec.js +2 -0
- package/dist/core/rebase/revisionTagCodec.js.map +1 -1
- package/dist/core/rebase/utils.d.ts +2 -2
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +4 -4
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/schema-stored/formatV2.d.ts +1 -1
- package/dist/core/schema-stored/formatV2.js +1 -1
- package/dist/core/schema-stored/formatV2.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +8 -0
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +42 -7
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/cursor.d.ts +25 -1
- package/dist/core/tree/cursor.d.ts.map +1 -1
- package/dist/core/tree/cursor.js +45 -1
- package/dist/core/tree/cursor.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts +13 -1
- package/dist/core/tree/deltaUtil.d.ts.map +1 -1
- package/dist/core/tree/deltaUtil.js +34 -1
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts +5 -5
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.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 +6 -2
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts +11 -0
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +1 -1
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +5 -0
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/entrypoints/alpha.d.ts +6 -0
- package/dist/entrypoints/alpha.d.ts.map +1 -0
- package/dist/entrypoints/alpha.js +91 -0
- package/dist/entrypoints/alpha.js.map +1 -0
- package/dist/entrypoints/beta.d.ts +6 -0
- package/dist/entrypoints/beta.d.ts.map +1 -0
- package/dist/entrypoints/beta.js +43 -0
- package/dist/entrypoints/beta.js.map +1 -0
- package/dist/entrypoints/internal.d.ts +6 -0
- package/dist/entrypoints/internal.d.ts.map +1 -0
- package/dist/entrypoints/internal.js +28 -0
- package/dist/entrypoints/internal.js.map +1 -0
- package/dist/entrypoints/legacy.d.ts +6 -0
- package/dist/entrypoints/legacy.d.ts.map +1 -0
- package/dist/entrypoints/legacy.js +49 -0
- package/dist/entrypoints/legacy.js.map +1 -0
- package/dist/entrypoints/public.d.ts +6 -0
- package/dist/entrypoints/public.d.ts.map +1 -0
- package/dist/entrypoints/public.js +27 -0
- package/dist/entrypoints/public.js.map +1 -0
- package/dist/feature-libraries/changeAtomIdCodec.d.ts +4 -3
- package/dist/feature-libraries/changeAtomIdCodec.d.ts.map +1 -1
- package/dist/feature-libraries/changeAtomIdCodec.js +2 -0
- package/dist/feature-libraries/changeAtomIdCodec.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +2 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +2 -2
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +4 -4
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +6 -6
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -4
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +6 -6
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +12 -12
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/{formatGeneric.d.ts → format/formatGeneric.d.ts} +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +187 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js +115 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +33 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js +16 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts +10 -0
- package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/index.js +18 -0
- package/dist/feature-libraries/chunked-forest/codec/format/index.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts +93 -0
- package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js +29 -0
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
- package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/index.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +7 -7
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +6 -4
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +3 -3
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/cursorComparator.d.ts +23 -0
- package/dist/feature-libraries/cursorComparator.d.ts.map +1 -0
- package/dist/feature-libraries/cursorComparator.js +65 -0
- package/dist/feature-libraries/cursorComparator.js.map +1 -0
- package/dist/feature-libraries/forest-summary/codec.d.ts +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +3 -3
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +3 -2
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +5 -5
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +2 -0
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +12 -7
- package/dist/feature-libraries/indexing/anchorTreeIndex.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 +3 -3
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +1 -0
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +14 -6
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +3 -3
- 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 +0 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +10 -10
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +2 -4
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +3 -3
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +3 -3
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +11 -6
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +2 -2
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +4 -4
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts +3 -3
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-edits/index.d.ts +1 -1
- package/dist/feature-libraries/schema-edits/index.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/index.js +2 -3
- package/dist/feature-libraries/schema-edits/index.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -15
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -54
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts +3 -16
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +1 -21
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -1
- package/dist/feature-libraries/schema-index/formatV2.js +1 -1
- package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
- package/dist/feature-libraries/schema-index/index.d.ts +1 -1
- package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/index.js +1 -2
- package/dist/feature-libraries/schema-index/index.js.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -4
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts +1 -1
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +14 -21
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +2 -2
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +1 -2
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +2 -36
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +15 -117
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +3 -22
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +10 -27
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +3 -2
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +23 -16
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
- 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/sharedTreeChangeFormat.d.ts +8 -7
- package/dist/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFormat.js +13 -5
- package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
- package/dist/shared-tree/tree.d.ts.map +1 -1
- package/dist/shared-tree/tree.js +2 -1
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +13 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +3 -0
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +34 -69
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +885 -677
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree/unhydratedTreeContext.js +3 -3
- package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +23 -12
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +40 -67
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js +0 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +10 -2
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js +18 -13
- 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 +6 -9
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +3 -3
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +5 -8
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -3
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js +8 -8
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts +2 -3
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js +5 -4
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +15 -14
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +38 -74
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormat.d.ts +0 -1
- package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormat.js +1 -2
- package/dist/shared-tree-core/messageFormat.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +1 -3
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +12 -2
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/sharedTreeAttributes.d.ts.map +1 -1
- package/dist/sharedTreeAttributes.js +3 -0
- package/dist/sharedTreeAttributes.js.map +1 -1
- package/dist/simple-tree/api/eraseSchemaDetails.d.ts +43 -0
- package/dist/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -1
- package/dist/simple-tree/api/eraseSchemaDetails.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +4 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +126 -29
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +72 -7
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/dist/simple-tree/api/schemaStatics.d.ts +10 -11
- package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaStatics.js +13 -7
- package/dist/simple-tree/api/schemaStatics.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +6 -6
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +7 -19
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeAlpha.d.ts +69 -0
- package/dist/simple-tree/api/treeAlpha.d.ts.map +1 -0
- package/dist/simple-tree/api/treeAlpha.js +7 -0
- package/dist/simple-tree/api/treeAlpha.js.map +1 -0
- package/dist/simple-tree/api/treeBeta.d.ts +1 -1
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.d.ts +3 -0
- package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts +49 -0
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +41 -2
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +23 -2
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +45 -8
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +5 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts +3 -2
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js +3 -4
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +16 -0
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +23 -0
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +10 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/index.d.ts +2 -2
- package/dist/simple-tree/node-kinds/array/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/index.d.ts +2 -2
- package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/index.d.ts +2 -2
- package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts +43 -7
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +26 -2
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +321 -13
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +100 -25
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +5 -2
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/rangeMap.d.ts +25 -18
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +24 -30
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/referenceCounting.d.ts.map +1 -1
- package/dist/util/referenceCounting.js +0 -1
- package/dist/util/referenceCounting.js.map +1 -1
- package/dist/util/typeCheck.d.ts.map +1 -1
- package/dist/util/typeCheck.js.map +1 -1
- package/dist/util/typeUtils.d.ts.map +1 -1
- package/dist/util/typeUtils.js.map +1 -1
- package/eslint.config.mts +10 -2
- package/internal.d.ts +2 -2
- package/legacy.d.ts +2 -2
- package/lib/api.d.ts +6 -1
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js.map +1 -1
- package/lib/codec/codec.d.ts +28 -2
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +1 -0
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/index.d.ts +2 -2
- 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 +18 -36
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js +45 -56
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/codec/versioned/index.d.ts +1 -1
- package/lib/codec/versioned/index.d.ts.map +1 -1
- package/lib/codec/versioned/index.js +1 -1
- package/lib/codec/versioned/index.js.map +1 -1
- package/lib/core/forest/forest.d.ts +5 -2
- package/lib/core/forest/forest.d.ts.map +1 -1
- package/lib/core/forest/forest.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/changeRebaser.d.ts +8 -1
- package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
- package/lib/core/rebase/changeRebaser.js.map +1 -1
- package/lib/core/rebase/revisionTagCodec.d.ts +4 -3
- package/lib/core/rebase/revisionTagCodec.d.ts.map +1 -1
- package/lib/core/rebase/revisionTagCodec.js +2 -0
- package/lib/core/rebase/revisionTagCodec.js.map +1 -1
- package/lib/core/rebase/utils.d.ts +2 -2
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +4 -4
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/schema-stored/formatV2.d.ts +1 -1
- package/lib/core/schema-stored/formatV2.js +1 -1
- package/lib/core/schema-stored/formatV2.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts +8 -0
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +42 -7
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/cursor.d.ts +25 -1
- package/lib/core/tree/cursor.d.ts.map +1 -1
- package/lib/core/tree/cursor.js +43 -0
- package/lib/core/tree/cursor.js.map +1 -1
- package/lib/core/tree/deltaUtil.d.ts +13 -1
- package/lib/core/tree/deltaUtil.d.ts.map +1 -1
- package/lib/core/tree/deltaUtil.js +31 -0
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts +5 -5
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.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 +2 -2
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts +11 -0
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +1 -1
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +5 -0
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/entrypoints/alpha.d.ts +6 -0
- package/lib/entrypoints/alpha.d.ts.map +1 -0
- package/lib/entrypoints/alpha.js +12 -0
- package/lib/entrypoints/alpha.js.map +1 -0
- package/lib/entrypoints/beta.d.ts +6 -0
- package/lib/entrypoints/beta.d.ts.map +1 -0
- package/lib/entrypoints/beta.js +12 -0
- package/lib/entrypoints/beta.js.map +1 -0
- package/lib/entrypoints/internal.d.ts +6 -0
- package/lib/entrypoints/internal.d.ts.map +1 -0
- package/lib/entrypoints/internal.js +12 -0
- package/lib/entrypoints/internal.js.map +1 -0
- package/lib/entrypoints/legacy.d.ts +6 -0
- package/lib/entrypoints/legacy.d.ts.map +1 -0
- package/lib/entrypoints/legacy.js +15 -0
- package/lib/entrypoints/legacy.js.map +1 -0
- package/lib/entrypoints/public.d.ts +6 -0
- package/lib/entrypoints/public.d.ts.map +1 -0
- package/lib/entrypoints/public.js +10 -0
- package/lib/entrypoints/public.js.map +1 -0
- package/lib/feature-libraries/changeAtomIdCodec.d.ts +4 -3
- package/lib/feature-libraries/changeAtomIdCodec.d.ts.map +1 -1
- package/lib/feature-libraries/changeAtomIdCodec.js +2 -0
- package/lib/feature-libraries/changeAtomIdCodec.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +2 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +2 -2
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +4 -4
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +4 -4
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -4
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +12 -12
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/{formatGeneric.d.ts → format/formatGeneric.d.ts} +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +187 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js +112 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +33 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js +13 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts +10 -0
- package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/index.js +8 -0
- package/lib/feature-libraries/chunked-forest/codec/format/index.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts +93 -0
- package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/versions.js +26 -0
- package/lib/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
- package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +7 -7
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +4 -2
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
- package/lib/feature-libraries/cursorComparator.d.ts +23 -0
- package/lib/feature-libraries/cursorComparator.d.ts.map +1 -0
- package/lib/feature-libraries/cursorComparator.js +61 -0
- package/lib/feature-libraries/cursorComparator.js.map +1 -0
- package/lib/feature-libraries/forest-summary/codec.d.ts +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +3 -3
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +3 -2
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +3 -2
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +2 -0
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +12 -7
- package/lib/feature-libraries/indexing/anchorTreeIndex.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 +3 -3
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +1 -0
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +14 -6
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +3 -3
- 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 +0 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +10 -10
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +2 -4
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +3 -3
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +3 -3
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +11 -6
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +2 -2
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +4 -4
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts +3 -3
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/schema-edits/index.d.ts +1 -1
- package/lib/feature-libraries/schema-edits/index.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/index.js +1 -1
- package/lib/feature-libraries/schema-edits/index.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -15
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +6 -50
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts +3 -16
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +0 -19
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV2.d.ts +1 -1
- package/lib/feature-libraries/schema-index/formatV2.js +1 -1
- package/lib/feature-libraries/schema-index/formatV2.js.map +1 -1
- package/lib/feature-libraries/schema-index/index.d.ts +1 -1
- package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/index.js +1 -1
- package/lib/feature-libraries/schema-index/index.js.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -4
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/lib/index.d.ts +8 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +9 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts +1 -1
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +4 -11
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +2 -2
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +2 -36
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +17 -116
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +3 -22
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +11 -27
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +3 -2
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +19 -12
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.js +2 -2
- package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +2 -2
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
- package/lib/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFormat.js +11 -5
- package/lib/shared-tree/sharedTreeChangeFormat.js.map +1 -1
- package/lib/shared-tree/tree.d.ts.map +1 -1
- package/lib/shared-tree/tree.js +2 -1
- package/lib/shared-tree/tree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +13 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +3 -0
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +34 -69
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +889 -682
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree/unhydratedTreeContext.js +1 -1
- package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +23 -12
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +41 -65
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js +0 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +10 -2
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js +16 -11
- 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 +5 -8
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +3 -3
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +3 -3
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -3
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.js +8 -8
- package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts +2 -3
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js +5 -4
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +15 -14
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +38 -71
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormat.d.ts +0 -1
- package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormat.js +0 -1
- package/lib/shared-tree-core/messageFormat.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +1 -3
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +14 -4
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/sharedTreeAttributes.d.ts.map +1 -1
- package/lib/sharedTreeAttributes.js +3 -0
- package/lib/sharedTreeAttributes.js.map +1 -1
- package/lib/simple-tree/api/eraseSchemaDetails.d.ts +43 -0
- package/lib/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -1
- package/lib/simple-tree/api/eraseSchemaDetails.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +4 -2
- 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/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +126 -29
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +66 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/lib/simple-tree/api/schemaStatics.d.ts +10 -11
- package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaStatics.js +14 -8
- package/lib/simple-tree/api/schemaStatics.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +7 -7
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +7 -19
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeAlpha.d.ts +69 -0
- package/lib/simple-tree/api/treeAlpha.d.ts.map +1 -0
- package/lib/simple-tree/api/treeAlpha.js +6 -0
- package/lib/simple-tree/api/treeAlpha.js.map +1 -0
- package/lib/simple-tree/api/treeBeta.d.ts +1 -1
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.d.ts +3 -0
- package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts +49 -0
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +41 -2
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +23 -2
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +45 -8
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +5 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts +3 -2
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js +3 -4
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +16 -0
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +23 -0
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +10 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/index.d.ts +2 -2
- package/lib/simple-tree/node-kinds/array/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts +2 -2
- package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/index.d.ts +2 -2
- package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts +43 -7
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +26 -2
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +321 -13
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +103 -28
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +6 -3
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/rangeMap.d.ts +25 -18
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +25 -31
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/referenceCounting.d.ts.map +1 -1
- package/lib/util/referenceCounting.js +0 -1
- package/lib/util/referenceCounting.js.map +1 -1
- package/lib/util/typeCheck.d.ts.map +1 -1
- package/lib/util/typeCheck.js.map +1 -1
- package/lib/util/typeUtils.d.ts.map +1 -1
- package/lib/util/typeUtils.js.map +1 -1
- package/package.json +50 -50
- package/scripts/generate-entrypoint-sources.sh +31 -0
- package/src/api.ts +11 -0
- package/src/codec/codec.ts +32 -2
- package/src/codec/index.ts +2 -3
- package/src/codec/versioned/codec.ts +99 -109
- package/src/codec/versioned/index.ts +1 -3
- package/src/core/forest/forest.ts +5 -2
- package/src/core/index.ts +4 -0
- package/src/core/rebase/changeRebaser.ts +8 -0
- package/src/core/rebase/revisionTagCodec.ts +4 -4
- package/src/core/rebase/utils.ts +9 -2
- package/src/core/schema-stored/formatV2.ts +1 -1
- package/src/core/tree/anchorSet.ts +67 -10
- package/src/core/tree/cursor.ts +52 -1
- package/src/core/tree/deltaUtil.ts +37 -1
- package/src/core/tree/detachedFieldIndexCodecs.ts +4 -4
- package/src/core/tree/index.ts +4 -0
- package/src/core/tree/visitDelta.ts +13 -1
- package/src/core/tree/visitorUtils.ts +5 -0
- package/{dist/alpha.d.ts → src/entrypoints/alpha.ts} +25 -11
- package/{lib/beta.d.ts → src/entrypoints/beta.ts} +4 -7
- package/src/entrypoints/internal.ts +13 -0
- package/{lib/legacy.d.ts → src/entrypoints/legacy.ts} +13 -8
- package/{dist/public.d.ts → src/entrypoints/public.ts} +3 -6
- package/src/feature-libraries/changeAtomIdCodec.ts +8 -7
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -2
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +18 -13
- package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -2
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +16 -10
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +16 -14
- package/src/feature-libraries/chunked-forest/codec/{formatGeneric.ts → format/formatGeneric.ts} +1 -1
- package/src/feature-libraries/chunked-forest/codec/{format.ts → format/formatV1.ts} +41 -111
- package/src/feature-libraries/chunked-forest/codec/format/formatV2.ts +31 -0
- package/src/feature-libraries/chunked-forest/codec/format/index.ts +31 -0
- package/src/feature-libraries/chunked-forest/codec/format/versions.ts +81 -0
- package/src/feature-libraries/chunked-forest/codec/index.ts +6 -2
- package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +19 -12
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +6 -4
- package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +10 -10
- package/src/feature-libraries/chunked-forest/index.ts +2 -1
- package/src/feature-libraries/cursorComparator.ts +77 -0
- package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +5 -5
- package/src/feature-libraries/index.ts +5 -3
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +20 -10
- package/src/feature-libraries/mitigatedChangeFamily.ts +4 -1
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +3 -8
- package/src/feature-libraries/modular-schema/defaultRevisionReplacer.ts +16 -8
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +4 -5
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +0 -1
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +19 -26
- package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +4 -4
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -5
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +15 -6
- package/src/feature-libraries/object-forest/objectForest.ts +8 -2
- package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +11 -13
- package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +4 -5
- package/src/feature-libraries/schema-edits/index.ts +1 -4
- package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +10 -78
- package/src/feature-libraries/schema-index/codec.ts +0 -25
- package/src/feature-libraries/schema-index/formatV2.ts +1 -1
- package/src/feature-libraries/schema-index/index.ts +1 -4
- package/src/feature-libraries/sequence-field/moveEffectTable.ts +1 -1
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +6 -6
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +8 -5
- package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +4 -5
- package/src/index.ts +29 -3
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +5 -18
- package/src/shared-tree/index.ts +0 -4
- package/src/shared-tree/schematizingTreeView.ts +19 -165
- package/src/shared-tree/sharedTree.ts +16 -59
- package/src/shared-tree/sharedTreeChangeCodecs.ts +23 -29
- package/src/shared-tree/sharedTreeChangeEnricher.ts +1 -2
- package/src/shared-tree/sharedTreeChangeFamily.ts +2 -0
- package/src/shared-tree/sharedTreeChangeFormat.ts +23 -8
- package/src/shared-tree/tree.ts +2 -5
- package/src/shared-tree/treeAlpha.ts +26 -0
- package/src/shared-tree/treeCheckout.ts +277 -100
- package/src/shared-tree/unhydratedTreeContext.ts +1 -1
- package/src/shared-tree-core/editManagerCodecs.ts +99 -124
- package/src/shared-tree-core/editManagerCodecsCommons.ts +0 -1
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +54 -59
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +72 -95
- package/src/shared-tree-core/index.ts +4 -8
- package/src/shared-tree-core/messageCodecV1ToV4.ts +56 -71
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +76 -92
- package/src/shared-tree-core/messageCodecs.ts +88 -126
- package/src/shared-tree-core/messageFormat.ts +0 -3
- package/src/shared-tree-core/sharedTreeCore.ts +14 -21
- package/src/sharedTreeAttributes.ts +3 -0
- package/src/simple-tree/api/eraseSchemaDetails.ts +60 -0
- package/src/simple-tree/api/index.ts +22 -1
- package/src/simple-tree/api/schemaFactory.ts +8 -3
- package/src/simple-tree/api/schemaFactoryAlpha.ts +275 -27
- package/src/simple-tree/api/schemaFactoryBeta.ts +10 -1
- package/src/simple-tree/api/schemaStatics.ts +79 -21
- package/src/simple-tree/api/storedSchema.ts +8 -19
- package/src/simple-tree/api/tree.ts +7 -20
- package/src/simple-tree/api/treeAlpha.ts +90 -0
- package/src/simple-tree/api/treeBeta.ts +1 -1
- package/src/simple-tree/api/treeChangeEvents.ts +3 -0
- package/src/simple-tree/api/treeNodeApi.ts +95 -3
- package/src/simple-tree/api/typesUnsafe.ts +49 -1
- package/src/simple-tree/core/treeNodeKernel.ts +53 -7
- package/src/simple-tree/core/unhydratedFlexTree.ts +5 -1
- package/src/simple-tree/fieldSchema.ts +29 -5
- package/src/simple-tree/index.ts +20 -0
- package/src/simple-tree/node-kinds/array/arrayNode.ts +64 -0
- package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +25 -1
- package/src/simple-tree/node-kinds/array/index.ts +2 -0
- package/src/simple-tree/node-kinds/index.ts +5 -0
- package/src/simple-tree/node-kinds/object/index.ts +3 -0
- package/src/simple-tree/node-kinds/object/objectNode.ts +69 -11
- package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +33 -2
- package/src/text/textDomainFormatted.ts +113 -11
- package/src/treeFactory.ts +10 -5
- package/src/util/rangeMap.ts +54 -50
- package/src/util/referenceCounting.ts +0 -1
- package/src/util/typeCheck.ts +1 -0
- package/src/util/typeUtils.ts +4 -7
- package/dist/beta.d.ts +0 -152
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts +0 -383
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +0 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js +0 -191
- package/dist/feature-libraries/chunked-forest/codec/format.js.map +0 -1
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +0 -1
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js.map +0 -1
- package/dist/legacy.d.ts +0 -159
- package/lib/alpha.d.ts +0 -304
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts +0 -383
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js +0 -188
- package/lib/feature-libraries/chunked-forest/codec/format.js.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js.map +0 -1
- package/lib/public.d.ts +0 -94
- /package/dist/feature-libraries/chunked-forest/codec/{formatGeneric.js → format/formatGeneric.js} +0 -0
- /package/lib/feature-libraries/chunked-forest/codec/{formatGeneric.js → format/formatGeneric.js} +0 -0
package/dist/core/tree/cursor.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.inCursorNode = exports.inCursorField = exports.castCursorToSynchronous = exports.forEachNodeInSubtree = exports.forEachNode = exports.iterateCursorField = exports.mapCursorField = exports.forEachField = exports.mapCursorFields = exports.CursorLocationType = exports.isCursor = exports.CursorMarker = void 0;
|
|
7
|
+
exports.inCursorNode = exports.inCursorField = exports.castCursorToSynchronous = exports.forEachNodeInSubtree = exports.forEachNodeSubsequence = exports.forEachNode = exports.iterateCursorField = exports.mapCursorField = exports.forEachField = exports.mapCursorFields = exports.CursorLocationType = exports.isCursor = exports.CursorMarker = void 0;
|
|
8
8
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
9
|
/**
|
|
10
10
|
* A symbol for marking an object as an {@link ITreeCursor}.
|
|
@@ -39,6 +39,8 @@ var CursorLocationType;
|
|
|
39
39
|
CursorLocationType[CursorLocationType["Fields"] = 1] = "Fields";
|
|
40
40
|
})(CursorLocationType || (exports.CursorLocationType = CursorLocationType = {}));
|
|
41
41
|
/**
|
|
42
|
+
* Applies a mapping function to each field of the current node, returning the results as an array.
|
|
43
|
+
*
|
|
42
44
|
* @param cursor - tree whose fields will be visited.
|
|
43
45
|
* @param f - builds output from field, which will be selected in cursor when cursor is provided.
|
|
44
46
|
* If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.
|
|
@@ -55,6 +57,8 @@ function mapCursorFields(cursor, f) {
|
|
|
55
57
|
}
|
|
56
58
|
exports.mapCursorFields = mapCursorFields;
|
|
57
59
|
/**
|
|
60
|
+
* Iterates over each field of the current node, invoking a callback for each.
|
|
61
|
+
*
|
|
58
62
|
* @param cursor - cursor at a node whose fields will be visited.
|
|
59
63
|
* @param f - For on each field.
|
|
60
64
|
* If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.
|
|
@@ -67,6 +71,8 @@ function forEachField(cursor, f) {
|
|
|
67
71
|
}
|
|
68
72
|
exports.forEachField = forEachField;
|
|
69
73
|
/**
|
|
74
|
+
* Applies a mapping function to each node of the current field, returning the results as an array.
|
|
75
|
+
*
|
|
70
76
|
* @param cursor - tree whose field will be visited.
|
|
71
77
|
* @param f - builds output from field member, which will be selected in cursor when cursor is provided.
|
|
72
78
|
* If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.
|
|
@@ -82,6 +88,8 @@ function mapCursorField(cursor, f) {
|
|
|
82
88
|
}
|
|
83
89
|
exports.mapCursorField = mapCursorField;
|
|
84
90
|
/**
|
|
91
|
+
* Lazily iterates over each node in the current field, yielding the result of applying a mapping function to each.
|
|
92
|
+
*
|
|
85
93
|
* @param cursor - The tree whose field will be visited.
|
|
86
94
|
* @param f - Builds output from field member, which will be selected in cursor when cursor is provided.
|
|
87
95
|
* If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.
|
|
@@ -96,6 +104,8 @@ function* iterateCursorField(cursor, f) {
|
|
|
96
104
|
}
|
|
97
105
|
exports.iterateCursorField = iterateCursorField;
|
|
98
106
|
/**
|
|
107
|
+
* Iterates over each node in the current field, invoking a callback for each.
|
|
108
|
+
*
|
|
99
109
|
* @param cursor - cursor at a field whose nodes will be visited.
|
|
100
110
|
* @param f - For on each node.
|
|
101
111
|
* If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.
|
|
@@ -108,6 +118,40 @@ function forEachNode(cursor, f) {
|
|
|
108
118
|
}
|
|
109
119
|
exports.forEachNode = forEachNode;
|
|
110
120
|
/**
|
|
121
|
+
* Iterates over a subrange of nodes in the current field, invoking a callback for each.
|
|
122
|
+
* See {@link forEachNode} for a version that visits all nodes in the field.
|
|
123
|
+
*
|
|
124
|
+
* @param cursor - cursor at a field whose nodes will be visited.
|
|
125
|
+
* @param startIndex - index of first node to visit. Must be non-negative.
|
|
126
|
+
* @param endIndex - index of first node to NOT visit. Must be greater than or equal to `startIndex`.
|
|
127
|
+
* @param f - For on each node.
|
|
128
|
+
* If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.
|
|
129
|
+
*/
|
|
130
|
+
function forEachNodeSubsequence(cursor, startIndex, endIndex, f) {
|
|
131
|
+
(0, internal_1.assert)(cursor.mode === 1 /* CursorLocationType.Fields */, 0xce5 /* should be in fields */);
|
|
132
|
+
(0, internal_1.assert)(startIndex >= 0, 0xce6 /* invalid startIndex */);
|
|
133
|
+
(0, internal_1.assert)(endIndex >= startIndex, 0xce7 /* invalid endIndex */);
|
|
134
|
+
const outputLength = endIndex - startIndex;
|
|
135
|
+
if (outputLength === 0) {
|
|
136
|
+
// Avoids out of bounds index on cursor.enterNode when requesting 0 length subarray at end of array.
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
cursor.enterNode(startIndex);
|
|
140
|
+
for (let i = 0; i < outputLength; i++) {
|
|
141
|
+
f(cursor);
|
|
142
|
+
const hasNext = cursor.nextNode();
|
|
143
|
+
if (!hasNext) {
|
|
144
|
+
(0, internal_1.assert)(i === outputLength - 1, 0xce8 /* requested endIndex is out of bounds */);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
cursor.exitNode();
|
|
149
|
+
}
|
|
150
|
+
exports.forEachNodeSubsequence = forEachNodeSubsequence;
|
|
151
|
+
/**
|
|
152
|
+
* Deeply iterates over each node in the current subtree (rooted at a node or field),
|
|
153
|
+
* invoking a callback for each.
|
|
154
|
+
*
|
|
111
155
|
* @param cursor - cursor at a field or node.
|
|
112
156
|
* @param f - Function to invoke for each node.
|
|
113
157
|
* If `f` moves the cursor, it must put it back to where it was at the beginning of `f` before returning.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../../src/core/tree/cursor.ts"],"names":[],"mappings":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CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;AACF,CAAC;AAVD,oDAUC;AAED;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,MAAmB;IAC1D,OAAO,MAAgC,CAAC;AACzC,CAAC;AAFD,0DAEC;AAED;;;;;;GAMG;AACH,SAAgB,aAAa,CAC5B,MAAe,EACf,KAAe,EACf,CAAyB;IAEzB,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACzB,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IACzB,MAAM,CAAC,SAAS,EAAE,CAAC;IACnB,OAAO,MAAM,CAAC;AACf,CAAC;AATD,sCASC;AAED;;;;;;GAMG;AACH,SAAgB,YAAY,CAC3B,MAAe,EACf,KAAa,EACb,CAAyB;IAEzB,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACxB,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IACzB,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClB,OAAO,MAAM,CAAC;AACf,CAAC;AATD,oCASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport type { FieldKey } from \"../schema-stored/index.js\";\n\nimport type { FieldUpPath, UpPath } from \"./pathTree.js\";\nimport type { TreeType, Value } from \"./types.js\";\n\n/**\n * A symbol for marking an object as an {@link ITreeCursor}.\n *\n * Useful when APIs want to take in tree data in multiple formats, including cursors.\n */\nexport const CursorMarker: unique symbol = Symbol(\"CursorMarker\");\n\n/**\n * Check if something is an {@link ITreeCursor}.\n *\n * Useful when APIs want to take in tree data in multiple formats, including cursors.\n */\nexport function isCursor(data: unknown): data is ITreeCursor {\n\t// Other than on null and undefined, looking up a missing symbol shouldn't type error.\n\t// typeof check deals with undefined while providing an early out for other non-object types.\n\treturn (\n\t\tdata !== null &&\n\t\ttypeof data === \"object\" &&\n\t\t(data as Partial<ITreeCursor>)[CursorMarker] === true\n\t);\n}\n\n/**\n * A stateful low-level interface for reading tree data.\n * *\n * @remarks Cursor exists so that specialized data formats can be viewed through\n * a common abstraction. This allows performance optimizations to be done based\n * on data.\n *\n * A tree cursor is similar to a database cursor in that it allows for the efficient\n * traversal over the contents of a tree. Note that unlike a database cursor,\n * tree cursors may be invalidated after any edit to the tree. For a cursor-like\n * structure that also remains valid across edits, see {@link AnchorNode}.\n */\nexport interface ITreeCursor {\n\t/**\n\t * Marks this object as a cursor.\n\t */\n\treadonly [CursorMarker]: true;\n\n\t/**\n\t * What kind of place the cursor is at.\n\t * Determines which operations are allowed.\n\t *\n\t * @remarks\n\t * Users of cursors frequently need to refer to places in trees, both fields and nodes.\n\t * Approaches other than having the cursor have separate modes for these\n\t * cases had issues even worse than having the two modes.\n\t *\n\t * For example, modeling fields as parent + key has issues when there is no\n\t * parent, and doesn't provide a great way to do iteration over fields while\n\t * also having a nice API and making it easy for the implementation to track\n\t * state (like its current location inside a sequence tree of fields) while\n\t * traversing without having to allocate some state management for that.\n\t *\n\t * Another approach, of using arrays of cursors for fields (like we currently\n\t * do for inserting content) is very inefficient and better addressed by a\n\t * dual mode cursor.\n\t *\n\t * Another approach, of using the first node in a field when referring to\n\t * the field gets confusing since it's unclear if a given cursor means that\n\t * node, or that node, and the ones after it, and in the second case, it's\n\t * hard to restore the cursor back to the right state when returning. It also\n\t * doesn't work for empty fields. Overall there just didn't seem to be a way\n\t * that sucked less than the dual mode API.\n\t */\n\treadonly mode: CursorLocationType;\n\n\t/*\n\t * True iff the current field or node (depending on mode) is \"pending\",\n\t * meaning that it has not been downloaded.\n\t */\n\treadonly pending: boolean;\n\n\t// ********** APIs for when mode = Fields ********** //\n\n\t/**\n\t * Moves the \"current field\" forward one in an arbitrary field traversal order,\n\t * skipping any empty fields.\n\t *\n\t * If there is no remaining field to iterate to,\n\t * returns false and navigates up to the parent setting the mode to `Nodes`.\n\t *\n\t * Order of fields is only guaranteed to be consistent through a single iteration.\n\t *\n\t * If skipPending, skip past fields which are currently pending.\n\t * This can be used to skip to the end of a large number of consecutive pending fields.\n\t *\n\t * Allowed when `mode` is `Fields`.\n\t */\n\tnextField(): boolean;\n\n\t/**\n\t * Navigate up to parent node.\n\t * Sets mode to `Nodes`\n\t *\n\t * Only valid when `mode` is `Fields`.\n\t *\n\t * TODO: what to do if at root?\n\t */\n\texitField(): void;\n\n\t/**\n\t * Moves the \"current field\" forward until `pending` is `false`.\n\t *\n\t * If there are no remaining field to iterate to,\n\t * returns false and navigates up to the parent setting the mode to `Nodes`.\n\t *\n\t * Order of fields is only guaranteed to be consistent through a single iteration.\n\t *\n\t * Allowed when `mode` is `Fields`.\n\t */\n\tskipPendingFields(): boolean;\n\n\t// ********** APIs for when mode = Fields, and not pending ********** //\n\n\t/**\n\t * Returns the FieldKey for the current field.\n\t *\n\t * Allowed when `mode` is `Fields`, and not `pending`.\n\t */\n\tgetFieldKey(): FieldKey;\n\n\t/**\n\t * @returns the number of immediate children in the current field.\n\t *\n\t * Allowed when `mode` is `Fields`, and not `pending`.\n\t */\n\tgetFieldLength(): number;\n\n\t/**\n\t * Moves to the first node of the selected field, setting mode to `Nodes`.\n\t *\n\t * If field is empty, returns false instead.\n\t *\n\t * Allowed when `mode` is `Fields`, and not `pending`.\n\t */\n\tfirstNode(): boolean;\n\n\t/**\n\t * Sets current node to the node at the provided `index` of the current field.\n\t *\n\t * Allowed when `mode` is `Fields`, and not `pending`.\n\t * Sets mode to `Nodes`.\n\t */\n\tenterNode(childIndex: number): void;\n\n\t/**\n\t * Returns a path to the current field. See {@link FieldUpPath}.\n\t *\n\t * Only valid when `mode` is `Fields`.\n\t *\n\t * If no prefix is provided, assumes this cursor is treated as if it has a root node where its field keys are actually detached sequences.\n\t * If the cursor is not rooted at such a node, the `prefix` should be used to ensure the path has the correct root.\n\t * This requirement exists because {@link FieldUpPath}s are absolute paths\n\t * and thus must be rooted in a detached sequence.\n\t *\n\t * @param prefix - optional overrides to apply to the root of the returned path.\n\t * See {@link PathRootPrefix}.\n\t * This adjusts the path as if the tree data accessible to this cursor is part of a larger tree.\n\t *\n\t * @returns a path to the current field.\n\t */\n\tgetFieldPath(prefix?: PathRootPrefix): FieldUpPath;\n\n\t// ********** APIs for when mode = Nodes ********** //\n\n\t/**\n\t * Returns a path to the current node. See {@link UpPath}.\n\t *\n\t * Only valid when `mode` is `Nodes`.\n\t *\n\t * If no prefix is provided, assumes this cursor is treated as if it has a root node where its field keys are actually detached sequences.\n\t * If the cursor is not rooted at such a node, the `prefix` should be used to ensure the path has the correct root.\n\t * This requirement exists because {@link UpPath}s are absolute paths\n\t * and thus must be rooted in a detached sequence.\n\t *\n\t * @param prefix - optional overrides to apply to the root of the returned path.\n\t * See {@link PathRootPrefix}.\n\t * This adjusts the path as if the tree data accessible to this cursor is part of a larger tree.\n\t *\n\t * @returns a path to the current node.\n\t */\n\tgetPath(prefix?: PathRootPrefix): UpPath | undefined;\n\n\t/**\n\t * Index (within its parent field) of the current node.\n\t *\n\t * Only valid when `mode` is `Nodes`.\n\t */\n\treadonly fieldIndex: number;\n\n\t/**\n\t * Index (within its parent field) of the first node in the current chunk.\n\t * Always less than or equal to `currentIndexInField`.\n\t *\n\t * Only valid when `mode` is `Nodes`.\n\t */\n\treadonly chunkStart: number;\n\n\t/**\n\t * Length of current chunk.\n\t * Since an entire chunk always has the same `pending` value,\n\t * can be used to help skip over all of a pending chunk at once.\n\t *\n\t * TODO:\n\t * Add optional APIs to access underlying chunks so readers can\n\t * accelerate processing of chunk formats they understand.\n\t *\n\t * Only valid when `mode` is `Nodes`.\n\t */\n\treadonly chunkLength: number;\n\n\t/**\n\t * Moves `offset` nodes in the field.\n\t * If seeking to exactly past either end,\n\t * returns false and navigates up to the parent field (setting mode to `Fields`).\n\t *\n\t * Allowed if mode is `Nodes`.\n\t */\n\tseekNodes(offset: number): boolean;\n\n\t/**\n\t * The same as `seekNodes(1)`, but might be faster.\n\t */\n\tnextNode(): boolean;\n\n\t/**\n\t * Navigate up to parent field.\n\t * Sets mode to `Fields`\n\t *\n\t * Same as seek Number.POSITIVE_INFINITY, but only valid when `mode` is `Nodes`.\n\t *\n\t * TODO: what to do if at root?\n\t * TODO: Maybe merge with upToNode to make a single \"Up\"?\n\t */\n\texitNode(): void;\n\n\t// ********** APIs for when mode = Nodes and not pending ********** //\n\n\t/**\n\t * Enters the first non-empty field (setting mode to `Fields`)\n\t * so fields can be iterated with `nextField` and `skipPendingFields`.\n\t *\n\t * If there are no fields, mode is returned to `Nodes` and false is returned.\n\t *\n\t * Allowed when `mode` is `Nodes` and not `pending`.\n\t */\n\tfirstField(): boolean;\n\n\t/**\n\t * Navigate to the field with the specified `key` and set the mode to `Fields`.\n\t *\n\t * Only valid when `mode` is `Nodes`, and not `pending`.\n\t */\n\tenterField(key: FieldKey): void;\n\n\t/**\n\t * The type of the currently selected node.\n\t *\n\t * Only valid when `mode` is `Nodes`, and not `pending`.\n\t */\n\treadonly type: TreeType;\n\n\t/**\n\t * The value associated with the currently selected node.\n\t *\n\t * Only valid when `mode` is `Nodes`, and not `pending`.\n\t */\n\treadonly value: Value;\n}\n\n/**\n * Prefix to apply as the root of a {@link UpPath} or {@link FieldUpPath}.\n *\n * @remarks This can be used to take a path relative to a subtree, and make it relative to a larger containing tree.\n * For example, if a node is being inserted in the 5th position in a field \"Foo\", you can update a path in that node's subtree to its new path by prefixing it with\n * `{ parent: theNodeAboveTheMovedNode, rootFieldOverride: Foo, indexOffset: 5 }`.\n * See {@link prefixPath} and {@link prefixFieldPath} for how to apply the prefix to the paths.\n */\nexport interface PathRootPrefix {\n\t/**\n\t * The new parent to place above root of the path which is being prefixed.\n\t * This replaces the `undefined` at the root of the path.\n\t *\n\t * @remarks specifying `undefined` here results in no change to the path.\n\t */\n\tparent?: UpPath | undefined;\n\n\t/**\n\t * The field of `parent` that the original path will be included under.\n\t *\n\t * If `undefined` the root field key from the original path will be used.\n\t */\n\trootFieldOverride?: FieldKey;\n\n\t/**\n\t * Offset to add to the uppermost `parentIndex` in the original path.\n\t */\n\tindexOffset?: number;\n}\n\nexport const enum CursorLocationType {\n\t/**\n\t * Can iterate through nodes in a field.\n\t * At a \"current node\".\n\t */\n\tNodes,\n\n\t/**\n\t * Can iterate through fields of a node.\n\t * At a \"current field\".\n\t */\n\tFields,\n}\n\n/**\n * {@link ITreeCursor} that is never pending.\n */\nexport interface ITreeCursorSynchronous extends ITreeCursor {\n\treadonly pending: false;\n}\n\n/**\n * @param cursor - tree whose fields will be visited.\n * @param f - builds output from field, which will be selected in cursor when cursor is provided.\n * If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.\n * @returns array resulting from applying `f` to each field of the current node on `cursor`.\n * Returns an empty array if the node is empty or not present (which are considered the same).\n * Note that order is not specified for field iteration.\n */\nexport function mapCursorFields<T, TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tf: (cursor: TCursor) => T,\n): T[] {\n\tconst output: T[] = [];\n\tforEachField(cursor, (c) => {\n\t\toutput.push(f(c));\n\t});\n\treturn output;\n}\n\n/**\n * @param cursor - cursor at a node whose fields will be visited.\n * @param f - For on each field.\n * If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.\n */\nexport function forEachField<TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tf: (cursor: TCursor) => void,\n): void {\n\tassert(cursor.mode === CursorLocationType.Nodes, 0x411 /* should be in nodes */);\n\tfor (let inField = cursor.firstField(); inField; inField = cursor.nextField()) {\n\t\tf(cursor);\n\t}\n}\n\n/**\n * @param cursor - tree whose field will be visited.\n * @param f - builds output from field member, which will be selected in cursor when cursor is provided.\n * If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.\n * @returns array resulting from applying `f` to each item of the current field on `cursor`.\n * Returns an empty array if the field is empty or not present (which are considered the same).\n */\nexport function mapCursorField<T, TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tf: (cursor: TCursor) => T,\n): T[] {\n\tconst output: T[] = [];\n\tforEachNode(cursor, (c) => {\n\t\toutput.push(f(c));\n\t});\n\treturn output;\n}\n\n/**\n * @param cursor - The tree whose field will be visited.\n * @param f - Builds output from field member, which will be selected in cursor when cursor is provided.\n * If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.\n * @returns An iterable of `T` resulting from applying `f` to each item of the current field on `cursor`.\n * Yields nothing if an empty array if the field is empty or not present (which are considered the same).\n */\nexport function* iterateCursorField<T, TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tf: (cursor: TCursor) => T,\n): IterableIterator<T> {\n\tassert(cursor.mode === CursorLocationType.Fields, 0x7a8 /* should be in fields */);\n\tfor (let inNodes = cursor.firstNode(); inNodes; inNodes = cursor.nextNode()) {\n\t\tyield f(cursor);\n\t}\n}\n\n/**\n * @param cursor - cursor at a field whose nodes will be visited.\n * @param f - For on each node.\n * If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.\n */\nexport function forEachNode<TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tf: (cursor: TCursor) => void,\n): void {\n\tassert(cursor.mode === CursorLocationType.Fields, 0x3bd /* should be in fields */);\n\tfor (let inNodes = cursor.firstNode(); inNodes; inNodes = cursor.nextNode()) {\n\t\tf(cursor);\n\t}\n}\n\n/**\n * @param cursor - cursor at a field or node.\n * @param f - Function to invoke for each node.\n * If `f` moves the cursor, it must put it back to where it was at the beginning of `f` before returning.\n *\n * Invokes `f` on each node in the subtree rooted at the current field or node.\n * Traversal is pre-order.\n * If the cursor is at a node, `f` will be invoked on that node.\n *\n * Returns the `cursor` to its initial position.\n */\nexport function forEachNodeInSubtree<TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tf: (cursor: TCursor) => void,\n): void {\n\tif (cursor.mode === CursorLocationType.Nodes) {\n\t\tf(cursor);\n\t\tforEachField(cursor, (c) => forEachNodeInSubtree(c, f));\n\t} else {\n\t\tforEachNode(cursor, (c) => forEachNodeInSubtree(c, f));\n\t}\n}\n\n/**\n * Casts a cursor to an {@link ITreeCursorSynchronous}.\n *\n * TODO: #1404: Handle this properly for partial data loading support.\n */\nexport function castCursorToSynchronous(cursor: ITreeCursor): ITreeCursorSynchronous {\n\treturn cursor as ITreeCursorSynchronous;\n}\n\n/**\n * Runs `f` inside of field `field` on `cursor`.\n * @param cursor - Cursor whose field to enter and exit. Must be in `nodes` mode.\n * @param field - Field to enter.\n * @param f - Callback to run when in field.\n * @returns return value of `f`\n */\nexport function inCursorField<T, TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tfield: FieldKey,\n\tf: (cursor: TCursor) => T,\n): T {\n\tcursor.enterField(field);\n\tconst result = f(cursor);\n\tcursor.exitField();\n\treturn result;\n}\n\n/**\n * Runs `f` inside of node `index` on `cursor`.\n * @param cursor - Cursor whoso node to enter and exit. Must be in `fields` mode.\n * @param index - Node to enter.\n * @param f - Callback to run when in node.\n * @returns return value of `f`\n */\nexport function inCursorNode<T, TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tindex: number,\n\tf: (cursor: TCursor) => T,\n): T {\n\tcursor.enterNode(index);\n\tconst result = f(cursor);\n\tcursor.exitNode();\n\treturn result;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../../src/core/tree/cursor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAO7D;;;;GAIG;AACU,QAAA,YAAY,GAAkB,MAAM,CAAC,cAAc,CAAC,CAAC;AAElE;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,IAAa;IACrC,sFAAsF;IACtF,6FAA6F;IAC7F,OAAO,CACN,IAAI,KAAK,IAAI;QACb,OAAO,IAAI,KAAK,QAAQ;QACvB,IAA6B,CAAC,oBAAY,CAAC,KAAK,IAAI,CACrD,CAAC;AACH,CAAC;AARD,4BAQC;AA0RD,IAAkB,kBAYjB;AA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EAAE,CAAC;IAClB,OAAO,MAAM,CAAC;AACf,CAAC;AATD,oCASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport type { FieldKey } from \"../schema-stored/index.js\";\n\nimport type { FieldUpPath, UpPath } from \"./pathTree.js\";\nimport type { TreeType, Value } from \"./types.js\";\n\n/**\n * A symbol for marking an object as an {@link ITreeCursor}.\n *\n * Useful when APIs want to take in tree data in multiple formats, including cursors.\n */\nexport const CursorMarker: unique symbol = Symbol(\"CursorMarker\");\n\n/**\n * Check if something is an {@link ITreeCursor}.\n *\n * Useful when APIs want to take in tree data in multiple formats, including cursors.\n */\nexport function isCursor(data: unknown): data is ITreeCursor {\n\t// Other than on null and undefined, looking up a missing symbol shouldn't type error.\n\t// typeof check deals with undefined while providing an early out for other non-object types.\n\treturn (\n\t\tdata !== null &&\n\t\ttypeof data === \"object\" &&\n\t\t(data as Partial<ITreeCursor>)[CursorMarker] === true\n\t);\n}\n\n/**\n * A stateful low-level interface for reading tree data.\n * *\n * @remarks Cursor exists so that specialized data formats can be viewed through\n * a common abstraction. This allows performance optimizations to be done based\n * on data.\n *\n * A tree cursor is similar to a database cursor in that it allows for the efficient\n * traversal over the contents of a tree. Note that unlike a database cursor,\n * tree cursors may be invalidated after any edit to the tree. For a cursor-like\n * structure that also remains valid across edits, see {@link AnchorNode}.\n */\nexport interface ITreeCursor {\n\t/**\n\t * Marks this object as a cursor.\n\t */\n\treadonly [CursorMarker]: true;\n\n\t/**\n\t * What kind of place the cursor is at.\n\t * Determines which operations are allowed.\n\t *\n\t * @remarks\n\t * Users of cursors frequently need to refer to places in trees, both fields and nodes.\n\t * Approaches other than having the cursor have separate modes for these\n\t * cases had issues even worse than having the two modes.\n\t *\n\t * For example, modeling fields as parent + key has issues when there is no\n\t * parent, and doesn't provide a great way to do iteration over fields while\n\t * also having a nice API and making it easy for the implementation to track\n\t * state (like its current location inside a sequence tree of fields) while\n\t * traversing without having to allocate some state management for that.\n\t *\n\t * Another approach, of using arrays of cursors for fields (like we currently\n\t * do for inserting content) is very inefficient and better addressed by a\n\t * dual mode cursor.\n\t *\n\t * Another approach, of using the first node in a field when referring to\n\t * the field gets confusing since it's unclear if a given cursor means that\n\t * node, or that node, and the ones after it, and in the second case, it's\n\t * hard to restore the cursor back to the right state when returning. It also\n\t * doesn't work for empty fields. Overall there just didn't seem to be a way\n\t * that sucked less than the dual mode API.\n\t */\n\treadonly mode: CursorLocationType;\n\n\t/*\n\t * True iff the current field or node (depending on mode) is \"pending\",\n\t * meaning that it has not been downloaded.\n\t */\n\treadonly pending: boolean;\n\n\t// ********** APIs for when mode = Fields ********** //\n\n\t/**\n\t * Moves the \"current field\" forward one in an arbitrary field traversal order,\n\t * skipping any empty fields.\n\t *\n\t * If there is no remaining field to iterate to,\n\t * returns false and navigates up to the parent setting the mode to `Nodes`.\n\t *\n\t * Order of fields is only guaranteed to be consistent through a single iteration.\n\t *\n\t * If skipPending, skip past fields which are currently pending.\n\t * This can be used to skip to the end of a large number of consecutive pending fields.\n\t *\n\t * Allowed when `mode` is `Fields`.\n\t */\n\tnextField(): boolean;\n\n\t/**\n\t * Navigate up to parent node.\n\t * Sets mode to `Nodes`\n\t *\n\t * Only valid when `mode` is `Fields`.\n\t *\n\t * TODO: what to do if at root?\n\t */\n\texitField(): void;\n\n\t/**\n\t * Moves the \"current field\" forward until `pending` is `false`.\n\t *\n\t * If there are no remaining field to iterate to,\n\t * returns false and navigates up to the parent setting the mode to `Nodes`.\n\t *\n\t * Order of fields is only guaranteed to be consistent through a single iteration.\n\t *\n\t * Allowed when `mode` is `Fields`.\n\t */\n\tskipPendingFields(): boolean;\n\n\t// ********** APIs for when mode = Fields, and not pending ********** //\n\n\t/**\n\t * Returns the FieldKey for the current field.\n\t *\n\t * Allowed when `mode` is `Fields`, and not `pending`.\n\t */\n\tgetFieldKey(): FieldKey;\n\n\t/**\n\t * Returns the number of immediate children in the current field.\n\t *\n\t * Allowed when `mode` is `Fields`, and not `pending`.\n\t */\n\tgetFieldLength(): number;\n\n\t/**\n\t * Moves to the first node of the selected field, setting mode to `Nodes`.\n\t *\n\t * If field is empty, returns false instead.\n\t *\n\t * Allowed when `mode` is `Fields`, and not `pending`.\n\t */\n\tfirstNode(): boolean;\n\n\t/**\n\t * Sets current node to the node at the provided `index` of the current field.\n\t *\n\t * Allowed when `mode` is `Fields`, and not `pending`.\n\t * Sets mode to `Nodes`.\n\t */\n\tenterNode(childIndex: number): void;\n\n\t/**\n\t * Returns a path to the current field. See {@link FieldUpPath}.\n\t *\n\t * Only valid when `mode` is `Fields`.\n\t *\n\t * If no prefix is provided, assumes this cursor is treated as if it has a root node where its field keys are actually detached sequences.\n\t * If the cursor is not rooted at such a node, the `prefix` should be used to ensure the path has the correct root.\n\t * This requirement exists because {@link FieldUpPath}s are absolute paths\n\t * and thus must be rooted in a detached sequence.\n\t *\n\t * @param prefix - optional overrides to apply to the root of the returned path.\n\t * See {@link PathRootPrefix}.\n\t * This adjusts the path as if the tree data accessible to this cursor is part of a larger tree.\n\t *\n\t * @returns a path to the current field.\n\t */\n\tgetFieldPath(prefix?: PathRootPrefix): FieldUpPath;\n\n\t// ********** APIs for when mode = Nodes ********** //\n\n\t/**\n\t * Returns a path to the current node. See {@link UpPath}.\n\t *\n\t * Only valid when `mode` is `Nodes`.\n\t *\n\t * If no prefix is provided, assumes this cursor is treated as if it has a root node where its field keys are actually detached sequences.\n\t * If the cursor is not rooted at such a node, the `prefix` should be used to ensure the path has the correct root.\n\t * This requirement exists because {@link UpPath}s are absolute paths\n\t * and thus must be rooted in a detached sequence.\n\t *\n\t * @param prefix - optional overrides to apply to the root of the returned path.\n\t * See {@link PathRootPrefix}.\n\t * This adjusts the path as if the tree data accessible to this cursor is part of a larger tree.\n\t *\n\t * @returns a path to the current node.\n\t */\n\tgetPath(prefix?: PathRootPrefix): UpPath | undefined;\n\n\t/**\n\t * Index (within its parent field) of the current node.\n\t *\n\t * Only valid when `mode` is `Nodes`.\n\t */\n\treadonly fieldIndex: number;\n\n\t/**\n\t * Index (within its parent field) of the first node in the current chunk.\n\t * Always less than or equal to `currentIndexInField`.\n\t *\n\t * Only valid when `mode` is `Nodes`.\n\t */\n\treadonly chunkStart: number;\n\n\t/**\n\t * Length of current chunk.\n\t * Since an entire chunk always has the same `pending` value,\n\t * can be used to help skip over all of a pending chunk at once.\n\t *\n\t * TODO:\n\t * Add optional APIs to access underlying chunks so readers can\n\t * accelerate processing of chunk formats they understand.\n\t *\n\t * Only valid when `mode` is `Nodes`.\n\t */\n\treadonly chunkLength: number;\n\n\t/**\n\t * Moves `offset` nodes in the field.\n\t * If seeking to exactly past either end,\n\t * returns false and navigates up to the parent field (setting mode to `Fields`).\n\t *\n\t * Allowed if mode is `Nodes`.\n\t */\n\tseekNodes(offset: number): boolean;\n\n\t/**\n\t * The same as `seekNodes(1)`, but might be faster.\n\t */\n\tnextNode(): boolean;\n\n\t/**\n\t * Navigate up to parent field.\n\t * Sets mode to `Fields`\n\t *\n\t * Same as seek Number.POSITIVE_INFINITY, but only valid when `mode` is `Nodes`.\n\t *\n\t * TODO: what to do if at root?\n\t * TODO: Maybe merge with upToNode to make a single \"Up\"?\n\t */\n\texitNode(): void;\n\n\t// ********** APIs for when mode = Nodes and not pending ********** //\n\n\t/**\n\t * Enters the first non-empty field (setting mode to `Fields`)\n\t * so fields can be iterated with `nextField` and `skipPendingFields`.\n\t *\n\t * If there are no fields, mode is returned to `Nodes` and false is returned.\n\t *\n\t * Allowed when `mode` is `Nodes` and not `pending`.\n\t */\n\tfirstField(): boolean;\n\n\t/**\n\t * Navigate to the field with the specified `key` and set the mode to `Fields`.\n\t *\n\t * Only valid when `mode` is `Nodes`, and not `pending`.\n\t */\n\tenterField(key: FieldKey): void;\n\n\t/**\n\t * The type of the currently selected node.\n\t *\n\t * Only valid when `mode` is `Nodes`, and not `pending`.\n\t */\n\treadonly type: TreeType;\n\n\t/**\n\t * The value associated with the currently selected node.\n\t *\n\t * Only valid when `mode` is `Nodes`, and not `pending`.\n\t */\n\treadonly value: Value;\n}\n\n/**\n * Prefix to apply as the root of a {@link UpPath} or {@link FieldUpPath}.\n *\n * @remarks This can be used to take a path relative to a subtree, and make it relative to a larger containing tree.\n * For example, if a node is being inserted in the 5th position in a field \"Foo\", you can update a path in that node's subtree to its new path by prefixing it with\n * `{ parent: theNodeAboveTheMovedNode, rootFieldOverride: Foo, indexOffset: 5 }`.\n * See {@link prefixPath} and {@link prefixFieldPath} for how to apply the prefix to the paths.\n */\nexport interface PathRootPrefix {\n\t/**\n\t * The new parent to place above root of the path which is being prefixed.\n\t * This replaces the `undefined` at the root of the path.\n\t *\n\t * @remarks specifying `undefined` here results in no change to the path.\n\t */\n\tparent?: UpPath | undefined;\n\n\t/**\n\t * The field of `parent` that the original path will be included under.\n\t *\n\t * If `undefined` the root field key from the original path will be used.\n\t */\n\trootFieldOverride?: FieldKey;\n\n\t/**\n\t * Offset to add to the uppermost `parentIndex` in the original path.\n\t */\n\tindexOffset?: number;\n}\n\nexport const enum CursorLocationType {\n\t/**\n\t * Can iterate through nodes in a field.\n\t * At a \"current node\".\n\t */\n\tNodes,\n\n\t/**\n\t * Can iterate through fields of a node.\n\t * At a \"current field\".\n\t */\n\tFields,\n}\n\n/**\n * {@link ITreeCursor} that is never pending.\n */\nexport interface ITreeCursorSynchronous extends ITreeCursor {\n\treadonly pending: false;\n}\n\n/**\n * Applies a mapping function to each field of the current node, returning the results as an array.\n *\n * @param cursor - tree whose fields will be visited.\n * @param f - builds output from field, which will be selected in cursor when cursor is provided.\n * If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.\n * @returns array resulting from applying `f` to each field of the current node on `cursor`.\n * Returns an empty array if the node is empty or not present (which are considered the same).\n * Note that order is not specified for field iteration.\n */\nexport function mapCursorFields<T, TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tf: (cursor: TCursor) => T,\n): T[] {\n\tconst output: T[] = [];\n\tforEachField(cursor, (c) => {\n\t\toutput.push(f(c));\n\t});\n\treturn output;\n}\n\n/**\n * Iterates over each field of the current node, invoking a callback for each.\n *\n * @param cursor - cursor at a node whose fields will be visited.\n * @param f - For on each field.\n * If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.\n */\nexport function forEachField<TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tf: (cursor: TCursor) => void,\n): void {\n\tassert(cursor.mode === CursorLocationType.Nodes, 0x411 /* should be in nodes */);\n\tfor (let inField = cursor.firstField(); inField; inField = cursor.nextField()) {\n\t\tf(cursor);\n\t}\n}\n\n/**\n * Applies a mapping function to each node of the current field, returning the results as an array.\n *\n * @param cursor - tree whose field will be visited.\n * @param f - builds output from field member, which will be selected in cursor when cursor is provided.\n * If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.\n * @returns array resulting from applying `f` to each item of the current field on `cursor`.\n * Returns an empty array if the field is empty or not present (which are considered the same).\n */\nexport function mapCursorField<T, TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tf: (cursor: TCursor) => T,\n): T[] {\n\tconst output: T[] = [];\n\tforEachNode(cursor, (c) => {\n\t\toutput.push(f(c));\n\t});\n\treturn output;\n}\n\n/**\n * Lazily iterates over each node in the current field, yielding the result of applying a mapping function to each.\n *\n * @param cursor - The tree whose field will be visited.\n * @param f - Builds output from field member, which will be selected in cursor when cursor is provided.\n * If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.\n * @returns An iterable of `T` resulting from applying `f` to each item of the current field on `cursor`.\n * Yields nothing if an empty array if the field is empty or not present (which are considered the same).\n */\nexport function* iterateCursorField<T, TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tf: (cursor: TCursor) => T,\n): IterableIterator<T> {\n\tassert(cursor.mode === CursorLocationType.Fields, 0x7a8 /* should be in fields */);\n\tfor (let inNodes = cursor.firstNode(); inNodes; inNodes = cursor.nextNode()) {\n\t\tyield f(cursor);\n\t}\n}\n\n/**\n * Iterates over each node in the current field, invoking a callback for each.\n *\n * @param cursor - cursor at a field whose nodes will be visited.\n * @param f - For on each node.\n * If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.\n */\nexport function forEachNode<TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tf: (cursor: TCursor) => void,\n): void {\n\tassert(cursor.mode === CursorLocationType.Fields, 0x3bd /* should be in fields */);\n\tfor (let inNodes = cursor.firstNode(); inNodes; inNodes = cursor.nextNode()) {\n\t\tf(cursor);\n\t}\n}\n\n/**\n * Iterates over a subrange of nodes in the current field, invoking a callback for each.\n * See {@link forEachNode} for a version that visits all nodes in the field.\n *\n * @param cursor - cursor at a field whose nodes will be visited.\n * @param startIndex - index of first node to visit. Must be non-negative.\n * @param endIndex - index of first node to NOT visit. Must be greater than or equal to `startIndex`.\n * @param f - For on each node.\n * If `f` moves cursor, it must put it back to where it was at the beginning of `f` before returning.\n */\nexport function forEachNodeSubsequence<TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tstartIndex: number,\n\tendIndex: number,\n\tf: (cursor: TCursor) => void,\n): void {\n\tassert(cursor.mode === CursorLocationType.Fields, 0xce5 /* should be in fields */);\n\n\tassert(startIndex >= 0, 0xce6 /* invalid startIndex */);\n\tassert(endIndex >= startIndex, 0xce7 /* invalid endIndex */);\n\tconst outputLength = endIndex - startIndex;\n\tif (outputLength === 0) {\n\t\t// Avoids out of bounds index on cursor.enterNode when requesting 0 length subarray at end of array.\n\t\treturn;\n\t}\n\n\tcursor.enterNode(startIndex);\n\tfor (let i = 0; i < outputLength; i++) {\n\t\tf(cursor);\n\t\tconst hasNext = cursor.nextNode();\n\t\tif (!hasNext) {\n\t\t\tassert(i === outputLength - 1, 0xce8 /* requested endIndex is out of bounds */);\n\t\t\treturn;\n\t\t}\n\t}\n\tcursor.exitNode();\n}\n\n/**\n * Deeply iterates over each node in the current subtree (rooted at a node or field),\n * invoking a callback for each.\n *\n * @param cursor - cursor at a field or node.\n * @param f - Function to invoke for each node.\n * If `f` moves the cursor, it must put it back to where it was at the beginning of `f` before returning.\n *\n * Invokes `f` on each node in the subtree rooted at the current field or node.\n * Traversal is pre-order.\n * If the cursor is at a node, `f` will be invoked on that node.\n *\n * Returns the `cursor` to its initial position.\n */\nexport function forEachNodeInSubtree<TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tf: (cursor: TCursor) => void,\n): void {\n\tif (cursor.mode === CursorLocationType.Nodes) {\n\t\tf(cursor);\n\t\tforEachField(cursor, (c) => forEachNodeInSubtree(c, f));\n\t} else {\n\t\tforEachNode(cursor, (c) => forEachNodeInSubtree(c, f));\n\t}\n}\n\n/**\n * Casts a cursor to an {@link ITreeCursorSynchronous}.\n *\n * TODO: #1404: Handle this properly for partial data loading support.\n */\nexport function castCursorToSynchronous(cursor: ITreeCursor): ITreeCursorSynchronous {\n\treturn cursor as ITreeCursorSynchronous;\n}\n\n/**\n * Runs `f` inside of field `field` on `cursor`.\n * @param cursor - Cursor whose field to enter and exit. Must be in `nodes` mode.\n * @param field - Field to enter.\n * @param f - Callback to run when in field.\n * @returns return value of `f`\n */\nexport function inCursorField<T, TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tfield: FieldKey,\n\tf: (cursor: TCursor) => T,\n): T {\n\tcursor.enterField(field);\n\tconst result = f(cursor);\n\tcursor.exitField();\n\treturn result;\n}\n\n/**\n * Runs `f` inside of node `index` on `cursor`.\n * @param cursor - Cursor whoso node to enter and exit. Must be in `fields` mode.\n * @param index - Node to enter.\n * @param f - Callback to run when in node.\n * @returns return value of `f`\n */\nexport function inCursorNode<T, TCursor extends ITreeCursor = ITreeCursor>(\n\tcursor: TCursor,\n\tindex: number,\n\tf: (cursor: TCursor) => T,\n): T {\n\tcursor.enterNode(index);\n\tconst result = f(cursor);\n\tcursor.exitNode();\n\treturn result;\n}\n"]}
|
|
@@ -3,11 +3,23 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { TreeChunk } from "./chunk.js";
|
|
6
|
-
import type { DetachedNodeId, Root } from "./delta.js";
|
|
6
|
+
import type { DetachedNodeId, FieldChanges, FieldMap, Root } from "./delta.js";
|
|
7
7
|
export declare const emptyDelta: Root;
|
|
8
8
|
export declare function deltaForRootInitialization(content: TreeChunk): Root;
|
|
9
9
|
export declare function makeDetachedNodeId(major: DetachedNodeId["major"], minor: DetachedNodeId["minor"]): DetachedNodeId;
|
|
10
10
|
export declare function offsetDetachId(id: DetachedNodeId, offset: number): DetachedNodeId;
|
|
11
11
|
export declare function offsetDetachId(id: DetachedNodeId | undefined, offset: number): DetachedNodeId | undefined;
|
|
12
12
|
export declare function areDetachedNodeIdsEqual(a: DetachedNodeId, b: DetachedNodeId): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Returns true if a delta field map contains any changes that would be visible in the document (eg, an insert, move, edit)
|
|
15
|
+
* @param fields - Delta FieldMap to check for visible changes
|
|
16
|
+
* @returns True if change map contains any changes that would be visible in the document, false otherwise
|
|
17
|
+
*/
|
|
18
|
+
export declare function deltaFieldMapHasVisibleChanges(fields: FieldMap | undefined): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Returns true if the given field changes contains any changes that would be visible in the document (eg, an insert, move, edit)
|
|
21
|
+
* @param fieldChanges - Field changes to check for visible changes
|
|
22
|
+
* @returns True if the field changes contain any changes that would be visible in the document, false otherwise
|
|
23
|
+
*/
|
|
24
|
+
export declare function deltaFieldChangesHaveVisibleChanges(fieldChanges: FieldChanges): boolean;
|
|
13
25
|
//# sourceMappingURL=deltaUtil.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deltaUtil.d.ts","sourceRoot":"","sources":["../../../src/core/tree/deltaUtil.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"deltaUtil.d.ts","sourceRoot":"","sources":["../../../src/core/tree/deltaUtil.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAG/E,eAAO,MAAM,UAAU,EAAE,IAAS,CAAC;AAEnC,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI,CAYnE;AAED,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,EAC9B,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,GAC5B,cAAc,CAMhB;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAAC;AACnF,wBAAgB,cAAc,CAC7B,EAAE,EAAE,cAAc,GAAG,SAAS,EAC9B,MAAM,EAAE,MAAM,GACZ,cAAc,GAAG,SAAS,CAAC;AAc9B,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,GAAG,OAAO,CAErF;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAUpF;AAED;;;;GAIG;AACH,wBAAgB,mCAAmC,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAYvF"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.areDetachedNodeIdsEqual = exports.offsetDetachId = exports.makeDetachedNodeId = exports.deltaForRootInitialization = exports.emptyDelta = void 0;
|
|
7
|
+
exports.deltaFieldChangesHaveVisibleChanges = exports.deltaFieldMapHasVisibleChanges = exports.areDetachedNodeIdsEqual = exports.offsetDetachId = exports.makeDetachedNodeId = exports.deltaForRootInitialization = exports.emptyDelta = void 0;
|
|
8
8
|
const types_js_1 = require("./types.js");
|
|
9
9
|
exports.emptyDelta = {};
|
|
10
10
|
function deltaForRootInitialization(content) {
|
|
@@ -43,4 +43,37 @@ function areDetachedNodeIdsEqual(a, b) {
|
|
|
43
43
|
return a.major === b.major && a.minor === b.minor;
|
|
44
44
|
}
|
|
45
45
|
exports.areDetachedNodeIdsEqual = areDetachedNodeIdsEqual;
|
|
46
|
+
/**
|
|
47
|
+
* Returns true if a delta field map contains any changes that would be visible in the document (eg, an insert, move, edit)
|
|
48
|
+
* @param fields - Delta FieldMap to check for visible changes
|
|
49
|
+
* @returns True if change map contains any changes that would be visible in the document, false otherwise
|
|
50
|
+
*/
|
|
51
|
+
function deltaFieldMapHasVisibleChanges(fields) {
|
|
52
|
+
if (fields === undefined || fields.size === 0) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
for (const [, fieldChanges] of fields) {
|
|
56
|
+
if (deltaFieldChangesHaveVisibleChanges(fieldChanges)) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
exports.deltaFieldMapHasVisibleChanges = deltaFieldMapHasVisibleChanges;
|
|
63
|
+
/**
|
|
64
|
+
* Returns true if the given field changes contains any changes that would be visible in the document (eg, an insert, move, edit)
|
|
65
|
+
* @param fieldChanges - Field changes to check for visible changes
|
|
66
|
+
* @returns True if the field changes contain any changes that would be visible in the document, false otherwise
|
|
67
|
+
*/
|
|
68
|
+
function deltaFieldChangesHaveVisibleChanges(fieldChanges) {
|
|
69
|
+
for (const mark of fieldChanges.marks) {
|
|
70
|
+
if (mark.attach !== undefined ||
|
|
71
|
+
mark.detach !== undefined ||
|
|
72
|
+
deltaFieldMapHasVisibleChanges(mark.fields)) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
exports.deltaFieldChangesHaveVisibleChanges = deltaFieldChangesHaveVisibleChanges;
|
|
46
79
|
//# sourceMappingURL=deltaUtil.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deltaUtil.js","sourceRoot":"","sources":["../../../src/core/tree/deltaUtil.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,yCAA0C;AAE7B,QAAA,UAAU,GAAS,EAAE,CAAC;AAEnC,SAAgB,0BAA0B,CAAC,OAAkB;IAC5D,IAAI,OAAO,CAAC,cAAc,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO,kBAAU,CAAC;IACnB,CAAC;IACD,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAS;QACnB,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;QACxC,MAAM,EAAE,IAAI,GAAG,CAAyB;YACvC,CAAC,uBAAY,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;SAC/E,CAAC;KACF,CAAC;IACF,OAAO,KAAK,CAAC;AACd,CAAC;AAZD,gEAYC;AAED,SAAgB,kBAAkB,CACjC,KAA8B,EAC9B,KAA8B;IAE9B,MAAM,GAAG,GAA4B,EAAE,KAAK,EAAE,CAAC;IAC/C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;IACnB,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC;AATD,gDASC;AAOD,SAAgB,cAAc,CAC7B,EAA8B,EAC9B,MAAc;IAEd,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,OAAO;QACN,GAAG,EAAE;QACL,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,MAAM;KACxB,CAAC;AACH,CAAC;AAXD,wCAWC;AAED,SAAgB,uBAAuB,CAAC,CAAiB,EAAE,CAAiB;IAC3E,OAAO,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,CAAC;AACnD,CAAC;AAFD,0DAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Mutable } from \"../../util/index.js\";\nimport type { FieldKey } from \"../schema-stored/index.js\";\n\nimport type { TreeChunk } from \"./chunk.js\";\nimport type { DetachedNodeId, FieldChanges, Root } from \"./delta.js\";\nimport { rootFieldKey } from \"./types.js\";\n\nexport const emptyDelta: Root = {};\n\nexport function deltaForRootInitialization(content: TreeChunk): Root {\n\tif (content.topLevelLength === 0) {\n\t\treturn emptyDelta;\n\t}\n\tconst buildId = { minor: 0 };\n\tconst delta: Root = {\n\t\tbuild: [{ id: buildId, trees: content }],\n\t\tfields: new Map<FieldKey, FieldChanges>([\n\t\t\t[rootFieldKey, { marks: [{ count: content.topLevelLength, attach: buildId }] }],\n\t\t]),\n\t};\n\treturn delta;\n}\n\nexport function makeDetachedNodeId(\n\tmajor: DetachedNodeId[\"major\"],\n\tminor: DetachedNodeId[\"minor\"],\n): DetachedNodeId {\n\tconst out: Mutable<DetachedNodeId> = { minor };\n\tif (major !== undefined) {\n\t\tout.major = major;\n\t}\n\treturn out;\n}\n\nexport function offsetDetachId(id: DetachedNodeId, offset: number): DetachedNodeId;\nexport function offsetDetachId(\n\tid: DetachedNodeId | undefined,\n\toffset: number,\n): DetachedNodeId | undefined;\nexport function offsetDetachId(\n\tid: DetachedNodeId | undefined,\n\toffset: number,\n): DetachedNodeId | undefined {\n\tif (id === undefined) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\t...id,\n\t\tminor: id.minor + offset,\n\t};\n}\n\nexport function areDetachedNodeIdsEqual(a: DetachedNodeId, b: DetachedNodeId): boolean {\n\treturn a.major === b.major && a.minor === b.minor;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"deltaUtil.js","sourceRoot":"","sources":["../../../src/core/tree/deltaUtil.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,yCAA0C;AAE7B,QAAA,UAAU,GAAS,EAAE,CAAC;AAEnC,SAAgB,0BAA0B,CAAC,OAAkB;IAC5D,IAAI,OAAO,CAAC,cAAc,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO,kBAAU,CAAC;IACnB,CAAC;IACD,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAS;QACnB,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;QACxC,MAAM,EAAE,IAAI,GAAG,CAAyB;YACvC,CAAC,uBAAY,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;SAC/E,CAAC;KACF,CAAC;IACF,OAAO,KAAK,CAAC;AACd,CAAC;AAZD,gEAYC;AAED,SAAgB,kBAAkB,CACjC,KAA8B,EAC9B,KAA8B;IAE9B,MAAM,GAAG,GAA4B,EAAE,KAAK,EAAE,CAAC;IAC/C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;IACnB,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC;AATD,gDASC;AAOD,SAAgB,cAAc,CAC7B,EAA8B,EAC9B,MAAc;IAEd,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,OAAO;QACN,GAAG,EAAE;QACL,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,MAAM;KACxB,CAAC;AACH,CAAC;AAXD,wCAWC;AAED,SAAgB,uBAAuB,CAAC,CAAiB,EAAE,CAAiB;IAC3E,OAAO,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,CAAC;AACnD,CAAC;AAFD,0DAEC;AAED;;;;GAIG;AACH,SAAgB,8BAA8B,CAAC,MAA4B;IAC1E,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QAC/C,OAAO,KAAK,CAAC;IACd,CAAC;IACD,KAAK,MAAM,CAAC,EAAE,YAAY,CAAC,IAAI,MAAM,EAAE,CAAC;QACvC,IAAI,mCAAmC,CAAC,YAAY,CAAC,EAAE,CAAC;YACvD,OAAO,IAAI,CAAC;QACb,CAAC;IACF,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAVD,wEAUC;AAED;;;;GAIG;AACH,SAAgB,mCAAmC,CAAC,YAA0B;IAC7E,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,KAAK,EAAE,CAAC;QACvC,IACC,IAAI,CAAC,MAAM,KAAK,SAAS;YACzB,IAAI,CAAC,MAAM,KAAK,SAAS;YACzB,8BAA8B,CAAC,IAAI,CAAC,MAAM,CAAC,EAC1C,CAAC;YACF,OAAO,IAAI,CAAC;QACb,CAAC;IACF,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC;AAZD,kFAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Mutable } from \"../../util/index.js\";\nimport type { FieldKey } from \"../schema-stored/index.js\";\n\nimport type { TreeChunk } from \"./chunk.js\";\nimport type { DetachedNodeId, FieldChanges, FieldMap, Root } from \"./delta.js\";\nimport { rootFieldKey } from \"./types.js\";\n\nexport const emptyDelta: Root = {};\n\nexport function deltaForRootInitialization(content: TreeChunk): Root {\n\tif (content.topLevelLength === 0) {\n\t\treturn emptyDelta;\n\t}\n\tconst buildId = { minor: 0 };\n\tconst delta: Root = {\n\t\tbuild: [{ id: buildId, trees: content }],\n\t\tfields: new Map<FieldKey, FieldChanges>([\n\t\t\t[rootFieldKey, { marks: [{ count: content.topLevelLength, attach: buildId }] }],\n\t\t]),\n\t};\n\treturn delta;\n}\n\nexport function makeDetachedNodeId(\n\tmajor: DetachedNodeId[\"major\"],\n\tminor: DetachedNodeId[\"minor\"],\n): DetachedNodeId {\n\tconst out: Mutable<DetachedNodeId> = { minor };\n\tif (major !== undefined) {\n\t\tout.major = major;\n\t}\n\treturn out;\n}\n\nexport function offsetDetachId(id: DetachedNodeId, offset: number): DetachedNodeId;\nexport function offsetDetachId(\n\tid: DetachedNodeId | undefined,\n\toffset: number,\n): DetachedNodeId | undefined;\nexport function offsetDetachId(\n\tid: DetachedNodeId | undefined,\n\toffset: number,\n): DetachedNodeId | undefined {\n\tif (id === undefined) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\t...id,\n\t\tminor: id.minor + offset,\n\t};\n}\n\nexport function areDetachedNodeIdsEqual(a: DetachedNodeId, b: DetachedNodeId): boolean {\n\treturn a.major === b.major && a.minor === b.minor;\n}\n\n/**\n * Returns true if a delta field map contains any changes that would be visible in the document (eg, an insert, move, edit)\n * @param fields - Delta FieldMap to check for visible changes\n * @returns True if change map contains any changes that would be visible in the document, false otherwise\n */\nexport function deltaFieldMapHasVisibleChanges(fields: FieldMap | undefined): boolean {\n\tif (fields === undefined || fields.size === 0) {\n\t\treturn false;\n\t}\n\tfor (const [, fieldChanges] of fields) {\n\t\tif (deltaFieldChangesHaveVisibleChanges(fieldChanges)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n/**\n * Returns true if the given field changes contains any changes that would be visible in the document (eg, an insert, move, edit)\n * @param fieldChanges - Field changes to check for visible changes\n * @returns True if the field changes contain any changes that would be visible in the document, false otherwise\n */\nexport function deltaFieldChangesHaveVisibleChanges(fieldChanges: FieldChanges): boolean {\n\tfor (const mark of fieldChanges.marks) {\n\t\tif (\n\t\t\tmark.attach !== undefined ||\n\t\t\tmark.detach !== undefined ||\n\t\t\tdeltaFieldMapHasVisibleChanges(mark.fields)\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n"]}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
6
|
-
import { ClientVersionDispatchingCodecBuilder, type
|
|
6
|
+
import { ClientVersionDispatchingCodecBuilder, type ICodecOptions } from "../../codec/index.js";
|
|
7
7
|
import type { RevisionTagCodec } from "../rebase/index.js";
|
|
8
|
-
export declare const detachedFieldIndexCodecBuilder: ClientVersionDispatchingCodecBuilder<
|
|
9
|
-
revisionTagCodec: RevisionTagCodec;
|
|
10
|
-
idCompressor: IIdCompressor;
|
|
11
|
-
}>;
|
|
8
|
+
export declare const detachedFieldIndexCodecBuilder: ClientVersionDispatchingCodecBuilder<ICodecOptions & {
|
|
9
|
+
readonly revisionTagCodec: RevisionTagCodec;
|
|
10
|
+
readonly idCompressor: IIdCompressor;
|
|
11
|
+
}, import("./detachedFieldIndexTypes.js").DetachedFieldSummaryData, void, import("../../util/brand.js").Brand<1, "DetachedFieldIndexFormatVersion"> | import("../../util/brand.js").Brand<2, "DetachedFieldIndexFormatVersion">, "DetachedFieldIndex">;
|
|
12
12
|
//# sourceMappingURL=detachedFieldIndexCodecs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detachedFieldIndexCodecs.d.ts","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EACN,oCAAoC,
|
|
1
|
+
{"version":3,"file":"detachedFieldIndexCodecs.d.ts","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EACN,oCAAoC,EAEpC,KAAK,aAAa,EAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAW3D,eAAO,MAAM,8BAA8B;+BAJf,gBAAgB;2BACpB,aAAa;sPAmBpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detachedFieldIndexCodecs.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexCodecs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qEAAmF;AAEnF,mDAI8B;AAG9B,iFAAgF;AAChF,iFAAgF;AAChF,2FAAsF;AAOzE,QAAA,8BAA8B,GAAG,+CAAoC,CAAC,KAAK,CACvF,oBAAoB,EACpB;IACC;QACC,mBAAmB,EAAE,oCAAyB;QAC9C,aAAa,EAAE,mEAA+B,CAAC,EAAE;QACjD,KAAK,EAAE,CAAC,SAAoB,EAAE,EAAE,CAC/B,IAAA,6DAA8B,EAAC,SAAS,CAAC,gBAAgB,EAAE,SAAS,CAAC,YAAY,CAAC;KACnF;IACD;QACC,mBAAmB,EAAE,6BAAkB,CAAC,KAAK;QAC7C,aAAa,EAAE,mEAA+B,CAAC,EAAE;QACjD,KAAK,EAAE,CAAC,SAAoB,EAAE,EAAE,CAC/B,IAAA,6DAA8B,EAAC,SAAS,CAAC,gBAAgB,EAAE,SAAS,CAAC,YAAY,CAAC;KACnF;CACD,CACD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport { lowestMinVersionForCollab } from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\tClientVersionDispatchingCodecBuilder,\n\
|
|
1
|
+
{"version":3,"file":"detachedFieldIndexCodecs.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexCodecs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qEAAmF;AAEnF,mDAI8B;AAG9B,iFAAgF;AAChF,iFAAgF;AAChF,2FAAsF;AAOzE,QAAA,8BAA8B,GAAG,+CAAoC,CAAC,KAAK,CACvF,oBAAoB,EACpB;IACC;QACC,mBAAmB,EAAE,oCAAyB;QAC9C,aAAa,EAAE,mEAA+B,CAAC,EAAE;QACjD,KAAK,EAAE,CAAC,SAAoB,EAAE,EAAE,CAC/B,IAAA,6DAA8B,EAAC,SAAS,CAAC,gBAAgB,EAAE,SAAS,CAAC,YAAY,CAAC;KACnF;IACD;QACC,mBAAmB,EAAE,6BAAkB,CAAC,KAAK;QAC7C,aAAa,EAAE,mEAA+B,CAAC,EAAE;QACjD,KAAK,EAAE,CAAC,SAAoB,EAAE,EAAE,CAC/B,IAAA,6DAA8B,EAAC,SAAS,CAAC,gBAAgB,EAAE,SAAS,CAAC,YAAY,CAAC;KACnF;CACD,CACD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport { lowestMinVersionForCollab } from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\tClientVersionDispatchingCodecBuilder,\n\tFluidClientVersion,\n\ttype ICodecOptions,\n} from \"../../codec/index.js\";\nimport type { RevisionTagCodec } from \"../rebase/index.js\";\n\nimport { makeDetachedNodeToFieldCodecV1 } from \"./detachedFieldIndexCodecV1.js\";\nimport { makeDetachedNodeToFieldCodecV2 } from \"./detachedFieldIndexCodecV2.js\";\nimport { DetachedFieldIndexFormatVersion } from \"./detachedFieldIndexFormatCommon.js\";\n\ntype BuildData = ICodecOptions & {\n\treadonly revisionTagCodec: RevisionTagCodec;\n\treadonly idCompressor: IIdCompressor;\n};\n\nexport const detachedFieldIndexCodecBuilder = ClientVersionDispatchingCodecBuilder.build(\n\t\"DetachedFieldIndex\",\n\t[\n\t\t{\n\t\t\tminVersionForCollab: lowestMinVersionForCollab,\n\t\t\tformatVersion: DetachedFieldIndexFormatVersion.v1,\n\t\t\tcodec: (buildData: BuildData) =>\n\t\t\t\tmakeDetachedNodeToFieldCodecV1(buildData.revisionTagCodec, buildData.idCompressor),\n\t\t},\n\t\t{\n\t\t\tminVersionForCollab: FluidClientVersion.v2_52,\n\t\t\tformatVersion: DetachedFieldIndexFormatVersion.v2,\n\t\t\tcodec: (buildData: BuildData) =>\n\t\t\t\tmakeDetachedNodeToFieldCodecV2(buildData.revisionTagCodec, buildData.idCompressor),\n\t\t},\n\t],\n);\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
export { type Anchor, type AnchorLocator, AnchorSet, type AnchorSlot, type AnchorNode, anchorSlot, type AnchorEvents, type AnchorSetRootEvents, } from "./anchorSet.js";
|
|
6
|
-
export { type ITreeCursor, CursorLocationType, castCursorToSynchronous, mapCursorField, mapCursorFields, forEachNode, forEachNodeInSubtree, forEachField, iterateCursorField, type ITreeCursorSynchronous, type PathRootPrefix, inCursorField, inCursorNode, CursorMarker, isCursor, } from "./cursor.js";
|
|
6
|
+
export { type ITreeCursor, CursorLocationType, castCursorToSynchronous, mapCursorField, mapCursorFields, forEachNode, forEachNodeInSubtree, forEachField, iterateCursorField, type ITreeCursorSynchronous, type PathRootPrefix, inCursorField, inCursorNode, CursorMarker, isCursor, forEachNodeSubsequence, } from "./cursor.js";
|
|
7
7
|
export type { ProtoNodes, Root as DeltaRoot, Mark as DeltaMark, DetachedNodeId as DeltaDetachedNodeId, FieldMap as DeltaFieldMap, DetachedNodeChanges as DeltaDetachedNodeChanges, DetachedNodeBuild as DeltaDetachedNodeBuild, DetachedNodeDestruction as DeltaDetachedNodeDestruction, DetachedNodeRename as DeltaDetachedNodeRename, FieldChanges as DeltaFieldChanges, } from "./delta.js";
|
|
8
8
|
export { type MapTree, type ExclusiveMapTree, deepCopyMapTree } from "./mapTree.js";
|
|
9
9
|
export { clonePath, topDownPath, getDepth, type UpPath, type NormalizedUpPath, type INormalizedUpPath, type NormalizedFieldUpPath, type FieldUpPath, type Range, type RangeUpPath, type PlaceUpPath, type PlaceIndex, type NodeIndex, compareUpPaths, compareFieldUpPaths, isDetachedUpPathRoot as isDetachedUpPath, getDetachedFieldContainingPath, type UpPathDefault, } from "./pathTree.js";
|
|
@@ -13,7 +13,7 @@ export { EmptyKey, type TreeType, type ChildLocation, type DetachedField, type C
|
|
|
13
13
|
export { type DeltaVisitor, visitDelta } from "./visitDelta.js";
|
|
14
14
|
export { type AnnouncedVisitor, announceDelta, applyDelta, createAnnouncedVisitor, combineVisitors, makeDetachedFieldIndex, } from "./visitorUtils.js";
|
|
15
15
|
export { SparseNode, getDescendant } from "./sparseTree.js";
|
|
16
|
-
export { deltaForRootInitialization, makeDetachedNodeId, offsetDetachId, emptyDelta, } from "./deltaUtil.js";
|
|
16
|
+
export { deltaForRootInitialization, makeDetachedNodeId, offsetDetachId, emptyDelta, areDetachedNodeIdsEqual, deltaFieldMapHasVisibleChanges, deltaFieldChangesHaveVisibleChanges, } from "./deltaUtil.js";
|
|
17
17
|
export { type TreeChunk, dummyRoot, cursorChunk, tryGetChunk, type ChunkedCursor, } from "./chunk.js";
|
|
18
18
|
export { DetachedFieldIndex, type DetachedFieldIndexCheckpoint, type ReadOnlyDetachedFieldIndex, } from "./detachedFieldIndex.js";
|
|
19
19
|
export { detachedFieldIndexCodecBuilder } from "./detachedFieldIndexCodecs.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,SAAS,EACT,KAAK,UAAU,EACf,KAAK,UAAU,EACf,UAAU,EACV,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,KAAK,WAAW,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,SAAS,EACT,KAAK,UAAU,EACf,KAAK,UAAU,EACf,UAAU,EACV,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,KAAK,WAAW,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,sBAAsB,GACtB,MAAM,aAAa,CAAC;AACrB,YAAY,EACX,UAAU,EACV,IAAI,IAAI,SAAS,EACjB,IAAI,IAAI,SAAS,EACjB,cAAc,IAAI,mBAAmB,EACrC,QAAQ,IAAI,aAAa,EACzB,mBAAmB,IAAI,wBAAwB,EAC/C,iBAAiB,IAAI,sBAAsB,EAC3C,uBAAuB,IAAI,4BAA4B,EACvD,kBAAkB,IAAI,uBAAuB,EAC7C,YAAY,IAAI,iBAAiB,GACjC,MAAM,YAAY,CAAC;AACpB,OAAO,EA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AC9B,mCAAmC,GACnC,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EACT,WAAW,EACX,WAAW,EACX,KAAK,aAAa,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,kBAAkB,EAClB,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,GAC/B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AACtF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dist/core/tree/index.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
8
|
-
exports.DetachedFieldIndexFormatVersion = void 0;
|
|
7
|
+
exports.dummyRoot = exports.deltaFieldChangesHaveVisibleChanges = exports.deltaFieldMapHasVisibleChanges = exports.areDetachedNodeIdsEqual = exports.emptyDelta = exports.offsetDetachId = exports.makeDetachedNodeId = exports.deltaForRootInitialization = exports.getDescendant = exports.SparseNode = exports.makeDetachedFieldIndex = exports.combineVisitors = exports.createAnnouncedVisitor = exports.applyDelta = exports.announceDelta = exports.visitDelta = exports.aboveRootPlaceholder = exports.rootField = exports.rootFieldKey = exports.keyAsDetachedField = exports.detachedFieldAsKey = exports.EmptyKey = exports.EncodedJsonableTree = exports.setGenericTreeField = exports.getGenericTreeField = exports.genericTreeKeys = exports.genericTreeDeleteIfEmpty = exports.getDetachedFieldContainingPath = exports.isDetachedUpPath = exports.compareFieldUpPaths = exports.compareUpPaths = exports.getDepth = exports.topDownPath = exports.clonePath = exports.deepCopyMapTree = exports.forEachNodeSubsequence = exports.isCursor = exports.CursorMarker = exports.inCursorNode = exports.inCursorField = exports.iterateCursorField = exports.forEachField = exports.forEachNodeInSubtree = exports.forEachNode = exports.mapCursorFields = exports.mapCursorField = exports.castCursorToSynchronous = exports.CursorLocationType = exports.anchorSlot = exports.AnchorSet = void 0;
|
|
8
|
+
exports.DetachedFieldIndexFormatVersion = exports.detachedFieldIndexCodecBuilder = exports.DetachedFieldIndex = exports.tryGetChunk = exports.cursorChunk = void 0;
|
|
9
9
|
var anchorSet_js_1 = require("./anchorSet.js");
|
|
10
10
|
Object.defineProperty(exports, "AnchorSet", { enumerable: true, get: function () { return anchorSet_js_1.AnchorSet; } });
|
|
11
11
|
Object.defineProperty(exports, "anchorSlot", { enumerable: true, get: function () { return anchorSet_js_1.anchorSlot; } });
|
|
@@ -22,6 +22,7 @@ Object.defineProperty(exports, "inCursorField", { enumerable: true, get: functio
|
|
|
22
22
|
Object.defineProperty(exports, "inCursorNode", { enumerable: true, get: function () { return cursor_js_1.inCursorNode; } });
|
|
23
23
|
Object.defineProperty(exports, "CursorMarker", { enumerable: true, get: function () { return cursor_js_1.CursorMarker; } });
|
|
24
24
|
Object.defineProperty(exports, "isCursor", { enumerable: true, get: function () { return cursor_js_1.isCursor; } });
|
|
25
|
+
Object.defineProperty(exports, "forEachNodeSubsequence", { enumerable: true, get: function () { return cursor_js_1.forEachNodeSubsequence; } });
|
|
25
26
|
var mapTree_js_1 = require("./mapTree.js");
|
|
26
27
|
Object.defineProperty(exports, "deepCopyMapTree", { enumerable: true, get: function () { return mapTree_js_1.deepCopyMapTree; } });
|
|
27
28
|
var pathTree_js_1 = require("./pathTree.js");
|
|
@@ -62,6 +63,9 @@ Object.defineProperty(exports, "deltaForRootInitialization", { enumerable: true,
|
|
|
62
63
|
Object.defineProperty(exports, "makeDetachedNodeId", { enumerable: true, get: function () { return deltaUtil_js_1.makeDetachedNodeId; } });
|
|
63
64
|
Object.defineProperty(exports, "offsetDetachId", { enumerable: true, get: function () { return deltaUtil_js_1.offsetDetachId; } });
|
|
64
65
|
Object.defineProperty(exports, "emptyDelta", { enumerable: true, get: function () { return deltaUtil_js_1.emptyDelta; } });
|
|
66
|
+
Object.defineProperty(exports, "areDetachedNodeIdsEqual", { enumerable: true, get: function () { return deltaUtil_js_1.areDetachedNodeIdsEqual; } });
|
|
67
|
+
Object.defineProperty(exports, "deltaFieldMapHasVisibleChanges", { enumerable: true, get: function () { return deltaUtil_js_1.deltaFieldMapHasVisibleChanges; } });
|
|
68
|
+
Object.defineProperty(exports, "deltaFieldChangesHaveVisibleChanges", { enumerable: true, get: function () { return deltaUtil_js_1.deltaFieldChangesHaveVisibleChanges; } });
|
|
65
69
|
var chunk_js_1 = require("./chunk.js");
|
|
66
70
|
Object.defineProperty(exports, "dummyRoot", { enumerable: true, get: function () { return chunk_js_1.dummyRoot; } });
|
|
67
71
|
Object.defineProperty(exports, "cursorChunk", { enumerable: true, get: function () { return chunk_js_1.cursorChunk; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,+CASwB;AANvB,yGAAA,SAAS,OAAA;AAGT,0GAAA,UAAU,OAAA;AAIX,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,+CASwB;AANvB,yGAAA,SAAS,OAAA;AAGT,0GAAA,UAAU,OAAA;AAIX,yCAiBqB;AAfpB,+GAAA,kBAAkB,OAAA;AAClB,oHAAA,uBAAuB,OAAA;AACvB,2GAAA,cAAc,OAAA;AACd,4GAAA,eAAe,OAAA;AACf,wGAAA,WAAW,OAAA;AACX,iHAAA,oBAAoB,OAAA;AACpB,yGAAA,YAAY,OAAA;AACZ,+GAAA,kBAAkB,OAAA;AAGlB,0GAAA,aAAa,OAAA;AACb,yGAAA,YAAY,OAAA;AACZ,yGAAA,YAAY,OAAA;AACZ,q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B,6EAA+E;AAAtE,6IAAA,8BAA8B,OAAA;AACvC,yFAAsF;AAA7E,oJAAA,+BAA+B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype Anchor,\n\ttype AnchorLocator,\n\tAnchorSet,\n\ttype AnchorSlot,\n\ttype AnchorNode,\n\tanchorSlot,\n\ttype AnchorEvents,\n\ttype AnchorSetRootEvents,\n} from \"./anchorSet.js\";\nexport {\n\ttype ITreeCursor,\n\tCursorLocationType,\n\tcastCursorToSynchronous,\n\tmapCursorField,\n\tmapCursorFields,\n\tforEachNode,\n\tforEachNodeInSubtree,\n\tforEachField,\n\titerateCursorField,\n\ttype ITreeCursorSynchronous,\n\ttype PathRootPrefix,\n\tinCursorField,\n\tinCursorNode,\n\tCursorMarker,\n\tisCursor,\n\tforEachNodeSubsequence,\n} from \"./cursor.js\";\nexport type {\n\tProtoNodes,\n\tRoot as DeltaRoot,\n\tMark as DeltaMark,\n\tDetachedNodeId as DeltaDetachedNodeId,\n\tFieldMap as DeltaFieldMap,\n\tDetachedNodeChanges as DeltaDetachedNodeChanges,\n\tDetachedNodeBuild as DeltaDetachedNodeBuild,\n\tDetachedNodeDestruction as DeltaDetachedNodeDestruction,\n\tDetachedNodeRename as DeltaDetachedNodeRename,\n\tFieldChanges as DeltaFieldChanges,\n} from \"./delta.js\";\nexport { type MapTree, type ExclusiveMapTree, deepCopyMapTree } from \"./mapTree.js\";\nexport {\n\tclonePath,\n\ttopDownPath,\n\tgetDepth,\n\ttype UpPath,\n\ttype NormalizedUpPath,\n\ttype INormalizedUpPath,\n\ttype NormalizedFieldUpPath,\n\ttype FieldUpPath,\n\ttype Range,\n\ttype RangeUpPath,\n\ttype PlaceUpPath,\n\ttype PlaceIndex,\n\ttype NodeIndex,\n\tcompareUpPaths,\n\tcompareFieldUpPaths,\n\tisDetachedUpPathRoot as isDetachedUpPath,\n\tgetDetachedFieldContainingPath,\n\ttype UpPathDefault,\n} from \"./pathTree.js\";\nexport {\n\ttype FieldMapObject,\n\ttype GenericFieldsNode,\n\tgenericTreeDeleteIfEmpty,\n\tgenericTreeKeys,\n\ttype GenericTreeNode,\n\tgetGenericTreeField,\n\ttype JsonableTree,\n\tsetGenericTreeField,\n} from \"./treeTextFormat.js\";\nexport { EncodedJsonableTree } from \"./persistedTreeTextFormat.js\";\nexport {\n\tEmptyKey,\n\ttype TreeType,\n\ttype ChildLocation,\n\ttype DetachedField,\n\ttype ChildCollection,\n\ttype RootField,\n\ttype Value,\n\ttype TreeValue,\n\tdetachedFieldAsKey,\n\tkeyAsDetachedField,\n\trootFieldKey,\n\ttype NodeData,\n\trootField,\n\taboveRootPlaceholder,\n} from \"./types.js\";\nexport { type DeltaVisitor, visitDelta } from \"./visitDelta.js\";\nexport {\n\ttype AnnouncedVisitor,\n\tannounceDelta,\n\tapplyDelta,\n\tcreateAnnouncedVisitor,\n\tcombineVisitors,\n\tmakeDetachedFieldIndex,\n} from \"./visitorUtils.js\";\n\nexport { SparseNode, getDescendant } from \"./sparseTree.js\";\n\nexport {\n\tdeltaForRootInitialization,\n\tmakeDetachedNodeId,\n\toffsetDetachId,\n\temptyDelta,\n\tareDetachedNodeIdsEqual,\n\tdeltaFieldMapHasVisibleChanges,\n\tdeltaFieldChangesHaveVisibleChanges,\n} from \"./deltaUtil.js\";\n\nexport {\n\ttype TreeChunk,\n\tdummyRoot,\n\tcursorChunk,\n\ttryGetChunk,\n\ttype ChunkedCursor,\n} from \"./chunk.js\";\n\nexport {\n\tDetachedFieldIndex,\n\ttype DetachedFieldIndexCheckpoint,\n\ttype ReadOnlyDetachedFieldIndex,\n} from \"./detachedFieldIndex.js\";\n\nexport { detachedFieldIndexCodecBuilder } from \"./detachedFieldIndexCodecs.js\";\nexport { DetachedFieldIndexFormatVersion } from \"./detachedFieldIndexFormatCommon.js\";\nexport { type FormatV1 } from \"./detachedFieldIndexFormatV1.js\";\n\nexport { type ForestRootId } from \"./detachedFieldIndexTypes.js\";\n"]}
|
|
@@ -127,5 +127,16 @@ export interface DeltaVisitor {
|
|
|
127
127
|
* @remarks This should only be called when the "current location" is a Field.
|
|
128
128
|
*/
|
|
129
129
|
exitField(key: FieldKey): void;
|
|
130
|
+
/**
|
|
131
|
+
* Optional hook for obtaining the complete ordered change description for a field, suitable
|
|
132
|
+
* for producing positional deltas for external representations (e.g. a text editor or virtual
|
|
133
|
+
* list) without needing to diff the old and new states.
|
|
134
|
+
* @remarks
|
|
135
|
+
* Called once per field per delta, during the first (detach) pass only, after `enterField` but
|
|
136
|
+
* before any `attach`, `detach`, or `enterNode` calls for the field. Firing only during the
|
|
137
|
+
* detach pass ensures marks are always relative to the original array positions rather than an
|
|
138
|
+
* intermediate partially-transformed state.
|
|
139
|
+
*/
|
|
140
|
+
fieldMarks?(marks: readonly Delta.Mark[]): void;
|
|
130
141
|
}
|
|
131
142
|
//# sourceMappingURL=visitDelta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visitDelta.d.ts","sourceRoot":"","sources":["../../../src/core/tree/visitDelta.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAG1D,OAAO,EAAkB,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AAEzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACzB,KAAK,EAAE,KAAK,CAAC,IAAI,EACjB,OAAO,EAAE,YAAY,EACrB,kBA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,EACb,WAAW,EAAE,QAAQ,EACrB,EAAE,EAAE,KAAK,CAAC,cAAc,EACxB,UAAU,EAAE,OAAO,GACjB,IAAI,CAAC;IAER;;;;;;;OAOG;IACH,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IAElC;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IAEjC;;;;;;;OAOG;IACH,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAAC;IAEhC;;;;;;;OAOG;IACH,SAAS,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAAC;IAE/B;;;;;;;;;OASG;IACH,UAAU,CAAC,CAAC,KAAK,EAAE,SAAS,KAAK,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC;CAChD"}
|
|
@@ -169,7 +169,6 @@ function transferRoots(rootTransfers, mapToUpdate, detachedFieldIndex, visitor,
|
|
|
169
169
|
delayed.push({ oldId, newId });
|
|
170
170
|
continue;
|
|
171
171
|
}
|
|
172
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions -- intentional behavior
|
|
173
172
|
newRootId = detachedFieldIndex.createEntry(newId, revision);
|
|
174
173
|
const fields = mapToUpdate.get(oldRootId);
|
|
175
174
|
if (fields !== undefined) {
|
|
@@ -209,6 +208,7 @@ function visitNode(index, fields, visitor, config) {
|
|
|
209
208
|
* - Executes detaches (bottom-up)
|
|
210
209
|
*/
|
|
211
210
|
function detachPass(fieldChanges, visitor, config) {
|
|
211
|
+
visitor.fieldMarks?.(fieldChanges.marks);
|
|
212
212
|
let index = 0;
|
|
213
213
|
for (const mark of fieldChanges.marks) {
|
|
214
214
|
if (mark.fields !== undefined) {
|