@fluidframework/tree 2.3.1 → 2.4.0-297027
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/api-report/tree.alpha.api.md +77 -38
- package/api-report/tree.beta.api.md +50 -30
- package/api-report/tree.legacy.alpha.api.md +50 -30
- package/api-report/tree.legacy.public.api.md +50 -30
- package/api-report/tree.public.api.md +50 -30
- package/dist/alpha.d.ts +7 -0
- package/dist/beta.d.ts +4 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +2 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +1 -0
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +8 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +7 -0
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +9 -0
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +1 -2
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +2 -2
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +13 -2
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexTypes.d.ts +1 -1
- package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
- package/dist/feature-libraries/editableTreeBinder.d.ts +3 -230
- package/dist/feature-libraries/editableTreeBinder.d.ts.map +1 -1
- package/dist/feature-libraries/editableTreeBinder.js +1 -539
- package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.d.ts +7 -14
- package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js +3 -3
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -16
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +2 -3
- package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyEntity.js +1 -2
- package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts +10 -15
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +18 -20
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts +4 -5
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.js +13 -23
- package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/dist/feature-libraries/flex-tree/utilities.js +1 -1
- package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +4 -7
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +5 -31
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +7 -0
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +61 -17
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +3 -0
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV1.d.ts +18 -18
- package/dist/feature-libraries/sequence-field/formatV2.d.ts +18 -18
- package/dist/feature-libraries/sequence-field/formatV3.d.ts +27 -27
- package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +1 -4
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/feature-libraries/typed-schema/flexList.d.ts +1 -46
- package/dist/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
- package/dist/feature-libraries/typed-schema/flexList.js +1 -13
- package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
- package/dist/feature-libraries/typed-schema/index.d.ts +2 -4
- package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/typed-schema/index.js +1 -19
- package/dist/feature-libraries/typed-schema/index.js.map +1 -1
- package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -212
- package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
- package/dist/feature-libraries/typed-schema/typedTreeSchema.js +0 -266
- package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/internalTypes.d.ts +1 -1
- package/dist/internalTypes.d.ts.map +1 -1
- package/dist/internalTypes.js.map +1 -1
- package/dist/legacy.d.ts +4 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +4 -0
- package/dist/shared-tree/checkoutFlexTreeView.d.ts +3 -3
- package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
- package/dist/shared-tree/checkoutFlexTreeView.js +1 -1
- package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +3 -3
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +2 -3
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts +1 -40
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +2 -11
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +9 -7
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +19 -8
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +19 -2
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +10 -2
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +71 -41
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +116 -84
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +8 -11
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +12 -15
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts +1 -1
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js +11 -13
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.d.ts +3 -3
- package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.js +1 -1
- package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/getSimpleSchema.d.ts +2 -2
- package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +3 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/jsonSchema.d.ts +13 -14
- package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/jsonSchema.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +14 -8
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +21 -2
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +3 -3
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/simpleSchema.d.ts +18 -10
- package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchema.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +30 -17
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +16 -6
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js +4 -4
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +8 -6
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +6 -10
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/{lib/feature-libraries/typed-schema → dist/simple-tree/api}/view.d.ts +4 -11
- package/dist/simple-tree/api/view.d.ts.map +1 -0
- package/dist/{feature-libraries/typed-schema → simple-tree/api}/view.js +9 -9
- package/dist/simple-tree/api/view.js.map +1 -0
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +2 -2
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +11 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts +147 -14
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js +32 -20
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/context.d.ts +55 -0
- package/dist/simple-tree/core/context.d.ts.map +1 -0
- package/dist/simple-tree/core/context.js +60 -0
- package/dist/simple-tree/core/context.js.map +1 -0
- package/dist/simple-tree/core/getOrCreateNode.d.ts +15 -0
- package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -0
- package/dist/simple-tree/core/getOrCreateNode.js +36 -0
- package/dist/simple-tree/core/getOrCreateNode.js.map +1 -0
- package/dist/simple-tree/core/index.d.ts +7 -3
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +16 -7
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/schemaCaching.d.ts +5 -13
- package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -1
- package/dist/simple-tree/core/schemaCaching.js +16 -45
- package/dist/simple-tree/core/schemaCaching.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +29 -7
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +94 -58
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +24 -0
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/core/types.d.ts +0 -5
- package/dist/simple-tree/core/types.d.ts.map +1 -1
- package/dist/simple-tree/core/types.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +139 -0
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -0
- package/dist/{feature-libraries/flex-map-tree/mapTreeNode.js → simple-tree/core/unhydratedFlexTree.js} +112 -132
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -0
- package/dist/simple-tree/{walkSchema.d.ts → core/walkSchema.d.ts} +8 -4
- package/dist/simple-tree/core/walkSchema.d.ts.map +1 -0
- package/dist/simple-tree/core/walkSchema.js +34 -0
- package/dist/simple-tree/core/walkSchema.js.map +1 -0
- package/dist/simple-tree/createContext.d.ts +11 -0
- package/dist/simple-tree/createContext.d.ts.map +1 -0
- package/dist/simple-tree/createContext.js +25 -0
- package/dist/simple-tree/createContext.js.map +1 -0
- package/dist/simple-tree/index.d.ts +4 -5
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +7 -7
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +1 -0
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +1 -2
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/mapNode.d.ts +4 -4
- package/dist/simple-tree/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.js +9 -5
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +8 -8
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +33 -14
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/objectNodeTypes.d.ts +7 -3
- package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/proxies.d.ts +1 -2
- package/dist/simple-tree/proxies.d.ts.map +1 -1
- package/dist/simple-tree/proxies.js +6 -22
- package/dist/simple-tree/proxies.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +44 -4
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +10 -0
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/toFlexSchema.d.ts +6 -36
- package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
- package/dist/simple-tree/toFlexSchema.js +58 -142
- package/dist/simple-tree/toFlexSchema.js.map +1 -1
- package/dist/simple-tree/toMapTree.d.ts.map +1 -1
- package/dist/simple-tree/toMapTree.js +2 -2
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.d.ts +13 -5
- package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +19 -10
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/simple-tree/typesUnsafe.d.ts +4 -4
- package/dist/simple-tree/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/walkFieldSchema.d.ts +11 -0
- package/dist/simple-tree/walkFieldSchema.d.ts.map +1 -0
- package/dist/simple-tree/walkFieldSchema.js +17 -0
- package/dist/simple-tree/walkFieldSchema.js.map +1 -0
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/typeUtils.d.ts +14 -45
- package/dist/util/typeUtils.d.ts.map +1 -1
- package/dist/util/typeUtils.js.map +1 -1
- package/lib/alpha.d.ts +7 -0
- package/lib/beta.d.ts +4 -0
- 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/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +1 -0
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +6 -0
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +7 -0
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +9 -0
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts +1 -2
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +2 -2
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +13 -2
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexTypes.d.ts +1 -1
- package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
- package/lib/feature-libraries/editableTreeBinder.d.ts +3 -230
- package/lib/feature-libraries/editableTreeBinder.d.ts.map +1 -1
- package/lib/feature-libraries/editableTreeBinder.js +1 -532
- package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.d.ts +7 -14
- package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js +3 -3
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -16
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +2 -3
- package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyEntity.js +1 -2
- package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts +10 -15
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +18 -20
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts +4 -5
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js +13 -23
- package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/lib/feature-libraries/flex-tree/utilities.js +1 -1
- package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +4 -7
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +4 -6
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +7 -0
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +62 -18
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +3 -0
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV1.d.ts +18 -18
- package/lib/feature-libraries/sequence-field/formatV2.d.ts +18 -18
- package/lib/feature-libraries/sequence-field/formatV3.d.ts +27 -27
- package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +2 -5
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/feature-libraries/typed-schema/flexList.d.ts +1 -46
- package/lib/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
- package/lib/feature-libraries/typed-schema/flexList.js +0 -11
- package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
- package/lib/feature-libraries/typed-schema/index.d.ts +2 -4
- package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/typed-schema/index.js +0 -3
- package/lib/feature-libraries/typed-schema/index.js.map +1 -1
- package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -212
- package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
- package/lib/feature-libraries/typed-schema/typedTreeSchema.js +1 -253
- package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/internalTypes.d.ts +1 -1
- package/lib/internalTypes.d.ts.map +1 -1
- package/lib/internalTypes.js.map +1 -1
- package/lib/legacy.d.ts +4 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +4 -0
- package/lib/shared-tree/checkoutFlexTreeView.d.ts +3 -3
- package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
- package/lib/shared-tree/checkoutFlexTreeView.js +1 -1
- package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +3 -3
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -2
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts +1 -40
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +1 -9
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +9 -7
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +22 -11
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +19 -2
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +10 -3
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +71 -41
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +118 -86
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +8 -11
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +12 -15
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts +1 -1
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js +14 -16
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/getJsonSchema.d.ts +3 -3
- package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/getJsonSchema.js +1 -1
- package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/getSimpleSchema.d.ts +2 -2
- package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -0
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/jsonSchema.d.ts +13 -14
- package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/jsonSchema.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +14 -8
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +21 -2
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +3 -3
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/simpleSchema.d.ts +18 -10
- package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchema.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +31 -18
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +16 -6
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js +4 -4
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +10 -8
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +6 -10
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/{dist/feature-libraries/typed-schema → lib/simple-tree/api}/view.d.ts +4 -11
- package/lib/simple-tree/api/view.d.ts.map +1 -0
- package/lib/{feature-libraries/typed-schema → simple-tree/api}/view.js +9 -9
- package/lib/simple-tree/api/view.js.map +1 -0
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +2 -2
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +11 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/lib/simple-tree/arrayNode.d.ts +147 -14
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js +37 -25
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/context.d.ts +55 -0
- package/lib/simple-tree/core/context.d.ts.map +1 -0
- package/lib/simple-tree/core/context.js +55 -0
- package/lib/simple-tree/core/context.js.map +1 -0
- package/lib/simple-tree/core/getOrCreateNode.d.ts +15 -0
- package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -0
- package/lib/simple-tree/core/getOrCreateNode.js +32 -0
- package/lib/simple-tree/core/getOrCreateNode.js.map +1 -0
- package/lib/simple-tree/core/index.d.ts +7 -3
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +6 -2
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/schemaCaching.d.ts +5 -13
- package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -1
- package/lib/simple-tree/core/schemaCaching.js +13 -39
- package/lib/simple-tree/core/schemaCaching.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts +29 -7
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +89 -54
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +24 -0
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/core/types.d.ts +0 -5
- package/lib/simple-tree/core/types.d.ts.map +1 -1
- package/lib/simple-tree/core/types.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +139 -0
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -0
- package/lib/{feature-libraries/flex-map-tree/mapTreeNode.js → simple-tree/core/unhydratedFlexTree.js} +110 -128
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -0
- package/lib/simple-tree/{walkSchema.d.ts → core/walkSchema.d.ts} +8 -4
- package/lib/simple-tree/core/walkSchema.d.ts.map +1 -0
- package/lib/simple-tree/core/walkSchema.js +29 -0
- package/lib/simple-tree/core/walkSchema.js.map +1 -0
- package/lib/simple-tree/createContext.d.ts +11 -0
- package/lib/simple-tree/createContext.d.ts.map +1 -0
- package/lib/simple-tree/createContext.js +21 -0
- package/lib/simple-tree/createContext.js.map +1 -0
- package/lib/simple-tree/index.d.ts +4 -5
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +3 -4
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +1 -0
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +3 -4
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/mapNode.d.ts +4 -4
- package/lib/simple-tree/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.js +12 -8
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts +8 -8
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +36 -17
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/objectNodeTypes.d.ts +7 -3
- package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/objectNodeTypes.js.map +1 -1
- package/lib/simple-tree/proxies.d.ts +1 -2
- package/lib/simple-tree/proxies.d.ts.map +1 -1
- package/lib/simple-tree/proxies.js +7 -22
- package/lib/simple-tree/proxies.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +44 -4
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +10 -0
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/toFlexSchema.d.ts +6 -36
- package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
- package/lib/simple-tree/toFlexSchema.js +61 -142
- package/lib/simple-tree/toFlexSchema.js.map +1 -1
- package/lib/simple-tree/toMapTree.d.ts.map +1 -1
- package/lib/simple-tree/toMapTree.js +4 -4
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.d.ts +13 -5
- package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +21 -12
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/simple-tree/typesUnsafe.d.ts +4 -4
- package/lib/simple-tree/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/walkFieldSchema.d.ts +11 -0
- package/lib/simple-tree/walkFieldSchema.d.ts.map +1 -0
- package/lib/simple-tree/walkFieldSchema.js +13 -0
- package/lib/simple-tree/walkFieldSchema.js.map +1 -0
- package/lib/util/index.d.ts +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/typeUtils.d.ts +14 -45
- package/lib/util/typeUtils.d.ts.map +1 -1
- package/lib/util/typeUtils.js.map +1 -1
- package/package.json +41 -22
- package/src/core/index.ts +1 -0
- package/src/core/rebase/index.ts +1 -0
- package/src/core/rebase/types.ts +11 -0
- package/src/core/schema-stored/schema.ts +18 -0
- package/src/core/tree/anchorSet.ts +3 -4
- package/src/core/tree/detachedFieldIndex.ts +14 -3
- package/src/core/tree/detachedFieldIndexTypes.ts +1 -1
- package/src/feature-libraries/editableTreeBinder.ts +2 -915
- package/src/feature-libraries/flex-tree/context.ts +7 -20
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +2 -18
- package/src/feature-libraries/flex-tree/lazyEntity.ts +1 -4
- package/src/feature-libraries/flex-tree/lazyField.ts +22 -78
- package/src/feature-libraries/flex-tree/lazyNode.ts +24 -39
- package/src/feature-libraries/flex-tree/utilities.ts +1 -1
- package/src/feature-libraries/index.ts +3 -71
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +97 -10
- package/src/feature-libraries/sequence-field/compose.ts +3 -0
- package/src/feature-libraries/sequence-field/utils.ts +2 -4
- package/src/feature-libraries/typed-schema/flexList.ts +3 -84
- package/src/feature-libraries/typed-schema/index.ts +1 -33
- package/src/feature-libraries/typed-schema/typedTreeSchema.ts +0 -458
- package/src/index.ts +7 -0
- package/src/internalTypes.ts +0 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/checkoutFlexTreeView.ts +3 -3
- package/src/shared-tree/index.ts +4 -8
- package/src/shared-tree/schematizeTree.ts +2 -56
- package/src/shared-tree/schematizingTreeView.ts +38 -15
- package/src/shared-tree/sharedTree.ts +36 -8
- package/src/shared-tree/treeCheckout.ts +225 -128
- package/src/shared-tree-core/branch.ts +15 -26
- package/src/simple-tree/api/create.ts +18 -20
- package/src/simple-tree/api/getJsonSchema.ts +3 -3
- package/src/simple-tree/api/getSimpleSchema.ts +2 -2
- package/src/simple-tree/api/index.ts +2 -0
- package/src/simple-tree/api/jsonSchema.ts +19 -17
- package/src/simple-tree/api/schemaFactory.ts +53 -18
- package/src/simple-tree/api/schemaFactoryRecursive.ts +3 -6
- package/src/simple-tree/api/simpleSchema.ts +20 -10
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +40 -19
- package/src/simple-tree/api/tree.ts +20 -9
- package/src/simple-tree/api/treeNodeApi.ts +12 -10
- package/src/simple-tree/api/verboseTree.ts +6 -12
- package/src/{feature-libraries/typed-schema → simple-tree/api}/view.ts +9 -22
- package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +18 -4
- package/src/simple-tree/arrayNode.ts +202 -53
- package/src/simple-tree/core/context.ts +78 -0
- package/src/simple-tree/core/getOrCreateNode.ts +38 -0
- package/src/simple-tree/core/index.ts +11 -7
- package/src/simple-tree/core/schemaCaching.ts +13 -50
- package/src/simple-tree/core/treeNodeKernel.ts +117 -78
- package/src/simple-tree/core/treeNodeSchema.ts +35 -1
- package/src/simple-tree/core/types.ts +0 -5
- package/src/{feature-libraries/flex-map-tree/mapTreeNode.ts → simple-tree/core/unhydratedFlexTree.ts} +167 -210
- package/src/simple-tree/{walkSchema.ts → core/walkSchema.ts} +12 -34
- package/src/simple-tree/createContext.ts +24 -0
- package/src/simple-tree/index.ts +6 -2
- package/src/simple-tree/leafNodeSchema.ts +3 -9
- package/src/simple-tree/mapNode.ts +20 -17
- package/src/simple-tree/objectNode.ts +63 -38
- package/src/simple-tree/objectNodeTypes.ts +8 -5
- package/src/simple-tree/proxies.ts +8 -26
- package/src/simple-tree/schemaTypes.ts +55 -5
- package/src/simple-tree/toFlexSchema.ts +71 -204
- package/src/simple-tree/toMapTree.ts +5 -5
- package/src/simple-tree/treeNodeValid.ts +28 -22
- package/src/simple-tree/typesUnsafe.ts +4 -4
- package/src/simple-tree/walkFieldSchema.ts +19 -0
- package/src/util/index.ts +1 -5
- package/src/util/typeUtils.ts +14 -56
- package/dist/feature-libraries/fieldGenerator.d.ts +0 -43
- package/dist/feature-libraries/fieldGenerator.d.ts.map +0 -1
- package/dist/feature-libraries/fieldGenerator.js +0 -13
- package/dist/feature-libraries/fieldGenerator.js.map +0 -1
- package/dist/feature-libraries/flex-map-tree/index.d.ts +0 -6
- package/dist/feature-libraries/flex-map-tree/index.d.ts.map +0 -1
- package/dist/feature-libraries/flex-map-tree/index.js +0 -14
- package/dist/feature-libraries/flex-map-tree/index.js.map +0 -1
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +0 -157
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +0 -1
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +0 -1
- package/dist/feature-libraries/storedToViewSchema.d.ts +0 -17
- package/dist/feature-libraries/storedToViewSchema.d.ts.map +0 -1
- package/dist/feature-libraries/storedToViewSchema.js +0 -67
- package/dist/feature-libraries/storedToViewSchema.js.map +0 -1
- package/dist/feature-libraries/typed-schema/schemaCollection.d.ts +0 -58
- package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +0 -1
- package/dist/feature-libraries/typed-schema/schemaCollection.js +0 -160
- package/dist/feature-libraries/typed-schema/schemaCollection.js.map +0 -1
- package/dist/feature-libraries/typed-schema/typeUtils.d.ts +0 -15
- package/dist/feature-libraries/typed-schema/typeUtils.d.ts.map +0 -1
- package/dist/feature-libraries/typed-schema/typeUtils.js +0 -14
- package/dist/feature-libraries/typed-schema/typeUtils.js.map +0 -1
- package/dist/feature-libraries/typed-schema/view.d.ts.map +0 -1
- package/dist/feature-libraries/typed-schema/view.js.map +0 -1
- package/dist/simple-tree/getSimpleFieldSchema.d.ts +0 -14
- package/dist/simple-tree/getSimpleFieldSchema.d.ts.map +0 -1
- package/dist/simple-tree/getSimpleFieldSchema.js +0 -29
- package/dist/simple-tree/getSimpleFieldSchema.js.map +0 -1
- package/dist/simple-tree/walkSchema.d.ts.map +0 -1
- package/dist/simple-tree/walkSchema.js +0 -49
- package/dist/simple-tree/walkSchema.js.map +0 -1
- package/lib/feature-libraries/fieldGenerator.d.ts +0 -43
- package/lib/feature-libraries/fieldGenerator.d.ts.map +0 -1
- package/lib/feature-libraries/fieldGenerator.js +0 -12
- package/lib/feature-libraries/fieldGenerator.js.map +0 -1
- package/lib/feature-libraries/flex-map-tree/index.d.ts +0 -6
- package/lib/feature-libraries/flex-map-tree/index.d.ts.map +0 -1
- package/lib/feature-libraries/flex-map-tree/index.js +0 -6
- package/lib/feature-libraries/flex-map-tree/index.js.map +0 -1
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +0 -157
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +0 -1
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +0 -1
- package/lib/feature-libraries/storedToViewSchema.d.ts +0 -17
- package/lib/feature-libraries/storedToViewSchema.d.ts.map +0 -1
- package/lib/feature-libraries/storedToViewSchema.js +0 -62
- package/lib/feature-libraries/storedToViewSchema.js.map +0 -1
- package/lib/feature-libraries/typed-schema/schemaCollection.d.ts +0 -58
- package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +0 -1
- package/lib/feature-libraries/typed-schema/schemaCollection.js +0 -153
- package/lib/feature-libraries/typed-schema/schemaCollection.js.map +0 -1
- package/lib/feature-libraries/typed-schema/typeUtils.d.ts +0 -15
- package/lib/feature-libraries/typed-schema/typeUtils.d.ts.map +0 -1
- package/lib/feature-libraries/typed-schema/typeUtils.js +0 -10
- package/lib/feature-libraries/typed-schema/typeUtils.js.map +0 -1
- package/lib/feature-libraries/typed-schema/view.d.ts.map +0 -1
- package/lib/feature-libraries/typed-schema/view.js.map +0 -1
- package/lib/simple-tree/getSimpleFieldSchema.d.ts +0 -14
- package/lib/simple-tree/getSimpleFieldSchema.d.ts.map +0 -1
- package/lib/simple-tree/getSimpleFieldSchema.js +0 -25
- package/lib/simple-tree/getSimpleFieldSchema.js.map +0 -1
- package/lib/simple-tree/walkSchema.d.ts.map +0 -1
- package/lib/simple-tree/walkSchema.js +0 -43
- package/lib/simple-tree/walkSchema.js.map +0 -1
- package/src/feature-libraries/fieldGenerator.ts +0 -47
- package/src/feature-libraries/flex-map-tree/index.ts +0 -14
- package/src/feature-libraries/storedToViewSchema.ts +0 -100
- package/src/feature-libraries/typed-schema/schemaCollection.ts +0 -254
- package/src/feature-libraries/typed-schema/typeUtils.ts +0 -29
- package/src/simple-tree/getSimpleFieldSchema.ts +0 -36
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { type
|
|
5
|
+
import { type ForestEvents, type SchemaPolicy, type TreeStoredSchema } from "../../core/index.js";
|
|
6
6
|
import type { Listenable } from "../../events/index.js";
|
|
7
7
|
import { type IDisposable, disposeSymbol } from "../../util/index.js";
|
|
8
|
-
import type { FieldGenerator } from "../fieldGenerator.js";
|
|
9
8
|
import type { NodeKeyManager } from "../node-key/index.js";
|
|
10
|
-
import type { FlexTreeSchema } from "../typed-schema/index.js";
|
|
11
9
|
import type { FlexTreeField } from "./flexTreeTypes.js";
|
|
12
10
|
import { type LazyEntity } from "./lazyEntity.js";
|
|
13
11
|
import type { ITreeCheckout } from "../../shared-tree/index.js";
|
|
@@ -19,12 +17,11 @@ export interface FlexTreeContext {
|
|
|
19
17
|
* Schema used within this context.
|
|
20
18
|
* All data must conform to these schema.
|
|
21
19
|
*/
|
|
22
|
-
readonly
|
|
20
|
+
readonly schema: TreeStoredSchema;
|
|
23
21
|
/**
|
|
24
|
-
*
|
|
25
|
-
* All data must conform to these schema.
|
|
22
|
+
* SchemaPolicy used within this context.
|
|
26
23
|
*/
|
|
27
|
-
readonly
|
|
24
|
+
readonly schemaPolicy: SchemaPolicy;
|
|
28
25
|
/**
|
|
29
26
|
* If true, this context is the canonical context instance for a given view,
|
|
30
27
|
* and its schema include all schema from the document.
|
|
@@ -59,7 +56,7 @@ export declare const ContextSlot: import("../../core/index.js").AnchorSlot<Conte
|
|
|
59
56
|
* @remarks An editor is required to edit the FlexTree.
|
|
60
57
|
*/
|
|
61
58
|
export declare class Context implements FlexTreeHydratedContext, IDisposable {
|
|
62
|
-
readonly
|
|
59
|
+
readonly schemaPolicy: SchemaPolicy;
|
|
63
60
|
readonly checkout: ITreeCheckout;
|
|
64
61
|
readonly nodeKeyManager: NodeKeyManager;
|
|
65
62
|
readonly withCursors: Set<LazyEntity>;
|
|
@@ -71,7 +68,7 @@ export declare class Context implements FlexTreeHydratedContext, IDisposable {
|
|
|
71
68
|
* @param checkout - The checkout.
|
|
72
69
|
* @param nodeKeyManager - An object which handles node key generation and conversion
|
|
73
70
|
*/
|
|
74
|
-
constructor(
|
|
71
|
+
constructor(schemaPolicy: SchemaPolicy, checkout: ITreeCheckout, nodeKeyManager: NodeKeyManager);
|
|
75
72
|
isHydrated(): this is FlexTreeHydratedContext;
|
|
76
73
|
get schema(): TreeStoredSchema;
|
|
77
74
|
/**
|
|
@@ -89,10 +86,6 @@ export declare class Context implements FlexTreeHydratedContext, IDisposable {
|
|
|
89
86
|
clear(): void;
|
|
90
87
|
get root(): FlexTreeField;
|
|
91
88
|
on<K extends keyof ForestEvents>(eventName: K, listener: ForestEvents[K]): () => void;
|
|
92
|
-
/**
|
|
93
|
-
* FieldSource used to get a FieldGenerator to populate required fields during procedural contextual data generation.
|
|
94
|
-
*/
|
|
95
|
-
fieldSource?(key: FieldKey, schema: TreeFieldStoredSchema): undefined | FieldGenerator;
|
|
96
89
|
}
|
|
97
90
|
/**
|
|
98
91
|
* A simple API for a Forest to interact with the tree.
|
|
@@ -103,5 +96,5 @@ export declare class Context implements FlexTreeHydratedContext, IDisposable {
|
|
|
103
96
|
* @returns {@link FlexTreeContext} which is used to manage the cursors and anchors within the FlexTrees:
|
|
104
97
|
* This is necessary for supporting using this tree across edits to the forest, and not leaking memory.
|
|
105
98
|
*/
|
|
106
|
-
export declare function getTreeContext(schema:
|
|
99
|
+
export declare function getTreeContext(schema: SchemaPolicy, checkout: ITreeCheckout, nodeKeyManager: NodeKeyManager): Context;
|
|
107
100
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EAGrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,KAAK,UAAU,EAAwB,MAAM,iBAAiB,CAAC;AAExE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAEpC;;;;;OAKG;IACH,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C5B,OAAO,CAET"}
|
|
@@ -26,8 +26,8 @@ class Context {
|
|
|
26
26
|
* @param checkout - The checkout.
|
|
27
27
|
* @param nodeKeyManager - An object which handles node key generation and conversion
|
|
28
28
|
*/
|
|
29
|
-
constructor(
|
|
30
|
-
this.
|
|
29
|
+
constructor(schemaPolicy, checkout, nodeKeyManager) {
|
|
30
|
+
this.schemaPolicy = schemaPolicy;
|
|
31
31
|
this.checkout = checkout;
|
|
32
32
|
this.nodeKeyManager = nodeKeyManager;
|
|
33
33
|
this.withCursors = new Set();
|
|
@@ -86,7 +86,7 @@ class Context {
|
|
|
86
86
|
(0, internal_1.assert)(this.disposed === false, 0x804 /* use after dispose */);
|
|
87
87
|
const cursor = this.checkout.forest.allocateCursor("root");
|
|
88
88
|
(0, index_js_1.moveToDetachedField)(this.checkout.forest, cursor);
|
|
89
|
-
const field = (0, lazyField_js_1.makeField)(this, this.
|
|
89
|
+
const field = (0, lazyField_js_1.makeField)(this, this.schema.rootFieldSchema.kind, cursor);
|
|
90
90
|
cursor.free();
|
|
91
91
|
return field;
|
|
92
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,kDAM6B;AAE7B,kDAAsE;AAItE,mDAAwE;AACxE,iDAA2C;AA6C3C;;;GAGG;AACU,QAAA,WAAW,GAAG,IAAA,qBAAU,GAAW,CAAC;AAEjD;;;;GAIG;AACH,MAAa,OAAO;IAOnB;;;;OAIG;IACH,YACiB,YAA0B,EAC1B,QAAuB,EACvB,cAA8B;QAF9B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,aAAQ,GAAR,QAAQ,CAAe;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CAAC;IACd,CAAC;IAEM,EAAE,CACR,SAAY,EACZ,QAAyB;QAEzB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACrD,CAAC;CACD;AA5FD,0BA4FC;AAED;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAC7B,MAAoB,EACpB,QAAuB,EACvB,cAA8B;IAE9B,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AACtD,CAAC;AAND,wCAMC","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 {\n\ttype ForestEvents,\n\ttype SchemaPolicy,\n\ttype TreeStoredSchema,\n\tanchorSlot,\n\tmoveToDetachedField,\n} from \"../../core/index.js\";\nimport type { Listenable } from \"../../events/index.js\";\nimport { type IDisposable, disposeSymbol } from \"../../util/index.js\";\nimport type { NodeKeyManager } from \"../node-key/index.js\";\n\nimport type { FlexTreeField } from \"./flexTreeTypes.js\";\nimport { type LazyEntity, prepareForEditSymbol } from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\nimport type { ITreeCheckout } from \"../../shared-tree/index.js\";\n\n/**\n * Context for FlexTrees.\n */\nexport interface FlexTreeContext {\n\t/**\n\t * Schema used within this context.\n\t * All data must conform to these schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\n\t/**\n\t * SchemaPolicy used within this context.\n\t */\n\treadonly schemaPolicy: SchemaPolicy;\n\n\t/**\n\t * If true, this context is the canonical context instance for a given view,\n\t * and its schema include all schema from the document.\n\t *\n\t * If false, this context was created for use in a unhydrated tree, and the full document schema is unknown.\n\t */\n\tisHydrated(): this is FlexTreeHydratedContext;\n}\n\n/**\n * A common context of a \"forest\" of FlexTrees.\n * It handles group operations like transforming cursors into anchors for edits.\n */\nexport interface FlexTreeHydratedContext extends FlexTreeContext, Listenable<ForestEvents> {\n\t/**\n\t * Gets the root field of the tree.\n\t */\n\tget root(): FlexTreeField;\n\n\treadonly nodeKeyManager: NodeKeyManager;\n\n\t/**\n\t * The checkout object associated with this context.\n\t */\n\treadonly checkout: ITreeCheckout;\n}\n\n/**\n * Creating multiple flex tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.\n * This slot is used to detect if one already exists and error if creating a second.\n */\nexport const ContextSlot = anchorSlot<Context>();\n\n/**\n * Implementation of `FlexTreeContext`.\n *\n * @remarks An editor is required to edit the FlexTree.\n */\nexport class Context implements FlexTreeHydratedContext, IDisposable {\n\tpublic readonly withCursors: Set<LazyEntity> = new Set();\n\tpublic readonly withAnchors: Set<LazyEntity> = new Set();\n\n\tprivate readonly eventUnregister: (() => void)[];\n\tprivate disposed = false;\n\n\t/**\n\t * @param flexSchema - Schema to use when working with the tree.\n\t * @param checkout - The checkout.\n\t * @param nodeKeyManager - An object which handles node key generation and conversion\n\t */\n\tpublic constructor(\n\t\tpublic readonly schemaPolicy: SchemaPolicy,\n\t\tpublic readonly checkout: ITreeCheckout,\n\t\tpublic readonly nodeKeyManager: NodeKeyManager,\n\t) {\n\t\tthis.eventUnregister = [\n\t\t\tthis.checkout.forest.on(\"beforeChange\", () => {\n\t\t\t\tthis.prepareForEdit();\n\t\t\t}),\n\t\t];\n\n\t\tassert(\n\t\t\t!this.checkout.forest.anchors.slots.has(ContextSlot),\n\t\t\t0x92b /* Cannot create second flex-tree from checkout */,\n\t\t);\n\t\tthis.checkout.forest.anchors.slots.set(ContextSlot, this);\n\t}\n\n\tpublic isHydrated(): this is FlexTreeHydratedContext {\n\t\treturn true;\n\t}\n\n\tpublic get schema(): TreeStoredSchema {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\t/**\n\t * Called before editing.\n\t * Clears all cursors so editing can proceed.\n\t */\n\tprivate prepareForEdit(): void {\n\t\tassert(this.disposed === false, 0x802 /* use after dispose */);\n\t\tfor (const target of this.withCursors) {\n\t\t\ttarget[prepareForEditSymbol]();\n\t\t}\n\t\tassert(this.withCursors.size === 0, 0x773 /* prepareForEdit should remove all cursors */);\n\t}\n\n\tpublic [disposeSymbol](): void {\n\t\tassert(this.disposed === false, 0x803 /* double dispose */);\n\t\tthis.disposed = true;\n\t\tthis.clear();\n\t\tfor (const unregister of this.eventUnregister) {\n\t\t\tunregister();\n\t\t}\n\t\tthis.eventUnregister.length = 0;\n\n\t\tconst deleted = this.checkout.forest.anchors.slots.delete(ContextSlot);\n\t\tassert(deleted, 0x8c4 /* unexpected dispose */);\n\t}\n\n\t/**\n\t * Release any cursors and anchors held by tree entities created in this context.\n\t * Ensures the cashed references to those entities on the Anchors are also cleared.\n\t * The tree entities are invalid to use after this, but the context may still be used\n\t * to create new trees starting from the root.\n\t */\n\tpublic clear(): void {\n\t\tfor (const target of this.withAnchors) {\n\t\t\ttarget[disposeSymbol]();\n\t\t}\n\t\tassert(this.withCursors.size === 0, 0x774 /* free should remove all cursors */);\n\t\tassert(this.withAnchors.size === 0, 0x775 /* free should remove all anchors */);\n\t}\n\n\tpublic get root(): FlexTreeField {\n\t\tassert(this.disposed === false, 0x804 /* use after dispose */);\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"root\");\n\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\tconst field = makeField(this, this.schema.rootFieldSchema.kind, cursor);\n\t\tcursor.free();\n\t\treturn field;\n\t}\n\n\tpublic on<K extends keyof ForestEvents>(\n\t\teventName: K,\n\t\tlistener: ForestEvents[K],\n\t): () => void {\n\t\treturn this.checkout.forest.on(eventName, listener);\n\t}\n}\n\n/**\n * A simple API for a Forest to interact with the tree.\n *\n * @param forest - the Forest\n * @param editor - an editor that makes changes to the forest.\n * @param nodeKeyManager - an object which handles node key generation and conversion.\n * @returns {@link FlexTreeContext} which is used to manage the cursors and anchors within the FlexTrees:\n * This is necessary for supporting using this tree across edits to the forest, and not leaking memory.\n */\nexport function getTreeContext(\n\tschema: SchemaPolicy,\n\tcheckout: ITreeCheckout,\n\tnodeKeyManager: NodeKeyManager,\n): Context {\n\treturn new Context(schema, checkout, nodeKeyManager);\n}\n"]}
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { type AnchorNode, type ExclusiveMapTree, type FieldKey, type
|
|
5
|
+
import { type AnchorNode, type ExclusiveMapTree, type FieldKey, type FieldKindIdentifier, type FieldUpPath, type TreeNodeSchemaIdentifier, type TreeValue } from "../../core/index.js";
|
|
6
6
|
import type { FieldKinds, SequenceFieldEditBuilder, ValueFieldEditBuilder, OptionalFieldEditBuilder } from "../default-schema/index.js";
|
|
7
7
|
import type { FlexFieldKind } from "../modular-schema/index.js";
|
|
8
|
-
import type { FlexTreeNodeSchema } from "../typed-schema/index.js";
|
|
9
8
|
import type { FlexTreeContext } from "./context.js";
|
|
10
9
|
/**
|
|
11
10
|
* An anchor slot which records the {@link FlexTreeNode} associated with that anchor, if there is one.
|
|
@@ -93,11 +92,7 @@ export declare enum TreeStatus {
|
|
|
93
92
|
* the same {@link FlexTreeNode} instance will be used in the new location.
|
|
94
93
|
* Similarly, edits applied to a node's sub-tree concurrently with the move of the node will still be applied to its subtree in its new location.
|
|
95
94
|
*
|
|
96
|
-
*
|
|
97
95
|
* @remarks
|
|
98
|
-
* Down-casting (via {@link FlexTreeNode#is}) is required to access Schema-Aware APIs, including editing.
|
|
99
|
-
* All content in the tree is accessible without down-casting, but if the schema is known,
|
|
100
|
-
* the schema aware API may be more ergonomic.
|
|
101
96
|
* All editing is actually done via {@link FlexTreeField}s: the nodes are immutable other than that they contain mutable fields.
|
|
102
97
|
*/
|
|
103
98
|
export interface FlexTreeNode extends FlexTreeEntity {
|
|
@@ -127,10 +122,6 @@ export interface FlexTreeNode extends FlexTreeEntity {
|
|
|
127
122
|
readonly parent: FlexTreeField;
|
|
128
123
|
readonly index: number;
|
|
129
124
|
};
|
|
130
|
-
/**
|
|
131
|
-
* Type guard for narrowing / down-casting to a specific schema.
|
|
132
|
-
*/
|
|
133
|
-
is(schema: FlexTreeNodeSchema): boolean;
|
|
134
125
|
boxedIterator(): IterableIterator<FlexTreeField>;
|
|
135
126
|
/**
|
|
136
127
|
* The anchor node associated with this node
|
|
@@ -155,11 +146,6 @@ export interface FlexTreeNode extends FlexTreeEntity {
|
|
|
155
146
|
* If well-formed, it must follow this schema.
|
|
156
147
|
*/
|
|
157
148
|
readonly schema: TreeNodeSchemaIdentifier;
|
|
158
|
-
/**
|
|
159
|
-
* Schema for this entity.
|
|
160
|
-
* If well-formed, it must follow this schema.
|
|
161
|
-
*/
|
|
162
|
-
readonly flexSchema: FlexTreeNodeSchema;
|
|
163
149
|
}
|
|
164
150
|
/**
|
|
165
151
|
* A collaboratively editable collection of nodes within a {@link FlexTreeEntity}.
|
|
@@ -219,7 +205,7 @@ export interface FlexTreeField extends FlexTreeEntity {
|
|
|
219
205
|
* Schema for this entity.
|
|
220
206
|
* If well-formed, it must follow this schema.
|
|
221
207
|
*/
|
|
222
|
-
readonly schema:
|
|
208
|
+
readonly schema: FieldKindIdentifier;
|
|
223
209
|
}
|
|
224
210
|
/**
|
|
225
211
|
* Typed tree for inserting as the content of a field.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flexTreeTypes.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/flexTreeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,
|
|
1
|
+
{"version":3,"file":"flexTreeTypes.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/flexTreeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EAC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|
|
|
1
|
-
{"version":3,"file":"flexTreeTypes.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/flexTreeTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kDAS6B;AAY7B;;;GAGG;AACU,QAAA,YAAY,GAAG,IAAA,qBAAU,GAAgB,CAAC;AAEvD;;GAEG;AACU,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAEvD,SAAS,gBAAgB,CAAC,CAAU;IACnC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,sBAAc,IAAI,CAAC,CAAC;AACnE,CAAC;AAED,SAAgB,cAAc,CAAC,CAAU;IACxC,OAAO,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,sBAAc,CAAC,KAAK,kBAAkB,CAAC,IAAI,CAAC;AAC7E,CAAC;AAFD,wCAEC;AAED;GACG;AACH,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC7B,2DAAI,CAAA;IACJ,6DAAK,CAAA;AACN,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AA6BD;;;GAGG;AACH,IAAY,UAkCX;AAlCD,WAAY,UAAU;IACrB;;OAEG;IACH,uDAAc,CAAA;IAEd;;OAEG;IACH,iDAAW,CAAA;IAEX;;OAEG;IACH,iDAAW,CAAA;IAEX;;;;;;;;;;;;;;;;OAgBG;IACH,yCAAO,CAAA;AACR,CAAC,EAlCW,UAAU,0BAAV,UAAU,QAkCrB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype AnchorNode,\n\ttype ExclusiveMapTree,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeValue,\n\tanchorSlot,\n} from \"../../core/index.js\";\nimport type {\n\tFieldKinds,\n\tSequenceFieldEditBuilder,\n\tValueFieldEditBuilder,\n\tOptionalFieldEditBuilder,\n} from \"../default-schema/index.js\";\nimport type { FlexFieldKind } from \"../modular-schema/index.js\";\nimport type { FlexTreeNodeSchema } from \"../typed-schema/index.js\";\n\nimport type { FlexTreeContext } from \"./context.js\";\n\n/**\n * An anchor slot which records the {@link FlexTreeNode} associated with that anchor, if there is one.\n * @remarks This always points to a \"real\" {@link FlexTreeNode} (i.e. a `LazyTreeNode`), never to a \"raw\" node.\n */\nexport const flexTreeSlot = anchorSlot<FlexTreeNode>();\n\n/**\n * Indicates that an object is a flex tree.\n */\nexport const flexTreeMarker = Symbol(\"flexTreeMarker\");\n\nfunction isFlexTreeEntity(t: unknown): t is FlexTreeEntity {\n\treturn typeof t === \"object\" && t !== null && flexTreeMarker in t;\n}\n\nexport function isFlexTreeNode(t: unknown): t is FlexTreeNode {\n\treturn isFlexTreeEntity(t) && t[flexTreeMarker] === FlexTreeEntityKind.Node;\n}\n\n/**\n */\nexport enum FlexTreeEntityKind {\n\tNode,\n\tField,\n}\n\n/**\n * Part of a tree.\n * Iterates over children.\n *\n * @privateRemarks\n * This exists mainly as a place to share common members between nodes and fields.\n * It is not expected to be useful or common to write code which handles this type directly.\n * If this assumption turns out to be false, and generically processing `UntypedEntity`s is useful,\n * then this interface should probably be extended with some down casting functionality (like `is`).\n *\n * TODO:\n * Design and document iterator invalidation rules and ordering rules.\n * Providing a custom iterator type with place anchor semantics would be a good approach.\n */\nexport interface FlexTreeEntity {\n\t/**\n\t * Indicates that an object is a specific kind of flex tree FlexTreeEntity.\n\t * This makes it possible to both down cast FlexTreeEntities safely as well as validate if an object is or is not a FlexTreeEntity.\n\t */\n\treadonly [flexTreeMarker]: FlexTreeEntityKind;\n\n\t/**\n\t * A common context of FlexTrees.\n\t */\n\treadonly context: FlexTreeContext;\n}\n\n/**\n * Status of the tree that a particular node belongs to.\n * @public\n */\nexport enum TreeStatus {\n\t/**\n\t * Is parented under the root field.\n\t */\n\tInDocument = 0,\n\n\t/**\n\t * Is not parented under the root field, but can be added back to the original document tree.\n\t */\n\tRemoved = 1,\n\n\t/**\n\t * Is removed and cannot be added back to the original document tree.\n\t */\n\tDeleted = 2,\n\n\t/**\n\t * Is created but has not yet been inserted into the tree.\n\t * @remarks\n\t * See also {@link Unhydrated}.\n\t *\n\t * Nodes in the new state have some limitations:\n\t *\n\t * - Events are not currently triggered for changes. Fixes for this are planned.\n\t *\n\t * - Reading identifiers from nodes which were left unspecified (defaulted) when creating the tree will error.\n\t * This is because allocating unique identifiers in a compressible manner requires knowing which tree the nodes will be inserted into.\n\t *\n\t * - Transactions do not work: transactions apply to a single {@link TreeView}, and `New` nodes are not part of one.\n\t *\n\t * - `Tree.shortId` (when the identifier was explicitly specified and thus works at all) will just return the full identifier as a string,\n\t * but might return a compressed form as a number once hydrated.\n\t */\n\tNew = 3,\n}\n\n/**\n * Generic tree node API.\n *\n * Nodes are (shallowly) immutable and have a logical identity, a type and either a value or fields under string keys.\n *\n * This \"logical identity\" is exposed as the object identity: if a node is moved within a document,\n * the same {@link FlexTreeNode} instance will be used in the new location.\n * Similarly, edits applied to a node's sub-tree concurrently with the move of the node will still be applied to its subtree in its new location.\n *\n *\n * @remarks\n * Down-casting (via {@link FlexTreeNode#is}) is required to access Schema-Aware APIs, including editing.\n * All content in the tree is accessible without down-casting, but if the schema is known,\n * the schema aware API may be more ergonomic.\n * All editing is actually done via {@link FlexTreeField}s: the nodes are immutable other than that they contain mutable fields.\n */\nexport interface FlexTreeNode extends FlexTreeEntity {\n\treadonly [flexTreeMarker]: FlexTreeEntityKind.Node;\n\n\t/**\n\t * Value stored on this node.\n\t */\n\treadonly value?: TreeValue;\n\n\t/**\n\t * Gets a field of this node, if it is not empty.\n\t */\n\ttryGetField(key: FieldKey): undefined | FlexTreeField;\n\n\t/**\n\t * Get the field for `key`.\n\t * @param key - which entry to look up.\n\t *\n\t * @remarks\n\t * All fields implicitly exist, so `getBoxed` can be called with any key and will always return a field.\n\t * Even if the field is empty, it will still be returned, and can be edited to insert content if allowed by the field kind.\n\t * See {@link FlexTreeNode.tryGetField} for a variant that does not allocate afield in the empty case.\n\t */\n\tgetBoxed(key: FieldKey): FlexTreeField;\n\n\t/**\n\t * The field this tree is in, and the index within that field.\n\t */\n\treadonly parentField: { readonly parent: FlexTreeField; readonly index: number };\n\n\t/**\n\t * Type guard for narrowing / down-casting to a specific schema.\n\t */\n\tis(schema: FlexTreeNodeSchema): boolean;\n\n\tboxedIterator(): IterableIterator<FlexTreeField>;\n\n\t/**\n\t * The anchor node associated with this node\n\t *\n\t * @remarks\n\t * The ref count keeping this alive is owned by the FlexTreeNode:\n\t * if holding onto this anchor for longer than the FlexTreeNode might be alive,\n\t * a separate Anchor (and thus ref count) must be allocated to keep it alive.\n\t */\n\treadonly anchorNode: AnchorNode;\n\n\t/**\n\t * Returns an iterable of keys for non-empty fields.\n\t *\n\t * @remarks\n\t * All fields under a map implicitly exist, but `keys` will yield only the keys of fields which contain one or more nodes.\n\t *\n\t * No guarantees are made regarding the order of the keys returned.\n\t */\n\tkeys(): IterableIterator<FieldKey>;\n\n\t/**\n\t * Schema for this entity.\n\t * If well-formed, it must follow this schema.\n\t */\n\treadonly schema: TreeNodeSchemaIdentifier;\n\n\t/**\n\t * Schema for this entity.\n\t * If well-formed, it must follow this schema.\n\t */\n\treadonly flexSchema: FlexTreeNodeSchema;\n}\n\n/**\n * A collaboratively editable collection of nodes within a {@link FlexTreeEntity}.\n *\n * Fields are inherently part of their parent, and thus cannot be moved.\n * Instead their content can be moved, deleted or created.\n *\n * Editing operations are only valid on trees with the {@link TreeStatus#InDocument} `TreeStatus`.\n *\n * @remarks\n * Fields are used wherever an editable collection of nodes is required.\n * This is required in two places:\n * 1. To hold the children of non-leaf {@link FlexTreeNode}s.\n * 2. As the root of a {@link FlexTreeEntity}.\n *\n * Down-casting (via {@link FlexTreeField.is}) is required to access Schema-Aware APIs, including editing.\n * All content in the tree is accessible without down-casting, but if the schema is known,\n * the schema aware API may be more ergonomic.\n */\nexport interface FlexTreeField extends FlexTreeEntity {\n\treadonly [flexTreeMarker]: FlexTreeEntityKind.Field;\n\n\t/**\n\t * The number of nodes in this field\n\t */\n\treadonly length: number;\n\n\t/**\n\t * The `FieldKey` this field is under.\n\t * Defines what part of its parent this field makes up.\n\t */\n\treadonly key: FieldKey;\n\n\t/**\n\t * The node which has this field on it under `fieldKey`.\n\t * `undefined` iff this field is a detached field.\n\t */\n\treadonly parent?: FlexTreeNode;\n\n\t/**\n\t * Type guard for narrowing / down-casting to a specific schema.\n\t */\n\tis<TKind extends FlexFieldKind>(kind: TKind): this is FlexTreeTypedField<TKind>;\n\n\tboxedIterator(): IterableIterator<FlexTreeNode>;\n\n\t/**\n\t * Gets a node of this field by its index without unboxing.\n\t * @param index - Zero-based index of the item to retrieve. Negative values are interpreted from the end of the sequence.\n\t *\n\t * @returns The element in the sequence matching the given index. Always returns undefined if index \\< -sequence.length\n\t * or index \\>= sequence.length.\n\t *\n\t * @remarks\n\t * Semantics match {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at}.\n\t */\n\tboxedAt(index: number): FlexTreeNode | undefined;\n\n\t/**\n\t * Gets the FieldUpPath of a field.\n\t */\n\tgetFieldPath(): FieldUpPath;\n\n\t/**\n\t * Schema for this entity.\n\t * If well-formed, it must follow this schema.\n\t */\n\treadonly schema: TreeFieldStoredSchema;\n}\n\n// #region Field Kinds\n\n/**\n * Typed tree for inserting as the content of a field.\n */\nexport type FlexibleFieldContent = ExclusiveMapTree[];\n\n/**\n * Tree for inserting as a node.\n */\nexport type FlexibleNodeContent = ExclusiveMapTree;\n\n/**\n * {@link FlexTreeField} that stores a sequence of children.\n *\n * Sequence fields can contain an ordered sequence any number of {@link FlexTreeNode}s which must be of the {@link FlexAllowedTypes} from the {@link FlexFieldSchema}).\n *\n * @remarks\n * Allows for concurrent editing based on index, adjusting the locations of indexes as needed so they apply to the same logical place in the sequence when rebased and merged.\n *\n * Edits to sequence fields are anchored relative to their surroundings, so concurrent edits can result in the indexes of nodes and edits getting shifted.\n * To hold onto locations in sequence across an edit, use anchors.\n *\n * @privateRemarks\n * TODO:\n * Add anchor API that can actually hold onto locations in a sequence.\n * Currently only nodes can be held onto with anchors, and this does not replicate the behavior implemented for editing.\n */\nexport interface FlexTreeSequenceField extends FlexTreeField {\n\t/**\n\t * Gets a node of this field by its index with unboxing.\n\t * @param index - Zero-based index of the item to retrieve. Negative values are interpreted from the end of the sequence.\n\t *\n\t * @returns The element in the sequence matching the given index. Always returns undefined if index \\< -sequence.length\n\t * or index \\>= array.length.\n\t *\n\t * @remarks\n\t * Semantics match {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at}.\n\t */\n\tat(index: number): FlexTreeUnknownUnboxed | undefined;\n\n\t/**\n\t * {@inheritdoc FlexTreeField.boxedAt}\n\t */\n\tboxedAt(index: number): FlexTreeNode | undefined;\n\n\t/**\n\t * Calls the provided callback function on each child of this sequence, and returns an array that contains the results.\n\t * @param callbackfn - A function that accepts the child and its index.\n\t */\n\tmap<U>(callbackfn: (value: FlexTreeUnknownUnboxed, index: number) => U): U[];\n\n\t/**\n\t * Get an editor for this sequence.\n\t */\n\treadonly editor: SequenceFieldEditBuilder<FlexibleFieldContent>;\n\n\tboxedIterator(): IterableIterator<FlexTreeNode>;\n}\n\n/**\n * Field that stores exactly one child.\n *\n * @remarks\n * Unboxes its content, so in schema aware APIs which do unboxing, the RequiredField itself will be skipped over and its content will be returned directly.\n */\nexport interface FlexTreeRequiredField extends FlexTreeField {\n\tget content(): FlexTreeUnknownUnboxed;\n\n\treadonly editor: ValueFieldEditBuilder<FlexibleNodeContent>;\n}\n\n/**\n * Field that stores zero or one child.\n *\n * @remarks\n * Unboxes its content, so in schema aware APIs which do unboxing, the OptionalField itself will be skipped over and its content will be returned directly.\n *\n * @privateRemarks\n * TODO: Document merge semitics\n * TODO: Allow Optional fields to be used with last write wins OR first write wins merge resolution.\n * TODO:\n * Better centralize the documentation about what kinds of merge semantics are available for field kinds.\n * Maybe link editor?\n */\nexport interface FlexTreeOptionalField extends FlexTreeField {\n\tget content(): FlexTreeUnknownUnboxed | undefined;\n\n\treadonly editor: OptionalFieldEditBuilder<FlexibleNodeContent>;\n}\n\n// #endregion\n\n// #region Typed\n\n/**\n * Schema aware specialization of {@link FlexTreeField}.\n */\nexport type FlexTreeTypedField<Kind extends FlexFieldKind> =\n\tKind extends typeof FieldKinds.sequence\n\t\t? FlexTreeSequenceField\n\t\t: Kind extends typeof FieldKinds.required\n\t\t\t? FlexTreeRequiredField\n\t\t\t: Kind extends typeof FieldKinds.optional\n\t\t\t\t? FlexTreeOptionalField\n\t\t\t\t: FlexTreeField;\n\n// #endregion\n\n/**\n * Unboxed tree type for unknown schema cases.\n */\nexport type FlexTreeUnknownUnboxed = TreeValue | FlexTreeNode;\n"]}
|
|
1
|
+
{"version":3,"file":"flexTreeTypes.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/flexTreeTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kDAS6B;AAW7B;;;GAGG;AACU,QAAA,YAAY,GAAG,IAAA,qBAAU,GAAgB,CAAC;AAEvD;;GAEG;AACU,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAEvD,SAAS,gBAAgB,CAAC,CAAU;IACnC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,sBAAc,IAAI,CAAC,CAAC;AACnE,CAAC;AAED,SAAgB,cAAc,CAAC,CAAU;IACxC,OAAO,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,sBAAc,CAAC,KAAK,kBAAkB,CAAC,IAAI,CAAC;AAC7E,CAAC;AAFD,wCAEC;AAED;GACG;AACH,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC7B,2DAAI,CAAA;IACJ,6DAAK,CAAA;AACN,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AA6BD;;;GAGG;AACH,IAAY,UAkCX;AAlCD,WAAY,UAAU;IACrB;;OAEG;IACH,uDAAc,CAAA;IAEd;;OAEG;IACH,iDAAW,CAAA;IAEX;;OAEG;IACH,iDAAW,CAAA;IAEX;;;;;;;;;;;;;;;;OAgBG;IACH,yCAAO,CAAA;AACR,CAAC,EAlCW,UAAU,0BAAV,UAAU,QAkCrB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype AnchorNode,\n\ttype ExclusiveMapTree,\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\ttype FieldUpPath,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeValue,\n\tanchorSlot,\n} from \"../../core/index.js\";\nimport type {\n\tFieldKinds,\n\tSequenceFieldEditBuilder,\n\tValueFieldEditBuilder,\n\tOptionalFieldEditBuilder,\n} from \"../default-schema/index.js\";\nimport type { FlexFieldKind } from \"../modular-schema/index.js\";\n\nimport type { FlexTreeContext } from \"./context.js\";\n\n/**\n * An anchor slot which records the {@link FlexTreeNode} associated with that anchor, if there is one.\n * @remarks This always points to a \"real\" {@link FlexTreeNode} (i.e. a `LazyTreeNode`), never to a \"raw\" node.\n */\nexport const flexTreeSlot = anchorSlot<FlexTreeNode>();\n\n/**\n * Indicates that an object is a flex tree.\n */\nexport const flexTreeMarker = Symbol(\"flexTreeMarker\");\n\nfunction isFlexTreeEntity(t: unknown): t is FlexTreeEntity {\n\treturn typeof t === \"object\" && t !== null && flexTreeMarker in t;\n}\n\nexport function isFlexTreeNode(t: unknown): t is FlexTreeNode {\n\treturn isFlexTreeEntity(t) && t[flexTreeMarker] === FlexTreeEntityKind.Node;\n}\n\n/**\n */\nexport enum FlexTreeEntityKind {\n\tNode,\n\tField,\n}\n\n/**\n * Part of a tree.\n * Iterates over children.\n *\n * @privateRemarks\n * This exists mainly as a place to share common members between nodes and fields.\n * It is not expected to be useful or common to write code which handles this type directly.\n * If this assumption turns out to be false, and generically processing `UntypedEntity`s is useful,\n * then this interface should probably be extended with some down casting functionality (like `is`).\n *\n * TODO:\n * Design and document iterator invalidation rules and ordering rules.\n * Providing a custom iterator type with place anchor semantics would be a good approach.\n */\nexport interface FlexTreeEntity {\n\t/**\n\t * Indicates that an object is a specific kind of flex tree FlexTreeEntity.\n\t * This makes it possible to both down cast FlexTreeEntities safely as well as validate if an object is or is not a FlexTreeEntity.\n\t */\n\treadonly [flexTreeMarker]: FlexTreeEntityKind;\n\n\t/**\n\t * A common context of FlexTrees.\n\t */\n\treadonly context: FlexTreeContext;\n}\n\n/**\n * Status of the tree that a particular node belongs to.\n * @public\n */\nexport enum TreeStatus {\n\t/**\n\t * Is parented under the root field.\n\t */\n\tInDocument = 0,\n\n\t/**\n\t * Is not parented under the root field, but can be added back to the original document tree.\n\t */\n\tRemoved = 1,\n\n\t/**\n\t * Is removed and cannot be added back to the original document tree.\n\t */\n\tDeleted = 2,\n\n\t/**\n\t * Is created but has not yet been inserted into the tree.\n\t * @remarks\n\t * See also {@link Unhydrated}.\n\t *\n\t * Nodes in the new state have some limitations:\n\t *\n\t * - Events are not currently triggered for changes. Fixes for this are planned.\n\t *\n\t * - Reading identifiers from nodes which were left unspecified (defaulted) when creating the tree will error.\n\t * This is because allocating unique identifiers in a compressible manner requires knowing which tree the nodes will be inserted into.\n\t *\n\t * - Transactions do not work: transactions apply to a single {@link TreeView}, and `New` nodes are not part of one.\n\t *\n\t * - `Tree.shortId` (when the identifier was explicitly specified and thus works at all) will just return the full identifier as a string,\n\t * but might return a compressed form as a number once hydrated.\n\t */\n\tNew = 3,\n}\n\n/**\n * Generic tree node API.\n *\n * Nodes are (shallowly) immutable and have a logical identity, a type and either a value or fields under string keys.\n *\n * This \"logical identity\" is exposed as the object identity: if a node is moved within a document,\n * the same {@link FlexTreeNode} instance will be used in the new location.\n * Similarly, edits applied to a node's sub-tree concurrently with the move of the node will still be applied to its subtree in its new location.\n *\n * @remarks\n * All editing is actually done via {@link FlexTreeField}s: the nodes are immutable other than that they contain mutable fields.\n */\nexport interface FlexTreeNode extends FlexTreeEntity {\n\treadonly [flexTreeMarker]: FlexTreeEntityKind.Node;\n\n\t/**\n\t * Value stored on this node.\n\t */\n\treadonly value?: TreeValue;\n\n\t/**\n\t * Gets a field of this node, if it is not empty.\n\t */\n\ttryGetField(key: FieldKey): undefined | FlexTreeField;\n\n\t/**\n\t * Get the field for `key`.\n\t * @param key - which entry to look up.\n\t *\n\t * @remarks\n\t * All fields implicitly exist, so `getBoxed` can be called with any key and will always return a field.\n\t * Even if the field is empty, it will still be returned, and can be edited to insert content if allowed by the field kind.\n\t * See {@link FlexTreeNode.tryGetField} for a variant that does not allocate afield in the empty case.\n\t */\n\tgetBoxed(key: FieldKey): FlexTreeField;\n\n\t/**\n\t * The field this tree is in, and the index within that field.\n\t */\n\treadonly parentField: { readonly parent: FlexTreeField; readonly index: number };\n\n\tboxedIterator(): IterableIterator<FlexTreeField>;\n\n\t/**\n\t * The anchor node associated with this node\n\t *\n\t * @remarks\n\t * The ref count keeping this alive is owned by the FlexTreeNode:\n\t * if holding onto this anchor for longer than the FlexTreeNode might be alive,\n\t * a separate Anchor (and thus ref count) must be allocated to keep it alive.\n\t */\n\treadonly anchorNode: AnchorNode;\n\n\t/**\n\t * Returns an iterable of keys for non-empty fields.\n\t *\n\t * @remarks\n\t * All fields under a map implicitly exist, but `keys` will yield only the keys of fields which contain one or more nodes.\n\t *\n\t * No guarantees are made regarding the order of the keys returned.\n\t */\n\tkeys(): IterableIterator<FieldKey>;\n\n\t/**\n\t * Schema for this entity.\n\t * If well-formed, it must follow this schema.\n\t */\n\treadonly schema: TreeNodeSchemaIdentifier;\n}\n\n/**\n * A collaboratively editable collection of nodes within a {@link FlexTreeEntity}.\n *\n * Fields are inherently part of their parent, and thus cannot be moved.\n * Instead their content can be moved, deleted or created.\n *\n * Editing operations are only valid on trees with the {@link TreeStatus#InDocument} `TreeStatus`.\n *\n * @remarks\n * Fields are used wherever an editable collection of nodes is required.\n * This is required in two places:\n * 1. To hold the children of non-leaf {@link FlexTreeNode}s.\n * 2. As the root of a {@link FlexTreeEntity}.\n *\n * Down-casting (via {@link FlexTreeField.is}) is required to access Schema-Aware APIs, including editing.\n * All content in the tree is accessible without down-casting, but if the schema is known,\n * the schema aware API may be more ergonomic.\n */\nexport interface FlexTreeField extends FlexTreeEntity {\n\treadonly [flexTreeMarker]: FlexTreeEntityKind.Field;\n\n\t/**\n\t * The number of nodes in this field\n\t */\n\treadonly length: number;\n\n\t/**\n\t * The `FieldKey` this field is under.\n\t * Defines what part of its parent this field makes up.\n\t */\n\treadonly key: FieldKey;\n\n\t/**\n\t * The node which has this field on it under `fieldKey`.\n\t * `undefined` iff this field is a detached field.\n\t */\n\treadonly parent?: FlexTreeNode;\n\n\t/**\n\t * Type guard for narrowing / down-casting to a specific schema.\n\t */\n\tis<TKind extends FlexFieldKind>(kind: TKind): this is FlexTreeTypedField<TKind>;\n\n\tboxedIterator(): IterableIterator<FlexTreeNode>;\n\n\t/**\n\t * Gets a node of this field by its index without unboxing.\n\t * @param index - Zero-based index of the item to retrieve. Negative values are interpreted from the end of the sequence.\n\t *\n\t * @returns The element in the sequence matching the given index. Always returns undefined if index \\< -sequence.length\n\t * or index \\>= sequence.length.\n\t *\n\t * @remarks\n\t * Semantics match {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at}.\n\t */\n\tboxedAt(index: number): FlexTreeNode | undefined;\n\n\t/**\n\t * Gets the FieldUpPath of a field.\n\t */\n\tgetFieldPath(): FieldUpPath;\n\n\t/**\n\t * Schema for this entity.\n\t * If well-formed, it must follow this schema.\n\t */\n\treadonly schema: FieldKindIdentifier;\n}\n\n// #region Field Kinds\n\n/**\n * Typed tree for inserting as the content of a field.\n */\nexport type FlexibleFieldContent = ExclusiveMapTree[];\n\n/**\n * Tree for inserting as a node.\n */\nexport type FlexibleNodeContent = ExclusiveMapTree;\n\n/**\n * {@link FlexTreeField} that stores a sequence of children.\n *\n * Sequence fields can contain an ordered sequence any number of {@link FlexTreeNode}s which must be of the {@link FlexAllowedTypes} from the {@link FlexFieldSchema}).\n *\n * @remarks\n * Allows for concurrent editing based on index, adjusting the locations of indexes as needed so they apply to the same logical place in the sequence when rebased and merged.\n *\n * Edits to sequence fields are anchored relative to their surroundings, so concurrent edits can result in the indexes of nodes and edits getting shifted.\n * To hold onto locations in sequence across an edit, use anchors.\n *\n * @privateRemarks\n * TODO:\n * Add anchor API that can actually hold onto locations in a sequence.\n * Currently only nodes can be held onto with anchors, and this does not replicate the behavior implemented for editing.\n */\nexport interface FlexTreeSequenceField extends FlexTreeField {\n\t/**\n\t * Gets a node of this field by its index with unboxing.\n\t * @param index - Zero-based index of the item to retrieve. Negative values are interpreted from the end of the sequence.\n\t *\n\t * @returns The element in the sequence matching the given index. Always returns undefined if index \\< -sequence.length\n\t * or index \\>= array.length.\n\t *\n\t * @remarks\n\t * Semantics match {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at}.\n\t */\n\tat(index: number): FlexTreeUnknownUnboxed | undefined;\n\n\t/**\n\t * {@inheritdoc FlexTreeField.boxedAt}\n\t */\n\tboxedAt(index: number): FlexTreeNode | undefined;\n\n\t/**\n\t * Calls the provided callback function on each child of this sequence, and returns an array that contains the results.\n\t * @param callbackfn - A function that accepts the child and its index.\n\t */\n\tmap<U>(callbackfn: (value: FlexTreeUnknownUnboxed, index: number) => U): U[];\n\n\t/**\n\t * Get an editor for this sequence.\n\t */\n\treadonly editor: SequenceFieldEditBuilder<FlexibleFieldContent>;\n\n\tboxedIterator(): IterableIterator<FlexTreeNode>;\n}\n\n/**\n * Field that stores exactly one child.\n *\n * @remarks\n * Unboxes its content, so in schema aware APIs which do unboxing, the RequiredField itself will be skipped over and its content will be returned directly.\n */\nexport interface FlexTreeRequiredField extends FlexTreeField {\n\tget content(): FlexTreeUnknownUnboxed;\n\n\treadonly editor: ValueFieldEditBuilder<FlexibleNodeContent>;\n}\n\n/**\n * Field that stores zero or one child.\n *\n * @remarks\n * Unboxes its content, so in schema aware APIs which do unboxing, the OptionalField itself will be skipped over and its content will be returned directly.\n *\n * @privateRemarks\n * TODO: Document merge semitics\n * TODO: Allow Optional fields to be used with last write wins OR first write wins merge resolution.\n * TODO:\n * Better centralize the documentation about what kinds of merge semantics are available for field kinds.\n * Maybe link editor?\n */\nexport interface FlexTreeOptionalField extends FlexTreeField {\n\tget content(): FlexTreeUnknownUnboxed | undefined;\n\n\treadonly editor: OptionalFieldEditBuilder<FlexibleNodeContent>;\n}\n\n// #endregion\n\n// #region Typed\n\n/**\n * Schema aware specialization of {@link FlexTreeField}.\n */\nexport type FlexTreeTypedField<Kind extends FlexFieldKind> =\n\tKind extends typeof FieldKinds.sequence\n\t\t? FlexTreeSequenceField\n\t\t: Kind extends typeof FieldKinds.required\n\t\t\t? FlexTreeRequiredField\n\t\t\t: Kind extends typeof FieldKinds.optional\n\t\t\t\t? FlexTreeOptionalField\n\t\t\t\t: FlexTreeField;\n\n// #endregion\n\n/**\n * Unboxed tree type for unknown schema cases.\n */\nexport type FlexTreeUnknownUnboxed = TreeValue | FlexTreeNode;\n"]}
|
|
@@ -25,12 +25,11 @@ export declare function assertFlexTreeEntityNotFreed(entity: FlexTreeEntity): vo
|
|
|
25
25
|
/**
|
|
26
26
|
* This is a base class for lazy (cursor based) UntypedEntity implementations, which uniformly handles cursors and anchors.
|
|
27
27
|
*/
|
|
28
|
-
export declare abstract class LazyEntity<
|
|
28
|
+
export declare abstract class LazyEntity<TAnchor = unknown> implements FlexTreeEntity, IDisposable {
|
|
29
29
|
#private;
|
|
30
30
|
readonly context: Context;
|
|
31
|
-
readonly flexSchema: TSchema;
|
|
32
31
|
readonly [anchorSymbol]: TAnchor;
|
|
33
|
-
protected constructor(context: Context,
|
|
32
|
+
protected constructor(context: Context, cursor: ITreeSubscriptionCursor, anchor: TAnchor);
|
|
34
33
|
abstract boxedIterator(): IterableIterator<FlexTreeEntity>;
|
|
35
34
|
abstract get [flexTreeMarker](): FlexTreeEntityKind;
|
|
36
35
|
[disposeSymbol](): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazyEntity.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyEntity.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,uBAAuB,EAE5B,oBAAoB,EACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,cAAc,EACd,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,oBAAoB,eAA2B,CAAC;AAC7D,eAAO,MAAM,aAAa,eAAoB,CAAC;AAC/C,eAAO,MAAM,2BAA2B,eAAkC,CAAC;AAC3E,eAAO,MAAM,kBAAkB,eAAyB,CAAC;AACzD,eAAO,MAAM,YAAY,eAAmB,CAAC;AAC7C;;GAEG;AACH,eAAO,MAAM,YAAY,eAAmB,CAAC;AAE7C;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAGzE;AAED;;GAEG;AACH,8BAAsB,UAAU,CAAC,OAAO,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"lazyEntity.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyEntity.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,uBAAuB,EAE5B,oBAAoB,EACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,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ity implementations, which uniformly handles cursors and anchors.
|
|
46
46
|
*/
|
|
47
47
|
class LazyEntity {
|
|
48
|
-
constructor(context,
|
|
48
|
+
constructor(context, cursor, anchor) {
|
|
49
49
|
this.context = context;
|
|
50
|
-
this.flexSchema = flexSchema;
|
|
51
50
|
_LazyEntity_lazyCursor.set(this, void 0);
|
|
52
51
|
this[exports.anchorSymbol] = anchor;
|
|
53
52
|
__classPrivateFieldSet(this, _LazyEntity_lazyCursor, cursor.fork("LazyEntity Fork"), "f");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazyEntity.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyEntity.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,kEAA6D;AAE7D,kDAI6B;AAC7B,kDAAsE;AAGtE,yDAI4B;AAEf,QAAA,oBAAoB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAChD,QAAA,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAClC,QAAA,2BAA2B,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAC9D,QAAA,kBAAkB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAC5C,QAAA,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC7C;;GAEG;AACU,QAAA,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAE7C;;;;;GAKG;AACH,SAAgB,4BAA4B,CAAC,MAAsB;IAClE,IAAA,iBAAM,EAAC,MAAM,YAAY,UAAU,EAAE,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAC5E,IAAA,iBAAM,EAAC,CAAC,MAAM,CAAC,qBAAa,CAAC,EAAE,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;AAC9D,CAAC;AAHD,oEAGC;AAED;;GAEG;AACH,MAAsB,UAAU;
|
|
1
|
+
{"version":3,"file":"lazyEntity.js","sourceRoot":"","sources":["../../../src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B,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,0BAAkB,CAAC,EAAE,CAAC;QAC3B,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAEM,CAAC,4BAAoB,CAAC;QAC5B,uBAAA,IAAI,8BAAY,CAAC,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAEM,CAAC,qBAAa,CAAC;QACrB,OAAO,uBAAA,IAAI,8BAAY,CAAC,KAAK,KAAK,uCAA4B,CAAC,KAAK,CAAC;IACtE,CAAC;IAED,IAAW,CAAC,oBAAY,CAAC;QACxB,IAAI,uBAAA,IAAI,8BAAY,CAAC,KAAK,KAAK,uCAA4B,CAAC,OAAO,EAAE,CAAC;YACrE,IAAA,iBAAM,EACL,uBAAA,IAAI,8BAAY,CAAC,KAAK,KAAK,uCAA4B,CAAC,OAAO,EAC/D,KAAK,CAAC,6CAA6C,CACnD,CAAC;YACF,IAAA,iBAAM,EACL,IAAI,CAAC,oBAAY,CAAC,KAAK,SAAS,EAChC,KAAK,CAAC,iEAAiE,CACvE,CAAC;YACF,MAAM,MAAM,GAAG,IAAI,CAAC,mCAA2B,CAAC,CAAC,uBAAA,IAAI,8BAAY,CAAC,CAAC;YACnE,IAAA,iBAAM,EACL,MAAM,oCAA4B,EAClC,KAAK,CAAC,oEAAoE,CAC1E,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,uBAAA,IAAI,8BAAY,CAAC;IACzB,CAAC;CAUD;AA9DD,gCA8DC","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 {\n\ttype ITreeSubscriptionCursor,\n\tITreeSubscriptionCursorState,\n\tTreeNavigationResult,\n} from \"../../core/index.js\";\nimport { type IDisposable, disposeSymbol } from \"../../util/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport {\n\ttype FlexTreeEntity,\n\ttype FlexTreeEntityKind,\n\tflexTreeMarker,\n} from \"./flexTreeTypes.js\";\n\nexport const prepareForEditSymbol = Symbol(\"prepareForEdit\");\nexport const isFreedSymbol = Symbol(\"isFreed\");\nexport const tryMoveCursorToAnchorSymbol = Symbol(\"tryMoveCursorToAnchor\");\nexport const forgetAnchorSymbol = Symbol(\"forgetAnchor\");\nexport const cursorSymbol = Symbol(\"cursor\");\n/**\n * Symbol used to access the (generic) anchor of a {@link LazyEntity}.\n */\nexport const anchorSymbol = Symbol(\"anchor\");\n\n/**\n * Assert `entity` is not deleted.\n * @privateRemarks\n * This can be faster than getting the tree status and checking that since that can require computing removed vs deleted.\n * TODO: provide a non implementation dependent way to leverage this optimization.\n */\nexport function assertFlexTreeEntityNotFreed(entity: FlexTreeEntity): void {\n\tassert(entity instanceof LazyEntity, 0x8c9 /* unexpected implementation */);\n\tassert(!entity[isFreedSymbol](), 0x8ca /* Use after free */);\n}\n\n/**\n * This is a base class for lazy (cursor based) UntypedEntity implementations, which uniformly handles cursors and anchors.\n */\nexport abstract class LazyEntity<TAnchor = unknown> implements FlexTreeEntity, IDisposable {\n\treadonly #lazyCursor: ITreeSubscriptionCursor;\n\tpublic readonly [anchorSymbol]: TAnchor;\n\n\tprotected constructor(\n\t\tpublic readonly context: Context,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tanchor: TAnchor,\n\t) {\n\t\tthis[anchorSymbol] = anchor;\n\t\tthis.#lazyCursor = cursor.fork(\"LazyEntity Fork\");\n\t\tcontext.withCursors.add(this);\n\t\tthis.context.withAnchors.add(this);\n\t}\n\n\tpublic abstract boxedIterator(): IterableIterator<FlexTreeEntity>;\n\tpublic abstract get [flexTreeMarker](): FlexTreeEntityKind;\n\n\tpublic [disposeSymbol](): void {\n\t\tthis.#lazyCursor.free();\n\t\tthis.context.withCursors.delete(this);\n\t\tthis[forgetAnchorSymbol]();\n\t\tthis.context.withAnchors.delete(this);\n\t}\n\n\tpublic [prepareForEditSymbol](): void {\n\t\tthis.#lazyCursor.clear();\n\t\tthis.context.withCursors.delete(this);\n\t}\n\n\tpublic [isFreedSymbol](): boolean {\n\t\treturn this.#lazyCursor.state === ITreeSubscriptionCursorState.Freed;\n\t}\n\n\tpublic get [cursorSymbol](): ITreeSubscriptionCursor {\n\t\tif (this.#lazyCursor.state !== ITreeSubscriptionCursorState.Current) {\n\t\t\tassert(\n\t\t\t\tthis.#lazyCursor.state === ITreeSubscriptionCursorState.Cleared,\n\t\t\t\t0x778 /* Unset cursor should be in cleared state */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\tthis[anchorSymbol] !== undefined,\n\t\t\t\t0x779 /* FlexTree should have an anchor if it does not have a cursor */,\n\t\t\t);\n\t\t\tconst result = this[tryMoveCursorToAnchorSymbol](this.#lazyCursor);\n\t\t\tassert(\n\t\t\t\tresult === TreeNavigationResult.Ok,\n\t\t\t\t0x77a /* It is invalid to access a FlexTree node which no longer exists */,\n\t\t\t);\n\t\t\tthis.context.withCursors.add(this);\n\t\t}\n\t\treturn this.#lazyCursor;\n\t}\n\n\tprotected abstract [tryMoveCursorToAnchorSymbol](\n\t\tcursor: ITreeSubscriptionCursor,\n\t): TreeNavigationResult;\n\n\t/**\n\t * Called when disposing of this target, iff it has an anchor.\n\t */\n\tprotected abstract [forgetAnchorSymbol](): void;\n}\n"]}
|
|
@@ -2,27 +2,26 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { type ExclusiveMapTree, type FieldAnchor, type FieldKey, type
|
|
6
|
-
import {
|
|
5
|
+
import { type ExclusiveMapTree, type FieldAnchor, type FieldKey, type FieldKindIdentifier, type FieldUpPath, type ITreeSubscriptionCursor, type TreeNavigationResult } from "../../core/index.js";
|
|
6
|
+
import { type OptionalFieldEditBuilder, type SequenceFieldEditBuilder, type ValueFieldEditBuilder } from "../default-schema/index.js";
|
|
7
7
|
import type { FlexFieldKind } from "../modular-schema/index.js";
|
|
8
|
-
import type { FlexFieldSchema } from "../typed-schema/index.js";
|
|
9
8
|
import type { Context } from "./context.js";
|
|
10
9
|
import { FlexTreeEntityKind, type FlexTreeField, type FlexTreeNode, type FlexTreeOptionalField, type FlexTreeRequiredField, type FlexTreeSequenceField, type FlexTreeTypedField, type FlexTreeUnknownUnboxed, flexTreeMarker } from "./flexTreeTypes.js";
|
|
11
10
|
import { LazyEntity, forgetAnchorSymbol, tryMoveCursorToAnchorSymbol } from "./lazyEntity.js";
|
|
12
|
-
export declare function makeField(context: Context, schema:
|
|
11
|
+
export declare function makeField(context: Context, schema: FieldKindIdentifier, cursor: ITreeSubscriptionCursor): FlexTreeField;
|
|
13
12
|
/**
|
|
14
13
|
* Base type for fields implementing {@link FlexTreeField} using cursors.
|
|
15
14
|
*/
|
|
16
|
-
export declare abstract class LazyField
|
|
15
|
+
export declare abstract class LazyField extends LazyEntity<FieldAnchor> implements FlexTreeField {
|
|
16
|
+
readonly schema: FieldKindIdentifier;
|
|
17
17
|
get [flexTreeMarker](): FlexTreeEntityKind.Field;
|
|
18
18
|
readonly key: FieldKey;
|
|
19
|
-
get schema(): TreeFieldStoredSchema;
|
|
20
19
|
/**
|
|
21
20
|
* If this field ends its lifetime before the Anchor does, this needs to be invoked to avoid a double free
|
|
22
21
|
* if/when the Anchor is destroyed.
|
|
23
22
|
*/
|
|
24
23
|
private readonly offAfterDestroy?;
|
|
25
|
-
constructor(context: Context, schema:
|
|
24
|
+
constructor(context: Context, schema: FieldKindIdentifier, cursor: ITreeSubscriptionCursor, fieldAnchor: FieldAnchor);
|
|
26
25
|
is<TKind2 extends FlexFieldKind>(kind: TKind2): this is FlexTreeTypedField<TKind2>;
|
|
27
26
|
get parent(): FlexTreeNode | undefined;
|
|
28
27
|
protected [tryMoveCursorToAnchorSymbol](cursor: ITreeSubscriptionCursor): TreeNavigationResult;
|
|
@@ -40,30 +39,26 @@ export declare abstract class LazyField<out TKind extends FlexFieldKind> extends
|
|
|
40
39
|
*/
|
|
41
40
|
getFieldPathForEditing(): FieldUpPath;
|
|
42
41
|
}
|
|
43
|
-
export declare class LazySequence extends LazyField
|
|
44
|
-
constructor(context: Context, schema: FlexFieldSchema<typeof FieldKinds.sequence>, cursor: ITreeSubscriptionCursor, fieldAnchor: FieldAnchor);
|
|
42
|
+
export declare class LazySequence extends LazyField implements FlexTreeSequenceField {
|
|
45
43
|
at(index: number): FlexTreeUnknownUnboxed | undefined;
|
|
46
44
|
get asArray(): readonly FlexTreeUnknownUnboxed[];
|
|
47
45
|
editor: SequenceFieldEditBuilder<ExclusiveMapTree[]>;
|
|
48
46
|
private sequenceEditor;
|
|
49
47
|
}
|
|
50
|
-
export declare class ReadonlyLazyValueField extends LazyField
|
|
51
|
-
constructor(context: Context, schema: FlexFieldSchema<typeof FieldKinds.required>, cursor: ITreeSubscriptionCursor, fieldAnchor: FieldAnchor);
|
|
48
|
+
export declare class ReadonlyLazyValueField extends LazyField implements FlexTreeRequiredField {
|
|
52
49
|
editor: ValueFieldEditBuilder<ExclusiveMapTree>;
|
|
53
50
|
get content(): FlexTreeUnknownUnboxed;
|
|
54
51
|
}
|
|
55
52
|
export declare class LazyValueField extends ReadonlyLazyValueField implements FlexTreeRequiredField {
|
|
56
|
-
constructor(context: Context, schema: FlexFieldSchema<typeof FieldKinds.required>, cursor: ITreeSubscriptionCursor, fieldAnchor: FieldAnchor);
|
|
57
53
|
editor: ValueFieldEditBuilder<ExclusiveMapTree>;
|
|
58
54
|
private valueFieldEditor;
|
|
59
55
|
get content(): FlexTreeUnknownUnboxed;
|
|
60
56
|
}
|
|
61
|
-
export declare class LazyOptionalField extends LazyField
|
|
62
|
-
constructor(context: Context, schema: FlexFieldSchema<typeof FieldKinds.optional>, cursor: ITreeSubscriptionCursor, fieldAnchor: FieldAnchor);
|
|
57
|
+
export declare class LazyOptionalField extends LazyField implements FlexTreeOptionalField {
|
|
63
58
|
editor: OptionalFieldEditBuilder<ExclusiveMapTree>;
|
|
64
59
|
private optionalEditor;
|
|
65
60
|
get content(): FlexTreeUnknownUnboxed | undefined;
|
|
66
61
|
}
|
|
67
|
-
export declare class LazyForbiddenField extends LazyField
|
|
62
|
+
export declare class LazyForbiddenField extends LazyField {
|
|
68
63
|
}
|
|
69
64
|
//# sourceMappingURL=lazyField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazyField.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyField.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAEN,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,WAAW,EAEhB,KAAK,uBAAuB,EAC5B,KAAK,
|
|
1
|
+
{"version":3,"file":"lazyField.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyField.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAEN,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAEhB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAIzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAEN,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACN,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,qBAAqB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AC,EAAE;IAI5E,aAAa,IAAI,gBAAgB,CAAC,YAAY,CAAC;IAI/C,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,sBAAsB,CAAC;IAM7D,YAAY,IAAI,WAAW;IAIlC;;;OAGG;IACI,sBAAsB,IAAI,WAAW;CAe5C;AAED,qBAAa,YAAa,SAAQ,SAAU,YAAW,qBAAqB;IACpE,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS;IAW5D,IAAW,OAAO,IAAI,SAAS,sBAAsB,EAAE,CAEtD;IAEM,MAAM,EAAE,wBAAwB,CAAC,gBAAgB,EAAE,CAAC,CAOzD;IAEF,OAAO,CAAC,cAAc;CAItB;AAED,qBAAa,sBAAuB,SAAQ,SAAU,YAAW,qBAAqB;IAC9E,MAAM,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,CAIpD;IAEF,IAAW,OAAO,IAAI,sBAAsB,CAE3C;CACD;AAED,qBAAa,cAAe,SAAQ,sBAAuB,YAAW,qBAAqB;IAC1E,MAAM,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,CAI7D;IAEF,OAAO,CAAC,gBAAgB;IAMxB,IAAoB,OAAO,IAAI,sBAAsB,CAEpD;CACD;AAED,qBAAa,iBAAkB,SAAQ,SAAU,YAAW,qBAAqB;IACzE,MAAM,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAOvD;IAEF,OAAO,CAAC,cAAc;IAMtB,IAAW,OAAO,IAAI,sBAAsB,GAAG,SAAS,CAEvD;CACD;AAED,qBAAa,kBAAmB,SAAQ,SAAS;CAAG"}
|
|
@@ -36,7 +36,7 @@ function makeField(context, schema, cursor) {
|
|
|
36
36
|
let usedAnchor = false;
|
|
37
37
|
const makeFlexTreeField = () => {
|
|
38
38
|
usedAnchor = true;
|
|
39
|
-
const field = new (kindToClass.get(schema
|
|
39
|
+
const field = new (kindToClass.get(schema) ?? (0, index_js_2.fail)("missing field implementation"))(context, schema, cursor, fieldAnchor);
|
|
40
40
|
return field;
|
|
41
41
|
};
|
|
42
42
|
if (fieldAnchor.parent === undefined) {
|
|
@@ -67,11 +67,9 @@ class LazyField extends lazyEntity_js_1.LazyEntity {
|
|
|
67
67
|
get [flexTreeTypes_js_1.flexTreeMarker]() {
|
|
68
68
|
return flexTreeTypes_js_1.FlexTreeEntityKind.Field;
|
|
69
69
|
}
|
|
70
|
-
get schema() {
|
|
71
|
-
return this.flexSchema.stored;
|
|
72
|
-
}
|
|
73
70
|
constructor(context, schema, cursor, fieldAnchor) {
|
|
74
|
-
super(context,
|
|
71
|
+
super(context, cursor, fieldAnchor);
|
|
72
|
+
this.schema = schema;
|
|
75
73
|
(0, internal_1.assert)(cursor.mode === 1 /* CursorLocationType.Fields */, 0x77b /* must be in fields mode */);
|
|
76
74
|
this.key = cursor.getFieldKey();
|
|
77
75
|
// Fields currently live as long as their parent does.
|
|
@@ -85,8 +83,8 @@ class LazyField extends lazyEntity_js_1.LazyEntity {
|
|
|
85
83
|
}
|
|
86
84
|
}
|
|
87
85
|
is(kind) {
|
|
88
|
-
(0, internal_1.assert)(this.context.
|
|
89
|
-
return this.
|
|
86
|
+
(0, internal_1.assert)(this.context.schemaPolicy.fieldKinds.get(kind.identifier) === kind, 0xa26 /* Narrowing must be done to a kind that exists in this context */);
|
|
87
|
+
return this.schema === kind.identifier;
|
|
90
88
|
}
|
|
91
89
|
get parent() {
|
|
92
90
|
if (this[lazyEntity_js_1.anchorSymbol].parent === undefined) {
|
|
@@ -152,8 +150,8 @@ class LazyField extends lazyEntity_js_1.LazyEntity {
|
|
|
152
150
|
}
|
|
153
151
|
exports.LazyField = LazyField;
|
|
154
152
|
class LazySequence extends LazyField {
|
|
155
|
-
constructor(
|
|
156
|
-
super(
|
|
153
|
+
constructor() {
|
|
154
|
+
super(...arguments);
|
|
157
155
|
this.editor = {
|
|
158
156
|
insert: (index, newContent) => {
|
|
159
157
|
this.sequenceEditor().insert(index, (0, mapTreeCursor_js_1.cursorForMapTreeField)(newContent));
|
|
@@ -180,8 +178,8 @@ class LazySequence extends LazyField {
|
|
|
180
178
|
}
|
|
181
179
|
exports.LazySequence = LazySequence;
|
|
182
180
|
class ReadonlyLazyValueField extends LazyField {
|
|
183
|
-
constructor(
|
|
184
|
-
super(
|
|
181
|
+
constructor() {
|
|
182
|
+
super(...arguments);
|
|
185
183
|
this.editor = {
|
|
186
184
|
set: (newContent) => {
|
|
187
185
|
(0, internal_1.assert)(false, 0xa0c /* Unexpected set of readonly field */);
|
|
@@ -194,8 +192,8 @@ class ReadonlyLazyValueField extends LazyField {
|
|
|
194
192
|
}
|
|
195
193
|
exports.ReadonlyLazyValueField = ReadonlyLazyValueField;
|
|
196
194
|
class LazyValueField extends ReadonlyLazyValueField {
|
|
197
|
-
constructor(
|
|
198
|
-
super(
|
|
195
|
+
constructor() {
|
|
196
|
+
super(...arguments);
|
|
199
197
|
this.editor = {
|
|
200
198
|
set: (newContent) => {
|
|
201
199
|
this.valueFieldEditor().set((0, mapTreeCursor_js_1.cursorForMapTreeNode)(newContent));
|
|
@@ -213,8 +211,8 @@ class LazyValueField extends ReadonlyLazyValueField {
|
|
|
213
211
|
}
|
|
214
212
|
exports.LazyValueField = LazyValueField;
|
|
215
213
|
class LazyOptionalField extends LazyField {
|
|
216
|
-
constructor(
|
|
217
|
-
super(
|
|
214
|
+
constructor() {
|
|
215
|
+
super(...arguments);
|
|
218
216
|
this.editor = {
|
|
219
217
|
set: (newContent, wasEmpty) => {
|
|
220
218
|
this.optionalEditor().set(newContent !== undefined ? (0, mapTreeCursor_js_1.cursorForMapTreeNode)(newContent) : newContent, wasEmpty);
|
|
@@ -235,11 +233,11 @@ class LazyForbiddenField extends LazyField {
|
|
|
235
233
|
}
|
|
236
234
|
exports.LazyForbiddenField = LazyForbiddenField;
|
|
237
235
|
const builderList = [
|
|
238
|
-
[index_js_3.FieldKinds.forbidden, LazyForbiddenField],
|
|
239
|
-
[index_js_3.FieldKinds.optional, LazyOptionalField],
|
|
240
|
-
[index_js_3.FieldKinds.sequence, LazySequence],
|
|
241
|
-
[index_js_3.FieldKinds.required, LazyValueField],
|
|
242
|
-
[index_js_3.FieldKinds.identifier, LazyValueField],
|
|
236
|
+
[index_js_3.FieldKinds.forbidden.identifier, LazyForbiddenField],
|
|
237
|
+
[index_js_3.FieldKinds.optional.identifier, LazyOptionalField],
|
|
238
|
+
[index_js_3.FieldKinds.sequence.identifier, LazySequence],
|
|
239
|
+
[index_js_3.FieldKinds.required.identifier, LazyValueField],
|
|
240
|
+
[index_js_3.FieldKinds.identifier.identifier, LazyValueField],
|
|
243
241
|
];
|
|
244
242
|
const kindToClass = new Map(builderList);
|
|
245
243
|
//# sourceMappingURL=lazyField.js.map
|