@fluidframework/tree 2.101.1 → 2.103.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 +8 -0
- package/api-report/tree.alpha.api.md +19 -0
- package/dist/codec/codec.d.ts +22 -53
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +7 -44
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/index.d.ts +1 -1
- package/dist/codec/index.d.ts.map +1 -1
- package/dist/codec/index.js +2 -2
- package/dist/codec/index.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +56 -28
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js +29 -12
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/codec/versioned/format.d.ts +5 -4
- package/dist/codec/versioned/format.d.ts.map +1 -1
- package/dist/codec/versioned/format.js +26 -3
- package/dist/codec/versioned/format.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 -2
- package/dist/codec/versioned/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +4 -3
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +27 -4
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/schema-stored/formatV1.d.ts +16 -15
- package/dist/core/schema-stored/formatV1.d.ts.map +1 -1
- package/dist/core/schema-stored/formatV1.js +31 -8
- package/dist/core/schema-stored/formatV1.js.map +1 -1
- package/dist/core/schema-stored/formatV2.d.ts +29 -28
- package/dist/core/schema-stored/formatV2.d.ts.map +1 -1
- package/dist/core/schema-stored/formatV2.js +33 -10
- package/dist/core/schema-stored/formatV2.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts +2 -2
- package/dist/core/tree/deltaUtil.js +2 -2
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -2
- package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.js +4 -2
- package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts +3 -3
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js +1 -1
- package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +11 -10
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatCommon.js +33 -10
- package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +7 -6
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV2.js +25 -2
- package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
- package/dist/core/tree/persistedTreeTextFormat.d.ts +19 -18
- package/dist/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
- package/dist/core/tree/persistedTreeTextFormat.js +33 -10
- package/dist/core/tree/persistedTreeTextFormat.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +38 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +63 -5
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +18 -4
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +34 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +106 -3
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +5 -5
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +7 -7
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +13 -12
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js +36 -13
- package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +36 -35
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js +41 -18
- package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +35 -14
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js +35 -6
- package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/formatVText.d.ts +106 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatVText.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatVText.js +67 -0
- package/dist/feature-libraries/chunked-forest/codec/format/formatVText.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts +2 -1
- package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/index.js +5 -1
- package/dist/feature-libraries/chunked-forest/codec/format/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts +38 -4
- package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format/versions.js +7 -1
- package/dist/feature-libraries/chunked-forest/codec/format/versions.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 +1 -2
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +66 -14
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +101 -36
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +36 -14
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts +5 -4
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js +2 -2
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts +6 -5
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.js +26 -3
- package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +4 -3
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js +26 -3
- package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +45 -44
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js +48 -25
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +23 -22
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +29 -6
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +9 -8
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.js +31 -8
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +14 -13
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.js +34 -11
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +5 -4
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.js +25 -2
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts +2 -2
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +1 -1
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV1.d.ts +15 -14
- package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/formatV1.js +27 -4
- package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV2.d.ts +20 -19
- package/dist/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/formatV2.js +27 -4
- package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +1 -3
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV1.d.ts +283 -282
- package/dist/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV1.js +63 -40
- package/dist/feature-libraries/sequence-field/formatV1.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV2.d.ts +180 -179
- package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV2.js +55 -32
- package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV3.d.ts +126 -125
- package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV3.js +27 -4
- package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- 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/isAuditableFromOutcome.d.ts +20 -0
- package/dist/shared-tree/isAuditableFromOutcome.d.ts.map +1 -0
- package/dist/shared-tree/isAuditableFromOutcome.js +36 -0
- package/dist/shared-tree/isAuditableFromOutcome.js.map +1 -0
- package/dist/shared-tree/sharedTree.d.ts +2 -2
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.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 +28 -5
- package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +5 -3
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +37 -8
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +2 -2
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -3
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +2 -2
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts +35 -34
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js +39 -16
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +15 -15
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.js +33 -10
- package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +40 -40
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.js +27 -4
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js +25 -2
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +3 -3
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +2 -2
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +5 -5
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js +31 -8
- package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -7
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.js +29 -6
- package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +5 -0
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +62 -24
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.d.ts +121 -120
- package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchemaFormatV1.js +54 -31
- package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/dist/text/codePointUtils.d.ts +48 -0
- package/dist/text/codePointUtils.d.ts.map +1 -0
- package/dist/text/codePointUtils.js +80 -0
- package/dist/text/codePointUtils.js.map +1 -0
- package/dist/text/index.d.ts +1 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +4 -1
- package/dist/text/index.js.map +1 -1
- package/dist/text/textDomain.d.ts +93 -1
- package/dist/text/textDomain.d.ts.map +1 -1
- package/dist/text/textDomain.js +65 -8
- package/dist/text/textDomain.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +24 -6
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +29 -1
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +9 -7
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/breakable.d.ts +7 -1
- package/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js +18 -4
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/typeboxBrand.d.ts +1 -1
- package/dist/util/typeboxBrand.d.ts.map +1 -1
- package/dist/util/typeboxBrand.js +26 -3
- package/dist/util/typeboxBrand.js.map +1 -1
- package/dist/util/utils.d.ts +2 -2
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +25 -2
- package/dist/util/utils.js.map +1 -1
- package/eslint.config.mts +44 -0
- package/lib/codec/codec.d.ts +22 -53
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +7 -44
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/index.d.ts +1 -1
- package/lib/codec/index.d.ts.map +1 -1
- package/lib/codec/index.js +1 -1
- package/lib/codec/index.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts +56 -28
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js +27 -10
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/codec/versioned/format.d.ts +5 -4
- package/lib/codec/versioned/format.d.ts.map +1 -1
- package/lib/codec/versioned/format.js +1 -1
- package/lib/codec/versioned/format.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/rebase/types.d.ts +4 -3
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +1 -1
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/schema-stored/formatV1.d.ts +16 -15
- package/lib/core/schema-stored/formatV1.d.ts.map +1 -1
- package/lib/core/schema-stored/formatV1.js +1 -1
- package/lib/core/schema-stored/formatV1.js.map +1 -1
- package/lib/core/schema-stored/formatV2.d.ts +29 -28
- package/lib/core/schema-stored/formatV2.d.ts.map +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/deltaUtil.d.ts +2 -2
- package/lib/core/tree/deltaUtil.js +2 -2
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.js +3 -2
- package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV2.js +5 -3
- package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts +3 -3
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecs.js +2 -2
- package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +11 -10
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.js +1 -1
- package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV2.d.ts +7 -6
- package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV2.js +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
- package/lib/core/tree/persistedTreeTextFormat.d.ts +19 -18
- package/lib/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
- package/lib/core/tree/persistedTreeTextFormat.js +1 -1
- package/lib/core/tree/persistedTreeTextFormat.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +38 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +62 -5
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +20 -6
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +34 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +102 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +5 -5
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +3 -3
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +7 -7
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +13 -12
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +36 -35
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +35 -14
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js +9 -3
- package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/formatVText.d.ts +106 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatVText.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatVText.js +41 -0
- package/lib/feature-libraries/chunked-forest/codec/format/formatVText.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts +2 -1
- package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/index.js +2 -1
- package/lib/feature-libraries/chunked-forest/codec/format/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts +38 -4
- package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format/versions.js +6 -0
- package/lib/feature-libraries/chunked-forest/codec/format/versions.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 +2 -3
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +66 -14
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +101 -36
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +36 -14
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts +5 -4
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js +3 -3
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts +6 -5
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.js +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +4 -3
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.js +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindFormat.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +45 -44
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +23 -22
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +9 -8
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.js +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +14 -13
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.js +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +5 -4
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.js +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts +2 -2
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +2 -2
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV1.d.ts +15 -14
- package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/formatV1.js +1 -1
- package/lib/feature-libraries/schema-index/formatV1.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV2.d.ts +20 -19
- package/lib/feature-libraries/schema-index/formatV2.d.ts.map +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/sequence-field/compose.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +1 -3
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV1.d.ts +283 -282
- package/lib/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV1.js +1 -1
- package/lib/feature-libraries/sequence-field/formatV1.js.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV2.d.ts +180 -179
- package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV2.js +1 -1
- package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV3.d.ts +126 -125
- package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV3.js +1 -1
- package/lib/feature-libraries/sequence-field/formatV3.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -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/isAuditableFromOutcome.d.ts +20 -0
- package/lib/shared-tree/isAuditableFromOutcome.d.ts.map +1 -0
- package/lib/shared-tree/isAuditableFromOutcome.js +32 -0
- package/lib/shared-tree/isAuditableFromOutcome.js.map +1 -0
- package/lib/shared-tree/sharedTree.d.ts +2 -2
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +1 -1
- package/lib/shared-tree/sharedTree.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 +1 -1
- package/lib/shared-tree/sharedTreeChangeFormat.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +5 -3
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +38 -9
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +2 -2
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -3
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +3 -3
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts +35 -34
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +15 -15
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.js +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +40 -40
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.js +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +3 -3
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +3 -3
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +5 -5
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -7
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.js +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts +5 -0
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +60 -23
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.d.ts +121 -120
- package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.js +1 -1
- package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
- package/lib/text/codePointUtils.d.ts +48 -0
- package/lib/text/codePointUtils.d.ts.map +1 -0
- package/lib/text/codePointUtils.js +75 -0
- package/lib/text/codePointUtils.js.map +1 -0
- package/lib/text/index.d.ts +1 -0
- package/lib/text/index.d.ts.map +1 -1
- package/lib/text/index.js +1 -0
- package/lib/text/index.js.map +1 -1
- package/lib/text/textDomain.d.ts +93 -1
- package/lib/text/textDomain.d.ts.map +1 -1
- package/lib/text/textDomain.js +56 -0
- package/lib/text/textDomain.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +24 -6
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +30 -2
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +2 -0
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/breakable.d.ts +7 -1
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js +18 -4
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/typeboxBrand.d.ts +1 -1
- package/lib/util/typeboxBrand.d.ts.map +1 -1
- package/lib/util/typeboxBrand.js +1 -1
- package/lib/util/typeboxBrand.js.map +1 -1
- package/lib/util/utils.d.ts +2 -2
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +1 -1
- package/lib/util/utils.js.map +1 -1
- package/package.json +24 -24
- package/src/codec/codec.ts +82 -73
- package/src/codec/index.ts +2 -1
- package/src/codec/versioned/codec.ts +173 -73
- package/src/codec/versioned/format.ts +2 -1
- package/src/codec/versioned/index.ts +2 -1
- package/src/core/rebase/types.ts +1 -1
- package/src/core/schema-stored/formatV1.ts +2 -1
- package/src/core/schema-stored/formatV2.ts +2 -1
- package/src/core/tree/deltaUtil.ts +2 -2
- package/src/core/tree/detachedFieldIndexCodecV1.ts +3 -2
- package/src/core/tree/detachedFieldIndexCodecV2.ts +5 -3
- package/src/core/tree/detachedFieldIndexCodecs.ts +2 -2
- package/src/core/tree/detachedFieldIndexFormatCommon.ts +2 -1
- package/src/core/tree/detachedFieldIndexFormatV2.ts +2 -1
- package/src/core/tree/persistedTreeTextFormat.ts +2 -1
- package/src/feature-libraries/chunked-forest/chunkTree.ts +88 -3
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +27 -7
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +143 -7
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +30 -28
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +7 -7
- package/src/feature-libraries/chunked-forest/codec/format/formatGeneric.ts +2 -1
- package/src/feature-libraries/chunked-forest/codec/format/formatV1.ts +2 -1
- package/src/feature-libraries/chunked-forest/codec/format/formatV2.ts +13 -8
- package/src/feature-libraries/chunked-forest/codec/format/formatVText.ts +84 -0
- package/src/feature-libraries/chunked-forest/codec/format/index.ts +6 -1
- package/src/feature-libraries/chunked-forest/codec/format/versions.ts +25 -4
- package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +14 -18
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +131 -44
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +36 -14
- package/src/feature-libraries/forest-summary/codec.ts +9 -4
- package/src/feature-libraries/forest-summary/formatCommon.ts +2 -1
- package/src/feature-libraries/modular-schema/genericFieldKindFormat.ts +2 -1
- package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +2 -1
- package/src/feature-libraries/modular-schema/modularChangeFormatV2.ts +2 -1
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +1 -1
- package/src/feature-libraries/optional-field/optionalFieldChangeFormatV1.ts +2 -1
- package/src/feature-libraries/optional-field/optionalFieldChangeFormatV2.ts +2 -1
- package/src/feature-libraries/schema-edits/schemaChangeFormat.ts +2 -1
- package/src/feature-libraries/schema-index/codec.ts +2 -5
- package/src/feature-libraries/schema-index/formatV1.ts +2 -1
- package/src/feature-libraries/schema-index/formatV2.ts +2 -1
- package/src/feature-libraries/sequence-field/compose.ts +1 -4
- package/src/feature-libraries/sequence-field/formatV1.ts +2 -1
- package/src/feature-libraries/sequence-field/formatV2.ts +2 -1
- package/src/feature-libraries/sequence-field/formatV3.ts +2 -1
- package/src/index.ts +6 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/isAuditableFromOutcome.ts +34 -0
- package/src/shared-tree/sharedTree.ts +2 -5
- package/src/shared-tree/sharedTreeChangeFormat.ts +2 -1
- package/src/shared-tree/treeCheckout.ts +55 -15
- package/src/shared-tree-core/editManager.ts +2 -2
- package/src/shared-tree-core/editManagerCodecs.ts +4 -6
- package/src/shared-tree-core/editManagerFormatCommons.ts +2 -1
- package/src/shared-tree-core/editManagerFormatV1toV4.ts +2 -1
- package/src/shared-tree-core/editManagerFormatVSharedBranches.ts +2 -1
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +2 -1
- package/src/shared-tree-core/messageCodecs.ts +4 -4
- package/src/shared-tree-core/messageFormatV1ToV4.ts +2 -1
- package/src/shared-tree-core/messageFormatVSharedBranches.ts +2 -1
- package/src/simple-tree/core/treeNodeKernel.ts +66 -28
- package/src/simple-tree/simpleSchemaFormatV1.ts +2 -1
- package/src/text/codePointUtils.ts +81 -0
- package/src/text/index.ts +1 -0
- package/src/text/textDomain.ts +155 -2
- package/src/text/textDomainFormatted.ts +73 -2
- package/src/treeFactory.ts +5 -0
- package/src/util/breakable.ts +27 -6
- package/src/util/typeboxBrand.ts +2 -1
- package/src/util/utils.ts +2 -1
|
@@ -3,6 +3,29 @@
|
|
|
3
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
|
+
if (mod && mod.__esModule) return mod;
|
|
24
|
+
var result = {};
|
|
25
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26
|
+
__setModuleDefault(result, mod);
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
6
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
30
|
exports.SimpleTreeSchemaFormat = exports.SimpleSchemaDefinitionsFormat = exports.SimpleNodeSchemaUnionFormat = exports.SimpleObjectNodeSchemaFormat = exports.SimpleObjectFieldSchemasFormat = exports.SimpleLeafNodeSchemaFormat = exports.SimpleRecordNodeSchemaFormat = exports.SimpleMapNodeSchemaFormat = exports.SimpleArrayNodeSchemaFormat = exports.SimpleObjectFieldSchemaFormat = exports.SimpleFieldSchemaFormat = exports.SimpleAllowedTypesFormat = exports.SimpleAllowedTypeAttributesFormat = exports.SimpleSchemaFormatVersion = void 0;
|
|
8
31
|
/*
|
|
@@ -12,7 +35,7 @@ exports.SimpleTreeSchemaFormat = exports.SimpleSchemaDefinitionsFormat = exports
|
|
|
12
35
|
* This only includes all parts of the schema that impact compatibility according to SchemaCompatibilityTester.
|
|
13
36
|
* It may not include some details which impact maintenance of application enforced invariants (like persisted metadata or logic in view schema).
|
|
14
37
|
*/
|
|
15
|
-
const
|
|
38
|
+
const Type = __importStar(require("@sinclair/typebox"));
|
|
16
39
|
const noAdditionalProps = { additionalProperties: false };
|
|
17
40
|
/**
|
|
18
41
|
* The format version for the schema.
|
|
@@ -24,98 +47,98 @@ exports.SimpleSchemaFormatVersion = {
|
|
|
24
47
|
* The allowed types and their attributes in the simple schema format.
|
|
25
48
|
* @see {@link SimpleAllowedTypes}.
|
|
26
49
|
*/
|
|
27
|
-
exports.SimpleAllowedTypeAttributesFormat =
|
|
28
|
-
isStaged:
|
|
50
|
+
exports.SimpleAllowedTypeAttributesFormat = Type.Object({
|
|
51
|
+
isStaged: Type.Optional(Type.Boolean()),
|
|
29
52
|
}, noAdditionalProps);
|
|
30
53
|
/**
|
|
31
54
|
* A set of allowed types in the simple schema format.
|
|
32
55
|
* The keys are the type identifiers, and the values are their attributes.
|
|
33
56
|
*/
|
|
34
|
-
exports.SimpleAllowedTypesFormat =
|
|
57
|
+
exports.SimpleAllowedTypesFormat = Type.Record(Type.String(), exports.SimpleAllowedTypeAttributesFormat);
|
|
35
58
|
/**
|
|
36
59
|
* Persisted format for a field schema in the simple schema format.
|
|
37
60
|
* @see {@link SimpleFieldSchema}.
|
|
38
61
|
*/
|
|
39
|
-
exports.SimpleFieldSchemaFormat =
|
|
40
|
-
kind:
|
|
62
|
+
exports.SimpleFieldSchemaFormat = Type.Object({
|
|
63
|
+
kind: Type.Integer(),
|
|
41
64
|
simpleAllowedTypes: exports.SimpleAllowedTypesFormat,
|
|
42
65
|
}, noAdditionalProps);
|
|
43
66
|
/**
|
|
44
67
|
* Persisted format for an object field schema in the simple schema format.
|
|
45
68
|
* @see {@link SimpleObjectFieldSchema}.
|
|
46
69
|
*/
|
|
47
|
-
exports.SimpleObjectFieldSchemaFormat =
|
|
48
|
-
kind:
|
|
70
|
+
exports.SimpleObjectFieldSchemaFormat = Type.Object({
|
|
71
|
+
kind: Type.Integer(),
|
|
49
72
|
simpleAllowedTypes: exports.SimpleAllowedTypesFormat,
|
|
50
|
-
storedKey:
|
|
73
|
+
storedKey: Type.String(),
|
|
51
74
|
}, noAdditionalProps);
|
|
52
75
|
/**
|
|
53
76
|
* Persisted format for an array node schema in the simple schema format.
|
|
54
77
|
* @see {@link SimpleArrayNodeSchema}.
|
|
55
78
|
*/
|
|
56
|
-
exports.SimpleArrayNodeSchemaFormat =
|
|
57
|
-
kind:
|
|
79
|
+
exports.SimpleArrayNodeSchemaFormat = Type.Object({
|
|
80
|
+
kind: Type.Integer(),
|
|
58
81
|
simpleAllowedTypes: exports.SimpleAllowedTypesFormat,
|
|
59
82
|
}, noAdditionalProps);
|
|
60
83
|
/**
|
|
61
84
|
* Persisted format for a map node schema in the simple schema format.
|
|
62
85
|
* @see {@link SimpleMapNodeSchema}.
|
|
63
86
|
*/
|
|
64
|
-
exports.SimpleMapNodeSchemaFormat =
|
|
65
|
-
kind:
|
|
87
|
+
exports.SimpleMapNodeSchemaFormat = Type.Object({
|
|
88
|
+
kind: Type.Integer(),
|
|
66
89
|
simpleAllowedTypes: exports.SimpleAllowedTypesFormat,
|
|
67
90
|
}, noAdditionalProps);
|
|
68
91
|
/**
|
|
69
92
|
* Persisted format for a record node schema in the simple schema format.
|
|
70
93
|
* @see {@link SimpleRecordNodeSchema}.
|
|
71
94
|
*/
|
|
72
|
-
exports.SimpleRecordNodeSchemaFormat =
|
|
73
|
-
kind:
|
|
95
|
+
exports.SimpleRecordNodeSchemaFormat = Type.Object({
|
|
96
|
+
kind: Type.Integer(),
|
|
74
97
|
simpleAllowedTypes: exports.SimpleAllowedTypesFormat,
|
|
75
98
|
}, noAdditionalProps);
|
|
76
99
|
/**
|
|
77
100
|
* Persisted format for a leaf node schema in the simple schema format.
|
|
78
101
|
* @see {@link SimpleLeafNodeSchema}.
|
|
79
102
|
*/
|
|
80
|
-
exports.SimpleLeafNodeSchemaFormat =
|
|
81
|
-
kind:
|
|
82
|
-
leafKind:
|
|
103
|
+
exports.SimpleLeafNodeSchemaFormat = Type.Object({
|
|
104
|
+
kind: Type.Integer(),
|
|
105
|
+
leafKind: Type.Integer(),
|
|
83
106
|
}, noAdditionalProps);
|
|
84
107
|
/**
|
|
85
108
|
* Persisted format for the field schemas of an object node in the simple schema format.
|
|
86
109
|
*/
|
|
87
|
-
exports.SimpleObjectFieldSchemasFormat =
|
|
110
|
+
exports.SimpleObjectFieldSchemasFormat = Type.Record(Type.String(), exports.SimpleObjectFieldSchemaFormat);
|
|
88
111
|
/**
|
|
89
112
|
* Persisted format for an object node schema in the simple schema format.
|
|
90
113
|
* @see {@link SimpleObjectNodeSchema}.
|
|
91
114
|
*/
|
|
92
|
-
exports.SimpleObjectNodeSchemaFormat =
|
|
93
|
-
kind:
|
|
115
|
+
exports.SimpleObjectNodeSchemaFormat = Type.Object({
|
|
116
|
+
kind: Type.Integer(),
|
|
94
117
|
fields: exports.SimpleObjectFieldSchemasFormat,
|
|
95
|
-
allowUnknownOptionalFields:
|
|
118
|
+
allowUnknownOptionalFields: Type.Optional(Type.Boolean()),
|
|
96
119
|
}, noAdditionalProps);
|
|
97
120
|
/**
|
|
98
121
|
* Discriminated union of all possible node schemas.
|
|
99
122
|
*
|
|
100
123
|
* See {@link DiscriminatedUnionDispatcher} for more information on this pattern.
|
|
101
124
|
*/
|
|
102
|
-
exports.SimpleNodeSchemaUnionFormat =
|
|
103
|
-
array:
|
|
104
|
-
map:
|
|
105
|
-
record:
|
|
106
|
-
leaf:
|
|
107
|
-
object:
|
|
125
|
+
exports.SimpleNodeSchemaUnionFormat = Type.Object({
|
|
126
|
+
array: Type.Optional(exports.SimpleArrayNodeSchemaFormat),
|
|
127
|
+
map: Type.Optional(exports.SimpleMapNodeSchemaFormat),
|
|
128
|
+
record: Type.Optional(exports.SimpleRecordNodeSchemaFormat),
|
|
129
|
+
leaf: Type.Optional(exports.SimpleLeafNodeSchemaFormat),
|
|
130
|
+
object: Type.Optional(exports.SimpleObjectNodeSchemaFormat),
|
|
108
131
|
});
|
|
109
132
|
/**
|
|
110
133
|
* Helper type for the schema definitions map in the persisted format.
|
|
111
134
|
*/
|
|
112
|
-
exports.SimpleSchemaDefinitionsFormat =
|
|
135
|
+
exports.SimpleSchemaDefinitionsFormat = Type.Record(Type.String(), exports.SimpleNodeSchemaUnionFormat);
|
|
113
136
|
/**
|
|
114
137
|
* Persisted format for the compatibility impacting subset of simple schema.
|
|
115
138
|
* @see {@link SimpleTreeSchema}.
|
|
116
139
|
*/
|
|
117
|
-
exports.SimpleTreeSchemaFormat =
|
|
118
|
-
version:
|
|
140
|
+
exports.SimpleTreeSchemaFormat = Type.Object({
|
|
141
|
+
version: Type.Literal(exports.SimpleSchemaFormatVersion.v1),
|
|
119
142
|
root: exports.SimpleFieldSchemaFormat,
|
|
120
143
|
definitions: exports.SimpleSchemaDefinitionsFormat,
|
|
121
144
|
}, noAdditionalProps);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleSchemaFormatV1.js","sourceRoot":"","sources":["../../src/simple-tree/simpleSchemaFormatV1.ts"],"names":[],"mappings":";AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"simpleSchemaFormatV1.js","sourceRoot":"","sources":["../../src/simple-tree/simpleSchemaFormatV1.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;;;;;GAMG;AAEH,wDAA0C;AAG1C,MAAM,iBAAiB,GAAkB,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC;AAEzE;;GAEG;AACU,QAAA,yBAAyB,GAAG;IACxC,EAAE,EAAE,CAAC;CACI,CAAC;AAEX;;;GAGG;AACU,QAAA,iCAAiC,GAAG,IAAI,CAAC,MAAM,CAC3D;IACC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;CACvC,EACD,iBAAiB,CACjB,CAAC;AAMF;;;GAGG;AACU,QAAA,wBAAwB,GAAG,IAAI,CAAC,MAAM,CAClD,IAAI,CAAC,MAAM,EAAE,EACb,yCAAiC,CACjC,CAAC;AAGF;;;GAGG;AACU,QAAA,uBAAuB,GAAG,IAAI,CAAC,MAAM,CACjD;IACC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE;IACpB,kBAAkB,EAAE,gCAAwB;CAC5C,EACD,iBAAiB,CACjB,CAAC;AAGF;;;GAGG;AACU,QAAA,6BAA6B,GAAG,IAAI,CAAC,MAAM,CACvD;IACC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE;IACpB,kBAAkB,EAAE,gCAAwB;IAC5C,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE;CACxB,EACD,iBAAiB,CACjB,CAAC;AAGF;;;GAGG;AACU,QAAA,2BAA2B,GAAG,IAAI,CAAC,MAAM,CACrD;IACC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE;IACpB,kBAAkB,EAAE,gCAAwB;CAC5C,EACD,iBAAiB,CACjB,CAAC;AAGF;;;GAGG;AACU,QAAA,yBAAyB,GAAG,IAAI,CAAC,MAAM,CACnD;IACC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE;IACpB,kBAAkB,EAAE,gCAAwB;CAC5C,EACD,iBAAiB,CACjB,CAAC;AAGF;;;GAGG;AACU,QAAA,4BAA4B,GAAG,IAAI,CAAC,MAAM,CACtD;IACC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE;IACpB,kBAAkB,EAAE,gCAAwB;CAC5C,EACD,iBAAiB,CACjB,CAAC;AAGF;;;GAGG;AACU,QAAA,0BAA0B,GAAG,IAAI,CAAC,MAAM,CACpD;IACC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE;IACpB,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE;CACxB,EACD,iBAAiB,CACjB,CAAC;AAGF;;GAEG;AACU,QAAA,8BAA8B,GAAG,IAAI,CAAC,MAAM,CACxD,IAAI,CAAC,MAAM,EAAE,EACb,qCAA6B,CAC7B,CAAC;AAGF;;;GAGG;AACU,QAAA,4BAA4B,GAAG,IAAI,CAAC,MAAM,CACtD;IACC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE;IACpB,MAAM,EAAE,sCAA8B;IACtC,0BAA0B,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;CACzD,EACD,iBAAiB,CACjB,CAAC;AAGF;;;;GAIG;AACU,QAAA,2BAA2B,GAAG,IAAI,CAAC,MAAM,CAAC;IACtD,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,mCAA2B,CAAC;IACjD,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,iCAAyB,CAAC;IAC7C,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,oCAA4B,CAAC;IACnD,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,kCAA0B,CAAC;IAC/C,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,oCAA4B,CAAC;CACnD,CAAC,CAAC;AAGH;;GAEG;AACU,QAAA,6BAA6B,GAAG,IAAI,CAAC,MAAM,CACvD,IAAI,CAAC,MAAM,EAAE,EACb,mCAA2B,CAC3B,CAAC;AAGF;;;GAGG;AACU,QAAA,sBAAsB,GAAG,IAAI,CAAC,MAAM,CAChD;IACC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,iCAAyB,CAAC,EAAE,CAAC;IACnD,IAAI,EAAE,+BAAuB;IAC7B,WAAW,EAAE,qCAA6B;CAC1C,EACD,iBAAiB,CACjB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/*\n * This file contains a format for serializing the compatibility impacting subset of simple schema.\n\n * This format can be used for both view and stored simple schema.\n * This only includes all parts of the schema that impact compatibility according to SchemaCompatibilityTester.\n * It may not include some details which impact maintenance of application enforced invariants (like persisted metadata or logic in view schema).\n */\n\nimport * as Type from \"@sinclair/typebox\";\nimport type { ObjectOptions, Static } from \"@sinclair/typebox\";\n\nconst noAdditionalProps: ObjectOptions = { additionalProperties: false };\n\n/**\n * The format version for the schema.\n */\nexport const SimpleSchemaFormatVersion = {\n\tv1: 1,\n} as const;\n\n/**\n * The allowed types and their attributes in the simple schema format.\n * @see {@link SimpleAllowedTypes}.\n */\nexport const SimpleAllowedTypeAttributesFormat = Type.Object(\n\t{\n\t\tisStaged: Type.Optional(Type.Boolean()),\n\t},\n\tnoAdditionalProps,\n);\n\nexport type SimpleAllowedTypeAttributesFormat = Static<\n\ttypeof SimpleAllowedTypeAttributesFormat\n>;\n\n/**\n * A set of allowed types in the simple schema format.\n * The keys are the type identifiers, and the values are their attributes.\n */\nexport const SimpleAllowedTypesFormat = Type.Record(\n\tType.String(),\n\tSimpleAllowedTypeAttributesFormat,\n);\nexport type SimpleAllowedTypesFormat = Static<typeof SimpleAllowedTypesFormat>;\n\n/**\n * Persisted format for a field schema in the simple schema format.\n * @see {@link SimpleFieldSchema}.\n */\nexport const SimpleFieldSchemaFormat = Type.Object(\n\t{\n\t\tkind: Type.Integer(),\n\t\tsimpleAllowedTypes: SimpleAllowedTypesFormat,\n\t},\n\tnoAdditionalProps,\n);\nexport type SimpleFieldSchemaFormat = Static<typeof SimpleFieldSchemaFormat>;\n\n/**\n * Persisted format for an object field schema in the simple schema format.\n * @see {@link SimpleObjectFieldSchema}.\n */\nexport const SimpleObjectFieldSchemaFormat = Type.Object(\n\t{\n\t\tkind: Type.Integer(),\n\t\tsimpleAllowedTypes: SimpleAllowedTypesFormat,\n\t\tstoredKey: Type.String(),\n\t},\n\tnoAdditionalProps,\n);\nexport type SimpleObjectFieldSchemaFormat = Static<typeof SimpleObjectFieldSchemaFormat>;\n\n/**\n * Persisted format for an array node schema in the simple schema format.\n * @see {@link SimpleArrayNodeSchema}.\n */\nexport const SimpleArrayNodeSchemaFormat = Type.Object(\n\t{\n\t\tkind: Type.Integer(),\n\t\tsimpleAllowedTypes: SimpleAllowedTypesFormat,\n\t},\n\tnoAdditionalProps,\n);\nexport type SimpleArrayNodeSchemaFormat = Static<typeof SimpleArrayNodeSchemaFormat>;\n\n/**\n * Persisted format for a map node schema in the simple schema format.\n * @see {@link SimpleMapNodeSchema}.\n */\nexport const SimpleMapNodeSchemaFormat = Type.Object(\n\t{\n\t\tkind: Type.Integer(),\n\t\tsimpleAllowedTypes: SimpleAllowedTypesFormat,\n\t},\n\tnoAdditionalProps,\n);\nexport type SimpleMapNodeSchemaFormat = Static<typeof SimpleMapNodeSchemaFormat>;\n\n/**\n * Persisted format for a record node schema in the simple schema format.\n * @see {@link SimpleRecordNodeSchema}.\n */\nexport const SimpleRecordNodeSchemaFormat = Type.Object(\n\t{\n\t\tkind: Type.Integer(),\n\t\tsimpleAllowedTypes: SimpleAllowedTypesFormat,\n\t},\n\tnoAdditionalProps,\n);\nexport type SimpleRecordNodeSchemaFormat = Static<typeof SimpleRecordNodeSchemaFormat>;\n\n/**\n * Persisted format for a leaf node schema in the simple schema format.\n * @see {@link SimpleLeafNodeSchema}.\n */\nexport const SimpleLeafNodeSchemaFormat = Type.Object(\n\t{\n\t\tkind: Type.Integer(),\n\t\tleafKind: Type.Integer(),\n\t},\n\tnoAdditionalProps,\n);\nexport type SimpleLeafNodeSchemaFormat = Static<typeof SimpleLeafNodeSchemaFormat>;\n\n/**\n * Persisted format for the field schemas of an object node in the simple schema format.\n */\nexport const SimpleObjectFieldSchemasFormat = Type.Record(\n\tType.String(),\n\tSimpleObjectFieldSchemaFormat,\n);\nexport type SimpleObjectFieldSchemasFormat = Static<typeof SimpleObjectFieldSchemasFormat>;\n\n/**\n * Persisted format for an object node schema in the simple schema format.\n * @see {@link SimpleObjectNodeSchema}.\n */\nexport const SimpleObjectNodeSchemaFormat = Type.Object(\n\t{\n\t\tkind: Type.Integer(),\n\t\tfields: SimpleObjectFieldSchemasFormat,\n\t\tallowUnknownOptionalFields: Type.Optional(Type.Boolean()),\n\t},\n\tnoAdditionalProps,\n);\nexport type SimpleObjectNodeSchemaFormat = Static<typeof SimpleObjectNodeSchemaFormat>;\n\n/**\n * Discriminated union of all possible node schemas.\n *\n * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.\n */\nexport const SimpleNodeSchemaUnionFormat = Type.Object({\n\tarray: Type.Optional(SimpleArrayNodeSchemaFormat),\n\tmap: Type.Optional(SimpleMapNodeSchemaFormat),\n\trecord: Type.Optional(SimpleRecordNodeSchemaFormat),\n\tleaf: Type.Optional(SimpleLeafNodeSchemaFormat),\n\tobject: Type.Optional(SimpleObjectNodeSchemaFormat),\n});\nexport type SimpleNodeSchemaUnionFormat = Static<typeof SimpleNodeSchemaUnionFormat>;\n\n/**\n * Helper type for the schema definitions map in the persisted format.\n */\nexport const SimpleSchemaDefinitionsFormat = Type.Record(\n\tType.String(),\n\tSimpleNodeSchemaUnionFormat,\n);\nexport type SimpleSchemaDefinitionsFormat = Static<typeof SimpleSchemaDefinitionsFormat>;\n\n/**\n * Persisted format for the compatibility impacting subset of simple schema.\n * @see {@link SimpleTreeSchema}.\n */\nexport const SimpleTreeSchemaFormat = Type.Object(\n\t{\n\t\tversion: Type.Literal(SimpleSchemaFormatVersion.v1),\n\t\troot: SimpleFieldSchemaFormat,\n\t\tdefinitions: SimpleSchemaDefinitionsFormat,\n\t},\n\tnoAdditionalProps,\n);\nexport type SimpleTreeSchemaFormat = Static<typeof SimpleTreeSchemaFormat>;\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Returns the number of Unicode code points in `value`.
|
|
7
|
+
* @remarks
|
|
8
|
+
* Use this to translate a JavaScript string length (which is in UTF-16 code units) into
|
|
9
|
+
* the atom/code-point space used by {@link TextAsTree}.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* codePointCount(""); // 0
|
|
14
|
+
* codePointCount("abc"); // 3
|
|
15
|
+
* codePointCount("a😀b"); // 3 — emoji is one code point, but "a😀b".length === 4 (UTF-16 surrogate pair)
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function codePointCount(value: string): number;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the number of UTF-16 code units occupied by the first `count` Unicode code points in `value`,
|
|
23
|
+
* starting at UTF-16 index `start`.
|
|
24
|
+
* @remarks
|
|
25
|
+
* Use this to translate {@link TextAsTree}-space counts (code points) into JavaScript string indices (UTF-16).
|
|
26
|
+
* One code point outside the Basic Multilingual Plane (e.g. most emoji) occupies two UTF-16 code units.
|
|
27
|
+
*
|
|
28
|
+
* Validates that the requested `count` code points are fully consumable from `start`; silent truncation
|
|
29
|
+
* would misalign delta offsets applied to strings rather than surface the drift to the caller.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* utf16LengthForCodePoints("abc", 0, 3); // 3 — three single-unit characters
|
|
34
|
+
* utf16LengthForCodePoints("a😀b", 0, 3); // 4 — a (1) + 😀 (2) + b (1)
|
|
35
|
+
* utf16LengthForCodePoints("a😀b", 1, 1); // 2 — just the emoji
|
|
36
|
+
* utf16LengthForCodePoints("abc", 0, 0); // 0 — no code points requested
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param value - The string to measure.
|
|
40
|
+
* @param start - The UTF-16 index in `value` to start measuring from. Must be in `[0, value.length]`.
|
|
41
|
+
* @param count - The number of Unicode code points to measure. Must be non-negative, and there must
|
|
42
|
+
* be at least `count` code points available in `value` starting at `start`.
|
|
43
|
+
* @throws A {@link @fluidframework/telemetry-utils#UsageError} if `start` is out of range,
|
|
44
|
+
* `count` is negative, or fewer than `count` code points are available from `start`.
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export declare function utf16LengthForCodePoints(value: string, start: number, count: number): number;
|
|
48
|
+
//# sourceMappingURL=codePointUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codePointUtils.d.ts","sourceRoot":"","sources":["../../src/text/codePointUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOpD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAuB5F"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.utf16LengthForCodePoints = exports.codePointCount = void 0;
|
|
8
|
+
const internal_1 = require("@fluidframework/telemetry-utils/internal");
|
|
9
|
+
/**
|
|
10
|
+
* Returns the number of Unicode code points in `value`.
|
|
11
|
+
* @remarks
|
|
12
|
+
* Use this to translate a JavaScript string length (which is in UTF-16 code units) into
|
|
13
|
+
* the atom/code-point space used by {@link TextAsTree}.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* codePointCount(""); // 0
|
|
18
|
+
* codePointCount("abc"); // 3
|
|
19
|
+
* codePointCount("a😀b"); // 3 — emoji is one code point, but "a😀b".length === 4 (UTF-16 surrogate pair)
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
function codePointCount(value) {
|
|
25
|
+
// Iterate instead of spreading to avoid allocating an intermediate array.
|
|
26
|
+
let count = 0;
|
|
27
|
+
for (const _ of value) {
|
|
28
|
+
count++;
|
|
29
|
+
}
|
|
30
|
+
return count;
|
|
31
|
+
}
|
|
32
|
+
exports.codePointCount = codePointCount;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the number of UTF-16 code units occupied by the first `count` Unicode code points in `value`,
|
|
35
|
+
* starting at UTF-16 index `start`.
|
|
36
|
+
* @remarks
|
|
37
|
+
* Use this to translate {@link TextAsTree}-space counts (code points) into JavaScript string indices (UTF-16).
|
|
38
|
+
* One code point outside the Basic Multilingual Plane (e.g. most emoji) occupies two UTF-16 code units.
|
|
39
|
+
*
|
|
40
|
+
* Validates that the requested `count` code points are fully consumable from `start`; silent truncation
|
|
41
|
+
* would misalign delta offsets applied to strings rather than surface the drift to the caller.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* utf16LengthForCodePoints("abc", 0, 3); // 3 — three single-unit characters
|
|
46
|
+
* utf16LengthForCodePoints("a😀b", 0, 3); // 4 — a (1) + 😀 (2) + b (1)
|
|
47
|
+
* utf16LengthForCodePoints("a😀b", 1, 1); // 2 — just the emoji
|
|
48
|
+
* utf16LengthForCodePoints("abc", 0, 0); // 0 — no code points requested
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @param value - The string to measure.
|
|
52
|
+
* @param start - The UTF-16 index in `value` to start measuring from. Must be in `[0, value.length]`.
|
|
53
|
+
* @param count - The number of Unicode code points to measure. Must be non-negative, and there must
|
|
54
|
+
* be at least `count` code points available in `value` starting at `start`.
|
|
55
|
+
* @throws A {@link @fluidframework/telemetry-utils#UsageError} if `start` is out of range,
|
|
56
|
+
* `count` is negative, or fewer than `count` code points are available from `start`.
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
function utf16LengthForCodePoints(value, start, count) {
|
|
60
|
+
if (start < 0 || start > value.length) {
|
|
61
|
+
throw new internal_1.UsageError(`start (${start}) must be within [0, ${value.length}] (value.length).`);
|
|
62
|
+
}
|
|
63
|
+
if (count < 0) {
|
|
64
|
+
throw new internal_1.UsageError(`count (${count}) must be non-negative.`);
|
|
65
|
+
}
|
|
66
|
+
let utf16 = 0;
|
|
67
|
+
let counted = 0;
|
|
68
|
+
while (counted < count && start + utf16 < value.length) {
|
|
69
|
+
// Code points above 0xFFFF are encoded in UTF-16 as a surrogate pair (2 units);
|
|
70
|
+
// everything else takes a single UTF-16 unit.
|
|
71
|
+
utf16 += (value.codePointAt(start + utf16) ?? 0) > 0xffff ? 2 : 1;
|
|
72
|
+
counted++;
|
|
73
|
+
}
|
|
74
|
+
if (counted !== count) {
|
|
75
|
+
throw new internal_1.UsageError(`count (${count}) exceeds the ${counted} code point(s) available from start (${start}) in a value of length ${value.length}.`);
|
|
76
|
+
}
|
|
77
|
+
return utf16;
|
|
78
|
+
}
|
|
79
|
+
exports.utf16LengthForCodePoints = utf16LengthForCodePoints;
|
|
80
|
+
//# sourceMappingURL=codePointUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codePointUtils.js","sourceRoot":"","sources":["../../src/text/codePointUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uEAAsE;AAEtE;;;;;;;;;;;;;;GAcG;AACH,SAAgB,cAAc,CAAC,KAAa;IAC3C,0EAA0E;IAC1E,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACvB,KAAK,EAAE,CAAC;IACT,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAPD,wCAOC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,wBAAwB,CAAC,KAAa,EAAE,KAAa,EAAE,KAAa;IACnF,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QACvC,MAAM,IAAI,qBAAU,CACnB,UAAU,KAAK,wBAAwB,KAAK,CAAC,MAAM,mBAAmB,CACtE,CAAC;IACH,CAAC;IACD,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,qBAAU,CAAC,UAAU,KAAK,yBAAyB,CAAC,CAAC;IAChE,CAAC;IACD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,OAAO,OAAO,GAAG,KAAK,IAAI,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QACxD,gFAAgF;QAChF,8CAA8C;QAC9C,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClE,OAAO,EAAE,CAAC;IACX,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,EAAE,CAAC;QACvB,MAAM,IAAI,qBAAU,CACnB,UAAU,KAAK,iBAAiB,OAAO,wCAAwC,KAAK,0BAA0B,KAAK,CAAC,MAAM,GAAG,CAC7H,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAvBD,4DAuBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Returns the number of Unicode code points in `value`.\n * @remarks\n * Use this to translate a JavaScript string length (which is in UTF-16 code units) into\n * the atom/code-point space used by {@link TextAsTree}.\n *\n * @example\n * ```typescript\n * codePointCount(\"\"); // 0\n * codePointCount(\"abc\"); // 3\n * codePointCount(\"a😀b\"); // 3 — emoji is one code point, but \"a😀b\".length === 4 (UTF-16 surrogate pair)\n * ```\n *\n * @internal\n */\nexport function codePointCount(value: string): number {\n\t// Iterate instead of spreading to avoid allocating an intermediate array.\n\tlet count = 0;\n\tfor (const _ of value) {\n\t\tcount++;\n\t}\n\treturn count;\n}\n\n/**\n * Returns the number of UTF-16 code units occupied by the first `count` Unicode code points in `value`,\n * starting at UTF-16 index `start`.\n * @remarks\n * Use this to translate {@link TextAsTree}-space counts (code points) into JavaScript string indices (UTF-16).\n * One code point outside the Basic Multilingual Plane (e.g. most emoji) occupies two UTF-16 code units.\n *\n * Validates that the requested `count` code points are fully consumable from `start`; silent truncation\n * would misalign delta offsets applied to strings rather than surface the drift to the caller.\n *\n * @example\n * ```typescript\n * utf16LengthForCodePoints(\"abc\", 0, 3); // 3 — three single-unit characters\n * utf16LengthForCodePoints(\"a😀b\", 0, 3); // 4 — a (1) + 😀 (2) + b (1)\n * utf16LengthForCodePoints(\"a😀b\", 1, 1); // 2 — just the emoji\n * utf16LengthForCodePoints(\"abc\", 0, 0); // 0 — no code points requested\n * ```\n *\n * @param value - The string to measure.\n * @param start - The UTF-16 index in `value` to start measuring from. Must be in `[0, value.length]`.\n * @param count - The number of Unicode code points to measure. Must be non-negative, and there must\n * be at least `count` code points available in `value` starting at `start`.\n * @throws A {@link @fluidframework/telemetry-utils#UsageError} if `start` is out of range,\n * `count` is negative, or fewer than `count` code points are available from `start`.\n * @internal\n */\nexport function utf16LengthForCodePoints(value: string, start: number, count: number): number {\n\tif (start < 0 || start > value.length) {\n\t\tthrow new UsageError(\n\t\t\t`start (${start}) must be within [0, ${value.length}] (value.length).`,\n\t\t);\n\t}\n\tif (count < 0) {\n\t\tthrow new UsageError(`count (${count}) must be non-negative.`);\n\t}\n\tlet utf16 = 0;\n\tlet counted = 0;\n\twhile (counted < count && start + utf16 < value.length) {\n\t\t// Code points above 0xFFFF are encoded in UTF-16 as a surrogate pair (2 units);\n\t\t// everything else takes a single UTF-16 unit.\n\t\tutf16 += (value.codePointAt(start + utf16) ?? 0) > 0xffff ? 2 : 1;\n\t\tcounted++;\n\t}\n\tif (counted !== count) {\n\t\tthrow new UsageError(\n\t\t\t`count (${count}) exceeds the ${counted} code point(s) available from start (${start}) in a value of length ${value.length}.`,\n\t\t);\n\t}\n\treturn utf16;\n}\n"]}
|
package/dist/text/index.d.ts
CHANGED
package/dist/text/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/text/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/text/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/text/index.js
CHANGED
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.FormattedTextAsTree = exports.TextAsTree = void 0;
|
|
7
|
+
exports.utf16LengthForCodePoints = exports.codePointCount = exports.FormattedTextAsTree = exports.TextAsTree = void 0;
|
|
8
8
|
var textDomain_js_1 = require("./textDomain.js");
|
|
9
9
|
Object.defineProperty(exports, "TextAsTree", { enumerable: true, get: function () { return textDomain_js_1.TextAsTree; } });
|
|
10
10
|
var textDomainFormatted_js_1 = require("./textDomainFormatted.js");
|
|
11
11
|
Object.defineProperty(exports, "FormattedTextAsTree", { enumerable: true, get: function () { return textDomainFormatted_js_1.FormattedTextAsTree; } });
|
|
12
|
+
var codePointUtils_js_1 = require("./codePointUtils.js");
|
|
13
|
+
Object.defineProperty(exports, "codePointCount", { enumerable: true, get: function () { return codePointUtils_js_1.codePointCount; } });
|
|
14
|
+
Object.defineProperty(exports, "utf16LengthForCodePoints", { enumerable: true, get: function () { return codePointUtils_js_1.utf16LengthForCodePoints; } });
|
|
12
15
|
//# sourceMappingURL=index.js.map
|
package/dist/text/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/text/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAA6C;AAApC,2GAAA,UAAU,OAAA;AACnB,mEAA+D;AAAtD,6HAAA,mBAAmB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { TextAsTree } from \"./textDomain.js\";\nexport { FormattedTextAsTree } from \"./textDomainFormatted.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/text/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAA6C;AAApC,2GAAA,UAAU,OAAA;AACnB,mEAA+D;AAAtD,6HAAA,mBAAmB,OAAA;AAC5B,yDAA+E;AAAtE,mHAAA,cAAc,OAAA;AAAE,6HAAA,wBAAwB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { TextAsTree } from \"./textDomain.js\";\nexport { FormattedTextAsTree } from \"./textDomainFormatted.js\";\nexport { codePointCount, utf16LengthForCodePoints } from \"./codePointUtils.js\";\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import type { TreeNode, WithType } from "../simple-tree/index.js";
|
|
5
|
+
import type { ArrayNodeDeltaOp, ArrayNodeTreeChangedDeltaOp, TreeNode, WithType } from "../simple-tree/index.js";
|
|
6
6
|
import type { NodeKind, TreeNodeSchema } from "../simple-tree/index.js";
|
|
7
7
|
/**
|
|
8
8
|
* Interpret a string as an iterable of characters.
|
|
@@ -12,6 +12,21 @@ import type { NodeKind, TreeNodeSchema } from "../simple-tree/index.js";
|
|
|
12
12
|
* Additionally using this function consistently will make any refactors to support alternative character boundaries easier.
|
|
13
13
|
*/
|
|
14
14
|
export declare function charactersFromString(value: string): Iterable<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Processes an array-node delta into a {@link TextAsTree.TextOp}[] and calls `callback`.
|
|
17
|
+
* @remarks
|
|
18
|
+
* Shared by both the plain `onCharactersChanged` (from `nodeChanged`) and formatted `onContentChanged`
|
|
19
|
+
* (from `treeChanged`) implementations.
|
|
20
|
+
* @param delta - The raw array-node delta, or `undefined` when no delta is available.
|
|
21
|
+
* When retain ops carry `subtreeChanged` (i.e. delta comes from a `treeChanged` event), the emitted
|
|
22
|
+
* retain ops include an explicit `formattingChanged: boolean`. Otherwise `formattingChanged` is omitted.
|
|
23
|
+
* @param getCharacter - Returns the character string at the given array index in the **post-edit** tree.
|
|
24
|
+
* Only invoked for insert ops, where it must read the inserted character at the given index of the tree
|
|
25
|
+
* after the edit has been applied. Passing an accessor that reads pre-edit content will silently produce wrong text.
|
|
26
|
+
* Return `undefined` if the tree is out of sync with the delta; this triggers a full-reread fallback.
|
|
27
|
+
* @param callback - The user-supplied callback to invoke with the translated ops.
|
|
28
|
+
*/
|
|
29
|
+
export declare function processCharactersChangedDelta(delta: readonly (ArrayNodeDeltaOp | ArrayNodeTreeChangedDeltaOp)[] | undefined, getCharacter: (index: number) => string | undefined, callback: (ops: readonly TextAsTree.TextOp[] | undefined) => void): void;
|
|
15
30
|
/**
|
|
16
31
|
* A collection of text related types, schema and utilities for working with text beyond the basic {@link SchemaStatics.string}.
|
|
17
32
|
* @privateRemarks
|
|
@@ -75,6 +90,67 @@ export declare function charactersFromString(value: string): Iterable<string>;
|
|
|
75
90
|
* @alpha
|
|
76
91
|
*/
|
|
77
92
|
export declare namespace TextAsTree {
|
|
93
|
+
/**
|
|
94
|
+
* A retain op in a character-level delta — a span of unchanged characters that the consumer should skip over.
|
|
95
|
+
* @sealed
|
|
96
|
+
* @alpha
|
|
97
|
+
*/
|
|
98
|
+
interface TextRetainOp {
|
|
99
|
+
/**
|
|
100
|
+
* Discriminator identifying this op as a retain.
|
|
101
|
+
*/
|
|
102
|
+
readonly type: "retain";
|
|
103
|
+
/**
|
|
104
|
+
* The number of Unicode code points to retain.
|
|
105
|
+
*/
|
|
106
|
+
readonly count: number;
|
|
107
|
+
/**
|
|
108
|
+
* Whether at least one character in the retained range had a deep change.
|
|
109
|
+
* @remarks
|
|
110
|
+
* Present only on retain ops delivered by {@link @fluidframework/tree#FormattedTextAsTree.Members.onContentChanged};
|
|
111
|
+
* always absent on retain ops delivered by {@link TextAsTree.Members.onCharactersChanged}.
|
|
112
|
+
* When present, `true` indicates the retained range contained a formatting property update
|
|
113
|
+
* or an atom content edit; `false` indicates no deep change.
|
|
114
|
+
*/
|
|
115
|
+
readonly formattingChanged?: boolean;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* An insert op in a character-level delta — characters newly added to the text.
|
|
119
|
+
* @remarks
|
|
120
|
+
* Carries the inserted text as a single string, which is more convenient for consumers than individual characters.
|
|
121
|
+
* @sealed
|
|
122
|
+
* @alpha
|
|
123
|
+
*/
|
|
124
|
+
interface TextInsertOp {
|
|
125
|
+
/**
|
|
126
|
+
* Discriminator identifying this op as an insert.
|
|
127
|
+
*/
|
|
128
|
+
readonly type: "insert";
|
|
129
|
+
/**
|
|
130
|
+
* The newly inserted characters, concatenated into a single string.
|
|
131
|
+
*/
|
|
132
|
+
readonly text: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* A remove op in a character-level delta — a span of characters that has been deleted from the text.
|
|
136
|
+
* @sealed
|
|
137
|
+
* @alpha
|
|
138
|
+
*/
|
|
139
|
+
interface TextRemoveOp {
|
|
140
|
+
/**
|
|
141
|
+
* Discriminator identifying this op as a remove.
|
|
142
|
+
*/
|
|
143
|
+
readonly type: "remove";
|
|
144
|
+
/**
|
|
145
|
+
* The number of Unicode code points removed.
|
|
146
|
+
*/
|
|
147
|
+
readonly count: number;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* A single operation in a character-level delta describing an insert, remove, or retain of text.
|
|
151
|
+
* @alpha
|
|
152
|
+
*/
|
|
153
|
+
type TextOp = TextRetainOp | TextInsertOp | TextRemoveOp;
|
|
78
154
|
/**
|
|
79
155
|
* Statics for text nodes.
|
|
80
156
|
* @alpha
|
|
@@ -101,6 +177,7 @@ export declare namespace TextAsTree {
|
|
|
101
177
|
*
|
|
102
178
|
* @see {@link TextAsTree.Statics.fromString} for construction.
|
|
103
179
|
* @see {@link TextAsTree.(Tree:type)} for schema.
|
|
180
|
+
* @sealed
|
|
104
181
|
* @alpha
|
|
105
182
|
*/
|
|
106
183
|
interface Members {
|
|
@@ -145,6 +222,21 @@ export declare namespace TextAsTree {
|
|
|
145
222
|
* See {@link (TreeArrayNode:interface).removeRange} for more details on the behavior.
|
|
146
223
|
*/
|
|
147
224
|
removeRange(startIndex: number | undefined, endIndex: number | undefined): void;
|
|
225
|
+
/**
|
|
226
|
+
* Subscribe to shallow character-level changes on this text node — inserts and removes only.
|
|
227
|
+
* @param callback - Called after each change with a sequence of {@link TextAsTree.TextOp}s describing what changed,
|
|
228
|
+
* or `undefined` when a delta could not be computed (e.g. during a schema upgrade).
|
|
229
|
+
* @returns A cleanup function that unsubscribes the callback when called.
|
|
230
|
+
* @remarks
|
|
231
|
+
* Only fires on shallow changes — inserts and removes.
|
|
232
|
+
* It does not fire on deep changes such as formatting property updates on existing characters.
|
|
233
|
+
* For formatted text, use {@link @fluidframework/tree#FormattedTextAsTree.Members.onContentChanged} to also receive deep changes.
|
|
234
|
+
*
|
|
235
|
+
* All counts in the delivered ops are in Unicode code points, not UTF-16 code units.
|
|
236
|
+
* For characters outside the Basic Multilingual Plane (e.g. emoji), one code point
|
|
237
|
+
* corresponds to two UTF-16 code units — convert before using the counts as string indices.
|
|
238
|
+
*/
|
|
239
|
+
onCharactersChanged(callback: (ops: readonly TextOp[] | undefined) => void): () => void;
|
|
148
240
|
}
|
|
149
241
|
/**
|
|
150
242
|
* Schema for a {@link TextAsTree.(Tree:variable)} node.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textDomain.d.ts","sourceRoot":"","sources":["../../src/text/textDomain.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"textDomain.d.ts","sourceRoot":"","sources":["../../src/text/textDomain.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH,OAAO,KAAK,EACX,gBAAgB,EAChB,2BAA2B,EAC3B,QAAQ,EACR,QAAQ,EAER,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAsIxE;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAKpE;AAsBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,6BAA6B,CAC5C,KAAK,EAAE,SAAS,CAAC,gBAAgB,GAAG,2BAA2B,CAAC,EAAE,GAAG,SAAS,EAC9E,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EACnD,QAAQ,EAAE,CAAC,GAAG,EAAE,SAAS,UAAU,CAAC,MAAM,EAAE,GAAG,SAAS,KAAK,IAAI,GAC/D,IAAI,CAqCN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,yBAAiB,UAAU,CAAC;IAC3B;;;;OAIG;IACH,UAAiB,YAAY;QAC5B;;WAEG;QACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;QACxB;;WAEG;QACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB;;;;;;;WAOG;QACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;KACrC;IAED;;;;;;OAMG;IACH,UAAiB,YAAY;QAC5B;;WAEG;QACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;QACxB;;WAEG;QACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;KACtB;IAED;;;;OAIG;IACH,UAAiB,YAAY;QAC5B;;WAEG;QACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;QACxB;;WAEG;QACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;KACvB;IAED;;;OAGG;IACH,KAAY,MAAM,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC;IAEhE;;;OAGG;IACH,UAAiB,OAAO;QACvB;;;WAGG;QACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;KAChC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,UAAiB,OAAO;QACvB;;;;WAIG;QACH,UAAU,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE/B;;WAEG;QACH,cAAc,IAAI,MAAM,EAAE,CAAC;QAE3B;;;;;;WAMG;QACH,cAAc,IAAI,MAAM,CAAC;QAEzB;;WAEG;QACH,UAAU,IAAI,MAAM,CAAC;QAErB;;;;;;;;;;;;WAYG;QACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;QAE5D;;;WAGG;QACH,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;QAEhF;;;;;;;;;;;;;WAaG;QACH,mBAAmB,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;KACxF;IAED;;;;;OAKG;IACI,MAAM,IAAI,oKAAmD,CAAC;IAErE;;;;;OAKG;IACH,KAAY,IAAI,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC,8BAA8B,CAAC,CAAC;CACjF"}
|
package/dist/text/textDomain.js
CHANGED
|
@@ -4,15 +4,16 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.TextAsTree = exports.charactersFromString = void 0;
|
|
7
|
+
exports.TextAsTree = exports.processCharactersChangedDelta = exports.charactersFromString = void 0;
|
|
8
8
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
9
|
const alpha_1 = require("@fluidframework/type-factory/alpha");
|
|
10
10
|
const internal_2 = require("@fluidframework/type-factory/internal");
|
|
11
11
|
const index_js_1 = require("../core/index.js");
|
|
12
|
-
const index_js_2 = require("../
|
|
13
|
-
const
|
|
12
|
+
const index_js_2 = require("../shared-tree/index.js");
|
|
13
|
+
const index_js_3 = require("../simple-tree/index.js");
|
|
14
|
+
const sf = new index_js_3.SchemaFactoryAlpha("com.fluidframework.text");
|
|
14
15
|
class TextNode extends sf.object("Text", {
|
|
15
|
-
content:
|
|
16
|
+
content: index_js_3.SchemaFactory.required([() => StringArray], { key: index_js_1.EmptyKey }),
|
|
16
17
|
}) {
|
|
17
18
|
static [alpha_1.exposeMethodsSymbol](methods) {
|
|
18
19
|
methods.exposeMethod(TextNode, "insertAt", (0, alpha_1.buildFunc)({
|
|
@@ -40,7 +41,7 @@ class TextNode extends sf.object("Text", {
|
|
|
40
41
|
TextNode[alpha_1.exposeMethodsSymbol](methods);
|
|
41
42
|
}
|
|
42
43
|
insertAt(index, additionalCharacters) {
|
|
43
|
-
this.content.insertAt(index,
|
|
44
|
+
this.content.insertAt(index, index_js_3.TreeArrayNode.spread(charactersFromString(additionalCharacters)));
|
|
44
45
|
}
|
|
45
46
|
removeRange(index, end) {
|
|
46
47
|
this.content.removeRange(index, end);
|
|
@@ -74,6 +75,9 @@ class TextNode extends sf.object("Text", {
|
|
|
74
75
|
charactersCopy_reference() {
|
|
75
76
|
return [...this.content];
|
|
76
77
|
}
|
|
78
|
+
onCharactersChanged(callback) {
|
|
79
|
+
return index_js_2.TreeAlpha.on(this.content, "nodeChanged", ({ delta }) => processCharactersChangedDelta(delta, (i) => this.content[i], callback));
|
|
80
|
+
}
|
|
77
81
|
static fromString(value) {
|
|
78
82
|
// Constructing an ArrayNode from an iterator is supported, so creating an array from the iterable of characters seems like its not necessary here,
|
|
79
83
|
// but to reduce the risk of incorrect data interpretation, we actually ban this in the special case where the iterable is a string directly, which is the case here.
|
|
@@ -95,9 +99,9 @@ function charactersFromString(value) {
|
|
|
95
99
|
return value;
|
|
96
100
|
}
|
|
97
101
|
exports.charactersFromString = charactersFromString;
|
|
98
|
-
class StringArray extends sf.array("StringArray",
|
|
102
|
+
class StringArray extends sf.array("StringArray", index_js_3.SchemaFactory.string) {
|
|
99
103
|
withBorrowedSequenceCursor(f) {
|
|
100
|
-
const cursor = (0,
|
|
104
|
+
const cursor = (0, index_js_3.getInnerNode)(this).borrowCursor();
|
|
101
105
|
cursor.enterField(index_js_1.EmptyKey);
|
|
102
106
|
const result = f(cursor);
|
|
103
107
|
cursor.exitField();
|
|
@@ -110,6 +114,59 @@ class StringArray extends sf.array("StringArray", index_js_2.SchemaFactory.strin
|
|
|
110
114
|
return this.charactersCopy().join("");
|
|
111
115
|
}
|
|
112
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Processes an array-node delta into a {@link TextAsTree.TextOp}[] and calls `callback`.
|
|
119
|
+
* @remarks
|
|
120
|
+
* Shared by both the plain `onCharactersChanged` (from `nodeChanged`) and formatted `onContentChanged`
|
|
121
|
+
* (from `treeChanged`) implementations.
|
|
122
|
+
* @param delta - The raw array-node delta, or `undefined` when no delta is available.
|
|
123
|
+
* When retain ops carry `subtreeChanged` (i.e. delta comes from a `treeChanged` event), the emitted
|
|
124
|
+
* retain ops include an explicit `formattingChanged: boolean`. Otherwise `formattingChanged` is omitted.
|
|
125
|
+
* @param getCharacter - Returns the character string at the given array index in the **post-edit** tree.
|
|
126
|
+
* Only invoked for insert ops, where it must read the inserted character at the given index of the tree
|
|
127
|
+
* after the edit has been applied. Passing an accessor that reads pre-edit content will silently produce wrong text.
|
|
128
|
+
* Return `undefined` if the tree is out of sync with the delta; this triggers a full-reread fallback.
|
|
129
|
+
* @param callback - The user-supplied callback to invoke with the translated ops.
|
|
130
|
+
*/
|
|
131
|
+
function processCharactersChangedDelta(delta, getCharacter, callback) {
|
|
132
|
+
if (delta === undefined) {
|
|
133
|
+
callback(undefined);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
let readPosition = 0;
|
|
137
|
+
const ops = [];
|
|
138
|
+
for (const op of delta) {
|
|
139
|
+
if (op.type === "retain") {
|
|
140
|
+
// `subtreeChanged` is only present on retain ops from `treeChanged` deltas.
|
|
141
|
+
ops.push("subtreeChanged" in op
|
|
142
|
+
? { type: "retain", count: op.count, formattingChanged: op.subtreeChanged === true }
|
|
143
|
+
: { type: "retain", count: op.count });
|
|
144
|
+
readPosition += op.count;
|
|
145
|
+
}
|
|
146
|
+
else if (op.type === "insert") {
|
|
147
|
+
// Accumulate into an array and join at the end to keep this O(n) for large inserts
|
|
148
|
+
// (paste of long text) instead of O(n^2) from repeated string concatenation.
|
|
149
|
+
const characters = [];
|
|
150
|
+
for (let i = 0; i < op.count; i++) {
|
|
151
|
+
const character = getCharacter(readPosition);
|
|
152
|
+
if (character === undefined) {
|
|
153
|
+
// Tree is out of sync with the delta — fall back to full re-read.
|
|
154
|
+
callback(undefined);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
characters.push(character);
|
|
158
|
+
readPosition++;
|
|
159
|
+
}
|
|
160
|
+
ops.push({ type: "insert", text: characters.join("") });
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
// Construct explicit remove op so internal fields on the source op don't leak.
|
|
164
|
+
ops.push({ type: "remove", count: op.count });
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
callback(ops);
|
|
168
|
+
}
|
|
169
|
+
exports.processCharactersChangedDelta = processCharactersChangedDelta;
|
|
113
170
|
/**
|
|
114
171
|
* A collection of text related types, schema and utilities for working with text beyond the basic {@link SchemaStatics.string}.
|
|
115
172
|
* @privateRemarks
|
|
@@ -180,6 +237,6 @@ var TextAsTree;
|
|
|
180
237
|
* See {@link TextAsTree.Statics} for static APIs on this schema, including construction.
|
|
181
238
|
* @alpha
|
|
182
239
|
*/
|
|
183
|
-
TextAsTree.Tree = (0,
|
|
240
|
+
TextAsTree.Tree = (0, index_js_3.eraseSchemaDetails)()(TextNode);
|
|
184
241
|
})(TextAsTree || (exports.TextAsTree = TextAsTree = {}));
|
|
185
242
|
//# sourceMappingURL=textDomain.js.map
|