@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
|
@@ -3,31 +3,23 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { oob } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { Lazy, oob } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
|
|
9
9
|
import { EmptyKey, type ExclusiveMapTree } from "../core/index.js";
|
|
10
10
|
import {
|
|
11
|
-
type FlexTreeNodeSchema,
|
|
12
11
|
type FlexTreeNode,
|
|
13
12
|
type FlexTreeSequenceField,
|
|
14
|
-
type MapTreeNode,
|
|
15
|
-
getOrCreateMapTreeNode,
|
|
16
13
|
getSchemaAndPolicy,
|
|
17
14
|
isFlexTreeNode,
|
|
18
|
-
isMapTreeSequenceField,
|
|
19
|
-
UnhydratedContext,
|
|
20
15
|
} from "../feature-libraries/index.js";
|
|
21
|
-
import {
|
|
16
|
+
import { prepareContentForHydration } from "./proxies.js";
|
|
22
17
|
import { getOrCreateInnerNode } from "./proxyBinding.js";
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
ImplicitAllowedTypes,
|
|
29
|
-
InsertableTreeNodeFromImplicitAllowedTypes,
|
|
30
|
-
TreeNodeFromImplicitAllowedTypes,
|
|
18
|
+
import {
|
|
19
|
+
normalizeAllowedTypes,
|
|
20
|
+
type ImplicitAllowedTypes,
|
|
21
|
+
type InsertableTreeNodeFromImplicitAllowedTypes,
|
|
22
|
+
type TreeNodeFromImplicitAllowedTypes,
|
|
31
23
|
} from "./schemaTypes.js";
|
|
32
24
|
import {
|
|
33
25
|
type WithType,
|
|
@@ -36,15 +28,22 @@ import {
|
|
|
36
28
|
NodeKind,
|
|
37
29
|
type TreeNode,
|
|
38
30
|
type InternalTreeNode,
|
|
39
|
-
type TreeNodeSchemaClass,
|
|
40
31
|
type TreeNodeSchema,
|
|
41
32
|
typeSchemaSymbol,
|
|
33
|
+
type Context,
|
|
34
|
+
getOrCreateNodeFromInnerNode,
|
|
35
|
+
type TreeNodeSchemaBoth,
|
|
36
|
+
getSimpleNodeSchemaFromInnerNode,
|
|
42
37
|
} from "./core/index.js";
|
|
43
38
|
import { type InsertableContent, mapTreeFromNodeData } from "./toMapTree.js";
|
|
44
39
|
import { fail } from "../util/index.js";
|
|
45
|
-
import {
|
|
46
|
-
|
|
40
|
+
import {
|
|
41
|
+
getKernel,
|
|
42
|
+
UnhydratedFlexTreeNode,
|
|
43
|
+
UnhydratedTreeSequenceField,
|
|
44
|
+
} from "./core/index.js";
|
|
47
45
|
import { TreeNodeValid, type MostDerivedData } from "./treeNodeValid.js";
|
|
46
|
+
import { getUnhydratedContext } from "./createContext.js";
|
|
48
47
|
|
|
49
48
|
/**
|
|
50
49
|
* A generic array type, used to defined types like {@link (TreeArrayNode:interface)}.
|
|
@@ -132,23 +131,89 @@ export interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom>
|
|
|
132
131
|
|
|
133
132
|
/**
|
|
134
133
|
* Moves the specified item to the desired location in the array.
|
|
135
|
-
*
|
|
136
|
-
*
|
|
134
|
+
*
|
|
135
|
+
* WARNING - This API is easily misused.
|
|
136
|
+
* Please read the documentation for the `destinationGap` parameter carefully.
|
|
137
|
+
*
|
|
138
|
+
* @param destinationGap - The location *between* existing items that the moved item should be moved to.
|
|
139
|
+
*
|
|
140
|
+
* WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.
|
|
141
|
+
*
|
|
142
|
+
* For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:
|
|
143
|
+
*
|
|
144
|
+
* - `0` (between the start of the array and `A`'s original position)
|
|
145
|
+
* - `1` (between `A`'s original position and `B`'s original position)
|
|
146
|
+
* - `2` (between `B`'s original position and `C`'s original position)
|
|
147
|
+
* - `3` (between `C`'s original position and the end of the array)
|
|
148
|
+
*
|
|
149
|
+
* So moving `A` between `B` and `C` would require `destinationGap` to be `2`.
|
|
150
|
+
*
|
|
151
|
+
* This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,
|
|
152
|
+
* or relative to the start or end of the array:
|
|
153
|
+
*
|
|
154
|
+
* - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)
|
|
155
|
+
* - Move to before some item X: `array.moveToIndex(indexOfX, ...)`
|
|
156
|
+
* - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)
|
|
157
|
+
* - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)
|
|
158
|
+
*
|
|
159
|
+
* This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:
|
|
160
|
+
*
|
|
161
|
+
* - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`
|
|
162
|
+
* - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`
|
|
163
|
+
*
|
|
164
|
+
* Notice the asymmetry between `-1` and `+2` in the above examples.
|
|
165
|
+
* In such scenarios, it can often be easier to approach such edits by swapping adjacent items:
|
|
166
|
+
* If items A and B are adjacent, such that A precedes B,
|
|
167
|
+
* then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.
|
|
168
|
+
*
|
|
137
169
|
* @param sourceIndex - The index of the item to move.
|
|
138
170
|
* @throws Throws if any of the input indices are not in the range [0, `array.length`).
|
|
139
171
|
*/
|
|
140
|
-
moveToIndex(
|
|
172
|
+
moveToIndex(destinationGap: number, sourceIndex: number): void;
|
|
141
173
|
|
|
142
174
|
/**
|
|
143
175
|
* Moves the specified item to the desired location in the array.
|
|
144
|
-
*
|
|
145
|
-
*
|
|
176
|
+
*
|
|
177
|
+
* WARNING - This API is easily misused.
|
|
178
|
+
* Please read the documentation for the `destinationGap` parameter carefully.
|
|
179
|
+
*
|
|
180
|
+
* @param destinationGap - The location *between* existing items that the moved item should be moved to.
|
|
181
|
+
*
|
|
182
|
+
* WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.
|
|
183
|
+
*
|
|
184
|
+
* For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:
|
|
185
|
+
*
|
|
186
|
+
* - `0` (between the start of the array and `A`'s original position)
|
|
187
|
+
* - `1` (between `A`'s original position and `B`'s original position)
|
|
188
|
+
* - `2` (between `B`'s original position and `C`'s original position)
|
|
189
|
+
* - `3` (between `C`'s original position and the end of the array)
|
|
190
|
+
*
|
|
191
|
+
* So moving `A` between `B` and `C` would require `destinationGap` to be `2`.
|
|
192
|
+
*
|
|
193
|
+
* This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,
|
|
194
|
+
* or relative to the start or end of the array:
|
|
195
|
+
*
|
|
196
|
+
* - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)
|
|
197
|
+
* - Move to before some item X: `array.moveToIndex(indexOfX, ...)`
|
|
198
|
+
* - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)
|
|
199
|
+
* - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)
|
|
200
|
+
*
|
|
201
|
+
* This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:
|
|
202
|
+
*
|
|
203
|
+
* - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`
|
|
204
|
+
* - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`
|
|
205
|
+
*
|
|
206
|
+
* Notice the asymmetry between `-1` and `+2` in the above examples.
|
|
207
|
+
* In such scenarios, it can often be easier to approach such edits by swapping adjacent items:
|
|
208
|
+
* If items A and B are adjacent, such that A precedes B,
|
|
209
|
+
* then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.
|
|
210
|
+
*
|
|
146
211
|
* @param sourceIndex - The index of the item to move.
|
|
147
212
|
* @param source - The source array to move the item out of.
|
|
148
213
|
* @throws Throws if any of the source index is not in the range [0, `array.length`),
|
|
149
214
|
* or if the index is not in the range [0, `array.length`].
|
|
150
215
|
*/
|
|
151
|
-
moveToIndex(
|
|
216
|
+
moveToIndex(destinationGap: number, sourceIndex: number, source: TMoveFrom): void;
|
|
152
217
|
|
|
153
218
|
/**
|
|
154
219
|
* Moves the specified items to the start of the array.
|
|
@@ -192,18 +257,85 @@ export interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom>
|
|
|
192
257
|
|
|
193
258
|
/**
|
|
194
259
|
* Moves the specified items to the desired location within the array.
|
|
195
|
-
*
|
|
196
|
-
*
|
|
260
|
+
*
|
|
261
|
+
* WARNING - This API is easily misused.
|
|
262
|
+
* Please read the documentation for the `destinationGap` parameter carefully.
|
|
263
|
+
*
|
|
264
|
+
* @param destinationGap - The location *between* existing items that the moved item should be moved to.
|
|
265
|
+
*
|
|
266
|
+
* WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.
|
|
267
|
+
*
|
|
268
|
+
* For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:
|
|
269
|
+
*
|
|
270
|
+
* - `0` (between the start of the array and `A`'s original position)
|
|
271
|
+
* - `1` (between `A`'s original position and `B`'s original position)
|
|
272
|
+
* - `2` (between `B`'s original position and `C`'s original position)
|
|
273
|
+
* - `3` (between `C`'s original position and the end of the array)
|
|
274
|
+
*
|
|
275
|
+
* So moving `A` between `B` and `C` would require `destinationGap` to be `2`.
|
|
276
|
+
*
|
|
277
|
+
* This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,
|
|
278
|
+
* or relative to the start or end of the array:
|
|
279
|
+
*
|
|
280
|
+
* - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)
|
|
281
|
+
* - Move to before some item X: `array.moveToIndex(indexOfX, ...)`
|
|
282
|
+
* - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)
|
|
283
|
+
* - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)
|
|
284
|
+
*
|
|
285
|
+
* This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:
|
|
286
|
+
*
|
|
287
|
+
* - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`
|
|
288
|
+
* - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`
|
|
289
|
+
*
|
|
290
|
+
* Notice the asymmetry between `-1` and `+2` in the above examples.
|
|
291
|
+
* In such scenarios, it can often be easier to approach such edits by swapping adjacent items:
|
|
292
|
+
* If items A and B are adjacent, such that A precedes B,
|
|
293
|
+
* then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.
|
|
294
|
+
*
|
|
197
295
|
* @param sourceStart - The starting index of the range to move (inclusive).
|
|
198
296
|
* @param sourceEnd - The ending index of the range to move (exclusive)
|
|
199
297
|
* @throws Throws if any of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.
|
|
200
298
|
* if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.
|
|
201
299
|
*/
|
|
202
|
-
moveRangeToIndex(
|
|
300
|
+
moveRangeToIndex(destinationGap: number, sourceStart: number, sourceEnd: number): void;
|
|
203
301
|
|
|
204
302
|
/**
|
|
205
303
|
* Moves the specified items to the desired location within the array.
|
|
206
|
-
*
|
|
304
|
+
*
|
|
305
|
+
* WARNING - This API is easily misused.
|
|
306
|
+
* Please read the documentation for the `destinationGap` parameter carefully.
|
|
307
|
+
*
|
|
308
|
+
* @param destinationGap - The location *between* existing items that the moved item should be moved to.
|
|
309
|
+
*
|
|
310
|
+
* WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.
|
|
311
|
+
*
|
|
312
|
+
* For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:
|
|
313
|
+
*
|
|
314
|
+
* - `0` (between the start of the array and `A`'s original position)
|
|
315
|
+
* - `1` (between `A`'s original position and `B`'s original position)
|
|
316
|
+
* - `2` (between `B`'s original position and `C`'s original position)
|
|
317
|
+
* - `3` (between `C`'s original position and the end of the array)
|
|
318
|
+
*
|
|
319
|
+
* So moving `A` between `B` and `C` would require `destinationGap` to be `2`.
|
|
320
|
+
*
|
|
321
|
+
* This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,
|
|
322
|
+
* or relative to the start or end of the array:
|
|
323
|
+
*
|
|
324
|
+
* - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)
|
|
325
|
+
* - Move to before some item X: `array.moveToIndex(indexOfX, ...)`
|
|
326
|
+
* - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)
|
|
327
|
+
* - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)
|
|
328
|
+
*
|
|
329
|
+
* This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:
|
|
330
|
+
*
|
|
331
|
+
* - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`
|
|
332
|
+
* - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`
|
|
333
|
+
*
|
|
334
|
+
* Notice the asymmetry between `-1` and `+2` in the above examples.
|
|
335
|
+
* In such scenarios, it can often be easier to approach such edits by swapping adjacent items:
|
|
336
|
+
* If items A and B are adjacent, such that A precedes B,
|
|
337
|
+
* then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.
|
|
338
|
+
*
|
|
207
339
|
* @param sourceStart - The starting index of the range to move (inclusive).
|
|
208
340
|
* @param sourceEnd - The ending index of the range to move (exclusive)
|
|
209
341
|
* @param source - The source array to move items out of.
|
|
@@ -211,7 +343,7 @@ export interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom>
|
|
|
211
343
|
* if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.
|
|
212
344
|
*/
|
|
213
345
|
moveRangeToIndex(
|
|
214
|
-
|
|
346
|
+
destinationGap: number,
|
|
215
347
|
sourceStart: number,
|
|
216
348
|
sourceEnd: number,
|
|
217
349
|
source: TMoveFrom,
|
|
@@ -559,7 +691,7 @@ function createArrayNodeProxy(
|
|
|
559
691
|
|
|
560
692
|
const maybeContent = field.at(maybeIndex);
|
|
561
693
|
return isFlexTreeNode(maybeContent)
|
|
562
|
-
?
|
|
694
|
+
? getOrCreateNodeFromInnerNode(maybeContent)
|
|
563
695
|
: maybeContent;
|
|
564
696
|
},
|
|
565
697
|
set: (target, key, newValue, receiver) => {
|
|
@@ -619,7 +751,7 @@ function createArrayNodeProxy(
|
|
|
619
751
|
// To satisfy 'deepEquals' level scrutiny, the property descriptor for indexed properties must
|
|
620
752
|
// be a simple value property (as opposed to using getter) and declared writable/enumerable/configurable.
|
|
621
753
|
return {
|
|
622
|
-
value: isFlexTreeNode(val) ?
|
|
754
|
+
value: isFlexTreeNode(val) ? getOrCreateNodeFromInnerNode(val) : val,
|
|
623
755
|
writable: true, // For MVP, setting indexed properties is reported as allowed here (for deep equals compatibility noted above), but not actually supported.
|
|
624
756
|
enumerable: true,
|
|
625
757
|
configurable: true,
|
|
@@ -665,6 +797,7 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>
|
|
|
665
797
|
public static readonly kind = NodeKind.Array;
|
|
666
798
|
|
|
667
799
|
protected abstract get simpleSchema(): T;
|
|
800
|
+
protected abstract get allowedTypes(): ReadonlySet<TreeNodeSchema>;
|
|
668
801
|
|
|
669
802
|
public constructor(
|
|
670
803
|
input: Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>> | InternalTreeNode,
|
|
@@ -736,7 +869,7 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>
|
|
|
736
869
|
return val;
|
|
737
870
|
}
|
|
738
871
|
|
|
739
|
-
return
|
|
872
|
+
return getOrCreateNodeFromInnerNode(val) as TreeNodeFromImplicitAllowedTypes<T>;
|
|
740
873
|
}
|
|
741
874
|
public insertAt(index: number, ...value: Insertable<T>): void {
|
|
742
875
|
const field = getSequenceField(this);
|
|
@@ -781,16 +914,16 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>
|
|
|
781
914
|
this.moveRangeToIndex(this.length, sourceIndex, sourceIndex + 1, source);
|
|
782
915
|
}
|
|
783
916
|
public moveToIndex(
|
|
784
|
-
|
|
917
|
+
destinationGap: number,
|
|
785
918
|
sourceIndex: number,
|
|
786
919
|
source?: TreeArrayNode,
|
|
787
920
|
): void {
|
|
788
921
|
const sourceArray = source ?? this;
|
|
789
922
|
const sourceField = getSequenceField(sourceArray);
|
|
790
923
|
const destinationField = getSequenceField(this);
|
|
791
|
-
validateIndex(
|
|
924
|
+
validateIndex(destinationGap, destinationField, "moveToIndex", true);
|
|
792
925
|
validateIndex(sourceIndex, sourceField, "moveToIndex");
|
|
793
|
-
this.moveRangeToIndex(
|
|
926
|
+
this.moveRangeToIndex(destinationGap, sourceIndex, sourceIndex + 1, source);
|
|
794
927
|
}
|
|
795
928
|
public moveRangeToStart(
|
|
796
929
|
sourceStart: number,
|
|
@@ -815,22 +948,24 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>
|
|
|
815
948
|
this.moveRangeToIndex(this.length, sourceStart, sourceEnd, source);
|
|
816
949
|
}
|
|
817
950
|
public moveRangeToIndex(
|
|
818
|
-
|
|
951
|
+
destinationGap: number,
|
|
819
952
|
sourceStart: number,
|
|
820
953
|
sourceEnd: number,
|
|
821
954
|
source?: TreeArrayNode,
|
|
822
955
|
): void {
|
|
823
956
|
const destinationField = getSequenceField(this);
|
|
957
|
+
const destinationSchema = this.allowedTypes;
|
|
824
958
|
const sourceField = source !== undefined ? getSequenceField(source) : destinationField;
|
|
825
959
|
|
|
826
|
-
validateIndex(
|
|
960
|
+
validateIndex(destinationGap, destinationField, "moveRangeToIndex", true);
|
|
827
961
|
validateIndexRange(sourceStart, sourceEnd, source ?? destinationField, "moveRangeToIndex");
|
|
828
962
|
|
|
829
963
|
// TODO: determine support for move across different sequence types
|
|
830
964
|
if (sourceField !== destinationField) {
|
|
831
965
|
for (let i = sourceStart; i < sourceEnd; i++) {
|
|
832
966
|
const sourceNode = sourceField.boxedAt(i) ?? oob();
|
|
833
|
-
|
|
967
|
+
const sourceSchema = getSimpleNodeSchemaFromInnerNode(sourceNode);
|
|
968
|
+
if (!destinationSchema.has(sourceSchema)) {
|
|
834
969
|
throw new UsageError("Type in source sequence is not allowed in destination.");
|
|
835
970
|
}
|
|
836
971
|
}
|
|
@@ -838,20 +973,26 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>
|
|
|
838
973
|
|
|
839
974
|
const movedCount = sourceEnd - sourceStart;
|
|
840
975
|
if (!destinationField.context.isHydrated()) {
|
|
841
|
-
if (!
|
|
976
|
+
if (!(sourceField instanceof UnhydratedTreeSequenceField)) {
|
|
842
977
|
throw new UsageError(
|
|
843
978
|
"Cannot move elements from an unhydrated array to a hydrated array.",
|
|
844
979
|
);
|
|
845
980
|
}
|
|
846
981
|
|
|
847
|
-
if (sourceField
|
|
982
|
+
if (sourceField.context.isHydrated()) {
|
|
983
|
+
throw new UsageError(
|
|
984
|
+
"Cannot move elements from an unhydrated array to a hydrated array.",
|
|
985
|
+
);
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
if (sourceField !== destinationField || destinationGap < sourceStart) {
|
|
848
989
|
destinationField.editor.insert(
|
|
849
|
-
|
|
990
|
+
destinationGap,
|
|
850
991
|
sourceField.editor.remove(sourceStart, movedCount),
|
|
851
992
|
);
|
|
852
|
-
} else if (
|
|
993
|
+
} else if (destinationGap > sourceStart + movedCount) {
|
|
853
994
|
destinationField.editor.insert(
|
|
854
|
-
|
|
995
|
+
destinationGap - movedCount,
|
|
855
996
|
sourceField.editor.remove(sourceStart, movedCount),
|
|
856
997
|
);
|
|
857
998
|
}
|
|
@@ -870,7 +1011,7 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>
|
|
|
870
1011
|
sourceStart,
|
|
871
1012
|
movedCount,
|
|
872
1013
|
destinationField.getFieldPath(),
|
|
873
|
-
|
|
1014
|
+
destinationGap,
|
|
874
1015
|
);
|
|
875
1016
|
}
|
|
876
1017
|
}
|
|
@@ -910,7 +1051,7 @@ export function arraySchema<
|
|
|
910
1051
|
implicitlyConstructable: ImplicitlyConstructable,
|
|
911
1052
|
customizable: boolean,
|
|
912
1053
|
) {
|
|
913
|
-
type Output =
|
|
1054
|
+
type Output = TreeNodeSchemaBoth<
|
|
914
1055
|
TName,
|
|
915
1056
|
NodeKind.Array,
|
|
916
1057
|
TreeArrayNode<T> & WithType<TName, NodeKind.Array>,
|
|
@@ -918,8 +1059,10 @@ export function arraySchema<
|
|
|
918
1059
|
ImplicitlyConstructable,
|
|
919
1060
|
T
|
|
920
1061
|
>;
|
|
921
|
-
|
|
922
|
-
|
|
1062
|
+
|
|
1063
|
+
const lazyChildTypes = new Lazy(() => normalizeAllowedTypes(info));
|
|
1064
|
+
|
|
1065
|
+
let unhydratedContext: Context;
|
|
923
1066
|
|
|
924
1067
|
// This class returns a proxy from its constructor to handle numeric indexing.
|
|
925
1068
|
// Alternatively it could extend a normal class which gets tons of numeric properties added.
|
|
@@ -948,20 +1091,18 @@ export function arraySchema<
|
|
|
948
1091
|
this: typeof TreeNodeValid<T2>,
|
|
949
1092
|
instance: TreeNodeValid<T2>,
|
|
950
1093
|
input: T2,
|
|
951
|
-
):
|
|
952
|
-
return
|
|
1094
|
+
): UnhydratedFlexTreeNode {
|
|
1095
|
+
return UnhydratedFlexTreeNode.getOrCreate(
|
|
953
1096
|
unhydratedContext,
|
|
954
|
-
flexSchema,
|
|
955
1097
|
mapTreeFromNodeData(input as object, this as unknown as ImplicitAllowedTypes),
|
|
956
1098
|
);
|
|
957
1099
|
}
|
|
958
1100
|
|
|
959
1101
|
protected static override constructorCached: MostDerivedData | undefined = undefined;
|
|
960
1102
|
|
|
961
|
-
protected static override oneTimeSetup<T2>(this: typeof TreeNodeValid<T2>):
|
|
1103
|
+
protected static override oneTimeSetup<T2>(this: typeof TreeNodeValid<T2>): Context {
|
|
962
1104
|
const schema = this as unknown as TreeNodeSchema;
|
|
963
|
-
|
|
964
|
-
unhydratedContext = new UnhydratedContext(toFlexSchema(schema));
|
|
1105
|
+
unhydratedContext = getUnhydratedContext(schema);
|
|
965
1106
|
|
|
966
1107
|
// First run, do extra validation.
|
|
967
1108
|
// TODO: provide a way for TreeConfiguration to trigger this same validation to ensure it gets run early.
|
|
@@ -987,12 +1128,17 @@ export function arraySchema<
|
|
|
987
1128
|
prototype = Reflect.getPrototypeOf(prototype) as object;
|
|
988
1129
|
}
|
|
989
1130
|
}
|
|
1131
|
+
|
|
1132
|
+
return unhydratedContext;
|
|
990
1133
|
}
|
|
991
1134
|
|
|
992
1135
|
public static readonly identifier = identifier;
|
|
993
1136
|
public static readonly info = info;
|
|
994
1137
|
public static readonly implicitlyConstructable: ImplicitlyConstructable =
|
|
995
1138
|
implicitlyConstructable;
|
|
1139
|
+
public static get childTypes(): ReadonlySet<TreeNodeSchema> {
|
|
1140
|
+
return lazyChildTypes.value;
|
|
1141
|
+
}
|
|
996
1142
|
|
|
997
1143
|
// eslint-disable-next-line import/no-deprecated
|
|
998
1144
|
public get [typeNameSymbol](): TName {
|
|
@@ -1005,6 +1151,9 @@ export function arraySchema<
|
|
|
1005
1151
|
protected get simpleSchema(): T {
|
|
1006
1152
|
return info;
|
|
1007
1153
|
}
|
|
1154
|
+
protected get allowedTypes(): ReadonlySet<TreeNodeSchema> {
|
|
1155
|
+
return lazyChildTypes.value;
|
|
1156
|
+
}
|
|
1008
1157
|
}
|
|
1009
1158
|
|
|
1010
1159
|
const output: Output = Schema;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { anchorSlot, type TreeNodeSchemaIdentifier } from "../../core/index.js";
|
|
7
|
+
import type {
|
|
8
|
+
FlexTreeContext,
|
|
9
|
+
FlexTreeHydratedContext,
|
|
10
|
+
} from "../../feature-libraries/index.js";
|
|
11
|
+
import { brand } from "../../util/index.js";
|
|
12
|
+
import type { TreeNodeSchema } from "./treeNodeSchema.js";
|
|
13
|
+
import { walkAllowedTypes } from "./walkSchema.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Creating multiple simple tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.
|
|
17
|
+
* This slot is used to detect if one already exists and error if creating a second.
|
|
18
|
+
* @remarks
|
|
19
|
+
* See also {@link ContextSlot} in which the flex-tree context is stored.
|
|
20
|
+
*/
|
|
21
|
+
export const SimpleContextSlot = anchorSlot<HydratedContext>();
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Additional information about a collection of {@link TreeNode}s.
|
|
25
|
+
* @remarks
|
|
26
|
+
* Each TreeNode provides a way to navigate to a context for it with additional information.
|
|
27
|
+
*
|
|
28
|
+
* For unhydrated nodes, this information is rather limited since the node doesn't know what tree it might get inserted into (if any),
|
|
29
|
+
* and thus is limited to information derived about that particular unhydrated tree and its schema.
|
|
30
|
+
*
|
|
31
|
+
* Hydrated nodes have more contextual information, and thus can provide a single {@link HydratedContext} for all nodes in the document which can have additional information.
|
|
32
|
+
*
|
|
33
|
+
* @privateRemarks
|
|
34
|
+
* This design is the same as {@link FlexTreeContext} with its base type and {@link FlexTreeHydratedContext} extending it.
|
|
35
|
+
*/
|
|
36
|
+
export class Context {
|
|
37
|
+
/**
|
|
38
|
+
* All schema which could transitively be used under the associated node.
|
|
39
|
+
* @remarks
|
|
40
|
+
* While generally {@link TreeNodeSchema} are referenced as objects and thus do not need to be looked up by identifier,
|
|
41
|
+
* there are a few cases (mainly constructing new TreeNodes from existing tree data) where such a lookup is useful.
|
|
42
|
+
* Having this map in the context addresses this use-case.
|
|
43
|
+
* @privateRemarks
|
|
44
|
+
* This design mirrors how {@link FlexTreeSchema} are accessed off the {@link FlexTreeContext}, making the migration away from them simpler.
|
|
45
|
+
*/
|
|
46
|
+
public readonly schema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeSchema>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Builds the context.
|
|
50
|
+
* @remarks
|
|
51
|
+
* Since this walks the schema, it must not be invoked during schema declaration or schema forward references could fail to be resolved.
|
|
52
|
+
*/
|
|
53
|
+
public constructor(
|
|
54
|
+
rootSchema: Iterable<TreeNodeSchema>,
|
|
55
|
+
public readonly flexContext: FlexTreeContext,
|
|
56
|
+
) {
|
|
57
|
+
const schema: Map<TreeNodeSchemaIdentifier, TreeNodeSchema> = new Map();
|
|
58
|
+
walkAllowedTypes(rootSchema, {
|
|
59
|
+
node(nodeSchema) {
|
|
60
|
+
schema.set(brand(nodeSchema.identifier), nodeSchema);
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
this.schema = schema;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Extends {@link Context} with additional information from the view and/or tree which becomes known when a {@link TreeNode} is hydrated,
|
|
69
|
+
* associating it with the containing {@link TreeView}.
|
|
70
|
+
*/
|
|
71
|
+
export class HydratedContext extends Context {
|
|
72
|
+
public constructor(
|
|
73
|
+
rootSchema: Iterable<TreeNodeSchema>,
|
|
74
|
+
public override readonly flexContext: FlexTreeHydratedContext,
|
|
75
|
+
) {
|
|
76
|
+
super(rootSchema, flexContext);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { TreeValue } from "../../core/index.js";
|
|
7
|
+
import type { FlexTreeNode } from "../../feature-libraries/index.js";
|
|
8
|
+
import { fail } from "../../util/index.js";
|
|
9
|
+
import { type InnerNode, mapTreeNodeToProxy, proxySlot } from "./treeNodeKernel.js";
|
|
10
|
+
import { getSimpleNodeSchemaFromInnerNode } from "./schemaCaching.js";
|
|
11
|
+
import type { TreeNode, InternalTreeNode } from "./types.js";
|
|
12
|
+
import { UnhydratedFlexTreeNode } from "./unhydratedFlexTree.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Returns the TreeNode or TreeValue for the provided {@link InnerNode}.
|
|
16
|
+
* This will allocate a new one if needed, and otherwise return one from cache.
|
|
17
|
+
* @remarks
|
|
18
|
+
* This supports both hydrated and unhydrated nodes.
|
|
19
|
+
*/
|
|
20
|
+
export function getOrCreateNodeFromInnerNode(flexNode: InnerNode): TreeNode | TreeValue {
|
|
21
|
+
const cached =
|
|
22
|
+
flexNode instanceof UnhydratedFlexTreeNode
|
|
23
|
+
? mapTreeNodeToProxy.get(flexNode)
|
|
24
|
+
: flexNode.anchorNode.slots.get(proxySlot);
|
|
25
|
+
|
|
26
|
+
if (cached !== undefined) {
|
|
27
|
+
return cached;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const classSchema = getSimpleNodeSchemaFromInnerNode(flexNode) ?? fail("Missing schema");
|
|
31
|
+
const node = flexNode as unknown as InternalTreeNode;
|
|
32
|
+
// eslint-disable-next-line unicorn/prefer-ternary
|
|
33
|
+
if (typeof classSchema === "function") {
|
|
34
|
+
return new classSchema(node) as TreeNode;
|
|
35
|
+
} else {
|
|
36
|
+
return (classSchema as { create(data: FlexTreeNode): TreeValue }).create(flexNode);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -9,8 +9,8 @@ export {
|
|
|
9
9
|
getKernel,
|
|
10
10
|
tryGetTreeNodeSchema,
|
|
11
11
|
type InnerNode,
|
|
12
|
-
tryGetCachedTreeNode,
|
|
13
12
|
tryDisposeTreeNode,
|
|
13
|
+
tryGetTreeNodeFromMapNode,
|
|
14
14
|
} from "./treeNodeKernel.js";
|
|
15
15
|
export { type WithType, typeNameSymbol, typeSchemaSymbol } from "./withType.js";
|
|
16
16
|
export {
|
|
@@ -27,11 +27,15 @@ export {
|
|
|
27
27
|
type TreeNodeSchemaClass,
|
|
28
28
|
type TreeNodeSchemaNonClass,
|
|
29
29
|
type TreeNodeSchemaCore,
|
|
30
|
+
type TreeNodeSchemaBoth,
|
|
30
31
|
} from "./treeNodeSchema.js";
|
|
32
|
+
export { getSimpleNodeSchemaFromInnerNode } from "./schemaCaching.js";
|
|
33
|
+
export { walkAllowedTypes, type SchemaVisitor } from "./walkSchema.js";
|
|
34
|
+
export { Context, HydratedContext, SimpleContextSlot } from "./context.js";
|
|
35
|
+
export { getOrCreateNodeFromInnerNode } from "./getOrCreateNode.js";
|
|
31
36
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} from "./schemaCaching.js";
|
|
37
|
+
UnhydratedFlexTreeNode,
|
|
38
|
+
UnhydratedTreeSequenceField,
|
|
39
|
+
tryUnhydratedFlexTreeNode,
|
|
40
|
+
UnhydratedContext,
|
|
41
|
+
} from "./unhydratedFlexTree.js";
|